bnc486093 (RANDR) - Ensure that there will be a backup file before committing changes
Signed-off-by: Federico Mena Quintero <federico@novell.com> svn path=/trunk/; revision=9398
This commit is contained in:
parent
2211e92c07
commit
72ed4d4460
2 changed files with 34 additions and 0 deletions
|
@ -1,3 +1,10 @@
|
||||||
|
2009-03-30 Federico Mena Quintero <federico@novell.com>
|
||||||
|
|
||||||
|
* xrandr-capplet.c (ensure_current_configuration_is_saved): Save
|
||||||
|
monitors.xml with the current configuration before changing it, so
|
||||||
|
that we'll have something to go back to even on a first-time login
|
||||||
|
(when monitors.xml doesn't exist).
|
||||||
|
|
||||||
2009-03-20 Federico Mena Quintero <federico@novell.com>
|
2009-03-20 Federico Mena Quintero <federico@novell.com>
|
||||||
|
|
||||||
* xrandr-capplet.c (begin_version2_apply_configuration): There is no need
|
* xrandr-capplet.c (begin_version2_apply_configuration): There is no need
|
||||||
|
|
|
@ -1767,6 +1767,31 @@ begin_version1_apply_configuration (App *app)
|
||||||
*/
|
*/
|
||||||
}
|
}
|
||||||
|
|
||||||
|
static void
|
||||||
|
ensure_current_configuration_is_saved (void)
|
||||||
|
{
|
||||||
|
GnomeRRScreen *rr_screen;
|
||||||
|
GnomeRRConfig *rr_config;
|
||||||
|
|
||||||
|
/* Normally, gnome_rr_config_save() creates a backup file based on the
|
||||||
|
* old monitors.xml. However, if *that* file didn't exist, there is
|
||||||
|
* nothing from which to create a backup. So, here we'll save the
|
||||||
|
* current/unchanged configuration and then let our caller call
|
||||||
|
* gnome_rr_config_save() again with the new/changed configuration, so
|
||||||
|
* that there *will* be a backup file in the end.
|
||||||
|
*/
|
||||||
|
|
||||||
|
rr_screen = gnome_rr_screen_new (gdk_screen_get_default (), NULL, NULL, NULL); /* NULL-GError */
|
||||||
|
if (!rr_screen)
|
||||||
|
return;
|
||||||
|
|
||||||
|
rr_config = gnome_rr_config_new_current (rr_screen);
|
||||||
|
gnome_rr_config_save (rr_config, NULL); /* NULL-GError */
|
||||||
|
|
||||||
|
gnome_rr_config_free (rr_config);
|
||||||
|
gnome_rr_screen_destroy (rr_screen);
|
||||||
|
}
|
||||||
|
|
||||||
/* Callback for dbus_g_proxy_begin_call() */
|
/* Callback for dbus_g_proxy_begin_call() */
|
||||||
static void
|
static void
|
||||||
apply_configuration_returned_cb (DBusGProxy *proxy,
|
apply_configuration_returned_cb (DBusGProxy *proxy,
|
||||||
|
@ -1819,6 +1844,8 @@ apply (App *app)
|
||||||
|
|
||||||
foo_scroll_area_invalidate (FOO_SCROLL_AREA (app->area));
|
foo_scroll_area_invalidate (FOO_SCROLL_AREA (app->area));
|
||||||
|
|
||||||
|
ensure_current_configuration_is_saved ();
|
||||||
|
|
||||||
if (!gnome_rr_config_save (app->current_configuration, &error))
|
if (!gnome_rr_config_save (app->current_configuration, &error))
|
||||||
{
|
{
|
||||||
error_message (app, _("Could not save the monitor configuration"), error->message);
|
error_message (app, _("Could not save the monitor configuration"), error->message);
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue