Close Privacy Lists Window with ESC

This commit is contained in:
Philipp Hörist 2017-02-06 23:19:07 +01:00
parent ad936b8df8
commit fa54237164
3 changed files with 13 additions and 3 deletions

View File

@ -1,5 +1,5 @@
<?xml version="1.0" encoding="UTF-8"?>
<!-- Generated with glade 3.18.3 -->
<!-- Generated with glade 3.20.0 -->
<interface>
<requires lib="gtk+" version="3.12"/>
<object class="GtkAdjustment" id="adjustment1">
@ -47,6 +47,7 @@
<property name="title" translatable="yes">Privacy List</property>
<property name="type_hint">dialog</property>
<signal name="destroy" handler="on_privacy_list_edit_window_destroy" swapped="no"/>
<signal name="key-press-event" handler="on_key_press_event" swapped="no"/>
<child>
<object class="GtkBox" id="main_vbox">
<property name="visible">True</property>

View File

@ -1,5 +1,5 @@
<?xml version="1.0" encoding="UTF-8"?>
<!-- Generated with glade 3.18.3 -->
<!-- Generated with glade 3.20.0 -->
<interface>
<requires lib="gtk+" version="3.12"/>
<object class="GtkListStore" id="liststore1">
@ -15,6 +15,7 @@
<property name="title" translatable="yes">window1</property>
<property name="type_hint">dialog</property>
<signal name="destroy" handler="on_privacy_lists_first_window_destroy" swapped="no"/>
<signal name="key-press-event" handler="on_key_press_event" swapped="no"/>
<child>
<object class="GtkBox" id="vbox1">
<property name="visible">True</property>
@ -30,8 +31,8 @@
<object class="GtkLabel" id="label1">
<property name="visible">True</property>
<property name="can_focus">False</property>
<property name="xalign">0</property>
<property name="label" translatable="yes">Privacy Lists:</property>
<property name="xalign">0</property>
</object>
<packing>
<property name="expand">False</property>

View File

@ -4370,6 +4370,10 @@ class PrivacyListWindow:
self.xml.connect_signals(self)
def on_key_press_event(self, widget, event):
if event.keyval == Gdk.KEY_Escape:
self.window.destroy()
def on_privacy_list_edit_window_destroy(self, widget):
key_name = 'privacy_list_%s' % self.privacy_list_name
if key_name in gajim.interface.instances[self.account]:
@ -4684,6 +4688,10 @@ class PrivacyListsWindow:
self.xml.connect_signals(self)
def on_key_press_event(self, widget, event):
if event.keyval == Gdk.KEY_Escape:
self.window.destroy()
def on_privacy_lists_first_window_destroy(self, widget):
if 'privacy_lists' in gajim.interface.instances[self.account]:
del gajim.interface.instances[self.account]['privacy_lists']