aboutsummaryrefslogtreecommitdiffstats
path: root/addressbook/backend
diff options
context:
space:
mode:
Diffstat (limited to 'addressbook/backend')
-rw-r--r--addressbook/backend/ebook/e-book-listener.c10
-rw-r--r--addressbook/backend/ebook/e-destination.c49
2 files changed, 9 insertions, 50 deletions
diff --git a/addressbook/backend/ebook/e-book-listener.c b/addressbook/backend/ebook/e-book-listener.c
index 7670a8b35d..dd682cbce4 100644
--- a/addressbook/backend/ebook/e-book-listener.c
+++ b/addressbook/backend/ebook/e-book-listener.c
@@ -33,7 +33,6 @@ struct _EBookListenerPrivate {
static gboolean
e_book_listener_check_queue (EBookListener *listener)
{
- gtk_object_ref (GTK_OBJECT (listener));
if (listener->priv->response_queue != NULL) {
gtk_signal_emit (GTK_OBJECT (listener),
e_book_listener_signals [RESPONSES_QUEUED]);
@@ -41,11 +40,14 @@ e_book_listener_check_queue (EBookListener *listener)
if (listener->priv->response_queue == NULL) {
listener->priv->idle_id = 0;
+
+ /* We only release our reference to the listener when the idle
+ function is totally finished. */
gtk_object_unref (GTK_OBJECT (listener));
+
return FALSE;
}
- gtk_object_unref (GTK_OBJECT (listener));
return TRUE;
}
@@ -58,6 +60,10 @@ e_book_listener_queue_response (EBookListener *listener,
response);
if (listener->priv->idle_id == 0) {
+
+ /* Hold a reference to the listener until the idle function is finished. */
+ gtk_object_ref (GTK_OBJECT (listener));
+
listener->priv->idle_id = g_idle_add (
(GSourceFunc) e_book_listener_check_queue, listener);
}
diff --git a/addressbook/backend/ebook/e-destination.c b/addressbook/backend/ebook/e-destination.c
index 8a25fd1937..42377aaa33 100644
--- a/addressbook/backend/ebook/e-destination.c
+++ b/addressbook/backend/ebook/e-destination.c
@@ -271,58 +271,11 @@ e_destination_set_email (EDestination *dest, const gchar *email)
void
e_destination_set_string (EDestination *dest, const gchar *str)
{
- gchar *name = NULL;
- gchar *email = NULL;
-#if 0
- gchar *lt, *gt;
-#endif
-
g_return_if_fail (dest && E_IS_DESTINATION (dest));
g_return_if_fail (str != NULL);
- /* This turned out to be an overly-clever approach... */
-#if 0
- /* Look for something of the form Jane Smith <jane@assbarn.com> */
- if ( (lt = strrchr (str, '<')) && (gt = strrchr (str, '>')) && lt+1 < gt) {
- name = g_strndup (str, lt-str);
- email = g_strndup (lt+1, gt-lt-1);
-
- /* I love using goto. It makes me feel so wicked. */
- goto finished;
- }
-
- /* If it contains '@', assume it is an e-mail address. */
- if (strchr (str, '@')) {
- email = g_strdup (str);
- goto finished;
- }
-
- /* If we contain whitespace, that is very suggestive of being a name. */
- if (strchr (str, ' ')) {
- name = g_strdup (str);
- goto finished;
- }
-#endif
-
/* Default: Just treat it as a name address. */
- name = g_strdup (str);
-
-#if 0
- finished:
-#endif
- if (name) {
- g_message ("name: [%s]", name);
- if (*name)
- e_destination_set_name (dest, name);
- g_free (name);
- }
-
- if (email) {
- g_message ("email: [%s]", email);
- if (*email)
- e_destination_set_email (dest, email);
- g_free (email);
- }
+ e_destination_set_name (dest, str);
}
void