From b7c8e687b0bb1b94905b1a03d5a578736e226030 Mon Sep 17 00:00:00 2001 From: Jon Trowbridge Date: Wed, 25 Jul 2001 08:31:02 +0000 Subject: Properly dup the results of e_destination_get_email. 2001-07-25 Jon Trowbridge * backend/ebook/e-destination.c (e_destination_get_name): Properly dup the results of e_destination_get_email. * gui/component/select-names/e-select-names-popup.c (e_select_names_popup): Check that our destination isn't empty before building our popup. (Bug #5250) * backend/ebook/e-destination.c (e_destination_is_empty): Made argument const. svn path=/trunk/; revision=11395 --- addressbook/ChangeLog | 12 ++++++++++++ addressbook/backend/ebook/e-destination.c | 4 ++-- addressbook/backend/ebook/e-destination.h | 2 +- .../gui/component/select-names/e-select-names-popup.c | 5 +++++ 4 files changed, 20 insertions(+), 3 deletions(-) diff --git a/addressbook/ChangeLog b/addressbook/ChangeLog index 730f9cd396..d7f2827dd3 100644 --- a/addressbook/ChangeLog +++ b/addressbook/ChangeLog @@ -1,3 +1,15 @@ +2001-07-25 Jon Trowbridge + + * backend/ebook/e-destination.c (e_destination_get_name): Properly dup + the results of e_destination_get_email. + + * gui/component/select-names/e-select-names-popup.c + (e_select_names_popup): Check that our destination isn't empty + before building our popup. (Bug #5250) + + * backend/ebook/e-destination.c (e_destination_is_empty): Made + argument const. + 2001-07-24 Jon Trowbridge * gui/contact-list-editor/e-contact-list-model.c: Added checks diff --git a/addressbook/backend/ebook/e-destination.c b/addressbook/backend/ebook/e-destination.c index e836922ba3..9b4fbe681b 100644 --- a/addressbook/backend/ebook/e-destination.c +++ b/addressbook/backend/ebook/e-destination.c @@ -189,7 +189,7 @@ e_destination_clear (EDestination *dest) } gboolean -e_destination_is_empty (EDestination *dest) +e_destination_is_empty (const EDestination *dest) { struct _EDestinationPrivate *p; g_return_val_if_fail (dest && E_IS_DESTINATION (dest), TRUE); @@ -405,7 +405,7 @@ e_destination_get_name (const EDestination *dest) if (priv->name == NULL || *priv->name == '\0') { g_free (priv->name); - priv->name = e_destination_get_email (dest); + priv->name = g_strdup (e_destination_get_email (dest)); } } diff --git a/addressbook/backend/ebook/e-destination.h b/addressbook/backend/ebook/e-destination.h index c53f255436..fc46a20538 100644 --- a/addressbook/backend/ebook/e-destination.h +++ b/addressbook/backend/ebook/e-destination.h @@ -63,7 +63,7 @@ EDestination *e_destination_new (void); EDestination *e_destination_copy (const EDestination *); void e_destination_clear (EDestination *); -gboolean e_destination_is_empty (EDestination *); +gboolean e_destination_is_empty (const EDestination *); void e_destination_set_card (EDestination *, ECard *card, gint email_num); void e_destination_set_card_uri (EDestination *, const gchar *uri, gint email_num); diff --git a/addressbook/gui/component/select-names/e-select-names-popup.c b/addressbook/gui/component/select-names/e-select-names-popup.c index aa668884c2..c4cb57533d 100644 --- a/addressbook/gui/component/select-names/e-select-names-popup.c +++ b/addressbook/gui/component/select-names/e-select-names-popup.c @@ -323,6 +323,8 @@ popup_menu_nocard (PopupInfo *info) memset (uiinfo, 0, sizeof (uiinfo)); str = e_destination_get_name (info->dest); + if (str == NULL) + str = _("Unnamed Contact"); uiinfo[i].type = GNOME_APP_UI_ITEM; uiinfo[i].label = (gchar *) str; @@ -373,6 +375,9 @@ e_select_names_popup (ESelectNamesModel *model, GdkEventButton *ev, gint pos) return; dest = e_select_names_model_get_destination (model, index); + if (e_destination_is_empty (dest)) + return; + card = e_destination_get_card (dest); info = popup_info_new (model, dest, pos, index); -- cgit v1.2.3