[gnome-documents] embed: Switch to the preview as soon as an item starts loading



commit 413326a6046e3d02c23869493f154aeb8d4ce0e1
Author: Pranav Kant <pranav913 gmail com>
Date:   Mon Oct 6 16:51:58 2014 +0200

    embed: Switch to the preview as soon as an item starts loading
    
    We are essentially in the preview, not the overview, when an item
    starts loading. Therefore the UI should relate to the current context.
    
    https://bugzilla.gnome.org/show_bug.cgi?id=720516

 src/embed.js |    8 ++++----
 1 files changed, 4 insertions(+), 4 deletions(-)
---
diff --git a/src/embed.js b/src/embed.js
index 1a082e6..13312cb 100644
--- a/src/embed.js
+++ b/src/embed.js
@@ -385,6 +385,8 @@ const Embed = new Lang.Class({
     },
 
     _onLoadStarted: function() {
+        Application.modeController.setWindowMode(WindowMode.WindowMode.PREVIEW);
+
         this._clearLoadTimer();
         this._loadShowId = Mainloop.timeout_add(_PDF_LOADER_TIMEOUT, Lang.bind(this,
             function() {
@@ -397,8 +399,6 @@ const Embed = new Lang.Class({
     },
 
     _onLoadFinished: function(manager, doc, docModel) {
-        Application.modeController.setWindowMode(WindowMode.WindowMode.PREVIEW);
-
         docModel.set_sizing_mode(EvView.SizingMode.AUTOMATIC);
         docModel.set_page_layout(EvView.PageLayout.AUTOMATIC);
         this._toolbar.setModel(docModel);
@@ -411,8 +411,6 @@ const Embed = new Lang.Class({
     },
 
     _onLoadError: function(manager, doc, message, exception) {
-        Application.modeController.setWindowMode(WindowMode.WindowMode.PREVIEW);
-
         this._clearLoadTimer();
         this._spinnerBox.stop();
         this._setError(message, exception.message);
@@ -456,6 +454,8 @@ const Embed = new Lang.Class({
         // pack the toolbar
         this._toolbar = new Preview.PreviewToolbar(this._preview);
         this._titlebar.add(this._toolbar.widget);
+
+        this._stack.set_visible_child_name('preview');
     },
 
     _prepareForEdit: function() {


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