[gnome-documents] preview: add Properties to the preview gear menu



commit a2a427c2db6704664ecb51b0ab0db5cf050847b3
Author: Cosimo Cecchi <cosimoc gnome org>
Date:   Mon Nov 19 16:35:48 2012 -0500

    preview: add Properties to the preview gear menu

 src/application.js            |   20 ++++++++++++++++++--
 src/resources/preview-menu.ui |    6 ++++++
 2 files changed, 24 insertions(+), 2 deletions(-)
---
diff --git a/src/application.js b/src/application.js
index d2f2e95..5c6e59f 100644
--- a/src/application.js
+++ b/src/application.js
@@ -45,6 +45,7 @@ const Manager = imports.manager;
 const Miners = imports.miners;
 const Notifications = imports.notifications;
 const Path = imports.path;
+const Properties = imports.properties;
 const Query = imports.query;
 const Selections = imports.selections;
 const Sources = imports.sources;
@@ -120,7 +121,7 @@ const Application = new Lang.Class({
     },
 
     _onActionPrintCurrent: function() {
-        let doc = Global.documentManager.getActiveItem();;
+        let doc = Global.documentManager.getActiveItem();
         if (doc)
             doc.print(this._mainWindow.window);
     },
@@ -130,6 +131,18 @@ const Application = new Lang.Class({
         action.change_state(GLib.Variant.new('b', !state.get_boolean()));
     },
 
+    _onActionProperties: function() {
+        let doc = Global.documentManager.getActiveItem();
+        if (!doc)
+            return;
+
+        let dialog = new Properties.PropertiesDialog(doc.id);
+        dialog.widget.connect('response', Lang.bind(this,
+            function(widget, response) {
+                widget.destroy();
+            }));
+    },
+
     _initActions: function() {
         let actionEntries = [
             { name: 'quit',
@@ -183,7 +196,10 @@ const Application = new Lang.Class({
             { name: 'select-all', accel: '<Primary>a',
               window_mode: WindowMode.WindowMode.OVERVIEW },
             { name: 'select-none',
-              window_mode: WindowMode.WindowMode.OVERVIEW }
+              window_mode: WindowMode.WindowMode.OVERVIEW },
+            { name: 'properties',
+              callback: this._onActionProperties,
+              window_mode: WindowMode.WindowMode.PREVIEW }
         ];
 
         actionEntries.forEach(Lang.bind(this,
diff --git a/src/resources/preview-menu.ui b/src/resources/preview-menu.ui
index 9f42766..175424f 100644
--- a/src/resources/preview-menu.ui
+++ b/src/resources/preview-menu.ui
@@ -35,5 +35,11 @@
         <attribute name="accel">&lt;Primary&gt;Right</attribute>
       </item>
     </section>
+    <section>
+      <item>
+        <attribute name="action">app.properties</attribute>
+        <attribute name="label" translatable="yes">Properties</attribute>
+      </item>
+    </section>
   </menu>
 </interface>



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