Skip to content
GitLab
Menu
Projects
Groups
Snippets
Help
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in / Register
Toggle navigation
Menu
Open sidebar
gajim
gajim
Commits
15f73dad
Commit
15f73dad
authored
Mar 30, 2021
by
Daniel Brötzmann
Browse files
Accounts: Add account switch description
parent
b8690214
Changes
1
Hide whitespace changes
Inline
Side-by-side
gajim/gtk/accounts.py
View file @
15f73dad
...
...
@@ -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
:
...
...
Daniel Brötzmann
@wurstsalat
mentioned in issue
#10497 (closed)
·
Mar 30, 2021
mentioned in issue
#10497 (closed)
mentioned in issue #10497
Toggle commit list
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
.
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment