Skip to content
GitLab
Projects
Groups
Snippets
Help
Loading...
Help
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in / Register
Toggle navigation
G
gajim-plugins
Project overview
Project overview
Details
Activity
Releases
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Issues
0
Issues
0
List
Boards
Labels
Service Desk
Milestones
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Operations
Operations
Incidents
Environments
Analytics
Analytics
CI / CD
Repository
Value Stream
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
Yuki
gajim-plugins
Commits
10bbeda0
Commit
10bbeda0
authored
Mar 26, 2019
by
Philipp Hörist
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
[omemo] Use Gajims confirmation dialog
parent
9d810ef5
Changes
2
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
9 additions
and
79 deletions
+9
-79
omemo/gtk/key.py
omemo/gtk/key.py
+9
-10
omemo/gtk/util.py
omemo/gtk/util.py
+0
-69
No files found.
omemo/gtk/key.py
View file @
10bbeda0
...
...
@@ -26,11 +26,12 @@ from gi.repository import Gtk
from
gi.repository
import
GdkPixbuf
from
gajim.common
import
app
from
gajim.common.const
import
ButtonAction
from
gajim.plugins.plugins_i18n
import
_
from
gajim.plugins.helpers
import
get_builder
from
gajim.gtk.dialogs
import
NewConfirmationDialog
from
gajim.gtk.dialogs
import
DialogButton
from
omemo.gtk.util
import
DialogButton
,
ButtonAction
from
omemo.gtk.util
import
NewConfirmationDialog
from
omemo.backend.util
import
Trust
from
omemo.backend.util
import
IdentityKeyExtended
from
omemo.backend.util
import
get_fingerprint
...
...
@@ -278,17 +279,15 @@ class KeyRow(Gtk.ListBoxRow):
self
.
get_parent
().
remove
(
self
)
self
.
destroy
()
buttons
=
{
Gtk
.
ResponseType
.
CANCEL
:
DialogButton
(
_
(
'Cancel'
)),
Gtk
.
ResponseType
.
OK
:
DialogButton
(
_
(
'Delete'
),
_remove
,
ButtonAction
.
DESTRUCTIVE
),
}
NewConfirmationDialog
(
_
(
'Delete'
),
_
(
'Delete Fingerprint'
),
_
(
'Doing so will permanently delete this Fingerprint'
),
buttons
,
[
DialogButton
.
make
(
'Cancel'
),
DialogButton
.
make
(
'OK'
,
text
=
_
(
'Delete'
),
callback
=
_remove
,
action
=
ButtonAction
.
DESTRUCTIVE
)],
transient_for
=
self
.
get_toplevel
())
def
set_trust
(
self
):
...
...
omemo/gtk/util.py
deleted
100644 → 0
View file @
9d810ef5
# Copyright (C) 2019 Philipp Hörist <philipp AT hoerist.com>
#
# This file is part of OMEMO Gajim Plugin.
#
# OMEMO Gajim Plugin is free software; you can redistribute it and/or modify
# it under the terms of the GNU General Public License as published
# by the Free Software Foundation; version 3 only.
#
# OMEMO Gajim Plugin is distributed in the hope that it will be useful,
# but WITHOUT ANY WARRANTY; without even the implied warranty of
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
# GNU General Public License for more details.
#
# You should have received a copy of the GNU General Public License
# along with OMEMO Gajim Plugin. If not, see <http://www.gnu.org/licenses/>.
from
collections
import
namedtuple
from
enum
import
IntEnum
from
enum
import
Enum
from
gi.repository
import
Gtk
DialogButton
=
namedtuple
(
'DialogButton'
,
'text callback action'
)
DialogButton
.
__new__
.
__defaults__
=
(
None
,
None
)
# type: ignore
class
ButtonAction
(
Enum
):
DESTRUCTIVE
=
'destructive-action'
SUGGESTED
=
'suggested-action'
class
NewConfirmationDialog
(
Gtk
.
MessageDialog
):
def
__init__
(
self
,
text
,
sec_text
,
buttons
,
transient_for
=
None
):
Gtk
.
MessageDialog
.
__init__
(
self
,
transient_for
=
transient_for
,
message_type
=
Gtk
.
MessageType
.
QUESTION
,
text
=
text
)
self
.
_buttons
=
buttons
for
response
,
button
in
buttons
.
items
():
self
.
add_button
(
button
.
text
,
response
)
if
button
.
action
is
not
None
:
widget
=
self
.
get_widget_for_response
(
response
)
widget
.
get_style_context
().
add_class
(
button
.
action
.
value
)
self
.
format_secondary_markup
(
sec_text
)
self
.
connect
(
'response'
,
self
.
_on_response
)
self
.
run
()
def
_on_response
(
self
,
dialog
,
response
):
if
response
==
Gtk
.
ResponseType
.
DELETE_EVENT
:
# Look if DELETE_EVENT is mapped to another response
response
=
self
.
_buttons
.
get
(
response
,
None
)
if
response
is
None
:
# If DELETE_EVENT was not mapped we assume CANCEL
response
=
Gtk
.
ResponseType
.
CANCEL
button
=
self
.
_buttons
.
get
(
response
,
None
)
if
button
is
None
:
self
.
destroy
()
return
if
button
.
callback
is
not
None
:
button
.
callback
()
self
.
destroy
()
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