[Xfce4-commits] r26945 - xfce-mcs-plugins/branches/xfce-plugins-stephan/dialogs/appearance-settings
Stephan Arts
stephan at xfce.org
Sun May 11 13:00:47 CEST 2008
Author: stephan
Date: 2008-05-11 11:00:47 +0000 (Sun, 11 May 2008)
New Revision: 26945
Modified:
xfce-mcs-plugins/branches/xfce-plugins-stephan/dialogs/appearance-settings/appearance-dialog.glade
xfce-mcs-plugins/branches/xfce-plugins-stephan/dialogs/appearance-settings/main.c
Log:
Enable hinting support
Modified: xfce-mcs-plugins/branches/xfce-plugins-stephan/dialogs/appearance-settings/appearance-dialog.glade
===================================================================
--- xfce-mcs-plugins/branches/xfce-plugins-stephan/dialogs/appearance-settings/appearance-dialog.glade 2008-05-11 10:36:10 UTC (rev 26944)
+++ xfce-mcs-plugins/branches/xfce-plugins-stephan/dialogs/appearance-settings/appearance-dialog.glade 2008-05-11 11:00:47 UTC (rev 26945)
@@ -1,6 +1,6 @@
<?xml version="1.0" encoding="UTF-8" standalone="no"?>
<!DOCTYPE glade-interface SYSTEM "glade-2.0.dtd">
-<!--Generated with glade3 3.4.2 on Sun May 11 12:00:23 2008 -->
+<!--Generated with glade3 3.4.2 on Sun May 11 12:46:18 2008 -->
<glade-interface>
<requires lib="xfce4"/>
<widget class="GtkDialog" id="appearance-settings-dialog">
@@ -189,7 +189,7 @@
</packing>
</child>
<child>
- <widget class="GtkComboBox" id="xft_hinting_combo_box">
+ <widget class="GtkComboBox" id="xft_hinting_style_combo_box">
<property name="visible">True</property>
</widget>
<packing>
Modified: xfce-mcs-plugins/branches/xfce-plugins-stephan/dialogs/appearance-settings/main.c
===================================================================
--- xfce-mcs-plugins/branches/xfce-plugins-stephan/dialogs/appearance-settings/main.c 2008-05-11 10:36:10 UTC (rev 26944)
+++ xfce-mcs-plugins/branches/xfce-plugins-stephan/dialogs/appearance-settings/main.c 2008-05-11 11:00:47 UTC (rev 26945)
@@ -64,9 +64,51 @@
}
}
+void
+cb_hinting_style_combo_changed (GtkComboBox *combo, XfconfChannel *channel)
+{
+ switch (gtk_combo_box_get_active(combo))
+ {
+ case 0:
+ xfconf_channel_set_string (channel, "/Xft/HintStyle", "hintnone");
+ break;
+ case 1:
+ xfconf_channel_set_string (channel, "/Xft/HintStyle", "hintslight");
+ break;
+ case 2:
+ xfconf_channel_set_string (channel, "/Xft/HintStyle", "hintmedium");
+ break;
+ case 3:
+ xfconf_channel_set_string (channel, "/Xft/HintStyle", "hintfull");
+ break;
+ }
+}
+
+void
+cb_hinting_check_toggled (GtkToggleButton *toggle, XfconfChannel *channel)
+{
+ if (gtk_toggle_button_get_active(toggle))
+ {
+ xfconf_channel_set_int (channel, "/Xft/Hinting", 1);
+ }
+ else
+ {
+ xfconf_channel_set_int (channel, "/Xft/Hinting", 0);
+ }
+}
+
+void
+cb_hinting_check_toggled_ui (GtkToggleButton *toggle, GtkWidget *como)
+{
+ gtk_widget_set_sensitive(como, gtk_toggle_button_get_active(toggle));
+}
+
GtkWidget *
appearance_settings_dialog_new_from_xml (GladeXML *gxml)
{
+ GtkTreeIter iter;
+ GtkListStore *list_store;
+ GtkCellRenderer *renderer;
XfconfChannel *xsettings_channel = xfconf_channel_new("xsettings");
GtkWidget *can_edit_accels = glade_xml_get_widget (gxml, "gtk_caneditaccels_check_button");
@@ -76,10 +118,12 @@
GtkWidget *toolbar_style_combo = glade_xml_get_widget (gxml, "gtk_toolbar_style_combo_box");
GtkWidget *antialias_check_button = glade_xml_get_widget (gxml, "xft_antialias_check_button");
+ GtkWidget *hinting_style_combo = glade_xml_get_widget (gxml, "xft_hinting_style_combo_box");
+ GtkWidget *hinting_check = glade_xml_get_widget (gxml, "xft_hinting_check_button");
/* Fill the combo-boxes */
- GtkTreeIter iter;
- GtkListStore *list_store = gtk_list_store_new(1, G_TYPE_STRING);
+ /* ToolbarStyle combo */
+ list_store = gtk_list_store_new(1, G_TYPE_STRING);
gtk_list_store_append(list_store, &iter);
gtk_list_store_set(list_store, &iter, 0, N_("Icons"), -1);
gtk_list_store_append(list_store, &iter);
@@ -91,12 +135,30 @@
/* Should not need to clear the cell layout, doing it anyways. just to be sure */
gtk_cell_layout_clear (GTK_CELL_LAYOUT (toolbar_style_combo));
- GtkCellRenderer *renderer = gtk_cell_renderer_text_new();
+ renderer = gtk_cell_renderer_text_new();
gtk_cell_layout_pack_start (GTK_CELL_LAYOUT (toolbar_style_combo), renderer, TRUE);
gtk_cell_layout_add_attribute (GTK_CELL_LAYOUT (toolbar_style_combo), renderer, "text", 0);
gtk_combo_box_set_model (GTK_COMBO_BOX (toolbar_style_combo), GTK_TREE_MODEL(list_store));
+ /* Hinting Combo */
+ list_store = gtk_list_store_new(1, G_TYPE_STRING);
+ gtk_list_store_append(list_store, &iter);
+ gtk_list_store_set(list_store, &iter, 0, N_("No Hinting"), -1);
+ gtk_list_store_append(list_store, &iter);
+ gtk_list_store_set(list_store, &iter, 0, N_("Slight Hinting"), -1);
+ gtk_list_store_append(list_store, &iter);
+ gtk_list_store_set(list_store, &iter, 0, N_("Medium Hinting"), -1);
+ gtk_list_store_append(list_store, &iter);
+ gtk_list_store_set(list_store, &iter, 0, N_("Full Hinting"), -1);
+
+ gtk_cell_layout_clear (GTK_CELL_LAYOUT (hinting_style_combo));
+ renderer = gtk_cell_renderer_text_new();
+ gtk_cell_layout_pack_start (GTK_CELL_LAYOUT (hinting_style_combo), renderer, TRUE);
+ gtk_cell_layout_add_attribute (GTK_CELL_LAYOUT (hinting_style_combo), renderer, "text", 0);
+
+ gtk_combo_box_set_model (GTK_COMBO_BOX (hinting_style_combo), GTK_TREE_MODEL(list_store));
+
/* Bind easy properties */
xfconf_g_property_bind (xsettings_channel,
"/Gtk/CanChangeAccels",
@@ -116,17 +178,52 @@
G_TYPE_STRING,
(GObject *)fontname_button, "font-name");
/* Less easy properties */
- gchar *toolbar_style_string = xfconf_channel_get_string (xsettings_channel, "/Gtk/ToolbarStyle", "Both");
- if (!strcmp(toolbar_style_string, "icons"))
- gtk_combo_box_set_active (GTK_COMBO_BOX(toolbar_style_combo), 0);
- if (!strcmp(toolbar_style_string, "text"))
- gtk_combo_box_set_active (GTK_COMBO_BOX(toolbar_style_combo), 1);
- if (!strcmp(toolbar_style_string, "both"))
- gtk_combo_box_set_active (GTK_COMBO_BOX(toolbar_style_combo), 2);
- if (!strcmp(toolbar_style_string, "both-horiz"))
- gtk_combo_box_set_active (GTK_COMBO_BOX(toolbar_style_combo), 3);
- g_free (toolbar_style_string);
+ {
+ gchar *toolbar_style_string = xfconf_channel_get_string (xsettings_channel, "/Gtk/ToolbarStyle", "Both");
+ if (!strcmp(toolbar_style_string, "icons"))
+ gtk_combo_box_set_active (GTK_COMBO_BOX(toolbar_style_combo), 0);
+ if (!strcmp(toolbar_style_string, "text"))
+ gtk_combo_box_set_active (GTK_COMBO_BOX(toolbar_style_combo), 1);
+ if (!strcmp(toolbar_style_string, "both"))
+ gtk_combo_box_set_active (GTK_COMBO_BOX(toolbar_style_combo), 2);
+ if (!strcmp(toolbar_style_string, "both-horiz"))
+ gtk_combo_box_set_active (GTK_COMBO_BOX(toolbar_style_combo), 3);
+ g_free (toolbar_style_string);
+ }
+ {
+ gchar *hinting_style_string = xfconf_channel_get_string (xsettings_channel, "/Xft/HintStyle", "hintnone");
+ if (!strcmp(hinting_style_string, "hintnone"))
+ gtk_combo_box_set_active (GTK_COMBO_BOX(hinting_style_combo), 0);
+ if (!strcmp(hinting_style_string, "hintslight"))
+ gtk_combo_box_set_active (GTK_COMBO_BOX(hinting_style_combo), 1);
+ if (!strcmp(hinting_style_string, "hintmedium"))
+ gtk_combo_box_set_active (GTK_COMBO_BOX(hinting_style_combo), 2);
+ if (!strcmp(hinting_style_string, "hintfull"))
+ gtk_combo_box_set_active (GTK_COMBO_BOX(hinting_style_combo), 3);
+ g_free (hinting_style_string);
+ }
+ {
+ gint hinting = xfconf_channel_get_int (xsettings_channel, "/Xft/Hinting", -1);
+ switch (hinting)
+ {
+ case 1:
+ gtk_widget_set_sensitive(hinting_style_combo, TRUE);
+ break;
+ case 0:
+ default:
+ gtk_widget_set_sensitive(hinting_style_combo, FALSE);
+ break;
+ }
+
+ }
+
g_signal_connect (G_OBJECT(toolbar_style_combo), "changed", G_CALLBACK(cb_toolbar_style_combo_changed), xsettings_channel);
+ g_signal_connect (G_OBJECT(hinting_style_combo), "changed", G_CALLBACK(cb_hinting_style_combo_changed), xsettings_channel);
+ if (hinting_check)
+ {
+ g_signal_connect (G_OBJECT(hinting_check), "toggled", G_CALLBACK(cb_hinting_check_toggled), xsettings_channel);
+ g_signal_connect (G_OBJECT(hinting_check), "toggled", G_CALLBACK(cb_hinting_check_toggled_ui), hinting_style_combo);
+ }
GtkWidget *dialog = glade_xml_get_widget (gxml, "appearance-settings-dialog");
More information about the Xfce4-commits
mailing list