From d369e177b199c4c798f0b6ad8972951d8586bcd9 Mon Sep 17 00:00:00 2001 From: Jon Trowbridge Date: Mon, 19 Feb 2001 22:49:18 +0000 Subject: When creating the entry, open up an ebook (corresponding to the local 2001-02-19 Jon Trowbridge * gui/component/select-names/e-select-names-manager.c (e_select_names_manager_create_entry): When creating the entry, open up an ebook (corresponding to the local addressbook) and make the entry use an EAddressCompletion. (completion_handler): Added; this is the actual completion handler, which manipulates the entry when the user selects something from the drop-down. * gui/component/select-names/e-select-names-model.c: Various hacks by clahey to unbreak e_select_names_model_add_item, e_select_names_model_replace_item (which I added) and e_select_names_model_remove_item. * gui/component/select-names/e-select-names-text-model.c (e_select_names_text_model_obj_count, e_select_names_text_model_get_nth_obj): Make chunks of text that correspond to ECards in the ESelectNamesModel be embedded objects. (e_select_names_text_model_activate_obj): On activation, pop up a contact editor for the embedded object's card. (e_select_names_text_model_model_changed): Fixed to work with ETextModel API changes. (e_select_names_text_model_set_text): Make const correct. (e_select_names_text_model_insert): Make const correct. (e_select_names_text_model_insert_length): Make const correct. * backend/ebook/e-address-completion.h, backend/ebook/e-address-completion.c: Added. EAddressCompletion is a derived class of ECompletion that does asynchronous address lookups for completions. svn path=/trunk/; revision=8282 --- .../component/select-names/e-select-names-model.c | 36 ++++++++++++++++++++-- 1 file changed, 34 insertions(+), 2 deletions(-) (limited to 'addressbook/gui/component/select-names/e-select-names-model.c') diff --git a/addressbook/gui/component/select-names/e-select-names-model.c b/addressbook/gui/component/select-names/e-select-names-model.c index 0bbbe588a6..735840d2b3 100644 --- a/addressbook/gui/component/select-names/e-select-names-model.c +++ b/addressbook/gui/component/select-names/e-select-names-model.c @@ -420,13 +420,45 @@ e_select_names_model_replace (ESelectNamesModel *model, gtk_object_unref(GTK_OBJECT(iterator)); } +static void +esnm_add_item_real (ESelectNamesModel *model, + EIterator *iterator, /* NULL for at the beginning. */ + gboolean before, + ESelectNamesModelData *data) +{ + if (iterator == NULL) + iterator = e_list_get_iterator(model->data); + else + gtk_object_ref(GTK_OBJECT(iterator)); + + e_iterator_insert(iterator, data, before); + + gtk_object_unref(GTK_OBJECT(iterator)); +} + +static void +esnm_remove_item_real (ESelectNamesModel *model, + EIterator *iterator) +{ + e_iterator_delete(iterator); +} void e_select_names_model_add_item (ESelectNamesModel *model, EIterator *iterator, /* NULL for at the beginning. */ ESelectNamesModelData *data) { - e_iterator_insert(iterator, data, FALSE); + esnm_add_item_real(model, iterator, FALSE, data); + e_select_names_model_changed(model); +} + +void +e_select_names_model_replace_item (ESelectNamesModel *model, + EIterator *iterator, + ESelectNamesModelData *data) +{ + esnm_remove_item_real(model, iterator); + esnm_add_item_real(model, iterator, FALSE, data); e_select_names_model_changed(model); } @@ -434,7 +466,7 @@ void e_select_names_model_remove_item (ESelectNamesModel *model, EIterator *iterator) { - e_iterator_delete(iterator); + esnm_remove_item_real(model, iterator); e_select_names_model_changed(model); } -- cgit v1.2.3