[evolution-patches] address book patch to fix #54447



hi Chris,
Thanks for your review my patch.
This patch fix the bug 54447 in bugzilla.ximnain.org, provide ESC suport for contact editor.

Attach is the patch. Would you like to spend a little time to review it? Thank you.

Best regards
Index: gui/contact-editor/e-contact-editor.c
===================================================================
RCS file: /cvs/gnome/evolution/addressbook/gui/contact-editor/e-contact-editor.c,v
retrieving revision 1.165
diff -u -r1.165 e-contact-editor.c
--- gui/contact-editor/e-contact-editor.c	30 Jan 2004 22:52:38 -0000	1.165
+++ gui/contact-editor/e-contact-editor.c	17 Feb 2004 05:54:37 -0000
@@ -45,6 +45,7 @@
 #include <gal/widgets/e-categories.h>
 #include <gal/widgets/e-gui-utils.h>
 #include <gal/e-text/e-entry.h>
+#include <gdk/gdkkeysyms.h>
 
 #include <libebook/e-address-western.h>
 
@@ -116,6 +117,8 @@
 static void close_dialog (EContactEditor *ce);
 static void enable_widget (GtkWidget *widget, gboolean enabled);
 
+static gint app_key_press_cb (GtkWidget *widget, GdkEvent *event, gpointer data);
+
 static GtkObjectClass *parent_class = NULL;
 
 static guint contact_editor_signals[LAST_SIGNAL];
@@ -1881,6 +1884,22 @@
 	return TRUE;
 }
 
+/* Callback used when the ESC key pressed at contact  */
+static gint
+app_key_press_cb (GtkWidget *widget, GdkEvent *event, gpointer data)
+{
+	if (event->key.keyval == GDK_Escape){
+		EContactEditor *ce;
+		if (E_IS_CONTACT_EDITOR(data)){
+			ce = E_CONTACT_EDITOR (data);
+			close_dialog (ce);
+			return TRUE;
+			}
+		return FALSE;
+	}
+	return FALSE;
+}
+
 static GList *
 add_to_tab_order(GList *list, GladeXML *gui, char *name)
 {
@@ -2059,6 +2078,11 @@
 	g_signal_connect (e_contact_editor->app, "delete_event",
 			    GTK_SIGNAL_FUNC (app_delete_event_cb), e_contact_editor);
 
+	/*Connect to the ESC of the dialog*/
+	g_signal_connect (e_contact_editor->app, "key_press_event",
+			    GTK_SIGNAL_FUNC (app_key_press_cb), e_contact_editor);
+
+
 	/* set the icon */
 	icon_path = g_build_filename (EVOLUTION_IMAGESDIR, "evolution-contacts-mini.png", NULL);
 	gnome_window_icon_set_from_file (GTK_WINDOW (e_contact_editor->app), icon_path);


[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]