diff options
author | Federico Mena Quintero <federico@novell.com> | 2009-01-27 21:33:44 +0000 |
---|---|---|
committer | Federico Mena Quintero <federico@src.gnome.org> | 2009-01-27 21:33:44 +0000 |
commit | e917cfbcf950d6a6cabc17db968caa6c1aa2e1b0 (patch) | |
tree | ced78decb78b895bdb86eb53769f79fbe6fc6d3d /plugins | |
parent | 064441cc640dfc3f7f31b0bdbd3fe713c3f54901 (diff) | |
download | gnome-settings-daemon-e917cfbcf950d6a6cabc17db968caa6c1aa2e1b0.tar.gz |
bgo545115 (RANDR) - Factor out function to apply the stored configuration at startup
2009-01-27 Federico Mena Quintero <federico@novell.com>
http://bugzilla.gnome.org/show_bug.cgi?id=545115 - Ask for
confirmation, with a timeout, after changing the RANDR
configuration for if we leave the user with an unusable display.
This also handles the case where the machine may crash after
changing the configuration; the old/known-good configuration will
be restored when the user restarts his session.
Refactor:
* plugins/xrandr/gsd-xrandr-manager.c
(apply_stored_configuration_at_startup): Factor out the logic to
apply the stored configuration at startup.
(gsd_xrandr_manager_start): Use the function above.
Signed-off-by: Federico Mena Quintero <federico@novell.com>
svn path=/trunk/; revision=674
Diffstat (limited to 'plugins')
-rw-r--r-- | plugins/xrandr/gsd-xrandr-manager.c | 29 |
1 files changed, 18 insertions, 11 deletions
diff --git a/plugins/xrandr/gsd-xrandr-manager.c b/plugins/xrandr/gsd-xrandr-manager.c index 45f31c5c..e39b101b 100644 --- a/plugins/xrandr/gsd-xrandr-manager.c +++ b/plugins/xrandr/gsd-xrandr-manager.c @@ -1121,12 +1121,27 @@ on_config_changed (GConfClient *client, start_or_stop_icon (manager); } +static void +apply_stored_configuration_at_startup (GsdXrandrManager *manager) +{ + GError *my_error; + + my_error = NULL; + if (!gnome_rr_config_apply_stored (manager->priv->rw_screen, &my_error)) { + if (my_error) { + if (!g_error_matches (my_error, G_FILE_ERROR, G_FILE_ERROR_NOENT)) + error_message (manager, _("Could not apply the stored configuration for monitors"), my_error, NULL); + + g_error_free (my_error); + } + } + +} + gboolean gsd_xrandr_manager_start (GsdXrandrManager *manager, GError **error) { - GError *my_error; - g_debug ("Starting xrandr manager"); gnome_settings_profile_start (NULL); @@ -1163,15 +1178,7 @@ gsd_xrandr_manager_start (GsdXrandrManager *manager, gdk_error_trap_pop (); } - my_error = NULL; - if (!gnome_rr_config_apply_stored (manager->priv->rw_screen, &my_error)) { - if (my_error) { - if (!g_error_matches (my_error, G_FILE_ERROR, G_FILE_ERROR_NOENT)) - error_message (manager, _("Could not apply the stored configuration for monitors"), my_error, NULL); - - g_error_free (my_error); - } - } + apply_stored_configuration_at_startup (manager); gdk_window_add_filter (gdk_get_default_root_window(), (GdkFilterFunc)event_filter, |