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-09 09:24:53 +0800
committerChris Lahey <clahey@src.gnome.org>2000-07-09 09:24:53 +0800
commita451a634c20ffb820fd07700b9bb88fbd29df2b9 (patch)
treeeaaa372f989cdb74eb7685b3f80cb10d08c88ae0 /addressbook/gui/component/select-names/e-select-names-model.c
parent1150b8d1b3f6691ea50eeb768216838311f7b7c6 (diff)
downloadgsoc2013-evolution-a451a634c20ffb820fd07700b9bb88fbd29df2b9.tar
gsoc2013-evolution-a451a634c20ffb820fd07700b9bb88fbd29df2b9.tar.gz
gsoc2013-evolution-a451a634c20ffb820fd07700b9bb88fbd29df2b9.tar.bz2
gsoc2013-evolution-a451a634c20ffb820fd07700b9bb88fbd29df2b9.tar.lz
gsoc2013-evolution-a451a634c20ffb820fd07700b9bb88fbd29df2b9.tar.xz
gsoc2013-evolution-a451a634c20ffb820fd07700b9bb88fbd29df2b9.tar.zst
gsoc2013-evolution-a451a634c20ffb820fd07700b9bb88fbd29df2b9.zip
Include e-select-names-factory.h.
2000-07-08 Christopher James Lahey <clahey@helixcode.com> * gui/component/addressbook-factory.c: Include e-select-names-factory.h. * gui/component/select-names/e-select-names-model.c: Handle a NULL iterator properly in the replace function. * gui/component/select-names/e-select-names-table-model.c: Fill in info properly in the value_at function. * gui/component/select-names/e-select-names-text-model.c: Don't strlen a NULL text object. * gui/component/select-names/e-select-names.c: Close if the person hits ok or cancel (doesn't yet actually undo changes if Cancel is hit.) Handle removing addresses when they're double clicked on. * gui/component/select-names/select-names.glade, gui/component/select-names/select-names.glade.h: Hid some unused fields and changed the text at the top of the dialog. svn path=/trunk/; revision=3989
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.c21
1 files changed, 19 insertions, 2 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 c131c4d66f..94fb3d980a 100644
--- a/addressbook/gui/component/select-names/e-select-names-model.c
+++ b/addressbook/gui/component/select-names/e-select-names-model.c
@@ -260,6 +260,8 @@ e_select_names_model_insert (ESelectNamesModel *model,
iterator = e_list_get_iterator(model->data);
index = 0;
+ } else {
+ gtk_object_ref(GTK_OBJECT(iterator));
}
if (strings[0]) {
ESelectNamesModelData *node = (void *) e_iterator_get(iterator);
@@ -288,6 +290,7 @@ e_select_names_model_insert (ESelectNamesModel *model,
g_free(node);
}
e_select_names_model_changed(model);
+ gtk_object_unref(GTK_OBJECT(iterator));
}
void
@@ -347,6 +350,16 @@ e_select_names_model_replace (ESelectNamesModel *model,
int length,
char *data)
{
+ if (iterator == NULL) {
+ ESelectNamesModelData new = {E_SELECT_NAMES_MODEL_DATA_TYPE_STRING_ADDRESS, NULL, ""};
+
+ e_list_append(model->data, &new);
+ iterator = e_list_get_iterator(model->data);
+
+ index = 0;
+ } else {
+ gtk_object_ref(GTK_OBJECT(iterator));
+ }
while (length > 0 && e_iterator_is_valid(iterator)) {
ESelectNamesModelData *node = (void *) e_iterator_get(iterator);
int this_length = strlen(node->string);
@@ -377,10 +390,14 @@ e_select_names_model_replace (ESelectNamesModel *model,
if (!e_iterator_is_valid(iterator)) {
ESelectNamesModelData *node;
e_iterator_last(iterator);
- node = (void *) e_iterator_get(iterator);
- index = strlen(node->string);
+ if (e_iterator_is_valid(iterator)) {
+ node = (void *) e_iterator_get(iterator);
+ index = strlen(node->string);
+ } else
+ index = 0;
}
e_select_names_model_insert (model, iterator, index, data);
+ gtk_object_unref(GTK_OBJECT(iterator));
}