aboutsummaryrefslogtreecommitdiffstats
path: root/e-util
diff options
context:
space:
mode:
authorChristopher James Lahey <clahey@helixcode.com>2000-09-11 17:58:06 +0800
committerChris Lahey <clahey@src.gnome.org>2000-09-11 17:58:06 +0800
commite30911d7d0806677fbd6ee239d0c47284c05a228 (patch)
treece6ab5dd297209e0d08fd0eeb11d3d001418b646 /e-util
parentf094dd14a3a21a1c3ede914c80c8b96692b388ad (diff)
downloadgsoc2013-evolution-e30911d7d0806677fbd6ee239d0c47284c05a228.tar
gsoc2013-evolution-e30911d7d0806677fbd6ee239d0c47284c05a228.tar.gz
gsoc2013-evolution-e30911d7d0806677fbd6ee239d0c47284c05a228.tar.bz2
gsoc2013-evolution-e30911d7d0806677fbd6ee239d0c47284c05a228.tar.lz
gsoc2013-evolution-e30911d7d0806677fbd6ee239d0c47284c05a228.tar.xz
gsoc2013-evolution-e30911d7d0806677fbd6ee239d0c47284c05a228.tar.zst
gsoc2013-evolution-e30911d7d0806677fbd6ee239d0c47284c05a228.zip
Added e_utf8_gtk_editable_get_text and e_utf8_gtk_editable_set_text.
2000-09-11 Christopher James Lahey <clahey@helixcode.com> * e-unicode.c, e-unicode.h: Added e_utf8_gtk_editable_get_text and e_utf8_gtk_editable_set_text. svn path=/trunk/; revision=5316
Diffstat (limited to 'e-util')
-rw-r--r--e-util/ChangeLog5
-rw-r--r--e-util/e-unicode.c44
-rw-r--r--e-util/e-unicode.h2
3 files changed, 41 insertions, 10 deletions
diff --git a/e-util/ChangeLog b/e-util/ChangeLog
index c3156ecee9..1f09bd1ec7 100644
--- a/e-util/ChangeLog
+++ b/e-util/ChangeLog
@@ -1,3 +1,8 @@
+2000-09-11 Christopher James Lahey <clahey@helixcode.com>
+
+ * e-unicode.c, e-unicode.h: Added e_utf8_gtk_editable_get_text and
+ e_utf8_gtk_editable_set_text.
+
2000-09-11 Lauris Kaplinski <lauris@helixcode.com>
* e-font.c: Try to find real bold variant of X font, fall
diff --git a/e-util/e-unicode.c b/e-util/e-unicode.c
index 8357977f8e..748f38a83a 100644
--- a/e-util/e-unicode.c
+++ b/e-util/e-unicode.c
@@ -21,7 +21,13 @@ e_unicode_init (void)
static gboolean initialized = FALSE;
if (!initialized) {
- unicode_init ();
+ unicode_iconv_t hackhack;
+
+ if ((hackhack = unicode_iconv_open("ASCII", "ASCII")) == (unicode_iconv_t) -1)
+ unicode_init ();
+ else
+ unicode_iconv_close(hackhack);
+
initialized = TRUE;
}
}
@@ -202,6 +208,7 @@ e_utf8_to_gtk_string (GtkWidget *widget, const gchar *string)
{
return e_utf8_to_gtk_string_sized (widget, string, strlen (string));
}
+
gchar *
e_utf8_gtk_entry_get_text (GtkEntry *entry)
{
@@ -214,6 +221,12 @@ e_utf8_gtk_entry_get_text (GtkEntry *entry)
}
gchar *
+e_utf8_gtk_editable_get_text (GtkEditable *editable)
+{
+ return e_utf8_gtk_editable_get_chars(editable, 0, -1);
+}
+
+gchar *
e_utf8_gtk_editable_get_chars (GtkEditable *editable, gint start, gint end)
{
gchar *s, *u;
@@ -238,18 +251,29 @@ e_utf8_gtk_editable_insert_text (GtkEditable *editable, const gchar *text, gint
}
void
-e_utf8_gtk_entry_set_text (GtkEntry *entry, const gchar *text)
+e_utf8_gtk_editable_set_text (GtkEditable *editable, const gchar *text)
{
- gchar *s;
-
- if (!text) return;
-
- s = e_utf8_to_gtk_string ((GtkWidget *) entry, text);
- gtk_entry_set_text (entry, s);
-
- if (s) g_free (s);
+ int position;
+ gtk_editable_delete_text(editable, 0, -1);
+ if (text)
+ e_utf8_gtk_editable_insert_text(editable, text, strlen(text), &position);
}
+void
+e_utf8_gtk_entry_set_text (GtkEntry *entry, const gchar *text)
+{
+ if (!text)
+ gtk_entry_set_text(entry, "");
+ else {
+ gchar *s;
+
+ s = e_utf8_to_gtk_string ((GtkWidget *) entry, text);
+ gtk_entry_set_text (entry, s);
+
+ if (s) g_free (s);
+ }
+}
+
GtkWidget *
e_utf8_gtk_menu_item_new_with_label (GtkMenu *menu, const gchar *label)
{
diff --git a/e-util/e-unicode.h b/e-util/e-unicode.h
index 654d8d94ee..57f5845c1f 100644
--- a/e-util/e-unicode.h
+++ b/e-util/e-unicode.h
@@ -37,6 +37,8 @@ gchar * e_utf8_to_gtk_string_sized (GtkWidget *widget, const gchar *string, gint
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_text (GtkEditable *editable);
+void e_utf8_gtk_editable_set_text (GtkEditable *editable, const gchar *text);
gchar *e_utf8_gtk_editable_get_chars (GtkEditable *editable, gint start, gint end);
void e_utf8_gtk_editable_insert_text (GtkEditable *editable, const gchar *text, gint length, gint *position);