Author: stephan
Date: 2008-05-12 12:58:42 +0000 (Mon, 12 May 2008)
New Revision: 26949

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:
Fix subpixel-hinting


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-12 00:23:51 UTC (rev 26948)
+++ 
xfce-mcs-plugins/branches/xfce-plugins-stephan/dialogs/appearance-settings/appearance-dialog.glade
  2008-05-12 12:58:42 UTC (rev 26949)
@@ -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:46:18 2008 -->
+<!--Generated with glade3 3.4.2 on Mon May 12 09:53:03 2008 -->
 <glade-interface>
   <requires lib="xfce4"/>
   <widget class="GtkDialog" id="appearance-settings-dialog">
@@ -209,7 +209,7 @@
                                       <widget class="GtkCheckButton" 
id="xft_rgba_check_button">
                                         <property 
name="visible">True</property>
                                         <property 
name="can_focus">True</property>
-                                        <property name="label" 
translatable="yes">RGBA Subpixel Hinting</property>
+                                        <property name="label" 
translatable="yes">Subpixel Hinting</property>
                                         <property 
name="response_id">0</property>
                                         <property 
name="draw_indicator">True</property>
                                       </widget>

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-12 00:23:51 UTC (rev 26948)
+++ 
xfce-mcs-plugins/branches/xfce-plugins-stephan/dialogs/appearance-settings/main.c
   2008-05-12 12:58:42 UTC (rev 26949)
@@ -33,6 +33,11 @@
 #include <xfconf/xfconf.h>
 #include "appearance-dialog.glade.h"
 
+typedef struct {
+    GtkWidget *slave;
+    XfconfChannel *channel;
+} PropertyPair;
+
 gboolean version = FALSE;
 
 static GOptionEntry entries[] =
@@ -99,27 +104,73 @@
 
 
 void
-cb_hinting_check_toggled (GtkToggleButton *toggle, XfconfChannel *channel)
+cb_hinting_check_toggled (GtkToggleButton *toggle, PropertyPair *pair)
 {
     if (gtk_toggle_button_get_active(toggle))
     {
-        xfconf_channel_set_int (channel, "/Xft/Hinting", 1);
+        xfconf_channel_set_int (pair->channel, "/Xft/Hinting", 1);
+        gtk_widget_set_sensitive(pair->slave, TRUE);
     }
     else
     {
-        xfconf_channel_set_int (channel, "/Xft/Hinting", 0);
+        xfconf_channel_set_int (pair->channel, "/Xft/Hinting", 0);
+        gtk_widget_set_sensitive(pair->slave, FALSE);
     }
 }
 
 void
-cb_hinting_check_toggled_ui (GtkToggleButton *toggle, GtkWidget *como)
+cb_rgba_style_combo_changed (GtkComboBox *combo, XfconfChannel *channel)
 {
-    gtk_widget_set_sensitive(como, gtk_toggle_button_get_active(toggle));
+    switch (gtk_combo_box_get_active(combo))
+    {
+        case 0:
+            xfconf_channel_set_string (channel, "/Xft/RGBA", "rgb");
+            break;
+        case 1:
+            xfconf_channel_set_string (channel, "/Xft/RGBA", "bgr");
+            break;
+        case 2:
+            xfconf_channel_set_string (channel, "/Xft/RGBA", "vrgb");
+            break;
+        case 3:
+            xfconf_channel_set_string (channel, "/Xft/RGBA", "vbgr");
+            break;
+    }
 }
 
+void
+cb_rgba_check_toggled (GtkToggleButton *toggle, PropertyPair *pair)
+{
+    if (gtk_toggle_button_get_active(toggle))
+    {
+            gtk_widget_set_sensitive(pair->slave, TRUE);
+            switch (gtk_combo_box_get_active(pair->slave))
+            {
+                case 0:
+                    xfconf_channel_set_string (pair->channel, "/Xft/RGBA", 
"rgb");
+                    break;
+                case 1:
+                    xfconf_channel_set_string (pair->channel, "/Xft/RGBA", 
"bgr");
+                    break;
+                case 2:
+                    xfconf_channel_set_string (pair->channel, "/Xft/RGBA", 
"vrgb");
+                    break;
+                case 3:
+                    xfconf_channel_set_string (pair->channel, "/Xft/RGBA", 
"vbgr");
+                    break;
+            }
+    }
+    else
+    {
+            gtk_widget_set_sensitive(pair->slave, FALSE);
+            xfconf_channel_set_string (pair->channel, "/Xft/RGBA", "none");
+    }
+}
+
 GtkWidget *
 appearance_settings_dialog_new_from_xml (GladeXML *gxml)
 {
+    PropertyPair *pair = NULL;
     GtkTreeIter iter;
     GtkListStore *list_store;
     GtkCellRenderer *renderer;
@@ -134,6 +185,8 @@
     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");
+    GtkWidget *rgba_style_combo = glade_xml_get_widget (gxml, 
"xft_rgba_combo_box");
+    GtkWidget *rgba_check = glade_xml_get_widget (gxml, 
"xft_rgba_check_button");
 
     /* Fill the combo-boxes */
     /* ToolbarStyle combo */
@@ -173,6 +226,24 @@
 
     gtk_combo_box_set_model (GTK_COMBO_BOX (hinting_style_combo), 
GTK_TREE_MODEL(list_store));
 
+    /* Subpixel (rgba)  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_("rgb"), -1);
+    gtk_list_store_append(list_store, &iter);
+    gtk_list_store_set(list_store, &iter, 0, N_("bgr"), -1);
+    gtk_list_store_append(list_store, &iter);
+    gtk_list_store_set(list_store, &iter, 0, N_("vrgb"), -1);
+    gtk_list_store_append(list_store, &iter);
+    gtk_list_store_set(list_store, &iter, 0, N_("vbgr"), -1);
+
+    gtk_cell_layout_clear (GTK_CELL_LAYOUT (rgba_style_combo));
+    renderer = gtk_cell_renderer_text_new();
+    gtk_cell_layout_pack_start (GTK_CELL_LAYOUT (rgba_style_combo), renderer, 
TRUE);
+    gtk_cell_layout_add_attribute (GTK_CELL_LAYOUT (rgba_style_combo), 
renderer, "text", 0);
+
+    gtk_combo_box_set_model (GTK_COMBO_BOX (rgba_style_combo), 
GTK_TREE_MODEL(list_store));
+
     /* Bind easy properties */
     xfconf_g_property_bind (xsettings_channel, 
                             "/Gtk/CanChangeAccels",
@@ -248,14 +319,46 @@
         }
 
     }
+    {
+        gchar *rgba_style_string = xfconf_channel_get_string 
(xsettings_channel, "/Xft/RGBA", "none");
+        if (!strcmp(rgba_style_string, "none"))
+        {
+            gtk_toggle_button_set_state(GTK_TOGGLE_BUTTON(rgba_check), FALSE);
+            gtk_widget_set_sensitive(rgba_style_combo, FALSE);
+            gtk_combo_box_set_active (GTK_COMBO_BOX(rgba_style_combo), 0);
+        }
+        else
+        {
+            gtk_widget_set_sensitive(rgba_style_combo, TRUE);
+            gtk_toggle_button_set_state(GTK_TOGGLE_BUTTON(rgba_check), TRUE);
+        }
+        if (!strcmp(rgba_style_string, "rgb"))
+            gtk_combo_box_set_active (GTK_COMBO_BOX(rgba_style_combo), 0);
+        if (!strcmp(rgba_style_string, "bgr"))
+            gtk_combo_box_set_active (GTK_COMBO_BOX(rgba_style_combo), 1);
+        if (!strcmp(rgba_style_string, "vrgb"))
+            gtk_combo_box_set_active (GTK_COMBO_BOX(rgba_style_combo), 2);
+        if (!strcmp(rgba_style_string, "vbgr"))
+            gtk_combo_box_set_active (GTK_COMBO_BOX(rgba_style_combo), 3);
+        g_free (rgba_style_string);
+    }
 
     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);
-    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);
+    g_signal_connect (G_OBJECT(rgba_style_combo), "changed", 
G_CALLBACK(cb_rgba_style_combo_changed), xsettings_channel);
     g_signal_connect (G_OBJECT(antialias_check_button), "toggled", 
G_CALLBACK(cb_antialias_check_button_toggled), xsettings_channel);
+    
+    pair = g_new0(PropertyPair, 1);
+    pair->channel = xsettings_channel;
+    pair->slave = hinting_style_combo;
+    g_signal_connect (G_OBJECT(hinting_check), "toggled", 
G_CALLBACK(cb_hinting_check_toggled), pair);
 
+    pair = g_new0(PropertyPair, 1);
+    pair->channel = xsettings_channel;
+    pair->slave = rgba_style_combo;
+    g_signal_connect (G_OBJECT(rgba_check), "toggled", 
G_CALLBACK(cb_rgba_check_toggled), pair);
 
+
     GtkWidget *dialog = glade_xml_get_widget (gxml, 
"appearance-settings-dialog");
     return dialog;
 }

_______________________________________________
Xfce4-commits mailing list
[email protected]
http://foo-projects.org/mailman/listinfo/xfce4-commits

Reply via email to