Author: jannis
Date: 2008-11-10 13:10:52 +0000 (Mon, 10 Nov 2008)
New Revision: 28712

Modified:
   xfwm4/trunk/settings-dialogs/xfwm4-dialog.glade
   xfwm4/trunk/settings-dialogs/xfwm4-settings.c
Log:
Fix the /general/click_to_focus radio button synchronization with
xfconf. The two radio buttons are now properly updated when the
/general/click_to_focus property is changed outside of the dialog.

Modified: xfwm4/trunk/settings-dialogs/xfwm4-dialog.glade
===================================================================
--- xfwm4/trunk/settings-dialogs/xfwm4-dialog.glade     2008-11-10 12:30:57 UTC 
(rev 28711)
+++ xfwm4/trunk/settings-dialogs/xfwm4-dialog.glade     2008-11-10 13:10:52 UTC 
(rev 28712)
@@ -1,10 +1,10 @@
 <?xml version="1.0" encoding="UTF-8" standalone="no"?>
 <!DOCTYPE glade-interface SYSTEM "glade-2.0.dtd">
-<!--Generated with glade3 3.4.5 on Fri Oct 31 11:06:00 2008 -->
+<!--Generated with glade3 3.4.5 on Mon Nov 10 13:50:52 2008 -->
 <glade-interface>
   <requires lib="xfce4"/>
   <widget class="XfceTitledDialog" id="main-dialog">
-    <property name="title" translatable="yes">Window Manager</property>
+    <property name="title">Window Manager</property>
     <property name="window_position">GTK_WIN_POS_CENTER_ON_PARENT</property>
     <property name="icon_name">xfwm4</property>
     <property name="type_hint">GDK_WINDOW_TYPE_HINT_DIALOG</property>
@@ -431,7 +431,6 @@
                               <widget class="GtkTreeView" 
id="shortcuts_treeview">
                                 <property name="visible">True</property>
                                 <property name="can_focus">True</property>
-                                <property 
name="headers_clickable">True</property>
                               </widget>
                             </child>
                           </widget>
@@ -531,26 +530,24 @@
                                 <property name="spacing">12</property>
                                 <property name="homogeneous">True</property>
                                 <child>
-                                  <widget class="GtkRadioButton" 
id="click_to_focus_mode">
+                                  <widget class="GtkRadioButton" 
id="click_to_focus_radio">
                                     <property name="visible">True</property>
                                     <property name="can_focus">True</property>
                                     <property name="label" 
translatable="yes">Clic_k to focus</property>
                                     <property 
name="use_underline">True</property>
                                     <property name="response_id">0</property>
-                                    <property name="active">True</property>
                                     <property 
name="draw_indicator">True</property>
                                   </widget>
                                 </child>
                                 <child>
-                                  <widget class="GtkRadioButton" 
id="radiobutton2">
+                                  <widget class="GtkRadioButton" 
id="focus_follows_mouse_radio">
                                     <property name="visible">True</property>
                                     <property name="can_focus">True</property>
                                     <property name="label" 
translatable="yes">Focus follows _mouse</property>
                                     <property 
name="use_underline">True</property>
                                     <property name="response_id">0</property>
-                                    <property name="active">True</property>
                                     <property 
name="draw_indicator">True</property>
-                                    <property 
name="group">click_to_focus_mode</property>
+                                    <property 
name="group">click_to_focus_radio</property>
                                   </widget>
                                   <packing>
                                     <property name="position">1</property>

Modified: xfwm4/trunk/settings-dialogs/xfwm4-settings.c
===================================================================
--- xfwm4/trunk/settings-dialogs/xfwm4-settings.c       2008-11-10 12:30:57 UTC 
(rev 28711)
+++ xfwm4/trunk/settings-dialogs/xfwm4-settings.c       2008-11-10 13:10:52 UTC 
(rev 28712)
@@ -164,6 +164,10 @@
                                                                       const 
gchar           *property,
                                                                       const 
GValue          *value,
                                                                       
XfwmSettings          *settings);
+static void       xfwm_settings_click_to_focus_property_changed      
(XfconfChannel         *channel,
+                                                                      const 
gchar           *property,
+                                                                      const 
GValue          *value,
+                                                                      
XfwmSettings          *settings);
 static void       xfwm_settings_initialize_shortcuts                 
(XfwmSettings          *settings);
 static void       xfwm_settings_reload_shortcuts                     
(XfwmSettings          *settings);
 static void       xfwm_settings_shortcut_added                       
(XfceShortcutsProvider *provider,
@@ -414,7 +418,7 @@
   GtkWidget          *shortcuts_clear_button;
   GtkWidget          *shortcuts_reset_button;
   GtkWidget          *focus_delay_scale;
-  GtkWidget          *click_to_focus_mode;
+  GtkWidget          *click_to_focus_radio;
   GtkWidget          *raise_on_click_check;
   GtkWidget          *raise_on_focus_check;
   GtkWidget          *focus_new_check;
@@ -626,13 +630,10 @@
   focus_new_check = glade_xml_get_widget (settings->priv->glade_xml, 
"focus_new_check");
   raise_on_focus_check = glade_xml_get_widget (settings->priv->glade_xml, 
"raise_on_focus_check");
   raise_on_click_check = glade_xml_get_widget (settings->priv->glade_xml, 
"raise_on_click_check");
-  click_to_focus_mode = glade_xml_get_widget (settings->priv->glade_xml, 
"click_to_focus_mode");
 
   /* Focus tab */
   xfconf_g_property_bind (settings->priv->wm_channel, "/general/focus_delay", 
G_TYPE_INT,
                           gtk_range_get_adjustment (GTK_RANGE 
(focus_delay_scale)), "value");
-  xfconf_g_property_bind (settings->priv->wm_channel, 
"/general/click_to_focus", G_TYPE_BOOLEAN,
-                          click_to_focus_mode, "active");
   xfconf_g_property_bind (settings->priv->wm_channel, 
"/general/raise_on_click", G_TYPE_BOOLEAN,
                           raise_on_click_check, "active");
   xfconf_g_property_bind (settings->priv->wm_channel, 
"/general/raise_on_focus", G_TYPE_BOOLEAN,
@@ -640,6 +641,14 @@
   xfconf_g_property_bind (settings->priv->wm_channel, "/general/focus_new", 
G_TYPE_BOOLEAN,
                           focus_new_check, "active");
 
+  g_signal_connect (settings->priv->wm_channel, 
"property-changed::/general/click_to_focus", 
+                    G_CALLBACK 
(xfwm_settings_click_to_focus_property_changed), settings);
+  
+  xfconf_channel_get_property (settings->priv->wm_channel, 
"/general/click_to_focus", &value);
+  xfwm_settings_click_to_focus_property_changed (settings->priv->wm_channel, 
+                                                 "/general/click_to_focus", 
&value, settings);
+  g_value_unset (&value);
+
   /* Advanced tab widgets */
   box_move_check = glade_xml_get_widget (settings->priv->glade_xml, 
"box_move_check");
   box_resize_check = glade_xml_get_widget (settings->priv->glade_xml, 
"box_resize_check");
@@ -1583,6 +1592,36 @@
 
 
 static void
+xfwm_settings_click_to_focus_property_changed (XfconfChannel *channel,
+                                               const gchar   *property,
+                                               const GValue  *value,
+                                               XfwmSettings  *settings)
+{
+  GtkWidget *click_to_focus_radio;
+  GtkWidget *focus_follows_mouse_radio;
+
+  g_return_if_fail (XFWM_IS_SETTINGS (settings));
+  g_return_if_fail (GLADE_IS_XML (settings->priv->glade_xml));
+
+  click_to_focus_radio = glade_xml_get_widget (settings->priv->glade_xml, 
+                                               "click_to_focus_radio");
+  focus_follows_mouse_radio = glade_xml_get_widget (settings->priv->glade_xml, 
+                                                    
"focus_follows_mouse_radio");
+
+  if (G_UNLIKELY (G_VALUE_TYPE (value) != G_TYPE_BOOLEAN))
+    gtk_toggle_button_set_active (GTK_TOGGLE_BUTTON (click_to_focus_radio), 
TRUE);
+  else 
+    {
+      if (g_value_get_boolean (value))
+        gtk_toggle_button_set_active (GTK_TOGGLE_BUTTON 
(click_to_focus_radio), TRUE);
+      else
+        gtk_toggle_button_set_active (GTK_TOGGLE_BUTTON 
(focus_follows_mouse_radio), TRUE);
+    }
+}
+
+
+
+static void
 xfwm_settings_initialize_shortcuts (XfwmSettings *settings)
 {
   GtkTreeModel *model;

_______________________________________________
Xfce4-commits mailing list
Xfce4-commits@xfce.org
http://foo-projects.org/mailman/listinfo/xfce4-commits

Reply via email to