aboutsummaryrefslogtreecommitdiffstats
path: root/addressbook
diff options
context:
space:
mode:
authorJon Trowbridge <trow@ximian.com>2001-08-03 11:09:35 +0800
committerJon Trowbridge <trow@src.gnome.org>2001-08-03 11:09:35 +0800
commit5b11f6dc1de45412cdfb5aded38b20f1d8bb8ce6 (patch)
treea7bd3df4d06e8bd33f148b6f47209c76a9ae4021 /addressbook
parent7fe5d849e52dced4b5dfd5289e59d87e2d092f6c (diff)
downloadgsoc2013-evolution-5b11f6dc1de45412cdfb5aded38b20f1d8bb8ce6.tar
gsoc2013-evolution-5b11f6dc1de45412cdfb5aded38b20f1d8bb8ce6.tar.gz
gsoc2013-evolution-5b11f6dc1de45412cdfb5aded38b20f1d8bb8ce6.tar.bz2
gsoc2013-evolution-5b11f6dc1de45412cdfb5aded38b20f1d8bb8ce6.tar.lz
gsoc2013-evolution-5b11f6dc1de45412cdfb5aded38b20f1d8bb8ce6.tar.xz
gsoc2013-evolution-5b11f6dc1de45412cdfb5aded38b20f1d8bb8ce6.tar.zst
gsoc2013-evolution-5b11f6dc1de45412cdfb5aded38b20f1d8bb8ce6.zip
Add camel dependency.
2001-08-02 Jon Trowbridge <trow@ximian.com> * printing/Makefile.am (ecpsdir): Add camel dependency. * gui/component/Makefile.am: Add camel dependency. * backend/ebook/Makefile.am: Add camel dependency. * gui/component/addressbook-factory.c (main): Properly init camel. * backend/ebook/e-destination.c (e_destination_clear_strings): Clear ->raw. (e_destination_is_empty): We aren't empty if ->raw is set.. (e_destination_set_raw): Replaces e_destination_set_string. (e_destination_get_name): Use camel's parser to extract the name from ->raw. (e_destination_get_email): Use camel's parser to extract the email address from ->raw. (e_destination_get_address): Use camel to produce properly quoted, RFC-compliant addresses. Thanks camel! (Bug #5860) * gui/component/select-names/e-select-names-completion.c (emailify_match): Always append an e-mail address, as long as it doesn't have one already at it's beginning or end. Don't limit self to just emailifying entries tied to cards with multiple addresses. (I didn't really want to do this, but people seem to like keeping multiple cards for the same person, and other solutions (like scanning all matches for duplicate names, and only emailifying those) just seemed like way too much work for such a limited payoff.) * gui/component/select-names/e-select-names-text-model.c: s/e_destination_set_string/e_destination_set_raw/. * gui/component/select-names/e-select-names-popup.c (popup_menu_card): Quote _'s in our popup menus, so that "foo_bar" doesn't get displayed as "foobar" w/ the 'b' underlined. (Bug #5558) (popup_menu_nocard): Ditto. 2001-08-02 Jon Trowbridge <trow@ximian.com> * Makefile.am: Added camel dependency (now needed by ebook). 2001-08-02 Jon Trowbridge <trow@ximian.com> * gui/Makefile.am: Added camel dependency (now needed by ebook). 2001-08-02 Jon Trowbridge <trow@ximian.com> * Makefile.am: Added camel dependency (now needed by ebook). svn path=/trunk/; revision=11602
Diffstat (limited to 'addressbook')
-rw-r--r--addressbook/ChangeLog40
-rw-r--r--addressbook/backend/ebook/Makefile.am18
-rw-r--r--addressbook/backend/ebook/e-destination.c211
-rw-r--r--addressbook/backend/ebook/e-destination.h2
-rw-r--r--addressbook/gui/component/Makefile.am2
-rw-r--r--addressbook/gui/component/addressbook-factory.c6
-rw-r--r--addressbook/gui/component/select-names/e-select-names-completion.c23
-rw-r--r--addressbook/gui/component/select-names/e-select-names-popup.c48
-rw-r--r--addressbook/gui/component/select-names/e-select-names-text-model.c10
-rw-r--r--addressbook/printing/Makefile.am6
10 files changed, 224 insertions, 142 deletions
diff --git a/addressbook/ChangeLog b/addressbook/ChangeLog
index f1e9fcbc0f..0f5e7fe4c6 100644
--- a/addressbook/ChangeLog
+++ b/addressbook/ChangeLog
@@ -1,3 +1,43 @@
+2001-08-02 Jon Trowbridge <trow@ximian.com>
+
+ * printing/Makefile.am (ecpsdir): Add camel dependency.
+
+ * gui/component/Makefile.am: Add camel dependency.
+
+ * backend/ebook/Makefile.am: Add camel dependency.
+
+ * gui/component/addressbook-factory.c (main): Properly init camel.
+
+ * backend/ebook/e-destination.c (e_destination_clear_strings):
+ Clear ->raw.
+ (e_destination_is_empty): We aren't empty if ->raw is set..
+ (e_destination_set_raw): Replaces e_destination_set_string.
+ (e_destination_get_name): Use camel's parser to extract the name
+ from ->raw.
+ (e_destination_get_email): Use camel's parser to extract the email
+ address from ->raw.
+ (e_destination_get_address): Use camel to produce properly quoted,
+ RFC-compliant addresses. Thanks camel! (Bug #5860)
+
+ * gui/component/select-names/e-select-names-completion.c
+ (emailify_match): Always append an e-mail address, as long as it
+ doesn't have one already at it's beginning or end. Don't limit
+ self to just emailifying entries tied to cards with multiple
+ addresses. (I didn't really want to do this, but people seem to
+ like keeping multiple cards for the same person, and other
+ solutions (like scanning all matches for duplicate names, and only
+ emailifying those) just seemed like way too much work for such a
+ limited payoff.)
+
+ * gui/component/select-names/e-select-names-text-model.c:
+ s/e_destination_set_string/e_destination_set_raw/.
+
+ * gui/component/select-names/e-select-names-popup.c
+ (popup_menu_card): Quote _'s in our popup menus, so that "foo_bar"
+ doesn't get displayed as "foobar" w/ the 'b' underlined. (Bug
+ #5558)
+ (popup_menu_nocard): Ditto.
+
2001-08-02 Jason Leach <jleach@ximian.com>
* gui/component/addressbook.c (addressbook_factory_new_control):
diff --git a/addressbook/backend/ebook/Makefile.am b/addressbook/backend/ebook/Makefile.am
index 895390e776..37a940d515 100644
--- a/addressbook/backend/ebook/Makefile.am
+++ b/addressbook/backend/ebook/Makefile.am
@@ -26,6 +26,7 @@ INCLUDES = \
-DGNOMELOCALEDIR=\""$(localedir)"\" \
-DG_LOG_DOMAIN=\"EBook\" \
-I$(top_srcdir) \
+ -I$(top_srcdir)/camel \
-I$(top_srcdir)/addressbook/backend \
-I$(top_srcdir)/addressbook/ename \
-I$(top_builddir)/addressbook/backend \
@@ -80,8 +81,11 @@ test_client_SOURCES = \
test_client_LDADD = \
libebook.la \
+ $(BONOBO_CONF_LIBS) \
$(BONOBO_GNOME_LIBS) \
$(EXTRA_GNOME_LIBS) \
+ $(top_builddir)/camel/libcamel.la \
+ $(top_builddir)/libibex/libibex.la \
$(top_builddir)/libversit/libversit.la \
$(top_builddir)/e-util/ename/libename.la \
$(top_builddir)/e-util/libeutil.la
@@ -91,8 +95,11 @@ test_client_list_SOURCES = \
test_client_list_LDADD = \
libebook.la \
+ $(BONOBO_CONF_LIBS) \
$(BONOBO_GNOME_LIBS) \
$(EXTRA_GNOME_LIBS) \
+ $(top_builddir)/camel/libcamel.la \
+ $(top_builddir)/libibex/libibex.la \
$(top_builddir)/e-util/ename/libename.la \
$(top_builddir)/libversit/libversit.la \
$(top_builddir)/e-util/libeutil.la
@@ -102,8 +109,11 @@ test_card_SOURCES = \
test_card_LDADD = \
libebook.la \
+ $(BONOBO_CONF_LIBS) \
$(BONOBO_GNOME_LIBS) \
$(EXTRA_GNOME_LIBS) \
+ $(top_builddir)/camel/libcamel.la \
+ $(top_builddir)/libibex/libibex.la \
$(top_builddir)/e-util/ename/libename.la \
$(top_builddir)/libversit/libversit.la \
$(top_builddir)/e-util/libeutil.la
@@ -115,6 +125,8 @@ evolution_vcard_importer_LDADD = \
$(BONOBO_CONF_LIBS) \
$(BONOBO_GNOME_LIBS) \
$(EXTRA_GNOME_LIBS) \
+ $(top_builddir)/camel/libcamel.la \
+ $(top_builddir)/libibex/libibex.la \
$(top_builddir)/shell/importer/libevolution-importer.la \
$(DB3_LDADD) \
$(top_builddir)/e-util/ename/libename.la \
@@ -126,8 +138,11 @@ load_pine_addressbook_SOURCES = \
load_pine_addressbook_LDADD = \
libebook.la \
+ $(BONOBO_CONF_LIBS) \
$(BONOBO_GNOME_LIBS) \
$(EXTRA_GNOME_LIBS) \
+ $(top_builddir)/camel/libcamel.la \
+ $(top_builddir)/libibex/libibex.la \
$(top_builddir)/e-util/ename/libename.la \
$(top_builddir)/libversit/libversit.la \
$(top_builddir)/e-util/libeutil.la
@@ -138,8 +153,11 @@ load_gnomecard_addressbook_SOURCES = \
load_gnomecard_addressbook_LDADD = \
libebook.la \
+ $(BONOBO_CONF_LIBS) \
$(BONOBO_GNOME_LIBS) \
$(EXTRA_GNOME_LIBS) \
+ $(top_builddir)/camel/libcamel.la \
+ $(top_builddir)/libibex/libibex.la \
$(top_builddir)/e-util/ename/libename.la \
$(top_builddir)/libversit/libversit.la \
$(top_builddir)/e-util/libeutil.la
diff --git a/addressbook/backend/ebook/e-destination.c b/addressbook/backend/ebook/e-destination.c
index e5d41ab36d..bed6fc1b7d 100644
--- a/addressbook/backend/ebook/e-destination.c
+++ b/addressbook/backend/ebook/e-destination.c
@@ -39,9 +39,12 @@
#include <gal/widgets/e-unicode.h>
#include <gnome-xml/parser.h>
#include <gnome-xml/xmlmemory.h>
+#include <camel/camel-internet-address.h>
struct _EDestinationPrivate {
+ gchar *raw;
+
gchar *card_uri;
ECard *card;
gint card_email_num;
@@ -168,6 +171,9 @@ e_destination_clear_card (EDestination *dest)
static void
e_destination_clear_strings (EDestination *dest)
{
+ g_free (dest->priv->raw);
+ dest->priv->raw = NULL;
+
g_free (dest->priv->name);
dest->priv->name = NULL;
@@ -196,6 +202,7 @@ e_destination_is_empty (const EDestination *dest)
return !(p->card != NULL
|| (p->card_uri && *p->card_uri)
+ || (p->raw && *p->raw)
|| (p->name && *p->name)
|| (p->email && *p->email)
|| (p->addr && *p->addr)
@@ -243,7 +250,7 @@ e_destination_set_name (EDestination *dest, const gchar *name)
g_free (dest->priv->name);
dest->priv->name = g_strdup (name);
- if (dest->priv->addr) {
+ if (dest->priv->addr != NULL) {
g_free (dest->priv->addr);
dest->priv->addr = NULL;
}
@@ -258,25 +265,12 @@ e_destination_set_email (EDestination *dest, const gchar *email)
g_free (dest->priv->email);
dest->priv->email = g_strdup (email);
- if (dest->priv->addr) {
+ if (dest->priv->addr != NULL) {
g_free (dest->priv->addr);
dest->priv->addr = NULL;
}
}
-
-/* This function takes a free-form string and tries to do something
- intelligent with it. */
-void
-e_destination_set_string (EDestination *dest, const gchar *str)
-{
- g_return_if_fail (dest && E_IS_DESTINATION (dest));
- g_return_if_fail (str != NULL);
-
- /* Default: Just treat it as a name address. */
- e_destination_set_name (dest, str);
-}
-
void
e_destination_set_html_mail_pref (EDestination *dest, gboolean x)
{
@@ -334,13 +328,13 @@ e_destination_use_card (EDestination *dest, EDestinationCardCallback cb, gpointe
{
g_return_if_fail (dest && E_IS_DESTINATION (dest));
- if (dest->priv->card) {
+ if (dest->priv->card != NULL) {
if (cb) {
cb (dest, dest->priv->card, closure);
}
- } else if (dest->priv->card_uri) {
+ } else if (dest->priv->card_uri != NULL) {
UseCard *uc = g_new (UseCard, 1);
uc->dest = dest;
@@ -393,18 +387,33 @@ e_destination_get_name (const EDestination *dest)
priv = (struct _EDestinationPrivate *)dest->priv; /* cast out const */
- if (priv->name == NULL && priv->card != NULL) {
+ if (priv->name == NULL) {
+
+ if (priv->card != NULL) {
- priv->name = e_card_name_to_string (priv->card->name);
+ priv->name = e_card_name_to_string (priv->card->name);
- if (priv->name == NULL || *priv->name == '\0') {
- g_free (priv->name);
- priv->name = g_strdup (priv->card->file_as);
- }
+ if (priv->name == NULL || *priv->name == '\0') {
+ g_free (priv->name);
+ priv->name = g_strdup (priv->card->file_as);
+ }
+
+ if (priv->name == NULL || *priv->name == '\0') {
+ g_free (priv->name);
+ priv->name = g_strdup (e_destination_get_email (dest));
+ }
+
+ } else if (priv->raw != NULL) {
+
+ CamelInternetAddress *addr = camel_internet_address_new ();
- if (priv->name == NULL || *priv->name == '\0') {
- g_free (priv->name);
- priv->name = g_strdup (e_destination_get_email (dest));
+ if (camel_address_unformat (CAMEL_ADDRESS (addr), priv->raw)) {
+ const gchar *camel_name = NULL;
+ camel_internet_address_get (addr, 0, &camel_name, NULL);
+ priv->name = g_strdup (camel_name);
+ }
+
+ camel_object_unref (CAMEL_OBJECT (addr));
}
}
@@ -412,7 +421,6 @@ e_destination_get_name (const EDestination *dest)
}
-/* FIXME: not utf-8 safe */
const gchar *
e_destination_get_email (const EDestination *dest)
{
@@ -424,7 +432,7 @@ e_destination_get_email (const EDestination *dest)
if (priv->email == NULL) {
- if (priv->card) { /* Pull the address out of the card. */
+ if (priv->card != NULL) { /* Pull the address out of the card. */
EIterator *iter = e_list_get_iterator (priv->card->email);
gint n = priv->card_email_num;
@@ -441,70 +449,21 @@ e_destination_get_email (const EDestination *dest)
}
}
- } else if (priv->name) {
- gchar *lt = strchr (priv->name, '<');
- gchar *gt = strchr (priv->name, '>');
-
- if (lt && gt && lt+1 < gt) {
- priv->email = g_strndup (lt+1, gt-lt-1);
- }
- }
- }
-
- return priv->email;
-}
-
-#define NEEDS_QUOTING(c) ((c) == '.' || (c) == ',' || (c) == '<' || (c) == '>')
-
-/* FIXME: not utf-8 safe */
-static gboolean
-needs_quotes (const gchar *str)
-{
- gboolean in_quote = FALSE;
-
- while (*str) {
- if (*str == '"')
- in_quote = !in_quote;
- else if (NEEDS_QUOTING (*str) && !in_quote) {
- return TRUE;
- }
- ++str;
- }
- return FALSE;
-}
-
-/* FIXME: not utf-8 safe */
-static gchar *
-quote_string (const gchar *str)
-{
- gchar *new_str, *t;
- const gchar *s;
- if (strchr (str, '\"') == NULL) {
-
- new_str = g_strdup_printf ("\"%s\"", str);
+ } else if (priv->raw != NULL) {
- } else {
+ CamelInternetAddress *addr = camel_internet_address_new ();
- new_str = t = g_malloc (strlen (str)+3);
- *t = '\"';
- ++t;
-
- s = str;
- while (*s) {
- if (*s != '"') {
- *t = *s;
- ++t;
+ if (camel_address_unformat (CAMEL_ADDRESS (addr), priv->raw)) {
+ const gchar *camel_email = NULL;
+ camel_internet_address_get (addr, 0, NULL, &camel_email);
+ priv->email = g_strdup (camel_email);
}
- ++s;
+
+ camel_object_unref (CAMEL_OBJECT (addr));
}
-
- *t = '\"';
- ++t;
- *t = '\0';
-
}
-
- return new_str;
+
+ return priv->email;
}
const gchar *
@@ -517,63 +476,56 @@ e_destination_get_address (const EDestination *dest)
priv = (struct _EDestinationPrivate *)dest->priv; /* cast out const */
if (priv->addr == NULL) {
+ CamelInternetAddress *addr = camel_internet_address_new ();
+
if (e_destination_is_evolution_list (dest)) {
- gchar **strv = g_new0 (gchar *, g_list_length (priv->list_dests) + 1);
- gint i = 0;
GList *iter = dest->priv->list_dests;
while (iter) {
EDestination *list_dest = E_DESTINATION (iter->data);
if (!e_destination_is_empty (list_dest)) {
- strv[i++] = (gchar *) e_destination_get_address (list_dest);
+ camel_internet_address_add (addr,
+ e_destination_get_name (list_dest),
+ e_destination_get_email (list_dest));
}
iter = g_list_next (iter);
}
- priv->addr = g_strjoinv (", ", strv);
-
- g_free (strv);
+ priv->addr = camel_address_encode (CAMEL_ADDRESS (addr));
+
+ } else if (priv->raw) {
+
+ if (camel_address_unformat (CAMEL_ADDRESS (addr), priv->raw)) {
+ priv->addr = camel_address_encode (CAMEL_ADDRESS (addr));
+ }
+
} else {
- const gchar *name = e_destination_get_name (dest);
- const gchar *email = e_destination_get_email (dest);
- /* If this isn't set, we return NULL */
- if (email) {
- if (name) {
- const gchar *lt = strchr (name, '<');
- gchar *namestrip = lt ? g_strndup (name, lt-name) : g_strdup (name);
- gchar *namecopy;
-
- g_strstrip (namestrip);
- if (needs_quotes (namestrip)) {
- namecopy = quote_string (namestrip);
- } else {
- namecopy = namestrip;
- namestrip = NULL;
- }
- if (namestrip)
- g_free (namestrip);
-
- priv->addr = g_strdup_printf ("%s <%s>", namecopy, email);
- g_free (namecopy);
-
- } else {
- priv->addr = g_strdup (email);
- }
- } else {
- /* Just use the name, which is the best we can do. */
- if (needs_quotes (name)) {
- priv->addr = quote_string (name);
- } else {
- priv->addr = g_strdup (name);
- }
- }
+ camel_internet_address_add (addr,
+ e_destination_get_name (dest),
+ e_destination_get_email (dest));
+
+ priv->addr = camel_address_encode (CAMEL_ADDRESS (addr));
}
+
+ camel_object_unref (CAMEL_OBJECT (addr));
}
return priv->addr;
}
+void
+e_destination_set_raw (EDestination *dest, const gchar *raw)
+{
+ g_return_if_fail (E_IS_DESTINATION (dest));
+ g_return_if_fail (raw != NULL);
+
+ e_destination_clear (dest);
+
+ dest->priv->raw = g_strdup (raw);
+
+}
+
const gchar *
e_destination_get_textrep (const EDestination *dest)
{
@@ -581,12 +533,15 @@ e_destination_get_textrep (const EDestination *dest)
g_return_val_if_fail (dest && E_IS_DESTINATION (dest), NULL);
+ if (dest->priv->raw)
+ return dest->priv->raw;
+
txt = e_destination_get_name (dest);
- if (txt)
+ if (txt != NULL)
return txt;
txt = e_destination_get_email (dest);
- if (txt)
+ if (txt != NULL)
return txt;
return "";
diff --git a/addressbook/backend/ebook/e-destination.h b/addressbook/backend/ebook/e-destination.h
index fc46a20538..96a3989d9a 100644
--- a/addressbook/backend/ebook/e-destination.h
+++ b/addressbook/backend/ebook/e-destination.h
@@ -71,7 +71,6 @@ void e_destination_set_card_uri (EDestination *, const gchar *ur
void e_destination_set_name (EDestination *, const gchar *name);
void e_destination_set_email (EDestination *, const gchar *email);
-void e_destination_set_string (EDestination *, const gchar *string);
void e_destination_set_html_mail_pref (EDestination *, gboolean);
gboolean e_destination_contains_card (const EDestination *);
@@ -87,6 +86,7 @@ const gchar *e_destination_get_name (const EDestination *); /* "Jan
const gchar *e_destination_get_email (const EDestination *); /* "jane@assbarn.com" */
const gchar *e_destination_get_address (const EDestination *); /* "Jane Smith <jane@assbarn.com>" (or a comma-sep set of such for a list) */
+void e_destination_set_raw (EDestination *, const gchar *free_form_string);
const gchar *e_destination_get_textrep (const EDestination *); /* "Jane Smith" or "jane@assbarn.com" */
gboolean e_destination_is_evolution_list (const EDestination *);
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)
diff --git a/addressbook/printing/Makefile.am b/addressbook/printing/Makefile.am
index fc3b174d98..dc1fb510a7 100644
--- a/addressbook/printing/Makefile.am
+++ b/addressbook/printing/Makefile.am
@@ -43,10 +43,13 @@ contact_print_test_SOURCES = \
contact_print_test_LDADD = \
$(top_builddir)/addressbook/backend/ebook/libebook.la \
+ $(top_builddir)/camel/libcamel.la \
+ $(top_builddir)/libibex/libibex.la \
$(top_builddir)/e-util/libeutil.la \
$(top_builddir)/libversit/libversit.la \
$(top_builddir)/e-util/ename/libename.la \
libecontactprint.a \
+ $(BONOBO_CONF_LIBS) \
$(EXTRA_GNOME_LIBS) \
$(BONOBO_GNOME_LIBS) \
$(GNOME_PRINT_LIBS)
@@ -56,10 +59,13 @@ contact_print_style_editor_test_SOURCES = \
contact_print_style_editor_test_LDADD = \
$(top_builddir)/addressbook/backend/ebook/libebook.la \
+ $(top_builddir)/camel/libcamel.la \
+ $(top_builddir)/libibex/libibex.la \
$(top_builddir)/e-util/libeutil.la \
$(top_builddir)/libversit/libversit.la \
$(top_builddir)/e-util/ename/libename.la \
libecontactprint.a \
+ $(BONOBO_CONF_LIBS) \
$(EXTRA_GNOME_LIBS) \
$(BONOBO_GNOME_LIBS) \
$(GNOME_PRINT_LIBS)