[evolution-patches] Patch for the bug #66523



hi,

Attach is the patch to fix the bug #66523 on http://bugzilla.ximian.com.
"No error dialog in contact list"

Would you like to spend a little time to review it, please?

Best regards
hao.sheng


Index: ChangeLog
===================================================================
RCS file: /cvs/gnome/evolution/addressbook/ChangeLog,v
retrieving revision 1.1830
diff -u -r1.1830 ChangeLog
--- ChangeLog	13 Sep 2004 16:26:49 -0000	1.1830
+++ ChangeLog	22 Sep 2004 02:36:23 -0000
@@ -1,3 +1,13 @@
+2004-09-22  Hao Sheng  <hao sheng sun com>
+
+	* gui/contact-list-editor/e-contact-list-editor.c:
+	(add_email_cb): add a parameter to the function
+	* gui/contact-list-editor/e-contact-list-model.h:
+	add an parameter to e_contact_list_model_add_email
+	* gui/contact-list-editor/e-contact-list-model.c:
+	(e_contact_list_model_add_email): estimate the same mail address
+	and popup a warning dialog
+				 
 2004-09-13  Rodney Dawes  <dobey novell com>
 
 	* gui/contact-editor/e-contact-editor.c (show_help_cb):
Index: gui/contact-list-editor/e-contact-list-editor.c
===================================================================
RCS file: /cvs/gnome/evolution/addressbook/gui/contact-list-editor/e-contact-list-editor.c,v
retrieving revision 1.63
diff -u -r1.63 e-contact-list-editor.c
--- gui/contact-list-editor/e-contact-list-editor.c	3 Aug 2004 22:53:33 -0000	1.63
+++ gui/contact-list-editor/e-contact-list-editor.c	22 Sep 2004 02:36:30 -0000
@@ -770,7 +770,7 @@
 	const char *text = gtk_entry_get_text (GTK_ENTRY(editor->email_entry));
 
 	if (text && *text) {
-		e_contact_list_model_add_email (E_CONTACT_LIST_MODEL(editor->model), text);
+		e_contact_list_model_add_email (w, E_CONTACT_LIST_MODEL(editor->model), text);
 
 		/* Skip to the end of the list */
 		if (adj->upper - adj->lower > adj->page_size)
Index: gui/contact-list-editor/e-contact-list-model.h
===================================================================
RCS file: /cvs/gnome/evolution/addressbook/gui/contact-list-editor/e-contact-list-model.h,v
retrieving revision 1.10
diff -u -r1.10 e-contact-list-model.h
--- gui/contact-list-editor/e-contact-list-model.h	17 Jun 2004 21:59:37 -0000	1.10
+++ gui/contact-list-editor/e-contact-list-model.h	22 Sep 2004 02:36:30 -0000
@@ -36,7 +36,7 @@
 ETableModel *e_contact_list_model_new (void);
 
 void         e_contact_list_model_add_destination (EContactListModel *model, EDestination *dest);
-void         e_contact_list_model_add_email       (EContactListModel *model, const char *email);
+void         e_contact_list_model_add_email       (GtkWidget *widget, EContactListModel *model, const char *email);
 void         e_contact_list_model_add_contact     (EContactListModel *model, EContact *contact, int email_num);
 
 void	     e_contact_list_model_remove_row (EContactListModel *model, int row);
Index: gui/contact-list-editor/e-contact-list-model.c
===================================================================
RCS file: /cvs/gnome/evolution/addressbook/gui/contact-list-editor/e-contact-list-model.c,v
retrieving revision 1.19
diff -u -r1.19 e-contact-list-model.c
--- gui/contact-list-editor/e-contact-list-model.c	8 Jun 2004 03:17:06 -0000	1.19
+++ gui/contact-list-editor/e-contact-list-model.c	22 Sep 2004 02:36:31 -0000
@@ -1,4 +1,9 @@
 /* -*- Mode: C; tab-width: 8; indent-tabs-mode: t; c-basic-offset: 8 -*- */
+#include <gtk/gtkmessagedialog.h>
+#include <libgnomeui/gnome-popup-menu.h>
+#include <libgnomeui/gnome-window-icon.h>
+#include <libgnome/gnome-i18n.h>
+#include <gtk/gtkstock.h>
 
 #include <config.h>
 #include <string.h>
@@ -191,13 +196,46 @@
 }
 
 void
-e_contact_list_model_add_email (EContactListModel *model,
+e_contact_list_model_add_email (GtkWidget *widget, EContactListModel *model,
 				const char *email)
 {
 	EDestination *new_dest;
 
 	g_return_if_fail (E_IS_CONTACT_LIST_MODEL (model));
 	g_return_if_fail (email != NULL);
+
+	char *list = NULL;
+	gboolean compare = TRUE;
+	int row = 0;
+	int row_count = e_table_model_row_count(E_TABLE_MODEL (model));
+
+	while (row < row_count) {
+		list = (char *)e_table_model_value_at(E_TABLE_MODEL (model), 1,row);
+		row++;
+		
+		if (strcmp(list, email) == 0 && compare) {
+			GtkWidget *dialog;
+			gint       response;
+			compare = FALSE;
+			dialog = gtk_message_dialog_new (NULL,
+							 (GtkDialogFlags) 0,
+							 GTK_MESSAGE_QUESTION,
+							 GTK_BUTTONS_NONE,
+							 _("The mail address has already exist on "
+							 "the list. Do you want to add again?"));
+
+			gtk_dialog_add_buttons (GTK_DIALOG (dialog),
+						_("Discard"), GTK_RESPONSE_YES,
+						GTK_STOCK_CANCEL, GTK_RESPONSE_CANCEL,
+						NULL);
+			gtk_dialog_set_default_response (GTK_DIALOG (dialog), GTK_RESPONSE_CANCEL);
+			response = gtk_dialog_run (GTK_DIALOG (dialog));
+			gtk_widget_destroy (dialog);
+
+			if (response != GTK_RESPONSE_YES)
+				return;
+		}
+	}
 
 	new_dest = e_destination_new ();
 	e_destination_set_email (new_dest, email);


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