aboutsummaryrefslogtreecommitdiffstats
path: root/addressbook/gui/widgets
diff options
context:
space:
mode:
Diffstat (limited to 'addressbook/gui/widgets')
-rw-r--r--addressbook/gui/widgets/e-minicard-label.c16
-rw-r--r--addressbook/gui/widgets/e-minicard.c12
2 files changed, 27 insertions, 1 deletions
diff --git a/addressbook/gui/widgets/e-minicard-label.c b/addressbook/gui/widgets/e-minicard-label.c
index 54779c4ea6..b59ff46ae3 100644
--- a/addressbook/gui/widgets/e-minicard-label.c
+++ b/addressbook/gui/widgets/e-minicard-label.c
@@ -20,13 +20,16 @@
*/
#include <config.h>
+
+#include "e-minicard-label.h"
+
#include <gtk/gtksignal.h>
#include <libgnomeui/gnome-canvas-rect-ellipse.h>
#include <gal/util/e-util.h>
#include <gal/e-text/e-text.h>
#include <gal/widgets/e-canvas.h>
#include <gal/widgets/e-canvas-utils.h>
-#include "e-minicard-label.h"
+#include <gdk/gdkkeysyms.h>
static void e_minicard_label_init (EMinicardLabel *card);
static void e_minicard_label_class_init (EMinicardLabelClass *klass);
@@ -300,6 +303,17 @@ e_minicard_label_event (GnomeCanvasItem *item, GdkEvent *event)
switch( event->type )
{
+ case GDK_KEY_PRESS:
+ if (event->key.keyval == GDK_Escape) {
+ GnomeCanvasItem *parent;
+
+ e_text_cancel_editing (E_TEXT (e_minicard_label->field));
+
+ parent = GNOME_CANVAS_ITEM (e_minicard_label)->parent;
+ if (parent)
+ e_canvas_item_grab_focus(parent, FALSE);
+ }
+ break;
case GDK_FOCUS_CHANGE:
{
GdkEventFocus *focus_event = (GdkEventFocus *) event;
diff --git a/addressbook/gui/widgets/e-minicard.c b/addressbook/gui/widgets/e-minicard.c
index 96ae2fad9e..8991d8c757 100644
--- a/addressbook/gui/widgets/e-minicard.c
+++ b/addressbook/gui/widgets/e-minicard.c
@@ -709,6 +709,13 @@ field_changed (EText *text, EMinicard *e_minicard)
}
static void
+field_activated (EText *text, EMinicard *e_minicard)
+{
+ e_text_stop_editing (text);
+ e_canvas_item_grab_focus (GNOME_CANVAS_ITEM (e_minicard), FALSE);
+}
+
+static void
add_field (EMinicard *e_minicard, ECardSimpleField field, gdouble left_width)
{
GnomeCanvasItem *new_item;
@@ -745,6 +752,11 @@ add_field (EMinicard *e_minicard, ECardSimpleField field, gdouble left_width)
NULL );
gtk_signal_connect(GTK_OBJECT(E_MINICARD_LABEL(new_item)->field),
"changed", GTK_SIGNAL_FUNC(field_changed), e_minicard);
+ gtk_signal_connect(GTK_OBJECT(E_MINICARD_LABEL(new_item)->field),
+ "activate", GTK_SIGNAL_FUNC(field_activated), e_minicard);
+ gtk_object_set(GTK_OBJECT(E_MINICARD_LABEL(new_item)->field),
+ "allow_newlines", e_card_simple_get_allow_newlines (e_minicard->simple, field),
+ NULL);
gtk_object_set_data(GTK_OBJECT(E_MINICARD_LABEL(new_item)->field),
"EMinicard:field",
GINT_TO_POINTER(field));