From 9ea208e36a717dc2c8f55f4a5edb0ddc14e9cc90 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Tomasz=20Mi=C4=85sko?= Date: Wed, 18 Jan 2017 18:45:04 +0100 Subject: [PATCH] Use separate application id for each profile. Application id is customized in do_handle_local_options just before it is registered and can't be changed any further. This makes it possible to run multiple instances of Gajim, at most one for each profile. --- src/application.py | 9 +++++++++ 1 file changed, 9 insertions(+) diff --git a/src/application.py b/src/application.py index a96ba61df..61ce00455 100644 --- a/src/application.py +++ b/src/application.py @@ -217,6 +217,15 @@ class GajimApplication(Gtk.Application): if hasattr(self.interface, 'roster') and self.interface.roster: self.interface.roster.prepare_quit() + def do_handle_local_options(self, options: GLib.VariantDict) -> int: + if options.contains('profile'): + # Incorporate profile name into application id + # to have a single app instance for each profile. + profile = options.lookup_value('profile').get_string() + app_id = '%s.%s' % (self.get_application_id(), profile) + self.set_application_id(app_id) + return -1 + def do_command_line(self, command_line: Gio.ApplicationCommandLine) -> int: Gtk.Application.do_command_line(self, command_line) options = command_line.get_options_dict()