don't try to do Awn code if it's not available

This commit is contained in:
Yann Leboulanger 2007-06-29 22:25:50 +00:00
parent 270c956db3
commit 965e2b1c78
1 changed files with 7 additions and 1 deletions

View File

@ -3538,6 +3538,13 @@ class RosterWindow:
if not dbus_support.supported: if not dbus_support.supported:
# do nothing if user doesn't have D-Bus bindings # do nothing if user doesn't have D-Bus bindings
return return
bus = dbus.SessionBus()
try:
if not 'com.google.code.Awn' in bus.list_names():
# Awn is not installed
return
except:
pass
iconset = gajim.config.get('iconset') iconset = gajim.config.get('iconset')
prefix = os.path.join(gajim.DATA_DIR, 'iconsets', iconset, '32x32') prefix = os.path.join(gajim.DATA_DIR, 'iconsets', iconset, '32x32')
if status in ('chat', 'away', 'xa', 'dnd', 'invisible', 'offline'): if status in ('chat', 'away', 'xa', 'dnd', 'invisible', 'offline'):
@ -3547,7 +3554,6 @@ class RosterWindow:
status = 'gajim.png' status = 'gajim.png'
path = os.path.join(prefix, status) path = os.path.join(prefix, status)
try: try:
bus = dbus.SessionBus()
obj = bus.get_object('com.google.code.Awn', '/com/google/code/Awn') obj = bus.get_object('com.google.code.Awn', '/com/google/code/Awn')
awn = dbus.Interface(obj, 'com.google.code.Awn') awn = dbus.Interface(obj, 'com.google.code.Awn')
awn.SetTaskIconByName('Gajim', os.path.abspath(path)) awn.SetTaskIconByName('Gajim', os.path.abspath(path))