diff options
author | Jon Trowbridge <trow@ximian.com> | 2001-03-31 14:52:11 +0800 |
---|---|---|
committer | Jon Trowbridge <trow@src.gnome.org> | 2001-03-31 14:52:11 +0800 |
commit | e51bb13fc41584414bdb78cf2ea3d1c86d01133f (patch) | |
tree | d56c68435010e185a40ba7a45e8b21901917823b /addressbook | |
parent | 0cdb4fef03126fa4220ff00ab4a85be48c594281 (diff) | |
download | gsoc2013-evolution-e51bb13fc41584414bdb78cf2ea3d1c86d01133f.tar.gz gsoc2013-evolution-e51bb13fc41584414bdb78cf2ea3d1c86d01133f.tar.zst gsoc2013-evolution-e51bb13fc41584414bdb78cf2ea3d1c86d01133f.zip |
Call e_select_names_model_clean after adding address. This should deal
2001-03-31 Jon Trowbridge <trow@ximian.com>
* gui/component/select-names/e-select-names.c
(real_add_address_cb): Call e_select_names_model_clean after
adding address. This should deal with the bug reports related
to stray commas.
* gui/component/select-names/e-select-names-model.c
(e_select_names_model_clean): Added. Remove all empty destinations.
* backend/ebook/e-destination.c (e_destination_is_empty): Added. Check
if an EDestination is in essentially a null state.
svn path=/trunk/; revision=9067
Diffstat (limited to 'addressbook')
-rw-r--r-- | addressbook/ChangeLog | 13 | ||||
-rw-r--r-- | addressbook/backend/ebook/e-destination.c | 8 | ||||
-rw-r--r-- | addressbook/backend/ebook/e-destination.h | 2 | ||||
-rw-r--r-- | addressbook/gui/component/select-names/e-select-names-model.c | 33 | ||||
-rw-r--r-- | addressbook/gui/component/select-names/e-select-names-model.h | 2 | ||||
-rw-r--r-- | addressbook/gui/component/select-names/e-select-names.c | 1 |
6 files changed, 58 insertions, 1 deletions
diff --git a/addressbook/ChangeLog b/addressbook/ChangeLog index d3e8385f19..57ad3c492b 100644 --- a/addressbook/ChangeLog +++ b/addressbook/ChangeLog @@ -1,3 +1,16 @@ +2001-03-31 Jon Trowbridge <trow@ximian.com> + + * gui/component/select-names/e-select-names.c + (real_add_address_cb): Call e_select_names_model_clean after + adding address. This should deal with the bug reports related + to stray commas. + + * gui/component/select-names/e-select-names-model.c + (e_select_names_model_clean): Added. Remove all empty destinations. + + * backend/ebook/e-destination.c (e_destination_is_empty): Added. Check + if an EDestination is in essentially a null state. + 2001-03-30 Christopher James Lahey <clahey@ximian.com> * backend/pas/pas-backend-file.c (pas_backend_file_add_client): diff --git a/addressbook/backend/ebook/e-destination.c b/addressbook/backend/ebook/e-destination.c index 3b7ad60189..a44ce3ddc8 100644 --- a/addressbook/backend/ebook/e-destination.c +++ b/addressbook/backend/ebook/e-destination.c @@ -126,6 +126,14 @@ e_destination_copy (EDestination *dest) return new_dest; } +gboolean +e_destination_is_empty (EDestination *dest) +{ + g_return_val_if_fail (dest && E_IS_DESTINATION (dest), TRUE); + + return !(dest->priv->card || (dest->priv->string && *dest->priv->string)); +} + static void e_destination_clear_card (EDestination *dest) { diff --git a/addressbook/backend/ebook/e-destination.h b/addressbook/backend/ebook/e-destination.h index 618cfdb458..d0af6b0d23 100644 --- a/addressbook/backend/ebook/e-destination.h +++ b/addressbook/backend/ebook/e-destination.h @@ -57,6 +57,8 @@ GtkType e_destination_get_type (void); EDestination *e_destination_new (void); EDestination *e_destination_copy (EDestination *); +gboolean e_destination_is_empty (EDestination *); + void e_destination_set_card (EDestination *, ECard *card, gint email_num); void e_destination_set_string (EDestination *, const gchar *string); 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 5dd11496d2..59d7bc7c24 100644 --- a/addressbook/gui/component/select-names/e-select-names-model.c +++ b/addressbook/gui/component/select-names/e-select-names-model.c @@ -433,9 +433,40 @@ e_select_names_model_delete (ESelectNamesModel *model, gint index) } void +e_select_names_model_clean (ESelectNamesModel *model) +{ + GList *iter, *next; + gboolean changed = FALSE; + + g_return_if_fail (model != NULL && E_IS_SELECT_NAMES_MODEL (model)); + + iter = model->priv->data; + + while (iter) { + EDestination *dest; + + next = g_list_next (iter); + dest = iter->data ? E_DESTINATION (iter->data) : NULL; + + if (dest == NULL || e_destination_is_empty (dest)) { + if (dest) + gtk_object_unref (GTK_OBJECT (dest)); + model->priv->data = g_list_remove_link (model->priv->data, iter); + g_list_free_1 (iter); + changed = TRUE; + } + + iter = next; + } + + if (changed) + e_select_names_model_changed (model); +} + +void e_select_names_model_delete_all (ESelectNamesModel *model) { - g_return_if_fail (model != NULL); + g_return_if_fail (model != NULL && E_IS_SELECT_NAMES_MODEL (model)); g_list_foreach (model->priv->data, (GFunc) gtk_object_unref, NULL); g_list_free (model->priv->data); diff --git a/addressbook/gui/component/select-names/e-select-names-model.h b/addressbook/gui/component/select-names/e-select-names-model.h index 9d8c66f063..ab7477762c 100644 --- a/addressbook/gui/component/select-names/e-select-names-model.h +++ b/addressbook/gui/component/select-names/e-select-names-model.h @@ -59,6 +59,8 @@ void e_select_names_model_replace (ESelectNamesModel *model, gint in void e_select_names_model_delete (ESelectNamesModel *model, gint index); void e_select_names_model_delete_all (ESelectNamesModel *model); +void e_select_names_model_clean (ESelectNamesModel *model); + void e_select_names_model_name_pos (ESelectNamesModel *model, gint index, gint *pos, gint *length); void e_select_names_model_text_pos (ESelectNamesModel *model, gint pos, gint *index, gint *start_pos, gint *length); diff --git a/addressbook/gui/component/select-names/e-select-names.c b/addressbook/gui/component/select-names/e-select-names.c index cbe9624be7..30dc482e85 100644 --- a/addressbook/gui/component/select-names/e-select-names.c +++ b/addressbook/gui/component/select-names/e-select-names.c @@ -149,6 +149,7 @@ real_add_address_cb (int model_row, e_select_names_model_insert (child->source, e_select_names_model_count (child->source), dest); + e_select_names_model_clean (child->source); gtk_object_unref(GTK_OBJECT(card)); } |