[gnome-documents] Make sure toolbar is shown on load error



commit 203c1e4e470f624312b29afbd77db7a5d22e6c64
Author: William Jon McCann <jmccann redhat com>
Date:   Mon Jan 28 23:37:20 2013 -0500

    Make sure toolbar is shown on load error
    
    https://bugzilla.gnome.org/show_bug.cgi?id=692564

 src/preview.js |   20 +++++++++++++++++++-
 1 files changed, 19 insertions(+), 1 deletions(-)
---
diff --git a/src/preview.js b/src/preview.js
index b4d1a6d..a8ff646 100644
--- a/src/preview.js
+++ b/src/preview.js
@@ -124,6 +124,8 @@ const PreviewView = new Lang.Class({
                                             Lang.bind(this, this._onLoadStarted));
         Application.documentManager.connect('load-finished',
                                             Lang.bind(this, this._onLoadFinished));
+        Application.documentManager.connect('load-error',
+                                            Lang.bind(this, this._onLoadError));
     },
 
    _onLoadStarted: function() {
@@ -139,6 +141,11 @@ const PreviewView = new Lang.Class({
         this._bookmarks = new GdPrivate.Bookmarks({ metadata: Application.documentManager.metadata });
     },
 
+    _onLoadError: function(manager, doc, message, exception) {
+        this._controlsVisible = true;
+        this._syncControlsVisible();
+    },
+
     _onActionStateChanged: function(source, actionName, state) {
         if (!this._model)
             return;
@@ -393,7 +400,7 @@ const PreviewView = new Lang.Class({
         if (this._model) {
             this._createView();
             this.view.set_model(this._model);
-            this._navBar.widget.document_model = model;
+            this._navBar.setModel(model);
             this._model.connect('page-changed', Lang.bind(this, this._onPageChanged));
         }
     },
@@ -418,6 +425,7 @@ const PreviewNav = new Lang.Class({
     Name: 'PreviewNav',
 
     _init: function(model) {
+        this._model = model;
         this.widget = new GdPrivate.NavBar({ document_model: model });
         this.widget.get_style_context().add_class('osd');
 
@@ -448,7 +456,17 @@ const PreviewNav = new Lang.Class({
         this.widget.show_all();
     },
 
+    setModel: function(model) {
+        this._model = model;
+        this.widget.document_model = model;
+        if (!model)
+            this.hide();
+    },
+
     show: function() {
+        if (!this._model)
+            return;
+
         this.actor.show();
 
         Tweener.addTween(this.actor,



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