Merge lp:~dobey/ubuntu-sso-client/fix-glib-main into lp:ubuntu-sso-client/stable-3-0

Proposed by dobey
Status: Merged
Approved by: dobey
Approved revision: 842
Merged at revision: 842
Proposed branch: lp:~dobey/ubuntu-sso-client/fix-glib-main
Merge into: lp:ubuntu-sso-client/stable-3-0
Diff against target: 41 lines (+9/-9)
1 file modified
ubuntu_sso/main/glib.py (+9/-9)
To merge this branch: bzr merge lp:~dobey/ubuntu-sso-client/fix-glib-main
Reviewer Review Type Date Requested Status
Diego Sarmentero (community) Approve
Roberto Alsina (community) Approve
Review via email: mp+119045@code.launchpad.net

Commit message

Refactor the glib main runner to not depend on GTK+/Gdk, but only on glib

To post a comment you must log in.
Revision history for this message
Roberto Alsina (ralsina) :
review: Approve
Revision history for this message
Diego Sarmentero (diegosarmentero) wrote :

+1

review: Approve

Preview Diff

[H/L] Next/Prev Comment, [J/K] Next/Prev File, [N/P] Next/Prev Hunk
1=== modified file 'ubuntu_sso/main/glib.py'
2--- ubuntu_sso/main/glib.py 2012-04-09 17:38:24 +0000
3+++ ubuntu_sso/main/glib.py 2012-08-09 20:59:20 +0000
4@@ -30,11 +30,10 @@
5
6 # pylint: disable=E0611,F0401
7
8-# pylint: disable=W0621
9-import dbus.mainloop.glib
10-# pylint: enable=W0621
11+from dbus.mainloop.glib import DBusGMainLoop
12+from gi.repository import GLib
13
14-from gi.repository import GLib, Gdk, Gtk
15+GLIB_MAINLOOP = None # global
16
17
18 def timeout_func(*a, **kw):
19@@ -44,16 +43,17 @@
20
21 def shutdown_func(*a, **kw):
22 """Delay import of dynamic bindings to avoid crashes."""
23- Gtk.main_quit()
24+ GLIB_MAINLOOP.quit()
25
26
27 def run_func(loop):
28 """Delay import of dynamic bindings to avoid crashes."""
29- Gtk.main()
30+ loop.run()
31
32
33 def start_setup():
34 """Setup the env to run the service."""
35- dbus.mainloop.glib.threads_init()
36- Gdk.threads_init()
37- dbus.mainloop.glib.DBusGMainLoop(set_as_default=True)
38+ DBusGMainLoop(set_as_default=True)
39+ global GLIB_MAINLOOP # pylint: disable=W0603
40+ GLIB_MAINLOOP = loop = GLib.MainLoop()
41+ return loop

Subscribers

People subscribed via source and target branches

to all changes: