From 81f994a359a8f70efa3ffcca2004233387815b06 Mon Sep 17 00:00:00 2001 From: Lauris Kaplinski Date: Fri, 25 Aug 2000 04:31:13 +0000 Subject: More UTF-8 handling svn path=/trunk/; revision=5032 --- camel/ChangeLog | 8 +++++ camel/camel-folder-summary.c | 8 ++--- camel/camel-mime-part-utils.c | 8 ++--- camel/camel-mime-utils.c | 2 +- composer/ChangeLog | 8 +++++ composer/e-msg-composer-address-entry.c | 16 +++++++--- composer/e-msg-composer-attachment.c | 47 +++++++++++++++++++++-------- composer/e-msg-composer-hdrs.c | 11 ++++--- e-util/ChangeLog | 5 ++++ e-util/e-unicode.c | 17 +++++++++++ e-util/e-unicode.h | 2 ++ filter/ChangeLog | 8 +++++ filter/filter-folder.c | 8 +++-- filter/filter-input.c | 8 +++-- filter/filter-rule.c | 6 ++-- mail/ChangeLog | 6 ++++ mail/folder-browser.c | 13 +++++++-- mail/mail-config-gui.c | 52 ++++++++++++++++----------------- widgets/misc/e-unicode.c | 17 +++++++++++ widgets/misc/e-unicode.h | 2 ++ 20 files changed, 186 insertions(+), 66 deletions(-) diff --git a/camel/ChangeLog b/camel/ChangeLog index a593b52c95..cc7ea92a4b 100644 --- a/camel/ChangeLog +++ b/camel/ChangeLog @@ -1,3 +1,11 @@ +2000-08-24 Lauris Kaplinski + + * camel-folder-summary.c (summary_build_content_info): + Use UTF-8 as default + * camel-mime-part-utils.c (simple_data_wrapper_construct_from_parser): + Use UTF-8 as default + * camel-mime-utils.c (rfc2047_decode_word): Use UTF-8 + 2000-08-17 Not Zed * providers/mh/camel-mh-folder.c (mh_finalize): And here too. diff --git a/camel/camel-folder-summary.c b/camel/camel-folder-summary.c index 71456dbf4d..a990d87a9c 100644 --- a/camel/camel-folder-summary.c +++ b/camel/camel-folder-summary.c @@ -1230,18 +1230,18 @@ summary_build_content_info(CamelFolderSummary *s, CamelMimeParser *mp) charset = header_content_type_param(ct, "charset"); if (charset!=NULL && !(strcasecmp(charset, "us-ascii")==0 - || strcasecmp(charset, "iso-8859-1")==0)) { - d(printf(" Adding conversion filter from %s to iso-8859-1\n", charset)); + || strcasecmp(charset, "utf-8")==0)) { + d(printf(" Adding conversion filter from %s to UTF-8\n", charset)); mfc = g_hash_table_lookup(p->filter_charset, charset); if (mfc == NULL) { - mfc = camel_mime_filter_charset_new_convert(charset, "iso-8859-1"); + mfc = camel_mime_filter_charset_new_convert(charset, "UTF-8"); if (mfc) g_hash_table_insert(p->filter_charset, g_strdup(charset), mfc); } if (mfc) { chr_id = camel_mime_parser_filter_add(mp, (CamelMimeFilter *)mfc); } else { - g_warning("Cannot convert '%s' to 'iso-8859-1', message index may be corrupt", charset); + g_warning("Cannot convert '%s' to 'UTF-8', message index may be corrupt", charset); } } diff --git a/camel/camel-mime-part-utils.c b/camel/camel-mime-part-utils.c index 646b0131b1..81f17aa098 100644 --- a/camel/camel-mime-part-utils.c +++ b/camel/camel-mime-part-utils.c @@ -96,13 +96,13 @@ simple_data_wrapper_construct_from_parser(CamelDataWrapper *dw, CamelMimeParser if (charset!=NULL && !(strcasecmp(charset, "us-ascii")==0 - || strcasecmp(charset, "iso-8859-1")==0)) { - d(printf("Adding conversion filter from %s to iso-8859-1\n", charset)); - fch = (CamelMimeFilter *)camel_mime_filter_charset_new_convert(charset, "iso-8859-1"); + || strcasecmp(charset, "utf-8")==0)) { + d(printf("Adding conversion filter from %s to UTF-8\n", charset)); + fch = (CamelMimeFilter *)camel_mime_filter_charset_new_convert(charset, "UTF-8"); if (fch) { chrid = camel_mime_parser_filter_add(mp, (CamelMimeFilter *)fch); } else { - g_warning("Cannot convert '%s' to 'iso-8859-1', message display may be corrupt", charset); + g_warning("Cannot convert '%s' to 'UTF-8', message display may be corrupt", charset); } } diff --git a/camel/camel-mime-utils.c b/camel/camel-mime-utils.c index 68af633c44..781ae59c23 100644 --- a/camel/camel-mime-utils.c +++ b/camel/camel-mime-utils.c @@ -880,7 +880,7 @@ rfc2047_decode_word(const char *in, int len) outbuf = outbase; /* TODO: Should this cache iconv converters? */ - ic = unicode_iconv_open("iso-8859-1", encname); + ic = unicode_iconv_open("UTF-8", encname); if (ic != (unicode_iconv_t)-1) { ret = unicode_iconv(ic, (const char **)&inbuf, &inlen, &outbuf, &outlen); unicode_iconv_close(ic); diff --git a/composer/ChangeLog b/composer/ChangeLog index 218a590858..0d5311b76a 100644 --- a/composer/ChangeLog +++ b/composer/ChangeLog @@ -1,3 +1,11 @@ +2000-08-24 Lauris Kaplinski + + * e-msg-composer-address-entry.c: Use e_utf8 wrappers + + * e-msg-composer-attachment.c: Use e_utf8 wrappers + + * e-msg-composer-hdrs.c: Use e_utf8 wrappers + 2000-08-24 Peter Williams * Makefile.am (INCLUDES): Add builddir/shell so we can diff --git a/composer/e-msg-composer-address-entry.c b/composer/e-msg-composer-address-entry.c index ce946d203e..63b338b905 100644 --- a/composer/e-msg-composer-address-entry.c +++ b/composer/e-msg-composer-address-entry.c @@ -26,7 +26,7 @@ cooler. */ #include - +#include #include "e-msg-composer-address-entry.h" @@ -98,11 +98,11 @@ GList * e_msg_composer_address_entry_get_addresses (EMsgComposerAddressEntry *entry) { GList *list; - const gchar *s; const gchar *p, *oldp; + gchar *s; gboolean in_quotes; - s = gtk_entry_get_text (GTK_ENTRY (entry)); + s = e_utf8_gtk_entry_get_text (GTK_ENTRY (entry)); in_quotes = FALSE; list = NULL; @@ -110,6 +110,8 @@ e_msg_composer_address_entry_get_addresses (EMsgComposerAddressEntry *entry) p = s; oldp = s; + /* This should work with UTF-8, although it uses simple pointer increment */ + while (1) { if (*p == '"') { in_quotes = ! in_quotes; @@ -138,6 +140,8 @@ e_msg_composer_address_entry_get_addresses (EMsgComposerAddressEntry *entry) } } + g_free (s); + return g_list_reverse (list); } @@ -170,6 +174,10 @@ e_msg_composer_address_entry_set_list (EMsgComposerAddressEntry *entry, g_string_append (string, p->data); } - gtk_entry_set_text (GTK_ENTRY (entry), string->str); + e_utf8_gtk_entry_set_text (GTK_ENTRY (entry), string->str); g_string_free (string, TRUE); } + + + + diff --git a/composer/e-msg-composer-attachment.c b/composer/e-msg-composer-attachment.c index 9883640e23..ea17a9bcf3 100644 --- a/composer/e-msg-composer-attachment.c +++ b/composer/e-msg-composer-attachment.c @@ -31,6 +31,7 @@ #include #include +#include #include "e-msg-composer-attachment.h" @@ -234,19 +235,26 @@ destroy_dialog_data (DialogData *data) g_free (data); } +/* + * fixme: I am converting EVERYTHING to/from UTF-8, although mime types + * are in ASCII. This is not strictly necessary, but we want to be + * consistent and possibly check for errors somewhere. + */ + static void update_mime_type (DialogData *data) { const gchar *mime_type; - const gchar *file_name; + gchar *file_name; if (!data->attachment->guessed_type) return; - file_name = gtk_entry_get_text (data->file_name_entry); + file_name = e_utf8_gtk_entry_get_text (data->file_name_entry); mime_type = get_mime_type (file_name); + g_free (file_name); - gtk_entry_set_text (data->mime_type_entry, mime_type); + e_utf8_gtk_entry_set_text (data->mime_type_entry, mime_type); } static void @@ -259,7 +267,7 @@ set_entry (GladeXML *xml, entry = GTK_ENTRY (glade_xml_get_widget (xml, widget_name)); if (entry == NULL) g_warning ("Entry for `%s' not found.", widget_name); - gtk_entry_set_text (entry, value ? value : ""); + e_utf8_gtk_entry_set_text (entry, value ? value : ""); } static void @@ -299,21 +307,25 @@ ok_cb (GtkWidget *widget, { DialogData *dialog_data; EMsgComposerAttachment *attachment; + gchar *str; dialog_data = (DialogData *) data; attachment = dialog_data->attachment; - camel_mime_part_set_filename (attachment->body, gtk_entry_get_text - (dialog_data->file_name_entry)); + str = e_utf8_gtk_entry_get_text (dialog_data->file_name_entry); + camel_mime_part_set_filename (attachment->body, str); + g_free (str); - camel_mime_part_set_description (attachment->body, gtk_entry_get_text - (dialog_data->description_entry)); + str = e_utf8_gtk_entry_get_text (dialog_data->description_entry); + camel_mime_part_set_description (attachment->body, str); + g_free (str); + + str = e_utf8_gtk_entry_get_text (dialog_data->mime_type_entry); + camel_mime_part_set_content_type (attachment->body, str); - camel_mime_part_set_content_type (attachment->body, gtk_entry_get_text - (dialog_data->mime_type_entry)); camel_data_wrapper_set_mime_type ( - camel_medium_get_content_object (CAMEL_MEDIUM (attachment->body)), - gtk_entry_get_text (dialog_data->mime_type_entry)); + camel_medium_get_content_object (CAMEL_MEDIUM (attachment->body)), str); + g_free (str); changed (attachment); close_cb (widget, data); @@ -397,3 +409,14 @@ e_msg_composer_attachment_edit (EMsgComposerAttachment *attachment, connect_widget (editor_gui, "file_name_entry", "focus_out_event", file_name_focus_out_cb, dialog_data); } + + + + + + + + + + + diff --git a/composer/e-msg-composer-hdrs.c b/composer/e-msg-composer-hdrs.c index 1e3502c79a..31dbed9e39 100644 --- a/composer/e-msg-composer-hdrs.c +++ b/composer/e-msg-composer-hdrs.c @@ -37,6 +37,7 @@ #include "e-msg-composer-address-entry.h" #include "e-msg-composer-hdrs.h" #include "widgets/e-text/e-entry.h" +#include "e-util/e-unicode.h" #include "mail/mail-config.h" @@ -176,7 +177,7 @@ create_dropdown_entry (EMsgComposerHdrs *hdrs, camel_internet_address_add (ciaddr, id->name, id->address); val = camel_address_encode (CAMEL_ADDRESS (ciaddr)); - gtk_entry_set_text (GTK_ENTRY (GTK_COMBO (combo)->entry), val); + e_utf8_gtk_entry_set_text (GTK_ENTRY (GTK_COMBO (combo)->entry), val); g_free (val); } @@ -564,7 +565,7 @@ e_msg_composer_hdrs_set_from (EMsgComposerHdrs *hdrs, g_return_if_fail (E_IS_MSG_COMPOSER_HDRS (hdrs)); entry = GTK_ENTRY (GTK_COMBO (hdrs->priv->from_entry)->entry); - gtk_entry_set_text (entry, from); + e_utf8_gtk_entry_set_text (entry, from); } void @@ -610,14 +611,16 @@ e_msg_composer_hdrs_set_subject (EMsgComposerHdrs *hdrs, NULL); } - +/* + * Hmmm... this introduces possible memory leak, but syntax suggest allocated string + */ char * e_msg_composer_hdrs_get_from (EMsgComposerHdrs *hdrs) { g_return_val_if_fail (hdrs != NULL, NULL); g_return_val_if_fail (E_IS_MSG_COMPOSER_HDRS (hdrs), NULL); - return gtk_entry_get_text (GTK_ENTRY (GTK_COMBO (hdrs->priv->from_entry)->entry)); + return e_utf8_gtk_entry_get_text (GTK_ENTRY (GTK_COMBO (hdrs->priv->from_entry)->entry)); } /* FIXME this is currently unused and broken. */ diff --git a/e-util/ChangeLog b/e-util/ChangeLog index 3e9465814b..cb5d4f0a5e 100644 --- a/e-util/ChangeLog +++ b/e-util/ChangeLog @@ -1,3 +1,8 @@ +2000-08-24 Lauris Kaplinski + + * e-unicode.h: + * e-unicode.c (e_utf8_gtk_menu_item_new_with_label): New wrapper + 2000-08-23 Lauris Kaplinski * e-unicode.h: diff --git a/e-util/e-unicode.c b/e-util/e-unicode.c index 8612048e21..e9b87ca64d 100644 --- a/e-util/e-unicode.c +++ b/e-util/e-unicode.c @@ -199,3 +199,20 @@ e_utf8_gtk_entry_set_text (GtkEntry *entry, const gchar *text) if (s) g_free (s); } +GtkWidget * +e_utf8_gtk_menu_item_new_with_label (const gchar *label) +{ + GtkWidget *w; + gchar *s; + + if (!label) return NULL; + + s = e_utf8_to_gtk_string (NULL, label); + w = gtk_menu_item_new_with_label (s); + + if (s) g_free (s); + + return w; +} + + diff --git a/e-util/e-unicode.h b/e-util/e-unicode.h index 7bd46397e4..5df2932ac4 100644 --- a/e-util/e-unicode.h +++ b/e-util/e-unicode.h @@ -29,5 +29,7 @@ void e_utf8_gtk_entry_set_text (GtkEntry *entry, const gchar *text); gchar *e_utf8_gtk_editable_get_chars (GtkEditable *editable, gint start, gint end); +GtkWidget *e_utf8_gtk_menu_item_new_with_label (const gchar *label); + #endif diff --git a/filter/ChangeLog b/filter/ChangeLog index 31b39867cb..b1d0466194 100644 --- a/filter/ChangeLog +++ b/filter/ChangeLog @@ -1,3 +1,11 @@ +2000-08-24 Lauris Kaplinski + + * filter-folder.c: Use e_utf8 wrappers + + * filter-input.c: Use e_utf8 wrappers + + * filter-rule.c: Use e_utf8 wrappers + 2000-08-23 Dan Winship * filter-datespec.c (cal_day_selected): Set seltime.tm_isdst to diff --git a/filter/filter-folder.c b/filter/filter-folder.c index 60212086ee..cb2d87c29f 100644 --- a/filter/filter-folder.c +++ b/filter/filter-folder.c @@ -23,6 +23,8 @@ #define SHELL +#include + #include "filter-folder.h" #ifdef SHELL #include "shell/evolution-shell-client.h" @@ -207,7 +209,7 @@ static void button_clicked(GtkButton *button, FilterFolder *ff) NULL); entry = (GtkEntry *)gtk_entry_new(); if (ff->uri) { - gtk_entry_set_text(entry, ff->uri); + e_utf8_gtk_entry_set_text(entry, ff->uri); } gtk_box_pack_start((GtkBox *)gd->vbox, (GtkWidget *)entry, TRUE, TRUE, 3); gtk_widget_show((GtkWidget *)entry); @@ -215,8 +217,8 @@ static void button_clicked(GtkButton *button, FilterFolder *ff) case 0: g_free(ff->uri); g_free(ff->name); - uri = gtk_entry_get_text(entry); - ff->uri = g_strdup(uri); + uri = e_utf8_gtk_entry_get_text(entry); + ff->uri = uri; str = strstr(uri, "//"); if (str) str = strchr(str+2, '/'); diff --git a/filter/filter-input.c b/filter/filter-input.c index f422a091b1..8811c1b6d7 100644 --- a/filter/filter-input.c +++ b/filter/filter-input.c @@ -21,6 +21,8 @@ #include #include +#include + #include "filter-input.h" #include "e-util/e-sexp.h" @@ -216,7 +218,7 @@ static void entry_changed(GtkEntry *entry, FilterElement *fe) FilterInput *fi = (FilterInput *)fe; GList *l; - new = gtk_entry_get_text(entry); + new = e_utf8_gtk_entry_get_text(entry); /* NOTE: entry only supports a single value ... */ l = fi->values; @@ -226,7 +228,7 @@ static void entry_changed(GtkEntry *entry, FilterElement *fe) } g_list_free(fi->values); - fi->values = g_list_append(NULL, g_strdup(new)); + fi->values = g_list_append(NULL, new); } static GtkWidget *get_widget(FilterElement *fe) @@ -236,7 +238,7 @@ static GtkWidget *get_widget(FilterElement *fe) entry = (GtkEntry *)gtk_entry_new(); if (fi->values && fi->values->data) { - gtk_entry_set_text(entry, fi->values->data); + e_utf8_gtk_entry_set_text(entry, fi->values->data); } gtk_signal_connect((GtkObject *)entry, "changed", entry_changed, fe); return (GtkWidget *)entry; diff --git a/filter/filter-rule.c b/filter/filter-rule.c index 39012b9e54..21aa5ed396 100644 --- a/filter/filter-rule.c +++ b/filter/filter-rule.c @@ -22,6 +22,8 @@ #include #include +#include + #include "filter-rule.h" #include "filter-context.h" @@ -454,7 +456,7 @@ static void name_changed(GtkEntry *entry, FilterRule *fr) { g_free(fr->name); - fr->name = g_strdup(gtk_entry_get_text(entry)); + fr->name = e_utf8_gtk_entry_get_text(entry); } GtkWidget *filter_rule_get_widget (FilterRule *fr, struct _RuleContext *f) @@ -482,7 +484,7 @@ static GtkWidget *get_widget(FilterRule *fr, struct _RuleContext *f) label = (GtkLabel *)gtk_label_new("Name"); name = (GtkEntry *)gtk_entry_new(); if (fr->name) - gtk_entry_set_text(name, fr->name); + e_utf8_gtk_entry_set_text(name, fr->name); hbox = (GtkHBox *)gtk_hbox_new(FALSE, 3); gtk_box_pack_start((GtkBox *)hbox, (GtkWidget *)label, FALSE, FALSE, 0); gtk_box_pack_start((GtkBox *)hbox, (GtkWidget *)name, TRUE, TRUE, 0); diff --git a/mail/ChangeLog b/mail/ChangeLog index 767238e21a..07b93370e0 100644 --- a/mail/ChangeLog +++ b/mail/ChangeLog @@ -1,3 +1,9 @@ +2000-08-24 Lauris Kaplinski + + * folder-browser.c: Use e_utf8 wrappers + + * mail-config-gui.c: Use e_utf8 wrappers + 2000-08-24 Peter Williams * folder-browser-factory.c (control_activate): Add all the diff --git a/mail/folder-browser.c b/mail/folder-browser.c index 9932498c0b..8279624e4c 100644 --- a/mail/folder-browser.c +++ b/mail/folder-browser.c @@ -12,6 +12,7 @@ #include #include "e-util/e-util.h" #include "e-util/e-sexp.h" +#include "e-util/e-unicode.h" #include "folder-browser.h" #include "mail.h" #include "mail-tools.h" @@ -154,9 +155,10 @@ search_set(FolderBrowser *fb) int index; char *text; - text = gtk_entry_get_text((GtkEntry *)fb->search_entry); + text = e_utf8_gtk_entry_get_text((GtkEntry *)fb->search_entry); if (text == NULL || text[0] == 0) { + if (text) g_free (text); mail_do_regenerate_messagelist (fb->message_list, NULL); return; } @@ -179,6 +181,8 @@ search_set(FolderBrowser *fb) } mail_do_regenerate_messagelist (fb->message_list, out->str); g_string_free(out, TRUE); + + g_free (text); } static void @@ -199,7 +203,7 @@ create_option_menu (char **menu_list, int item, void *data) while (*menu_list){ GtkWidget *entry; - entry = gtk_menu_item_new_with_label (*menu_list); + entry = e_utf8_gtk_menu_item_new_with_label (*menu_list); gtk_widget_show (entry); gtk_object_set_data((GtkObject *)entry, "search_option", (void *)i); gtk_menu_append (GTK_MENU (menu), entry); @@ -233,9 +237,10 @@ search_save(GtkWidget *w, FolderBrowser *fb) VfolderRule *rule; FilterPart *part; - text = gtk_entry_get_text((GtkEntry *)fb->search_entry); + text = e_utf8_gtk_entry_get_text((GtkEntry *)fb->search_entry); if (text == NULL || text[0] == 0) { + if (text) g_free (text); return; } @@ -285,6 +290,8 @@ search_save(GtkWidget *w, FolderBrowser *fb) } vfolder_gui_add_rule(rule); + + g_free (text); } void diff --git a/mail/mail-config-gui.c b/mail/mail-config-gui.c index abb0fc317d..cbfb587122 100644 --- a/mail/mail-config-gui.c +++ b/mail/mail-config-gui.c @@ -33,6 +33,7 @@ #include #include "e-util/e-html-utils.h" +#include "e-util/e-unicode.h" #include "mail.h" #include "mail-threads.h" #include "mail-config.h" @@ -375,8 +376,8 @@ identity_page_changed (GtkWidget *widget, MailDialogIdentityPage *page) { gchar *name, *addr; - name = gtk_editable_get_chars (GTK_EDITABLE (page->name), 0, -1); - addr = gtk_editable_get_chars (GTK_EDITABLE (page->address), 0, -1); + name = e_utf8_gtk_editable_get_chars (GTK_EDITABLE (page->name), 0, -1); + addr = e_utf8_gtk_editable_get_chars (GTK_EDITABLE (page->address), 0, -1); if (addr && *addr && name && *name && page->donecb) page->donecb (page, page->donedata); @@ -392,11 +393,10 @@ identity_page_extract (MailDialogIdentityPage *page) { MailConfigIdentity *id = g_new0 (MailConfigIdentity, 1); - id->name = gtk_editable_get_chars (GTK_EDITABLE (page->name), 0, -1); - id->address = - gtk_editable_get_chars (GTK_EDITABLE (page->address), 0, -1); - id->org = gtk_editable_get_chars (GTK_EDITABLE (page->org), 0, -1); - id->sig = gtk_editable_get_chars (GTK_EDITABLE (page->sig), 0, -1); + id->name = e_utf8_gtk_editable_get_chars (GTK_EDITABLE (page->name), 0, -1); + id->address = e_utf8_gtk_editable_get_chars (GTK_EDITABLE (page->address), 0, -1); + id->org = e_utf8_gtk_editable_get_chars (GTK_EDITABLE (page->org), 0, -1); + id->sig = e_utf8_gtk_editable_get_chars (GTK_EDITABLE (page->sig), 0, -1); return id; } @@ -463,7 +463,7 @@ identity_page_new (const MailConfigIdentity *id) else name = g_strdup (user); - gtk_entry_set_text (GTK_ENTRY (page->name), name); + e_utf8_gtk_entry_set_text (GTK_ENTRY (page->name), name); g_free (name); } @@ -474,7 +474,7 @@ identity_page_new (const MailConfigIdentity *id) page->address = gtk_entry_new (); if (id && id->address) - gtk_entry_set_text (GTK_ENTRY (page->address), id->address); + e_utf8_gtk_entry_set_text (GTK_ENTRY (page->address), id->address); gtk_table_attach (GTK_TABLE (table), page->address, 1, 2, 1, 2, GTK_EXPAND | GTK_FILL, 0, 0, 0); @@ -489,7 +489,7 @@ identity_page_new (const MailConfigIdentity *id) page->org = gtk_entry_new (); if (id && id->org) - gtk_entry_set_text (GTK_ENTRY (page->org), id->org); + e_utf8_gtk_entry_set_text (GTK_ENTRY (page->org), id->org); gtk_table_attach (GTK_TABLE (table), page->org, 1, 2, 3, 4, GTK_EXPAND | GTK_FILL, 0, 0, 0); @@ -501,7 +501,7 @@ identity_page_new (const MailConfigIdentity *id) fentry = gnome_file_entry_new (NULL, _("Signature File")); page->sig = gnome_file_entry_gtk_entry (GNOME_FILE_ENTRY (fentry)); if (id && id->sig) { - gtk_entry_set_text (GTK_ENTRY (page->sig), id->sig); + e_utf8_gtk_entry_set_text (GTK_ENTRY (page->sig), id->sig); } else { gchar *default_sig; @@ -509,7 +509,7 @@ identity_page_new (const MailConfigIdentity *id) G_DIR_SEPARATOR_S, ".signature", NULL); if (g_file_exists (default_sig)) - gtk_entry_set_text (GTK_ENTRY (page->sig), default_sig); + e_utf8_gtk_entry_set_text (GTK_ENTRY (page->sig), default_sig); g_free (default_sig); } @@ -585,12 +585,12 @@ service_page_get_url (MailDialogServicePage *page) url->protocol = g_strdup (spitem->protocol); if (spitem->user) - url->user = gtk_editable_get_chars (GTK_EDITABLE (spitem->user), 0, -1); + url->user = e_utf8_gtk_editable_get_chars (GTK_EDITABLE (spitem->user), 0, -1); if (spitem->host) - url->host = gtk_editable_get_chars (GTK_EDITABLE (spitem->host), 0, -1); + url->host = e_utf8_gtk_editable_get_chars (GTK_EDITABLE (spitem->host), 0, -1); if (spitem->path) { gchar *path; - path = gtk_editable_get_chars (GTK_EDITABLE (spitem->path), + path = e_utf8_gtk_editable_get_chars (GTK_EDITABLE (spitem->path), 0, -1); url->path = g_strdup_printf ("%s%s", url->host ? "/" : "", path); @@ -642,18 +642,18 @@ service_page_set_url (MailDialogServicePage *page, MailConfigService *service) spitem->pnum); if (spitem->user && url && url->user) - gtk_entry_set_text (GTK_ENTRY (spitem->user), url->user); + e_utf8_gtk_entry_set_text (GTK_ENTRY (spitem->user), url->user); if (spitem->host && url && url->host) - gtk_entry_set_text (GTK_ENTRY (spitem->host), url->host); + e_utf8_gtk_entry_set_text (GTK_ENTRY (spitem->host), url->host); if (spitem->path && url && url->path) { if (url->host && *url->path) - gtk_entry_set_text (GTK_ENTRY (spitem->path), - url->path + 1); + e_utf8_gtk_entry_set_text (GTK_ENTRY (spitem->path), + url->path + 1); else - gtk_entry_set_text (GTK_ENTRY (spitem->path), - url->path); + e_utf8_gtk_entry_set_text (GTK_ENTRY (spitem->path), + url->path); } /* Set the auth menu */ @@ -709,7 +709,7 @@ service_page_item_auth_fill (MailDialogServicePage *page, for (; authtypes; authtypes = authtypes->next) { authtype = authtypes->data; - item = gtk_menu_item_new_with_label (_(authtype->name)); + item = e_utf8_gtk_menu_item_new_with_label (_(authtype->name)); if (!firstitem) firstitem = item; spitem->auth_items = g_list_append (spitem->auth_items, item); @@ -772,7 +772,7 @@ service_page_item_changed (GtkWidget *item, MailDialogServicePage *page) } if (spitem->host && spitem->hostneed) { - data = gtk_editable_get_chars (GTK_EDITABLE (spitem->host), 0, -1); + data = e_utf8_gtk_editable_get_chars (GTK_EDITABLE (spitem->host), 0, -1); if (!data || !*data) complete = FALSE; g_free (data); @@ -780,7 +780,7 @@ service_page_item_changed (GtkWidget *item, MailDialogServicePage *page) if (complete) { if (spitem->user && spitem->userneed) { - data = gtk_editable_get_chars (GTK_EDITABLE (spitem->user), 0, -1); + data = e_utf8_gtk_editable_get_chars (GTK_EDITABLE (spitem->user), 0, -1); if (!data || !*data) complete = FALSE; g_free (data); @@ -789,7 +789,7 @@ service_page_item_changed (GtkWidget *item, MailDialogServicePage *page) if (complete) { if (spitem->path && spitem->pathneed) { - data = gtk_editable_get_chars (GTK_EDITABLE (spitem->path), 0, -1); + data = e_utf8_gtk_editable_get_chars (GTK_EDITABLE (spitem->path), 0, -1); if (!data || !*data) complete = FALSE; g_free (data); @@ -1064,7 +1064,7 @@ service_page_new (const char *label_text, GSList *services) gtk_notebook_append_page (GTK_NOTEBOOK (page->notebook), spitem->vbox, NULL); - spitem->item = gtk_menu_item_new_with_label (_(mcs->provider->name)); + spitem->item = e_utf8_gtk_menu_item_new_with_label (_(mcs->provider->name)); if (!first_item) first_item = spitem->item; diff --git a/widgets/misc/e-unicode.c b/widgets/misc/e-unicode.c index 8612048e21..e9b87ca64d 100644 --- a/widgets/misc/e-unicode.c +++ b/widgets/misc/e-unicode.c @@ -199,3 +199,20 @@ e_utf8_gtk_entry_set_text (GtkEntry *entry, const gchar *text) if (s) g_free (s); } +GtkWidget * +e_utf8_gtk_menu_item_new_with_label (const gchar *label) +{ + GtkWidget *w; + gchar *s; + + if (!label) return NULL; + + s = e_utf8_to_gtk_string (NULL, label); + w = gtk_menu_item_new_with_label (s); + + if (s) g_free (s); + + return w; +} + + diff --git a/widgets/misc/e-unicode.h b/widgets/misc/e-unicode.h index 7bd46397e4..5df2932ac4 100644 --- a/widgets/misc/e-unicode.h +++ b/widgets/misc/e-unicode.h @@ -29,5 +29,7 @@ void e_utf8_gtk_entry_set_text (GtkEntry *entry, const gchar *text); gchar *e_utf8_gtk_editable_get_chars (GtkEditable *editable, gint start, gint end); +GtkWidget *e_utf8_gtk_menu_item_new_with_label (const gchar *label); + #endif -- cgit