[gnome-photos/wip/uajain/item-manager: 1/3] item-manager: adjust set active object vfunc
- From: Umang Jain <uajain src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [gnome-photos/wip/uajain/item-manager: 1/3] item-manager: adjust set active object vfunc
- Date: Sat, 30 Jul 2016 21:40:54 +0000 (UTC)
commit f0618e1113c9f53eba003d56aa3c9cd15c1a38b2
Author: Umang Jain <mailumangjain gmail com>
Date: Sat Jul 30 14:26:27 2016 +0530
item-manager: adjust set active object vfunc
src/photos-base-manager.c | 16 ++++++++++++----
src/photos-base-manager.h | 2 ++
src/photos-item-manager.c | 16 +++++++++++++---
3 files changed, 27 insertions(+), 7 deletions(-)
---
diff --git a/src/photos-base-manager.c b/src/photos-base-manager.c
index 1e2b9d7..5e32ac7 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)
{
@@ -236,6 +246,7 @@ photos_base_manager_class_init (PhotosBaseManagerClass *class)
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;
+ class->get_active_object = photos_base_manager_default_get_active_object;
g_object_class_install_property (object_class,
PROP_ACTION_ID,
@@ -338,10 +349,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 f8b24f9..5ab2d9a 100644
--- a/src/photos-base-manager.h
+++ b/src/photos-base-manager.h
@@ -71,6 +71,8 @@ struct _PhotosBaseManagerClass
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);
+ GObject *(*get_active_object) (PhotosBaseManager *self);
+
/* signals */
void (*active_changed) (PhotosBaseManager *self, GObject *object);
diff --git a/src/photos-item-manager.c b/src/photos-item-manager.c
index e5fbc27..4da905a 100644
--- a/src/photos-item-manager.c
+++ b/src/photos-item-manager.c
@@ -46,6 +46,7 @@
struct _PhotosItemManager
{
PhotosBaseManager parent_instance;
+ GObject *active_object;
GCancellable *loader_cancellable;
GHashTable *collections;
GIOExtensionPoint *extension_point;
@@ -387,7 +388,7 @@ photos_item_manager_set_active_object (PhotosBaseManager *manager, GObject *obje
g_return_val_if_fail (object != NULL, FALSE);
g_return_val_if_fail (PHOTOS_IS_BASE_ITEM (object), FALSE);
- active_item = photos_base_manager_get_active_object (manager);
+ active_item = photos_item_manager_get_active_object (self);
if (object == active_item)
goto out;
@@ -412,11 +413,12 @@ photos_item_manager_set_active_object (PhotosBaseManager *manager, GObject *obje
start_loading = TRUE;
}
- ret_val = PHOTOS_BASE_MANAGER_CLASS (photos_item_manager_parent_class)->set_active_object (manager,
object);
+ ret_val = TRUE;
/* We have already eliminated the possibility of failure. */
g_assert (ret_val == TRUE);
- active_item = photos_base_manager_get_active_object (manager);
+ self->active_object = object;
+ active_item = photos_item_manager_get_active_object (manager);
g_assert (active_item == object);
if (active_collection_changed)
@@ -543,6 +545,7 @@ photos_item_manager_class_init (PhotosItemManagerClass *class)
base_manager_class->get_where = photos_item_manager_get_where;
base_manager_class->get_object_by_id = photos_item_manager_get_object_by_id;
base_manager_class->set_active_object = photos_item_manager_set_active_object;
+ base_manager_class->get_active_object = photos_item_manager_get_active_object;
base_manager_class->remove_object_by_id = photos_item_manager_remove_object_by_id;
signals[ACTIVE_COLLECTION_CHANGED] = g_signal_new ("active-collection-changed",
@@ -732,6 +735,13 @@ photos_item_manager_create_item (PhotosItemManager *self, TrackerSparqlCursor *c
}
+GObject*
+photos_item_manager_get_active_object (PhotosItemManager *self)
+{
+ return self->active_object;
+}
+
+
PhotosBaseItem *
photos_item_manager_get_active_collection (PhotosItemManager *self)
{
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]