gnome-control-center r9171 - trunk/capplets/display



Author: federico
Date: Mon Dec 15 23:19:32 2008
New Revision: 9171
URL: http://svn.gnome.org/viewvc/gnome-control-center?rev=9171&view=rev

Log:
Don't duplicate code to pick the current output
2008-12-15  Federico Mena Quintero  <federico novell com>

	* xrandr-capplet.c (on_screen_changed): Use
	select_current_output_from_dialog_position() instead of selecting
	an output ourselves.

Signed-off-by: Federico Mena Quintero <federico novell com>

Modified:
   trunk/capplets/display/ChangeLog
   trunk/capplets/display/xrandr-capplet.c

Modified: trunk/capplets/display/xrandr-capplet.c
==============================================================================
--- trunk/capplets/display/xrandr-capplet.c	(original)
+++ trunk/capplets/display/xrandr-capplet.c	Mon Dec 15 23:19:32 2008
@@ -65,6 +65,7 @@
 static void rebuild_gui (App *app);
 static void on_rate_changed (GtkComboBox *box, gpointer data);
 static gboolean output_overlaps (GnomeOutputInfo *output, GnomeRRConfig *config);
+static void select_current_output_from_dialog_position (App *app);
 
 static void
 error_message (App *app, const char *primary_text, const char *secondary_text)
@@ -113,7 +114,6 @@
     GnomeRRConfig *current;
     App *app = data;
     int i;
-    GnomeOutputInfo *best;
 
     current = gnome_rr_config_new_current (app->screen);
 
@@ -157,25 +157,7 @@
     }
 #endif
 
-    /* Select an output */
-    best = NULL;
-    for (i = 0; app->current_configuration->outputs[i] != NULL; ++i)
-    {
-	GnomeOutputInfo *output = app->current_configuration->outputs[i];
-
-	if (output->connected)
-	{
-	    char *cur_name =
-		app->current_output? app->current_output->name : NULL;
-
-	    if ((cur_name && strcmp (output->name, cur_name) == 0) || !best)
-		best = output;
-	}
-    }
-
-    app->current_output = best;
-
-    rebuild_gui (app);
+    select_current_output_from_dialog_position (app);
 }
 
 static void
@@ -1825,15 +1807,15 @@
 static void
 select_current_output_from_dialog_position (App *app)
 {
-    GnomeOutputInfo *output;
-
-    output = get_output_for_window (app->current_configuration, app->dialog->window);
-
-    if (output)
+    if (GTK_WIDGET_REALIZED (app->dialog))
     {
-	app->current_output = output;
-	rebuild_gui (app);
+	output = get_output_for_window (app->current_configuration, app->dialog->window);
+
+	if (output)
+	    app->current_output = output;
     }
+
+    rebuild_gui (app);
 }
 
 /* This is a GtkWidget::map-event handler.  We wait for the display-properties



[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]