[gnome-photos/wip/rishi/edit-mode: 4/31] Add a new mode for Edit
- From: Debarshi Ray <debarshir src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [gnome-photos/wip/rishi/edit-mode: 4/31] Add a new mode for Edit
- Date: Fri, 6 Nov 2015 18:27:39 +0000 (UTC)
commit 25f61d5a452ddc2a4d13dbfdf8c3115e0c54b365
Author: Debarshi Ray <debarshir gnome org>
Date: Thu Mar 26 10:28:28 2015 +0100
Add a new mode for Edit
src/photos-embed.c | 4 ++++
src/photos-empty-results-box.c | 2 ++
src/photos-item-manager.c | 33 +++++++++++++++++++--------------
src/photos-item-manager.h | 1 +
src/photos-main-window.c | 2 ++
src/photos-preview-view.c | 1 +
src/photos-view-container.c | 1 +
src/photos-view-model.c | 1 +
8 files changed, 31 insertions(+), 14 deletions(-)
---
diff --git a/src/photos-embed.c b/src/photos-embed.c
index b04909e..a3f8966 100644
--- a/src/photos-embed.c
+++ b/src/photos-embed.c
@@ -166,6 +166,7 @@ photos_embed_get_view_container_from_mode (PhotosEmbed *self, PhotosWindowMode m
break;
case PHOTOS_WINDOW_MODE_NONE:
+ case PHOTOS_WINDOW_MODE_EDIT:
case PHOTOS_WINDOW_MODE_PREVIEW:
default:
g_assert_not_reached ();
@@ -592,6 +593,9 @@ photos_embed_window_mode_changed (PhotosModeController *mode_cntrlr,
switch (mode)
{
+ case PHOTOS_WINDOW_MODE_EDIT:
+ break;
+
case PHOTOS_WINDOW_MODE_COLLECTIONS:
photos_embed_prepare_for_collections (self, old_mode);
goto set_toolbar_model;
diff --git a/src/photos-empty-results-box.c b/src/photos-empty-results-box.c
index 80c53ae..42dda65 100644
--- a/src/photos-empty-results-box.c
+++ b/src/photos-empty-results-box.c
@@ -193,6 +193,7 @@ photos_empty_results_box_constructed (GObject *object)
break;
case PHOTOS_WINDOW_MODE_NONE:
+ case PHOTOS_WINDOW_MODE_EDIT:
case PHOTOS_WINDOW_MODE_PREVIEW:
default:
g_assert_not_reached ();
@@ -237,6 +238,7 @@ photos_empty_results_box_constructed (GObject *object)
break;
case PHOTOS_WINDOW_MODE_NONE:
+ case PHOTOS_WINDOW_MODE_EDIT:
case PHOTOS_WINDOW_MODE_PREVIEW:
default:
g_assert_not_reached ();
diff --git a/src/photos-item-manager.c b/src/photos-item-manager.c
index 09d1226..c000456 100644
--- a/src/photos-item-manager.c
+++ b/src/photos-item-manager.c
@@ -693,7 +693,8 @@ photos_mode_controller_go_back (PhotosModeController *self)
old_mode = PHOTOS_WINDOW_MODE_OVERVIEW;
g_return_if_fail (old_mode != PHOTOS_WINDOW_MODE_NONE);
- g_return_if_fail (old_mode != PHOTOS_WINDOW_MODE_PREVIEW);
+ g_return_if_fail (old_mode != PHOTOS_WINDOW_MODE_PREVIEW
+ || (self->mode == PHOTOS_WINDOW_MODE_EDIT && old_mode == PHOTOS_WINDOW_MODE_PREVIEW));
g_queue_pop_head (self->history);
@@ -710,7 +711,7 @@ photos_mode_controller_go_back (PhotosModeController *self)
PHOTOS_BASE_MANAGER_CLASS (photos_item_manager_parent_class)
->set_active_object (PHOTOS_BASE_MANAGER (self), (GObject *) self->active_collection);
}
- else
+ else if (old_mode != PHOTOS_WINDOW_MODE_EDIT)
{
photos_item_manager_collection_path_free (self);
self->collection_path = g_queue_new ();
@@ -753,7 +754,8 @@ photos_mode_controller_set_window_mode (PhotosModeController *self, PhotosWindow
g_return_if_fail (mode != PHOTOS_WINDOW_MODE_NONE);
g_return_if_fail (mode != PHOTOS_WINDOW_MODE_PREVIEW);
- g_return_if_fail (self->mode != PHOTOS_WINDOW_MODE_PREVIEW);
+ g_return_if_fail (self->mode != PHOTOS_WINDOW_MODE_PREVIEW
+ || (self->mode == PHOTOS_WINDOW_MODE_PREVIEW && mode == PHOTOS_WINDOW_MODE_EDIT));
if (!photos_item_manager_set_window_mode_internal (self, mode, &old_mode))
return;
@@ -761,20 +763,23 @@ photos_mode_controller_set_window_mode (PhotosModeController *self, PhotosWindow
photos_item_manager_update_fullscreen (self);
photos_item_manager_clear_active_item_load (self);
- photos_item_manager_collection_path_free (self);
- self->collection_path = g_queue_new ();
-
- if (self->active_collection != NULL)
+ if (mode != PHOTOS_WINDOW_MODE_EDIT)
{
- g_clear_object (&self->active_collection);
- active_collection_changed = TRUE;
- }
+ photos_item_manager_collection_path_free (self);
+ self->collection_path = g_queue_new ();
- PHOTOS_BASE_MANAGER_CLASS (photos_item_manager_parent_class)
- ->set_active_object (PHOTOS_BASE_MANAGER (self), NULL);
+ if (self->active_collection != NULL)
+ {
+ g_clear_object (&self->active_collection);
+ active_collection_changed = TRUE;
+ }
- if (active_collection_changed)
- g_signal_emit (self, signals[ACTIVE_COLLECTION_CHANGED], 0, self->active_collection);
+ PHOTOS_BASE_MANAGER_CLASS (photos_item_manager_parent_class)
+ ->set_active_object (PHOTOS_BASE_MANAGER (self), NULL);
+
+ if (active_collection_changed)
+ g_signal_emit (self, signals[ACTIVE_COLLECTION_CHANGED], 0, self->active_collection);
+ }
g_signal_emit (self, signals[WINDOW_MODE_CHANGED], 0, mode, old_mode);
}
diff --git a/src/photos-item-manager.h b/src/photos-item-manager.h
index 69a8fe8..0e8ca14 100644
--- a/src/photos-item-manager.h
+++ b/src/photos-item-manager.h
@@ -58,6 +58,7 @@ typedef enum
{
PHOTOS_WINDOW_MODE_NONE,
PHOTOS_WINDOW_MODE_COLLECTIONS,
+ PHOTOS_WINDOW_MODE_EDIT,
PHOTOS_WINDOW_MODE_FAVORITES,
PHOTOS_WINDOW_MODE_OVERVIEW,
PHOTOS_WINDOW_MODE_PREVIEW,
diff --git a/src/photos-main-window.c b/src/photos-main-window.c
index 075de5e..76b8343 100644
--- a/src/photos-main-window.c
+++ b/src/photos-main-window.c
@@ -175,6 +175,7 @@ photos_main_window_go_back (PhotosMainWindow *self)
break;
case PHOTOS_WINDOW_MODE_NONE:
+ case PHOTOS_WINDOW_MODE_EDIT:
case PHOTOS_WINDOW_MODE_OVERVIEW:
default:
handled = FALSE;
@@ -284,6 +285,7 @@ photos_main_window_key_press_event (GtkWidget *widget, GdkEventKey *event)
switch (mode)
{
case PHOTOS_WINDOW_MODE_NONE:
+ case PHOTOS_WINDOW_MODE_EDIT:
handled = GDK_EVENT_PROPAGATE;
break;
diff --git a/src/photos-preview-view.c b/src/photos-preview-view.c
index bf0dc28..6331cdc 100644
--- a/src/photos-preview-view.c
+++ b/src/photos-preview-view.c
@@ -165,6 +165,7 @@ photos_preview_view_window_mode_changed (PhotosPreviewView *self, PhotosWindowMo
switch (mode)
{
case PHOTOS_WINDOW_MODE_COLLECTIONS:
+ case PHOTOS_WINDOW_MODE_EDIT:
case PHOTOS_WINDOW_MODE_FAVORITES:
case PHOTOS_WINDOW_MODE_OVERVIEW:
case PHOTOS_WINDOW_MODE_SEARCH:
diff --git a/src/photos-view-container.c b/src/photos-view-container.c
index cb1f85f..fbd891f 100644
--- a/src/photos-view-container.c
+++ b/src/photos-view-container.c
@@ -334,6 +334,7 @@ photos_view_container_constructed (GObject *object)
break;
case PHOTOS_WINDOW_MODE_NONE:
+ case PHOTOS_WINDOW_MODE_EDIT:
case PHOTOS_WINDOW_MODE_PREVIEW:
default:
g_assert_not_reached ();
diff --git a/src/photos-view-model.c b/src/photos-view-model.c
index c5a3388..a23d921 100644
--- a/src/photos-view-model.c
+++ b/src/photos-view-model.c
@@ -398,6 +398,7 @@ photos_view_model_constructed (GObject *object)
break;
case PHOTOS_WINDOW_MODE_NONE:
+ case PHOTOS_WINDOW_MODE_EDIT:
case PHOTOS_WINDOW_MODE_PREVIEW:
default:
g_assert_not_reached ();
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]