[evolution-patches] Patch for the bug #66523



hi,

Attach is the changed 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 -p -r1.1830 ChangeLog
--- ChangeLog	13 Sep 2004 16:26:49 -0000	1.1830
+++ ChangeLog	22 Sep 2004 06:16:20 -0000
@@ -1,3 +1,9 @@
+2004-09-22  Hao Sheng  <hao sheng sun com>
+
+	* 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-model.c
===================================================================
RCS file: /cvs/gnome/evolution/addressbook/gui/contact-list-editor/e-contact-list-model.c,v
retrieving revision 1.19
diff -u -p -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 06:16:21 -0000
@@ -1,9 +1,12 @@
 /* -*- Mode: C; tab-width: 8; indent-tabs-mode: t; c-basic-offset: 8 -*- */
-
 #include <config.h>
 #include <string.h>
 #include "e-contact-list-model.h"
 
+#include <gtk/gtkmessagedialog.h>
+#include <gtk/gtkstock.h>
+#include <libgnome/gnome-i18n.h>
+
 #define PARENT_TYPE e_table_model_get_type()
 static ETableModelClass *parent_class;
 
@@ -195,10 +198,43 @@ e_contact_list_model_add_email (EContact
 				const char *email)
 {
 	EDestination *new_dest;
+	char *list = NULL;
+	int row = 0;
+	int row_count;
 
 	g_return_if_fail (E_IS_CONTACT_LIST_MODEL (model));
 	g_return_if_fail (email != NULL);
 
+	row_count = e_table_model_row_count (E_TABLE_MODEL (model));
+
+	for (row = 0; row < row_count; row++) {
+		list = (char *) e_table_model_value_at (E_TABLE_MODEL (model), 1, row);
+		
+		if (strcmp(list, email) == 0) {
+			GtkWidget *dialog;
+		 	gint       response;
+			
+			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;
+			break;
+		}
+	}
+
 	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]