[evolution-patches] [addressbook] Patch for bug #235038



Hi,

This patch fixes bug # 235038.
It allows to select and remove multiple items in one go in
contact-list-editor.
I have reviewed the patch submitted against this bug.There were a few
mistakes there, corrected them.

thanks
Devashish
Index: addressbook/ChangeLog
===================================================================
RCS file: /cvs/gnome/evolution/addressbook/ChangeLog,v
retrieving revision 1.1982
diff -u -p -r1.1982 ChangeLog
--- addressbook/ChangeLog	17 Aug 2005 11:12:03 -0000	1.1982
+++ addressbook/ChangeLog	19 Aug 2005 08:57:25 -0000
@@ -1,3 +1,10 @@
+2005-08-19  Devashish Sharma <sdevashish novell com>
+	
+	* gui/contact-list-editor/e-contact-list-editor.c (remove_entry_cb):
+	Changes contact-list-editor so that multiple items can be selected and 
+	removed at once.
+	Fixes #235038
+	
 2005-08-17  Devashish Sharma <sdevashish novell com>
 
 	*  gui/merging/eab-contact-compare.c (use_common_book_cb): When
Index: addressbook/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.70
diff -u -p -r1.70 e-contact-list-editor.c
--- addressbook/gui/contact-list-editor/e-contact-list-editor.c	23 Jun 2005 09:11:04 -0000	1.70
+++ addressbook/gui/contact-list-editor/e-contact-list-editor.c	19 Aug 2005 08:50:20 -0000
@@ -789,16 +789,33 @@ add_email_cb (GtkWidget *w, EContactList
 }
 
 static void
-remove_row (int model_row, EContactListEditor *editor)
+prepend_selected_rows (int model_row, GList **list)
 {
-	e_contact_list_model_remove_row (E_CONTACT_LIST_MODEL (editor->model), model_row);
+	int *idx = g_new(int, 1);
+	*idx = model_row;
+	*list = g_list_append (*list, idx) ;
 }
 
 static void
 remove_entry_cb (GtkWidget *w, EContactListEditor *editor)
 {
+	int *idx = NULL;
+	GList *list = NULL;
+	int num_rows_deleted =0 ;
 	e_table_selected_row_foreach (e_table_scrolled_get_table(E_TABLE_SCROLLED(editor->table)),
-				      (EForeachFunc)remove_row, editor);
+				      (EForeachFunc)prepend_selected_rows, &list);
+
+	if (!list) return ;
+
+	for(; list ; list=list->next,num_rows_deleted++) {
+		idx = (int *)(list->data);
+		e_contact_list_model_remove_row (E_CONTACT_LIST_MODEL (editor->model), *idx-num_rows_deleted);
+		g_free(idx);
+		list->data = NULL;
+	}
+
+	list = g_list_first (list);
+	g_list_free (list);
 	editor->changed = TRUE;
 	command_state_changed (editor);
 }
Index: addressbook/gui/contact-list-editor/e-contact-list-editor.etspec
===================================================================
RCS file: /cvs/gnome/evolution/addressbook/gui/contact-list-editor/e-contact-list-editor.etspec,v
retrieving revision 1.1
diff -u -p -r1.1 e-contact-list-editor.etspec
--- addressbook/gui/contact-list-editor/e-contact-list-editor.etspec	9 Oct 2002 23:03:03 -0000	1.1
+++ addressbook/gui/contact-list-editor/e-contact-list-editor.etspec	19 Aug 2005 08:50:20 -0000
@@ -1,4 +1,4 @@
-<ETableSpecification no-headers="true" cursor-mode="line" selection-mode="single">
+<ETableSpecification no-headers="true" cursor-mode="line" selection-mode="multiple">
 <ETableColumn model_col= "0" _title="Contact" expansion="1.0" minimum_width="20" resizable="true" cell="string" compare="string" />
 	<ETableState>
 		<column source="0"/>


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