[gnome-photos/wip/rishi/item-manager: 1/3] base-manager: Make get_object_by_id a virtual method
- From: Debarshi Ray <debarshir src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [gnome-photos/wip/rishi/item-manager: 1/3] base-manager: Make get_object_by_id a virtual method
- Date: Thu, 28 Jul 2016 07:23:05 +0000 (UTC)
commit 84a4de2092d4b1f3a2452ab452e75c88eda94228
Author: Debarshi Ray <debarshir gnome org>
Date: Mon Jul 25 10:37:48 2016 +0200
base-manager: Make get_object_by_id a virtual method
This is required to split PhotosItemManager to have a separate child
manager for each mode.
src/photos-base-manager.c | 32 ++++++++++++++++++++------------
src/photos-base-manager.h | 1 +
2 files changed, 21 insertions(+), 12 deletions(-)
---
diff --git a/src/photos-base-manager.c b/src/photos-base-manager.c
index 0cd249b..4800511 100644
--- a/src/photos-base-manager.c
+++ b/src/photos-base-manager.c
@@ -87,6 +87,24 @@ photos_base_manager_default_get_filter (PhotosBaseManager *self, gint flags)
}
+static GObject *
+photos_base_manager_default_get_object_by_id (PhotosBaseManager *self, const gchar *id)
+{
+ PhotosBaseManagerPrivate *priv;
+ GObject *ret_val = NULL;
+
+ priv = photos_base_manager_get_instance_private (self);
+
+ if (id == NULL)
+ goto out;
+
+ ret_val = g_hash_table_lookup (priv->objects, id);
+
+ out:
+ return ret_val;
+}
+
+
static gchar *
photos_base_manager_default_get_where (PhotosBaseManager *self, gint flags)
{
@@ -214,6 +232,7 @@ photos_base_manager_class_init (PhotosBaseManagerClass *class)
object_class->set_property = photos_base_manager_set_property;
class->add_object = photos_base_manager_default_add_object;
class->get_filter = photos_base_manager_default_get_filter;
+ class->get_object_by_id = photos_base_manager_default_get_object_by_id;
class->get_where = photos_base_manager_default_get_where;
class->remove_object_by_id = photos_base_manager_default_remove_object_by_id;
class->set_active_object = photos_base_manager_default_set_active_object;
@@ -385,18 +404,7 @@ photos_base_manager_get_filter (PhotosBaseManager *self, gint flags)
GObject *
photos_base_manager_get_object_by_id (PhotosBaseManager *self, const gchar *id)
{
- PhotosBaseManagerPrivate *priv;
- GObject *ret_val = NULL;
-
- priv = photos_base_manager_get_instance_private (self);
-
- if (id == NULL)
- goto out;
-
- ret_val = g_hash_table_lookup (priv->objects, id);
-
- out:
- return ret_val;
+ return PHOTOS_BASE_MANAGER_GET_CLASS (self)->get_object_by_id (self, id);
}
diff --git a/src/photos-base-manager.h b/src/photos-base-manager.h
index 143087f..153f371 100644
--- a/src/photos-base-manager.h
+++ b/src/photos-base-manager.h
@@ -67,6 +67,7 @@ struct _PhotosBaseManagerClass
/* virtual methods */
void (*add_object) (PhotosBaseManager *self, GObject *object);
gchar *(*get_filter) (PhotosBaseManager *self, gint flags);
+ GObject *(*get_object_by_id) (PhotosBaseManager *self, const gchar *id);
gchar *(*get_where) (PhotosBaseManager *self, gint flags);
void (*remove_object_by_id) (PhotosBaseManager *self, const gchar *id);
gboolean (*set_active_object) (PhotosBaseManager *self, GObject *object);
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]