From 815ecdcf4760be56831f668b7c08fd7bb7b03086 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Philipp=20H=C3=B6rist?= Date: Fri, 30 Dec 2016 11:15:17 +0100 Subject: [PATCH] Handle start of second instance We bring the Roster Window to the front Gtk exits on return immediately --- src/application.py | 12 +++++++++--- 1 file changed, 9 insertions(+), 3 deletions(-) diff --git a/src/application.py b/src/application.py index d023d03a4..57be4dca0 100644 --- a/src/application.py +++ b/src/application.py @@ -64,11 +64,18 @@ class GajimApplication(Gtk.Application): self.profile = '' self.config_path = None self.profile_separation = False + self.interface = None def do_startup(self): Gtk.Application.do_startup(self) def do_activate(self): + # If a second instance starts do_activate() is called + # We bringt the Roster window to the front, GTK exits afterwards. + if self.interface: + self.interface.roster.window.present() + return + Gtk.Application.do_activate(self) if os.name == 'nt': @@ -424,9 +431,8 @@ class GajimApplication(Gtk.Application): check_paths.check_and_possibly_create_paths() - interface = Interface() - interface.run(self) - + self.interface = Interface() + self.interface.run(self) def do_command_line(self, command_line: Gio.ApplicationCommandLine) -> int: Gtk.Application.do_command_line(self, command_line)