diff options
author | Christopher James Lahey <clahey@helixcode.com> | 2000-07-08 02:37:43 +0800 |
---|---|---|
committer | Chris Lahey <clahey@src.gnome.org> | 2000-07-08 02:37:43 +0800 |
commit | cf61f7c4dd6f445be551bea4b55e7902edf4a816 (patch) | |
tree | 318ef66d98dbbd186310f71fefcc35cbd9812045 /addressbook/gui/component | |
parent | fc43959180e0ab748ba68fa4834e6913f2aba74e (diff) | |
download | gsoc2013-evolution-cf61f7c4dd6f445be551bea4b55e7902edf4a816.tar.gz gsoc2013-evolution-cf61f7c4dd6f445be551bea4b55e7902edf4a816.tar.zst gsoc2013-evolution-cf61f7c4dd6f445be551bea4b55e7902edf4a816.zip |
Make the entry widgets we create editable.
2000-07-07 Christopher James Lahey <clahey@helixcode.com>
* gui/component/select-names/e-select-names-manager.c: Make the
entry widgets we create editable.
* gui/component/select-names/e-select-names-model.c: Use
e_strsplit instead of g_strsplit. Fixed an off by 1 error.
* gui/component/select-names/e-select-names-table-model.c: When
the model changes, send a model changed signal.
* gui/component/select-names/e-select-names-text-model.c: Made
changing this work correctly if it's empty. Made change signals
propagate properly. Is a bit better about freeing iterators when
done.
* gui/component/select-names/e-select-names.c: Made the finished
lists be in order instead of being sorted.
svn path=/trunk/; revision=3955
Diffstat (limited to 'addressbook/gui/component')
5 files changed, 45 insertions, 12 deletions
diff --git a/addressbook/gui/component/select-names/e-select-names-manager.c b/addressbook/gui/component/select-names/e-select-names-manager.c index 2eea09f985..4b0d65902e 100644 --- a/addressbook/gui/component/select-names/e-select-names-manager.c +++ b/addressbook/gui/component/select-names/e-select-names-manager.c @@ -209,6 +209,7 @@ GtkWidget *e_select_names_manager_create_entry ( model = e_select_names_text_model_new(section->model); gtk_object_set(GTK_OBJECT(entry), "model", model, + "editable", TRUE, NULL); return entry; } 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 5bf9562646..98745523a1 100644 --- a/addressbook/gui/component/select-names/e-select-names-model.c +++ b/addressbook/gui/component/select-names/e-select-names-model.c @@ -13,6 +13,7 @@ #include <gtk/gtk.h> #include "e-select-names-model.h" +#include "e-util/e-util.h" enum { E_SELECT_NAMES_MODEL_CHANGED, @@ -212,7 +213,7 @@ e_select_names_model_insert (ESelectNamesModel *model, int index, char *data) { - gchar **strings = g_strsplit(data, ",", -1); + gchar **strings = e_strsplit(data, ",", -1); int i; if (iterator == NULL) { ESelectNamesModelData new = {E_SELECT_NAMES_MODEL_DATA_TYPE_STRING_ADDRESS, NULL, ""}; @@ -228,7 +229,7 @@ e_select_names_model_insert (ESelectNamesModel *model, g_free(node->string); node->string = temp; } - for (i = 0; strings[i]; i++) { + for (i = 1; strings[i]; i++) { ESelectNamesModelData *node = (void *) e_iterator_get(iterator); gchar *temp = g_strdup_printf("%.*s", index, node->string); gchar *temp2 = g_strdup_printf("%s%s", strings[0], node->string + index); diff --git a/addressbook/gui/component/select-names/e-select-names-table-model.c b/addressbook/gui/component/select-names/e-select-names-table-model.c index 2109eea0a0..b6e13bf81b 100644 --- a/addressbook/gui/component/select-names/e-select-names-table-model.c +++ b/addressbook/gui/component/select-names/e-select-names-table-model.c @@ -263,6 +263,7 @@ e_select_names_table_model_model_changed (ESelectNamesModel *source, ESelectNamesTableModel *model) { clear_info(model); + e_table_model_changed(E_TABLE_MODEL(model)); } /* Set_arg handler for the model */ diff --git a/addressbook/gui/component/select-names/e-select-names-text-model.c b/addressbook/gui/component/select-names/e-select-names-text-model.c index 3838e974f6..dd28a50239 100644 --- a/addressbook/gui/component/select-names/e-select-names-text-model.c +++ b/addressbook/gui/component/select-names/e-select-names-text-model.c @@ -125,11 +125,17 @@ e_select_names_text_model_set_text (ETextModel *model, gchar *text) EIterator *iterator = e_list_get_iterator(e_select_names_model_get_data(source)); e_iterator_reset(iterator); + if (!e_iterator_is_valid(iterator)) { + gtk_object_unref(GTK_OBJECT(iterator)); + iterator = NULL; + } e_select_names_model_replace(source, iterator, 0, strlen(model->text), text); + if (iterator) + gtk_object_unref(GTK_OBJECT(iterator)); } static void @@ -141,14 +147,21 @@ e_select_names_text_model_insert (ETextModel *model, gint position, gchar for (e_iterator_reset(iterator); e_iterator_is_valid(iterator); e_iterator_next(iterator)) { int this_length = get_length(iterator); if (position <= this_length) { - e_select_names_model_insert(source, - iterator, - position, - text); + break; } else { position -= this_length + 1; } } + if (!e_iterator_is_valid(iterator)) { + gtk_object_unref(GTK_OBJECT(iterator)); + iterator = NULL; + } + e_select_names_model_insert(source, + iterator, + position, + text); + if (iterator) + gtk_object_unref(GTK_OBJECT(iterator)); } static void @@ -160,16 +173,22 @@ e_select_names_text_model_insert_length (ETextModel *model, gint position, gchar for (e_iterator_reset(iterator); e_iterator_is_valid(iterator); e_iterator_next(iterator)) { int this_length = get_length(iterator); if (position <= this_length) { - e_select_names_model_insert_length(source, - iterator, - position, - text, - length); break; } else { position -= this_length + 1; } } + if (!e_iterator_is_valid(iterator)) { + gtk_object_unref(GTK_OBJECT(iterator)); + iterator = NULL; + } + e_select_names_model_insert_length(source, + iterator, + position, + text, + length); + if (iterator) + gtk_object_unref(GTK_OBJECT(iterator)); } static void @@ -190,6 +209,8 @@ e_select_names_text_model_delete (ETextModel *model, gint position, gint position -= this_length + 1; } } + if (iterator) + gtk_object_unref(GTK_OBJECT(iterator)); } static void @@ -233,6 +254,7 @@ e_select_names_text_model_model_changed (ESelectNamesModel *source, *lengthsp = -1; g_free(E_TEXT_MODEL(model)->text); E_TEXT_MODEL(model)->text = string; + e_text_model_changed(E_TEXT_MODEL(model)); } diff --git a/addressbook/gui/component/select-names/e-select-names.c b/addressbook/gui/component/select-names/e-select-names.c index b5e366a953..646321694f 100644 --- a/addressbook/gui/component/select-names/e-select-names.c +++ b/addressbook/gui/component/select-names/e-select-names.c @@ -103,6 +103,14 @@ e_select_names_class_init (ESelectNamesClass *klass) <grouping> <leaf column=\"0\" ascending=\"1\"/> </grouping> \ </ETableSpecification>" +#define SPEC2 "<ETableSpecification no-header=\"1\"> \ + <columns-shown> \ + <column> 0 </column> \ + <column> 2 </column> \ + </columns-shown> \ + <grouping> </grouping> \ +</ETableSpecification>" + GtkWidget *e_addressbook_create_ebook_table(char *name, char *string1, char *string2, int num1, int num2); static void @@ -294,7 +302,7 @@ e_select_names_add_section(ESelectNames *e_select_names, char *name, char *id, E cell_left_just = e_cell_text_new (model, NULL, GTK_JUSTIFY_LEFT); e_table_header_add_column (header, e_table_col_new (0, "Full Name", 1.0, 20, cell_left_just, g_str_compare, TRUE), 0); - etable = e_table_new (header, model, SPEC); + etable = e_table_new (header, model, SPEC2); child->model = model; gtk_object_ref(GTK_OBJECT(child->model)); |