[gnome-photos/wip/rishi/item-manager: 7/7] compile-able version



commit bbc5d2c84f2e1478c1ce58e38166c087f6b1814e
Author: Umang Jain <mailumangjain gmail com>
Date:   Sun Jul 31 11:25:39 2016 +0530

    compile-able version
    
    Currently, while running gnome-photos, no images
    show up. Reason is that, all images are now segregated
    into child base managers and the parent base manager
    i.e. item-manager's hash table is empty.
    
    We are displaying empty hash table (item-manager).
    Next changes will be regarding view-container and
    view-model.

 src/photos-application.c        |    4 +++-
 src/photos-item-manager.c       |   12 +++++++-----
 src/photos-tracker-controller.c |    2 +-
 3 files changed, 11 insertions(+), 7 deletions(-)
---
diff --git a/src/photos-application.c b/src/photos-application.c
index d59d813..384223d 100644
--- a/src/photos-application.c
+++ b/src/photos-application.c
@@ -675,6 +675,7 @@ photos_application_activate_query_executed (GObject *source_object, GAsyncResult
   PhotosApplication *self = PHOTOS_APPLICATION (user_data);
   GError *error = NULL;
   GObject *item;
+  PhotosWindowMode mode;
   PhotosSingleItemJob *job = PHOTOS_SINGLE_ITEM_JOB (source_object);
   TrackerSparqlCursor *cursor = NULL;
   const gchar *identifier;
@@ -690,7 +691,8 @@ photos_application_activate_query_executed (GObject *source_object, GAsyncResult
   if (cursor == NULL)
     goto out;
 
-  photos_item_manager_add_item (PHOTOS_ITEM_MANAGER (self->state->item_mngr), cursor);
+  mode = photos_mode_controller_get_window_mode (self->state->mode_cntrlr);
+  photos_item_manager_add_item (PHOTOS_ITEM_MANAGER (self->state->item_mngr), mode, cursor);
 
   identifier = tracker_sparql_cursor_get_string (cursor, PHOTOS_QUERY_COLUMNS_URN, NULL);
   item = photos_base_manager_get_object_by_id (self->state->item_mngr, identifier);
diff --git a/src/photos-item-manager.c b/src/photos-item-manager.c
index b6827dd..b19ff52 100644
--- a/src/photos-item-manager.c
+++ b/src/photos-item-manager.c
@@ -91,6 +91,7 @@ static guint signals[LAST_SIGNAL] = { 0 };
 G_DEFINE_TYPE (PhotosItemManager, photos_item_manager, PHOTOS_TYPE_BASE_MANAGER);
 EGG_DEFINE_COUNTER (instances, "PhotosItemManager", "Instances", "Number of PhotosItemManager instances")
 
+static GObject* photos_item_manager_get_active_object (PhotosBaseManager *mngr);
 
 static void
 photos_item_manager_add_object (PhotosBaseManager *mngr, GObject *object)
@@ -141,7 +142,7 @@ photos_item_manager_item_created_executed (GObject *source_object, GAsyncResult
   if (cursor == NULL)
     goto out;
 
-  photos_item_manager_add_item (self, cursor);
+  photos_item_manager_add_item (self, self->mode,cursor);
 
  out:
   g_clear_object (&cursor);
@@ -404,7 +405,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_item_manager_get_active_object (self);
+  active_item = photos_item_manager_get_active_object (manager);
   if (object == active_item)
     goto out;
 
@@ -531,7 +532,7 @@ photos_item_manager_init (PhotosItemManager *self)
   self->history = g_queue_new ();
 
   window_mode_class = G_ENUM_CLASS (g_type_class_ref (PHOTOS_TYPE_WINDOW_MODE));
-  self->item_mngr_chldrn = (gpointer *) g_malloc0_n (window_mode_class->n_values + 1, sizeof (gpointer));
+  self->item_mngr_chldrn = (PhotosBaseManager **) g_malloc0_n (window_mode_class->n_values + 1, sizeof 
(gpointer));
   for (i = 0; i < window_mode_class->n_values; i++)
     self->item_mngr_chldrn[i] = photos_base_manager_new ();
 
@@ -753,9 +754,10 @@ photos_item_manager_create_item (PhotosItemManager *self, TrackerSparqlCursor *c
 }
 
 
-GObject*
-photos_item_manager_get_active_object (PhotosItemManager *self)
+static GObject*
+photos_item_manager_get_active_object (PhotosBaseManager *mngr)
 {
+  PhotosItemManager *self = PHOTOS_ITEM_MANAGER (mngr);
   return self->active_object;
 }
 
diff --git a/src/photos-tracker-controller.c b/src/photos-tracker-controller.c
index 95ab8cf..6b99ce1 100644
--- a/src/photos-tracker-controller.c
+++ b/src/photos-tracker-controller.c
@@ -156,7 +156,7 @@ photos_tracker_controller_cursor_next (GObject *source_object, GAsyncResult *res
   now = g_get_monotonic_time ();
   photos_debug (PHOTOS_DEBUG_TRACKER, "Query Cursor: %" G_GINT64_FORMAT, (now - priv->last_query_time) / 
1000000);
 
-  photos_item_manager_add_item (PHOTOS_ITEM_MANAGER (priv->item_mngr), self->mode, cursor);
+  photos_item_manager_add_item (PHOTOS_ITEM_MANAGER (priv->item_mngr), priv->mode, cursor);
   tracker_sparql_cursor_next_async (cursor,
                                     priv->cancellable,
                                     photos_tracker_controller_cursor_next,


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