[gnome-photos/wip/rishi/item-manager] Make hide/unhide item work with child base managers
- From: Umang Jain <uajain src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [gnome-photos/wip/rishi/item-manager] Make hide/unhide item work with child base managers
- Date: Tue, 16 Aug 2016 19:10:11 +0000 (UTC)
commit dd3d05c8ae690242e4cf0d3a1f98543da26de723
Author: Umang Jain <mailumangjain gmail com>
Date: Tue Aug 16 22:42:59 2016 +0530
Make hide/unhide item work with child base managers
src/photos-item-manager.c | 35 +++++++++++++++++++++++++++++++++--
1 files changed, 33 insertions(+), 2 deletions(-)
---
diff --git a/src/photos-item-manager.c b/src/photos-item-manager.c
index f4a18ab..8404bc2 100644
--- a/src/photos-item-manager.c
+++ b/src/photos-item-manager.c
@@ -787,6 +787,8 @@ void
photos_item_manager_hide_item (PhotosItemManager *self, PhotosBaseItem *item)
{
PhotosBaseItem *old_hidden_item;
+ PhotosBaseManager *item_mngr_chld;
+ PhotosWindowMode mode;
const gchar *id;
g_return_if_fail (PHOTOS_IS_ITEM_MANAGER (self));
@@ -799,7 +801,21 @@ photos_item_manager_hide_item (PhotosItemManager *self, PhotosBaseItem *item)
g_return_if_fail (old_hidden_item == NULL);
g_hash_table_insert (self->hidden_items, g_strdup (id), g_object_ref (item));
- photos_base_manager_remove_object_by_id (PHOTOS_BASE_MANAGER (self), id);
+
+ if (photos_base_item_is_collection (item))
+ {
+ g_hash_table_remove (self->collections, id);
+ mode = PHOTOS_WINDOW_MODE_COLLECTIONS;
+ }
+ else
+ {
+ mode = PHOTOS_WINDOW_MODE_OVERVIEW;
+ }
+
+ item_mngr_chld = self->item_mngr_chldrn[mode];
+ photos_base_manager_remove_object_by_id (item_mngr_chld, id);
+ g_signal_emit_by_name (self, "object-removed", G_OBJECT (item));
+
}
@@ -807,6 +823,8 @@ void
photos_item_manager_unhide_item (PhotosItemManager *self, PhotosBaseItem *item)
{
PhotosBaseItem *hidden_item;
+ PhotosBaseManager *item_mngr_chld;
+ PhotosWindowMode mode;
const gchar *id;
g_return_if_fail (PHOTOS_IS_ITEM_MANAGER (self));
@@ -818,7 +836,20 @@ photos_item_manager_unhide_item (PhotosItemManager *self, PhotosBaseItem *item)
hidden_item = PHOTOS_BASE_ITEM (g_hash_table_lookup (self->hidden_items, id));
g_return_if_fail (hidden_item == item);
- photos_base_manager_add_object (PHOTOS_BASE_MANAGER (self), G_OBJECT (item));
+ if (photos_base_item_is_collection (hidden_item))
+ {
+ g_hash_table_insert (self->collections, g_strdup (id), g_object_ref (item));
+ mode = PHOTOS_WINDOW_MODE_COLLECTIONS;
+ }
+ else
+ {
+ mode = PHOTOS_WINDOW_MODE_OVERVIEW;
+ }
+
+ item_mngr_chld = self->item_mngr_chldrn[mode];
+ photos_base_manager_add_object (item_mngr_chld, G_OBJECT (item));
+ g_signal_emit_by_name (self, "object-added", G_OBJECT (item));
+
g_hash_table_remove (self->hidden_items, id);
}
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]