aboutsummaryrefslogtreecommitdiffstats
path: root/calendar/gui/dialogs/comp-editor-util.c
diff options
context:
space:
mode:
authorDamon Chaplin <damon@ximian.com>2001-10-27 08:07:29 +0800
committerDamon Chaplin <damon@src.gnome.org>2001-10-27 08:07:29 +0800
commit7b5415e5005aa1b7142d288af466b58b7e95ac42 (patch)
tree0204cc0c59e6c3b8bbb5c1fb556fed1b3a04f6d7 /calendar/gui/dialogs/comp-editor-util.c
parent067aaf149ec31e530a344167f59a895eefb350b8 (diff)
downloadgsoc2013-evolution-7b5415e5005aa1b7142d288af466b58b7e95ac42.tar
gsoc2013-evolution-7b5415e5005aa1b7142d288af466b58b7e95ac42.tar.gz
gsoc2013-evolution-7b5415e5005aa1b7142d288af466b58b7e95ac42.tar.bz2
gsoc2013-evolution-7b5415e5005aa1b7142d288af466b58b7e95ac42.tar.lz
gsoc2013-evolution-7b5415e5005aa1b7142d288af466b58b7e95ac42.tar.xz
gsoc2013-evolution-7b5415e5005aa1b7142d288af466b58b7e95ac42.tar.zst
gsoc2013-evolution-7b5415e5005aa1b7142d288af466b58b7e95ac42.zip
convert the formatted date to UTF-8.
2001-10-26 Damon Chaplin <damon@ximian.com> * gui/e-itip-control.c (write_label_piece): convert the formatted date to UTF-8. * cal-util/cal-recur.c (CAL_OBJ_DEBUG): turn off debug functions. * gui/dialogs/comp-editor-util.c (parse_contact_string): handle UTF8 correctly. Bug #4450. Good enough for 1.0. * gui/e-week-view-event-item.c (e_week_view_draw_time): set the gc color before drawing. Should fix bug #11469. * gui/dialogs/task-editor.c (task_editor_edit_comp): show or hide the meeting page as appropriate. Note this may be called more than once, if the task gets updated somewhere else and the user clicks 'Update the object'. Hopefully fixes bug #12930. * gui/print.c (print_comp_item): printed more fields and made a little prettier. Fixes bug #9352. (print_date_label): used the correct timezones for each date field. * *.c: removed several debug messages. svn path=/trunk/; revision=14187
Diffstat (limited to 'calendar/gui/dialogs/comp-editor-util.c')
-rw-r--r--calendar/gui/dialogs/comp-editor-util.c30
1 files changed, 19 insertions, 11 deletions
diff --git a/calendar/gui/dialogs/comp-editor-util.c b/calendar/gui/dialogs/comp-editor-util.c
index 77939beee8..f031f35556 100644
--- a/calendar/gui/dialogs/comp-editor-util.c
+++ b/calendar/gui/dialogs/comp-editor-util.c
@@ -32,6 +32,7 @@
#include <liboaf/liboaf.h>
#include <bonobo/bonobo-control.h>
#include <bonobo/bonobo-widget.h>
+#include <gal/unicode/gunicode.h>
#include <e-destination.h>
#include <e-util/e-time-utils.h>
#include <cal-util/timeutil.h>
@@ -359,8 +360,7 @@ comp_editor_show_contacts_dialog (GNOME_Evolution_Addressbook_SelectNames corba_
/* A simple 'name <email>' parser. Input should be UTF8.
- FIXME: Should probably use camel functions or something.
- Also note that this is broken wrt UTF8 - can't use strchr etc. */
+ FIXME: Should probably use camel functions or something. */
static void
parse_contact_string (const char *value, char **name, char **email)
{
@@ -372,8 +372,8 @@ parse_contact_string (const char *value, char **name, char **email)
return;
}
- lbracket = strchr (value, '<');
- rbracket = strchr (value, '>');
+ lbracket = g_utf8_strchr (value, '<');
+ rbracket = g_utf8_strchr (value, '>');
if (!lbracket || !rbracket || rbracket < lbracket) {
*name = g_strdup (value);
@@ -381,9 +381,9 @@ parse_contact_string (const char *value, char **name, char **email)
return;
}
- name_end = lbracket - 1;
- while (name_end > value && isspace (*name_end))
- name_end--;
+ name_end = g_utf8_prev_char (lbracket);
+ while (name_end > value && g_unichar_isspace (g_utf8_get_char (name_end)))
+ name_end = g_utf8_prev_char (name_end);
tmp_name = g_malloc (name_end - value + 2);
strncpy (tmp_name, value, name_end - value + 1);
@@ -395,8 +395,10 @@ parse_contact_string (const char *value, char **name, char **email)
tmp_email[rbracket - lbracket - 1] = '\0';
*email = tmp_email;
+#if 0
g_print ("Parsed: %s\n Name:'%s'\nEmail:'%s'\n",
value, *name, *email);
+#endif
}
@@ -431,7 +433,9 @@ comp_editor_contacts_to_widget (GtkWidget *contacts_entry,
g_ptr_array_add (dest_array, NULL);
contacts_string = e_destination_exportv ((EDestination**) dest_array->pdata);
+#if 0
g_print ("Destinations: %s\n", contacts_string ? contacts_string : "");
+#endif
bonobo_widget_set_property (BONOBO_WIDGET (contacts_entry),
"destinations", contacts_string, NULL);
@@ -460,7 +464,9 @@ comp_editor_contacts_to_component (GtkWidget *contacts_entry,
bonobo_widget_get_property (BONOBO_WIDGET (contacts_entry),
"destinations", &contacts_string, NULL);
+#if 0
g_print ("Contacts string: %s\n", contacts_string ? contacts_string : "");
+#endif
contact_destv = e_destination_importv (contacts_string);
if (contact_destv) {
@@ -472,16 +478,18 @@ comp_editor_contacts_to_component (GtkWidget *contacts_entry,
t->altrep = NULL;
/* If both name and email are given, use the standard
- 'name <email>' form, otherwise use just the name
+ '"name" <email>' form, otherwise use just the name
or the email address.
FIXME: I'm not sure this is correct syntax etc. */
if (name && name[0] && email && email[0])
- t->value = g_strdup_printf ("%s <%s>",
+ t->value = g_strdup_printf ("\"%s\" <%s>",
name, email);
else if (name && name[0])
- t->value = g_strdup (name);
+ t->value = g_strdup_printf ("\"%s\"",
+ name);
else
- t->value = g_strdup (email);
+ t->value = g_strdup_printf ("<%s>",
+ email);
contact_list = g_slist_prepend (contact_list, t);