[gnome-photos/wip/foo: 8/8] query-builder: Simplify photos_query_builder_count_query



commit b0c8aabf1e4ac82d45149c3a4093b181d5d25e39
Author: Debarshi Ray <debarshir gnome org>
Date:   Tue Apr 9 01:09:12 2013 +0200

    query-builder: Simplify photos_query_builder_count_query

 src/photos-query-builder.c |   26 ++++----------------------
 1 files changed, 4 insertions(+), 22 deletions(-)
---
diff --git a/src/photos-query-builder.c b/src/photos-query-builder.c
index 1d8fb2f..5f79b38 100644
--- a/src/photos-query-builder.c
+++ b/src/photos-query-builder.c
@@ -257,30 +257,12 @@ PhotosQuery *
 photos_query_builder_count_query (gint flags)
 {
   PhotosBaseManager *srch_typ_mngr;
-  gchar *filter;
-  gchar *optional;
   gchar *sparql;
-  gchar *where;
-
-  filter = photos_query_builder_filter (flags);
-  optional = photos_query_builder_optional ();
-
-  srch_typ_mngr = photos_search_type_manager_new ();
-  photos_query_builder_set_search_type (flags);
-  where = photos_search_type_manager_get_where (PHOTOS_SEARCH_TYPE_MANAGER (srch_typ_mngr));
-
-  sparql = g_strconcat ("SELECT DISTINCT COUNT(?urn) WHERE { ",
-                        where, " ",
-                        optional, " ",
-                        filter,
-                        " }",
-                        NULL);
+  gchar *where_sparql;
 
-  photos_query_builder_set_search_type (PHOTOS_QUERY_FLAGS_NONE);
-  g_free (where);
-  g_free (optional);
-  g_free (filter);
-  g_object_unref (srch_typ_mngr);
+  where_sparql = photos_query_builder_where (TRUE, flags);
+  sparql = g_strconcat ("SELECT DISTINCT COUNT(?urn) ", where_sparql, NULL);
+  g_free (where_sparql);
 
   return photos_query_new (sparql);
 }


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