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



Hi,
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 07:31:38 -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,9 @@
 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 gint app_messagedialog_key_press_cb (GtkWidget *widget, GdkEvent *event, gpointer data);
+
 static GtkObjectClass *parent_class = NULL;
 
 static guint contact_editor_signals[LAST_SIGNAL];
@@ -1733,6 +1737,10 @@
 				GTK_STOCK_DELETE, GTK_RESPONSE_ACCEPT,
 				NULL);
 
+	/* Connect to the ESC_key_press event of the message dialog */
+	g_signal_connect (dialog, "key_press_event",
+			        GTK_SIGNAL_FUNC (app_messagedialog_key_press_cb), NULL);
+
 	result = gtk_dialog_run(GTK_DIALOG (dialog));
 
 	gtk_widget_destroy (dialog);
@@ -1881,6 +1889,33 @@
 	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;
+}
+                                                                                                               
+/* Callback used when the ESC key pressed at message dialog  */
+static gint
+app_messagedialog_key_press_cb (GtkWidget *widget, GdkEvent *event, gpointer data)
+{
+	if (event->key.keyval == GDK_Escape){
+		gtk_widget_destroy (widget);
+		return TRUE;
+	}
+	return FALSE;
+}
+
 static GList *
 add_to_tab_order(GList *list, GladeXML *gui, char *name)
 {
@@ -2058,6 +2093,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);


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