From a66943ec821cda5eaef68ea8ecc07d3593dda893 Mon Sep 17 00:00:00 2001 From: Chris Toshok Date: Sun, 23 Mar 2003 09:18:04 +0000 Subject: [ fixes bug #32113 ] add include_email arg to e_destination_get_textrep. 2003-03-23 Chris Toshok [ fixes bug #32113 ] * backend/ebook/e-destination.h: add include_email arg to e_destination_get_textrep. * backend/ebook/e-destination.c (e_destination_get_textrep): add include_email arg. if it's TRUE, and if there's an email address to add * gui/contact-list-editor/e-contact-list-model.c (contact_list_value_at): use e_destination_get_textrep so we don't display QP text, and pass TRUE for include_email. * gui/widgets/e-minicard.c (add_field): same. (remodel): same. * gui/widgets/e-addressbook-treeview-adapter.c (adapter_get_value): same. * gui/widgets/e-addressbook-table-adapter.c (addressbook_value_at): same. * gui/component/select-names/e-select-names-text-model.c (e_select_names_text_model_insert_length): pass FALSE for include_email. * gui/component/select-names/e-select-names-model.c (e_select_names_model_get_textification): pass FALSE for include_email. (e_select_names_model_get_string): same. (e_select_names_model_replace): same. (e_select_names_model_name_pos): same. (e_select_names_model_text_pos): same. svn path=/trunk/; revision=20467 --- addressbook/ChangeLog | 33 ++++++++++++++++++++++ addressbook/backend/ebook/e-destination.c | 12 ++++---- addressbook/backend/ebook/e-destination.h | 4 +-- .../component/select-names/e-select-names-model.c | 12 ++++---- .../select-names/e-select-names-text-model.c | 2 +- .../gui/contact-list-editor/e-contact-list-model.c | 2 +- .../gui/widgets/e-addressbook-table-adapter.c | 2 +- .../gui/widgets/e-addressbook-treeview-adapter.c | 2 +- addressbook/gui/widgets/e-minicard.c | 4 +-- 9 files changed, 53 insertions(+), 20 deletions(-) (limited to 'addressbook') diff --git a/addressbook/ChangeLog b/addressbook/ChangeLog index 063e66bcd8..017371d6a3 100644 --- a/addressbook/ChangeLog +++ b/addressbook/ChangeLog @@ -1,3 +1,36 @@ +2003-03-23 Chris Toshok + + [ fixes bug #32113 ] + * backend/ebook/e-destination.h: add include_email arg to + e_destination_get_textrep. + + * backend/ebook/e-destination.c (e_destination_get_textrep): add + include_email arg. if it's TRUE, and if there's an email address to + add + + * gui/contact-list-editor/e-contact-list-model.c + (contact_list_value_at): use e_destination_get_textrep so we don't + display QP text, and pass TRUE for include_email. + + * gui/widgets/e-minicard.c (add_field): same. + (remodel): same. + + * gui/widgets/e-addressbook-treeview-adapter.c (adapter_get_value): same. + + * gui/widgets/e-addressbook-table-adapter.c (addressbook_value_at): same. + + * gui/component/select-names/e-select-names-text-model.c + (e_select_names_text_model_insert_length): pass FALSE for + include_email. + + * gui/component/select-names/e-select-names-model.c + (e_select_names_model_get_textification): pass FALSE for + include_email. + (e_select_names_model_get_string): same. + (e_select_names_model_replace): same. + (e_select_names_model_name_pos): same. + (e_select_names_model_text_pos): same. + 2003-03-19 Ettore Perazzoli * backend/ebook/GNOME_Evolution_Addressbook_VCard_Importer.server.in.in: diff --git a/addressbook/backend/ebook/e-destination.c b/addressbook/backend/ebook/e-destination.c index 87c3d83ee3..a746fd9cf9 100644 --- a/addressbook/backend/ebook/e-destination.c +++ b/addressbook/backend/ebook/e-destination.c @@ -263,7 +263,7 @@ e_destination_clear_card (EDestination *dest) dest->priv->old_card_email_num = dest->priv->card_email_num; g_free (dest->priv->old_textrep); - dest->priv->old_textrep = g_strdup (e_destination_get_textrep (dest)); + dest->priv->old_textrep = g_strdup (e_destination_get_textrep (dest, FALSE)); } g_free (dest->priv->book_uri); @@ -837,7 +837,7 @@ e_destination_set_raw (EDestination *dest, const gchar *raw) } const gchar * -e_destination_get_textrep (const EDestination *dest) +e_destination_get_textrep (const EDestination *dest, gboolean include_email) { const char *name, *email; @@ -849,7 +849,7 @@ e_destination_get_textrep (const EDestination *dest) name = e_destination_get_name (dest); email = e_destination_get_email (dest); - if (e_destination_from_card (dest) && name != NULL) + if (e_destination_from_card (dest) && name != NULL && (!include_email || !email || !*email)) return name; /* Make sure that our address gets quoted properly */ @@ -1005,7 +1005,7 @@ nickname_simple_query_cb (EBook *book, EBookSimpleQueryStatus status, const GLis we do a name-only query on the textrep */ e_book_name_and_email_query (book, - e_destination_get_textrep (dest), + e_destination_get_textrep (dest, FALSE), NULL, name_and_email_simple_query_cb, dest); @@ -1022,7 +1022,7 @@ launch_cardify_query (EDestination *dest) if (! e_destination_is_valid (dest)) { /* If it doesn't look like an e-mail address, see if it is a nickname. */ e_book_nickname_query (dest->priv->cardify_book, - e_destination_get_textrep (dest), + e_destination_get_textrep (dest, FALSE), nickname_simple_query_cb, dest); @@ -1058,7 +1058,7 @@ e_destination_reverting_is_a_good_idea (EDestination *dest) if (dest->priv->old_textrep == NULL) return FALSE; - textrep = e_destination_get_textrep (dest); + textrep = e_destination_get_textrep (dest, FALSE); len = g_utf8_strlen (textrep, -1); old_len = g_utf8_strlen (dest->priv->old_textrep, -1); diff --git a/addressbook/backend/ebook/e-destination.h b/addressbook/backend/ebook/e-destination.h index eb8257fb12..acd6af1bc4 100644 --- a/addressbook/backend/ebook/e-destination.h +++ b/addressbook/backend/ebook/e-destination.h @@ -96,10 +96,10 @@ gint e_destination_get_email_num (const EDestination *); const gchar *e_destination_get_name (const EDestination *); /* "Jane Smith" */ const gchar *e_destination_get_email (const EDestination *); /* "jane@assbarn.com" */ -const gchar *e_destination_get_address (const EDestination *); /* "Jane Smith " (or a comma-sep set of such for a list) */ +const gchar *e_destination_get_address (const EDestination *);; /* "Jane Smith " (or a comma-sep set of such for a list) */ void e_destination_set_raw (EDestination *, const gchar *free_form_string); -const gchar *e_destination_get_textrep (const EDestination *); /* "Jane Smith" or "jane@assbarn.com" */ +const gchar *e_destination_get_textrep (const EDestination *, gboolean include_email); /* "Jane Smith" or "jane@assbarn.com" */ gboolean e_destination_is_evolution_list (const EDestination *); gboolean e_destination_list_show_addresses (const EDestination *); 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 4c99d68f22..595b4a257e 100644 --- a/addressbook/gui/component/select-names/e-select-names-model.c +++ b/addressbook/gui/component/select-names/e-select-names-model.c @@ -213,7 +213,7 @@ e_select_names_model_get_textification (ESelectNamesModel *model, const char *se while (iter) { EDestination *dest = E_DESTINATION (iter->data); - strv[i] = (gchar *) e_destination_get_textrep (dest); + strv[i] = (gchar *) e_destination_get_textrep (dest, FALSE); ++i; iter = g_list_next (iter); } @@ -393,7 +393,7 @@ e_select_names_model_get_string (ESelectNamesModel *model, gint index) dest = e_select_names_model_get_destination (model, index); - return dest ? e_destination_get_textrep (dest) : ""; + return dest ? e_destination_get_textrep (dest, FALSE) : ""; } static void @@ -483,7 +483,7 @@ e_select_names_model_replace (ESelectNamesModel *model, gint index, EDestination g_return_if_fail (model->priv->data == NULL || (0 <= index && index < g_list_length (model->priv->data))); g_return_if_fail (dest && E_IS_DESTINATION (dest)); - new_str = e_destination_get_textrep (dest); + new_str = e_destination_get_textrep (dest, FALSE); new_strlen = new_str ? strlen (new_str) : 0; if (model->priv->data == NULL) { @@ -502,7 +502,7 @@ e_select_names_model_replace (ESelectNamesModel *model, gint index, EDestination disconnect_destination (model, E_DESTINATION (node->data)); connect_destination (model, dest); - old_str = e_destination_get_textrep (E_DESTINATION (node->data)); + old_str = e_destination_get_textrep (E_DESTINATION (node->data), FALSE); old_strlen = old_str ? strlen (old_str) : 0; g_object_unref (node->data); @@ -649,7 +649,7 @@ e_select_names_model_name_pos (ESelectNamesModel *model, gint seplen, gint index iter = model->priv->data; while (iter && i <= index) { rp += len + (i > 0 ? seplen : 0); - str = e_destination_get_textrep (E_DESTINATION (iter->data)); + str = e_destination_get_textrep (E_DESTINATION (iter->data), FALSE); len = str ? strlen (str) : 0; ++i; iter = g_list_next (iter); @@ -679,7 +679,7 @@ e_select_names_model_text_pos (ESelectNamesModel *model, gint seplen, gint pos, iter = model->priv->data; while (iter != NULL) { - str = e_destination_get_textrep (E_DESTINATION (iter->data)); + str = e_destination_get_textrep (E_DESTINATION (iter->data), FALSE); len = str ? strlen (str) : 0; if (sp <= pos && pos <= sp + len + adj) { 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 1fbc0aa7fd..269e0599a3 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 @@ -367,7 +367,7 @@ e_select_names_text_model_insert_length (ETextModel *model, gint pos, const gcha if (text[i] == *text_model->sep && index >= 0) { /* Is this a quoted or an unquoted separator we are dealing with? */ const EDestination *dest = e_select_names_model_get_destination (source, index); if (dest) { - const gchar *str = e_destination_get_textrep (dest); + const gchar *str = e_destination_get_textrep (dest, FALSE); gint j; if (out) fprintf (out, "str=%s pos=%d\n", str, pos); diff --git a/addressbook/gui/contact-list-editor/e-contact-list-model.c b/addressbook/gui/contact-list-editor/e-contact-list-model.c index 971b1a58e2..6e8357d93c 100644 --- a/addressbook/gui/contact-list-editor/e-contact-list-model.c +++ b/addressbook/gui/contact-list-editor/e-contact-list-model.c @@ -30,7 +30,7 @@ contact_list_value_at (ETableModel *etc, int col, int row) { EContactListModel *model = E_CONTACT_LIST_MODEL (etc); - return (void *) e_destination_get_address (model->data[row]); + return (void *) e_destination_get_textrep (model->data[row], TRUE); } /* This function sets the value at a particular point in our ETableModel. */ diff --git a/addressbook/gui/widgets/e-addressbook-table-adapter.c b/addressbook/gui/widgets/e-addressbook-table-adapter.c index c7b0003af6..3680af259c 100644 --- a/addressbook/gui/widgets/e-addressbook-table-adapter.c +++ b/addressbook/gui/widgets/e-addressbook-table-adapter.c @@ -124,7 +124,7 @@ addressbook_value_at (ETableModel *etc, int col, int row) EDestination *dest = e_destination_import (value); if (dest) { /* XXX blech, we leak this */ - value = g_strdup (e_destination_get_address (dest)); + value = g_strdup (e_destination_get_textrep (dest, TRUE)); g_object_unref (dest); } } diff --git a/addressbook/gui/widgets/e-addressbook-treeview-adapter.c b/addressbook/gui/widgets/e-addressbook-treeview-adapter.c index d6401133ec..af4652226e 100644 --- a/addressbook/gui/widgets/e-addressbook-treeview-adapter.c +++ b/addressbook/gui/widgets/e-addressbook-treeview-adapter.c @@ -380,7 +380,7 @@ adapter_get_value (GtkTreeModel *tree_model, EDestination *dest = e_destination_import (v); if (dest) { /* XXX blech, we leak this */ - v = g_strdup (e_destination_get_address (dest)); + v = g_strdup (e_destination_get_textrep (dest, TRUE)); g_object_unref (dest); } } diff --git a/addressbook/gui/widgets/e-minicard.c b/addressbook/gui/widgets/e-minicard.c index 822b10041a..8bebb4cdb0 100644 --- a/addressbook/gui/widgets/e-minicard.c +++ b/addressbook/gui/widgets/e-minicard.c @@ -803,7 +803,7 @@ add_field (EMinicard *e_minicard, ECardSimpleField field, gdouble left_width) if (!strncmp (string, "