aboutsummaryrefslogtreecommitdiffstats
path: root/addressbook/gui/contact-list-editor/e-contact-list-editor.c
diff options
context:
space:
mode:
authorSushma Rai <rsushma@src.gnome.org>2005-08-22 14:33:04 +0800
committerSushma Rai <rsushma@src.gnome.org>2005-08-22 14:33:04 +0800
commit04fe73b7a83c5469543b6c0eb57706bc2253b506 (patch)
tree7c9712ef28286a06acde159aad1c9ac935dbd491 /addressbook/gui/contact-list-editor/e-contact-list-editor.c
parent96604b4c6362d7ef1c5a74ad5f6a27c7ae5b604e (diff)
downloadgsoc2013-evolution-04fe73b7a83c5469543b6c0eb57706bc2253b506.tar
gsoc2013-evolution-04fe73b7a83c5469543b6c0eb57706bc2253b506.tar.gz
gsoc2013-evolution-04fe73b7a83c5469543b6c0eb57706bc2253b506.tar.bz2
gsoc2013-evolution-04fe73b7a83c5469543b6c0eb57706bc2253b506.tar.lz
gsoc2013-evolution-04fe73b7a83c5469543b6c0eb57706bc2253b506.tar.xz
gsoc2013-evolution-04fe73b7a83c5469543b6c0eb57706bc2253b506.tar.zst
gsoc2013-evolution-04fe73b7a83c5469543b6c0eb57706bc2253b506.zip
Allow selecting and removing multiple entries from contact list editor.
Fixes #235038. Patch submitted by "sean.gao@sun.com (Sean Gao)" and patch corrected by "Devashish Sharma <sdevashish@novell.com>". svn path=/trunk/; revision=30187
Diffstat (limited to 'addressbook/gui/contact-list-editor/e-contact-list-editor.c')
-rw-r--r--addressbook/gui/contact-list-editor/e-contact-list-editor.c23
1 files changed, 20 insertions, 3 deletions
diff --git a/addressbook/gui/contact-list-editor/e-contact-list-editor.c b/addressbook/gui/contact-list-editor/e-contact-list-editor.c
index fd48e53af7..a8424814e0 100644
--- a/addressbook/gui/contact-list-editor/e-contact-list-editor.c
+++ b/addressbook/gui/contact-list-editor/e-contact-list-editor.c
@@ -789,16 +789,33 @@ add_email_cb (GtkWidget *w, EContactListEditor *editor)
}
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);
}