Daniel Brötzmann pushed to branch master at gajim / gajim
Commits:
15f73dad by Daniel Brötzmann at 2021-03-30T09:05:46+02:00
Accounts: Add account switch description
- - - - -
1 changed file:
- gajim/gtk/accounts.py
Changes:
=====================================
gajim/gtk/accounts.py
=====================================
@@ -25,6 +25,7 @@
from gajim.common import app
from gajim.common import passwords
from gajim.common.i18n import _
+from gajim.common.i18n import Q_
from .dialogs import DialogButton
from .dialogs import ConfirmationDialog
@@ -482,11 +483,17 @@ def __init__(self, account):
Gtk.IconSize.MENU)
next_icon.get_style_context().add_class('insensitive-fg-color')
+ account_enabled = app.settings.get_account_setting(
+ self._account, 'active')
self._switch = Gtk.Switch()
- self._switch.set_active(
- app.settings.get_account_setting(self._account, 'active'))
+ self._switch.set_active(account_enabled)
self._switch.set_vexpand(False)
+ self._switch_state_label = Gtk.Label()
+ self._switch_state_label.set_xalign(1)
+ self._switch_state_label.set_valign(Gtk.Align.CENTER)
+ self._set_label(account_enabled)
+
if (self._account == app.ZEROCONF_ACC_NAME and
not app.is_installed('ZEROCONF')):
self._switch.set_active(False)
@@ -502,6 +509,8 @@ def __init__(self, account):
'state-set', self._on_enable_switch, self._account)
box.add(self._switch)
+ box.add(self._switch_state_label)
+ box.add(Gtk.Separator())
box.add(self._label)
box.add(next_icon)
self.add(box)
@@ -519,12 +528,18 @@ def update_account_label(self):
def enable_account(self, state):
self._switch.set_state(state)
+ self._set_label(state)
+
+ def _set_label(self, active):
+ text = Q_('?switch:On') if active else Q_('?switch:Off')
+ self._switch_state_label.set_text(text)
def _on_enable_switch(self, switch, state, account):
def _disable():
app.connections[account].change_status('offline', 'offline')
app.interface.disable_account(account)
switch.set_state(state)
+ self._set_label(state)
old_state = app.settings.get_account_setting(account, 'active')
if old_state == state:
View it on GitLab:
https://dev.gajim.org/gajim/gajim/-/commit/15f73dadff5740e1fd74a87ca184fdc8201985fa
--
View it on GitLab:
https://dev.gajim.org/gajim/gajim/-/commit/15f73dadff5740e1fd74a87ca184fdc8201985fa
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