do not fail because of music track listener if user does not have D-Bus bindings

This commit is contained in:
Nikos Kouremenos 2006-09-24 19:25:44 +00:00
parent e9a6b7c108
commit 70a28b4724
3 changed files with 11 additions and 4 deletions

View File

@ -14,6 +14,8 @@
## GNU General Public License for more details. ## GNU General Public License for more details.
## ##
import gobject import gobject
import dbus_support
if dbus_support.supported:
import dbus import dbus
import dbus.glib import dbus.glib

View File

@ -39,6 +39,9 @@ from message_window import MessageWindowMgr
from chat_control import ChatControl from chat_control import ChatControl
from groupchat_control import GroupchatControl from groupchat_control import GroupchatControl
from groupchat_control import PrivateChatControl from groupchat_control import PrivateChatControl
import dbus_support
if dbus_support.supported:
from music_track_listener import MusicTrackListener from music_track_listener import MusicTrackListener
#(icon, name, type, jid, account, editable, second pixbuf) #(icon, name, type, jid, account, editable, second pixbuf)
@ -2389,6 +2392,8 @@ _('If "%s" accepts this request you will know his or her status.') % jid)
'''if enabled is True, we listen to events from music players about '''if enabled is True, we listen to events from music players about
currently played music track, and we update our currently played music track, and we update our
status message accordinly''' status message accordinly'''
if not dbus_support.supported: # do nothing if we haven't D-Bus running
return
if enabled: if enabled:
if self._music_track_changed_signal is None: if self._music_track_changed_signal is None:
listener = MusicTrackListener.get() listener = MusicTrackListener.get()