[shotwell/wip/dedeprecate] wip: Fix titles for injection groups



commit 5614ad6c3f16bf59ff6e564fd365fd23b70fa3e2
Author: Jens Georg <mail jensge org>
Date:   Tue Nov 1 19:55:45 2016 +0100

    wip: Fix titles for injection groups
    
    Signed-off-by: Jens Georg <mail jensge org>

 src/CollectionPage.vala         |   50 ++++++++++++++++++++++++--------------
 src/Page.vala                   |   22 +++++++++++++----
 src/PhotoPage.vala              |    6 ++--
 src/direct/DirectPhotoPage.vala |    4 +-
 4 files changed, 53 insertions(+), 29 deletions(-)
---
diff --git a/src/CollectionPage.vala b/src/CollectionPage.vala
index 77d0d6c..d4004f2 100644
--- a/src/CollectionPage.vala
+++ b/src/CollectionPage.vala
@@ -71,11 +71,11 @@ public abstract class CollectionPage : MediaPage {
     private static InjectionGroup create_file_menu_injectables() {
         InjectionGroup group = new InjectionGroup("FileExtrasPlaceholder");
         
-        group.add_menu_item("Print");
+        group.add_menu_item(_("_Print"), "Print", "<Primary>p");
         group.add_separator();
-        group.add_menu_item("Publish");
-        group.add_menu_item("SendTo");
-        group.add_menu_item("SetBackground");
+        group.add_menu_item(_("_Publish"), "Publish", "<Primary><Shift>p");
+        group.add_menu_item(_("Send _To…"), "SendTo");
+        group.add_menu_item(_("Set as _Desktop Background"), "SetBackground");
         
         return group;
     }
@@ -83,7 +83,7 @@ public abstract class CollectionPage : MediaPage {
     private static InjectionGroup create_edit_menu_injectables() {
         InjectionGroup group = new InjectionGroup("EditExtrasPlaceholder");
         
-        group.add_menu_item("Duplicate");
+        group.add_menu_item(_("_Duplicate"), "Duplicate", "<Primary>D");
 
         return group;
     }
@@ -91,9 +91,9 @@ public abstract class CollectionPage : MediaPage {
     private static InjectionGroup create_view_menu_fullscreen_injectables() {
         InjectionGroup group = new InjectionGroup("ViewExtrasFullscreenSlideshowPlaceholder");
         
-        group.add_menu_item("Fullscreen", "CommonFullscreen");
+        group.add_menu_item(_("Fullscreen"), "CommonFullscreen", "F11");
         group.add_separator();
-        group.add_menu_item("Slideshow");
+        group.add_menu_item(_("S_lideshow"), "Slideshow", "F5");
         
         return group;
     }
@@ -101,16 +101,24 @@ public abstract class CollectionPage : MediaPage {
     private static InjectionGroup create_photos_menu_edits_injectables() {
         InjectionGroup group = new InjectionGroup("PhotosExtrasEditsPlaceholder");
         
-        group.add_menu_item("RotateClockwise");
-        group.add_menu_item("RotateCounterclockwise");
-        group.add_menu_item("FlipHorizontally");
-        group.add_menu_item("FlipVertically");
+        group.add_menu_item(_("Rotate _Right"),
+                            "RotateClockwise",
+                            "<Primary>r");
+        group.add_menu_item(_("Rotate _Left"),
+                            "RotateCounterclockwise",
+                            "<Primary><Shift>r");
+        group.add_menu_item(_("Flip Hori_zontally"), "FlipHorizontally");
+        group.add_menu_item(_("Flip Verti_cally"), "FlipVertically");
         group.add_separator();
-        group.add_menu_item("Enhance");
-        group.add_menu_item("Revert");
+        group.add_menu_item(_("_Enhance"), "Enhance");
+        group.add_menu_item(_("Re_vert to Original"), "Revert");
         group.add_separator();
-        group.add_menu_item("CopyColorAdjustments");
-        group.add_menu_item("PasteColorAdjustments");
+        group.add_menu_item(_("_Copy Color Adjustments"),
+                            "CopyColorAdjustments",
+                            "<Primary><Shift>c");
+        group.add_menu_item(_("_Paste Color Adjustments"),
+                            "PasteColorAdjustments",
+                            "<Primary><Shift>v");
         
         return group;
     }
@@ -118,7 +126,7 @@ public abstract class CollectionPage : MediaPage {
     private static InjectionGroup create_photos_menu_date_injectables() {
         InjectionGroup group = new InjectionGroup("PhotosExtrasDateTimePlaceholder");
         
-        group.add_menu_item("AdjustDateTime");
+        group.add_menu_item(_("Adjust Date and Time…"), "AdjustDateTime");
         
         return group;
     }
@@ -126,9 +134,13 @@ public abstract class CollectionPage : MediaPage {
     private static InjectionGroup create_photos_menu_externals_injectables() {
         InjectionGroup group = new InjectionGroup("PhotosExtrasExternalsPlaceholder");
         
-        group.add_menu_item("ExternalEdit");
-        group.add_menu_item("ExternalEditRAW");
-        group.add_menu_item("PlayVideo");
+        group.add_menu_item(_("Open With E_xternal Editor"),
+                            "ExternalEdit",
+                            "<Primary>Return");
+        group.add_menu_item(_("Open With RA_W Editor"),
+                            "ExternalEditRAW",
+                            "<Primary><Shift>Return");
+        group.add_menu_item(_("_Play"), "PlayVideo", "<Primary>Y");
         
         return group;
     }
diff --git a/src/Page.vala b/src/Page.vala
index 9da2dab..c271b8a 100644
--- a/src/Page.vala
+++ b/src/Page.vala
@@ -13,11 +13,13 @@ public class InjectionGroup {
         }
         public string name;
         public string action;
+        public string? accellerator;
         public ItemType kind;
 
-        public Element(string name, string? action, ItemType kind) {
+        public Element(string name, string? action, string? accellerator, ItemType kind) {
             this.name = name;
             this.action = action != null ? action : name;
+            this.accellerator = accellerator;
             this.kind = kind;
         }
     }
@@ -38,16 +40,18 @@ public class InjectionGroup {
         return elements;
     }
 
-    public void add_menu_item(string name, string? action = null) {
-        elements.add(new Element(name, action, Element.ItemType.MENUITEM));
+    public void add_menu_item(string name, string? action = null, string?
+            accellerator = null) {
+        elements.add(new Element(name, action, accellerator, Element.ItemType.MENUITEM));
     }
 
     public void add_menu(string name, string? action = null) {
-        elements.add(new Element(name, action, Element.ItemType.MENU));
+        elements.add(new Element(name, action, null, Element.ItemType.MENU));
     }
 
     public void add_separator() {
         elements.add(new Element("%d-separator".printf(separator_id++), null,
+                    null,
                     Element.ItemType.SEPARATOR));
     }
 }
@@ -230,7 +234,15 @@ public abstract class Page : Gtk.ScrolledWindow {
                         var menu = section as GLib.Menu;
                         switch (element.kind) {
                             case InjectionGroup.Element.ItemType.MENUITEM:
-                                menu.append (element.name, element.action);
+                                var item = new GLib.MenuItem (element.name,
+                                                              element.action);
+                                if (element.accellerator != null) {
+                                    item.set_attribute ("accel",
+                                                        "s",
+                                                        element.accellerator);
+                                }
+
+                                menu.append_item (item);
                                 break;
                             default:
                                 break;
diff --git a/src/PhotoPage.vala b/src/PhotoPage.vala
index 48862ea..881a8e6 100644
--- a/src/PhotoPage.vala
+++ b/src/PhotoPage.vala
@@ -2671,17 +2671,17 @@ public class LibraryPhotoPage : EditingHostPage {
         InjectionGroup[] groups = base.init_collect_injection_groups();
 
         InjectionGroup print_group = new InjectionGroup("PrintPlaceholder");
-        print_group.add_menu_item("Print");
+        print_group.add_menu_item(_("_Print"), "Print", "<Primary>p");
         
         groups += print_group;
         
         InjectionGroup publish_group = new InjectionGroup("PublishPlaceholder");
-        publish_group.add_menu_item("Publish");
+        publish_group.add_menu_item(_("_Publish"), "Publish", "<Primary><Shift>p");
         
         groups += publish_group;
         
         InjectionGroup bg_group = new InjectionGroup("SetBackgroundPlaceholder");
-        bg_group.add_menu_item("SetBackground");
+        bg_group.add_menu_item(_("Set as _Desktop Background"), "SetBackground");
         
         groups += bg_group;
         
diff --git a/src/direct/DirectPhotoPage.vala b/src/direct/DirectPhotoPage.vala
index 7717f77..ee6c5e5 100644
--- a/src/direct/DirectPhotoPage.vala
+++ b/src/direct/DirectPhotoPage.vala
@@ -210,12 +210,12 @@ public class DirectPhotoPage : EditingHostPage {
         InjectionGroup[] groups = base.init_collect_injection_groups();
         
         InjectionGroup print_group = new InjectionGroup("PrintPlaceholder");
-        print_group.add_menu_item("Print");
+        print_group.add_menu_item(_("_Print"), "Print", "<Primary>p");
         
         groups += print_group;
         
         InjectionGroup bg_group = new InjectionGroup("SetBackgroundPlaceholder");
-        bg_group.add_menu_item("SetBackground");
+        bg_group.add_menu_item(_("Set as _Desktop Background"), "SetBackground");
         
         groups += bg_group;
         


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