From 03a5d4a3d316d8ec923d7bde331b1e96d08c6720 Mon Sep 17 00:00:00 2001 From: Christopher James Lahey Date: Sun, 2 Sep 2001 02:14:04 +0000 Subject: Bumped the version number to 0.11.99.2 for new e_utf8 functions. 2001-09-01 Christopher James Lahey * configure.in: Bumped the version number to 0.11.99.2 for new e_utf8 functions. * gal/widgets/e-unicode.c, gal/widgets/e-unicode.h (e_utf8_is_ascii): Added this function. Reformatted. svn path=/trunk/; revision=12557 --- widgets/misc/e-unicode.c | 15 ++++++ widgets/misc/e-unicode.h | 128 +++++++++++++++++++++++++++-------------------- 2 files changed, 89 insertions(+), 54 deletions(-) diff --git a/widgets/misc/e-unicode.c b/widgets/misc/e-unicode.c index edb7d3ee17..93130741d1 100644 --- a/widgets/misc/e-unicode.c +++ b/widgets/misc/e-unicode.c @@ -577,6 +577,21 @@ e_utf8_to_locale_string (const gchar *string) return e_utf8_to_locale_string_sized (string, strlen (string)); } +gboolean +e_utf8_is_ascii (const gchar *string) +{ + char c; + + g_return_val_if_fail (string != NULL, FALSE); + + for (; (c = *string); string++) { + if (c & 0x80) + return FALSE; + } + + return TRUE; +} + gchar * e_utf8_gtk_entry_get_text (GtkEntry *entry) { diff --git a/widgets/misc/e-unicode.h b/widgets/misc/e-unicode.h index 0b137dc200..966d96356a 100644 --- a/widgets/misc/e-unicode.h +++ b/widgets/misc/e-unicode.h @@ -35,65 +35,85 @@ BEGIN_GNOME_DECLS * not ascii/iso ones) are ignored). */ -const gchar *e_utf8_strstrcase (const gchar *haystack, const gchar *needle); -const gchar *e_utf8_strstrcasedecomp (const gchar *haystack, const gchar *needle); - -gchar *e_utf8_from_gtk_event_key (GtkWidget *widget, guint keyval, const gchar *string); - -gchar *e_utf8_from_iconv_string (iconv_t ic, const gchar *string); -gchar *e_utf8_from_iconv_string_sized (iconv_t ic, const gchar *string, gint bytes); - -gchar *e_utf8_to_iconv_string (iconv_t ic, const gchar *string); -gchar *e_utf8_to_iconv_string_sized (iconv_t ic, const gchar *string, gint bytes); - - -gchar *e_utf8_from_charset_string (const gchar *charset, const gchar *string); -gchar *e_utf8_from_charset_string_sized (const gchar *charset, const gchar *string, gint bytes); - -gchar *e_utf8_to_charset_string (const gchar *charset, const gchar *string); -gchar *e_utf8_to_charset_string_sized (const gchar *charset, const gchar *string, gint bytes); - - -gchar *e_utf8_from_gtk_string (GtkWidget *widget, const gchar *string); -gchar *e_utf8_from_gtk_string_sized (GtkWidget *widget, const gchar *string, gint bytes); - -gchar *e_utf8_to_gtk_string (GtkWidget *widget, const gchar *string); -gchar *e_utf8_to_gtk_string_sized (GtkWidget *widget, const gchar *string, gint bytes); - - -gchar *e_utf8_from_locale_string (const gchar *string); -gchar *e_utf8_from_locale_string_sized (const gchar *string, gint bytes); - -gchar *e_utf8_to_locale_string (const gchar *string); -gchar *e_utf8_to_locale_string_sized (const gchar *string, gint bytes); +const gchar *e_utf8_strstrcase (const gchar *haystack, + const gchar *needle); +const gchar *e_utf8_strstrcasedecomp (const gchar *haystack, + const gchar *needle); +gchar *e_utf8_from_gtk_event_key (GtkWidget *widget, + guint keyval, + const gchar *string); +gchar *e_utf8_from_iconv_string (iconv_t ic, + const gchar *string); +gchar *e_utf8_from_iconv_string_sized (iconv_t ic, + const gchar *string, + gint bytes); +gchar *e_utf8_to_iconv_string (iconv_t ic, + const gchar *string); +gchar *e_utf8_to_iconv_string_sized (iconv_t ic, + const gchar *string, + gint bytes); +gchar *e_utf8_from_charset_string (const gchar *charset, + const gchar *string); +gchar *e_utf8_from_charset_string_sized (const gchar *charset, + const gchar *string, + gint bytes); +gchar *e_utf8_to_charset_string (const gchar *charset, + const gchar *string); +gchar *e_utf8_to_charset_string_sized (const gchar *charset, + const gchar *string, + gint bytes); +gchar *e_utf8_from_gtk_string (GtkWidget *widget, + const gchar *string); +gchar *e_utf8_from_gtk_string_sized (GtkWidget *widget, + const gchar *string, + gint bytes); +gchar *e_utf8_to_gtk_string (GtkWidget *widget, + const gchar *string); +gchar *e_utf8_to_gtk_string_sized (GtkWidget *widget, + const gchar *string, + gint bytes); +gchar *e_utf8_from_locale_string (const gchar *string); +gchar *e_utf8_from_locale_string_sized (const gchar *string, + gint bytes); +gchar *e_utf8_to_locale_string (const gchar *string); +gchar *e_utf8_to_locale_string_sized (const gchar *string, + gint bytes); +gboolean e_utf8_is_ascii (const gchar *string); /* * These are simple wrappers that save us some typing */ /* 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_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); - -GtkWidget *e_utf8_gtk_menu_item_new_with_label (GtkMenu *menu, 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[]); - -gchar * e_utf8_xml1_decode (const gchar *text); -gchar * e_utf8_xml1_encode (const gchar *text); - -gint e_unichar_to_utf8 (gint c, gchar *outbuf); -gchar *e_unicode_get_utf8 (const gchar *text, gunichar *out); -guint32 gdk_keyval_to_unicode (guint keysym); - -gchar *e_xml_get_translated_utf8_string_prop_by_name (const xmlNode *parent, - const xmlChar *prop_name); +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); +GtkWidget *e_utf8_gtk_menu_item_new_with_label (GtkMenu *menu, + 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[]); +gchar *e_utf8_xml1_decode (const gchar *text); +gchar *e_utf8_xml1_encode (const gchar *text); +gint e_unichar_to_utf8 (gint c, + gchar *outbuf); +gchar *e_unicode_get_utf8 (const gchar *text, + gunichar *out); +guint32 gdk_keyval_to_unicode (guint keysym); +gchar *e_xml_get_translated_utf8_string_prop_by_name (const xmlNode *parent, + const xmlChar *prop_name); END_GNOME_DECLS -- cgit