[gnome-photos] base-item: Disable favorite albums when reading from the database
- From: Debarshi Ray <debarshir src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [gnome-photos] base-item: Disable favorite albums when reading from the database
- Date: Thu, 21 Apr 2016 06:54:48 +0000 (UTC)
commit 1c04a6a9e0333f0375868642348781b1fba040db
Author: Debarshi Ray <debarshir gnome org>
Date: Tue Apr 19 19:02:03 2016 +0200
base-item: Disable favorite albums when reading from the database
If the member variable doesn't reflect the final outcome, then we will
have to call photos_base_item_is_favorite instead of directly checking
the variable inside the class. eg., when deciding whether or not to
show the emblem. This seems a bit wasteful, when we don't care about
the actual value in the database.
https://bugzilla.gnome.org/show_bug.cgi?id=764680
src/photos-base-item.c | 7 +++++--
1 files changed, 5 insertions(+), 2 deletions(-)
---
diff --git a/src/photos-base-item.c b/src/photos-base-item.c
index ff7eb84..7648bf3 100644
--- a/src/photos-base-item.c
+++ b/src/photos-base-item.c
@@ -1440,6 +1440,7 @@ photos_base_item_populate_from_cursor (PhotosBaseItem *self, TrackerSparqlCursor
{
PhotosBaseItemPrivate *priv = self->priv;
GTimeVal timeval;
+ gboolean favorite;
const gchar *date_created;
const gchar *equipment;
const gchar *flash;
@@ -1455,7 +1456,7 @@ photos_base_item_populate_from_cursor (PhotosBaseItem *self, TrackerSparqlCursor
priv->identifier = g_strdup (tracker_sparql_cursor_get_string (cursor, PHOTOS_QUERY_COLUMNS_IDENTIFIER,
NULL));
priv->author = g_strdup (tracker_sparql_cursor_get_string (cursor, PHOTOS_QUERY_COLUMNS_AUTHOR, NULL));
priv->resource_urn = g_strdup (tracker_sparql_cursor_get_string (cursor,
PHOTOS_QUERY_COLUMNS_RESOURCE_URN, NULL));
- priv->favorite = tracker_sparql_cursor_get_boolean (cursor, PHOTOS_QUERY_COLUMNS_RESOURCE_FAVORITE);
+ favorite = tracker_sparql_cursor_get_boolean (cursor, PHOTOS_QUERY_COLUMNS_RESOURCE_FAVORITE);
mtime = tracker_sparql_cursor_get_string (cursor, PHOTOS_QUERY_COLUMNS_MTIME, NULL);
if (mtime != NULL)
@@ -1470,6 +1471,8 @@ photos_base_item_populate_from_cursor (PhotosBaseItem *self, TrackerSparqlCursor
priv->rdf_type = g_strdup (tracker_sparql_cursor_get_string (cursor, PHOTOS_QUERY_COLUMNS_RDF_TYPE, NULL));
photos_base_item_update_info_from_type (self);
+ priv->favorite = favorite && !priv->collection;
+
date_created = tracker_sparql_cursor_get_string (cursor, PHOTOS_QUERY_COLUMNS_DATE_CREATED, NULL);
if (date_created != NULL)
{
@@ -2205,7 +2208,7 @@ gboolean
photos_base_item_is_favorite (PhotosBaseItem *self)
{
g_return_val_if_fail (PHOTOS_IS_BASE_ITEM (self), FALSE);
- return !self->priv->collection && self->priv->favorite;
+ return self->priv->favorite;
}
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]