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

@ -25,7 +25,7 @@ try:
import dbus
import dbus.service
# cause dbus 0.35+ doesn't return signal replies without it
import dbus.glib
import dbus.glib
supported = True
except ImportError:
supported = False

View File

@ -14,8 +14,10 @@
## GNU General Public License for more details.
##
import gobject
import dbus
import dbus.glib
import dbus_support
if dbus_support.supported:
import dbus
import dbus.glib
class MusicTrackInfo(object):
__slots__ = ['title', 'album', 'artist', 'duration', 'track_number']

View File

@ -39,7 +39,10 @@ from message_window import MessageWindowMgr
from chat_control import ChatControl
from groupchat_control import GroupchatControl
from groupchat_control import PrivateChatControl
from music_track_listener import MusicTrackListener
import dbus_support
if dbus_support.supported:
from music_track_listener import MusicTrackListener
#(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
currently played music track, and we update our
status message accordinly'''
if not dbus_support.supported: # do nothing if we haven't D-Bus running
return
if enabled:
if self._music_track_changed_signal is None:
listener = MusicTrackListener.get()