Skip to content
Snippets Groups Projects
Commit bbada2ec authored by Philipp Hörist's avatar Philipp Hörist
Browse files

Improve NewConfirmationDialog

- Add setting for modal/non-modal
- Add default transient
- Dont call run() it only returns after response
parent ca037665
No related branches found
No related tags found
No related merge requests found
......@@ -990,12 +990,16 @@ class ChangePasswordDialog(Gtk.Dialog):
class NewConfirmationDialog(Gtk.MessageDialog):
def __init__(self, title, text, sec_text, buttons, transient_for=None):
def __init__(self, title, text, sec_text, buttons,
modal=True, transient_for=None):
if transient_for is None:
transient_for = app.app.get_active_window()
Gtk.MessageDialog.__init__(self,
title=title,
text=text,
transient_for=transient_for,
message_type=Gtk.MessageType.QUESTION)
message_type=Gtk.MessageType.QUESTION,
modal=modal)
self._buttons = {}
......@@ -1012,8 +1016,6 @@ class NewConfirmationDialog(Gtk.MessageDialog):
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
......@@ -1031,6 +1033,9 @@ class NewConfirmationDialog(Gtk.MessageDialog):
button.callback(*button.args, **button.kwargs)
self.destroy()
def show(self):
self.show_all()
class ShortcutsWindow:
def __init__(self):
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment