do not fail because of music track listener if user does not have D-Bus bindings
This commit is contained in:
parent
e9a6b7c108
commit
70a28b4724
|
@ -25,7 +25,7 @@ try:
|
||||||
import dbus
|
import dbus
|
||||||
import dbus.service
|
import dbus.service
|
||||||
# cause dbus 0.35+ doesn't return signal replies without it
|
# cause dbus 0.35+ doesn't return signal replies without it
|
||||||
import dbus.glib
|
import dbus.glib
|
||||||
supported = True
|
supported = True
|
||||||
except ImportError:
|
except ImportError:
|
||||||
supported = False
|
supported = False
|
||||||
|
|
|
@ -14,8 +14,10 @@
|
||||||
## GNU General Public License for more details.
|
## GNU General Public License for more details.
|
||||||
##
|
##
|
||||||
import gobject
|
import gobject
|
||||||
import dbus
|
import dbus_support
|
||||||
import dbus.glib
|
if dbus_support.supported:
|
||||||
|
import dbus
|
||||||
|
import dbus.glib
|
||||||
|
|
||||||
class MusicTrackInfo(object):
|
class MusicTrackInfo(object):
|
||||||
__slots__ = ['title', 'album', 'artist', 'duration', 'track_number']
|
__slots__ = ['title', 'album', 'artist', 'duration', 'track_number']
|
||||||
|
|
|
@ -39,7 +39,10 @@ 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
|
||||||
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)
|
#(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()
|
||||||
|
|
Loading…
Reference in New Issue