[gnome-photos/wip/rishi/edit-mode: 3/26] Add an edit-current action



commit 296c3ae4c7c8992f3c6e65c1f14bbd5a4b096125
Author: Debarshi Ray <debarshir gnome org>
Date:   Wed Mar 25 09:40:38 2015 +0100

    Add an edit-current action

 src/photos-application.c   |   19 +++++++++++++++++++
 src/photos-preview-menu.ui |    4 ++++
 2 files changed, 23 insertions(+), 0 deletions(-)
---
diff --git a/src/photos-application.c b/src/photos-application.c
index e91667b..791024c 100644
--- a/src/photos-application.c
+++ b/src/photos-application.c
@@ -288,6 +288,20 @@ photos_application_can_fullscreen_changed (PhotosApplication *self)
 
 
 static void
+photos_application_edit_current (PhotosApplication *self)
+{
+  PhotosApplicationPrivate *priv = self->priv;
+  PhotosBaseItem *item;
+
+  item = PHOTOS_BASE_ITEM (photos_base_manager_get_active_object (priv->state->item_mngr));
+  if (item == NULL)
+    return;
+
+  photos_mode_controller_set_window_mode (priv->mode_cntrlr, PHOTOS_WINDOW_MODE_EDIT);
+}
+
+
+static void
 photos_application_fullscreen (PhotosApplication *self, GVariant *parameter)
 {
   PhotosApplicationPrivate *priv = self->priv;
@@ -881,6 +895,11 @@ photos_application_startup (GApplication *application)
   g_action_map_add_action (G_ACTION_MAP (self), G_ACTION (action));
   g_object_unref (action);
 
+  action = g_simple_action_new ("edit-current", NULL);
+  g_signal_connect_swapped (action, "activate", G_CALLBACK (photos_application_edit_current), self);
+  g_action_map_add_action (G_ACTION_MAP (self), G_ACTION (action));
+  g_object_unref (action);
+
   priv->fs_action = g_simple_action_new ("fullscreen", NULL);
   g_signal_connect_swapped (priv->fs_action, "activate", G_CALLBACK (photos_application_fullscreen), self);
   g_action_map_add_action (G_ACTION_MAP (self), G_ACTION (priv->fs_action));
diff --git a/src/photos-preview-menu.ui b/src/photos-preview-menu.ui
index 3d29507..18b5ee7 100644
--- a/src/photos-preview-menu.ui
+++ b/src/photos-preview-menu.ui
@@ -6,6 +6,10 @@
         <attribute name="label" translatable="yes">Open</attribute>
       </item>
       <item>
+        <attribute name="action">app.edit-current</attribute>
+        <attribute name="label" translatable="yes">Edit</attribute>
+      </item>
+      <item>
         <attribute name="action">app.print-current</attribute>
         <attribute name="label" translatable="yes">Print…</attribute>
         <attribute name="accel">&lt;Primary&gt;p</attribute>


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