Skip to content
GitLab
Explore
Sign in
Register
Primary navigation
Search or go to…
Project
gajim
Manage
Activity
Members
Labels
Plan
Issues
Issue boards
Milestones
Wiki
Code
Merge requests
Repository
Branches
Commits
Tags
Repository graph
Compare revisions
Deploy
Releases
Package Registry
Model registry
Operate
Terraform modules
Monitor
Incidents
Analyze
Contributor analytics
Model experiments
Help
Help
Support
GitLab documentation
Compare GitLab plans
Community forum
Contribute to GitLab
Provide feedback
Keyboard shortcuts
?
Snippets
Groups
Projects
Show more breadcrumbs
mesonium
gajim
Commits
962e10f5
Commit
962e10f5
authored
5 years ago
by
Daniel Brötzmann
Browse files
Options
Downloads
Patches
Plain Diff
Migration: Add color for each account
parent
1ebe0d0d
No related branches found
No related tags found
No related merge requests found
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
gajim/common/optparser.py
+20
-1
20 additions, 1 deletion
gajim/common/optparser.py
with
20 additions
and
1 deletion
gajim/common/optparser.py
+
20
−
1
View file @
962e10f5
...
...
@@ -29,10 +29,12 @@
import
logging
from
pathlib
import
Path
from
gi.repository
import
Gdk
from
nbxmpp.util
import
text_to_color
from
gajim.common
import
app
from
gajim.common.i18n
import
_
log
=
logging
.
getLogger
(
'
gajim.c.optparser
'
)
...
...
@@ -149,6 +151,8 @@ def update_config(self, old_version, new_version):
self
.
update_config_to_1193
()
if
old
<
[
1
,
1
,
94
]
and
new
>=
[
1
,
1
,
94
]:
self
.
update_config_to_1194
()
if
old
<
[
1
,
1
,
95
]
and
new
>=
[
1
,
1
,
95
]:
self
.
update_config_to_1195
()
app
.
config
.
set
(
'
version
'
,
new_version
)
...
...
@@ -230,3 +234,18 @@ def update_config_to_1194(self):
app
.
config
.
del_per
(
'
accounts
'
,
account
,
'
proxy
'
)
app
.
config
.
set
(
'
version
'
,
'
1.1.94
'
)
def
update_config_to_1195
(
self
):
# Add account color for every account
for
account
in
self
.
old_values
[
'
accounts
'
].
keys
():
username
=
self
.
old_values
[
'
accounts
'
][
account
][
'
name
'
]
domain
=
self
.
old_values
[
'
accounts
'
][
account
][
'
hostname
'
]
if
not
(
username
is
None
or
domain
is
None
):
account_string
=
'
%s@%s
'
%
(
username
,
domain
)
# We cannot get the preferred theme at this point
background
=
(
1
,
1
,
1
)
col_r
,
col_g
,
col_b
=
text_to_color
(
account_string
,
background
)
rgba
=
Gdk
.
RGBA
(
red
=
col_r
,
green
=
col_g
,
blue
=
col_b
)
color
=
rgba
.
to_string
()
app
.
config
.
set_per
(
'
accounts
'
,
account
,
'
account_color
'
,
color
)
app
.
config
.
set
(
'
version
'
,
'
1.1.95
'
)
This diff is collapsed.
Click to expand it.
Preview
0%
Loading
Try again
or
attach a new file
.
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Save comment
Cancel
Please
register
or
sign in
to comment