Author: stephan
Date: 2008-05-12 18:19:51 +0000 (Mon, 12 May 2008)
New Revision: 26950

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 custom-dpi settings



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 12:58:42 UTC (rev 26949)
+++ 
xfce-mcs-plugins/branches/xfce-plugins-stephan/dialogs/appearance-settings/appearance-dialog.glade
  2008-05-12 18:19:51 UTC (rev 26950)
@@ -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 Mon May 12 09:53:03 2008 -->
+<!--Generated with glade3 3.4.2 on Mon May 12 19:40:17 2008 -->
 <glade-interface>
   <requires lib="xfce4"/>
   <widget class="GtkDialog" id="appearance-settings-dialog">
@@ -279,7 +279,7 @@
                                   </packing>
                                 </child>
                                 <child>
-                                  <widget class="GtkSpinButton" 
id="xft_dpi_spin_button">
+                                  <widget class="GtkSpinButton" 
id="xft_custom_dpi_spin_button">
                                     <property name="visible">True</property>
                                     <property name="can_focus">True</property>
                                     <property name="adjustment">96 48 160 1 10 
10</property>

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 12:58:42 UTC (rev 26949)
+++ 
xfce-mcs-plugins/branches/xfce-plugins-stephan/dialogs/appearance-settings/main.c
   2008-05-12 18:19:51 UTC (rev 26950)
@@ -139,12 +139,33 @@
 }
 
 void
+cb_custom_dpi_check_button_toggled (GtkToggleButton *toggle, PropertyPair 
*pair)
+{
+    if (gtk_toggle_button_get_active(toggle))
+    {
+        xfconf_channel_set_int (pair->channel, "/Xft/DPI", 96*1024);
+        gtk_widget_set_sensitive(pair->slave, TRUE);
+    }
+    else
+    {
+        xfconf_channel_set_int (pair->channel, "/Xft/DPI", -1);
+        gtk_widget_set_sensitive(pair->slave, FALSE);
+    }
+}
+
+void
+cb_custom_dpi_spin_value_changed (GtkSpinButton *spin, XfconfChannel *channel)
+{
+    xfconf_channel_set_int (channel, "/Xft/DPI", 
(gint)(gtk_spin_button_get_value(spin)*1024));
+}
+
+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))
+            switch (gtk_combo_box_get_active(GTK_COMBO_BOX(pair->slave)))
             {
                 case 0:
                     xfconf_channel_set_string (pair->channel, "/Xft/RGBA", 
"rgb");
@@ -187,6 +208,8 @@
     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");
+    GtkWidget *custom_dpi_check = glade_xml_get_widget (gxml, 
"xft_custom_dpi_check_button");
+    GtkWidget *custom_dpi_spin = glade_xml_get_widget (gxml, 
"xft_custom_dpi_spin_button");
 
     /* Fill the combo-boxes */
     /* ToolbarStyle combo */
@@ -342,11 +365,31 @@
             gtk_combo_box_set_active (GTK_COMBO_BOX(rgba_style_combo), 3);
         g_free (rgba_style_string);
     }
+    {
+        gint dpi = xfconf_channel_get_int (xsettings_channel, "/Xft/DPI", -1);
+        if (dpi == -1)
+        {
+            gtk_toggle_button_set_state(GTK_TOGGLE_BUTTON(custom_dpi_check), 
FALSE);
+            gtk_widget_set_sensitive (custom_dpi_spin, FALSE);
+        }
+        else
+        {
+            gtk_toggle_button_set_state(GTK_TOGGLE_BUTTON(custom_dpi_check), 
TRUE);
+            gtk_widget_set_sensitive (custom_dpi_spin, TRUE);
+            gtk_spin_button_set_value (GTK_SPIN_BUTTON(custom_dpi_spin), 
(gdouble)dpi/1024);
+        }
+    }
 
     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(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 = custom_dpi_spin;
+    g_signal_connect (G_OBJECT(custom_dpi_check), "toggled", 
G_CALLBACK(cb_custom_dpi_check_button_toggled), pair);
+    g_signal_connect (G_OBJECT(custom_dpi_spin), "value-changed", 
G_CALLBACK(cb_custom_dpi_spin_value_changed), xsettings_channel);
     
     pair = g_new0(PropertyPair, 1);
     pair->channel = xsettings_channel;

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

Reply via email to