diff options
Diffstat (limited to 'addressbook/gui')
5 files changed, 76 insertions, 13 deletions
diff --git a/addressbook/gui/component/Makefile.am b/addressbook/gui/component/Makefile.am index 898a415747..29d3663f56 100644 --- a/addressbook/gui/component/Makefile.am +++ b/addressbook/gui/component/Makefile.am @@ -50,6 +50,8 @@ evolution_addressbook_LDADD = \ $(BONOBO_CONF_LIBS) \ $(top_builddir)/addressbook/gui/widgets/libeminicard.a \ $(top_builddir)/addressbook/backend/ebook/libebook.la \ + $(top_builddir)/camel/libcamel.la \ + $(top_builddir)/libibex/libibex.la \ $(top_builddir)/e-util/ename/libename.la \ $(top_builddir)/addressbook/gui/contact-list-editor/libecontactlisteditor.a \ $(top_builddir)/addressbook/gui/contact-editor/libecontacteditor.a \ diff --git a/addressbook/gui/component/addressbook-factory.c b/addressbook/gui/component/addressbook-factory.c index 6a5e79066a..305751aefd 100644 --- a/addressbook/gui/component/addressbook-factory.c +++ b/addressbook/gui/component/addressbook-factory.c @@ -18,6 +18,8 @@ #include <glade/glade.h> #include <gal/widgets/e-cursors.h> +#include <camel/camel.h> + #ifdef GTKHTML_HAVE_GCONF #include <gconf/gconf.h> #endif @@ -60,7 +62,6 @@ main (int argc, char **argv) init_corba (&argc, argv); - init_bonobo (argc, argv); /* FIXME: Messy names here. This file should be `main.c'. `addressbook.c' should @@ -84,6 +85,9 @@ main (int argc, char **argv) g_log_set_always_fatal (G_LOG_LEVEL_CRITICAL | G_LOG_LEVEL_WARNING); #endif + g_thread_init (NULL); + camel_type_init (); + bonobo_main (); return 0; diff --git a/addressbook/gui/component/select-names/e-select-names-completion.c b/addressbook/gui/component/select-names/e-select-names-completion.c index 1d1cde2489..8bee374f90 100644 --- a/addressbook/gui/component/select-names/e-select-names-completion.c +++ b/addressbook/gui/component/select-names/e-select-names-completion.c @@ -128,14 +128,19 @@ emailify_match (ECompletionMatch *match) const gchar *email = e_destination_get_email (dest); const gchar *menu_txt = e_completion_match_get_menu_text (match); - if (card && card->email && e_list_length (card->email) > 1 && !e_card_evolution_list (card)) { + if (card && email && !e_card_evolution_list (card)) { - if (email && strstr (menu_txt, email) == NULL) { + if (email + && menu_txt + && *menu_txt + && *menu_txt != '<' + && strstr (menu_txt, email) == NULL + && menu_txt[strlen(menu_txt)-1] != '>') { gchar *tmp = g_strdup_printf ("%s <%s>", menu_txt, email); - e_completion_match_set_text (match, - e_completion_match_get_match_text (match), - tmp); + gchar *tmp2 = g_strdup (e_completion_match_get_match_text (match)); + e_completion_match_set_text (match, tmp2, tmp); g_free (tmp); + g_free (tmp2); } match->sort_minor = e_destination_get_email_num (dest); @@ -412,6 +417,7 @@ match_name (ESelectNamesCompletion *comp, EDestination *dest) } if (menu_text) { + g_strstrip (menu_text); final_match = make_match (dest, menu_text, score); g_free (menu_text); } @@ -537,6 +543,13 @@ book_query_score (ESelectNamesCompletion *comp, EDestination *dest) } static void +hash_cleanup_fn (gpointer key, gpointer val, gpointer closure) +{ + g_free (key); + g_free (val); +} + +static void book_query_process_card_list (ESelectNamesCompletion *comp, const GList *cards) { while (cards) { diff --git a/addressbook/gui/component/select-names/e-select-names-popup.c b/addressbook/gui/component/select-names/e-select-names-popup.c index c4cb57533d..61de3a3c1f 100644 --- a/addressbook/gui/component/select-names/e-select-names-popup.c +++ b/addressbook/gui/component/select-names/e-select-names-popup.c @@ -205,6 +205,40 @@ init_html_mail (GnomeUIInfo *uiinfo, PopupInfo *info) } +/* Duplicate the string, mapping _ to __. This is to make sure that underscores in + e-mail addresses don't get mistaken for keyboard accelerators. */ +static gchar * +quote_label (const gchar *str) +{ + gint len = str ? strlen (str) : -1; + const gchar *c = str; + gchar *d, *q; + + if (len < 0) + return NULL; + + while (*c) { + if (*c == '_') + ++len; + ++c; + } + + q = g_new (gchar, len+1); + c = str; + d = q; + while (*c) { + *d = *c; + if (*c == '_') { + ++d; + *d = '_'; + } + ++c; + ++d; + } + *d = '\0'; + return q; +} + #define ARBITRARY_UIINFO_LIMIT 64 static GtkWidget * popup_menu_card (PopupInfo *info) @@ -217,6 +251,7 @@ popup_menu_card (PopupInfo *info) GtkWidget *pop; EIterator *iterator; gint html_toggle; + gchar *name_label; /* * Build up our GnomeUIInfo array. @@ -228,7 +263,8 @@ popup_menu_card (PopupInfo *info) card = e_destination_get_card (info->dest); uiinfo[i].type = GNOME_APP_UI_ITEM; - uiinfo[i].label = (gchar *) e_destination_get_name (info->dest); + name_label = quote_label (e_destination_get_name (info->dest)); + uiinfo[i].label = name_label; ++i; uiinfo[i].type = GNOME_APP_UI_SEPARATOR; @@ -301,6 +337,8 @@ popup_menu_card (PopupInfo *info) init_html_mail (&(uiinfo[html_toggle]), info); + g_free (name_label); + return pop; } @@ -318,16 +356,20 @@ popup_menu_nocard (PopupInfo *info) gint i=0; GtkWidget *pop; const gchar *str; + gchar *name_label; gint html_toggle; memset (uiinfo, 0, sizeof (uiinfo)); str = e_destination_get_name (info->dest); if (str == NULL) + str = e_destination_get_email (info->dest); + if (str == NULL) str = _("Unnamed Contact"); + name_label = quote_label (str); uiinfo[i].type = GNOME_APP_UI_ITEM; - uiinfo[i].label = (gchar *) str; + uiinfo[i].label = name_label; ++i; uiinfo[i].type = GNOME_APP_UI_SEPARATOR; @@ -354,6 +396,8 @@ popup_menu_nocard (PopupInfo *info) init_html_mail (&(uiinfo[html_toggle]), info); + g_free (name_label); + return pop; } diff --git a/addressbook/gui/component/select-names/e-select-names-text-model.c b/addressbook/gui/component/select-names/e-select-names-text-model.c index 0183fdd236..11b3b67323 100644 --- a/addressbook/gui/component/select-names/e-select-names-text-model.c +++ b/addressbook/gui/component/select-names/e-select-names-text-model.c @@ -371,8 +371,8 @@ e_select_names_text_model_insert_length (ETextModel *model, gint pos, const gcha gchar *str2 = g_strdup (str+offset); EDestination *d1 = e_destination_new (), *d2 = e_destination_new (); - e_destination_set_string (d1, str1); - e_destination_set_string (d2, str2); + e_destination_set_raw (d1, str1); + e_destination_set_raw (d2, str2); e_select_names_model_replace (source, index, d1); e_select_names_model_insert (source, index+1, d2); @@ -422,7 +422,7 @@ e_select_names_text_model_insert_length (ETextModel *model, gint pos, const gcha if (new_str) { EDestination *dest = e_destination_new (); - e_destination_set_string (dest, new_str); + e_destination_set_raw (dest, new_str); e_select_names_model_replace (source, index, dest); @@ -528,7 +528,7 @@ e_select_names_text_model_delete (ETextModel *model, gint pos, gint length) e_select_names_model_delete (source, index+1); new_dest = e_destination_new (); - e_destination_set_string (new_dest, new_str); + e_destination_set_raw (new_dest, new_str); e_select_names_model_replace (source, index, new_dest); g_free (new_str); @@ -604,7 +604,7 @@ e_select_names_text_model_delete (ETextModel *model, gint pos, gint length) EDestination *dest; dest = e_destination_new (); - e_destination_set_string (dest, new_str); + e_destination_set_raw (dest, new_str); e_select_names_model_replace (source, index, dest); if (out) |