[gnome-photos/wip/rishi/import-5: 2/5] query, source-manager: Support specifically querying for local content



commit 315136b9701993240f18fa5bc8c8bb326ade0668
Author: Debarshi Ray <debarshir gnome org>
Date:   Tue Feb 6 00:36:01 2018 +0100

    query, source-manager: Support specifically querying for local content
    
    This is necessary to fetch the list of local collections to let the
    user select an existing collection where imported items should be
    added.
    
    https://gitlab.gnome.org/GNOME/gnome-photos/issues/29

 src/photos-query.h          | 5 +++--
 src/photos-source-manager.c | 4 +++-
 2 files changed, 6 insertions(+), 3 deletions(-)
---
diff --git a/src/photos-query.h b/src/photos-query.h
index 94707161..2b83eccb 100644
--- a/src/photos-query.h
+++ b/src/photos-query.h
@@ -66,8 +66,9 @@ typedef enum
   PHOTOS_QUERY_FLAGS_UNFILTERED     = 1 << 0,
   PHOTOS_QUERY_FLAGS_COLLECTIONS    = 1 << 1,
   PHOTOS_QUERY_FLAGS_FAVORITES      = 1 << 2,
-  PHOTOS_QUERY_FLAGS_OVERVIEW       = 1 << 3,
-  PHOTOS_QUERY_FLAGS_SEARCH         = 1 << 4
+  PHOTOS_QUERY_FLAGS_LOCAL          = 1 << 3,
+  PHOTOS_QUERY_FLAGS_OVERVIEW       = 1 << 4,
+  PHOTOS_QUERY_FLAGS_SEARCH         = 1 << 5
 } PhotosQueryFlags;
 
 extern const gchar *PHOTOS_QUERY_COLLECTIONS_IDENTIFIER;
diff --git a/src/photos-source-manager.c b/src/photos-source-manager.c
index e24a0409..f6015dae 100644
--- a/src/photos-source-manager.c
+++ b/src/photos-source-manager.c
@@ -71,7 +71,9 @@ photos_source_manager_get_filter (PhotosBaseManager *mngr, gint flags)
       goto out;
     }
 
-  if (flags & PHOTOS_QUERY_FLAGS_SEARCH)
+  if (flags & PHOTOS_QUERY_FLAGS_LOCAL)
+    source = photos_base_manager_get_object_by_id (mngr, PHOTOS_SOURCE_STOCK_LOCAL);
+  else if (flags & PHOTOS_QUERY_FLAGS_SEARCH)
     source = photos_base_manager_get_active_object (mngr);
   else
     source = photos_base_manager_get_object_by_id (mngr, PHOTOS_SOURCE_STOCK_ALL);


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