remove use_pep option, always PEP it to send played song. fixes #3053
This commit is contained in:
parent
1b90552446
commit
cdb31a2b55
|
@ -151,8 +151,7 @@ class Config:
|
||||||
'before_nickname': [ opt_str, '', _('Characters that are printed before the nickname in conversations') ],
|
'before_nickname': [ opt_str, '', _('Characters that are printed before the nickname in conversations') ],
|
||||||
'after_nickname': [ opt_str, ':', _('Characters that are printed after the nickname in conversations') ],
|
'after_nickname': [ opt_str, ':', _('Characters that are printed after the nickname in conversations') ],
|
||||||
'send_os_info': [ opt_bool, True ],
|
'send_os_info': [ opt_bool, True ],
|
||||||
'set_status_msg_from_current_music_track': [ opt_bool, False ],
|
'set_status_msg_from_lastfm': [ opt_bool, False, _('If checked, Gajim can regularly poll a Last.fm account and sends recently played songs through PEP.') ],
|
||||||
'set_status_msg_from_lastfm': [ opt_bool, False, _('If checked, Gajim can regularly poll a Last.fm account and adjust the status message to reflect recently played songs. set_status_msg_from_current_music_track option must be False.') ],
|
|
||||||
'lastfm_username': [ opt_str, '', _('The username used to identify the Last.fm account.')],
|
'lastfm_username': [ opt_str, '', _('The username used to identify the Last.fm account.')],
|
||||||
'notify_on_new_gmail_email': [ opt_bool, True ],
|
'notify_on_new_gmail_email': [ opt_bool, True ],
|
||||||
'notify_on_new_gmail_email_extra': [ opt_bool, False ],
|
'notify_on_new_gmail_email_extra': [ opt_bool, False ],
|
||||||
|
@ -257,7 +256,6 @@ class Config:
|
||||||
'subscribe_activity': [opt_bool, True],
|
'subscribe_activity': [opt_bool, True],
|
||||||
'subscribe_tune': [opt_bool, True],
|
'subscribe_tune': [opt_bool, True],
|
||||||
'attach_notifications_to_systray': [opt_bool, False, _('If True, notification windows from notification-daemon will be attached to systray icon.')],
|
'attach_notifications_to_systray': [opt_bool, False, _('If True, notification windows from notification-daemon will be attached to systray icon.')],
|
||||||
'use_pep': [opt_bool, False, 'temporary variable to enable pep support'],
|
|
||||||
}
|
}
|
||||||
|
|
||||||
__options_per_key = {
|
__options_per_key = {
|
||||||
|
|
|
@ -759,7 +759,7 @@ class ConnectionDisco:
|
||||||
q.addChild('feature', attrs = {'var': common.xmpp.NS_MUC})
|
q.addChild('feature', attrs = {'var': common.xmpp.NS_MUC})
|
||||||
q.addChild('feature', attrs = {'var': common.xmpp.NS_COMMANDS})
|
q.addChild('feature', attrs = {'var': common.xmpp.NS_COMMANDS})
|
||||||
q.addChild('feature', attrs = {'var': common.xmpp.NS_DISCO_INFO})
|
q.addChild('feature', attrs = {'var': common.xmpp.NS_DISCO_INFO})
|
||||||
if gajim.config.get('use_pep'):
|
if self.pep_supported:
|
||||||
q.addChild('feature', attrs = {'var': common.xmpp.NS_ACTIVITY})
|
q.addChild('feature', attrs = {'var': common.xmpp.NS_ACTIVITY})
|
||||||
q.addChild('feature', attrs = {'var': common.xmpp.NS_ACTIVITY + '+notify'})
|
q.addChild('feature', attrs = {'var': common.xmpp.NS_ACTIVITY + '+notify'})
|
||||||
q.addChild('feature', attrs = {'var': common.xmpp.NS_TUNE})
|
q.addChild('feature', attrs = {'var': common.xmpp.NS_TUNE})
|
||||||
|
|
|
@ -272,9 +272,6 @@ class PreferencesWindow:
|
||||||
st = gajim.config.get('subscribe_tune')
|
st = gajim.config.get('subscribe_tune')
|
||||||
self.xml.get_widget('subscribe_tune_checkbutton').set_active(st)
|
self.xml.get_widget('subscribe_tune_checkbutton').set_active(st)
|
||||||
|
|
||||||
if not gajim.config.get('use_pep'):
|
|
||||||
self.xml.get_widget('frame_pep').set_sensitive(False)
|
|
||||||
|
|
||||||
### Notifications tab ###
|
### Notifications tab ###
|
||||||
# On new event
|
# On new event
|
||||||
on_event_combobox = self.xml.get_widget('on_event_combobox')
|
on_event_combobox = self.xml.get_widget('on_event_combobox')
|
||||||
|
|
|
@ -3021,7 +3021,7 @@ class RosterWindow:
|
||||||
item.connect('activate', self.change_status, account, 'offline')
|
item.connect('activate', self.change_status, account, 'offline')
|
||||||
|
|
||||||
pep_menuitem = xml.get_widget('pep_menuitem')
|
pep_menuitem = xml.get_widget('pep_menuitem')
|
||||||
if gajim.connections[account].pep_supported and gajim.config.get('use_pep'):
|
if gajim.connections[account].pep_supported:
|
||||||
pep_submenu = gtk.Menu()
|
pep_submenu = gtk.Menu()
|
||||||
pep_menuitem.set_submenu(pep_submenu)
|
pep_menuitem.set_submenu(pep_submenu)
|
||||||
if gajim.config.get('publish_mood'):
|
if gajim.config.get('publish_mood'):
|
||||||
|
@ -3038,8 +3038,7 @@ class RosterWindow:
|
||||||
item.connect('activate', self.on_pep_services_menuitem_activate,
|
item.connect('activate', self.on_pep_services_menuitem_activate,
|
||||||
account)
|
account)
|
||||||
else:
|
else:
|
||||||
pep_menuitem.set_no_show_all(True)
|
pep_menuitem.set_sensitive(False)
|
||||||
pep_menuitem.hide()
|
|
||||||
|
|
||||||
if not gajim.connections[account].gmail_url:
|
if not gajim.connections[account].gmail_url:
|
||||||
open_gmail_inbox_menuitem.set_no_show_all(True)
|
open_gmail_inbox_menuitem.set_no_show_all(True)
|
||||||
|
@ -3759,7 +3758,6 @@ class RosterWindow:
|
||||||
|
|
||||||
def _music_track_changed(self, unused_listener, music_track_info,
|
def _music_track_changed(self, unused_listener, music_track_info,
|
||||||
account=''):
|
account=''):
|
||||||
if gajim.config.get('use_pep'):
|
|
||||||
from common import pep
|
from common import pep
|
||||||
if account == '':
|
if account == '':
|
||||||
accounts = gajim.connections.keys()
|
accounts = gajim.connections.keys()
|
||||||
|
@ -3769,8 +3767,7 @@ class RosterWindow:
|
||||||
source = ''
|
source = ''
|
||||||
track = ''
|
track = ''
|
||||||
length = ''
|
length = ''
|
||||||
elif hasattr(music_track_info, 'paused') and \
|
elif hasattr(music_track_info, 'paused') and music_track_info.paused == 0:
|
||||||
music_track_info.paused == 0:
|
|
||||||
artist = ''
|
artist = ''
|
||||||
title = ''
|
title = ''
|
||||||
source = ''
|
source = ''
|
||||||
|
@ -3784,44 +3781,11 @@ class RosterWindow:
|
||||||
for account in accounts:
|
for account in accounts:
|
||||||
if not gajim.account_is_connected(account):
|
if not gajim.account_is_connected(account):
|
||||||
continue
|
continue
|
||||||
if not gajim.config.get('use_pep') and not gajim.config.get_per(
|
|
||||||
'accounts', account, 'sync_with_global_status'):
|
|
||||||
continue
|
|
||||||
if not gajim.connections[account].pep_supported:
|
if not gajim.connections[account].pep_supported:
|
||||||
continue
|
continue
|
||||||
pep.user_send_tune(account, artist, title, source)
|
pep.user_send_tune(account, artist, title, source)
|
||||||
else:
|
elif gajim.connections[account].pep_supported:
|
||||||
pep.user_send_tune(account, artist, title, source)
|
pep.user_send_tune(account, artist, title, source)
|
||||||
return
|
|
||||||
# No PEP
|
|
||||||
accounts = gajim.connections.keys()
|
|
||||||
if music_track_info is None:
|
|
||||||
status_message = ''
|
|
||||||
else:
|
|
||||||
if hasattr(music_track_info, 'paused') and \
|
|
||||||
music_track_info.paused == 0:
|
|
||||||
status_message = ''
|
|
||||||
else:
|
|
||||||
status_message = '♪ ' + _('"%(title)s" by %(artist)s') % \
|
|
||||||
{'title': music_track_info.title,
|
|
||||||
'artist': music_track_info.artist } + ' ♪'
|
|
||||||
for account in accounts:
|
|
||||||
if not gajim.config.get_per('accounts', account,
|
|
||||||
'sync_with_global_status'):
|
|
||||||
continue
|
|
||||||
if gajim.connections[account].connected < gajim.SHOW_LIST.index(
|
|
||||||
'online') or gajim.connections[account].connected > gajim.SHOW_LIST.\
|
|
||||||
index('invisible'):
|
|
||||||
continue
|
|
||||||
current_show = gajim.SHOW_LIST[gajim.connections[account].connected]
|
|
||||||
# Keep the last status message, replacing only the current song part
|
|
||||||
current_status_message = gajim.connections[account].status
|
|
||||||
song_offset = current_status_message.find('♪')
|
|
||||||
if song_offset >= 0:
|
|
||||||
current_status_message = current_status_message[0:song_offset]
|
|
||||||
current_status_message = current_status_message.strip() + '\n' + \
|
|
||||||
status_message
|
|
||||||
self.send_status(account, current_show, current_status_message.strip())
|
|
||||||
|
|
||||||
def update_status_combobox(self):
|
def update_status_combobox(self):
|
||||||
# table to change index in connection.connected to index in combobox
|
# table to change index in connection.connected to index in combobox
|
||||||
|
@ -5588,21 +5552,14 @@ class RosterWindow:
|
||||||
self.tooltip = tooltips.RosterTooltip()
|
self.tooltip = tooltips.RosterTooltip()
|
||||||
self.draw_roster()
|
self.draw_roster()
|
||||||
|
|
||||||
if gajim.config.get('use_pep'):
|
publish_tune = gajim.config.get('publish_tune')
|
||||||
self.enable_syncing_status_msg_from_current_music_track(
|
if publish_tune:
|
||||||
gajim.config.get('publish_tune'))
|
if gajim.config.get('set_status_msg_from_lastfm'):
|
||||||
|
self.enable_syncing_status_msg_from_lastfm(True)
|
||||||
else:
|
else:
|
||||||
## Music Track notifications
|
self.enable_syncing_status_msg_from_current_music_track(True)
|
||||||
## FIXME: we use a timeout because changing status of
|
|
||||||
## accounts has no effect until they are connected.
|
|
||||||
st = gajim.config.get('set_status_msg_from_current_music_track')
|
|
||||||
if st:
|
|
||||||
gobject.timeout_add_seconds(1,
|
|
||||||
self.enable_syncing_status_msg_from_current_music_track, st)
|
|
||||||
else:
|
else:
|
||||||
gobject.timeout_add_seconds(1,
|
self.enable_syncing_status_msg_from_current_music_track(False)
|
||||||
self.enable_syncing_status_msg_from_lastfm,
|
|
||||||
gajim.config.get('set_status_msg_from_lastfm'))
|
|
||||||
|
|
||||||
if gajim.config.get('show_roster_on_startup'):
|
if gajim.config.get('show_roster_on_startup'):
|
||||||
self.window.show_all()
|
self.window.show_all()
|
||||||
|
|
Loading…
Reference in New Issue