[gnome-photos] Ask for the nfo:equipment of each item and keep it as a GQuark



commit 303798d9623b062c0919df62b9afcc2216107ba4
Author: Debarshi Ray <debarshir gnome org>
Date:   Mon Aug 12 11:56:47 2013 +0200

    Ask for the nfo:equipment of each item and keep it as a GQuark

 src/photos-base-item.c     |   12 ++++++++++++
 src/photos-base-item.h     |    2 ++
 src/photos-query-builder.c |    3 ++-
 src/photos-query.h         |    3 ++-
 4 files changed, 18 insertions(+), 2 deletions(-)
---
diff --git a/src/photos-base-item.c b/src/photos-base-item.c
index a7d5248..c5179e3 100644
--- a/src/photos-base-item.c
+++ b/src/photos-base-item.c
@@ -52,6 +52,7 @@ struct _PhotosBaseItemPrivate
   GMutex mutex_create_thumbnail;
   GMutex mutex_download;
   GMutex mutex;
+  GQuark equipment;
   PhotosCollectionIconWatcher *watcher;
   PhotosSelectionController *sel_cntrlr;
   TrackerSparqlCursor *cursor;
@@ -692,6 +693,7 @@ photos_base_item_populate_from_cursor (PhotosBaseItem *self, TrackerSparqlCursor
   PhotosBaseItemPrivate *priv = self->priv;
   GTimeVal timeval;
   const gchar *date_created;
+  const gchar *equipment;
   const gchar *mtime;
   const gchar *title;
   const gchar *uri;
@@ -732,6 +734,9 @@ photos_base_item_populate_from_cursor (PhotosBaseItem *self, TrackerSparqlCursor
     title = "";
   priv->name = g_strdup (title);
 
+  equipment = tracker_sparql_cursor_get_string (cursor, PHOTOS_QUERY_COLUMNS_EQUIPMENT, NULL);
+  priv->equipment = g_quark_from_string (equipment);
+
   photos_base_item_refresh_icon (self);
 }
 
@@ -1046,6 +1051,13 @@ photos_base_item_get_default_app_name (PhotosBaseItem *self)
 }
 
 
+GQuark
+photos_base_item_get_equipment (PhotosBaseItem *self)
+{
+  return self->priv->equipment;
+}
+
+
 GdkPixbuf *
 photos_base_item_get_icon (PhotosBaseItem *self)
 {
diff --git a/src/photos-base-item.h b/src/photos-base-item.h
index 652a339..b3abc4d 100644
--- a/src/photos-base-item.h
+++ b/src/photos-base-item.h
@@ -104,6 +104,8 @@ gint64              photos_base_item_get_date_created   (PhotosBaseItem *self);
 
 const gchar        *photos_base_item_get_default_app_name (PhotosBaseItem *self);
 
+GQuark              photos_base_item_get_equipment      (PhotosBaseItem *self);
+
 GdkPixbuf          *photos_base_item_get_icon           (PhotosBaseItem *self);
 
 const gchar        *photos_base_item_get_id             (PhotosBaseItem *self);
diff --git a/src/photos-query-builder.c b/src/photos-query-builder.c
index 62db4ff..6b0db9d 100644
--- a/src/photos-query-builder.c
+++ b/src/photos-query-builder.c
@@ -198,7 +198,8 @@ photos_query_builder_query (gboolean global, gint flags)
                         "nie:dataSource(?urn) "
                         "( EXISTS { ?urn nao:hasTag nao:predefined-tag-favorite } ) "
                         "( EXISTS { ?urn nco:contributor ?contributor FILTER ( ?contributor != ?creator ) } 
) "
-                        "tracker:coalesce(nfo:fileCreated (?urn), nie:contentCreated (?urn))",
+                        "tracker:coalesce(nfo:fileCreated (?urn), nie:contentCreated (?urn))"
+                        "nfo:equipment (?urn)",
                         where_sparql,
                         tail_sparql,
                         NULL);
diff --git a/src/photos-query.h b/src/photos-query.h
index 7d5f7c9..f6c5bf1 100644
--- a/src/photos-query.h
+++ b/src/photos-query.h
@@ -46,7 +46,8 @@ typedef enum
   PHOTOS_QUERY_COLUMNS_RESOURCE_URN,
   PHOTOS_QUERY_COLUMNS_RESOURCE_FAVORITE,
   PHOTOS_QUERY_COLUMNS_RESOURCE_SHARED,
-  PHOTOS_QUERY_COLUMNS_DATE_CREATED
+  PHOTOS_QUERY_COLUMNS_DATE_CREATED,
+  PHOTOS_QUERY_COLUMNS_EQUIPMENT
 } PhotosQueryColumns;
 
 typedef enum


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