[gnome-photos/wip/rishi/item-manager: 9/12] base-manager: Make get_active_object a virtual method



commit 7928216aa96fe7737eaeabfc0c057d191bd990d1
Author: Umang Jain <mailumangjain gmail com>
Date:   Mon Aug 15 00:38:45 2016 +0200

    base-manager: Make get_active_object a virtual method
    
    This is required to split PhotosItemManager to have a separate child
    manager for each mode.

 src/photos-base-manager.c |   16 ++++++++++++----
 src/photos-base-manager.h |    1 +
 2 files changed, 13 insertions(+), 4 deletions(-)
---
diff --git a/src/photos-base-manager.c b/src/photos-base-manager.c
index 41c9b68..fdfc6fc 100644
--- a/src/photos-base-manager.c
+++ b/src/photos-base-manager.c
@@ -80,6 +80,16 @@ photos_base_manager_default_add_object (PhotosBaseManager *self, GObject *object
 }
 
 
+static GObject *
+photos_base_manager_default_get_active_object (PhotosBaseManager *self)
+{
+  PhotosBaseManagerPrivate *priv;
+
+  priv = photos_base_manager_get_instance_private (self);
+  return priv->active_object;
+}
+
+
 static gchar *
 photos_base_manager_default_get_filter (PhotosBaseManager *self, gint flags)
 {
@@ -225,6 +235,7 @@ photos_base_manager_class_init (PhotosBaseManagerClass *class)
   object_class->finalize = photos_base_manager_finalize;
   object_class->set_property = photos_base_manager_set_property;
   class->add_object = photos_base_manager_default_add_object;
+  class->get_active_object = photos_base_manager_default_get_active_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;
@@ -325,10 +336,7 @@ photos_base_manager_get_action_id (PhotosBaseManager *self)
 GObject *
 photos_base_manager_get_active_object (PhotosBaseManager *self)
 {
-  PhotosBaseManagerPrivate *priv;
-
-  priv = photos_base_manager_get_instance_private (self);
-  return priv->active_object;
+  return PHOTOS_BASE_MANAGER_GET_CLASS (self)->get_active_object (self);
 }
 
 
diff --git a/src/photos-base-manager.h b/src/photos-base-manager.h
index 153f371..030d24d 100644
--- a/src/photos-base-manager.h
+++ b/src/photos-base-manager.h
@@ -66,6 +66,7 @@ struct _PhotosBaseManagerClass
 
   /* virtual methods */
   void (*add_object)      (PhotosBaseManager *self, GObject *object);
+  GObject *(*get_active_object) (PhotosBaseManager *self);
   gchar *(*get_filter)    (PhotosBaseManager *self, gint flags);
   GObject *(*get_object_by_id) (PhotosBaseManager *self, const gchar *id);
   gchar *(*get_where)    (PhotosBaseManager *self, gint flags);


[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]