From eaa7342a04456fd360e6ba49035933dc857eda0a Mon Sep 17 00:00:00 2001 From: Federico Mena Quintero Date: Wed, 10 Mar 2010 12:33:51 -0600 Subject: [PATCH] Factor out function to sanitize and save the RANDR configuration Signed-off-by: Federico Mena Quintero --- capplets/display/xrandr-capplet.c | 20 ++++++++++++++++---- 1 file changed, 16 insertions(+), 4 deletions(-) diff --git a/capplets/display/xrandr-capplet.c b/capplets/display/xrandr-capplet.c index 9fb95b7ba..ad7c9aaa2 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);