[gnome-control-center/randr-set-as-default: 2/3] Factor out function to sanitize and save the RANDR configuration



commit eaa7342a04456fd360e6ba49035933dc857eda0a
Author: Federico Mena Quintero <federico novell com>
Date:   Wed Mar 10 12:33:51 2010 -0600

    Factor out function to sanitize and save the RANDR configuration
    
    Signed-off-by: Federico Mena Quintero <federico novell com>

 capplets/display/xrandr-capplet.c |   20 ++++++++++++++++----
 1 files changed, 16 insertions(+), 4 deletions(-)
---
diff --git a/capplets/display/xrandr-capplet.c b/capplets/display/xrandr-capplet.c
index 9fb95b7..ad7c9aa 100644
--- a/capplets/display/xrandr-capplet.c
+++ b/capplets/display/xrandr-capplet.c
@@ -2033,10 +2033,10 @@ apply_configuration_returned_cb (DBusGProxy       *proxy,
     gtk_widget_set_sensitive (app->dialog, TRUE);
 }
 
-static void
-apply (App *app)
+static gboolean
+sanitize_and_save_configuration (App *app)
 {
-    GError *error = NULL;
+    GError *error;
 
     gnome_rr_config_sanitize (app->current_configuration);
 
@@ -2046,13 +2046,25 @@ apply (App *app)
 
     ensure_current_configuration_is_saved ();
 
+    error = NULL;
     if (!gnome_rr_config_save (app->current_configuration, &error))
     {
 	error_message (app, _("Could not save the monitor configuration"), error->message);
 	g_error_free (error);
-	return;
+	return FALSE;
     }
 
+    return TRUE;
+}
+
+static void
+apply (App *app)
+{
+    GError *error = NULL;
+
+    if (!sanitize_and_save_configuration (app))
+	return;
+
     g_assert (app->connection == NULL);
     g_assert (app->proxy == NULL);
     g_assert (app->proxy_call == NULL);



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