aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorLauris Kaplinski <lauris@src.gnome.org>2000-09-02 10:51:32 +0800
committerLauris Kaplinski <lauris@src.gnome.org>2000-09-02 10:51:32 +0800
commite8ae4bc97abed6ad8571908f5fc4ac6fd5565fde (patch)
treee81cd450c3094cf33bbda8d65508b6edd5654625
parent16829497fd3a11bae35aaa440ee18ede4961ceb9 (diff)
downloadgsoc2013-evolution-e8ae4bc97abed6ad8571908f5fc4ac6fd5565fde.tar.gz
gsoc2013-evolution-e8ae4bc97abed6ad8571908f5fc4ac6fd5565fde.tar.zst
gsoc2013-evolution-e8ae4bc97abed6ad8571908f5fc4ac6fd5565fde.zip
A bit more e_utf8 wrappers here and there
svn path=/trunk/; revision=5180
-rw-r--r--addressbook/ChangeLog6
-rw-r--r--addressbook/contact-editor/e-contact-editor-categories.c6
-rw-r--r--addressbook/contact-editor/e-contact-editor.c4
-rw-r--r--addressbook/gui/contact-editor/e-contact-editor-categories.c6
-rw-r--r--addressbook/gui/contact-editor/e-contact-editor.c4
-rw-r--r--calendar/ChangeLog6
-rw-r--r--calendar/gui/event-editor.c9
-rw-r--r--calendar/gui/gncal-todo.c3
-rw-r--r--camel/ChangeLog4
-rw-r--r--camel/camel-folder-search.c3
-rw-r--r--composer/ChangeLog4
-rw-r--r--composer/e-msg-composer-address-dialog.c10
-rw-r--r--e-util/ChangeLog6
-rw-r--r--e-util/e-unicode.c50
-rw-r--r--e-util/e-unicode.h7
-rw-r--r--mail/ChangeLog7
-rw-r--r--mail/mail-config-gui.c24
-rw-r--r--mail/main.c3
-rw-r--r--shell/ChangeLog4
-rw-r--r--shell/e-shell-folder-creation-dialog.c6
-rw-r--r--widgets/e-text/e-text-test.c3
-rw-r--r--widgets/misc/e-unicode.c50
-rw-r--r--widgets/misc/e-unicode.h7
-rw-r--r--widgets/text/e-text-test.c3
24 files changed, 192 insertions, 43 deletions
diff --git a/addressbook/ChangeLog b/addressbook/ChangeLog
index 51db4eef14..8ca4a69bcc 100644
--- a/addressbook/ChangeLog
+++ b/addressbook/ChangeLog
@@ -1,3 +1,9 @@
+2000-09-02 Lauris kaplinski <lauris@helixcode.com>
+
+ * contact-editor/e-contact-editor-categories.c: e_utf8 wrappers
+
+ * contact-editor/e-contact-editor.c: e_utf8 wrappers
+
2000-09-01 Ettore Perazzoli <ettore@helixcode.com>
* gui/component/e-ldap-storage.c (load_ldap_data): Updated for the
diff --git a/addressbook/contact-editor/e-contact-editor-categories.c b/addressbook/contact-editor/e-contact-editor-categories.c
index 9251a86948..118f08a2a3 100644
--- a/addressbook/contact-editor/e-contact-editor-categories.c
+++ b/addressbook/contact-editor/e-contact-editor-categories.c
@@ -218,7 +218,7 @@ e_contact_editor_categories_entry_change (GtkWidget *entry,
EContactEditorCategories *categories)
{
g_free(categories->categories);
- categories->categories = g_strdup(gtk_entry_get_text(GTK_ENTRY(entry)));
+ categories->categories = e_utf8_gtk_entry_get_text(GTK_ENTRY(entry));
do_parse_categories(categories);
}
@@ -342,7 +342,7 @@ e_contact_editor_categories_set_arg (GtkObject *o, GtkArg *arg, guint arg_id)
switch (arg_id){
case ARG_CATEGORIES:
- gtk_entry_set_text(GTK_ENTRY(e_contact_editor_categories->entry), GTK_VALUE_STRING (*arg));
+ e_utf8_gtk_entry_set_text(GTK_ENTRY(e_contact_editor_categories->entry), GTK_VALUE_STRING (*arg));
break;
}
}
@@ -407,7 +407,7 @@ e_contact_editor_categories_set_value_at (ETableModel *etc, int col, int row, co
}
strs[j] = 0;
string = g_strjoinv(", ", strs);
- gtk_entry_set_text(GTK_ENTRY(categories->entry), string);
+ e_utf8_gtk_entry_set_text(GTK_ENTRY(categories->entry), string);
g_free(string);
g_free(strs);
}
diff --git a/addressbook/contact-editor/e-contact-editor.c b/addressbook/contact-editor/e-contact-editor.c
index aa9b1ff9c9..c2d4450a7b 100644
--- a/addressbook/contact-editor/e-contact-editor.c
+++ b/addressbook/contact-editor/e-contact-editor.c
@@ -359,8 +359,8 @@ file_as_set_style(EContactEditor *editor, int style)
if (style == -1) {
- string = gtk_entry_get_text(file_as);
- strings = g_list_append(strings, g_strdup(string));
+ string = e_utf8_gtk_entry_get_text(file_as);
+ strings = g_list_append(strings, string);
}
widget = glade_xml_get_widget(editor->gui, "combo-file-as");
diff --git a/addressbook/gui/contact-editor/e-contact-editor-categories.c b/addressbook/gui/contact-editor/e-contact-editor-categories.c
index 9251a86948..118f08a2a3 100644
--- a/addressbook/gui/contact-editor/e-contact-editor-categories.c
+++ b/addressbook/gui/contact-editor/e-contact-editor-categories.c
@@ -218,7 +218,7 @@ e_contact_editor_categories_entry_change (GtkWidget *entry,
EContactEditorCategories *categories)
{
g_free(categories->categories);
- categories->categories = g_strdup(gtk_entry_get_text(GTK_ENTRY(entry)));
+ categories->categories = e_utf8_gtk_entry_get_text(GTK_ENTRY(entry));
do_parse_categories(categories);
}
@@ -342,7 +342,7 @@ e_contact_editor_categories_set_arg (GtkObject *o, GtkArg *arg, guint arg_id)
switch (arg_id){
case ARG_CATEGORIES:
- gtk_entry_set_text(GTK_ENTRY(e_contact_editor_categories->entry), GTK_VALUE_STRING (*arg));
+ e_utf8_gtk_entry_set_text(GTK_ENTRY(e_contact_editor_categories->entry), GTK_VALUE_STRING (*arg));
break;
}
}
@@ -407,7 +407,7 @@ e_contact_editor_categories_set_value_at (ETableModel *etc, int col, int row, co
}
strs[j] = 0;
string = g_strjoinv(", ", strs);
- gtk_entry_set_text(GTK_ENTRY(categories->entry), string);
+ e_utf8_gtk_entry_set_text(GTK_ENTRY(categories->entry), string);
g_free(string);
g_free(strs);
}
diff --git a/addressbook/gui/contact-editor/e-contact-editor.c b/addressbook/gui/contact-editor/e-contact-editor.c
index aa9b1ff9c9..c2d4450a7b 100644
--- a/addressbook/gui/contact-editor/e-contact-editor.c
+++ b/addressbook/gui/contact-editor/e-contact-editor.c
@@ -359,8 +359,8 @@ file_as_set_style(EContactEditor *editor, int style)
if (style == -1) {
- string = gtk_entry_get_text(file_as);
- strings = g_list_append(strings, g_strdup(string));
+ string = e_utf8_gtk_entry_get_text(file_as);
+ strings = g_list_append(strings, string);
}
widget = glade_xml_get_widget(editor->gui, "combo-file-as");
diff --git a/calendar/ChangeLog b/calendar/ChangeLog
index 197410c3a2..1d663f2f75 100644
--- a/calendar/ChangeLog
+++ b/calendar/ChangeLog
@@ -1,3 +1,9 @@
+2000-09-02 Lauris Kaplinski <lauris@helixcode.com>
+
+ * gui/event-editor.c: e_utf8 wrappers
+
+ * gui/gncal-todo.c: e_utf8_wrappers
+
2000-09-02 Christopher James Lahey <clahey@helixcode.com>
* conduits/calendar/calendar-conduit.c,
diff --git a/calendar/gui/event-editor.c b/calendar/gui/event-editor.c
index c3c41e5cd5..34c659b163 100644
--- a/calendar/gui/event-editor.c
+++ b/calendar/gui/event-editor.c
@@ -25,6 +25,7 @@
#include <gnome.h>
#include <glade/glade.h>
#include <e-util/e-dialog-widgets.h>
+#include <e-util/e-unicode.h>
#include <cal-util/timeutil.h>
#include "event-editor.h"
@@ -1942,14 +1943,14 @@ append_exception (EventEditor *ee, time_t t)
priv = ee->priv;
- c[0] = get_exception_string (t);
-
tt = g_new (time_t, 1);
*tt = t;
clist = GTK_CLIST (priv->recurrence_exceptions_list);
- i = gtk_clist_append (clist, c);
+ c[0] = get_exception_string (t);
+ i = e_utf8_gtk_clist_append (clist, c);
+
gtk_clist_set_row_data (clist, i, tt);
gtk_clist_select_row (clist, i, 0);
@@ -2014,7 +2015,7 @@ recurrence_exception_changed (GtkWidget *widget, EventEditor *ee)
t = gtk_clist_get_row_data (clist, sel);
*t = e_dialog_dateedit_get (priv->recurrence_exceptions_date);
- gtk_clist_set_text (clist, sel, 0, get_exception_string (*t));
+ e_utf8_gtk_clist_set_text (clist, sel, 0, get_exception_string (*t));
}
diff --git a/calendar/gui/gncal-todo.c b/calendar/gui/gncal-todo.c
index 8f39c09411..47d63e35e9 100644
--- a/calendar/gui/gncal-todo.c
+++ b/calendar/gui/gncal-todo.c
@@ -7,6 +7,7 @@
#include <config.h>
#include <gnome.h>
+#include "e-util/e-unicode.h"
#include "event-editor.h"
#include "gncal-todo.h"
@@ -177,7 +178,7 @@ gncal_todo_edit (CalClient *client, CalComponent *comp)
entry = gtk_entry_new ();
cal_component_get_summary (comp, &text);
- gtk_entry_set_text (GTK_ENTRY (entry), text.value);
+ e_utf8_gtk_entry_set_text (GTK_ENTRY (entry), text.value);
gtk_box_pack_start (GTK_BOX (hbox), entry, TRUE, TRUE, 0);
gtk_widget_show (entry);
diff --git a/camel/ChangeLog b/camel/ChangeLog
index a02d92990a..53a99e5516 100644
--- a/camel/ChangeLog
+++ b/camel/ChangeLog
@@ -1,3 +1,7 @@
+2000-09-02 Lauris Kaplinski <lauris@helixcode.com>
+
+ * camel-folder-search (search_header_contains): Use e_utf8_strstrcase
+
2000-09-01 Christopher James Lahey <clahey@helixcode.com>
* providers/imap/camel-imap-utils.c: Removed some unused
diff --git a/camel/camel-folder-search.c b/camel/camel-folder-search.c
index 1c68f369ee..95b2f3d636 100644
--- a/camel/camel-folder-search.c
+++ b/camel/camel-folder-search.c
@@ -27,6 +27,7 @@
#include <string.h>
#include <glib.h>
+#include <e-util/e-unicode.h>
#include "camel-folder-search.h"
#include "string-utils.h"
@@ -406,7 +407,7 @@ search_header_contains(struct _ESExp *f, int argc, struct _ESExpResult **argv, C
/* performs an OR of all words */
for (i=1;i<argc && !truth;i++) {
if (argv[i]->type == ESEXP_RES_STRING
- && e_strstrcase (header, argv[i]->value.string)) {
+ && e_utf8_strstrcase (header, argv[i]->value.string)) {
r(printf("%s got a match with %s of %s\n", search->current->uid, header, argv[i]->value.string));
truth = TRUE;
break;
diff --git a/composer/ChangeLog b/composer/ChangeLog
index e6689b1ce0..02f48c58a5 100644
--- a/composer/ChangeLog
+++ b/composer/ChangeLog
@@ -1,3 +1,7 @@
+2000-09-02 Lauris Kaplinski <lauris@helixcode.com>
+
+ * e-msg-composer-address-dialog.c: Use e_utf8 wrappers
+
2000-09-01 Jeffrey Stedfast <fejj@helixcode.com>
* e-msg-composer.c (e_msg_composer_get_sig_file): This needs to
diff --git a/composer/e-msg-composer-address-dialog.c b/composer/e-msg-composer-address-dialog.c
index 5eec51c435..868bafb414 100644
--- a/composer/e-msg-composer-address-dialog.c
+++ b/composer/e-msg-composer-address-dialog.c
@@ -23,6 +23,7 @@
#include <gnome.h>
#include "e-msg-composer-address-dialog.h"
+#include <e-util/e-unicode.h>
enum {
@@ -53,7 +54,7 @@ load_addresses (EMsgComposerAddressDialog *dialog)
clist = GTK_CLIST (glade_xml_get_widget (dialog->gui, "address_clist"));
for (i = 0; text[i][0] != NULL; i++)
- gtk_clist_append (clist, text[i]);
+ e_utf8_gtk_clist_append (clist, text[i]);
}
/* Combine name and email into an address, e.g. "Ettore Perazzoli
@@ -89,12 +90,15 @@ add_address (EMsgComposerAddressDialog *dialog,
gtk_clist_get_text (src_clist, row, 0, &name);
gtk_clist_get_text (src_clist, row, 1, &email);
+ name = e_utf8_from_gtk_string ((GtkWidget *) src_clist, name);
+
text[0] = make_full_address (name, email);
text[1] = NULL;
- gtk_clist_append (dest_clist, text);
+ e_utf8_gtk_clist_append (dest_clist, text);
g_free (text[0]);
+ g_free (name);
}
static void
@@ -570,7 +574,7 @@ set_list (EMsgComposerAddressDialog *dialog,
text[1] = NULL;
for (p = list; p != NULL; p = p->next) {
text[0] = (gchar *) p->data;
- gtk_clist_append (clist, text);
+ e_utf8_gtk_clist_append (clist, text);
}
gtk_clist_thaw (clist);
diff --git a/e-util/ChangeLog b/e-util/ChangeLog
index 49c0b4ee8a..3fc150fc83 100644
--- a/e-util/ChangeLog
+++ b/e-util/ChangeLog
@@ -1,3 +1,9 @@
+2000-09-02 Lauris Kaplinski <lauris@helixcode.com>
+
+ * e-unicode.h, e-unicode.c: New functions
+ e_utf8_gtk_clist_append, e_utf8_gtk_clist_set_text
+ e_unicode_init
+
2000-08-31 Lauris Kaplinski <lauris@helixcode.com>
* e-html-utils.c (e_text_to_html): Use UTF-8
diff --git a/e-util/e-unicode.c b/e-util/e-unicode.c
index cf8976f109..eba9bd56d1 100644
--- a/e-util/e-unicode.c
+++ b/e-util/e-unicode.c
@@ -11,6 +11,17 @@
#include <gdk/gdk.h>
#include "e-unicode.h"
+void
+e_unicode_init (void)
+{
+ static gboolean initialized = FALSE;
+
+ if (!initialized) {
+ unicode_init ();
+ initialized = TRUE;
+ }
+}
+
const gchar *
e_utf8_strstrcase (const gchar *haystack, const gchar *needle)
{
@@ -85,7 +96,7 @@ e_utf8_from_gtk_event_key (GtkWidget *widget, guint keyval, const gchar *string)
if (!string) return NULL;
if (!uinit) {
- unicode_init ();
+ e_unicode_init ();
uiconv = unicode_iconv_open ("UTF-8", "iso-8859-1");
if (uiconv == (unicode_iconv_t) -1) {
uerror = TRUE;
@@ -123,7 +134,7 @@ e_utf8_from_gtk_string (GtkWidget *widget, const gchar *string)
if (!string) return NULL;
if (!uinit) {
- unicode_init ();
+ e_unicode_init ();
uiconv = unicode_iconv_open ("UTF-8", "iso-8859-1");
if (uiconv == (unicode_iconv_t) -1) {
uerror = TRUE;
@@ -160,7 +171,7 @@ e_utf8_to_gtk_string (GtkWidget *widget, const gchar *string)
if (!string) return NULL;
if (!uinit) {
- unicode_init ();
+ e_unicode_init ();
uiconv = unicode_iconv_open ("iso-8859-1", "UTF-8");
if (uiconv == (unicode_iconv_t) -1) {
uerror = TRUE;
@@ -233,6 +244,39 @@ e_utf8_gtk_menu_item_new_with_label (const gchar *label)
return w;
}
+void
+e_utf8_gtk_clist_set_text (GtkCList *clist, gint row, gint col, const gchar *text)
+{
+ gchar *s;
+
+ if (!text) return;
+
+ s = e_utf8_to_gtk_string ((GtkWidget *) clist, text);
+ gtk_clist_set_text (clist, row, col, s);
+
+ if (s) g_free (s);
+}
+
+gint
+e_utf8_gtk_clist_append (GtkCList *clist, gchar *text[])
+{
+ gint row, i;
+ gchar **v;
+
+ if (!text) return 0;
+
+ v = g_new (gchar *, clist->columns);
+ for (i = 0; i < clist->columns; i++)
+ v[i] = e_utf8_to_gtk_string ((GtkWidget *) clist, text[i]);
+
+ row = gtk_clist_append (clist, v);
+
+ for (i = 0; i < clist->columns; i++)
+ if (v[i]) g_free (v[i]);
+
+ return row;
+}
+
/**
* g_unichar_to_utf8:
* @ch: a ISO10646 character code
diff --git a/e-util/e-unicode.h b/e-util/e-unicode.h
index a69d1a3403..00cc3ab292 100644
--- a/e-util/e-unicode.h
+++ b/e-util/e-unicode.h
@@ -12,6 +12,8 @@
#define gnome_font_lookup_default gnome_font_get_glyph
#endif
+void e_unicode_init (void);
+
/*
* e_utf8_strstrcase
*/
@@ -31,15 +33,18 @@ gchar * e_utf8_to_gtk_string (GtkWidget *widget, const gchar *string);
/* NB! This return newly allocated string, not const as gtk+ one */
gchar *e_utf8_gtk_entry_get_text (GtkEntry *entry);
-
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);
+void e_utf8_gtk_clist_set_text (GtkCList *clist, gint row, gint col, const gchar *text);
+gint e_utf8_gtk_clist_append (GtkCList *clist, gchar *text[]);
+
gint g_unichar_to_utf8 (gint c, gchar *outbuf);
guint32 gdk_keyval_to_unicode (guint keysym);
#endif
+
diff --git a/mail/ChangeLog b/mail/ChangeLog
index f1d01d5b58..f3cd8e7fa7 100644
--- a/mail/ChangeLog
+++ b/mail/ChangeLog
@@ -1,3 +1,10 @@
+2000-09-02 Lauris Kaplinski <lauris@helixcode.com>
+
+ * mail-config-gui.c: Use e_utf8 wrappers
+
+ * main.c (main): Do e_unicode_init, so we are not confusing
+ libunicode
+
2000-09-01 Christopher James Lahey <clahey@helixcode.com>
* folder-browser.c: Removed a warning.
diff --git a/mail/mail-config-gui.c b/mail/mail-config-gui.c
index 8a007dc1c1..90437f6267 100644
--- a/mail/mail-config-gui.c
+++ b/mail/mail-config-gui.c
@@ -1727,7 +1727,7 @@ identities_add_clicked (GtkWidget *widget, MailDialog *dialog)
text[2] = id->org;
text[3] = id->sig;
- row = gtk_clist_append (GTK_CLIST (clist), text);
+ row = e_utf8_gtk_clist_append (GTK_CLIST (clist), text);
gtk_clist_set_row_data (GTK_CLIST (clist), row, id);
gtk_clist_select_row (GTK_CLIST (clist), row, 0);
dialog->maxidrow++;
@@ -1751,10 +1751,10 @@ identities_edit_clicked (GtkWidget *widget, MailDialog *dialog)
if (id2) {
GtkCList *clist = GTK_CLIST (dialog->clistIdentities);
- gtk_clist_set_text (clist, dialog->idrow, 0, id2->name);
- gtk_clist_set_text (clist, dialog->idrow, 1, id2->address);
- gtk_clist_set_text (clist, dialog->idrow, 2, id2->org);
- gtk_clist_set_text (clist, dialog->idrow, 3, id2->sig);
+ e_utf8_gtk_clist_set_text (clist, dialog->idrow, 0, id2->name);
+ e_utf8_gtk_clist_set_text (clist, dialog->idrow, 1, id2->address);
+ e_utf8_gtk_clist_set_text (clist, dialog->idrow, 2, id2->org);
+ e_utf8_gtk_clist_set_text (clist, dialog->idrow, 3, id2->sig);
gtk_clist_set_row_data (clist, dialog->idrow, id2);
identity_destroy (id);
@@ -1804,7 +1804,7 @@ sources_add_clicked (GtkWidget *widget, MailDialog *dialog)
text[0] = source->url;
- row = gtk_clist_append (clist, text);
+ row = e_utf8_gtk_clist_append (clist, text);
gtk_clist_set_row_data (clist, row, source);
gtk_clist_select_row (clist, row, 0);
dialog->maxsrow++;
@@ -1828,7 +1828,7 @@ sources_edit_clicked (GtkWidget *widget, MailDialog *dialog)
if (source2) {
GtkCList *clist = GTK_CLIST (dialog->clistSources);
- gtk_clist_set_text (clist, dialog->srow, 0, source2->url);
+ e_utf8_gtk_clist_set_text (clist, dialog->srow, 0, source2->url);
gtk_clist_set_row_data (clist, dialog->srow, source2);
service_destroy (source);
@@ -1877,7 +1877,7 @@ news_add_clicked (GtkWidget *widget, MailDialog *dialog)
text[0] = news->url;
- row = gtk_clist_append (clist, text);
+ row = e_utf8_gtk_clist_append (clist, text);
gtk_clist_set_row_data (clist, row, news);
gtk_clist_select_row (clist, row, 0);
dialog->maxnrow++;
@@ -1901,7 +1901,7 @@ news_edit_clicked (GtkWidget *widget, MailDialog *dialog)
if (news2) {
GtkCList *clist = GTK_CLIST (dialog->clistNews);
- gtk_clist_set_text (clist, dialog->nrow, 0, news2->url);
+ e_utf8_gtk_clist_set_text (clist, dialog->nrow, 0, news2->url);
gtk_clist_set_row_data (clist, dialog->nrow, news2);
service_destroy (news);
@@ -2074,7 +2074,7 @@ mail_config (Evolution_Shell shell)
text[2] = id->org;
text[3] = id->sig;
- row = gtk_clist_append (clist, text);
+ row = e_utf8_gtk_clist_append (clist, text);
gtk_clist_set_row_data (clist, row, id);
}
@@ -2114,7 +2114,7 @@ mail_config (Evolution_Shell shell)
text[0] = source->url;
- row = gtk_clist_append (clist, text);
+ row = e_utf8_gtk_clist_append (clist, text);
gtk_clist_set_row_data (clist, row, source);
}
@@ -2154,7 +2154,7 @@ mail_config (Evolution_Shell shell)
text[0] = news->url;
- row = gtk_clist_append (clist, text);
+ row = e_utf8_gtk_clist_append (clist, text);
gtk_clist_set_row_data (clist, row, news);
}
diff --git a/mail/main.c b/mail/main.c
index be35d52fd4..0ab58f9a3d 100644
--- a/mail/main.c
+++ b/mail/main.c
@@ -23,6 +23,7 @@
#include "e-util/e-gui-utils.h"
#include "e-util/e-cursors.h"
+#include "e-util/e-unicode.h"
#include "component-factory.h"
#include "mail.h"
@@ -57,6 +58,8 @@ main (int argc, char *argv [])
glade_gnome_init ();
+ e_unicode_init ();
+
session_init ();
e_cursors_init ();
diff --git a/shell/ChangeLog b/shell/ChangeLog
index 67027a5c15..1c019cc6ee 100644
--- a/shell/ChangeLog
+++ b/shell/ChangeLog
@@ -1,3 +1,7 @@
+2000-09-02 Lauris Kaplinski <lauris@helixcode.com>
+
+ * e-shell-folder-creation-dialog.c: Use e_utf8 wrappers
+
2000-09-01 Chris Toshok <toshok@helixcode.com>
* e-storage-set-view.c (removed_folder_cb): free node_data.
diff --git a/shell/e-shell-folder-creation-dialog.c b/shell/e-shell-folder-creation-dialog.c
index e793b2ccff..e9beb13670 100644
--- a/shell/e-shell-folder-creation-dialog.c
+++ b/shell/e-shell-folder-creation-dialog.c
@@ -30,6 +30,7 @@
#include "e-util/e-gui-utils.h"
#include "e-util/e-util.h"
+#include "e-util/e-unicode.h"
#include "widgets/misc/e-scroll-frame.h"
@@ -117,7 +118,7 @@ dialog_clicked_cb (GnomeDialog *dialog,
GtkWidget *folder_type_menu_item;
const char *folder_type;
const char *parent_path;
- const char *folder_name;
+ char *folder_name;
char *path;
if (button_number != 0) {
@@ -141,8 +142,9 @@ dialog_clicked_cb (GnomeDialog *dialog,
return;
}
- folder_name = gtk_entry_get_text (GTK_ENTRY (dialog_data->folder_name_entry));
+ folder_name = e_utf8_gtk_entry_get_text (GTK_ENTRY (dialog_data->folder_name_entry));
path = g_concat_dir_and_file (parent_path, folder_name);
+ g_free (folder_name);
storage_set = e_shell_get_storage_set (dialog_data->shell);
diff --git a/widgets/e-text/e-text-test.c b/widgets/e-text/e-text-test.c
index 12a31cce7e..45fa1fc3d7 100644
--- a/widgets/e-text/e-text-test.c
+++ b/widgets/e-text/e-text-test.c
@@ -8,6 +8,7 @@
#include "e-text.h"
#include <gnome.h>
#include "e-util/e-canvas.h"
+#include "e-util/e-unicode.h"
GnomeCanvasItem *rect;
static void allocate_callback(GtkWidget *canvas, GtkAllocation *allocation, GnomeCanvasItem *item)
@@ -55,7 +56,7 @@ change_text_cb (GtkEntry *entry,
{
gchar *str;
- str = gtk_entry_get_text (entry);
+ str = e_utf8_gtk_entry_get_text (entry);
gnome_canvas_item_set (GNOME_CANVAS_ITEM (text),
"text", str,
NULL);
diff --git a/widgets/misc/e-unicode.c b/widgets/misc/e-unicode.c
index cf8976f109..eba9bd56d1 100644
--- a/widgets/misc/e-unicode.c
+++ b/widgets/misc/e-unicode.c
@@ -11,6 +11,17 @@
#include <gdk/gdk.h>
#include "e-unicode.h"
+void
+e_unicode_init (void)
+{
+ static gboolean initialized = FALSE;
+
+ if (!initialized) {
+ unicode_init ();
+ initialized = TRUE;
+ }
+}
+
const gchar *
e_utf8_strstrcase (const gchar *haystack, const gchar *needle)
{
@@ -85,7 +96,7 @@ e_utf8_from_gtk_event_key (GtkWidget *widget, guint keyval, const gchar *string)
if (!string) return NULL;
if (!uinit) {
- unicode_init ();
+ e_unicode_init ();
uiconv = unicode_iconv_open ("UTF-8", "iso-8859-1");
if (uiconv == (unicode_iconv_t) -1) {
uerror = TRUE;
@@ -123,7 +134,7 @@ e_utf8_from_gtk_string (GtkWidget *widget, const gchar *string)
if (!string) return NULL;
if (!uinit) {
- unicode_init ();
+ e_unicode_init ();
uiconv = unicode_iconv_open ("UTF-8", "iso-8859-1");
if (uiconv == (unicode_iconv_t) -1) {
uerror = TRUE;
@@ -160,7 +171,7 @@ e_utf8_to_gtk_string (GtkWidget *widget, const gchar *string)
if (!string) return NULL;
if (!uinit) {
- unicode_init ();
+ e_unicode_init ();
uiconv = unicode_iconv_open ("iso-8859-1", "UTF-8");
if (uiconv == (unicode_iconv_t) -1) {
uerror = TRUE;
@@ -233,6 +244,39 @@ e_utf8_gtk_menu_item_new_with_label (const gchar *label)
return w;
}
+void
+e_utf8_gtk_clist_set_text (GtkCList *clist, gint row, gint col, const gchar *text)
+{
+ gchar *s;
+
+ if (!text) return;
+
+ s = e_utf8_to_gtk_string ((GtkWidget *) clist, text);
+ gtk_clist_set_text (clist, row, col, s);
+
+ if (s) g_free (s);
+}
+
+gint
+e_utf8_gtk_clist_append (GtkCList *clist, gchar *text[])
+{
+ gint row, i;
+ gchar **v;
+
+ if (!text) return 0;
+
+ v = g_new (gchar *, clist->columns);
+ for (i = 0; i < clist->columns; i++)
+ v[i] = e_utf8_to_gtk_string ((GtkWidget *) clist, text[i]);
+
+ row = gtk_clist_append (clist, v);
+
+ for (i = 0; i < clist->columns; i++)
+ if (v[i]) g_free (v[i]);
+
+ return row;
+}
+
/**
* g_unichar_to_utf8:
* @ch: a ISO10646 character code
diff --git a/widgets/misc/e-unicode.h b/widgets/misc/e-unicode.h
index a69d1a3403..00cc3ab292 100644
--- a/widgets/misc/e-unicode.h
+++ b/widgets/misc/e-unicode.h
@@ -12,6 +12,8 @@
#define gnome_font_lookup_default gnome_font_get_glyph
#endif
+void e_unicode_init (void);
+
/*
* e_utf8_strstrcase
*/
@@ -31,15 +33,18 @@ gchar * e_utf8_to_gtk_string (GtkWidget *widget, const gchar *string);
/* NB! This return newly allocated string, not const as gtk+ one */
gchar *e_utf8_gtk_entry_get_text (GtkEntry *entry);
-
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);
+void e_utf8_gtk_clist_set_text (GtkCList *clist, gint row, gint col, const gchar *text);
+gint e_utf8_gtk_clist_append (GtkCList *clist, gchar *text[]);
+
gint g_unichar_to_utf8 (gint c, gchar *outbuf);
guint32 gdk_keyval_to_unicode (guint keysym);
#endif
+
diff --git a/widgets/text/e-text-test.c b/widgets/text/e-text-test.c
index 12a31cce7e..45fa1fc3d7 100644
--- a/widgets/text/e-text-test.c
+++ b/widgets/text/e-text-test.c
@@ -8,6 +8,7 @@
#include "e-text.h"
#include <gnome.h>
#include "e-util/e-canvas.h"
+#include "e-util/e-unicode.h"
GnomeCanvasItem *rect;
static void allocate_callback(GtkWidget *canvas, GtkAllocation *allocation, GnomeCanvasItem *item)
@@ -55,7 +56,7 @@ change_text_cb (GtkEntry *entry,
{
gchar *str;
- str = gtk_entry_get_text (entry);
+ str = e_utf8_gtk_entry_get_text (entry);
gnome_canvas_item_set (GNOME_CANVAS_ITEM (text),
"text", str,
NULL);