[maemo-commits] [maemo-commits] r8472 - in projects/haf/trunk/maemo-af-desktop: . hildon-home

From: www-data at stage.maemo.org www-data at stage.maemo.org
Date: Wed Nov 29 17:20:29 EET 2006
Author: jobi
Date: 2006-11-29 17:20:25 +0200 (Wed, 29 Nov 2006)
New Revision: 8472

Modified:
   projects/haf/trunk/maemo-af-desktop/ChangeLog
   projects/haf/trunk/maemo-af-desktop/hildon-home/background-manager.c
Log:

2006-11-29  Johan Bilien <johan.bilien at nokia.com>

	* hildon-home/background-manager.c: Revert to plain color
	background if the image file is not found. Fixes: NB#47053



Modified: projects/haf/trunk/maemo-af-desktop/ChangeLog
===================================================================
--- projects/haf/trunk/maemo-af-desktop/ChangeLog	2006-11-29 15:06:49 UTC (rev 8471)
+++ projects/haf/trunk/maemo-af-desktop/ChangeLog	2006-11-29 15:20:25 UTC (rev 8472)
@@ -1,5 +1,10 @@
 2006-11-29  Johan Bilien <johan.bilien at nokia.com>
 
+	* hildon-home/background-manager.c: Revert to plain color
+	background if the image file is not found. Fixes: NB#47053
+
+2006-11-29  Johan Bilien <johan.bilien at nokia.com>
+
 	* configure.ac: 2.9.99.11
 
 2006-11-29  Johan Bilien <johan.bilien at nokia.com>

Modified: projects/haf/trunk/maemo-af-desktop/hildon-home/background-manager.c
===================================================================
--- projects/haf/trunk/maemo-af-desktop/hildon-home/background-manager.c	2006-11-29 15:06:49 UTC (rev 8471)
+++ projects/haf/trunk/maemo-af-desktop/hildon-home/background-manager.c	2006-11-29 15:20:25 UTC (rev 8472)
@@ -1572,25 +1572,50 @@
     {
       image = load_image_from_uri (current->image_uri, TRUE, cancellable, &err);
 
-      if (!image)
+      if (err)
         {
-          g_debug ("No image, no error. Assuming loading was cancelled");
-          if (cancellable)
+          if (err->domain == BACKGROUND_MANAGER_ERROR
+              && err->code == BACKGROUND_MANAGER_ERROR_UNREADABLE)
             {
-              if (priv->loading_note)
-                gtk_widget_destroy (priv->loading_note);
+              /* If the file doesn't exist, we revert to using a plain
+               * color background */
 
-              priv->loading_note = NULL;
+              g_warning ("Image file could not be opened. Reverting to"
+                         "plain color background");
+              g_free (current->image_uri);
+              current->image_uri = NULL;
+
+              image = NULL;
+              g_clear_error (&err);
+
             }
-          return;
+          else
+            {
+              /* Unrecoverable error :( */
+              if (err->message)
+                g_warning ("Unable to load background from `%s': %s",
+                           current->image_uri,
+                           err->message);
+
+              if (cancellable)
+                {
+                  if (priv->loading_note)
+                    gtk_widget_destroy (priv->loading_note);
+
+                  priv->loading_note = NULL;
+                }
+
+              g_signal_emit (manager, manager_signals[LOAD_ERROR], 0, err);
+
+              g_error_free (err);
+
+              return;
+            }
         }
 
-      if (err && err->message)
+      else if (!image)
         {
-          g_warning ("Unable to load background from `%s': %s",
-                     current->image_uri,
-                     err->message);
-
+          g_debug ("No image, no error. Assuming loading was cancelled");
           if (cancellable)
             {
               if (priv->loading_note)
@@ -1598,13 +1623,9 @@
 
               priv->loading_note = NULL;
             }
-
-          g_signal_emit (manager, manager_signals[LOAD_ERROR], 0, err);
-
-          g_error_free (err);
-
           return;
         }
+        
     }
   else
     image = NULL;


More information about the maemo-commits mailing list