aboutsummaryrefslogtreecommitdiffstats
path: root/libempathy-gtk/empathy-presence-chooser.c
diff options
context:
space:
mode:
authorDavyd Madeley <davyd@madeley.id.au>2009-04-11 00:53:39 +0800
committerXavier Claessens <xclaesse@src.gnome.org>2009-04-11 00:53:39 +0800
commit7ff5340a076a91f70ae8ba7a1a40b78d9fe89b1d (patch)
tree921347de2dfb070a01607ed92378914a9927c10e /libempathy-gtk/empathy-presence-chooser.c
parente85c92598fde2aa7dce7d1cff3bf00cf470b63a9 (diff)
downloadgsoc2013-empathy-7ff5340a076a91f70ae8ba7a1a40b78d9fe89b1d.tar
gsoc2013-empathy-7ff5340a076a91f70ae8ba7a1a40b78d9fe89b1d.tar.gz
gsoc2013-empathy-7ff5340a076a91f70ae8ba7a1a40b78d9fe89b1d.tar.bz2
gsoc2013-empathy-7ff5340a076a91f70ae8ba7a1a40b78d9fe89b1d.tar.lz
gsoc2013-empathy-7ff5340a076a91f70ae8ba7a1a40b78d9fe89b1d.tar.xz
gsoc2013-empathy-7ff5340a076a91f70ae8ba7a1a40b78d9fe89b1d.tar.zst
gsoc2013-empathy-7ff5340a076a91f70ae8ba7a1a40b78d9fe89b1d.zip
Escape to cancel from status editing
From: Davyd Madeley <davyd@madeley.id.au> svn path=/trunk/; revision=2776
Diffstat (limited to 'libempathy-gtk/empathy-presence-chooser.c')
-rw-r--r--libempathy-gtk/empathy-presence-chooser.c23
1 files changed, 23 insertions, 0 deletions
diff --git a/libempathy-gtk/empathy-presence-chooser.c b/libempathy-gtk/empathy-presence-chooser.c
index 702379a7c..11ee4f1b9 100644
--- a/libempathy-gtk/empathy-presence-chooser.c
+++ b/libempathy-gtk/empathy-presence-chooser.c
@@ -30,6 +30,7 @@
#include <glib/gi18n-lib.h>
#include <gtk/gtk.h>
#include <glade/glade.h>
+#include <gdk/gdkkeysyms.h>
#include <telepathy-glib/util.h>
#include <libmissioncontrol/mc-enum-types.h>
@@ -296,6 +297,25 @@ entry_activate_cb (EmpathyPresenceChooser *self,
mc_set_custom_state (self);
}
+static gboolean
+entry_key_press_event_cb (EmpathyPresenceChooser *self,
+ GdkEventKey *event,
+ GtkWidget *entry)
+{
+ EmpathyPresenceChooserPriv *priv = GET_PRIV (self);
+
+ if (priv->editing_status && event->keyval == GDK_Escape)
+ {
+ /* the user pressed Escape, undo the editing */
+ set_status_editing (self, FALSE);
+ presence_chooser_presence_changed_cb (self);
+
+ return TRUE;
+ }
+
+ return FALSE; /* send this event elsewhere */
+}
+
static void
changed_cb (GtkComboBox *self, gpointer user_data)
{
@@ -376,6 +396,9 @@ empathy_presence_chooser_init (EmpathyPresenceChooser *chooser)
g_signal_connect_object (entry, "activate",
G_CALLBACK (entry_activate_cb), chooser,
G_CONNECT_SWAPPED);
+ g_signal_connect_object (entry, "key-press-event",
+ G_CALLBACK (entry_key_press_event_cb), chooser,
+ G_CONNECT_SWAPPED);
// FIXME - should this also happen when the user presses TAB ?
GtkCellRenderer *renderer;