[Xfce4-commits] r26811 - xfce-mcs-plugins/branches/xfce-plugins-stephan/plugins/appearance-plugin

Stephan Arts stephan at xfce.org
Thu Apr 10 09:09:38 CEST 2008


Author: stephan
Date: 2008-04-10 07:09:38 +0000 (Thu, 10 Apr 2008)
New Revision: 26811

Modified:
   xfce-mcs-plugins/branches/xfce-plugins-stephan/plugins/appearance-plugin/main.c
   xfce-mcs-plugins/branches/xfce-plugins-stephan/plugins/appearance-plugin/ui-dialog.c
Log:
Add support for fonts, antialias and hinting



Modified: xfce-mcs-plugins/branches/xfce-plugins-stephan/plugins/appearance-plugin/main.c
===================================================================
--- xfce-mcs-plugins/branches/xfce-plugins-stephan/plugins/appearance-plugin/main.c	2008-04-09 20:41:20 UTC (rev 26810)
+++ xfce-mcs-plugins/branches/xfce-plugins-stephan/plugins/appearance-plugin/main.c	2008-04-10 07:09:38 UTC (rev 26811)
@@ -78,8 +78,9 @@
 
     ui_dialog_load_settings(UI_DIALOG(ui_dialog));
     gint result = gtk_dialog_run(GTK_DIALOG(ui_dialog));
-    if (result == GTK_RESPONSE_CLOSE)
+    if (result == GTK_RESPONSE_APPLY)
     {
+        gtk_widget_hide(ui_dialog);
         ui_dialog_save_settings(UI_DIALOG(ui_dialog));
     }
     

Modified: xfce-mcs-plugins/branches/xfce-plugins-stephan/plugins/appearance-plugin/ui-dialog.c
===================================================================
--- xfce-mcs-plugins/branches/xfce-plugins-stephan/plugins/appearance-plugin/ui-dialog.c	2008-04-09 20:41:20 UTC (rev 26810)
+++ xfce-mcs-plugins/branches/xfce-plugins-stephan/plugins/appearance-plugin/ui-dialog.c	2008-04-10 07:09:38 UTC (rev 26811)
@@ -1,5 +1,5 @@
 /*
- *  Copyright (C) Stephan Arts 2006-2008 <stephan at xfce.org>
+ *  Copyright (C) Stephan Arts 2008 <stephan at xfce.org>
  *
  *  This program is free software; you can redistribute it and/or modify
  *  it under the terms of the GNU General Public License as published by
@@ -37,7 +37,8 @@
 struct _UIDialogPriv
 {
     GtkWidget *heading;
-    GtkWidget *close_button;
+    GtkWidget *apply_button;
+    GtkWidget *cancel_button;
     GtkWidget *separator;
     GtkWidget *notebook;
 
@@ -53,6 +54,15 @@
     struct {
         GtkWidget *font_label;
         GtkWidget *font_box;
+
+        GtkWidget *style_box;
+        GtkWidget *style_frame;
+        GtkWidget *style_combo;
+          
+        GtkWidget *antialias_box;
+        GtkWidget *antialias_frame;
+        GtkWidget *antialias_checkbox;
+        GtkWidget *hinting_checkbox;
     } font;
 
     struct {
@@ -109,6 +119,24 @@
     gtk_notebook_append_page(GTK_NOTEBOOK(priv->notebook), priv->font.font_box, priv->font.font_label);
     gtk_container_set_border_width(GTK_CONTAINER(priv->font.font_box), 3);
 
+    priv->font.style_box = gtk_vbox_new(FALSE, 0);
+    priv->font.style_frame = xfce_create_framebox_with_content(_("Style"), priv->font.style_box);
+    gtk_box_pack_start(GTK_BOX(priv->font.font_box), priv->font.style_frame, FALSE, FALSE, 0);
+
+    priv->font.style_combo = gtk_font_button_new();
+    gtk_box_pack_start(GTK_BOX(priv->font.style_box), priv->font.style_combo, FALSE, FALSE, 0);
+
+    priv->font.antialias_box = gtk_vbox_new(FALSE, 0);
+    priv->font.antialias_frame = xfce_create_framebox_with_content(_("Antialias fonts"), priv->font.antialias_box);
+    gtk_box_pack_start(GTK_BOX(priv->font.font_box), priv->font.antialias_frame, FALSE, FALSE, 0);
+    
+    priv->font.antialias_checkbox = gtk_check_button_new_with_mnemonic(_("_Enable Antialias"));
+    priv->font.hinting_checkbox = gtk_check_button_new_with_mnemonic(_("_Enable Hinting"));
+
+    gtk_box_pack_start(GTK_BOX(priv->font.antialias_box), priv->font.antialias_checkbox, FALSE, FALSE, 0);
+    gtk_box_pack_start(GTK_BOX(priv->font.antialias_box), priv->font.hinting_checkbox, FALSE, FALSE, 0);
+
+
     priv->behaviour.behaviour_label = gtk_label_new_with_mnemonic(_("_Behaviour"));
     priv->behaviour.behaviour_box = gtk_vbox_new(FALSE, 0);
     gtk_notebook_append_page(GTK_NOTEBOOK(priv->notebook), priv->behaviour.behaviour_box, priv->behaviour.behaviour_label);
@@ -158,8 +186,10 @@
     gtk_notebook_append_page(GTK_NOTEBOOK(priv->notebook), priv->desktop.desktop_box, priv->desktop.desktop_label);
     gtk_container_set_border_width(GTK_CONTAINER(priv->desktop.desktop_box), 3);
 
-    priv->close_button = gtk_button_new_from_stock(GTK_STOCK_CLOSE);
-    gtk_dialog_add_action_widget(GTK_DIALOG(ui_dialog), priv->close_button, GTK_RESPONSE_CLOSE);
+    priv->cancel_button = gtk_button_new_from_stock(GTK_STOCK_CANCEL);
+    gtk_dialog_add_action_widget(GTK_DIALOG(ui_dialog), priv->cancel_button, GTK_RESPONSE_CANCEL);
+    priv->apply_button = gtk_button_new_from_stock(GTK_STOCK_APPLY);
+    gtk_dialog_add_action_widget(GTK_DIALOG(ui_dialog), priv->apply_button, GTK_RESPONSE_APPLY);
 }
 
 static void
@@ -195,7 +225,17 @@
            GTK_TOGGLE_BUTTON(priv->behaviour.menu_accel_check),
            xfconf_channel_get_bool(priv->channels.xsettings, "/Gtk/CanChangeAccels", FALSE));
 
+    gtk_toggle_button_set_active(
+            GTK_TOGGLE_BUTTON(priv->font.antialias_checkbox),
+            xfconf_channel_get_bool(priv->channels.xsettings, "/Xft/Antialias", FALSE));
+    gtk_toggle_button_set_active(
+            GTK_TOGGLE_BUTTON(priv->font.hinting_checkbox),
+            xfconf_channel_get_bool(priv->channels.xsettings, "/Xft/Hinting", FALSE));
 
+    const gchar *font_name = xfconf_channel_get_string(priv->channels.xsettings, "/Gtk/FontName", "Sans 10");
+
+    gtk_font_button_set_font_name(GTK_FONT_BUTTON(priv->font.style_combo), font_name);
+
     return FALSE;
 };
 
@@ -226,5 +266,17 @@
             "/Gtk/CanChangeAccels",
             gtk_toggle_button_get_active(
                     GTK_TOGGLE_BUTTON(priv->behaviour.menu_accel_check)));
+    xfconf_channel_set_bool(
+            priv->channels.xsettings,
+            "/Xft/Antialias", gtk_toggle_button_get_active(
+                    GTK_TOGGLE_BUTTON(priv->font.antialias_checkbox)));
+    xfconf_channel_set_bool(
+            priv->channels.xsettings,
+            "/Xft/Hinting", gtk_toggle_button_get_active(
+                    GTK_TOGGLE_BUTTON(priv->font.hinting_checkbox)));
+    xfconf_channel_set_string(
+            priv->channels.xsettings,
+            "/Gtk/FontName", gtk_font_button_get_font_name(
+                    GTK_FONT_BUTTON(priv->font.style_combo)));
     return FALSE;
 };



More information about the Xfce4-commits mailing list