[gnome-documents] preview: Cache the 'bookmark-page' action



commit 5d3d6007514e97307954a909c4b8a7e174b3ade9
Author: Debarshi Ray <debarshir gnome org>
Date:   Fri Jul 11 12:54:24 2014 +0200

    preview: Cache the 'bookmark-page' action
    
    https://bugzilla.gnome.org/show_bug.cgi?id=733061

 src/preview.js |   10 +++++-----
 1 files changed, 5 insertions(+), 5 deletions(-)
---
diff --git a/src/preview.js b/src/preview.js
index c5234ae..e9f7342 100644
--- a/src/preview.js
+++ b/src/preview.js
@@ -85,10 +85,10 @@ const PreviewView = new Lang.Class({
 
         this.widget.show_all();
 
-        Application.application.connect('action-state-changed::bookmark-page',
+        this._bookmarkPage = Application.application.lookup_action('bookmark-page');
+        this._bookmarkPage.connect('change-state',
             Lang.bind(this, this._onActionStateChanged));
-        this._onActionStateChanged(Application.application, 'bookmark-page',
-            Application.application.get_action_state('bookmark-page'));
+        this._onActionStateChanged(this._bookmarkPage, this._bookmarkPage.state);
 
         this._zoomIn = Application.application.lookup_action('zoom-in');
         this._zoomIn.connect('activate', Lang.bind(this,
@@ -170,7 +170,7 @@ const PreviewView = new Lang.Class({
         this._loadError = false;
     },
 
-    _onActionStateChanged: function(source, actionName, state) {
+    _onActionStateChanged: function(action, state) {
         if (!this._model)
             return;
 
@@ -200,7 +200,7 @@ const PreviewView = new Lang.Class({
         let bookmark = new GdPrivate.Bookmark({ page_number: page_number });
         let hasBookmark = (this._bookmarks.find_bookmark(bookmark) != null);
 
-        Application.application.change_action_state('bookmark-page', GLib.Variant.new('b', (hasBookmark)));
+        this._bookmarkPage.state = GLib.Variant.new('b', hasBookmark);
     },
 
     _showPlaces: function() {


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