[gnome-photos/wip/rishi/collection: 25/25] base-item: Add a refresh_icon virtual method
- From: Debarshi Ray <debarshir src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [gnome-photos/wip/rishi/collection: 25/25] base-item: Add a refresh_icon virtual method
- Date: Tue, 13 Feb 2018 22:24:53 +0000 (UTC)
commit a8773ebdf0a41034c0f9edae8bcd315c42bd4de7
Author: Debarshi Ray <debarshir gnome org>
Date: Thu Jan 25 15:20:03 2018 +0100
base-item: Add a refresh_icon virtual method
This will enable a future BaseItem sub-class for attached devices to
hook into the thumbnailing process to gather additional information
about the underlying device before it gets to creating the thumbnail.
https://bugzilla.gnome.org/show_bug.cgi?id=751212
src/photos-base-item.c | 71 +++++++++++++++++++++++++-------------------------
src/photos-base-item.h | 1 +
2 files changed, 37 insertions(+), 35 deletions(-)
---
diff --git a/src/photos-base-item.c b/src/photos-base-item.c
index 2b118ca6..53e8c4c7 100644
--- a/src/photos-base-item.c
+++ b/src/photos-base-item.c
@@ -991,6 +991,40 @@ photos_base_item_default_open (PhotosBaseItem *self, GtkWindow *parent, guint32
}
+static void
+photos_base_item_default_refresh_icon (PhotosBaseItem *self)
+{
+ PhotosBaseItemPrivate *priv;
+
+ priv = photos_base_item_get_instance_private (self);
+
+ if (priv->thumb_path != NULL)
+ {
+ photos_base_item_refresh_thumb_path (self);
+ return;
+ }
+
+ photos_base_item_set_thumbnailing_icon (self);
+
+ if (priv->failed_thumbnailing)
+ return;
+
+ if (priv->collection)
+ {
+ photos_base_item_refresh_collection_icon (self);
+ return;
+ }
+
+ photos_base_item_query_info_async (self,
+ G_FILE_ATTRIBUTE_THUMBNAIL_PATH,
+ G_FILE_QUERY_INFO_NONE,
+ G_PRIORITY_DEFAULT,
+ priv->cancellable,
+ photos_base_item_file_query_info,
+ NULL);
+}
+
+
static void
photos_base_item_default_update_type_description (PhotosBaseItem *self)
{
@@ -2621,40 +2655,6 @@ photos_base_item_save_to_stream_load (GObject *source_object, GAsyncResult *res,
}
-static void
-photos_base_item_refresh_icon (PhotosBaseItem *self)
-{
- PhotosBaseItemPrivate *priv;
-
- priv = photos_base_item_get_instance_private (self);
-
- if (priv->thumb_path != NULL)
- {
- photos_base_item_refresh_thumb_path (self);
- return;
- }
-
- photos_base_item_set_thumbnailing_icon (self);
-
- if (priv->failed_thumbnailing)
- return;
-
- if (priv->collection)
- {
- photos_base_item_refresh_collection_icon (self);
- return;
- }
-
- photos_base_item_query_info_async (self,
- G_FILE_ATTRIBUTE_THUMBNAIL_PATH,
- G_FILE_QUERY_INFO_NONE,
- G_PRIORITY_DEFAULT,
- priv->cancellable,
- photos_base_item_file_query_info,
- NULL);
-}
-
-
static void
photos_base_item_update_info_from_type (PhotosBaseItem *self)
{
@@ -2810,7 +2810,7 @@ photos_base_item_populate_from_cursor (PhotosBaseItem *self, TrackerSparqlCursor
name_fallback = PHOTOS_BASE_ITEM_GET_CLASS (self)->create_name_fallback (self);
photos_utils_take_string (&priv->name_fallback, name_fallback);
- photos_base_item_refresh_icon (self);
+ PHOTOS_BASE_ITEM_GET_CLASS (self)->refresh_icon (self);
}
@@ -3046,6 +3046,7 @@ photos_base_item_class_init (PhotosBaseItemClass *class)
class->create_thumbnail_path = photos_base_item_default_create_thumbnail_path;
class->metadata_add_shared = photos_base_item_default_metadata_add_shared;
class->open = photos_base_item_default_open;
+ class->refresh_icon = photos_base_item_default_refresh_icon;
class->set_favorite = photos_base_item_default_set_favorite;
class->update_type_description = photos_base_item_default_update_type_description;
diff --git a/src/photos-base-item.h b/src/photos-base-item.h
index 516c5828..daf97d35 100644
--- a/src/photos-base-item.h
+++ b/src/photos-base-item.h
@@ -69,6 +69,7 @@ struct _PhotosBaseItemClass
GCancellable *cancellable,
GError **error);
void (*open) (PhotosBaseItem *self, GtkWindow *parent, guint32 timestamp);
+ void (*refresh_icon) (PhotosBaseItem *self);
void (*set_favorite) (PhotosBaseItem *self, gboolean favorite);
void (*trash) (PhotosBaseItem *self);
void (*update_type_description) (PhotosBaseItem *self);
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]