[evolution-patches] Seeking review for bug #48339, #48340 & #48341



Hi,

The bugs' summary are listed as follows:

48339 <http://bugzilla.ximian.com/show_bug.cgi?id=48339> Import wizard does not close on `ESC` 48341 <http://bugzilla.ximian.com/show_bug.cgi?id=48341> Add new mail account window does not close on Esc 48340 <http://bugzilla.ximian.com/show_bug.cgi?id=48340> Add/Edit directory servers windows do not close on Esc


These 3 bugs are almost the same. So I attach the patches together here.
They're quite simple. Please review, thanks!
--
Best Regards
Maxx

Index: mail/ChangeLog
===================================================================
RCS file: /cvs/gnome/evolution/mail/ChangeLog,v
retrieving revision 1.2798
diff -u -r1.2798 ChangeLog
--- mail/ChangeLog	26 Aug 2003 18:17:56 -0000	1.2798
+++ mail/ChangeLog	12 Sep 2003 06:02:09 -0000
@@ -1,3 +1,11 @@
+2003-09-12 Maxx Cao <maxx cao sun com>
+
+        ** Fixes bug #48341
+
+        * mail-config-druid.c (druid_cancel): Alert user before quit.
+        (druid_key_press): Filter Esc key event.
+        (mail_config_druid_new): Connect "key_press_event".
+
 2003-08-22  Not Zed  <NotZed Ximian com>
 
 	* mail-format.c (write_date): translate the local time format.
Index: mail/mail-config-druid.c
===================================================================
RCS file: /cvs/gnome/evolution/mail/mail-config-druid.c,v
retrieving revision 1.100
diff -u -r1.100 mail-config-druid.c
--- mail/mail-config-druid.c	16 Apr 2003 17:03:11 -0000	1.100
+++ mail/mail-config-druid.c	12 Sep 2003 06:02:09 -0000
@@ -51,6 +51,8 @@
 #include <evolution-wizard.h>
 #include <e-util/e-account.h>
 
+#include <gdk/gdkkeysyms.h>
+
 typedef enum {
 	MAIL_CONFIG_WIZARD_PAGE_NONE = -1,
 	MAIL_CONFIG_WIZARD_PAGE_IDENTITY,
@@ -570,11 +572,21 @@
 {
 	MailConfigWizard *mcw = user_data;
 	GtkWidget *window;
+	GtkWidget *confirm_dialog;
+	int response;
 
-	window = glade_xml_get_widget (mcw->gui->xml, "account_druid");
-	gtk_widget_destroy (window);
-
-	free_config_wizard (mcw);
+	confirm_dialog = gtk_message_dialog_new (NULL, GTK_DIALOG_MODAL,
+						 GTK_MESSAGE_QUESTION, GTK_BUTTONS_YES_NO,
+						 _("Are you sure you want to quit this assistant?"));
+
+	response = gtk_dialog_run (GTK_DIALOG (confirm_dialog));
+	gtk_widget_destroy (confirm_dialog);
+
+	if (response == GTK_RESPONSE_YES) {
+		window = glade_xml_get_widget (mcw->gui->xml, "account_druid");
+		gtk_widget_destroy (window);
+		free_config_wizard (mcw);
+	}
 }
 
 static void
@@ -620,6 +632,17 @@
 		return FALSE;
 }
 
+static gboolean
+druid_key_press (GtkWidget *widget, GdkEventKey *event, gpointer user_data)
+{
+	if (event->keyval == GDK_Escape) {
+		MailConfigWizard *mcw = user_data;
+		druid_cancel (mcw->druid, user_data);
+		return TRUE;
+	}
+	return FALSE;
+}
+
 
 MailConfigDruid *
 mail_config_druid_new (void)
@@ -632,6 +655,9 @@
 	mcw->druid = (GnomeDruid *)glade_xml_get_widget (mcw->gui->xml, "druid");
 	g_object_set_data (G_OBJECT (mcw->druid), "MailConfigWizard", mcw);
 	
+	g_signal_connect (gtk_widget_get_parent (mcw->druid), "key_press_event", 
+			  G_CALLBACK (druid_key_press), (gpointer)mcw);
+
 	mcw->interior_pages = g_ptr_array_new ();
 	for (i = 0; i < num_wizard_pages; i++) {
 		page = glade_xml_get_widget (mcw->gui->xml,
Index: addressbook/ChangeLog
===================================================================
RCS file: /cvs/gnome/evolution/addressbook/ChangeLog,v
retrieving revision 1.1446
diff -u -r1.1446 ChangeLog
--- addressbook/ChangeLog	26 Aug 2003 17:47:14 -0000	1.1446
+++ addressbook/ChangeLog	12 Sep 2003 06:02:09 -0000
@@ -1,3 +1,14 @@
+2003-09-10  Maxx Cao  <maxx cao sun com>
+
+	** Fixes bug #48340
+
+	* gui/component/addressbook-config.c 
+	(addressbook_add_server_druid_cancel): Alert user before quit.
+	(add_server_druid_key_press): Filter Esc key event.
+	(addressbook_add_server_druid): Connect "key_press_event".
+	(edit_dialog_key_press): Filter Esc key event.
+	(addressbook_edit_server_dialog): Connect "key_press_event".
+
 2003-08-26  JP Rosevear  <jpr ximian com>
  
  	* conduit/address-conduit.c (ecard_from_remote_record): duplicate
Index: addressbook/gui/component/addressbook-config.c
===================================================================
RCS file: /cvs/gnome/evolution/addressbook/gui/component/addressbook-config.c,v
retrieving revision 1.56
diff -u -r1.56 addressbook-config.c
--- addressbook/gui/component/addressbook-config.c	8 Apr 2003 15:31:53 -0000	1.56
+++ addressbook/gui/component/addressbook-config.c	12 Sep 2003 06:02:09 -0000
@@ -37,6 +37,7 @@
 #include <gal/e-table/e-table-memory-store.h>
 #include <gal/e-table/e-table-scrolled.h>
 
+#include <gdk/gdkkeysyms.h>
 
 #ifdef HAVE_LDAP
 #include "ldap.h"
@@ -370,7 +371,17 @@
 static void
 addressbook_add_server_druid_cancel (GtkWidget *widget, AddressbookSourceDialog *dialog)
 {
-	gtk_widget_destroy (dialog->window);
+	GtkWidget *confirm_dialog;
+	int response;
+
+	confirm_dialog = gtk_message_dialog_new (dialog->window, GTK_DIALOG_MODAL,
+						 GTK_MESSAGE_QUESTION, GTK_BUTTONS_YES_NO,
+						 _("Are you sure you want to quit this assistant?"));
+
+	response = gtk_dialog_run (GTK_DIALOG (confirm_dialog));
+	gtk_widget_destroy (confirm_dialog);
+	if (response == GTK_RESPONSE_YES)
+		gtk_widget_destroy (dialog->window);
 }
 
 static void
@@ -1048,7 +1059,18 @@
 }
 #endif
 
-
+
+static gboolean
+add_server_druid_key_press (GtkWidget *widget, GdkEventKey *event, gpointer data)
+{
+	if (event->keyval == GDK_Escape) {
+		addressbook_add_server_druid_cancel (widget, data);
+		return TRUE;
+	}
+	
+	return FALSE;
+}
+
 static AddressbookSourceDialog *
 addressbook_add_server_druid (AddressbookDialog *dialog)
 {
@@ -1105,6 +1127,8 @@
 	gtk_window_set_type_hint (GTK_WINDOW (sdialog->window), GDK_WINDOW_TYPE_HINT_DIALOG);
 	gtk_window_set_modal (GTK_WINDOW (sdialog->window), TRUE);
 
+	g_signal_connect (sdialog->window, "key_press_event", 
+			  G_CALLBACK (add_server_druid_key_press), sdialog);
 	gtk_widget_show_all (sdialog->window);
 
 	return sdialog;
@@ -1335,6 +1359,17 @@
 	}
 }
 
+static gboolean
+edit_dialog_key_press (GtkWidget *widget, GdkEventKey *event, AddressbookSourceDialog *sdialog)
+{
+	if (event->keyval == GDK_Escape) {
+		gtk_widget_destroy (sdialog->window);
+		return TRUE;
+	}
+	
+	return FALSE;
+}
+
 static AddressbookSourceDialog*
 addressbook_edit_server_dialog (GtkTreeModel      *model,
 				GtkTreePath       *path,
@@ -1447,6 +1482,8 @@
 	gtk_window_set_type_hint (GTK_WINDOW (sdialog->window), GDK_WINDOW_TYPE_HINT_DIALOG);
 	gtk_window_set_modal (GTK_WINDOW (sdialog->window), TRUE);
 
+	g_signal_connect (sdialog->window, "key_press_event", edit_dialog_key_press, sdialog);
+
 	gtk_widget_show (sdialog->window);
 
 	return sdialog;
Index: shell/ChangeLog
===================================================================
RCS file: /cvs/gnome/evolution/shell/ChangeLog,v
retrieving revision 1.1298
diff -u -r1.1298 ChangeLog
--- shell/ChangeLog	10 Sep 2003 03:12:15 -0000	1.1298
+++ shell/ChangeLog	12 Sep 2003 06:02:09 -0000
@@ -1,3 +1,12 @@
+2003-09-12  Maxx Cao  <maxx cao sun com>
+
+	reviewed by: <delete if not using a buddy>
+
+	* e-shell-importer.c (import_druid_cancel): Alert user before
+	canceling.
+	(import_druid_keypress): Filter Esc key event.
+	(show_import_wizard): Connect "key_press_event'.
+
 2003-09-05  Yuedong Du  <yuedong du sun com>
 
 	* e-shell-importer.c: (importer_file_page_new),
Index: shell/e-shell-importer.c
===================================================================
RCS file: /cvs/gnome/evolution/shell/e-shell-importer.c,v
retrieving revision 1.59
diff -u -r1.59 e-shell-importer.c
--- shell/e-shell-importer.c	10 Sep 2003 03:12:18 -0000	1.59
+++ shell/e-shell-importer.c	12 Sep 2003 06:02:10 -0000
@@ -45,6 +45,8 @@
 #include <bonobo/bonobo-exception.h>
 #include <bonobo/bonobo-widget.h>
 
+#include <gdk/gdkkeysyms.h>
+
 #include "e-shell.h"
 #include "e-shell-view.h"
 #include "e-shell-constants.h"
@@ -916,7 +918,18 @@
 import_druid_cancel (GnomeDruid *druid,
 		     ImportData *data)
 {
-  	gtk_widget_destroy (GTK_WIDGET (data->dialog));
+	GtkWidget *confirm_dialog;
+	int response;
+
+	confirm_dialog = gtk_message_dialog_new (GTK_WINDOW (data->dialog), GTK_DIALOG_MODAL,
+						 GTK_MESSAGE_QUESTION, GTK_BUTTONS_YES_NO,
+						 _("Are you sure you want to quit this assistant?"));
+
+	response = gtk_dialog_run (GTK_DIALOG (confirm_dialog));
+	gtk_widget_destroy (confirm_dialog);
+
+	if (response == GTK_RESPONSE_YES)
+		gtk_widget_destroy (GTK_WIDGET (data->dialog));
 }
 
 static void
@@ -1074,6 +1087,17 @@
 }
 
 static gboolean
+import_druid_keypress (GtkWidget *widget, GdkEventKey *event, ImportData *data)
+{
+	if (event->keyval == GDK_Escape) {
+		import_druid_cancel (GNOME_DRUID (data->druid), data);
+		return TRUE;
+	}
+	return FALSE;
+}
+
+
+static gboolean
 prepare_file_page (GnomeDruidPage *page,
 		   GnomeDruid *druid,
 		   ImportData *data)
@@ -1246,5 +1270,7 @@
 
 	g_object_weak_ref ((GObject *)data->dialog, import_druid_weak_notify, data);
 
+	g_signal_connect (data->dialog, "key_press_event", G_CALLBACK (import_druid_keypress), data);
+
 	gtk_widget_show_all (data->dialog);
 }


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