[gnome-control-center] RANDR - Factor out function to generate strings for resolution like 'width x height'



commit 9516f2f08298abdb8b2dcd92ced1df398c6043ea
Author: Federico Mena Quintero <federico novell com>
Date:   Wed Jul 15 18:48:35 2009 -0500

    RANDR - Factor out function to generate strings for resolution like 'width x height'
    
    Signed-off-by: Federico Mena Quintero <federico novell com>

 capplets/display/xrandr-capplet.c |   15 +++++++++------
 1 files changed, 9 insertions(+), 6 deletions(-)
---
diff --git a/capplets/display/xrandr-capplet.c b/capplets/display/xrandr-capplet.c
index dca6d49..81a6384 100644
--- a/capplets/display/xrandr-capplet.c
+++ b/capplets/display/xrandr-capplet.c
@@ -540,6 +540,12 @@ rebuild_on_off_radios (App *app)
     g_signal_handlers_unblock_by_func (app->monitor_off_radio, G_CALLBACK (monitor_on_off_toggled_cb), app);
 }
 
+static char *
+make_resolution_string (int width, int height)
+{
+    return g_strdup_printf (_("%d x %d"), width, height);
+}
+
 static void
 rebuild_resolution_combo (App *app)
 {
@@ -572,7 +578,7 @@ rebuild_resolution_combo (App *app)
 	height = gnome_rr_mode_get_height (modes[i]);
 
 	add_key (app->resolution_combo,
-		 idle_free (g_strdup_printf (_("%d x %d"), width, height)),
+		 idle_free (make_resolution_string (width, height)),
 		 width, height, 0, -1);
 
 	if (width * height > best_w * best_h)
@@ -582,15 +588,12 @@ rebuild_resolution_combo (App *app)
 	}
     }
 
-    current = idle_free (g_strdup_printf (_("%d x %d"),
-					  app->current_output->width,
-					  app->current_output->height));
+    current = idle_free (make_resolution_string (app->current_output->width, app->current_output->height));
 
     if (!combo_select (app->resolution_combo, current))
     {
 	combo_select (app->resolution_combo,
-		      idle_free (
-			  g_strdup_printf (_("%d x %d"), best_w, best_h)));
+		      idle_free (make_resolution_string (best_w, best_h)));
     }
 }
 



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