[polari] app: Make ::prepare-shutdown a GObject signal
- From: Florian Müllner <fmuellner src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [polari] app: Make ::prepare-shutdown a GObject signal
- Date: Fri, 19 Feb 2016 11:51:10 +0000 (UTC)
commit f858a03875adda7bd44c2f5d4c10920812851a2b
Author: Florian Müllner <fmuellner gnome org>
Date: Fri Feb 19 12:12:25 2016 +0100
app: Make ::prepare-shutdown a GObject signal
Using the Signals module's signal methods with GObject-derived classes
has always been awkward, as both emitter and consumer of signals need to
be aware of the difference and use dedicated methods. In newer classes,
we already make use of Lang.Class' ability to define GObject signals,
which makes the last remaining case of mixing signal systems even more
awkward - time to remove the old hack and make it a GObject signal.
src/accountsMonitor.js | 4 ++--
src/application.js | 4 ++--
src/utils.js | 7 -------
3 files changed, 4 insertions(+), 11 deletions(-)
---
diff --git a/src/accountsMonitor.js b/src/accountsMonitor.js
index b692d1a..844f993 100644
--- a/src/accountsMonitor.js
+++ b/src/accountsMonitor.js
@@ -19,8 +19,8 @@ const AccountsMonitor = new Lang.Class({
this._accounts = [];
this._app = Gio.Application.get_default();
- this._app.connectJS('prepare-shutdown',
- Lang.bind(this, this._onPrepareShutdown));
+ this._app.connect('prepare-shutdown',
+ Lang.bind(this, this._onPrepareShutdown));
this._accountManager = Tp.AccountManager.dup();
diff --git a/src/application.js b/src/application.js
index ad61436..925577d 100644
--- a/src/application.js
+++ b/src/application.js
@@ -23,6 +23,7 @@ const ConnectionError = {
const Application = new Lang.Class({
Name: 'Application',
Extends: Gtk.Application,
+ Signals: { 'prepare-shutdown': {} },
_init: function() {
this.parent({ application_id: 'org.gnome.Polari' });
@@ -143,7 +144,7 @@ const Application = new Lang.Class({
function() {
for (let id in this._pendingRequests)
this._pendingRequests[id].cancellable.cancel();
- this.emitJS('prepare-shutdown');
+ this.emit('prepare-shutdown');
}));
this._window.show_all();
@@ -503,4 +504,3 @@ const Application = new Lang.Class({
this._window.destroy();
}
});
-Utils.addJSSignalMethods(Application.prototype);
diff --git a/src/utils.js b/src/utils.js
index 69235f9..2c63918 100644
--- a/src/utils.js
+++ b/src/utils.js
@@ -108,13 +108,6 @@ function getURISchemes() {
return schemes;
}
-function addJSSignalMethods(proto) {
- proto.connectJS = Signals._connect;
- proto.disconnectJS = Signals._disconnect;
- proto.emitJS = Signals._emit;
- proto.disconnectAllJS = Signals._disconnectAll;
-}
-
function getTpEventTime() {
let time = Gtk.get_current_event_time ();
if (time == 0)
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]