[gnome-documents/wip/lokdocview-rebase: 3/14] Use the same hamburger menu definition for both EvView and LOKDocView



commit 58be7f2389f2f887b8bb01cae2fdda66dd759895
Author: Bastien Nocera <hadess hadess net>
Date:   Fri Dec 4 17:52:53 2015 +0100

    Use the same hamburger menu definition for both EvView and LOKDocView
    
    ... and remove the items which we are not supported yet (rotation,
    print and edit). As a nice side-effect, we get a few extra items that
    we didn't have before.
    
    https://bugzilla.gnome.org/show_bug.cgi?id=753686

 data/org.gnome.Documents.data.gresource.xml |    1 -
 data/ui/lokview-menu.ui                     |   16 ----------------
 src/application.js                          |    6 ++++--
 src/lokview.js                              |   23 +++++++++++++++++++++--
 4 files changed, 25 insertions(+), 21 deletions(-)
---
diff --git a/data/org.gnome.Documents.data.gresource.xml b/data/org.gnome.Documents.data.gresource.xml
index 3a6be94..e374424 100644
--- a/data/org.gnome.Documents.data.gresource.xml
+++ b/data/org.gnome.Documents.data.gresource.xml
@@ -6,7 +6,6 @@
     <file preprocess="xml-stripblanks">ui/organize-collection-dialog.ui</file>
     <file preprocess="xml-stripblanks">ui/preview-context-menu.ui</file>
     <file preprocess="xml-stripblanks">ui/preview-menu.ui</file>
-    <file preprocess="xml-stripblanks">ui/lokview-menu.ui</file>
     <file preprocess="xml-stripblanks">ui/selection-menu.ui</file>
     <file preprocess="xml-stripblanks">ui/selection-toolbar.ui</file>
     <file preprocess="xml-stripblanks">ui/view-menu.ui</file>
diff --git a/src/application.js b/src/application.js
index 8a69823..78e435f 100644
--- a/src/application.js
+++ b/src/application.js
@@ -574,7 +574,8 @@ const Application = new Lang.Class({
                              WindowMode.WindowMode.SEARCH] },
             { name: 'open-current',
               callback: this._onActionOpenCurrent,
-              window_mode: WindowMode.WindowMode.PREVIEW },
+              window_modes: [WindowMode.WindowMode.PREVIEW,
+                             WindowMode.WindowMode.PREVIEW_LOK] },
             { name: 'edit-current' },
             { name: 'view-current',
               window_mode: WindowMode.WindowMode.EDIT },
@@ -613,7 +614,8 @@ const Application = new Lang.Class({
                              WindowMode.WindowMode.SEARCH] },
             { name: 'properties',
               callback: this._onActionProperties,
-              window_mode: WindowMode.WindowMode.PREVIEW },
+              window_modes: [WindowMode.WindowMode.PREVIEW,
+                             WindowMode.WindowMode.PREVIEW_LOK] },
             { name: 'bookmark-page',
               callback: this._onActionToggle,
               state: GLib.Variant.new('b', false),
diff --git a/src/lokview.js b/src/lokview.js
index b5917f4..d6a9374 100644
--- a/src/lokview.js
+++ b/src/lokview.js
@@ -187,8 +187,27 @@ const LOKViewToolbar = new Lang.Class({
 
     _getLOKViewMenu: function() {
         let builder = new Gtk.Builder();
-        builder.add_from_resource('/org/gnome/Documents/ui/lokview-menu.ui');
-        let menu = builder.get_object('lokview-menu');
+        builder.add_from_resource('/org/gnome/Documents/ui/preview-menu.ui');
+        let menu = builder.get_object('preview-menu');
+        let section = builder.get_object('open-section');
+
+        let doc = Application.documentManager.getActiveItem();
+        if (doc && doc.defaultAppName) {
+            section.remove(0);
+            section.prepend(_("Open with %s").format(doc.defaultAppName), 'app.open-current');
+        }
+
+        // No edit support yet
+        section.remove(1);
+        // No print support yet
+        section.remove(1);
+        // No present support yet
+        section.remove(1);
+
+        // No rotate support
+        section = builder.get_object('rotate-section');
+        section.remove(0);
+        section.remove(0);
 
         return menu;
     },


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