[Xfce4-commits] <xfce4-settings:xrandr-display-settings> Apply the changes on the fly.

Jérôme Guelfucci noreply at xfce.org
Sun Jun 27 15:52:01 CEST 2010


Updating branch refs/heads/xrandr-display-settings
         to 2a927783de14ed4715b7611b0dc53d84e33d989f (commit)
       from 6288541444ba09f33c47034ff22d88107fdf6752 (commit)

commit 2a927783de14ed4715b7611b0dc53d84e33d989f
Author: Jérôme Guelfucci <jeromeg at xfce.org>
Date:   Sun Jun 27 11:57:24 2010 +0200

    Apply the changes on the fly.
    
    Be consistent with others dialogs and apply the changes on the fly
    without having an "Apply" button.

 dialogs/display-settings/display-dialog.glade |   32 ++++---------
 dialogs/display-settings/main.c               |   62 ++++++++++++++-----------
 2 files changed, 45 insertions(+), 49 deletions(-)

diff --git a/dialogs/display-settings/display-dialog.glade b/dialogs/display-settings/display-dialog.glade
index f61f5fa..156cea1 100644
--- a/dialogs/display-settings/display-dialog.glade
+++ b/dialogs/display-settings/display-dialog.glade
@@ -53,7 +53,6 @@
                 <property name="row_spacing">6</property>
                 <child>
                   <object class="GtkLabel" id="label-reflection">
-                    <property name="visible">False</property>
                     <property name="xalign">0</property>
                     <property name="label" translatable="yes">Ref_lection:</property>
                     <property name="use_underline">True</property>
@@ -113,10 +112,12 @@
                 </child>
                 <child>
                   <object class="GtkRadioButton" id="randr-on">
-                    <property name="visible">False</property>
-                    <property name="xalign">0</property>
                     <property name="label" translatable="yes">O_n</property>
+                    <property name="can_focus">False</property>
+                    <property name="receives_default">False</property>
                     <property name="use_underline">True</property>
+                    <property name="xalign">0</property>
+                    <property name="draw_indicator">False</property>
                   </object>
                   <packing>
                     <property name="x_options">GTK_FILL</property>
@@ -124,9 +125,7 @@
                   </packing>
                 </child>
                 <child>
-                  <object class="GtkComboBox" id="randr-reflection">
-                    <property name="visible">False</property>
-                  </object>
+                  <object class="GtkComboBox" id="randr-reflection"/>
                   <packing>
                     <property name="left_attach">1</property>
                     <property name="right_attach">2</property>
@@ -173,10 +172,12 @@
                 </child>
                 <child>
                   <object class="GtkRadioButton" id="randr-off">
-                    <property name="visible">False</property>
-                    <property name="xalign">0</property>
                     <property name="label" translatable="yes">Of_f</property>
+                    <property name="can_focus">False</property>
+                    <property name="receives_default">False</property>
                     <property name="use_underline">True</property>
+                    <property name="xalign">0</property>
+                    <property name="draw_indicator">False</property>
                     <property name="group">randr-on</property>
                   </object>
                   <packing>
@@ -201,19 +202,7 @@
             <property name="visible">True</property>
             <property name="layout_style">end</property>
             <child>
-              <object class="GtkButton" id="button-apply">
-                <property name="label">gtk-apply</property>
-                <property name="visible">True</property>
-                <property name="can_focus">True</property>
-                <property name="receives_default">True</property>
-                <property name="tooltip_text" translatable="yes">Apply any changes and test the new display settings</property>
-                <property name="use_stock">True</property>
-              </object>
-              <packing>
-                <property name="expand">False</property>
-                <property name="fill">False</property>
-                <property name="position">0</property>
-              </packing>
+              <placeholder/>
             </child>
             <child>
               <object class="GtkButton" id="button-close">
@@ -239,7 +228,6 @@
       </object>
     </child>
     <action-widgets>
-      <action-widget response="1">button-apply</action-widget>
       <action-widget response="0">button-close</action-widget>
     </action-widgets>
   </object>
diff --git a/dialogs/display-settings/main.c b/dialogs/display-settings/main.c
index a1262ff..44bceb7 100644
--- a/dialogs/display-settings/main.c
+++ b/dialogs/display-settings/main.c
@@ -153,6 +153,8 @@ display_setting_reflections_changed (GtkComboBox *combobox,
         XFCE_RANDR_ROTATION (xfce_randr) &= ~XFCE_RANDR_REFLECTIONS_MASK;
         /* set the new one */
         XFCE_RANDR_ROTATION (xfce_randr) |= value;
+        /* Apply the changes */
+        xfce_randr_save (xfce_randr, "Default", display_channel);
     }
 }
 
@@ -225,6 +227,14 @@ display_setting_rotations_changed (GtkComboBox *combobox,
     else
 #endif
         XFCE_RANDR_LEGACY_ROTATION (xfce_randr_legacy) = value;
+
+    /* Apply the changes */
+    #ifdef HAS_RANDR_ONE_POINT_TWO
+    if (xfce_randr)
+        xfce_randr_save (xfce_randr, "Default", display_channel);
+    else
+    #endif
+        xfce_randr_legacy_save (xfce_randr_legacy, "Default", display_channel);
 }
 
 
@@ -303,6 +313,14 @@ display_setting_refresh_rates_changed (GtkComboBox *combobox,
     else
 #endif
         XFCE_RANDR_LEGACY_RATE (xfce_randr_legacy) = value;
+
+    /* Apply the changes */
+    #ifdef HAS_RANDR_ONE_POINT_TWO
+    if (xfce_randr)
+        xfce_randr_save (xfce_randr, "Default", display_channel);
+    else
+    #endif
+        xfce_randr_legacy_save (xfce_randr_legacy, "Default", display_channel);
 }
 
 
@@ -420,6 +438,14 @@ display_setting_resolutions_changed (GtkComboBox *combobox,
 
     /* update refresh rates */
     display_setting_refresh_rates_populate (builder);
+
+    /* Apply the changes */
+    #ifdef HAS_RANDR_ONE_POINT_TWO
+    if (xfce_randr)
+        xfce_randr_save (xfce_randr, "Default", display_channel);
+    else
+    #endif
+        xfce_randr_legacy_save (xfce_randr_legacy, "Default", display_channel);
 }
 
 
@@ -526,6 +552,14 @@ display_setting_output_toggled (GtkToggleButton *togglebutton,
     display_setting_refresh_rates_populate (builder);
     display_setting_rotations_populate (builder);
     display_setting_reflections_populate (builder);
+
+    /* Apply the changes */
+    #ifdef HAS_RANDR_ONE_POINT_TWO
+    if (xfce_randr)
+        xfce_randr_save (xfce_randr, "Default", display_channel);
+    else
+    #endif
+        xfce_randr_legacy_save (xfce_randr_legacy, "Default", display_channel);
 }
 
 
@@ -723,33 +757,7 @@ display_settings_dialog_response (GtkDialog  *dialog,
                                   gint        response_id,
                                   GtkBuilder *builder)
 {
-    if (response_id == 1)
-    {
-#ifdef HAS_RANDR_ONE_POINT_TWO
-        if (xfce_randr)
-            xfce_randr_save (xfce_randr, "Default", display_channel);
-        else
-#endif
-            xfce_randr_legacy_save (xfce_randr_legacy, "Default", display_channel);
-    }
-    else if (response_id == 2)
-    {
-        /* reload randr information */
-#ifdef HAS_RANDR_ONE_POINT_TWO
-        if (xfce_randr)
-            xfce_randr_reload (xfce_randr);
-        else
-#endif
-            xfce_randr_legacy_reload (xfce_randr_legacy);
-
-        /* update dialog */
-        display_settings_treeview_populate (builder);
-    }
-    else
-    {
-        /* close */
-        gtk_main_quit ();
-    }
+    gtk_main_quit ();
 }
 
 



More information about the Xfce4-commits mailing list