aboutsummaryrefslogtreecommitdiffstats
path: root/composer
diff options
context:
space:
mode:
authorLauris Kaplinski <lauris@src.gnome.org>2000-08-25 12:31:13 +0800
committerLauris Kaplinski <lauris@src.gnome.org>2000-08-25 12:31:13 +0800
commit81f994a359a8f70efa3ffcca2004233387815b06 (patch)
treed2051c453ec0d6b4e88f5a730cb593b7605aa42e /composer
parent6252ffa2f5708c65bba754f74cda708558d733a7 (diff)
downloadgsoc2013-evolution-81f994a359a8f70efa3ffcca2004233387815b06.tar
gsoc2013-evolution-81f994a359a8f70efa3ffcca2004233387815b06.tar.gz
gsoc2013-evolution-81f994a359a8f70efa3ffcca2004233387815b06.tar.bz2
gsoc2013-evolution-81f994a359a8f70efa3ffcca2004233387815b06.tar.lz
gsoc2013-evolution-81f994a359a8f70efa3ffcca2004233387815b06.tar.xz
gsoc2013-evolution-81f994a359a8f70efa3ffcca2004233387815b06.tar.zst
gsoc2013-evolution-81f994a359a8f70efa3ffcca2004233387815b06.zip
More UTF-8 handling
svn path=/trunk/; revision=5032
Diffstat (limited to 'composer')
-rw-r--r--composer/ChangeLog8
-rw-r--r--composer/e-msg-composer-address-entry.c16
-rw-r--r--composer/e-msg-composer-attachment.c47
-rw-r--r--composer/e-msg-composer-hdrs.c11
4 files changed, 62 insertions, 20 deletions
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 <lauris@helixcode.com>
+
+ * 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 <peterw@helixcode.com>
* 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 <gnome.h>
-
+#include <e-util/e-unicode.h>
#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 <gnome.h>
#include <camel/camel.h>
+#include <e-util/e-unicode.h>
#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. */