Commit a4f46f62 authored by Philipp Hörist's avatar Philipp Hörist

Dialogs: Use connect_after() for key-press-event

This allows other widgets to handle the ESCAPE Key first and only
if not other widget handled the key press exits the dialog
parent 3befd602
Pipeline #6253 passed with stages
in 3 minutes and 52 seconds
......@@ -68,7 +68,7 @@ class AccountsWindow(Gtk.ApplicationWindow):
self._menu.connect('menu-activated', self._on_menu_activated)
self.connect('destroy', self._on_destroy)
self.connect('key-press-event', self._on_key_press)
self.connect_after('key-press-event', self._on_key_press)
self.show_all()
......
......@@ -41,7 +41,7 @@ class AddNewContactWindow(Gtk.ApplicationWindow, EventHelper):
self.set_resizable(False)
self.set_title(_('Add Contact'))
self.connect('key-press-event', self._on_key_press)
self.connect_after('key-press-event', self._on_key_press)
self.account = account
self.adding_jid = False
......
......@@ -103,7 +103,7 @@ class AdvancedConfig(Gtk.ApplicationWindow):
treeview.set_model(self.modelfilter)
self.connect('key-press-event', self._on_key_press)
self.connect_after('key-press-event', self._on_key_press)
self._ui.connect_signals(self)
self.show_all()
......@@ -111,9 +111,6 @@ class AdvancedConfig(Gtk.ApplicationWindow):
if event.keyval != Gdk.KEY_Escape:
return
if self.renderer_text.get_property('editing'):
return
if self._ui.search_entry.get_text():
self._ui.search_entry.set_text('')
return
......
......@@ -37,7 +37,7 @@ class BlockingList(Gtk.ApplicationWindow):
self.set_show_menubar(False)
self.set_title(_('Blocking List for %s') % account)
self.connect('key-press-event', self._on_key_press)
self.connect_after('key-press-event', self._on_key_press)
self.account = account
self._con = app.connections[account]
......
......@@ -64,7 +64,7 @@ class Bookmarks(Gtk.ApplicationWindow):
self._ui.bookmarks_view.set_search_equal_func(self._search_func)
self._ui.connect_signals(self)
self.connect('key-press-event', self._on_key_press)
self.connect_after('key-press-event', self._on_key_press)
self.show_all()
......
......@@ -41,7 +41,7 @@ class MamPreferences(Gtk.ApplicationWindow, EventHelper):
self.set_show_menubar(False)
self.set_title(_('Archiving Preferences for %s') % account)
self.connect('key-press-event', self._on_key_press)
self.connect_after('key-press-event', self._on_key_press)
self.account = account
self._con = app.connections[account]
......
......@@ -38,7 +38,7 @@ class ManageProxies(Gtk.ApplicationWindow):
self._init_list()
self._block_signal = False
self.connect('key-press-event', self._on_key_press)
self.connect_after('key-press-event', self._on_key_press)
self.connect('destroy', self._on_destroy)
self._ui.connect_signals(self)
self.show_all()
......
......@@ -61,7 +61,7 @@ class SettingsDialog(Gtk.ApplicationWindow):
self.add(self.listbox)
self.show_all()
self.connect('key-press-event', self.on_key_press)
self.connect_after('key-press-event', self.on_key_press)
def on_key_press(self, _widget, event):
if event.keyval == Gdk.KEY_Escape:
......
......@@ -200,10 +200,16 @@ class Themes(Gtk.ApplicationWindow):
self._ui.connect_signals(self)
self.connect('destroy', self._on_destroy)
self.connect_after('key-press-event', self._on_key_press)
self.show_all()
self._fill_choose_listbox()
def _on_key_press(self, widget, event):
if event.keyval == Gdk.KEY_Escape:
self.destroy()
def _get_themes(self):
for theme in app.css_config.themes:
self._ui.theme_store.append([theme])
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment