Move Gajim startup code into do_startup

This commit is contained in:
Philipp Hörist 2017-02-11 19:38:45 +01:00
parent 819bee1253
commit e30527f8ce
1 changed files with 9 additions and 9 deletions

View File

@ -44,6 +44,7 @@ class GajimApplication(Gtk.Application):
def __init__(self):
Gtk.Application.__init__(self, application_id='org.gajim.Gajim',
flags=Gio.ApplicationFlags.HANDLES_COMMAND_LINE)
self.add_main_option('version', ord('V'), GLib.OptionFlags.NONE,
GLib.OptionArg.NONE,
_('Show the application\'s version'))
@ -85,15 +86,6 @@ class GajimApplication(Gtk.Application):
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)
import gtkexcepthook
gtkexcepthook.init()
@ -205,6 +197,14 @@ class GajimApplication(Gtk.Application):
self.interface = Interface()
self.interface.run(self)
def do_activate(self):
Gtk.Application.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
def do_shutdown(self, *args):
Gtk.Application.do_shutdown(self)
# Save the entropy from OpenSSL PRNG