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



Hi,

   Ignore the previous patch .
Because there is a simple mothed to deal with the ESC event on message dialog.

This patch is aimed for Head.
Fix the Bug#52765  on http://bugzilla.ximian.com.


Attach is a patch to fix that. Would you like to spend a little time to review it?

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	13 Feb 2004 09:05:00 -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];
@@ -1729,7 +1732,7 @@
 					    "to delete this contact?"));
 
 	gtk_dialog_add_buttons (GTK_DIALOG (dialog),
-				GTK_STOCK_CANCEL, GTK_RESPONSE_REJECT,
+				GTK_STOCK_CANCEL, GTK_RESPONSE_CANCEL,
 				GTK_STOCK_DELETE, GTK_RESPONSE_ACCEPT,
 				NULL);
 
@@ -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,10 @@
 	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]