[polari] app: Factor out 'start-client' action
- From: Florian Müllner <fmuellner src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [polari] app: Factor out 'start-client' action
- Date: Mon, 10 Oct 2016 22:11:52 +0000 (UTC)
commit 80d8fd021564dbe379c3e61b465a0287c7079efc
Author: Florian Müllner <fmuellner gnome org>
Date: Sat Aug 6 04:56:14 2016 +0200
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 files changed, 15 insertions(+), 8 deletions(-)
---
diff --git a/src/application.js b/src/application.js
index a0d31ba..a2f7bad 100644
--- a/src/application.js
+++ b/src/application.js
@@ -82,6 +82,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'] },
@@ -145,14 +147,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 });
@@ -472,6 +467,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());
},
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]