[gnome-photos] base-item: Implement refresh and dummy destroy methods
- From: Debarshi Ray <debarshir src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [gnome-photos] base-item: Implement refresh and dummy destroy methods
- Date: Sat, 18 Aug 2012 22:53:53 +0000 (UTC)
commit 978bf0114a5c96ef90837dece6150d5d4ea253a9
Author: Debarshi Ray <debarshir gnome org>
Date: Fri Aug 17 04:02:48 2012 +0200
base-item: Implement refresh and dummy destroy methods
src/photos-base-item.c | 37 +++++++++++++++++++++++++++++++++++++
src/photos-base-item.h | 4 ++++
2 files changed, 41 insertions(+), 0 deletions(-)
---
diff --git a/src/photos-base-item.c b/src/photos-base-item.c
index 822ee51..6ca2d7f 100644
--- a/src/photos-base-item.c
+++ b/src/photos-base-item.c
@@ -29,6 +29,7 @@
#include "photos-base-item.h"
#include "photos-query.h"
+#include "photos-single-item-job.h"
#include "photos-utils.h"
@@ -77,6 +78,9 @@ static guint signals[LAST_SIGNAL] = { 0 };
G_DEFINE_TYPE (PhotosBaseItem, photos_base_item, G_TYPE_OBJECT);
+static void photos_base_item_populate_from_cursor (PhotosBaseItem *self, TrackerSparqlCursor *cursor);
+
+
static GIcon *
photos_base_item_create_symbolic_emblem (const gchar *name)
{
@@ -213,6 +217,21 @@ photos_base_item_default_set_favorite (PhotosBaseItem *self, gboolean favorite)
static void
+photos_base_item_refresh_executed (TrackerSparqlCursor *cursor, gpointer user_data)
+{
+ PhotosBaseItem *self = PHOTOS_BASE_ITEM (user_data);
+
+ if (cursor == NULL)
+ goto out;
+
+ photos_base_item_populate_from_cursor (self, cursor);
+
+ out:
+ g_object_unref (self);
+}
+
+
+static void
photos_base_item_refresh_thumb_path_pixbuf (GObject *source_object, GAsyncResult *res, gpointer user_data)
{
PhotosBaseItem *self = PHOTOS_BASE_ITEM (user_data);
@@ -696,6 +715,13 @@ photos_base_item_can_trash (PhotosBaseItem *self)
}
+void
+photos_base_item_destroy (PhotosBaseItem *self)
+{
+ /* TODO: collection icon watcher, SearchCategoryManager */
+}
+
+
const gchar *
photos_base_item_get_author (PhotosBaseItem *self)
{
@@ -826,6 +852,17 @@ photos_base_item_load_finish (PhotosBaseItem *self, GAsyncResult *res, GError **
void
+photos_base_item_refresh (PhotosBaseItem *self)
+{
+ PhotosSingleItemJob *job;
+
+ job = photos_single_item_job_new (self->priv->id);
+ photos_single_item_job_run (job, PHOTOS_QUERY_FLAGS_NONE, photos_base_item_refresh_executed, g_object_ref (self));
+ g_object_unref (job);
+}
+
+
+void
photos_base_item_set_default_app_name (PhotosBaseItem *self, const gchar *default_app_name)
{
PhotosBaseItemPrivate *priv = self->priv;
diff --git a/src/photos-base-item.h b/src/photos-base-item.h
index b1088ed..3a6454a 100644
--- a/src/photos-base-item.h
+++ b/src/photos-base-item.h
@@ -75,6 +75,8 @@ GType photos_base_item_get_type (void) G_GNUC_CONST;
gboolean photos_base_item_can_trash (PhotosBaseItem *self);
+void photos_base_item_destroy (PhotosBaseItem *self);
+
const gchar *photos_base_item_get_author (PhotosBaseItem *self);
const gchar *photos_base_item_get_default_app_name (PhotosBaseItem *self);
@@ -104,6 +106,8 @@ void photos_base_item_load_async (PhotosBaseItem *self,
GdkPixbuf *photos_base_item_load_finish (PhotosBaseItem *self, GAsyncResult *res, GError **error);
+void photos_base_item_refresh (PhotosBaseItem *self);
+
void photos_base_item_set_default_app_name (PhotosBaseItem *self, const gchar *default_app_name);
void photos_base_item_set_favorite (PhotosBaseItem *self, gboolean favorite);
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]