[polari/wip/fmuellner/debug-instance: 2/4] app: Add --debug command line flag
- From: Gitlab Administrative User <gitlab src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [polari/wip/fmuellner/debug-instance: 2/4] app: Add --debug command line flag
- Date: Fri, 10 Nov 2017 19:07:40 +0000 (UTC)
commit 42807a3a6af6cecef92954006d07ec909fbc0407
Author: Florian Müllner <fmuellner gnome org>
Date: Fri Feb 19 12:45:26 2016 +0100
app: Add --debug command line flag
It runs polari with a different application ID and doesn't disconnect
when closed, so it allows hacking on polari while using it for chatting
at the same time :-)
Fixes https://gitlab.gnome.org/GNOME/polari/issues/24
flatpak/org.gnome.Polari.json | 1 +
src/accountsMonitor.js | 6 ++++--
src/application.js | 18 ++++++++++++++++--
3 files changed, 21 insertions(+), 4 deletions(-)
---
diff --git a/flatpak/org.gnome.Polari.json b/flatpak/org.gnome.Polari.json
index bc10c46..064ec3c 100644
--- a/flatpak/org.gnome.Polari.json
+++ b/flatpak/org.gnome.Polari.json
@@ -15,6 +15,7 @@
"--share=network",
/* Our client name */
"--own-name=org.freedesktop.Telepathy.Client.Polari",
+ "--own-name=org.freedesktop.Telepathy.Client.Polari.Debug",
/* Telepathy */
"--talk-name=org.freedesktop.Telepathy.AccountManager",
"--talk-name=org.freedesktop.Telepathy.ChannelDispatcher",
diff --git a/src/accountsMonitor.js b/src/accountsMonitor.js
index 1ae5900..3b0c67d 100644
--- a/src/accountsMonitor.js
+++ b/src/accountsMonitor.js
@@ -14,8 +14,10 @@ var AccountsMonitor = class {
this._accountSettings = new Map();
this._app = Gio.Application.get_default();
- this._app.connect('prepare-shutdown',
- this._onPrepareShutdown.bind(this));
+
+ if (!this._app.isDebugInstance)
+ this._app.connect('prepare-shutdown',
+ this._onPrepareShutdown.bind(this));
this._accountManager = Tp.AccountManager.dup();
diff --git a/src/application.js b/src/application.js
index 8b276c5..06613b2 100644
--- a/src/application.js
+++ b/src/application.js
@@ -45,17 +45,26 @@ var Application = GObject.registerClass({
this.add_main_option('start-client', 0,
GLib.OptionFlags.NONE, GLib.OptionArg.NONE,
_("Start Telepathy client"), null);
+ this.add_main_option('debug', 0,
+ GLib.OptionFlags.NONE, GLib.OptionArg.NONE,
+ _("Run in debug mode"), null);
this.add_main_option('version', 0,
GLib.OptionFlags.NONE, GLib.OptionArg.NONE,
_("Print version and exit"), null);
this.connect('handle-local-options', (o, dict) => {
+ let v = dict.lookup_value('debug', null);
+ if (v && v.get_boolean()) {
+ this.set_flags(this.flags | Gio.ApplicationFlags.NON_UNIQUE);
+
+ }
+
try {
this.register(null);
} catch(e) {
return 1;
}
- let v = dict.lookup_value('start-client', null);
+ v = dict.lookup_value('start-client', null);
if (v && v.get_boolean()) {
this.activate_action('start-client', null);
return 0;
@@ -452,6 +461,10 @@ var Application = GObject.registerClass({
return savedRooms.n_children() == 0;
}
+ get isDebugInstance() {
+ return this.flags & Gio.ApplicationFlags.NON_UNIQUE;
+ }
+
_updateUserListAction() {
let room = this.active_window.active_room;
let action = this.lookup_action('user-list');
@@ -716,8 +729,9 @@ var Application = GObject.registerClass({
if (this._telepathyClient)
return;
+ let suffix = this.isDebugInstance ? '.Debug' : '';
let params = {
- name: 'Polari',
+ name: 'Polari' + suffix,
account_manager: this._accountsMonitor.accountManager,
uniquify_name: false
};
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]