Web   ·   Wiki   ·   Activities   ·   Blog   ·   Lists   ·   Chat   ·   Meeting   ·   Bugs   ·   Git   ·   Translate   ·   Archive   ·   People   ·   Donate
summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorDan Williams <dcbw@redhat.com>2007-04-13 17:46:07 (GMT)
committer Dan Williams <dcbw@redhat.com>2007-04-13 17:46:07 (GMT)
commit982c11215578b75d6761296e36a3d6d7f32b4c6e (patch)
treec0d362d899686fce39a048b4c920c8237eaffd48
parent773ae4965e20f25e4d9454f7e6299afa2e2cab6a (diff)
Make debugging tp-gabble easier
When the environment variable TP_DEBUG is set, the sugar shell will print out the session bus address it's using, then poll that bus every 5 seconds waiting for a gabble instance to appear. This allows you to launch gabble in another window for debugging with LM_DEBUG and gdb, which wasn't possible before because the sugar emulator uses a custom session bus.
-rwxr-xr-xshell/sugar-shell33
1 files changed, 33 insertions, 0 deletions
diff --git a/shell/sugar-shell b/shell/sugar-shell
index f0cda4d..c203298 100755
--- a/shell/sugar-shell
+++ b/shell/sugar-shell
@@ -81,6 +81,39 @@ if not key or not len(key):
gtk.main()
profile.update()
+def check_gabble(bus_name):
+ try:
+ import dbus
+ bus = dbus.SessionBus()
+ bus_object = bus.get_object('org.freedesktop.DBus', '/org/freedesktop/DBus')
+ name = bus_object.GetNameOwner(bus_name, dbus_interface='org.freedesktop.DBus')
+ if name:
+ return True
+ except dbus.DBusException:
+ pass
+ return False
+
+if os.environ.has_key("TP_DEBUG"):
+ # Allow the user time to start up telepathy connection managers
+ # using the Sugar DBus bus address
+ import time
+ from telepathy.client import ManagerRegistry
+
+ registry = ManagerRegistry()
+ registry.LoadManagers()
+ try:
+ gabble = registry.services["gabble"]
+ except KeyError:
+ raise RuntimeError("Gabble connection manager not found!")
+
+ while not check_gabble(gabble['busname']):
+ print "Waiting for gabble on: DBUS_SESSION_BUS_ADDRESS=%s" % os.environ["DBUS_SESSION_BUS_ADDRESS"]
+ try:
+ time.sleep(5)
+ except KeyboardInterrupt:
+ print "Got Ctrl+C, continuing..."
+ break
+
model = ShellModel()
service = ShellService(model)
shell = Shell(model)