[Xfce4-commits] xfce4-settings:bluesabre/display-settings Super simplification of minimal dialog and code.

2013-12-09 Thread Nick Schermer
Updating branch refs/heads/bluesabre/display-settings
 to 1499a6c1cc8cf74dd4b5b453830cd9b25302d8fe (commit)
   from 07b666ad15773ed01ecc742a4305c2c8368927b9 (commit)

commit 1499a6c1cc8cf74dd4b5b453830cd9b25302d8fe
Author: Sean Davis smd.seanda...@gmail.com
Date:   Thu Oct 4 14:03:25 2012 -0400

Super simplification of minimal dialog and code.

 dialogs/display-settings/main.c|  225 ++--
 .../display-settings/minimal-display-dialog.glade  |  161 +++---
 2 files changed, 147 insertions(+), 239 deletions(-)

diff --git a/dialogs/display-settings/main.c b/dialogs/display-settings/main.c
index e57ba21..03ebbc5 100644
--- a/dialogs/display-settings/main.c
+++ b/dialogs/display-settings/main.c
@@ -1367,158 +1367,86 @@ display_settings_dialog_new (GtkBuilder *builder)
 
 static void
 display_settings_minimal_only_display1_toggled (GtkToggleButton *button,
-  GtkBuilder *builder)
+GtkBuilder  *builder)
 {
-GObject *mirror_displays, *extend_right, *only_display2;
+GObject *buttons;
 
-mirror_displays = gtk_builder_get_object(builder, mirror);
-extend_right = gtk_builder_get_object(builder, extend_right);
-only_display2 = gtk_builder_get_object(builder, display2);
-
-/* Lock everything in the dialog to prevent bad things from happening */
-g_object_disconnect (mirror_displays, any_signal::toggled,
- display_settings_minimal_mirror_displays_toggled,
- builder, NULL);
-g_object_disconnect (extend_right, any_signal::toggled,
- display_settings_minimal_extend_right_toggled,
- builder, NULL);
-g_object_disconnect (only_display2, any_signal::toggled,
- display_settings_minimal_only_display2_toggled,
- builder, NULL);
- 
-gtk_widget_set_sensitive( GTK_WIDGET(mirror_displays), FALSE );
-gtk_widget_set_sensitive( GTK_WIDGET(extend_right), FALSE );
-gtk_widget_set_sensitive( GTK_WIDGET(only_display2), FALSE );
-
-gtk_toggle_button_set_active (button, TRUE);
-gtk_toggle_button_set_active (GTK_TOGGLE_BUTTON(mirror_displays), FALSE);
-gtk_toggle_button_set_active (GTK_TOGGLE_BUTTON(extend_right), FALSE);
-gtk_toggle_button_set_active (GTK_TOGGLE_BUTTON(only_display2), FALSE);
+if ( !gtk_toggle_button_get_active(button) ) 
+return;
 
 if (!xfce_randr)
 return;
 
 if (xfce_randr-noutput = 1)
 return;
+
+buttons = gtk_builder_get_object(builder, buttons);
+gtk_widget_set_sensitive( GTK_WIDGET(buttons), FALSE );
 
-if (gtk_toggle_button_get_active (button))
-{
-   /* Put Display1 in its preferred mode and deactivate Display2 */
-XFCE_RANDR_MODE (xfce_randr) = xfce_randr_preferred_mode (xfce_randr, 
0);
-xfce_randr-active_output = 1;
-XFCE_RANDR_MODE (xfce_randr) = None;
-/* Apply the changes */
-xfce_randr_save_output (xfce_randr, Default, display_channel,0);
-xfce_randr_save_output (xfce_randr, Default, display_channel,1);
-xfce_randr_apply (xfce_randr, Default, display_channel);
-}
+   /* Put Display1 in its preferred mode and deactivate Display2 */
+XFCE_RANDR_MODE (xfce_randr) = xfce_randr_preferred_mode (xfce_randr, 0);
+xfce_randr-active_output = 1;
+XFCE_RANDR_MODE (xfce_randr) = None;
 
-gtk_widget_set_sensitive( GTK_WIDGET(mirror_displays), TRUE );
-gtk_widget_set_sensitive( GTK_WIDGET(extend_right), TRUE );
-gtk_widget_set_sensitive( GTK_WIDGET(only_display2), TRUE );
-
-/* Reconnect the signals */
-g_signal_connect (mirror_displays, toggled, G_CALLBACK 
(display_settings_minimal_mirror_displays_toggled),
-  builder);
-g_signal_connect (extend_right, toggled, G_CALLBACK 
(display_settings_minimal_extend_right_toggled),
-  builder);
-g_signal_connect (only_display2, toggled, G_CALLBACK 
(display_settings_minimal_only_display2_toggled),
-  builder);
+/* Apply the changes */
+xfce_randr_save_output (xfce_randr, Default, display_channel,0);
+xfce_randr_save_output (xfce_randr, Default, display_channel,1);
+xfce_randr_apply (xfce_randr, Default, display_channel);
+
+gtk_widget_set_sensitive( GTK_WIDGET(buttons), TRUE );
 }
 
 static void
 display_settings_minimal_only_display2_toggled (GtkToggleButton *button,
-  GtkBuilder *builder)
+GtkBuilder  *builder)
 {
-GObject *mirror_displays, *extend_right, *only_display1;
+GObject *buttons;
 
-mirror_displays = gtk_builder_get_object(builder, mirror);
-extend_right = gtk_builder_get_object(builder, extend_right);
-

[Xfce4-commits] xfce4-settings:bluesabre/display-settings Super simplification of minimal dialog and code.

2012-10-04 Thread Sean Davis
Updating branch refs/heads/bluesabre/display-settings
 to 422122c9d6236b4bf7010fbcd78eea35f3b823e5 (commit)
   from 131356b9b8cd8d1360624e06e887386d21aed299 (commit)

commit 422122c9d6236b4bf7010fbcd78eea35f3b823e5
Author: Sean Davis smd.seanda...@gmail.com
Date:   Thu Oct 4 14:03:25 2012 -0400

Super simplification of minimal dialog and code.

 dialogs/display-settings/main.c|  225 ++--
 .../display-settings/minimal-display-dialog.glade  |  161 ---
 2 files changed, 147 insertions(+), 239 deletions(-)

diff --git a/dialogs/display-settings/main.c b/dialogs/display-settings/main.c
index e57ba21..03ebbc5 100644
--- a/dialogs/display-settings/main.c
+++ b/dialogs/display-settings/main.c
@@ -1367,158 +1367,86 @@ display_settings_dialog_new (GtkBuilder *builder)
 
 static void
 display_settings_minimal_only_display1_toggled (GtkToggleButton *button,
-  GtkBuilder *builder)
+GtkBuilder  *builder)
 {
-GObject *mirror_displays, *extend_right, *only_display2;
+GObject *buttons;
 
-mirror_displays = gtk_builder_get_object(builder, mirror);
-extend_right = gtk_builder_get_object(builder, extend_right);
-only_display2 = gtk_builder_get_object(builder, display2);
-
-/* Lock everything in the dialog to prevent bad things from happening */
-g_object_disconnect (mirror_displays, any_signal::toggled,
- display_settings_minimal_mirror_displays_toggled,
- builder, NULL);
-g_object_disconnect (extend_right, any_signal::toggled,
- display_settings_minimal_extend_right_toggled,
- builder, NULL);
-g_object_disconnect (only_display2, any_signal::toggled,
- display_settings_minimal_only_display2_toggled,
- builder, NULL);
- 
-gtk_widget_set_sensitive( GTK_WIDGET(mirror_displays), FALSE );
-gtk_widget_set_sensitive( GTK_WIDGET(extend_right), FALSE );
-gtk_widget_set_sensitive( GTK_WIDGET(only_display2), FALSE );
-
-gtk_toggle_button_set_active (button, TRUE);
-gtk_toggle_button_set_active (GTK_TOGGLE_BUTTON(mirror_displays), FALSE);
-gtk_toggle_button_set_active (GTK_TOGGLE_BUTTON(extend_right), FALSE);
-gtk_toggle_button_set_active (GTK_TOGGLE_BUTTON(only_display2), FALSE);
+if ( !gtk_toggle_button_get_active(button) ) 
+return;
 
 if (!xfce_randr)
 return;
 
 if (xfce_randr-noutput = 1)
 return;
+
+buttons = gtk_builder_get_object(builder, buttons);
+gtk_widget_set_sensitive( GTK_WIDGET(buttons), FALSE );
 
-if (gtk_toggle_button_get_active (button))
-{
-   /* Put Display1 in its preferred mode and deactivate Display2 */
-XFCE_RANDR_MODE (xfce_randr) = xfce_randr_preferred_mode (xfce_randr, 
0);
-xfce_randr-active_output = 1;
-XFCE_RANDR_MODE (xfce_randr) = None;
-/* Apply the changes */
-xfce_randr_save_output (xfce_randr, Default, display_channel,0);
-xfce_randr_save_output (xfce_randr, Default, display_channel,1);
-xfce_randr_apply (xfce_randr, Default, display_channel);
-}
+   /* Put Display1 in its preferred mode and deactivate Display2 */
+XFCE_RANDR_MODE (xfce_randr) = xfce_randr_preferred_mode (xfce_randr, 0);
+xfce_randr-active_output = 1;
+XFCE_RANDR_MODE (xfce_randr) = None;
 
-gtk_widget_set_sensitive( GTK_WIDGET(mirror_displays), TRUE );
-gtk_widget_set_sensitive( GTK_WIDGET(extend_right), TRUE );
-gtk_widget_set_sensitive( GTK_WIDGET(only_display2), TRUE );
-
-/* Reconnect the signals */
-g_signal_connect (mirror_displays, toggled, G_CALLBACK 
(display_settings_minimal_mirror_displays_toggled),
-  builder);
-g_signal_connect (extend_right, toggled, G_CALLBACK 
(display_settings_minimal_extend_right_toggled),
-  builder);
-g_signal_connect (only_display2, toggled, G_CALLBACK 
(display_settings_minimal_only_display2_toggled),
-  builder);
+/* Apply the changes */
+xfce_randr_save_output (xfce_randr, Default, display_channel,0);
+xfce_randr_save_output (xfce_randr, Default, display_channel,1);
+xfce_randr_apply (xfce_randr, Default, display_channel);
+
+gtk_widget_set_sensitive( GTK_WIDGET(buttons), TRUE );
 }
 
 static void
 display_settings_minimal_only_display2_toggled (GtkToggleButton *button,
-  GtkBuilder *builder)
+GtkBuilder  *builder)
 {
-GObject *mirror_displays, *extend_right, *only_display1;
+GObject *buttons;
 
-mirror_displays = gtk_builder_get_object(builder, mirror);
-extend_right = gtk_builder_get_object(builder, extend_right);
-