A bit more e_utf8 wrappers here and there

svn path=/trunk/; revision=5180
This commit is contained in:
Lauris Kaplinski
2000-09-02 02:51:32 +00:00
parent 16829497fd
commit e8ae4bc97a
24 changed files with 192 additions and 43 deletions

View File

@ -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

View File

@ -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);
}

View File

@ -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");

View File

@ -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);
}

View File

@ -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");

View File

@ -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,

View File

@ -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));
}

View File

@ -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);

View File

@ -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

View File

@ -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;

View File

@ -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

View File

@ -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);

View File

@ -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

View File

@ -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

View File

@ -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

View File

@ -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.

View File

@ -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);
}

View File

@ -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 ();

View File

@ -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.

View File

@ -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);

View File

@ -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);

View File

@ -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

View File

@ -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

View File

@ -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);