[gnome-documents] application: switch to preview mode immediately when launched with args



commit 57cf0e31207860fc0fe25e230a73d267902e93b5
Author: Cosimo Cecchi <cosimoc gnome org>
Date:   Tue Oct 30 12:58:42 2012 -0400

    application: switch to preview mode immediately when launched with args
    
    This avoids the overview flickering before the preview is loaded, when
    launching results from the shell.

 src/application.js |    2 ++
 src/preview.js     |    7 +++++--
 2 files changed, 7 insertions(+), 2 deletions(-)
---
diff --git a/src/application.js b/src/application.js
index fa058bb..3a6a16e 100644
--- a/src/application.js
+++ b/src/application.js
@@ -331,6 +331,8 @@ const Application = new Lang.Class({
     vfunc_command_line: function(commandLine) {
         let args = commandLine.get_arguments();
         if (args.length) {
+            Global.modeController.setWindowMode(WindowMode.WindowMode.PREVIEW);
+
             let urn = args[0]; // gjs eats argv[0]
             let doc = Global.documentManager.getItemById(args[0]);
             if (doc) {
diff --git a/src/preview.js b/src/preview.js
index 3a0d977..2a82daa 100644
--- a/src/preview.js
+++ b/src/preview.js
@@ -401,9 +401,12 @@ const PreviewToolbar = new Lang.Class({
     },
 
     _setToolbarTitle: function() {
-        let doc = Global.documentManager.getActiveItem();
-        let primary = doc.name;
+        let primary = null;
         let detail = null;
+        let doc = Global.documentManager.getActiveItem();
+
+        if (doc)
+            primary = doc.name;
 
         if (this._model) {
             let curPage, totPages;



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