From df1d8e745005faa206583595211461adc53b81d0 Mon Sep 17 00:00:00 2001 From: Yann Leboulanger <asterix@lagaule.org> Date: Thu, 6 Jan 2005 13:01:22 +0000 Subject: [PATCH] when escape key is pressed in chat window, it is closed --- plugins/gtkgui/gtkgui.glade | 1 + plugins/gtkgui/gtkgui.py | 6 ++++++ 2 files changed, 7 insertions(+) diff --git a/plugins/gtkgui/gtkgui.glade b/plugins/gtkgui/gtkgui.glade index fff2e7cb8d..cf9d192ca3 100644 --- a/plugins/gtkgui/gtkgui.glade +++ b/plugins/gtkgui/gtkgui.glade @@ -286,6 +286,7 @@ <property name="gravity">GDK_GRAVITY_NORTH_WEST</property> <signal name="destroy" handler="gtk_widget_destroy" last_modification_time="Sun, 12 Oct 2003 18:17:05 GMT"/> <signal name="focus_in_event" handler="on_focus" last_modification_time="Fri, 11 Jun 2004 03:14:21 GMT"/> + <signal name="key_press_event" handler="on_chat_key_press_event" last_modification_time="Thu, 06 Jan 2005 12:53:45 GMT"/> <child> <widget class="GtkVBox" id="vbox2"> diff --git a/plugins/gtkgui/gtkgui.py b/plugins/gtkgui/gtkgui.py index f3e4c0103b..5435ddf72f 100644 --- a/plugins/gtkgui/gtkgui.py +++ b/plugins/gtkgui/gtkgui.py @@ -255,6 +255,10 @@ class message_Window: if len(self.plugin.roster.contacts[self.account][self.user.jid]) == 1: self.plugin.roster.remove_user(self.user, self.account) + def on_chat_key_press_event(self, widget, event): + if event.keyval == gtk.keysyms.Escape: + widget.get_toplevel().destroy() + def on_msg_key_press_event(self, widget, event): """When a key is pressed : if enter is pressed without the shit key, message (if not empty) is sent @@ -328,6 +332,8 @@ class message_Window: self.xml.signal_connect('on_history_clicked', self.on_history) self.xml.signal_connect('on_msg_key_press_event', \ self.on_msg_key_press_event) + self.xml.signal_connect('on_chat_key_press_event', \ + self.on_chat_key_press_event) self.tagIn = buffer.create_tag("incoming") color = self.plugin.config['inmsgcolor'] self.tagIn.set_property("foreground", color) -- GitLab