[gnome-photos/wip/rishi/resource-urn: 1/2] base-item: Simplify tracking the nie:DataSource
- From: Debarshi Ray <debarshir src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [gnome-photos/wip/rishi/resource-urn: 1/2] base-item: Simplify tracking the nie:DataSource
- Date: Wed, 13 Jul 2016 17:02:11 +0000 (UTC)
commit 6cb02af83c8d9fe94e86033317f5f05c7199e932
Author: Debarshi Ray <debarshir gnome org>
Date: Sat Jul 2 01:57:11 2016 +0200
base-item: Simplify tracking the nie:DataSource
Usually we will have a large number of BaseItems pointing to a small
number of nie:DataSources. The URNs of these nie:DataSources look like:
- gd:goa-account:account_1442355024_0
- urn:nepomuk:datasource:d289a99b2854ad9e9d19d497c112f6d9
This means that there will be several copies of a handful of strings.
Memory is fragmented and wasted.
Most of the time we want the online Source of the BaseItem, if any,
and not the nie:DataSource's URN. It is unnecessary work to go via the
SourceManager to resolve the URN.
Therefore, let's just keep a reference to the Source if the URN points
to an online nie:DataSource, and a GQuark to track the URN itself. That
means we replace a pointer and heap allocated string with two pointers
and a 32-bit integer. Some sub-classes were using one of those two
pointers anyway. We can't say how much memory or fragmentation we save
without actual measurements, but it isn't any worse and it does
simplify the rest of the code. The little extra work while reading the
TrackerSparqlCursor data will be masked by the disk I/O and IPC
involved.
https://bugzilla.gnome.org/show_bug.cgi?id=768766
src/photos-base-item.c | 44 ++++++++++++++++++++++++++++++---
src/photos-base-item.h | 4 +++
src/photos-facebook-item.c | 36 +++-----------------------
src/photos-flickr-item.c | 35 +++-----------------------
src/photos-google-item.c | 32 +++---------------------
src/photos-media-server-item.c | 27 +------------------
src/photos-organize-collection-view.c | 7 +----
src/photos-utils.c | 6 +---
src/photos-utils.h | 3 +-
9 files changed, 63 insertions(+), 131 deletions(-)
---
diff --git a/src/photos-base-item.c b/src/photos-base-item.c
index c838581..9e58207 100644
--- a/src/photos-base-item.c
+++ b/src/photos-base-item.c
@@ -42,6 +42,7 @@
#include "egg-counter.h"
#include "photos-application.h"
#include "photos-base-item.h"
+#include "photos-base-manager.h"
#include "photos-collection-icon-watcher.h"
#include "photos-debug.h"
#include "photos-delete-item-job.h"
@@ -75,9 +76,12 @@ struct _PhotosBaseItemPrivate
GQuark equipment;
GQuark flash;
GQuark orientation;
+ GQuark resource_urn;
+ PhotosBaseManager *src_mngr;
PhotosCollectionIconWatcher *watcher;
PhotosPipeline *pipeline;
PhotosSelectionController *sel_cntrlr;
+ PhotosSource *source;
TrackerSparqlCursor *cursor;
gboolean collection;
gboolean failed_thumbnailing;
@@ -91,7 +95,6 @@ struct _PhotosBaseItemPrivate
gchar *name;
gchar *name_fallback;
gchar *rdf_type;
- gchar *resource_urn;
gchar *thumb_path;
gchar *type_description;
gchar *uri;
@@ -1512,6 +1515,7 @@ photos_base_item_populate_from_cursor (PhotosBaseItem *self, TrackerSparqlCursor
{
PhotosBaseItemPrivate *priv = self->priv;
GTimeVal timeval;
+ PhotosSource *source;
gboolean favorite;
const gchar *author;
const gchar *date_created;
@@ -1524,6 +1528,7 @@ photos_base_item_populate_from_cursor (PhotosBaseItem *self, TrackerSparqlCursor
const gchar *orientation;
const gchar *rdf_type;
const gchar *resource_urn;
+ const gchar *source_id;
const gchar *title;
const gchar *uri;
gchar *filename;
@@ -1544,7 +1549,17 @@ photos_base_item_populate_from_cursor (PhotosBaseItem *self, TrackerSparqlCursor
photos_utils_set_string (&priv->author, author);
resource_urn = tracker_sparql_cursor_get_string (cursor, PHOTOS_QUERY_COLUMNS_RESOURCE_URN, NULL);
- photos_utils_set_string (&priv->resource_urn, resource_urn);
+ priv->resource_urn = g_quark_from_string (resource_urn);
+
+ if (resource_urn != NULL && g_str_has_prefix (resource_urn, "gd:goa-account:"))
+ source_id = resource_urn;
+ else
+ source_id = PHOTOS_SOURCE_STOCK_LOCAL;
+
+ source = PHOTOS_SOURCE (photos_base_manager_get_object_by_id (priv->src_mngr, source_id));
+ if (G_UNLIKELY (source == NULL))
+ g_warning ("Unable to find a source for %s", resource_urn);
+ g_set_object (&priv->source, source);
favorite = tracker_sparql_cursor_get_boolean (cursor, PHOTOS_QUERY_COLUMNS_RESOURCE_FAVORITE);
@@ -1687,9 +1702,11 @@ photos_base_item_dispose (GObject *object)
g_clear_object (&priv->load_graph);
g_clear_object (&priv->processor);
g_clear_object (&priv->original_icon);
+ g_clear_object (&priv->src_mngr);
g_clear_object (&priv->watcher);
g_clear_object (&priv->pipeline);
g_clear_object (&priv->sel_cntrlr);
+ g_clear_object (&priv->source);
g_clear_object (&priv->cursor);
G_OBJECT_CLASS (photos_base_item_parent_class)->dispose (object);
@@ -1711,7 +1728,6 @@ photos_base_item_finalize (GObject *object)
g_free (priv->name);
g_free (priv->name_fallback);
g_free (priv->rdf_type);
- g_free (priv->resource_urn);
g_free (priv->thumb_path);
g_free (priv->type_description);
g_free (priv->uri);
@@ -1770,17 +1786,23 @@ static void
photos_base_item_init (PhotosBaseItem *self)
{
PhotosBaseItemPrivate *priv;
+ GApplication *app;
+ PhotosSearchContextState *state;
EGG_COUNTER_INC (instances);
self->priv = photos_base_item_get_instance_private (self);
priv = self->priv;
+ app = g_application_get_default ();
+ state = photos_search_context_get_state (PHOTOS_SEARCH_CONTEXT (app));
+
priv->cancellable = g_cancellable_new ();
g_mutex_init (&priv->mutex_download);
g_mutex_init (&priv->mutex);
+ priv->src_mngr = g_object_ref (state->src_mngr);
priv->sel_cntrlr = photos_selection_controller_dup_singleton ();
}
@@ -2233,8 +2255,22 @@ photos_base_item_get_original_icon (PhotosBaseItem *self)
const gchar *
photos_base_item_get_resource_urn (PhotosBaseItem *self)
{
+ PhotosBaseItemPrivate *priv;
+ const gchar *resource_urn;
+
+ g_return_val_if_fail (PHOTOS_IS_BASE_ITEM (self), NULL);
+ priv = self->priv;
+
+ resource_urn = g_quark_to_string (priv->resource_urn);
+ return resource_urn;
+}
+
+
+PhotosSource *
+photos_base_item_get_source (PhotosBaseItem *self)
+{
g_return_val_if_fail (PHOTOS_IS_BASE_ITEM (self), NULL);
- return self->priv->resource_urn;
+ return self->priv->source;
}
diff --git a/src/photos-base-item.h b/src/photos-base-item.h
index b2c454f..eba5fc6 100644
--- a/src/photos-base-item.h
+++ b/src/photos-base-item.h
@@ -32,6 +32,8 @@
#include <glib-object.h>
#include <gtk/gtk.h>
+#include "photos-source.h"
+
G_BEGIN_DECLS
#define PHOTOS_TYPE_BASE_ITEM (photos_base_item_get_type ())
@@ -167,6 +169,8 @@ GdkPixbuf *photos_base_item_get_original_icon (PhotosBaseItem *se
const gchar *photos_base_item_get_resource_urn (PhotosBaseItem *self);
+PhotosSource *photos_base_item_get_source (PhotosBaseItem *self);
+
GtkWidget *photos_base_item_get_source_widget (PhotosBaseItem *self);
cairo_surface_t *photos_base_item_get_surface (PhotosBaseItem *self);
diff --git a/src/photos-facebook-item.c b/src/photos-facebook-item.c
index 00c6af6..2c5b218 100644
--- a/src/photos-facebook-item.c
+++ b/src/photos-facebook-item.c
@@ -34,10 +34,8 @@
#include <goa/goa.h>
#include <libgnome-desktop/gnome-desktop-thumbnail.h>
-#include "photos-base-manager.h"
#include "photos-debug.h"
#include "photos-facebook-item.h"
-#include "photos-search-context.h"
#include "photos-source.h"
#include "photos-utils.h"
@@ -45,7 +43,6 @@
struct _PhotosFacebookItem
{
PhotosBaseItem parent_instance;
- PhotosBaseManager *src_mngr;
};
struct _PhotosFacebookItemClass
@@ -86,14 +83,13 @@ photos_facebook_item_create_filename_fallback (PhotosBaseItem *item)
static gchar *
photos_facebook_item_create_name_fallback (PhotosBaseItem *item)
{
- PhotosFacebookItem *self = PHOTOS_FACEBOOK_ITEM (item);
GDateTime *date_modified;
const gchar *provider_name;
gchar *ret_val;
gchar *date_modified_str;
gint64 mtime;
- provider_name = photos_utils_get_provider_name (self->src_mngr, item);
+ provider_name = photos_utils_get_provider_name (item);
mtime = photos_base_item_get_mtime (item);
date_modified = g_date_time_new_from_unix_local (mtime);
@@ -113,14 +109,12 @@ photos_facebook_item_create_name_fallback (PhotosBaseItem *item)
static GFBGraphPhoto *
photos_facebook_get_gfbgraph_photo (PhotosBaseItem *item, GCancellable *cancellable, GError **error)
{
- PhotosFacebookItem *self = PHOTOS_FACEBOOK_ITEM (item);
PhotosSource *source;
- const gchar *identifier, *resource_urn;
+ const gchar *identifier;
GFBGraphGoaAuthorizer *authorizer;
GFBGraphPhoto *photo = NULL;
- resource_urn = photos_base_item_get_resource_urn (item);
- source = PHOTOS_SOURCE (photos_base_manager_get_object_by_id (self->src_mngr, resource_urn));
+ source = photos_base_item_get_source (item);
authorizer = gfbgraph_goa_authorizer_new (photos_source_get_goa_object (source));
identifier = photos_base_item_get_identifier (item) + strlen ("facebook:");
@@ -250,11 +244,10 @@ photos_facebook_item_download (PhotosBaseItem *item, GCancellable *cancellable,
static GtkWidget *
photos_facebook_item_get_source_widget (PhotosBaseItem *item)
{
- PhotosFacebookItem *self = PHOTOS_FACEBOOK_ITEM (item);
GtkWidget *source_widget;
const gchar *name;
- name = photos_utils_get_provider_name (self->src_mngr, item);
+ name = photos_utils_get_provider_name (item);
source_widget = gtk_link_button_new_with_label ("https://www.facebook.com/", name);
gtk_widget_set_halign (source_widget, GTK_ALIGN_START);
@@ -289,32 +282,14 @@ photos_facebook_item_constructed (GObject *object)
G_OBJECT_CLASS (photos_facebook_item_parent_class)->constructed (object);
- name = photos_utils_get_provider_name (self->src_mngr, PHOTOS_BASE_ITEM (self));
+ name = photos_utils_get_provider_name (PHOTOS_BASE_ITEM (self));
photos_base_item_set_default_app_name (PHOTOS_BASE_ITEM (self), name);
}
static void
-photos_facebook_item_dispose (GObject *object)
-{
- PhotosFacebookItem *self = PHOTOS_FACEBOOK_ITEM (object);
-
- g_clear_object (&self->src_mngr);
-
- G_OBJECT_CLASS (photos_facebook_item_parent_class)->dispose (object);
-}
-
-
-static void
photos_facebook_item_init (PhotosFacebookItem *self)
{
- GApplication *app;
- PhotosSearchContextState *state;
-
- app = g_application_get_default ();
- state = photos_search_context_get_state (PHOTOS_SEARCH_CONTEXT (app));
-
- self->src_mngr = g_object_ref (state->src_mngr);
}
@@ -328,7 +303,6 @@ photos_facebook_item_class_init (PhotosFacebookItemClass *class)
base_item_class->miner_object_path = "/org/gnome/OnlineMiners/Facebook";
object_class->constructed = photos_facebook_item_constructed;
- object_class->dispose = photos_facebook_item_dispose;
base_item_class->create_filename_fallback = photos_facebook_item_create_filename_fallback;
base_item_class->create_name_fallback = photos_facebook_item_create_name_fallback;
base_item_class->create_thumbnail = photos_facebook_item_create_thumbnail;
diff --git a/src/photos-flickr-item.c b/src/photos-flickr-item.c
index 249782a..090be0f 100644
--- a/src/photos-flickr-item.c
+++ b/src/photos-flickr-item.c
@@ -34,10 +34,8 @@
#include <grilo.h>
#include <libgnome-desktop/gnome-desktop-thumbnail.h>
-#include "photos-base-manager.h"
#include "photos-debug.h"
#include "photos-flickr-item.h"
-#include "photos-search-context.h"
#include "photos-source.h"
#include "photos-utils.h"
@@ -45,7 +43,6 @@
struct _PhotosFlickrItem
{
PhotosBaseItem parent_instance;
- PhotosBaseManager *src_mngr;
};
struct _PhotosFlickrItemClass
@@ -91,14 +88,13 @@ photos_flickr_item_create_filename_fallback (PhotosBaseItem *item)
static gchar *
photos_flickr_item_create_name_fallback (PhotosBaseItem *item)
{
- PhotosFlickrItem *self = PHOTOS_FLICKR_ITEM (item);
GDateTime *date_modified;
const gchar *provider_name;
gchar *ret_val;
gchar *date_modified_str;
gint64 mtime;
- provider_name = photos_utils_get_provider_name (self->src_mngr, item);
+ provider_name = photos_utils_get_provider_name (item);
mtime = photos_base_item_get_mtime (item);
date_modified = g_date_time_new_from_unix_local (mtime);
@@ -327,11 +323,10 @@ photos_flickr_item_download (PhotosBaseItem *item, GCancellable *cancellable, GE
static GtkWidget *
photos_flickr_item_get_source_widget (PhotosBaseItem *item)
{
- PhotosFlickrItem *self = PHOTOS_FLICKR_ITEM (item);
GtkWidget *source_widget;
const gchar *name;
- name = photos_utils_get_provider_name (self->src_mngr, item);
+ name = photos_utils_get_provider_name (item);
source_widget = gtk_link_button_new_with_label ("https://www.flickr.com/", name);
gtk_widget_set_halign (source_widget, GTK_ALIGN_START);
@@ -342,20 +337,17 @@ photos_flickr_item_get_source_widget (PhotosBaseItem *item)
static void
photos_flickr_item_open (PhotosBaseItem *item, GdkScreen *screen, guint32 timestamp)
{
- PhotosFlickrItem *self = PHOTOS_FLICKR_ITEM (item);
GError *error;
GoaAccount *account;
GoaObject *object;
PhotosSource *source;
const gchar *identifier;
const gchar *identity;
- const gchar *resource_urn;
gchar *flickr_uri;
identifier = photos_base_item_get_identifier (item) + strlen ("flickr:");
- resource_urn = photos_base_item_get_resource_urn (item);
- source = PHOTOS_SOURCE (photos_base_manager_get_object_by_id (self->src_mngr, resource_urn));
+ source = photos_base_item_get_source (item);
object = photos_source_get_goa_object (source);
account = goa_object_peek_account (object);
identity = goa_account_get_identity (account);
@@ -382,32 +374,14 @@ photos_flickr_item_constructed (GObject *object)
G_OBJECT_CLASS (photos_flickr_item_parent_class)->constructed (object);
- name = photos_utils_get_provider_name (self->src_mngr, PHOTOS_BASE_ITEM (self));
+ name = photos_utils_get_provider_name (PHOTOS_BASE_ITEM (self));
photos_base_item_set_default_app_name (PHOTOS_BASE_ITEM (self), name);
}
static void
-photos_flickr_item_dispose (GObject *object)
-{
- PhotosFlickrItem *self = PHOTOS_FLICKR_ITEM (object);
-
- g_clear_object (&self->src_mngr);
-
- G_OBJECT_CLASS (photos_flickr_item_parent_class)->dispose (object);
-}
-
-
-static void
photos_flickr_item_init (PhotosFlickrItem *self)
{
- GApplication *app;
- PhotosSearchContextState *state;
-
- app = g_application_get_default ();
- state = photos_search_context_get_state (PHOTOS_SEARCH_CONTEXT (app));
-
- self->src_mngr = g_object_ref (state->src_mngr);
}
@@ -421,7 +395,6 @@ photos_flickr_item_class_init (PhotosFlickrItemClass *class)
base_item_class->miner_object_path = "/org/gnome/OnlineMiners/Flickr";
object_class->constructed = photos_flickr_item_constructed;
- object_class->dispose = photos_flickr_item_dispose;
base_item_class->create_filename_fallback = photos_flickr_item_create_filename_fallback;
base_item_class->create_name_fallback = photos_flickr_item_create_name_fallback;
base_item_class->create_thumbnail = photos_flickr_item_create_thumbnail;
diff --git a/src/photos-google-item.c b/src/photos-google-item.c
index f79d995..a044b4f 100644
--- a/src/photos-google-item.c
+++ b/src/photos-google-item.c
@@ -32,10 +32,8 @@
#include <glib/gi18n.h>
#include <libgnome-desktop/gnome-desktop-thumbnail.h>
-#include "photos-base-manager.h"
#include "photos-debug.h"
#include "photos-google-item.h"
-#include "photos-search-context.h"
#include "photos-source.h"
#include "photos-utils.h"
@@ -43,7 +41,6 @@
struct _PhotosGoogleItem
{
PhotosBaseItem parent_instance;
- PhotosBaseManager *src_mngr;
};
struct _PhotosGoogleItemClass
@@ -95,7 +92,7 @@ photos_google_item_create_name_fallback (PhotosBaseItem *item)
gchar *date_modified_str;
gint64 mtime;
- provider_name = photos_utils_get_provider_name (self->src_mngr, item);
+ provider_name = photos_utils_get_provider_name (item);
mtime = photos_base_item_get_mtime (item);
date_modified = g_date_time_new_from_unix_local (mtime);
@@ -123,10 +120,8 @@ photos_google_get_picasaweb_file (PhotosBaseItem *item, GCancellable *cancellabl
GDataPicasaWebQuery *query;
GDataPicasaWebService *service;
const gchar *identifier;
- const gchar *resource_urn;
- resource_urn = photos_base_item_get_resource_urn (item);
- source = PHOTOS_SOURCE (photos_base_manager_get_object_by_id (self->src_mngr, resource_urn));
+ source = photos_base_item_get_source (item);
authorizer = gdata_goa_authorizer_new (photos_source_get_goa_object (source));
identifier = photos_base_item_get_identifier (item) + strlen ("google:picasaweb:");
service = gdata_picasaweb_service_new (GDATA_AUTHORIZER (authorizer));
@@ -285,7 +280,7 @@ photos_google_item_get_source_widget (PhotosBaseItem *item)
GtkWidget *source_widget;
const gchar *name;
- name = photos_utils_get_provider_name (self->src_mngr, item);
+ name = photos_utils_get_provider_name (item);
source_widget = gtk_link_button_new_with_label ("https://picasaweb.google.com/", name);
gtk_widget_set_halign (source_widget, GTK_ALIGN_START);
@@ -322,32 +317,14 @@ photos_google_item_constructed (GObject *object)
G_OBJECT_CLASS (photos_google_item_parent_class)->constructed (object);
- name = photos_utils_get_provider_name (self->src_mngr, PHOTOS_BASE_ITEM (self));
+ name = photos_utils_get_provider_name (PHOTOS_BASE_ITEM (self));
photos_base_item_set_default_app_name (PHOTOS_BASE_ITEM (self), name);
}
static void
-photos_google_item_dispose (GObject *object)
-{
- PhotosGoogleItem *self = PHOTOS_GOOGLE_ITEM (object);
-
- g_clear_object (&self->src_mngr);
-
- G_OBJECT_CLASS (photos_google_item_parent_class)->dispose (object);
-}
-
-
-static void
photos_google_item_init (PhotosGoogleItem *self)
{
- GApplication *app;
- PhotosSearchContextState *state;
-
- app = g_application_get_default ();
- state = photos_search_context_get_state (PHOTOS_SEARCH_CONTEXT (app));
-
- self->src_mngr = g_object_ref (state->src_mngr);
}
@@ -361,7 +338,6 @@ photos_google_item_class_init (PhotosGoogleItemClass *class)
base_item_class->miner_object_path = "/org/gnome/OnlineMiners/GData";
object_class->constructed = photos_google_item_constructed;
- object_class->dispose = photos_google_item_dispose;
base_item_class->create_filename_fallback = photos_google_item_create_filename_fallback;
base_item_class->create_name_fallback = photos_google_item_create_name_fallback;
base_item_class->create_thumbnail = photos_google_item_create_thumbnail;
diff --git a/src/photos-media-server-item.c b/src/photos-media-server-item.c
index 58e6a95..86a24d4 100644
--- a/src/photos-media-server-item.c
+++ b/src/photos-media-server-item.c
@@ -31,10 +31,8 @@
#include <gio/gio.h>
#include <glib.h>
-#include "photos-base-manager.h"
#include "photos-debug.h"
#include "photos-media-server-item.h"
-#include "photos-search-context.h"
#include "photos-source.h"
#include "photos-utils.h"
@@ -42,7 +40,6 @@
struct _PhotosMediaServerItem
{
PhotosBaseItem parent_instance;
- PhotosBaseManager *src_mngr;
};
struct _PhotosMediaServerItemClass
@@ -158,11 +155,10 @@ photos_media_server_item_download (PhotosBaseItem *item, GCancellable *cancellab
static GtkWidget *
photos_media_server_item_get_source_widget (PhotosBaseItem *item)
{
- PhotosMediaServerItem *self = PHOTOS_MEDIA_SERVER_ITEM (item);
GtkWidget *source_widget;
const gchar *name;
- name = photos_utils_get_provider_name (self->src_mngr, item);
+ name = photos_utils_get_provider_name (item);
source_widget = gtk_label_new (name);
gtk_widget_set_halign (source_widget, GTK_ALIGN_START);
@@ -178,32 +174,14 @@ photos_media_server_item_constructed (GObject *object)
G_OBJECT_CLASS (photos_media_server_item_parent_class)->constructed (object);
- name = photos_utils_get_provider_name (self->src_mngr, PHOTOS_BASE_ITEM (self));
+ name = photos_utils_get_provider_name (PHOTOS_BASE_ITEM (self));
photos_base_item_set_default_app_name (PHOTOS_BASE_ITEM (self), name);
}
static void
-photos_media_server_item_dispose (GObject *object)
-{
- PhotosMediaServerItem *self = PHOTOS_MEDIA_SERVER_ITEM (object);
-
- g_clear_object (&self->src_mngr);
-
- G_OBJECT_CLASS (photos_media_server_item_parent_class)->dispose (object);
-}
-
-
-static void
photos_media_server_item_init (PhotosMediaServerItem *self)
{
- GApplication *app;
- PhotosSearchContextState *state;
-
- app = g_application_get_default ();
- state = photos_search_context_get_state (PHOTOS_SEARCH_CONTEXT (app));
-
- self->src_mngr = g_object_ref (state->src_mngr);
}
@@ -217,7 +195,6 @@ photos_media_server_item_class_init (PhotosMediaServerItemClass *class)
base_item_class->miner_object_path = "/org/gnome/OnlineMiners/MediaServer";
object_class->constructed = photos_media_server_item_constructed;
- object_class->dispose = photos_media_server_item_dispose;
base_item_class->create_filename_fallback = photos_media_server_item_create_filename_fallback;
base_item_class->create_name_fallback = photos_media_server_item_create_name_fallback;
base_item_class->create_thumbnail = photos_media_server_item_create_thumbnail;
diff --git a/src/photos-organize-collection-view.c b/src/photos-organize-collection-view.c
index 0ac3937..30f1b3d 100644
--- a/src/photos-organize-collection-view.c
+++ b/src/photos-organize-collection-view.c
@@ -50,7 +50,6 @@ struct _PhotosOrganizeCollectionViewPrivate
GtkListStore *model;
GtkTreeViewColumn *view_col;
PhotosBaseManager *item_mngr;
- PhotosBaseManager *src_mngr;
gboolean choice_confirmed;
};
@@ -188,10 +187,8 @@ photos_organize_collection_view_detail_cell (GtkTreeViewColumn *tree_column,
{
PhotosSource *source;
const gchar *name;
- const gchar *resource_urn;
- resource_urn = photos_base_item_get_resource_urn (PHOTOS_BASE_ITEM (object));
- source = PHOTOS_SOURCE (photos_base_manager_get_object_by_id (priv->src_mngr, resource_urn));
+ source = photos_base_item_get_source (PHOTOS_BASE_ITEM (object));
name = photos_source_get_name (source);
g_object_set (cell_renderer, "text", name, NULL);
gtk_cell_renderer_set_visible (cell_renderer, TRUE);
@@ -304,7 +301,6 @@ photos_organize_collection_view_dispose (GObject *object)
g_clear_object (&priv->model);
g_clear_object (&priv->item_mngr);
- g_clear_object (&priv->src_mngr);
G_OBJECT_CLASS (photos_organize_collection_view_parent_class)->dispose (object);
}
@@ -366,7 +362,6 @@ photos_organize_collection_view_init (PhotosOrganizeCollectionView *self)
NULL);
priv->item_mngr = g_object_ref (state->item_mngr);
- priv->src_mngr = g_object_ref (state->src_mngr);
gtk_widget_show (GTK_WIDGET (self));
}
diff --git a/src/photos-utils.c b/src/photos-utils.c
index cb21e92..b121ccb 100644
--- a/src/photos-utils.c
+++ b/src/photos-utils.c
@@ -1216,14 +1216,12 @@ photos_utils_get_pixbuf_common_suffix (GdkPixbufFormat *format)
const gchar *
-photos_utils_get_provider_name (PhotosBaseManager *src_mngr, PhotosBaseItem *item)
+photos_utils_get_provider_name (PhotosBaseItem *item)
{
PhotosSource *source;
const gchar *name;
- const gchar *resource_urn;
- resource_urn = photos_base_item_get_resource_urn (item);
- source = PHOTOS_SOURCE (photos_base_manager_get_object_by_id (src_mngr, resource_urn));
+ source = photos_base_item_get_source (item);
name = photos_source_get_name (source);
return name;
}
diff --git a/src/photos-utils.h b/src/photos-utils.h
index 1821811..68750f7 100644
--- a/src/photos-utils.h
+++ b/src/photos-utils.h
@@ -37,7 +37,6 @@
#include <tracker-sparql.h>
#include "photos-base-item.h"
-#include "photos-base-manager.h"
G_BEGIN_DECLS
@@ -148,7 +147,7 @@ gint photos_utils_get_icon_size_unscaled (void);
char* photos_utils_get_pixbuf_common_suffix (GdkPixbufFormat *format);
-const gchar *photos_utils_get_provider_name (PhotosBaseManager *src_mngr, PhotosBaseItem
*item);
+const gchar *photos_utils_get_provider_name (PhotosBaseItem *item);
GtkBorder *photos_utils_get_thumbnail_frame_border (void);
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]