diff options
author | Federico Mena Quintero <federico@novell.com> | 2009-01-27 20:28:55 +0000 |
---|---|---|
committer | Federico Mena Quintero <federico@src.gnome.org> | 2009-01-27 20:28:55 +0000 |
commit | bc8f4d144a850beb03e81b768c32ef1c55cd5348 (patch) | |
tree | f5f1fb98663c968556321aba224a0e06a805f7fe | |
parent | 05ee4ce466a04c07d3d18c0935068a094bb72c29 (diff) | |
download | gnome-desktop-bc8f4d144a850beb03e81b768c32ef1c55cd5348.tar.gz |
bgo545115 - Pass a filename argument to gnome_rr_config_apply_stored() so we can try a backup
Pass a filename argument to gnome_rr_config_apply_stored() so we
can try the backup configuration from gnome-settings-daemon, for
recovery after a failed reconfiguration:
* gnome-rr-config.c (configurations_read): Removed, as
configurations_read_from_file() does everything we need now.
(gnome_rr_config_apply_stored): Take a filename argument; this
indicates from which file the configuration will be read.
* libgnomeui/gnome-rr-config.h (gnome_rr_config_apply_stored):
Update prototype with the filename argument.
Signed-off-by: Federico Mena Quintero <federico@novell.com>
svn path=/trunk/; revision=5367
-rw-r--r-- | libgnome-desktop/ChangeLog | 12 | ||||
-rw-r--r-- | libgnome-desktop/gnome-rr-config.c | 48 | ||||
-rw-r--r-- | libgnome-desktop/libgnomeui/gnome-rr-config.h | 1 |
3 files changed, 37 insertions, 24 deletions
diff --git a/libgnome-desktop/ChangeLog b/libgnome-desktop/ChangeLog index 9e0980f6..46bdfdda 100644 --- a/libgnome-desktop/ChangeLog +++ b/libgnome-desktop/ChangeLog @@ -32,6 +32,18 @@ (gnome_rr_config_save): Don't delete the pre-XDG configuration file anymore. + Pass a filename argument to gnome_rr_config_apply_stored() so we + can try the backup configuration from gnome-settings-daemon, for + recovery after a failed reconfiguration: + + * gnome-rr-config.c (configurations_read): Removed, as + configurations_read_from_file() does everything we need now. + (gnome_rr_config_apply_stored): Take a filename argument; this + indicates from which file the configuration will be read. + + * libgnomeui/gnome-rr-config.h (gnome_rr_config_apply_stored): + Update prototype with the filename argument. + 2009-01-25 Vincent Untz <vuntz@gnome.org> * gnome-rr-config.c: (get_config_filename): create the config dir if it diff --git a/libgnome-desktop/gnome-rr-config.c b/libgnome-desktop/gnome-rr-config.c index a04400a7..804ae9f5 100644 --- a/libgnome-desktop/gnome-rr-config.c +++ b/libgnome-desktop/gnome-rr-config.c @@ -421,21 +421,6 @@ out: return result; } -static GnomeRRConfig ** -configurations_read (GError **error) -{ - char *filename; - GnomeRRConfig **configs; - - filename = gnome_rr_config_get_intended_filename (); - - configs = configurations_read_from_file (filename, error); - - g_free (filename); - - return configs; -} - GnomeRRConfig * gnome_rr_config_new_current (GnomeRRScreen *screen) { @@ -1050,7 +1035,10 @@ gnome_rr_config_save (GnomeRRConfig *configuration, GError **error) output = g_string_new (""); - configurations = configurations_read (NULL); /* NULL-GError */ + backup_filename = gnome_rr_config_get_backup_filename (); + intended_filename = gnome_rr_config_get_intended_filename (); + + configurations = configurations_read_from_file (intended_filename, NULL); /* NULL-GError */ g_string_append_printf (output, "<monitors version=\"1\">\n"); @@ -1069,9 +1057,6 @@ gnome_rr_config_save (GnomeRRConfig *configuration, GError **error) g_string_append_printf (output, "</monitors>\n"); - backup_filename = gnome_rr_config_get_backup_filename (); - intended_filename = gnome_rr_config_get_intended_filename (); - /* backup the file first */ rename (intended_filename, backup_filename); /* no error checking because the intended file may not even exist */ @@ -1104,8 +1089,8 @@ gnome_rr_config_copy (GnomeRRConfig *config) return copy; } -GnomeRRConfig * -gnome_rr_config_new_stored (GnomeRRScreen *screen, GError **error) +static GnomeRRConfig * +config_new_stored (GnomeRRScreen *screen, const char *filename, GError **error) { GnomeRRConfig *current; GnomeRRConfig **configs; @@ -1116,7 +1101,7 @@ gnome_rr_config_new_stored (GnomeRRScreen *screen, GError **error) current = gnome_rr_config_new_current (screen); - configs = configurations_read (error); + configs = configurations_read_from_file (filename, error); result = NULL; if (configs) @@ -1144,6 +1129,21 @@ gnome_rr_config_new_stored (GnomeRRScreen *screen, GError **error) return result; } +GnomeRRConfig * +gnome_rr_config_new_stored (GnomeRRScreen *screen, GError **error) +{ + char *intended_filename; + GnomeRRConfig *config; + + intended_filename = gnome_rr_config_get_intended_filename (); + + config = config_new_stored (screen, intended_filename, error); + + g_free (intended_filename); + + return config; +} + gboolean gnome_rr_config_apply (GnomeRRConfig *config, GnomeRRScreen *screen, @@ -1173,7 +1173,7 @@ gnome_rr_config_apply (GnomeRRConfig *config, } gboolean -gnome_rr_config_apply_stored (GnomeRRScreen *screen, GError **error) +gnome_rr_config_apply_stored (GnomeRRScreen *screen, const char *filename, GError **error) { GnomeRRConfig *stored; GError *my_error; @@ -1191,7 +1191,7 @@ gnome_rr_config_apply_stored (GnomeRRScreen *screen, GError **error) /* This means the screen didn't change, so just proceed */ } - stored = gnome_rr_config_new_stored (screen, error); + stored = config_new_stored (screen, filename, error); if (stored) { diff --git a/libgnome-desktop/libgnomeui/gnome-rr-config.h b/libgnome-desktop/libgnomeui/gnome-rr-config.h index ffff2def..bee37148 100644 --- a/libgnome-desktop/libgnomeui/gnome-rr-config.h +++ b/libgnome-desktop/libgnomeui/gnome-rr-config.h @@ -87,6 +87,7 @@ gboolean gnome_rr_config_apply (GnomeRRConfig *configuration, GnomeRRScreen *screen, GError **error); gboolean gnome_rr_config_apply_stored (GnomeRRScreen *screen, + const char *filename, GError **error); gboolean gnome_rr_config_applicable (GnomeRRConfig *configuration, GnomeRRScreen *screen, |