Daniel Brötzmann pushed to branch master at gajim / gajim
Commits:
523820b4 by André Apitzsch at 2022-02-24T15:17:41+00:00
Update tune info with media playback switch
- - - - -
2 changed files:
- gajim/common/modules/user_tune.py
- gajim/gtk/accounts.py
Changes:
=====================================
gajim/common/modules/user_tune.py
=====================================
@@ -70,11 +70,12 @@ def _tune_received(self, _con, _stanza, properties):
contact.notify('tune-update', data)
@store_publish
- def set_tune(self, tune):
+ def set_tune(self, tune, force=False):
if not self._con.get_module('PEP').supported:
return
- if not app.settings.get_account_setting(self._account, 'publish_tune'):
+ if not force and not app.settings.get_account_setting(
+ self._account, 'publish_tune'):
return
if tune == self._current_tune:
@@ -87,16 +88,9 @@ def set_tune(self, tune):
def set_enabled(self, enable):
if enable:
- app.settings.set_account_setting(self._account,
- 'publish_tune',
- True)
self._publish_current_tune()
-
else:
- self.set_tune(None)
- app.settings.set_account_setting(self._account,
- 'publish_tune',
- False)
+ self.set_tune(None, force=True)
def _publish_current_tune(self):
self.set_tune(MusicTrackListener.get().current_tune)
=====================================
gajim/gtk/accounts.py
=====================================
@@ -737,6 +737,7 @@ def __init__(self, account: str) -> None:
Setting(SettingKind.SWITCH, _('Media Playback'),
SettingType.ACCOUNT_CONFIG, 'publish_tune',
+ callback=self._publish_tune,
desc=_('Disclose information about media that is '
'currently being played on your system.')),
@@ -812,6 +813,9 @@ def _reset_gc_send_chatstate(button: Gtk.Button) -> None:
button.set_sensitive(False)
app.settings.set_group_chat_settings('send_chatstate', None)
+ def _publish_tune(self, state: bool, _data: Any) -> None:
+
app.connections[self._account].get_module('UserTune').set_enabled(state)
+
def _send_read_marker(self, state: bool, _data: Any) -> None:
app.settings.set_account_setting(
self._account, 'send_marker_default', state)
View it on GitLab:
https://dev.gajim.org/gajim/gajim/-/commit/523820b48e25195588a07df7218838f181b0abef
--
View it on GitLab:
https://dev.gajim.org/gajim/gajim/-/commit/523820b48e25195588a07df7218838f181b0abef
You're receiving this email because of your account on dev.gajim.org.
_______________________________________________
Commits mailing list
[email protected]
https://lists.gajim.org/cgi-bin/listinfo/commits