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

Merge branch 'keypress' into 'master'

Close Windows with ESC Key

See merge request !53
parents 20c00041 1ad087e5
<?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="GtkImage" id="add_image">
......@@ -43,6 +43,7 @@
<property name="window_position">center</property>
<property name="default_width">450</property>
<signal name="destroy" handler="on_archiving_preferences_window_destroy" swapped="no"/>
<signal name="key-press-event" handler="on_key_press_event" swapped="no"/>
<child>
<object class="GtkGrid" id="pref_grid">
<property name="visible">True</property>
......
<?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="GtkWindow" id="features_window">
......@@ -10,6 +10,7 @@
<property name="default_width">300</property>
<property name="default_height">530</property>
<property name="type_hint">dialog</property>
<signal name="key-press-event" handler="on_key_press_event" swapped="no"/>
<child>
<object class="GtkBox" id="vbox1">
<property name="visible">True</property>
......@@ -22,9 +23,9 @@
<property name="visible">True</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="xalign">0</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="xalign">0</property>
</object>
<packing>
<property name="expand">False</property>
......@@ -98,9 +99,9 @@
<property name="visible">True</property>
<property name="can_focus">False</property>
<property name="margin_left">12</property>
<property name="xalign">0</property>
<property name="wrap">True</property>
<property name="selectable">True</property>
<property name="xalign">0</property>
</object>
</child>
<child type="label">
......
<?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="default_width">550</property>
<property name="default_height">300</property>
<property name="type_hint">dialog</property>
<signal name="key-press-event" handler="on_key_press_event" swapped="no"/>
<child>
<object class="GtkBox" id="vbox86">
<property name="visible">True</property>
......@@ -116,9 +117,9 @@
<object class="GtkLabel" id="label325">
<property name="visible">True</property>
<property name="can_focus">False</property>
<property name="xalign">0</property>
<property name="label" translatable="yes">_Title:</property>
<property name="use_underline">True</property>
<property name="xalign">0</property>
</object>
<packing>
<property name="left_attach">0</property>
......@@ -129,9 +130,9 @@
<object class="GtkLabel" id="label315">
<property name="visible">True</property>
<property name="can_focus">False</property>
<property name="xalign">0</property>
<property name="label" translatable="yes">_Nickname:</property>
<property name="use_underline">True</property>
<property name="xalign">0</property>
</object>
<packing>
<property name="left_attach">0</property>
......@@ -142,9 +143,9 @@
<object class="GtkLabel" id="label316">
<property name="visible">True</property>
<property name="can_focus">False</property>
<property name="xalign">0</property>
<property name="label" translatable="yes">Roo_m:</property>
<property name="use_underline">True</property>
<property name="xalign">0</property>
</object>
<packing>
<property name="left_attach">0</property>
......@@ -155,9 +156,9 @@
<object class="GtkLabel" id="label317">
<property name="visible">True</property>
<property name="can_focus">False</property>
<property name="xalign">0</property>
<property name="label" translatable="yes">_Server:</property>
<property name="use_underline">True</property>
<property name="xalign">0</property>
</object>
<packing>
<property name="left_attach">0</property>
......@@ -168,9 +169,9 @@
<object class="GtkLabel" id="label318">
<property name="visible">True</property>
<property name="can_focus">False</property>
<property name="xalign">0</property>
<property name="label" translatable="yes">_Password:</property>
<property name="use_underline">True</property>
<property name="xalign">0</property>
</object>
<packing>
<property name="left_attach">0</property>
......@@ -231,9 +232,9 @@
<object class="GtkLabel" id="label326">
<property name="visible">True</property>
<property name="can_focus">False</property>
<property name="xalign">0</property>
<property name="label" translatable="yes">Pr_int status:</property>
<property name="use_underline">True</property>
<property name="xalign">0</property>
</object>
<packing>
<property name="left_attach">0</property>
......
<?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="GtkImage" id="image1">
......@@ -27,6 +27,7 @@
<property name="default_height">500</property>
<property name="type_hint">dialog</property>
<signal name="destroy" handler="on_plugins_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>
......@@ -218,9 +219,9 @@
<object class="GtkLinkButton" id="plugin_homepage_linkbutton">
<property name="visible">True</property>
<property name="can_focus">True</property>
<property name="focus_on_click">False</property>
<property name="receives_default">True</property>
<property name="relief">none</property>
<property name="focus_on_click">False</property>
<property name="xalign">0</property>
</object>
<packing>
......
<?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>
......
<?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>
......
<?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="GtkImage" id="image1">
......@@ -15,6 +15,7 @@
<property name="default_height">420</property>
<property name="type_hint">dialog</property>
<signal name="destroy" handler="on_service_discovery_window_destroy" swapped="no"/>
<signal name="key-press-event" handler="on_key_press_event" swapped="no"/>
<child>
<object class="GtkBox" id="vbox11">
<property name="visible">True</property>
......@@ -34,11 +35,11 @@
<object class="GtkLabel" id="banner_agent_label">
<property name="visible">True</property>
<property name="can_focus">False</property>
<property name="xalign">0.05000000074505806</property>
<property name="ypad">6</property>
<property name="label">&lt;span weight="heavy" size="large"&gt;Agent name&lt;/span&gt;
Agent JID - node</property>
<property name="use_markup">True</property>
<property name="xalign">0.05000000074505806</property>
</object>
<packing>
<property name="expand">True</property>
......
<?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="GtkImage" id="image1">
......@@ -13,6 +13,7 @@
<property name="default_width">550</property>
<property name="default_height">450</property>
<signal name="destroy" handler="on_xml_console_window_destroy" swapped="no"/>
<signal name="key-press-event" handler="on_key_press_event" swapped="no"/>
<child>
<object class="GtkBox" id="vbox">
<property name="visible">True</property>
......
......@@ -3256,6 +3256,10 @@ class ManageBookmarksWindow:
# select root iter
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):
"""
Add a new bookmark
......
......@@ -3397,6 +3397,10 @@ class XMLConsoleWindow:
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):
del gajim.interface.instances[self.account]['xml_console']
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)
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):
for widget in ('default_cb', 'save_button', 'add_button',
'remove_button'):
......@@ -4362,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]:
......@@ -4676,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']
......
......@@ -603,6 +603,10 @@ _('Without a connection, you can not browse available services'))
if self.browser:
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):
if (modifier & Gdk.ModifierType.CONTROL_MASK) and (keyval == Gdk.KEY_r):
self.reload()
......
......@@ -25,7 +25,7 @@
import os
import gi
from gi.repository import Gtk
from gi.repository import Gtk, Gdk
import gtkgui_helpers
from common import gajim
......@@ -133,6 +133,10 @@ class FeaturesWindow:
self.window.show_all()
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):
self.window.destroy()
......
......@@ -29,7 +29,7 @@ __all__ = ['PluginsWindow']
from gi.repository import Pango
from gi.repository import Gtk
from gi.repository import GdkPixbuf
from gi.repository import GLib
from gi.repository import GLib, Gdk
import os
import gtkgui_helpers
......@@ -116,6 +116,9 @@ class PluginsWindow(object):
self.window.show_all()
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):
GLib.idle_add(self.xml.get_object('close_button').grab_focus)
......
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