[gnome-documents] preview: disable preview actions until loaded
- From: Cosimo Cecchi <cosimoc src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [gnome-documents] preview: disable preview actions until loaded
- Date: Sat, 9 Feb 2013 01:18:38 +0000 (UTC)
commit d99f5a38892ebc850aecfdf8f9066488bd92b5ec
Author: Cosimo Cecchi <cosimoc gnome org>
Date: Fri Feb 8 20:18:06 2013 -0500
preview: disable preview actions until loaded
src/preview.js | 29 ++++++++++++++++++++++++++++-
1 files changed, 28 insertions(+), 1 deletions(-)
---
diff --git a/src/preview.js b/src/preview.js
index f0ea900..aa7f4ad 100644
--- a/src/preview.js
+++ b/src/preview.js
@@ -82,7 +82,8 @@ const PreviewView = new Lang.Class({
Application.application.connect('action-state-changed::bookmark-page',
Lang.bind(this, this._onActionStateChanged));
- this._onActionStateChanged(Application.application, 'bookmark-page', Application.application.get_action_state('bookmark-page'));
+ this._onActionStateChanged(Application.application, 'bookmark-page',
+ Application.application.get_action_state('bookmark-page'));
this._zoomIn = Application.application.lookup_action('zoom-in');
this._zoomIn.connect('activate', Lang.bind(this,
@@ -516,8 +517,34 @@ const PreviewToolbar = new Lang.Class({
menuButton.set_menu_model(previewMenu);
menuButton.set_action_name('app.gear-menu');
+ this._searchAction = Application.application.lookup_action('search');
+ this._gearMenu = Application.application.lookup_action('gear-menu');
+
this._setToolbarTitle();
this.toolbar.show_all();
+
+ let loadStartId =
+ Application.documentManager.connect('load-started',
+ Lang.bind(this, this._onLoadStarted));
+ let loadFinishId =
+ Application.documentManager.connect('load-finished',
+ Lang.bind(this, this._onLoadFinished));
+
+ this.widget.connect('destroy',
+ function() {
+ Application.documentManager.disconnect(loadStartId);
+ Application.documentManager.disconnect(loadFinishId);
+ });
+ },
+
+ _onLoadStarted: function() {
+ this._gearMenu.enabled = false;
+ this._searchAction.enabled = false;
+ },
+
+ _onLoadFinished: function() {
+ this._gearMenu.enabled = true;
+ this._searchAction.enabled = true;
},
_getPreviewMenu: function() {
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]