gnome-settings-daemon r800 - in trunk: . plugins/xrandr



Author: federico
Date: Thu Mar 26 01:42:59 2009
New Revision: 800
URL: http://svn.gnome.org/viewvc/gnome-settings-daemon?rev=800&view=rev

Log:
(RANDR) - Handle the case where no backup file was created for monitors.xml, because *that* file didn't exist (such as on a first-time login)

Signed-off-by: Federico Mena Quintero <federico novell com>

Modified:
   trunk/ChangeLog
   trunk/plugins/xrandr/gsd-xrandr-manager.c

Modified: trunk/plugins/xrandr/gsd-xrandr-manager.c
==============================================================================
--- trunk/plugins/xrandr/gsd-xrandr-manager.c	(original)
+++ trunk/plugins/xrandr/gsd-xrandr-manager.c	Thu Mar 26 01:42:59 2009
@@ -148,7 +148,6 @@
 {
         struct GsdXrandrManagerPrivate *priv = manager->priv;
         int saved_errno;
-        char *msg;
 
         if (rename (backup_filename, intended_filename) == 0) {
                 GError *error;
@@ -166,14 +165,22 @@
 
         saved_errno = errno;
 
-        msg = g_strdup_printf ("Could not rename %s to %s: %s",
-                               backup_filename, intended_filename,
-                               g_strerror (saved_errno));
-        error_message (manager,
-                       _("Could not restore the display's configuration from a backup"),
-                       NULL,
-                       msg);
-        g_free (msg);
+        /* ENOENT means the original file didn't exist.  That is *not* an error;
+         * the backup was not created because there wasn't even an original
+         * monitors.xml (such as on a first-time login).
+         */
+        if (saved_errno != ENOENT) {
+                char *msg;
+
+                msg = g_strdup_printf ("Could not rename %s to %s: %s",
+                                       backup_filename, intended_filename,
+                                       g_strerror (saved_errno));
+                error_message (manager,
+                               _("Could not restore the display's configuration from a backup"),
+                               NULL,
+                               msg);
+                g_free (msg);
+        }
 
         unlink (backup_filename);
 }



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