Merge branch 'keypress' into 'master'

Close Windows with ESC Key

See merge request !53
This commit is contained in:
Philipp Hörist 2017-02-09 20:19:20 +01:00
commit d6ceca8344
13 changed files with 60 additions and 21 deletions

View File

@ -1,5 +1,5 @@
<?xml version="1.0" encoding="UTF-8"?> <?xml version="1.0" encoding="UTF-8"?>
<!-- Generated with glade 3.18.3 --> <!-- Generated with glade 3.20.0 -->
<interface> <interface>
<requires lib="gtk+" version="3.12"/> <requires lib="gtk+" version="3.12"/>
<object class="GtkImage" id="add_image"> <object class="GtkImage" id="add_image">
@ -43,6 +43,7 @@
<property name="window_position">center</property> <property name="window_position">center</property>
<property name="default_width">450</property> <property name="default_width">450</property>
<signal name="destroy" handler="on_archiving_preferences_window_destroy" swapped="no"/> <signal name="destroy" handler="on_archiving_preferences_window_destroy" swapped="no"/>
<signal name="key-press-event" handler="on_key_press_event" swapped="no"/>
<child> <child>
<object class="GtkGrid" id="pref_grid"> <object class="GtkGrid" id="pref_grid">
<property name="visible">True</property> <property name="visible">True</property>

View File

@ -1,5 +1,5 @@
<?xml version="1.0" encoding="UTF-8"?> <?xml version="1.0" encoding="UTF-8"?>
<!-- Generated with glade 3.18.3 --> <!-- Generated with glade 3.20.0 -->
<interface> <interface>
<requires lib="gtk+" version="3.12"/> <requires lib="gtk+" version="3.12"/>
<object class="GtkWindow" id="features_window"> <object class="GtkWindow" id="features_window">
@ -10,6 +10,7 @@
<property name="default_width">300</property> <property name="default_width">300</property>
<property name="default_height">530</property> <property name="default_height">530</property>
<property name="type_hint">dialog</property> <property name="type_hint">dialog</property>
<signal name="key-press-event" handler="on_key_press_event" swapped="no"/>
<child> <child>
<object class="GtkBox" id="vbox1"> <object class="GtkBox" id="vbox1">
<property name="visible">True</property> <property name="visible">True</property>
@ -22,9 +23,9 @@
<property name="visible">True</property> <property name="visible">True</property>
<property name="can_focus">False</property> <property name="can_focus">False</property>
<property name="events">GDK_POINTER_MOTION_MASK | GDK_POINTER_MOTION_HINT_MASK | GDK_BUTTON_PRESS_MASK | GDK_BUTTON_RELEASE_MASK</property> <property name="events">GDK_POINTER_MOTION_MASK | GDK_POINTER_MOTION_HINT_MASK | GDK_BUTTON_PRESS_MASK | GDK_BUTTON_RELEASE_MASK</property>
<property name="xalign">0</property>
<property name="label" translatable="yes">&lt;b&gt;List of possible features in Gajim:&lt;/b&gt;</property> <property name="label" translatable="yes">&lt;b&gt;List of possible features in Gajim:&lt;/b&gt;</property>
<property name="use_markup">True</property> <property name="use_markup">True</property>
<property name="xalign">0</property>
</object> </object>
<packing> <packing>
<property name="expand">False</property> <property name="expand">False</property>
@ -98,9 +99,9 @@
<property name="visible">True</property> <property name="visible">True</property>
<property name="can_focus">False</property> <property name="can_focus">False</property>
<property name="margin_left">12</property> <property name="margin_left">12</property>
<property name="xalign">0</property>
<property name="wrap">True</property> <property name="wrap">True</property>
<property name="selectable">True</property> <property name="selectable">True</property>
<property name="xalign">0</property>
</object> </object>
</child> </child>
<child type="label"> <child type="label">

View File

@ -1,5 +1,5 @@
<?xml version="1.0" encoding="UTF-8"?> <?xml version="1.0" encoding="UTF-8"?>
<!-- Generated with glade 3.18.3 --> <!-- Generated with glade 3.20.0 -->
<interface> <interface>
<requires lib="gtk+" version="3.12"/> <requires lib="gtk+" version="3.12"/>
<object class="GtkListStore" id="liststore1"> <object class="GtkListStore" id="liststore1">
@ -15,6 +15,7 @@
<property name="default_width">550</property> <property name="default_width">550</property>
<property name="default_height">300</property> <property name="default_height">300</property>
<property name="type_hint">dialog</property> <property name="type_hint">dialog</property>
<signal name="key-press-event" handler="on_key_press_event" swapped="no"/>
<child> <child>
<object class="GtkBox" id="vbox86"> <object class="GtkBox" id="vbox86">
<property name="visible">True</property> <property name="visible">True</property>
@ -116,9 +117,9 @@
<object class="GtkLabel" id="label325"> <object class="GtkLabel" id="label325">
<property name="visible">True</property> <property name="visible">True</property>
<property name="can_focus">False</property> <property name="can_focus">False</property>
<property name="xalign">0</property>
<property name="label" translatable="yes">_Title:</property> <property name="label" translatable="yes">_Title:</property>
<property name="use_underline">True</property> <property name="use_underline">True</property>
<property name="xalign">0</property>
</object> </object>
<packing> <packing>
<property name="left_attach">0</property> <property name="left_attach">0</property>
@ -129,9 +130,9 @@
<object class="GtkLabel" id="label315"> <object class="GtkLabel" id="label315">
<property name="visible">True</property> <property name="visible">True</property>
<property name="can_focus">False</property> <property name="can_focus">False</property>
<property name="xalign">0</property>
<property name="label" translatable="yes">_Nickname:</property> <property name="label" translatable="yes">_Nickname:</property>
<property name="use_underline">True</property> <property name="use_underline">True</property>
<property name="xalign">0</property>
</object> </object>
<packing> <packing>
<property name="left_attach">0</property> <property name="left_attach">0</property>
@ -142,9 +143,9 @@
<object class="GtkLabel" id="label316"> <object class="GtkLabel" id="label316">
<property name="visible">True</property> <property name="visible">True</property>
<property name="can_focus">False</property> <property name="can_focus">False</property>
<property name="xalign">0</property>
<property name="label" translatable="yes">Roo_m:</property> <property name="label" translatable="yes">Roo_m:</property>
<property name="use_underline">True</property> <property name="use_underline">True</property>
<property name="xalign">0</property>
</object> </object>
<packing> <packing>
<property name="left_attach">0</property> <property name="left_attach">0</property>
@ -155,9 +156,9 @@
<object class="GtkLabel" id="label317"> <object class="GtkLabel" id="label317">
<property name="visible">True</property> <property name="visible">True</property>
<property name="can_focus">False</property> <property name="can_focus">False</property>
<property name="xalign">0</property>
<property name="label" translatable="yes">_Server:</property> <property name="label" translatable="yes">_Server:</property>
<property name="use_underline">True</property> <property name="use_underline">True</property>
<property name="xalign">0</property>
</object> </object>
<packing> <packing>
<property name="left_attach">0</property> <property name="left_attach">0</property>
@ -168,9 +169,9 @@
<object class="GtkLabel" id="label318"> <object class="GtkLabel" id="label318">
<property name="visible">True</property> <property name="visible">True</property>
<property name="can_focus">False</property> <property name="can_focus">False</property>
<property name="xalign">0</property>
<property name="label" translatable="yes">_Password:</property> <property name="label" translatable="yes">_Password:</property>
<property name="use_underline">True</property> <property name="use_underline">True</property>
<property name="xalign">0</property>
</object> </object>
<packing> <packing>
<property name="left_attach">0</property> <property name="left_attach">0</property>
@ -231,9 +232,9 @@
<object class="GtkLabel" id="label326"> <object class="GtkLabel" id="label326">
<property name="visible">True</property> <property name="visible">True</property>
<property name="can_focus">False</property> <property name="can_focus">False</property>
<property name="xalign">0</property>
<property name="label" translatable="yes">Pr_int status:</property> <property name="label" translatable="yes">Pr_int status:</property>
<property name="use_underline">True</property> <property name="use_underline">True</property>
<property name="xalign">0</property>
</object> </object>
<packing> <packing>
<property name="left_attach">0</property> <property name="left_attach">0</property>

View File

@ -1,5 +1,5 @@
<?xml version="1.0" encoding="UTF-8"?> <?xml version="1.0" encoding="UTF-8"?>
<!-- Generated with glade 3.18.3 --> <!-- Generated with glade 3.20.0 -->
<interface> <interface>
<requires lib="gtk+" version="3.12"/> <requires lib="gtk+" version="3.12"/>
<object class="GtkImage" id="image1"> <object class="GtkImage" id="image1">
@ -27,6 +27,7 @@
<property name="default_height">500</property> <property name="default_height">500</property>
<property name="type_hint">dialog</property> <property name="type_hint">dialog</property>
<signal name="destroy" handler="on_plugins_window_destroy" swapped="no"/> <signal name="destroy" handler="on_plugins_window_destroy" swapped="no"/>
<signal name="key-press-event" handler="on_key_press_event" swapped="no"/>
<child> <child>
<object class="GtkBox" id="vbox1"> <object class="GtkBox" id="vbox1">
<property name="visible">True</property> <property name="visible">True</property>
@ -218,9 +219,9 @@
<object class="GtkLinkButton" id="plugin_homepage_linkbutton"> <object class="GtkLinkButton" id="plugin_homepage_linkbutton">
<property name="visible">True</property> <property name="visible">True</property>
<property name="can_focus">True</property> <property name="can_focus">True</property>
<property name="focus_on_click">False</property>
<property name="receives_default">True</property> <property name="receives_default">True</property>
<property name="relief">none</property> <property name="relief">none</property>
<property name="focus_on_click">False</property>
<property name="xalign">0</property> <property name="xalign">0</property>
</object> </object>
<packing> <packing>

View File

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

View File

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

View File

@ -1,5 +1,5 @@
<?xml version="1.0" encoding="UTF-8"?> <?xml version="1.0" encoding="UTF-8"?>
<!-- Generated with glade 3.18.3 --> <!-- Generated with glade 3.20.0 -->
<interface> <interface>
<requires lib="gtk+" version="3.12"/> <requires lib="gtk+" version="3.12"/>
<object class="GtkImage" id="image1"> <object class="GtkImage" id="image1">
@ -15,6 +15,7 @@
<property name="default_height">420</property> <property name="default_height">420</property>
<property name="type_hint">dialog</property> <property name="type_hint">dialog</property>
<signal name="destroy" handler="on_service_discovery_window_destroy" swapped="no"/> <signal name="destroy" handler="on_service_discovery_window_destroy" swapped="no"/>
<signal name="key-press-event" handler="on_key_press_event" swapped="no"/>
<child> <child>
<object class="GtkBox" id="vbox11"> <object class="GtkBox" id="vbox11">
<property name="visible">True</property> <property name="visible">True</property>
@ -34,11 +35,11 @@
<object class="GtkLabel" id="banner_agent_label"> <object class="GtkLabel" id="banner_agent_label">
<property name="visible">True</property> <property name="visible">True</property>
<property name="can_focus">False</property> <property name="can_focus">False</property>
<property name="xalign">0.05000000074505806</property>
<property name="ypad">6</property> <property name="ypad">6</property>
<property name="label">&lt;span weight="heavy" size="large"&gt;Agent name&lt;/span&gt; <property name="label">&lt;span weight="heavy" size="large"&gt;Agent name&lt;/span&gt;
Agent JID - node</property> Agent JID - node</property>
<property name="use_markup">True</property> <property name="use_markup">True</property>
<property name="xalign">0.05000000074505806</property>
</object> </object>
<packing> <packing>
<property name="expand">True</property> <property name="expand">True</property>

View File

@ -1,5 +1,5 @@
<?xml version="1.0" encoding="UTF-8"?> <?xml version="1.0" encoding="UTF-8"?>
<!-- Generated with glade 3.18.3 --> <!-- Generated with glade 3.20.0 -->
<interface> <interface>
<requires lib="gtk+" version="3.12"/> <requires lib="gtk+" version="3.12"/>
<object class="GtkImage" id="image1"> <object class="GtkImage" id="image1">
@ -13,6 +13,7 @@
<property name="default_width">550</property> <property name="default_width">550</property>
<property name="default_height">450</property> <property name="default_height">450</property>
<signal name="destroy" handler="on_xml_console_window_destroy" swapped="no"/> <signal name="destroy" handler="on_xml_console_window_destroy" swapped="no"/>
<signal name="key-press-event" handler="on_key_press_event" swapped="no"/>
<child> <child>
<object class="GtkBox" id="vbox"> <object class="GtkBox" id="vbox">
<property name="visible">True</property> <property name="visible">True</property>

View File

@ -3256,6 +3256,10 @@ class ManageBookmarksWindow:
# select root iter # select root iter
self.selection.select_iter(self.treestore.get_iter_first()) self.selection.select_iter(self.treestore.get_iter_first())
def on_key_press_event(self, widget, event):
if event.keyval == Gdk.KEY_Escape:
self.window.destroy()
def on_add_bookmark_button_clicked(self, widget): def on_add_bookmark_button_clicked(self, widget):
""" """
Add a new bookmark Add a new bookmark

View File

@ -3397,6 +3397,10 @@ class XMLConsoleWindow:
self.xml.connect_signals(self) self.xml.connect_signals(self)
def on_key_press_event(self, widget, event):
if event.keyval == Gdk.KEY_Escape:
self.window.destroy()
def on_xml_console_window_destroy(self, widget): def on_xml_console_window_destroy(self, widget):
del gajim.interface.instances[self.account]['xml_console'] del gajim.interface.instances[self.account]['xml_console']
gajim.ged.remove_event_handler('stanza-received', ged.GUI1, gajim.ged.remove_event_handler('stanza-received', ged.GUI1,
@ -4144,6 +4148,10 @@ class Archiving313PreferencesWindow:
self.idle_id = GLib.timeout_add_seconds(3, self._nec_archiving_error) self.idle_id = GLib.timeout_add_seconds(3, self._nec_archiving_error)
gajim.connections[self.account].request_archive_preferences() gajim.connections[self.account].request_archive_preferences()
def on_key_press_event(self, widget, event):
if event.keyval == Gdk.KEY_Escape:
self.window.destroy()
def set_widget_state(self, state): def set_widget_state(self, state):
for widget in ('default_cb', 'save_button', 'add_button', for widget in ('default_cb', 'save_button', 'add_button',
'remove_button'): 'remove_button'):
@ -4362,6 +4370,10 @@ class PrivacyListWindow:
self.xml.connect_signals(self) 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): def on_privacy_list_edit_window_destroy(self, widget):
key_name = 'privacy_list_%s' % self.privacy_list_name key_name = 'privacy_list_%s' % self.privacy_list_name
if key_name in gajim.interface.instances[self.account]: if key_name in gajim.interface.instances[self.account]:
@ -4676,6 +4688,10 @@ class PrivacyListsWindow:
self.xml.connect_signals(self) 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): def on_privacy_lists_first_window_destroy(self, widget):
if 'privacy_lists' in gajim.interface.instances[self.account]: if 'privacy_lists' in gajim.interface.instances[self.account]:
del gajim.interface.instances[self.account]['privacy_lists'] del gajim.interface.instances[self.account]['privacy_lists']

View File

@ -603,6 +603,10 @@ _('Without a connection, you can not browse available services'))
if self.browser: if self.browser:
self.browser.account = value self.browser.account = value
def on_key_press_event(self, widget, event):
if event.keyval == Gdk.KEY_Escape:
self.window.destroy()
def accel_group_func(self, accel_group, acceleratable, keyval, modifier): def accel_group_func(self, accel_group, acceleratable, keyval, modifier):
if (modifier & Gdk.ModifierType.CONTROL_MASK) and (keyval == Gdk.KEY_r): if (modifier & Gdk.ModifierType.CONTROL_MASK) and (keyval == Gdk.KEY_r):
self.reload() self.reload()

View File

@ -25,7 +25,7 @@
import os import os
import gi import gi
from gi.repository import Gtk from gi.repository import Gtk, Gdk
import gtkgui_helpers import gtkgui_helpers
from common import gajim from common import gajim
@ -133,6 +133,10 @@ class FeaturesWindow:
self.window.show_all() self.window.show_all()
self.xml.get_object('close_button').grab_focus() self.xml.get_object('close_button').grab_focus()
def on_key_press_event(self, widget, event):
if event.keyval == Gdk.KEY_Escape:
self.window.destroy()
def on_close_button_clicked(self, widget): def on_close_button_clicked(self, widget):
self.window.destroy() self.window.destroy()

View File

@ -29,7 +29,7 @@ __all__ = ['PluginsWindow']
from gi.repository import Pango from gi.repository import Pango
from gi.repository import Gtk from gi.repository import Gtk
from gi.repository import GdkPixbuf from gi.repository import GdkPixbuf
from gi.repository import GLib from gi.repository import GLib, Gdk
import os import os
import gtkgui_helpers import gtkgui_helpers
@ -116,6 +116,9 @@ class PluginsWindow(object):
self.window.show_all() self.window.show_all()
gtkgui_helpers.possibly_move_window_in_current_desktop(self.window) gtkgui_helpers.possibly_move_window_in_current_desktop(self.window)
def on_key_press_event(self, widget, event):
if event.keyval == Gdk.KEY_Escape:
self.window.destroy()
def on_plugins_notebook_switch_page(self, widget, page, page_num): def on_plugins_notebook_switch_page(self, widget, page, page_num):
GLib.idle_add(self.xml.get_object('close_button').grab_focus) GLib.idle_add(self.xml.get_object('close_button').grab_focus)