[gnome-documents] preview: Fix bookmark action
- From: Alessandro Bono <abono src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [gnome-documents] preview: Fix bookmark action
- Date: Sun, 5 Jun 2016 16:16:18 +0000 (UTC)
commit d06589b2959226843176b67db8efbaee78f11cbb
Author: Alessandro Bono <abono gnome org>
Date: Mon Apr 25 00:42:49 2016 +0200
preview: Fix bookmark action
If a handler is connected to GSimpleAction::change-state it
must implement the actual action change. Connect to
GActionGroup:action-state-changed as done for the other
stateful actions.
Source: https://developer.gnome.org/gio/stable/GSimpleAction.html#GSimpleAction-change-state
https://bugzilla.gnome.org/show_bug.cgi?id=759366
src/preview.js | 9 +++++----
1 files changed, 5 insertions(+), 4 deletions(-)
---
diff --git a/src/preview.js b/src/preview.js
index 8ffca57..cb0c5b9 100644
--- a/src/preview.js
+++ b/src/preview.js
@@ -91,9 +91,8 @@ const PreviewView = new Lang.Class({
this._bookmarkPage = Application.application.lookup_action('bookmark-page');
this._bookmarkPage.enabled = false;
- let bookmarkPageId = this._bookmarkPage.connect('change-state',
+ let bookmarkPageId = Application.application.connect('action-state-changed::bookmark-page',
Lang.bind(this, this._onActionStateChanged));
- this._onActionStateChanged(this._bookmarkPage, this._bookmarkPage.state);
this._zoomIn = Application.application.lookup_action('zoom-in');
let zoomInId = this._zoomIn.connect('activate', Lang.bind(this,
@@ -158,7 +157,6 @@ const PreviewView = new Lang.Class({
this.connect('destroy', Lang.bind(this,
function() {
- this._bookmarkPage.disconnect(bookmarkPageId);
this._zoomIn.disconnect(zoomInId);
this._zoomOut.disconnect(zoomOutId);
findPrev.disconnect(findPrevId);
@@ -169,6 +167,8 @@ const PreviewView = new Lang.Class({
this._places.disconnect(placesId);
if (!Application.application.isBooks)
Application.application.disconnect(presentCurrentId);
+
+ Application.application.disconnect(bookmarkPageId);
Application.application.disconnect(nightModeId);
}));
},
@@ -189,7 +189,7 @@ const PreviewView = new Lang.Class({
this._setError(message, exception.message);
},
- _onActionStateChanged: function(action, state) {
+ _onActionStateChanged: function(source, actionName, state) {
if (!this._model)
return;
@@ -574,6 +574,7 @@ const PreviewView = new Lang.Class({
this._places.enabled = hasMultiplePages;
this._model.connect('page-changed', Lang.bind(this, this._onPageChanged));
+ this._onPageChanged();
this._updateNightMode();
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]