From c0fa4148f3de389db473ca20f9e8ec850304234d Mon Sep 17 00:00:00 2001 From: Chyla Zbigniew Date: Fri, 7 Sep 2001 23:42:30 +0000 Subject: Fixed two bugs: - missing coversion of contact name to GTK+ locale, - * gui/component/select-names/e-select-names-popup.c (popup_menu_card): Fixed two bugs: - missing coversion of contact name to GTK+ locale, - passing dynamically created string (contact name) inside uiinfo struct to gnome-app-helper functions. Remember: these functions may change strings, trying to translate them! (popup_menu_nocard): Ditto svn path=/trunk/; revision=12694 --- addressbook/ChangeLog | 10 ++++ .../component/select-names/e-select-names-popup.c | 54 ++++++++++++++++------ 2 files changed, 49 insertions(+), 15 deletions(-) (limited to 'addressbook') diff --git a/addressbook/ChangeLog b/addressbook/ChangeLog index 930b615971..cf3fb13eb1 100644 --- a/addressbook/ChangeLog +++ b/addressbook/ChangeLog @@ -1,3 +1,13 @@ +2001-08-23 Zbigniew Chyla + + * gui/component/select-names/e-select-names-popup.c + (popup_menu_card): Fixed two bugs: + - missing coversion of contact name to GTK+ locale, + - passing dynamically created string (contact name) inside uiinfo struct + to gnome-app-helper functions. + Remember: these functions may change strings, trying to translate them! + (popup_menu_nocard): Ditto + 2001-09-07 Christopher James Lahey * gui/component/addressbook-component.c: Removed unused factory 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 61de3a3c1f..124301ace4 100644 --- a/addressbook/gui/component/select-names/e-select-names-popup.c +++ b/addressbook/gui/component/select-names/e-select-names-popup.c @@ -37,6 +37,7 @@ #include #include #include +#include #include #include @@ -248,10 +249,11 @@ popup_menu_card (PopupInfo *info) gboolean using_radio = FALSE; ECard *card; gint i=0; - GtkWidget *pop; + GtkWidget *pop, *label; + GList *item_children; EIterator *iterator; gint html_toggle; - gchar *name_label; + gchar *name_label, *quoted_name_label; /* * Build up our GnomeUIInfo array. @@ -262,9 +264,11 @@ popup_menu_card (PopupInfo *info) card = e_destination_get_card (info->dest); + /* Use an empty label for now, we'll fill it later. + If we set uiinfo label to contact name here, gnome_popup_menu_new + could screw it up trying make a "translation". */ uiinfo[i].type = GNOME_APP_UI_ITEM; - name_label = quote_label (e_destination_get_name (info->dest)); - uiinfo[i].label = name_label; + uiinfo[i].label = ""; ++i; uiinfo[i].type = GNOME_APP_UI_SEPARATOR; @@ -337,7 +341,15 @@ popup_menu_card (PopupInfo *info) init_html_mail (&(uiinfo[html_toggle]), info); + /* Now set label of the first item to contact name */ + name_label = e_utf8_to_locale_string (e_destination_get_name (info->dest)); + quoted_name_label = quote_label (name_label); + item_children = gtk_container_children (GTK_CONTAINER (uiinfo[0].widget)); + label = item_children->data; + g_list_free (item_children); + gtk_label_set_text (GTK_LABEL (label), quoted_name_label); g_free (name_label); + g_free (quoted_name_label); return pop; } @@ -354,22 +366,19 @@ popup_menu_nocard (PopupInfo *info) { GnomeUIInfo uiinfo[ARBITRARY_UIINFO_LIMIT]; gint i=0; - GtkWidget *pop; + GtkWidget *pop, *label; + GList *item_children; const gchar *str; - gchar *name_label; + gchar *name_label, *quoted_name_label; gint html_toggle; memset (uiinfo, 0, sizeof (uiinfo)); - str = e_destination_get_name (info->dest); - if (str == NULL) - str = e_destination_get_email (info->dest); - if (str == NULL) - str = _("Unnamed Contact"); - name_label = quote_label (str); - + /* Use an empty label for now, we'll fill it later. + If we set uiinfo label to contact name here, gnome_popup_menu_new + could screw it up trying make a "translation". */ uiinfo[i].type = GNOME_APP_UI_ITEM; - uiinfo[i].label = name_label; + uiinfo[i].label = ""; ++i; uiinfo[i].type = GNOME_APP_UI_SEPARATOR; @@ -395,8 +404,23 @@ popup_menu_nocard (PopupInfo *info) pop = gnome_popup_menu_new (uiinfo); init_html_mail (&(uiinfo[html_toggle]), info); - + + /* Now set label of the first item to contact name */ + str = e_destination_get_name (info->dest); + if (str == NULL) + str = e_destination_get_email (info->dest); + if (str != NULL) { + name_label = e_utf8_to_locale_string (str); + } else { + name_label = g_strdup (_("Unnamed Contact")); + } + quoted_name_label = quote_label (name_label); + item_children = gtk_container_children (GTK_CONTAINER (uiinfo[0].widget)); + label = item_children->data; + g_list_free (item_children); + gtk_label_set_text (GTK_LABEL (label), quoted_name_label); g_free (name_label); + g_free (quoted_name_label); return pop; } -- cgit v1.2.3