gnome-desktop r5367 - in trunk/libgnome-desktop: . libgnomeui



Author: federico
Date: Tue Jan 27 20:28:55 2009
New Revision: 5367
URL: http://svn.gnome.org/viewvc/gnome-desktop?rev=5367&view=rev

Log:
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>

Modified:
   trunk/libgnome-desktop/ChangeLog
   trunk/libgnome-desktop/gnome-rr-config.c
   trunk/libgnome-desktop/libgnomeui/gnome-rr-config.h

Modified: trunk/libgnome-desktop/gnome-rr-config.c
==============================================================================
--- trunk/libgnome-desktop/gnome-rr-config.c	(original)
+++ trunk/libgnome-desktop/gnome-rr-config.c	Tue Jan 27 20:28:55 2009
@@ -421,21 +421,6 @@
     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 @@
 
     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 @@
 
     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 @@
     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 @@
     
     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 @@
     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 @@
 }
 
 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 @@
 	    /* 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)
     {

Modified: trunk/libgnome-desktop/libgnomeui/gnome-rr-config.h
==============================================================================
--- trunk/libgnome-desktop/libgnomeui/gnome-rr-config.h	(original)
+++ trunk/libgnome-desktop/libgnomeui/gnome-rr-config.h	Tue Jan 27 20:28:55 2009
@@ -87,6 +87,7 @@
 					      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,



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