[gnome-documents] Remove Utils.addJSSignalMethods()
- From: Cosimo Cecchi <cosimoc src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [gnome-documents] Remove Utils.addJSSignalMethods()
- Date: Sat, 1 Apr 2017 22:41:56 +0000 (UTC)
commit 2f913a4f3b431523e44ef9c6f6118bfa7cedb624
Author: Cosimo Cecchi <cosimoc gnome org>
Date: Sat Apr 1 15:41:03 2017 -0700
Remove Utils.addJSSignalMethods()
We can use GObject signals and remove this quirk.
src/application.js | 10 ++++++----
src/embed.js | 4 ++--
src/evinceview.js | 2 +-
src/notifications.js | 2 +-
src/presentation.js | 10 +++++++---
src/searchbar.js | 6 ++++--
src/utils.js | 7 -------
7 files changed, 21 insertions(+), 20 deletions(-)
---
diff --git a/src/application.js b/src/application.js
index e17dbdd..f14758b 100644
--- a/src/application.js
+++ b/src/application.js
@@ -95,6 +95,9 @@ const MINER_REFRESH_TIMEOUT = 60; /* seconds */
const Application = new Lang.Class({
Name: 'Application',
Extends: Gtk.Application,
+ Signals: {
+ 'miners-changed': {}
+ },
_init: function(isBooks) {
this.minersRunning = [];
@@ -241,7 +244,7 @@ const Application = new Lang.Class({
return false;
this.minersRunning.push(miner);
- this.emitJS('miners-changed');
+ this.emit('miners-changed');
miner._cancellable = new Gio.Cancellable();
miner.RefreshDBRemote(['documents'], miner._cancellable, Lang.bind(this,
@@ -250,7 +253,7 @@ const Application = new Lang.Class({
function(element) {
return element != miner;
});
- this.emitJS('miners-changed');
+ this.emit('miners-changed');
if (error) {
if (!error.matches(Gio.IOErrorEnum, Gio.IOErrorEnum.CANCELLED))
@@ -324,6 +327,7 @@ const Application = new Lang.Class({
function(miner) {
miner._cancellable.cancel();
}));
+ this.minersRunning = [];
this.gdataMiner = null;
this.owncloudMiner = null;
@@ -481,7 +485,6 @@ const Application = new Lang.Class({
trackerSearchController.disconnectAll();
selectionController.disconnectAll();
modeController.disconnectAll();
- this.disconnectAllJS();
// reset state
documentManager.clearRowRefs();
@@ -564,4 +567,3 @@ const Application = new Lang.Class({
return window;
}
});
-Utils.addJSSignalMethods(Application.prototype);
diff --git a/src/embed.js b/src/embed.js
index 6203f69..81903ec 100644
--- a/src/embed.js
+++ b/src/embed.js
@@ -137,8 +137,8 @@ const View = new Lang.Class({
this._toolbar = this.view.createToolbar(this._stack);
if (this._toolbar.searchbar)
- this._toolbar.searchbar.connectJS('activate-result',
- Lang.bind(this, this._onActivateResult));
+ this._toolbar.searchbar.connect('activate-result',
+ Lang.bind(this, this._onActivateResult));
this._window.get_titlebar().add(this._toolbar);
}
},
diff --git a/src/evinceview.js b/src/evinceview.js
index afbbf65..b638674 100644
--- a/src/evinceview.js
+++ b/src/evinceview.js
@@ -360,7 +360,7 @@ const EvinceView = new Lang.Class({
this._showPresentation();
} else {
let chooser = new Presentation.PresentationOutputChooser(outputs);
- chooser.connectJS('output-activated', Lang.bind(this,
+ chooser.connect('output-activated', Lang.bind(this,
function(chooser, output) {
if (output) {
this._showPresentation(output);
diff --git a/src/notifications.js b/src/notifications.js
index 38531a6..259a317 100644
--- a/src/notifications.js
+++ b/src/notifications.js
@@ -185,7 +185,7 @@ const IndexingNotification = new Lang.Class({
return;
}
- Application.application.connectJS('miners-changed', Lang.bind(this, this._checkNotification));
+ Application.application.connect('miners-changed', Lang.bind(this, this._checkNotification));
Application.modeController.connect('window-mode-changed', Lang.bind(this, this._checkNotification));
},
diff --git a/src/presentation.js b/src/presentation.js
index 5a4535c..bc6c8c8 100644
--- a/src/presentation.js
+++ b/src/presentation.js
@@ -114,6 +114,11 @@ const PresentationWindow = new Lang.Class({
const PresentationOutputChooser = new Lang.Class({
Name: 'PresentationOutputChooser',
Extends: Gtk.Dialog,
+ Signals: {
+ 'output-activated': {
+ param_types: [GnomeDesktop.RROutputInfo.$gtype]
+ }
+ },
_init: function(outputs) {
let toplevel = Application.application.get_windows()[0];
@@ -185,7 +190,7 @@ const PresentationOutputChooser = new Lang.Class({
return;
this.output = output;
- this.emitJS('output-activated', this.output);
+ this.emit('output-activated', this.output);
this.close();
},
@@ -196,7 +201,7 @@ const PresentationOutputChooser = new Lang.Class({
_createWindow: function() {
this.connect('response', Lang.bind(this,
function(widget, response) {
- this.emitJS('output-activated', null);
+ this.emit('output-activated', null);
}));
let frame = new Gtk.Frame({ shadow_type: Gtk.ShadowType.IN });
@@ -223,7 +228,6 @@ const PresentationOutputChooser = new Lang.Class({
contentArea.pack_start(frame, true, false, 0);
}
});
-Utils.addJSSignalMethods(PresentationOutputChooser.prototype);
const PresentationOutputs = new Lang.Class({
Name: 'PresentationOutputs',
diff --git a/src/searchbar.js b/src/searchbar.js
index e8fe077..ca46205 100644
--- a/src/searchbar.js
+++ b/src/searchbar.js
@@ -33,6 +33,9 @@ const Utils = imports.utils;
const Searchbar = new Lang.Class({
Name: 'Searchbar',
Extends: Gtk.SearchBar,
+ Signals: {
+ 'activate-result': {}
+ },
_init: function() {
this.searchChangeBlocked = false;
@@ -71,7 +74,7 @@ const Searchbar = new Lang.Class({
let keyval = event.get_keyval()[1];
if (this.search_mode_enabled && keyval == Gdk.KEY_Return) {
- this.emitJS('activate-result');
+ this.emit('activate-result');
return true;
}
@@ -92,7 +95,6 @@ const Searchbar = new Lang.Class({
this.searchEntry.set_text('');
}
});
-Utils.addJSSignalMethods(Searchbar.prototype);
const Dropdown = new Lang.Class({
Name: 'Dropdown',
diff --git a/src/utils.js b/src/utils.js
index dfdcd97..bb45adf 100644
--- a/src/utils.js
+++ b/src/utils.js
@@ -114,13 +114,6 @@ function debug(str) {
log('DEBUG: ' + str);
}
-function addJSSignalMethods(proto) {
- proto.connectJS = Signals._connect;
- proto.disconnectJS = Signals._disconnect;
- proto.emitJS = Signals._emit;
- proto.disconnectAllJS = Signals._disconnectAll;
-}
-
function actionToggleCallback(action) {
let state = action.get_state();
action.change_state(GLib.Variant.new('b', !state.get_boolean()));
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]