[gnome-photos/wip/rishi/edit-mode: 14/20] application, preview-view: Hook up 'undo' to a GAction
- From: Debarshi Ray <debarshir src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [gnome-photos/wip/rishi/edit-mode: 14/20] application, preview-view: Hook up 'undo' to a GAction
- Date: Thu, 28 May 2015 08:27:59 +0000 (UTC)
commit 4b40ee0dec9794768e5cf06ea50d7c056b4fae44
Author: Debarshi Ray <debarshir gnome org>
Date: Thu May 21 11:24:28 2015 +0200
application, preview-view: Hook up 'undo' to a GAction
src/photos-application.c | 6 ++++++
src/photos-preview-view.c | 17 +++++++++++++++++
2 files changed, 23 insertions(+), 0 deletions(-)
---
diff --git a/src/photos-application.c b/src/photos-application.c
index 5c77cc5..b501fc7 100644
--- a/src/photos-application.c
+++ b/src/photos-application.c
@@ -81,6 +81,7 @@ struct _PhotosApplicationPrivate
GSimpleAction *set_bg_action;
GSimpleAction *set_ss_action;
GSimpleAction *remote_display_action;
+ GSimpleAction *undo_action;
GtkWidget *main_window;
PhotosCameraCache *camera_cache;
PhotosModeController *mode_cntrlr;
@@ -694,6 +695,7 @@ photos_application_window_mode_changed (PhotosApplication *self, PhotosWindowMod
enable = (mode == PHOTOS_WINDOW_MODE_EDIT);
g_simple_action_set_enabled (priv->gray_action, enable);
+ g_simple_action_set_enabled (priv->undo_action, enable);
enable = (mode == PHOTOS_WINDOW_MODE_COLLECTIONS
|| mode == PHOTOS_WINDOW_MODE_FAVORITES
@@ -990,6 +992,9 @@ photos_application_startup (GApplication *application)
g_signal_connect_swapped (priv->set_ss_action, "activate", G_CALLBACK (photos_application_set_bg_common),
self);
g_action_map_add_action (G_ACTION_MAP (self), G_ACTION (priv->set_ss_action));
+ priv->undo_action = g_simple_action_new ("undo-current", NULL);
+ g_action_map_add_action (G_ACTION_MAP (self), G_ACTION (priv->undo_action));
+
g_signal_connect_swapped (priv->mode_cntrlr,
"window-mode-changed",
G_CALLBACK (photos_application_window_mode_changed),
@@ -1068,6 +1073,7 @@ photos_application_dispose (GObject *object)
g_clear_object (&priv->sel_none_action);
g_clear_object (&priv->set_bg_action);
g_clear_object (&priv->set_ss_action);
+ g_clear_object (&priv->undo_action);
g_clear_object (&priv->camera_cache);
g_clear_object (&priv->mode_cntrlr);
g_clear_object (&priv->extract_priority);
diff --git a/src/photos-preview-view.c b/src/photos-preview-view.c
index 1f8a213..7f63ec0 100644
--- a/src/photos-preview-view.c
+++ b/src/photos-preview-view.c
@@ -265,6 +265,20 @@ photos_preview_view_gray (PhotosPreviewView *self)
static void
+photos_preview_view_undo (PhotosPreviewView *self)
+{
+ PhotosBaseItem *item;
+
+ item = PHOTOS_BASE_ITEM (photos_base_manager_get_active_object (self->priv->item_mngr));
+ if (item == NULL)
+ return;
+
+ photos_base_item_operation_undo (item);
+ photos_base_item_process_async (item, NULL, photos_preview_view_process, self);
+}
+
+
+static void
photos_preview_view_window_mode_changed (PhotosPreviewView *self, PhotosWindowMode mode, PhotosWindowMode
old_mode)
{
PhotosPreviewViewPrivate *priv = self->priv;
@@ -389,6 +403,9 @@ photos_preview_view_init (PhotosPreviewView *self)
action = g_action_map_lookup_action (G_ACTION_MAP (app), "gray-current");
g_signal_connect_object (action, "activate", G_CALLBACK (photos_preview_view_gray), self,
G_CONNECT_SWAPPED);
+
+ action = g_action_map_lookup_action (G_ACTION_MAP (app), "undo-current");
+ g_signal_connect_object (action, "activate", G_CALLBACK (photos_preview_view_undo), self,
G_CONNECT_SWAPPED);
}
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]