[gnome-photos/wip/rishi/collection: 41/46] device item
- From: Debarshi Ray <debarshir src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [gnome-photos/wip/rishi/collection: 41/46] device item
- Date: Thu, 25 Jan 2018 14:58:15 +0000 (UTC)
commit 1fbd0cc877b3a2adebe4893ad967f3ad8a5ba408
Author: Debarshi Ray <debarshir gnome org>
Date: Thu Jan 25 15:08:14 2018 +0100
device item
src/photos-device-item.c | 39 +++++++++++++++++++++------------------
1 file changed, 21 insertions(+), 18 deletions(-)
---
diff --git a/src/photos-device-item.c b/src/photos-device-item.c
index 3f92b3bb..89829cfe 100644
--- a/src/photos-device-item.c
+++ b/src/photos-device-item.c
@@ -30,6 +30,7 @@
#include "photos-base-manager.h"
#include "photos-device-item.h"
#include "photos-error.h"
+#include "photos-filterable.h"
#include "photos-glib.h"
#include "photos-query.h"
#include "photos-search-context.h"
@@ -150,15 +151,16 @@ photos_device_item_get_volume_from_enclosing_mount (PhotosDeviceItem *self, GMou
static void
-photos_device_item_populate_from_cursor_find_enclosing_mount (GObject *source_object,
- GAsyncResult *res,
- gpointer user_data)
+photos_device_item_refresh_icon_find_enclosing_mount (GObject *source_object,
+ GAsyncResult *res,
+ gpointer user_data)
{
- PhotosDeviceItemPopulateFromCursorData *data = (PhotosDeviceItemPopulateFromCursorData *) user_data;
PhotosDeviceItem *self;
GFile *file = G_FILE (source_object);
g_autoptr (GMount) mount = NULL;
+ g_message ("photos_device_item_refresh_icon_find_enclosing_mount");
+
{
g_autoptr (GError) error = NULL;
@@ -172,21 +174,24 @@ photos_device_item_populate_from_cursor_find_enclosing_mount (GObject *source_ob
}
}
- self = data->item;
+ self = PHOTOS_DEVICE_ITEM (user_data);
g_clear_object (&self->volume);
if (mount != NULL)
{
self->volume = photos_device_item_get_volume_from_enclosing_mount (self, mount);
if (self->volume == NULL)
- g_warning ("Unable to find volume");
+ {
+ const gchar *id;
+
+ id = photos_filterable_get_id (PHOTOS_FILTERABLE (self));
+ g_warning ("Unable to find volume for %s", id);
+ }
}
- PHOTOS_BASE_ITEM_CLASS (photos_device_item_parent_class)->populate_from_cursor (PHOTOS_BASE_ITEM (self),
- data->cursor);
+ PHOTOS_BASE_ITEM_CLASS (photos_device_item_parent_class)->refresh_icon (PHOTOS_BASE_ITEM (self));
out:
- photos_device_item_populate_from_cursor_data_free (data);
return;
}
@@ -321,6 +326,7 @@ photos_device_item_create_thumbnail (PhotosBaseItem *item, GCancellable *cancell
height = photos_base_item_get_height (PHOTOS_BASE_ITEM (self));
width = photos_base_item_get_width (PHOTOS_BASE_ITEM (self));
thumbnail_path = photos_base_item_create_thumbnail_path (PHOTOS_BASE_ITEM (self));
+ g_message ("create thumbnail: %s", thumbnail_path);
if (!photos_utils_create_thumbnail (file,
mime_type,
@@ -476,28 +482,25 @@ photos_device_item_metadata_add_shared (PhotosBaseItem *item,
static void
-photos_device_item_populate_from_cursor (PhotosBaseItem *item, TrackerSparqlCursor *cursor)
+photos_device_item_refresh_icon (PhotosBaseItem *item)
{
PhotosDeviceItem *self = PHOTOS_DEVICE_ITEM (item);
g_autoptr (GFile) file = NULL;
- PhotosDeviceItemPopulateFromCursorData *data;
const gchar *uri;
g_cancellable_cancel (self->cancellable);
g_clear_object (&self->cancellable);
self->cancellable = g_cancellable_new ();
- uri = tracker_sparql_cursor_get_string (cursor, PHOTOS_QUERY_COLUMNS_URI, NULL);
- if (uri == NULL)
- uri = "";
+ g_message ("photos_device_item_refresh_icon");
+ uri = photos_base_item_get_uri (item);
file = g_file_new_for_uri (uri);
- data = photos_device_item_populate_from_cursor_data_new (self, cursor);
g_file_find_enclosing_mount_async (file,
G_PRIORITY_DEFAULT,
self->cancellable,
- photos_device_item_populate_from_cursor_find_enclosing_mount,
- data);
+ photos_device_item_refresh_icon_find_enclosing_mount,
+ self);
}
@@ -575,6 +578,6 @@ photos_device_item_class_init (PhotosDeviceItemClass *class)
base_item_class->download = photos_device_item_download;
base_item_class->get_source_widget = photos_device_item_get_source_widget;
base_item_class->metadata_add_shared = photos_device_item_metadata_add_shared;
- base_item_class->populate_from_cursor = photos_device_item_populate_from_cursor;
+ base_item_class->refresh_icon = photos_device_item_refresh_icon;
base_item_class->trash = photos_device_item_trash;
}
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]