Re: [evolution-patches] Patch for the bug #66523



hi,

With Not Zed's suggestion, I make the patch again.
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	23 Sep 2004 12:44:43 -0000
@@ -1,3 +1,11 @@
+2004-09-23  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
+	* addressbook-errors.xml: add the question message for the warning
+	dialog
+				 
 2004-09-13  Rodney Dawes  <dobey novell com>
 
 	* gui/contact-editor/e-contact-editor.c (show_help_cb):
Index: addressbook-errors.xml
===================================================================
RCS file: /cvs/gnome/evolution/addressbook/addressbook-errors.xml,v
retrieving revision 1.2
diff -u -p -r1.2 addressbook-errors.xml
--- addressbook-errors.xml	19 Aug 2004 20:33:10 -0000	1.2
+++ addressbook-errors.xml	23 Sep 2004 12:44:47 -0000
@@ -77,4 +77,10 @@
   <secondary>Your contacts for {0} will not be available until Evolution is restarted.</secondary>
  </error>
 
+ <error id="ask-list-add-exists" type="question" default="GTK_RESPONSE_NO">
+  <primary>Address '{0}' already exists.</primary>
+  <secondary>A contact already exists with this address.  Would you like to add a new card with the same address anyway?</secondary>
+  <button stock="gtk-cancel" response="GTK_RESPONSE_CANCEL"/>
+  <button stock="gtk-ok" label="_Add" response="GTK_RESPONSE_YES"/>
+ </error>
 </error-list>
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	23 Sep 2004 12:44:51 -0000
@@ -3,7 +3,9 @@
 #include <config.h>
 #include <string.h>
 #include "e-contact-list-model.h"
+#include "widgets/misc/e-error.h"
 
+#include <gtk/gtkmessagedialog.h>
 #define PARENT_TYPE e_table_model_get_type()
 static ETableModelClass *parent_class;
 
@@ -195,9 +197,25 @@ e_contact_list_model_add_email (EContact
 				const char *email)
 {
 	EDestination *new_dest;
+	char *list = NULL;
+	int row;
+	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) {
+			if (e_error_run (NULL, "addressbook:ask-list-add-exists", 
+					 email) != 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]