[gnome-control-center/T20818: 10/54] background: also monitor the wallpapers directory



commit 9251e91856548bd8e8b11bb10950f893be4175c5
Author: Cosimo Cecchi <cosimo endlessm com>
Date:   Tue May 6 14:13:09 2014 -0700

    background: also monitor the wallpapers directory
    
    This is where Files etc will copy images when the user selects
    "Set as Wallpaper".

 panels/background/Makefile.am                 |    8 ++++++--
 panels/background/bg-pictures-source.c        |    7 +++++++
 panels/background/gnome-wallpapers.desktop.in |    3 +++
 po/POTFILES.in                                |    1 +
 4 files changed, 17 insertions(+), 2 deletions(-)
---
diff --git a/panels/background/Makefile.am b/panels/background/Makefile.am
index ccb8017..9ed8ab9 100644
--- a/panels/background/Makefile.am
+++ b/panels/background/Makefile.am
@@ -94,7 +94,11 @@ desktopdir = $(datadir)/applications
 desktop_in_files = gnome-background-panel.desktop.in
 desktop_DATA = $(desktop_in_files:.desktop.in=.desktop)
 
-CLEANFILES = $(desktop_in_files) $(desktop_DATA) $(BUILT_SOURCES) stamp-gdesktop-enums-types.h
-EXTRA_DIST = $(resource_files) background.gresource.xml
+xdgdirsdir = $(datadir)/xdg-user-dirs
+xdgdirs_in_files = gnome-wallpapers.desktop.in
+xdgdirs_DATA = $(xdgdirs_in_files:.desktop.in=.desktop)
+
+CLEANFILES = $(desktop_in_files) $(desktop_DATA) $(xdgdirs_DATA) $(BUILT_SOURCES) 
stamp-gdesktop-enums-types.h
+EXTRA_DIST = $(resource_files) background.gresource.xml gnome-wallpapers.desktop.in
 
 -include $(top_srcdir)/git.mk
diff --git a/panels/background/bg-pictures-source.c b/panels/background/bg-pictures-source.c
index a3b35f3..5aa1a2c 100644
--- a/panels/background/bg-pictures-source.c
+++ b/panels/background/bg-pictures-source.c
@@ -51,6 +51,7 @@ struct _BgPicturesSourcePrivate
   GnomeDesktopThumbnailFactory *thumb_factory;
 
   GFileMonitor *picture_dir_monitor;
+  GFileMonitor *wallpapers_dir_monitor;
   GFileMonitor *cache_dir_monitor;
 
   GHashTable *known_items;
@@ -102,6 +103,7 @@ bg_pictures_source_finalize (GObject *object)
   g_clear_pointer (&bg_source->priv->known_items, g_hash_table_destroy);
 
   g_clear_object (&bg_source->priv->picture_dir_monitor);
+  g_clear_object (&bg_source->priv->wallpapers_dir_monitor);
   g_clear_object (&bg_source->priv->cache_dir_monitor);
 
   G_OBJECT_CLASS (bg_pictures_source_parent_class)->finalize (object);
@@ -1004,6 +1006,7 @@ static void
 bg_pictures_source_init (BgPicturesSource *self)
 {
   const gchar *pictures_path;
+  const gchar *wallpapers_path;
   BgPicturesSourcePrivate *priv;
   char *cache_path;
   GtkListStore *store;
@@ -1022,6 +1025,10 @@ bg_pictures_source_init (BgPicturesSource *self)
 
   priv->picture_dir_monitor = monitor_path (self, pictures_path);
 
+  wallpapers_path = g_get_user_special_dir_for_desktop_id ("gnome-wallpapers.desktop");
+  if (wallpapers_path)
+    priv->wallpapers_dir_monitor = monitor_path (self, wallpapers_path);
+
   cache_path = bg_pictures_source_get_cache_path ();
   priv->cache_dir_monitor = monitor_path (self, cache_path);
   g_free (cache_path);
diff --git a/panels/background/gnome-wallpapers.desktop.in b/panels/background/gnome-wallpapers.desktop.in
new file mode 100644
index 0000000..2949821
--- /dev/null
+++ b/panels/background/gnome-wallpapers.desktop.in
@@ -0,0 +1,3 @@
+[Directory]
+_Name=Wallpapers
+Parent=XDG_PICTURES_DIR
diff --git a/po/POTFILES.in b/po/POTFILES.in
index 5b1500f..7b1d35e 100644
--- a/po/POTFILES.in
+++ b/po/POTFILES.in
@@ -7,6 +7,7 @@ panels/background/cc-background-chooser-dialog.c
 panels/background/cc-background-item.c
 panels/background/cc-background-panel.c
 panels/background/gnome-background-panel.desktop.in.in
+panels/background/gnome-wallpapers.desktop.in
 [type: gettext/glade]panels/bluetooth/bluetooth.ui
 panels/bluetooth/cc-bluetooth-panel.c
 panels/bluetooth/gnome-bluetooth-panel.desktop.in.in


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