[gnome-control-center] background: Be robust against missing directories, and warn otherwise



commit 9ce45bfd3f642b32c46ac9ec3b8b5645ff5398ac
Author: Debarshi Ray <debarshir gnome org>
Date:   Tue Oct 1 19:18:49 2013 +0200

    background: Be robust against missing directories, and warn otherwise
    
    We want to track the busy state of the source. To do that we will keep
    a count of the number of pending operations. Not having a check for
    NOT_FOUND makes it slightly easier to do that. Not a big deal, but I
    think it outweighs the downfall of showing an extra warning.
    
    Plus we are trying to create the directories before using them, so the
    warning means something fishy has been going on with your system.
    
    https://bugzilla.gnome.org/show_bug.cgi?id=708943

 panels/background/bg-pictures-source.c |    7 +++++--
 1 files changed, 5 insertions(+), 2 deletions(-)
---
diff --git a/panels/background/bg-pictures-source.c b/panels/background/bg-pictures-source.c
index dd3b9bd..3554266 100644
--- a/panels/background/bg-pictures-source.c
+++ b/panels/background/bg-pictures-source.c
@@ -412,8 +412,7 @@ dir_enum_async_ready (GObject      *source,
 
   if (err)
     {
-      if (!g_error_matches (err, G_IO_ERROR, G_IO_ERROR_NOT_FOUND) &&
-          !g_error_matches (err, G_IO_ERROR, G_IO_ERROR_CANCELLED))
+      if (!g_error_matches (err, G_IO_ERROR, G_IO_ERROR_CANCELLED))
         g_warning ("Could not fill pictures source: %s", err->message);
       g_error_free (err);
       return;
@@ -611,6 +610,8 @@ bg_pictures_source_init (BgPicturesSource *self)
                                             NULL);
 
   pictures_path = g_get_user_special_dir (G_USER_DIRECTORY_PICTURES);
+  g_mkdir_with_parents (pictures_path, 0700);
+
   dir = g_file_new_for_path (pictures_path);
   g_file_enumerate_children_async (dir,
                                   ATTRIBUTES,
@@ -632,6 +633,8 @@ bg_pictures_source_init (BgPicturesSource *self)
   g_object_unref (dir);
 
   cache_path = bg_pictures_source_get_cache_path ();
+  g_mkdir_with_parents (cache_path, 0700);
+
   dir = g_file_new_for_path (cache_path);
   g_file_enumerate_children_async (dir,
                                   ATTRIBUTES,


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