diff options
author | Chyla Zbigniew <chyla@src.gnome.org> | 2001-09-08 07:42:30 +0800 |
---|---|---|
committer | Chyla Zbigniew <chyla@src.gnome.org> | 2001-09-08 07:42:30 +0800 |
commit | c0fa4148f3de389db473ca20f9e8ec850304234d (patch) | |
tree | cc241238e883abacda5f652f087c56b81fef317d /addressbook/gui | |
parent | 36f535d34b7a2e9c134ff2416f8ed070c0285cc3 (diff) | |
download | gsoc2013-evolution-c0fa4148f3de389db473ca20f9e8ec850304234d.tar.gz gsoc2013-evolution-c0fa4148f3de389db473ca20f9e8ec850304234d.tar.zst gsoc2013-evolution-c0fa4148f3de389db473ca20f9e8ec850304234d.zip |
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
Diffstat (limited to 'addressbook/gui')
-rw-r--r-- | addressbook/gui/component/select-names/e-select-names-popup.c | 54 |
1 files changed, 39 insertions, 15 deletions
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 <libgnomeui/gnome-app.h> #include <libgnomeui/gnome-app-helper.h> #include <libgnomeui/gnome-popup-menu.h> +#include <gal/widgets/e-unicode.h> #include <addressbook/backend/ebook/e-book-util.h> #include <addressbook/gui/contact-editor/e-contact-editor.h> @@ -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; } |