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
Snippets
Build
Pipelines
Jobs
Pipeline schedules
Artifacts
Deploy
Releases
Model registry
Operate
Environments
Monitor
Incidents
Analyze
Value stream analytics
Contributor analytics
CI/CD analytics
Repository 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
eta
gajim
Commits
30442be2
Commit
30442be2
authored
6 years ago
by
Philipp Hörist
Committed by
Philipp Hörist
6 years ago
Browse files
Options
Downloads
Patches
Plain Diff
ConvTextview: Rework display of encryption
parent
fa45935c
No related branches found
Branches containing commit
No related tags found
Tags containing commit
No related merge requests found
Changes
3
Hide whitespace changes
Inline
Side-by-side
Showing
3 changed files
gajim/chat_control_base.py
+3
-1
3 additions, 1 deletion
gajim/chat_control_base.py
gajim/conversation_textview.py
+54
-4
54 additions, 4 deletions
gajim/conversation_textview.py
gajim/gtk/history.py
+4
-0
4 additions, 0 deletions
gajim/gtk/history.py
with
61 additions
and
5 deletions
gajim/chat_control_base.py
+
3
−
1
View file @
30442be2
...
...
@@ -338,6 +338,7 @@ class ChatControlBase(MessageControl, ChatCommandProcessor, CommandTools):
self
.
_schedule_activity_timers
()
self
.
encryption
=
self
.
get_encryption_state
()
self
.
conv_textview
.
encryption_enabled
=
self
.
encryption
is
not
None
# PluginSystem: adding GUI extension point for ChatControlBase
# instance object (also subclasses, eg. ChatControl or GroupchatControl)
...
...
@@ -429,8 +430,9 @@ class ChatControlBase(MessageControl, ChatCommandProcessor, CommandTools):
def
set_encryption_state
(
self
,
encryption
):
config_key
=
'
%s-%s
'
%
(
self
.
account
,
self
.
contact
.
jid
)
self
.
encryption
=
encryption
self
.
conv_textview
.
encryption_enabled
=
encryption
is
not
None
app
.
config
.
set_per
(
'
encryption
'
,
config_key
,
'
encryption
'
,
self
.
encryption
or
''
)
'
encryption
'
,
self
.
encryption
or
''
)
def
get_encryption_state
(
self
):
config_key
=
'
%s-%s
'
%
(
self
.
account
,
self
.
contact
.
jid
)
...
...
This diff is collapsed.
Click to expand it.
gajim/conversation_textview.py
+
54
−
4
View file @
30442be2
...
...
@@ -186,6 +186,7 @@ class ConversationTextview(GObject.GObject):
self
.
tv
.
set_wrap_mode
(
Gtk
.
WrapMode
.
WORD_CHAR
)
self
.
tv
.
set_left_margin
(
2
)
self
.
tv
.
set_right_margin
(
2
)
self
.
_buffer
=
self
.
tv
.
get_buffer
()
self
.
handlers
=
{}
self
.
image_cache
=
{}
self
.
xep0184_marks
=
{}
...
...
@@ -204,6 +205,7 @@ class ConversationTextview(GObject.GObject):
self
.
account
=
account
self
.
cursor_changed
=
False
self
.
last_time_printout
=
0
self
.
encryption_enabled
=
False
style
=
self
.
tv
.
get_style_context
()
style
.
add_class
(
'
gajim-conversation-font
'
)
...
...
@@ -261,6 +263,9 @@ class ConversationTextview(GObject.GObject):
self
.
tagMarked
.
set_property
(
'
foreground
'
,
color
)
self
.
tagMarked
.
set_property
(
'
weight
'
,
Pango
.
Weight
.
BOLD
)
textview_icon
=
buffer_
.
create_tag
(
'
textview-icon
'
)
textview_icon
.
set_property
(
'
rise
'
,
Pango
.
units_from_double
(
-
4.45
))
tag
=
buffer_
.
create_tag
(
'
time_sometimes
'
)
tag
.
set_property
(
'
foreground
'
,
'
darkgrey
'
)
#Pango.SCALE_SMALL
...
...
@@ -1147,14 +1152,13 @@ class ConversationTextview(GObject.GObject):
if
kind
==
'
status
'
:
direction_mark
=
i18n
.
direction_mark
# print the encryption icon
self
.
print_encryption_status
(
iter_
,
additional_data
)
# print the time stamp
self
.
print_time
(
text
,
kind
,
tim
,
simple
,
direction_mark
,
other_tags_for_time
,
iter_
)
icon
=
load_icon
(
'
channel-secure-croped-symbolic
'
,
self
.
tv
,
pixbuf
=
True
)
if
encrypted
:
buffer_
.
insert_pixbuf
(
iter_
,
icon
)
# If there's a displaymarking, print it here.
if
displaymarking
:
self
.
print_displaymarking
(
displaymarking
,
iter_
=
iter_
)
...
...
@@ -1275,6 +1279,52 @@ class ConversationTextview(GObject.GObject):
if
text
.
startswith
(
'
/me
'
)
or
text
.
startswith
(
'
/me
\n
'
):
return
kind
def
print_encryption_status
(
self
,
iter_
,
additional_data
):
details
=
self
.
_get_encryption_details
(
additional_data
)
if
details
is
None
:
# Message was not encrypted
if
not
self
.
encryption_enabled
:
return
icon
=
'
security-low-symbolic
'
color
=
'
error-color
'
tooltip
=
_
(
'
Not encrypted
'
)
else
:
icon
=
'
security-high-symbolic
'
color
=
'
success-color
'
name
,
fingerprint
=
details
if
fingerprint
is
None
:
tooltip
=
name
else
:
tooltip
=
'
%s %s
'
%
(
name
,
fingerprint
)
temp_mark
=
self
.
_buffer
.
create_mark
(
None
,
iter_
,
True
)
self
.
_buffer
.
insert
(
iter_
,
'
'
)
anchor
=
self
.
_buffer
.
create_child_anchor
(
iter_
)
anchor
.
plaintext
=
''
self
.
_buffer
.
insert
(
iter_
,
'
'
)
# Apply mark to vertically center the icon
start
=
self
.
_buffer
.
get_iter_at_mark
(
temp_mark
)
self
.
_buffer
.
apply_tag_by_name
(
'
textview-icon
'
,
start
,
iter_
)
image
=
Gtk
.
Image
.
new_from_icon_name
(
icon
,
Gtk
.
IconSize
.
MENU
)
image
.
show
()
image
.
set_tooltip_text
(
tooltip
)
image
.
get_style_context
().
add_class
(
color
)
self
.
tv
.
add_child_at_anchor
(
image
,
anchor
)
@staticmethod
def
_get_encryption_details
(
additional_data
):
encrypted
=
additional_data
.
get
(
'
encrypted
'
)
if
encrypted
is
None
:
return
name
=
encrypted
.
get
(
'
name
'
)
if
name
is
None
:
return
fingerprint
=
encrypted
.
get
(
'
fingerprint
'
)
return
name
,
fingerprint
def
print_time
(
self
,
text
,
kind
,
tim
,
simple
,
direction_mark
,
other_tags_for_time
,
iter_
):
local_tim
=
time
.
localtime
(
tim
)
buffer_
=
self
.
tv
.
get_buffer
()
...
...
This diff is collapsed.
Click to expand it.
gajim/gtk/history.py
+
4
−
0
View file @
30442be2
...
...
@@ -534,6 +534,10 @@ class HistoryWindow:
buf
.
insert_with_tags_by_name
(
end_iter
,
tim
+
'
\n
'
,
'
time_sometimes
'
)
# print the encryption icon
self
.
history_textview
.
print_encryption_status
(
end_iter
,
additional_data
)
tag_name
=
''
tag_msg
=
''
...
...
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