[gnome-photos/wip/rishi/edit-mode: 6/28] Add an edit-current action



commit aa36e64896b60107235b403010c75398b0e53d7f
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 f909d27..3dc2d90 100644
--- a/src/photos-application.c
+++ b/src/photos-application.c
@@ -495,6 +495,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->state->mode_cntrlr, PHOTOS_WINDOW_MODE_EDIT);
+}
+
+
+static void
 photos_application_fullscreen (PhotosApplication *self, GVariant *parameter)
 {
   PhotosApplicationPrivate *priv = self->priv;
@@ -1005,6 +1019,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 df41adf..6acb3a4 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]