diff options
author | Christopher James Lahey <clahey@helixcode.com> | 2000-12-20 00:15:00 +0800 |
---|---|---|
committer | Chris Lahey <clahey@src.gnome.org> | 2000-12-20 00:15:00 +0800 |
commit | b5eefb58b7d43473425da80de0803b2f560b156f (patch) | |
tree | b8c7f45205cd0f808c88e68496c4a074b5a37614 /addressbook/gui | |
parent | dcd4f312232db7d391b1dd969f271f9a65c540c1 (diff) | |
download | gsoc2013-evolution-b5eefb58b7d43473425da80de0803b2f560b156f.tar gsoc2013-evolution-b5eefb58b7d43473425da80de0803b2f560b156f.tar.gz gsoc2013-evolution-b5eefb58b7d43473425da80de0803b2f560b156f.tar.bz2 gsoc2013-evolution-b5eefb58b7d43473425da80de0803b2f560b156f.tar.lz gsoc2013-evolution-b5eefb58b7d43473425da80de0803b2f560b156f.tar.xz gsoc2013-evolution-b5eefb58b7d43473425da80de0803b2f560b156f.tar.zst gsoc2013-evolution-b5eefb58b7d43473425da80de0803b2f560b156f.zip |
Made it so that if you select multiple contacts, the right click menu to
2000-12-19 Christopher James Lahey <clahey@helixcode.com>
* gui/widgets/e-addressbook-view.c (delete): Made it so that if
you select multiple contacts, the right click menu to delete
deletes them all.
svn path=/trunk/; revision=7080
Diffstat (limited to 'addressbook/gui')
-rw-r--r-- | addressbook/gui/widgets/e-addressbook-view.c | 62 |
1 files changed, 53 insertions, 9 deletions
diff --git a/addressbook/gui/widgets/e-addressbook-view.c b/addressbook/gui/widgets/e-addressbook-view.c index d5beb6e30b..816c83ca36 100644 --- a/addressbook/gui/widgets/e-addressbook-view.c +++ b/addressbook/gui/widgets/e-addressbook-view.c @@ -401,7 +401,9 @@ table_double_click(ETableScrolled *table, gint row, EAddressbookView *view) typedef struct { EBook *book; ECard *card; + EAddressbookView *view; GtkWidget *widget; + gpointer closure; } CardAndBook; static void @@ -409,6 +411,38 @@ card_and_book_free (CardAndBook *card_and_book) { gtk_object_unref(GTK_OBJECT(card_and_book->card)); gtk_object_unref(GTK_OBJECT(card_and_book->book)); + gtk_object_unref(GTK_OBJECT(card_and_book->view)); +} + +static void +get_card_list_1(gint model_row, + gpointer closure) +{ + CardAndBook *card_and_book; + GList **list; + EAddressbookView *view; + ECard *card; + + card_and_book = closure; + list = card_and_book->closure; + view = card_and_book->view; + + card = e_addressbook_model_get_card(E_ADDRESSBOOK_MODEL(view->object), model_row); + *list = g_list_prepend(*list, card); +} + +static GList * +get_card_list (CardAndBook *card_and_book) +{ + GList *list = NULL; + ETable *table; + + table = E_TABLE(card_and_book->widget); + card_and_book->closure = &list; + e_table_selected_row_foreach(table, + get_card_list_1, + card_and_book); + return list; } static void @@ -427,6 +461,7 @@ send_as (GtkWidget *widget, CardAndBook *card_and_book) static void send_to (GtkWidget *widget, CardAndBook *card_and_book) + { e_card_send(card_and_book->card, E_CARD_DISPOSITION_AS_TO); card_and_book_free(card_and_book); @@ -450,11 +485,17 @@ static void delete (GtkWidget *widget, CardAndBook *card_and_book) { if (e_contact_editor_confirm_delete(GTK_WINDOW(gtk_widget_get_toplevel(card_and_book->widget)))) { - /* Add the card in the contact editor to our ebook */ - e_book_remove_card (card_and_book->book, - card_and_book->card, - NULL, - NULL); + GList *list = get_card_list(card_and_book); + GList *iterator; + for (iterator = list; iterator; iterator = iterator->next) { + ECard *card = iterator->data; + /* Add the card in the contact editor to our ebook */ + e_book_remove_card (card_and_book->book, + card, + NULL, + NULL); + } + e_free_object_list(list); } card_and_book_free(card_and_book); } @@ -465,7 +506,7 @@ table_right_click(ETableScrolled *table, gint row, gint col, GdkEvent *event, EA if (E_IS_ADDRESSBOOK_MODEL(view->object)) { EAddressbookModel *model = E_ADDRESSBOOK_MODEL(view->object); CardAndBook *card_and_book; - + EPopupMenu menu[] = { {"Save as VCard", NULL, GTK_SIGNAL_FUNC(save_as), NULL, 0}, {"Send contact to other", NULL, GTK_SIGNAL_FUNC(send_as), NULL, 0}, @@ -475,21 +516,24 @@ table_right_click(ETableScrolled *table, gint row, gint col, GdkEvent *event, EA {"Delete", NULL, GTK_SIGNAL_FUNC(delete), NULL, 0}, {NULL, NULL, NULL, NULL, 0} }; - + card_and_book = g_new(CardAndBook, 1); card_and_book->card = e_addressbook_model_get_card(model, row); card_and_book->widget = GTK_WIDGET(table); + card_and_book->view = view; gtk_object_get(GTK_OBJECT(model), "book", &(card_and_book->book), NULL); - + gtk_object_ref(GTK_OBJECT(card_and_book->book)); - + gtk_object_ref(GTK_OBJECT(card_and_book->view)); + e_popup_menu_run (menu, (GdkEventButton *)event, 0, 0, card_and_book); return TRUE; } else return FALSE; } + #define SPEC "<?xml version=\"1.0\"?> \ <ETableSpecification click-to-add=\"true\" draw-grid=\"true\" _click-to-add-message=\"* Click here to add a contact *\"> \ <ETableColumn model_col= \"0\" _title=\"Name\" expansion=\"1.0\" minimum_width=\"20\" resizable=\"true\" cell=\"string\" compare=\"string\"/> \ |