aboutsummaryrefslogtreecommitdiffstats
path: root/addressbook/gui/component/select-names/e-select-names-model.c
diff options
context:
space:
mode:
authorChristopher James Lahey <clahey@helixcode.com>2000-07-08 07:18:12 +0800
committerChris Lahey <clahey@src.gnome.org>2000-07-08 07:18:12 +0800
commit5e793d76f46de7aa61a7e4d738c7753424041ec8 (patch)
tree269a91190cc4d9d3db3b9ad1017d16f45f10721f /addressbook/gui/component/select-names/e-select-names-model.c
parentfffc023e64825d6488fa3d1827fe50d924af3535 (diff)
downloadgsoc2013-evolution-5e793d76f46de7aa61a7e4d738c7753424041ec8.tar
gsoc2013-evolution-5e793d76f46de7aa61a7e4d738c7753424041ec8.tar.gz
gsoc2013-evolution-5e793d76f46de7aa61a7e4d738c7753424041ec8.tar.bz2
gsoc2013-evolution-5e793d76f46de7aa61a7e4d738c7753424041ec8.tar.lz
gsoc2013-evolution-5e793d76f46de7aa61a7e4d738c7753424041ec8.tar.xz
gsoc2013-evolution-5e793d76f46de7aa61a7e4d738c7753424041ec8.tar.zst
gsoc2013-evolution-5e793d76f46de7aa61a7e4d738c7753424041ec8.zip
Implemented the get_cards function.
2000-07-07 Christopher James Lahey <clahey@helixcode.com> * gui/component/select-names/e-select-names-manager.c, gui/component/select-names/e-select-names-model.c: Implemented the get_cards function. * gui/component/select-names/e-select-names.c: Implemented adding cards through the interface. svn path=/trunk/; revision=3966
Diffstat (limited to 'addressbook/gui/component/select-names/e-select-names-model.c')
-rw-r--r--addressbook/gui/component/select-names/e-select-names-model.c44
1 files changed, 43 insertions, 1 deletions
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 98745523a1..c131c4d66f 100644
--- a/addressbook/gui/component/select-names/e-select-names-model.c
+++ b/addressbook/gui/component/select-names/e-select-names-model.c
@@ -14,6 +14,7 @@
#include "e-select-names-model.h"
#include "e-util/e-util.h"
+#include "addressbook/backend/ebook/e-card-simple.h"
enum {
E_SELECT_NAMES_MODEL_CHANGED,
@@ -189,10 +190,47 @@ e_select_names_model_init (ESelectNamesModel *model)
model->data = e_list_new(data_copy, data_free, model);
}
+static void *
+copy_func(const void *data, void *user_data)
+{
+ GtkObject *object = (void *) data;
+ if (object)
+ gtk_object_ref(object);
+ return object;
+}
+
+static void
+free_func(void *data, void *user_data)
+{
+ GtkObject *object = data;
+ if (object)
+ gtk_object_unref(object);
+}
+
/* Of type ECard */
EList *e_select_names_model_get_cards (ESelectNamesModel *model)
{
- return NULL;
+ EList *list = e_list_new(copy_func, free_func, NULL);
+ EIterator *iterator = e_list_get_iterator(model->data);
+ EIterator *new_iterator = e_list_get_iterator(list);
+
+ for (e_iterator_reset(iterator); e_iterator_is_valid(iterator); e_iterator_next(iterator)) {
+ ESelectNamesModelData *node = (void *) e_iterator_get(iterator);
+ ECard *card;
+ ECardSimple *simple;
+ if (node->card) {
+ card = node->card;
+ gtk_object_ref(GTK_OBJECT(card));
+ } else {
+ card = e_card_new("");
+ }
+ simple = e_card_simple_new(card);
+ e_card_simple_set_arbitrary(simple, "text_version", "string", node->string);
+ e_iterator_insert(new_iterator, card, FALSE);
+ gtk_object_unref(GTK_OBJECT(card));
+ gtk_object_unref(GTK_OBJECT(simple));
+ }
+ return list;
}
EList *e_select_names_model_get_data (ESelectNamesModel *model)
@@ -351,12 +389,16 @@ e_select_names_model_add_item (ESelectNamesModel *model,
EIterator *iterator, /* NULL for at the beginning. */
ESelectNamesModelData *data)
{
+ e_iterator_insert(iterator, data, FALSE);
+ e_select_names_model_changed(model);
}
void
e_select_names_model_remove_item (ESelectNamesModel *model,
EIterator *iterator)
{
+ e_iterator_delete(iterator);
+ e_select_names_model_changed(model);
}