diff options
author | Christopher James Lahey <clahey@helixcode.com> | 2000-07-06 14:18:47 +0800 |
---|---|---|
committer | Chris Lahey <clahey@src.gnome.org> | 2000-07-06 14:18:47 +0800 |
commit | 19848dbc6d5c085289af80975e53395443d41ee2 (patch) | |
tree | 051f68510fdce778cc2499af21f53f02d282e599 /addressbook/gui/component/select-names/e-select-names-text-model.c | |
parent | af494c55837bf4d88c421ce6ce3f8378727998c7 (diff) | |
download | gsoc2013-evolution-19848dbc6d5c085289af80975e53395443d41ee2.tar.gz gsoc2013-evolution-19848dbc6d5c085289af80975e53395443d41ee2.tar.zst gsoc2013-evolution-19848dbc6d5c085289af80975e53395443d41ee2.zip |
Changed "FIXME: Save and Close" to "Save and Close". Removed some toolbar
2000-07-06 Christopher James Lahey <clahey@helixcode.com>
* contact-editor/e-contact-editor.c: Changed "FIXME: Save and
Close" to "Save and Close". Removed some toolbar items that will
never be used.
* gui/component/select-names/e-select-names-model.c,
gui/component/select-names/e-select-names-model.h: Added functions
to allow you to modify the model (not implemented yet.)
* gui/component/select-names/e-select-names-table-model.c,
gui/component/select-names/e-select-names-table-model.h: Finished
this. Doesn't support changing the model at all.
* gui/component/select-names/e-select-names-text-model.c: Finished
this. Changing the model by typing is done, but doesn't work
since none of the functions in the base model are implemented.
svn path=/trunk/; revision=3918
Diffstat (limited to 'addressbook/gui/component/select-names/e-select-names-text-model.c')
-rw-r--r-- | addressbook/gui/component/select-names/e-select-names-text-model.c | 64 |
1 files changed, 60 insertions, 4 deletions
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 db273796f3..abbbae3321 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 @@ -33,7 +33,7 @@ static void e_select_names_text_model_insert_length (ETextModel *model, gint po static void e_select_names_text_model_delete (ETextModel *model, gint position, gint length); static void e_select_names_text_model_model_changed (ESelectNamesModel *source, - ESelectNamesTextModel *model); + ESelectNamesTextModel *model); ETextModelClass *parent_class; @@ -111,27 +111,83 @@ e_select_names_text_model_class_init (ESelectNamesTextModelClass *klass) text_model_class->delete = e_select_names_text_model_delete; } +static int +get_length(EIterator *iterator) +{ + const ESelectNamesModelData *data = e_iterator_get(iterator); + return strlen(data->string); +} + static void e_select_names_text_model_set_text (ETextModel *model, gchar *text) { -#if 0 - e_select_names_model_clear(model); -#endif + ESelectNamesModel *source = E_SELECT_NAMES_TEXT_MODEL(model)->source; + EIterator *iterator = e_list_get_iterator(e_select_names_model_get_data(source)); + + e_iterator_reset(iterator); + e_select_names_model_replace(source, + iterator, + 0, + strlen(model->text), + text); } static void e_select_names_text_model_insert (ETextModel *model, gint position, gchar *text) { + ESelectNamesModel *source = E_SELECT_NAMES_TEXT_MODEL(model)->source; + EIterator *iterator = e_list_get_iterator(e_select_names_model_get_data(source)); + + 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); + } else { + position -= this_length; + } + } } static void e_select_names_text_model_insert_length (ETextModel *model, gint position, gchar *text, gint length) { + ESelectNamesModel *source = E_SELECT_NAMES_TEXT_MODEL(model)->source; + EIterator *iterator = e_list_get_iterator(e_select_names_model_get_data(source)); + + 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); + } else { + position -= this_length; + } + } } static void e_select_names_text_model_delete (ETextModel *model, gint position, gint length) { + ESelectNamesModel *source = E_SELECT_NAMES_TEXT_MODEL(model)->source; + EIterator *iterator = e_list_get_iterator(e_select_names_model_get_data(source)); + + 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_delete(source, + iterator, + position, + length); + } else { + position -= this_length; + } + } } static void |