From 34eadf596e3f1934d61aac7b7bf00ba63dea41562e19a0186067838825b10be4 Mon Sep 17 00:00:00 2001 From: Dominique Leuenberger Date: Wed, 19 Oct 2016 17:33:23 +0000 Subject: [PATCH] Accepting request 436423 from GNOME:Next This fixes the emapthy for Tumbleweed at least - for 42.2 it will take a bit more, as the patches do not cleanly apply on 3.20.x OBS-URL: https://build.opensuse.org/request/show/436423 OBS-URL: https://build.opensuse.org/package/show/GNOME:Factory/polari?expand=0&rev=48 --- polari-run-as-background-service.patch | 271 +++++++++++++++++++++++++ polari.changes | 9 + polari.spec | 3 + 3 files changed, 283 insertions(+) create mode 100644 polari-run-as-background-service.patch diff --git a/polari-run-as-background-service.patch b/polari-run-as-background-service.patch new file mode 100644 index 0000000..3c9bd49 --- /dev/null +++ b/polari-run-as-background-service.patch @@ -0,0 +1,271 @@ +From 5be7218ae3b040849c6ba136709cfacad5a833b7 Mon Sep 17 00:00:00 2001 +From: =?UTF-8?q?Florian=20M=C3=BCllner?= +Date: Thu, 14 Jul 2016 16:04:43 +0200 +Subject: [PATCH 1/4] app: Stop using a private property to track the main + window + +We will eventually allow running without open windows, and possibly +with multiple windows as well, at which point using a private property +to track the main window gets in the way more than it helps, so adapt +the code to either use the :active-window or iterate over all windows +as appropriate. + +https://bugzilla.gnome.org/show_bug.cgi?id=770749 +--- + src/application.js | 33 ++++++++++++++++----------------- + 1 file changed, 16 insertions(+), 17 deletions(-) + +diff --git a/src/application.js b/src/application.js +index 898bff0..c6d19e2 100644 +--- a/src/application.js ++++ b/src/application.js +@@ -30,7 +30,6 @@ const Application = new Lang.Class({ + flags: Gio.ApplicationFlags.HANDLES_OPEN }); + + GLib.set_application_name('Polari'); +- this._window = null; + this._retryData = new Map(); + }, + +@@ -153,17 +152,17 @@ const Application = new Lang.Class({ + this._telepathyClient = new TelepathyClient.TelepathyClient(params); + } + +- if (!this._window) { +- this._window = new MainWindow.MainWindow({ application: this }); +- this._window.connect('destroy', +- () => { this.emit('prepare-shutdown'); }); +- this._window.connect('notify::active-room', +- () => { this.emit('room-focus-changed'); }); +- this._window.connect('notify::is-active', +- () => { this.emit('room-focus-changed'); }); +- this._window.show_all(); ++ if (!this.active_window) { ++ let window = new MainWindow.MainWindow({ application: this }); ++ window.connect('destroy', ++ () => { this.emit('prepare-shutdown'); }); ++ window.connect('notify::active-room', ++ () => { this.emit('room-focus-changed'); }); ++ window.connect('notify::is-active', ++ () => { this.emit('room-focus-changed'); }); ++ window.show_all(); + } +- this._window.present(); ++ this.active_window.present(); + }, + + vfunc_window_added: function(window) { +@@ -294,13 +293,13 @@ const Application = new Lang.Class({ + }, + + _onShowJoinDialog: function() { +- this._window.showJoinRoomDialog(); ++ this.active_window.showJoinRoomDialog(); + }, + + _maybePresent: function(time) { + let [present, ] = Tp.user_action_time_should_present(time); + +- if (!this._window || present) ++ if (!this.active_window || present) + this.activate(); + }, + +@@ -417,7 +416,7 @@ const Application = new Lang.Class({ + }, + + _onLeaveCurrentRoom: function() { +- let room = this._window.active_room; ++ let room = this.active_window.active_room; + if (!room) + return; + let action = this.lookup_action('leave-room'); +@@ -463,7 +462,7 @@ const Application = new Lang.Class({ + let accountPath = parameter.deep_unpack(); + let account = this._accountsMonitor.lookupAccount(accountPath); + let dialog = new Connections.ConnectionProperties(account); +- dialog.transient_for = this._window; ++ dialog.transient_for = this.active_window; + dialog.connect('response', Lang.bind(this, + function(w, response) { + w.destroy(); +@@ -509,7 +508,7 @@ const Application = new Lang.Class({ + website_label: _("Learn more about Polari"), + website: 'https://wiki.gnome.org/Apps/Polari', + +- transient_for: this._window, ++ transient_for: this.active_window, + modal: true + }; + +@@ -522,6 +521,6 @@ const Application = new Lang.Class({ + }, + + _onQuit: function() { +- this._window.destroy(); ++ this.get_windows().reverse().forEach(w => { w.destroy(); }); + } + }); +-- +2.10.1 + +From 7cf5e101496dc864809aa0e39d516642db982a6b Mon Sep 17 00:00:00 2001 +From: =?UTF-8?q?Florian=20M=C3=BCllner?= +Date: Sat, 6 Aug 2016 05:26:55 +0200 +Subject: [PATCH 2/4] telepathyClient: Hold application while running + +The application runtime is currently tied to having a window, however it +can be useful to have only the telepathy client running in the background. +In order to support this, hold the application while the client is running. + +https://bugzilla.gnome.org/show_bug.cgi?id=770749 +--- + src/telepathyClient.js | 2 ++ + 1 file changed, 2 insertions(+) + +diff --git a/src/telepathyClient.js b/src/telepathyClient.js +index 5a9d504..9b0c89c 100644 +--- a/src/telepathyClient.js ++++ b/src/telepathyClient.js +@@ -119,7 +119,9 @@ const TelepathyClient = new Lang.Class({ + this._app.connect('prepare-shutdown', () => { + [...this._pendingRequests.values()].forEach(r => { r.cancel(); }); + [...this._pendingBotPasswords.keys()].forEach(a => { this._discardIdentifyPassword(a); }); ++ this._app.release(); + }); ++ this._app.hold(); + + this._pendingBotPasswords = new Map(); + this._pendingRequests = new Map(); +-- +2.10.1 + +From 0f67348375f9b71393c1dccc6db84cb6e8b40ad8 Mon Sep 17 00:00:00 2001 +From: =?UTF-8?q?Florian=20M=C3=BCllner?= +Date: Sat, 6 Aug 2016 04:56:14 +0200 +Subject: [PATCH 3/4] app: Factor out 'start-client' action + +The telepathy client is currently started if necessary when the +application is activated. However as there are cases for running +the client without activating the application (read: creating a +window), it makes sense to split out the code. While for now a +separate function would do just fine, we'll eventually want the +functionality available even when Polari is not running, so add +a corresponding action. + +https://bugzilla.gnome.org/show_bug.cgi?id=770749 +--- + src/application.js | 23 +++++++++++++++-------- + 1 file changed, 15 insertions(+), 8 deletions(-) + +diff --git a/src/application.js b/src/application.js +index c6d19e2..9925d67 100644 +--- a/src/application.js ++++ b/src/application.js +@@ -81,6 +81,8 @@ const Application = new Lang.Class({ + parameter_type: GLib.VariantType.new('o') }, + { name: 'discard-identify-password', + parameter_type: GLib.VariantType.new('o') }, ++ { name: 'start-client', ++ activate: Lang.bind(this, this._onStartClient) }, + { name: 'help', + activate: Lang.bind(this, this._onShowHelp), + accels: ['F1'] }, +@@ -143,14 +145,7 @@ const Application = new Lang.Class({ + }, + + vfunc_activate: function() { +- if (!this._telepathyClient) { +- let params = { +- name: 'Polari', +- account_manager: this._accountsMonitor.accountManager, +- uniquify_name: false +- }; +- this._telepathyClient = new TelepathyClient.TelepathyClient(params); +- } ++ this.activate_action('start-client', null); + + if (!this.active_window) { + let window = new MainWindow.MainWindow({ application: this }); +@@ -470,6 +465,18 @@ const Application = new Lang.Class({ + dialog.show(); + }, + ++ _onStartClient: function() { ++ if (this._telepathyClient) ++ return; ++ ++ let params = { ++ name: 'Polari', ++ account_manager: this._accountsMonitor.accountManager, ++ uniquify_name: false ++ }; ++ this._telepathyClient = new TelepathyClient.TelepathyClient(params); ++ }, ++ + _onShowHelp: function() { + Utils.openURL('help:org.gnome.Polari', Gtk.get_current_event_time()); + }, +-- +2.10.1 + +From 39dc313fcafad55d9d9f62b954566b146cd3a3df Mon Sep 17 00:00:00 2001 +From: =?UTF-8?q?Florian=20M=C3=BCllner?= +Date: Sat, 6 Aug 2016 05:04:29 +0200 +Subject: [PATCH 4/4] data: Fix telepathy client service + +We register Polari as a Telepathy client so mission-control can launch us +to handle channel requests even when not running. However as the specified +command does not actually start the telepathy client, the request will fail +after a timeout in this case. +Fix this by exposing the newly-added 'start-client' action on the command +line and use it to launch the telepathy service. + +https://bugzilla.gnome.org/show_bug.cgi?id=770749 +--- + ...org.freedesktop.Telepathy.Client.Polari.service.in | 2 +- + src/application.js | 19 +++++++++++++++++++ + 2 files changed, 20 insertions(+), 1 deletion(-) + +diff --git a/data/org.freedesktop.Telepathy.Client.Polari.service.in b/data/org.freedesktop.Telepathy.Client.Polari.service.in +index 741036d..e5d9aee 100644 +--- a/data/org.freedesktop.Telepathy.Client.Polari.service.in ++++ b/data/org.freedesktop.Telepathy.Client.Polari.service.in +@@ -1,3 +1,3 @@ + [D-BUS Service] + Name=org.freedesktop.Telepathy.Client.Polari +-Exec=@bindir@/polari --gapplication-service ++Exec=@bindir@/polari --start-client +diff --git a/src/application.js b/src/application.js +index 9925d67..090569d 100644 +--- a/src/application.js ++++ b/src/application.js +@@ -31,6 +31,25 @@ const Application = new Lang.Class({ + + GLib.set_application_name('Polari'); + this._retryData = new Map(); ++ ++ this.add_main_option('start-client', 0, ++ GLib.OptionFlags.NONE, GLib.OptionArg.NONE, ++ _("Start Telephathy client"), null); ++ this.connect('handle-local-options', (o, dict) => { ++ try { ++ this.register(null); ++ } catch(e) { ++ return 1; ++ } ++ ++ let v = dict.lookup_value('start-client', null); ++ if (v && v.get_boolean()) { ++ this.activate_action('start-client', null); ++ return 0; ++ } ++ ++ return -1; ++ }); + }, + + isRoomFocused: function(room) { +-- +2.10.1 + diff --git a/polari.changes b/polari.changes index e39c780..a223a97 100644 --- a/polari.changes +++ b/polari.changes @@ -1,3 +1,12 @@ +------------------------------------------------------------------- +Wed Oct 19 17:13:19 UTC 2016 - dimstar@opensuse.org + +- Add polari-run-as-background-service.patch: Fix launching through + mission-control (bgo#770749, boo#1001553). When other Telepathy + clients (e.g. Empathy) query dbus for potential channel handlers + polari failed to startup and reply. This resulted in Empathy + waiting for the timeout before opening any chat window. + ------------------------------------------------------------------- Mon Oct 10 15:56:22 UTC 2016 - zaitor@opensuse.org diff --git a/polari.spec b/polari.spec index 73dc825..40c3fec 100644 --- a/polari.spec +++ b/polari.spec @@ -26,6 +26,8 @@ Group: Productivity/Networking/IRC Url: http://wiki.gnome.org/Apps/Polari Source0: http://download.gnome.org/sources/polari/3.22/%{name}-%{version}.tar.xz Source99: polari-rpmlintrc +# PATCH-FIX-UPSTREAM polari-run-as-background-service.patch bgo#770749 boo#1001553 dimstar@opensuse.org -- Fix launching through mission-control +Patch0: polari-run-as-background-service.patch BuildRequires: gjs >= 1.45.0 BuildRequires: hicolor-icon-theme BuildRequires: intltool >= 0.50.0 @@ -60,6 +62,7 @@ with GNOME 3. %lang_package %prep %setup -q +%patch0 -p1 %build %configure