[Deskbar] Evolution addressbook full search



Hi !

As requested on IRC, i had a look at contact-lookup-applet, which
searches in e-d-s addressbooks, and show infos about the matches like
name, address, email, phone number, etc.

Deskbar only shows the email and name and allow to send an email. That
should stay, but maybe we should also provide a way to show a contact
full vcard. The use case was looking someone's address by searching for
a phone number, or searching someones phone number by name, etc.

The attached patch (which is a hack) returns more info about e-d-s
contacts, needed to present the above infos.

It also changes searching through some fields, in searching in every
possible field, the code is simpler and returns more matches (we don't
do phone numbers for example).

Unfortunately it has proved far slower than the actual backend, which is
worrying me about the performances of synchronous evolution queries.

The current e-d-s bindings are a bit hand-made, Nigel did you try to
generate proper bindings for EContacts, and libedataserver ?

If it didn't work, iirc we had crashing problems when doing async e-d-s
queries, was that bug identified, or did we decide to just ignore it and
use sync queries ?

In any case, my vote is to try to provide async queries, allowing in
turn to do full search with no slowdown, provide good ldap experience,
and allow to present more infos without insane bindings like
contact-looku-applet does.

If someone can take a look before the final 2.14 release maybe the async
query can get in the core, and the full searching too, allowing oin turn
to write an unofficial extension to be written for presenting the info.
Or maybe it isn't safe at this point in time and we should provide that
for 2.16

Raf
? e-d-s-full-query.patch
? grab-patch.diff
? vchange-patch.diff
? data/mozilla-search.gladep
? data/prefs-dialog.gladep
? data/smart-bookmarks.gladep
Index: deskbar/evolution/_evolution.override
===================================================================
RCS file: /cvs/gnome/deskbar-applet/deskbar/evolution/_evolution.override,v
retrieving revision 1.4
diff -u -p -r1.4 _evolution.override
--- deskbar/evolution/_evolution.override	23 Nov 2005 06:12:52 -0000	1.4
+++ deskbar/evolution/_evolution.override	2 Mar 2006 22:23:09 -0000
@@ -25,7 +25,7 @@ hits_as_python_object (GList *hits)
 	i = 0;
 	for (; hits != NULL; hits = hits->next) {
 		Hit *hit = (Hit *) hits->data;
-		PyObject *t = PyTuple_New (3);
+		PyObject *t = PyTuple_New (9);
 		if (hit->text == NULL) {
 			Py_INCREF (Py_None);
 			PyTuple_SET_ITEM (t, 0, Py_None);
@@ -45,6 +45,48 @@ hits_as_python_object (GList *hits)
 			PyTuple_SET_ITEM (t, 2, Py_None);
 		} else {
 			PyTuple_SET_ITEM (t, 2, pygobject_new ((GObject*) hit->pixbuf));
+		}
+
+		if (hit->address_home == NULL) {
+			Py_INCREF (Py_None);
+			PyTuple_SET_ITEM (t, 3, Py_None);
+		} else {
+			PyTuple_SET_ITEM (t, 3, PyString_FromString(hit->address_home));
+		}
+		
+		if (hit->address_work == NULL) {
+			Py_INCREF (Py_None);
+			PyTuple_SET_ITEM (t, 4, Py_None);
+		} else {
+			PyTuple_SET_ITEM (t, 4, PyString_FromString(hit->address_work));
+		}
+		
+		if (hit->phone_home == NULL) {
+			Py_INCREF (Py_None);
+			PyTuple_SET_ITEM (t, 5, Py_None);
+		} else {
+			PyTuple_SET_ITEM (t, 5, PyString_FromString(hit->phone_home));
+		}
+
+		if (hit->phone_business == NULL) {
+			Py_INCREF (Py_None);
+			PyTuple_SET_ITEM (t, 6, Py_None);
+		} else {
+			PyTuple_SET_ITEM (t, 6, PyString_FromString(hit->phone_business));
+		}
+
+		if (hit->phone_mobile == NULL) {
+			Py_INCREF (Py_None);
+			PyTuple_SET_ITEM (t, 7, Py_None);
+		} else {
+			PyTuple_SET_ITEM (t, 7, PyString_FromString(hit->phone_mobile));
+		}
+
+		if (hit->homepage == NULL) {
+			Py_INCREF (Py_None);
+			PyTuple_SET_ITEM (t, 8, Py_None);
+		} else {
+			PyTuple_SET_ITEM (t, 8, PyString_FromString(hit->homepage));
 		}
 
 		PyList_SET_ITEM (result, i, t);
Index: deskbar/evolution/evolution.c
===================================================================
RCS file: /cvs/gnome/deskbar-applet/deskbar/evolution/evolution.c,v
retrieving revision 1.4
diff -u -p -r1.4 evolution.c
--- deskbar/evolution/evolution.c	23 Nov 2005 06:12:52 -0000	1.4
+++ deskbar/evolution/evolution.c	2 Mar 2006 22:23:09 -0000
@@ -6,22 +6,38 @@
 #include "evolution.h"
 
 typedef struct _Handler_And_Data {
-	SearchAsyncHandler  handler;
-	gpointer            user_data;
-	GList              *hits;
-	int                 max_results_remaining;
-	int                 book_views_remaining;
+    SearchAsyncHandler  handler;
+    gpointer            user_data;
+    GList              *hits;
+    int                 max_results_remaining;
+    int                 book_views_remaining;
 } Handler_And_Data;
 
 static GSList *books = NULL;
 static int pixbuf_size = 16;
 
-static EContactField search_fields[] = { E_CONTACT_FULL_NAME, E_CONTACT_EMAIL, E_CONTACT_NICKNAME, 0 };
+static EContactField search_fields[] = {
+	E_CONTACT_FULL_NAME,
+	E_CONTACT_EMAIL,
+	E_CONTACT_NICKNAME,
+	E_CONTACT_ADDRESS_LABEL_HOME,
+    E_CONTACT_ADDRESS_LABEL_WORK,
+    E_CONTACT_PHONE_HOME,
+    E_CONTACT_PHONE_BUSINESS,
+    E_CONTACT_PHONE_MOBILE,
+    E_CONTACT_HOMEPAGE_URL,
+	0 };
 static int n_search_fields = G_N_ELEMENTS (search_fields) - 1;
 
 void
 free_hit (Hit *h, gpointer unused)
 {
+    g_free (h->address_home);
+    g_free (h->address_work);
+    g_free (h->phone_home);
+    g_free (h->phone_business);
+    g_free (h->phone_mobile);
+    g_free (h->homepage);
     g_free (h->text);
     g_free (h->email);
     g_free (h);
@@ -33,28 +49,28 @@ free_hit (Hit *h, gpointer unused)
 static GArray *
 split_query_string (const gchar *str)
 {
-	GArray *parts = g_array_sized_new (FALSE, FALSE, sizeof (char *), 2);
-	PangoLogAttr *attrs;
-	guint str_len = strlen (str), word_start = 0, i;
-
-	attrs = g_new0 (PangoLogAttr, str_len + 1);  
-	/* TODO: do we need to specify a particular language or is NULL ok? */
-	pango_get_log_attrs (str, -1, -1, NULL, attrs, str_len + 1);
-
-	for (i = 0; i < str_len + 1; i++) {
-		char *start_word, *end_word, *word;
-		if (attrs[i].is_word_end) {
-			start_word = g_utf8_offset_to_pointer (str, word_start);
-			end_word = g_utf8_offset_to_pointer (str, i);
-			word  = g_strndup (start_word, end_word - start_word);
-			g_array_append_val (parts, word);
-		}
-		if (attrs[i].is_word_start) {
-			word_start = i;
-		}
-	}
-	g_free (attrs);
-	return parts;
+    GArray *parts = g_array_sized_new (FALSE, FALSE, sizeof (char *), 2);
+    PangoLogAttr *attrs;
+    guint str_len = strlen (str), word_start = 0, i;
+
+    attrs = g_new0 (PangoLogAttr, str_len + 1);  
+    /* TODO: do we need to specify a particular language or is NULL ok? */
+    pango_get_log_attrs (str, -1, -1, NULL, attrs, str_len + 1);
+
+    for (i = 0; i < str_len + 1; i++) {
+        char *start_word, *end_word, *word;
+        if (attrs[i].is_word_end) {
+            start_word = g_utf8_offset_to_pointer (str, word_start);
+            end_word = g_utf8_offset_to_pointer (str, i);
+            word  = g_strndup (start_word, end_word - start_word);
+            g_array_append_val (parts, word);
+        }
+        if (attrs[i].is_word_start) {
+            word_start = i;
+        }
+    }
+    g_free (attrs);
+    return parts;
 }
 
 /**
@@ -64,207 +80,195 @@ split_query_string (const gchar *str)
 static EBookQuery*
 create_query (const char* s)
 {
-	EBookQuery *query;
-	GArray *parts = split_query_string (s);
-	EBookQuery ***field_queries;
-	EBookQuery **q;
-	guint j;
-	int i;
-
-	q = g_new0 (EBookQuery *, n_search_fields);
-	field_queries = g_new0 (EBookQuery **, n_search_fields);
-
-	for (i = 0; i < n_search_fields; i++) {
-		field_queries[i] = g_new0 (EBookQuery *, parts->len);
-		for (j = 0; j < parts->len; j++) {
-			field_queries[i][j] = e_book_query_field_test (search_fields[i], E_BOOK_QUERY_CONTAINS, g_array_index (parts, gchar *, j));
-		}
-		q[i] = e_book_query_and (parts->len, field_queries[i], TRUE);
-	}
-	g_array_free (parts, TRUE);
-
-	query = e_book_query_or (n_search_fields, q, TRUE);
-
-	for (i = 0; i < n_search_fields; i++) {
-		g_free (field_queries[i]);
-	}
-	g_free (field_queries);
-	g_free (q);
+    EBookQuery *query;
+    GArray *parts = split_query_string (s);
+    EBookQuery **queries;
+    int i;
+
+    queries = g_new0 (EBookQuery *, parts->len);
+    for (i = 0; i < parts->len; i++) {
+   		
+        queries[i] = e_book_query_any_field_contains (g_array_index (parts, gchar *, i));
+    }
+    query = e_book_query_and (parts->len, queries, TRUE);
+    g_array_free (parts, TRUE);
 
-	return query;
+    g_free (queries);
+
+    return query;
 }
 
 static GdkPixbuf*
 pixbuf_from_contact (EContact *contact)
 {
-	GdkPixbuf *pixbuf = NULL;
-	EContactPhoto *photo = e_contact_get (contact, E_CONTACT_PHOTO);
-	if (photo) {
-		GdkPixbufLoader *loader;
-
-		loader = gdk_pixbuf_loader_new ();
-
-		if (gdk_pixbuf_loader_write (loader, (guchar *) photo->data, photo->length, NULL))
-			pixbuf = gdk_pixbuf_loader_get_pixbuf (loader);
-
-		if (pixbuf) {
-			GdkPixbuf *tmp;
-			gint width = gdk_pixbuf_get_width (pixbuf);
-			gint height = gdk_pixbuf_get_height (pixbuf);
-			double scale = 1.0;
-
-			if (height > width) {
-				scale = pixbuf_size / (double) height;
-			} else {
-				scale = pixbuf_size / (double) width;
-			}
-
-			if (scale < 1.0) {
-				tmp = gdk_pixbuf_scale_simple (pixbuf, width * scale, height * scale, GDK_INTERP_BILINEAR);
-				g_object_unref (pixbuf);
-				pixbuf = tmp;
-			}
-		}
-		e_contact_photo_free (photo);
-	}
-	return pixbuf;
+    GdkPixbuf *pixbuf = NULL;
+    EContactPhoto *photo = e_contact_get (contact, E_CONTACT_PHOTO);
+    if (photo) {
+        GdkPixbufLoader *loader;
+
+        loader = gdk_pixbuf_loader_new ();
+
+        if (gdk_pixbuf_loader_write (loader, (guchar *) photo->data, photo->length, NULL))
+            pixbuf = gdk_pixbuf_loader_get_pixbuf (loader);
+
+        if (pixbuf) {
+            GdkPixbuf *tmp;
+            gint width = gdk_pixbuf_get_width (pixbuf);
+            gint height = gdk_pixbuf_get_height (pixbuf);
+            double scale = 1.0;
+
+            if (height > width) {
+                scale = pixbuf_size / (double) height;
+            } else {
+                scale = pixbuf_size / (double) width;
+            }
+
+            if (scale < 1.0) {
+                tmp = gdk_pixbuf_scale_simple (pixbuf, width * scale, height * scale, GDK_INTERP_BILINEAR);
+                g_object_unref (pixbuf);
+                pixbuf = tmp;
+            }
+        }
+        e_contact_photo_free (photo);
+    }
+    return pixbuf;
 }
 
 static void
 view_finish (EBookView *book_view, Handler_And_Data *had)
 {
-	SearchAsyncHandler had_handler = had->handler;
-	GList *had_hits = had->hits;
-	gpointer had_user_data = had->user_data;
-	g_free (had);
+    SearchAsyncHandler had_handler = had->handler;
+    GList *had_hits = had->hits;
+    gpointer had_user_data = had->user_data;
+    g_free (had);
 
-	g_return_if_fail (book_view != NULL);
-	g_object_unref (book_view);
+    g_return_if_fail (book_view != NULL);
+    g_object_unref (book_view);
 
-	had_handler (had_hits, had_user_data);
+    had_handler (had_hits, had_user_data);
 }
 
 static void
 view_contacts_added_cb (EBookView *book_view, GList *contacts, gpointer user_data)
 {
-	Handler_And_Data *had = (Handler_And_Data *) user_data;
-	if (had->max_results_remaining <= 0) {
-		e_book_view_stop (book_view);
-		had->book_views_remaining--;
-		if (had->book_views_remaining == 0) {
-			view_finish (book_view, had);
-			return;
-		}
-	}
-	for (; contacts != NULL; contacts = g_list_next (contacts)) {
-		EContact *contact;
-		Hit *hit;
-
-		contact = E_CONTACT (contacts->data);
-		hit = g_new (Hit, 1);
-		hit->email = g_strdup ((char*) e_contact_get_const (contact, E_CONTACT_EMAIL_1));
-		hit->text = g_strdup_printf ("%s <%s>", (char*)e_contact_get_const (contact, E_CONTACT_NAME_OR_ORG), hit->email);
-		hit->pixbuf = pixbuf_from_contact (contact);
-
-		had->hits = g_list_append (had->hits, hit);
-		had->max_results_remaining--;
-		if (had->max_results_remaining <= 0) {
-			e_book_view_stop (book_view);
-			had->book_views_remaining--;
-			if (had->book_views_remaining == 0) {
-				view_finish (book_view, had);
-			}
-			break;
-		}
-	}
+    Handler_And_Data *had = (Handler_And_Data *) user_data;
+    if (had->max_results_remaining <= 0) {
+        e_book_view_stop (book_view);
+        had->book_views_remaining--;
+        if (had->book_views_remaining == 0) {
+            view_finish (book_view, had);
+            return;
+        }
+    }
+    for (; contacts != NULL; contacts = g_list_next (contacts)) {
+        EContact *contact;
+        Hit *hit;
+
+        contact = E_CONTACT (contacts->data);
+        hit = g_new (Hit, 1);
+        hit->email = g_strdup ((char*) e_contact_get_const (contact, E_CONTACT_EMAIL_1));
+        hit->text = g_strdup_printf ("%s <%s>", (char*)e_contact_get_const (contact, E_CONTACT_NAME_OR_ORG), hit->email);
+        hit->pixbuf = pixbuf_from_contact (contact);
+
+        had->hits = g_list_append (had->hits, hit);
+        had->max_results_remaining--;
+        if (had->max_results_remaining <= 0) {
+            e_book_view_stop (book_view);
+            had->book_views_remaining--;
+            if (had->book_views_remaining == 0) {
+                view_finish (book_view, had);
+            }
+            break;
+        }
+    }
 }
 
 static void
 view_completed_cb (EBookView *book_view, EBookViewStatus status, gpointer user_data)
 {
-	Handler_And_Data *had = (Handler_And_Data *) user_data;
-	had->book_views_remaining--;
-	if (had->book_views_remaining == 0) {
-		view_finish (book_view, had);
-	}
+    Handler_And_Data *had = (Handler_And_Data *) user_data;
+    had->book_views_remaining--;
+    if (had->book_views_remaining == 0) {
+        view_finish (book_view, had);
+    }
 }
 
 void
 init (void)
 {
-	GSList *list, *l;
-	ESourceList *source_list;
+    GSList *list, *l;
+    ESourceList *source_list;
 
-	source_list = e_source_list_new_for_gconf_default ("/apps/evolution/addressbook/sources");
-	if (source_list == NULL) {
-		return;
-	}
-
-	list = e_source_list_peek_groups (source_list);
-
-	for (l = list; l != NULL; l = l->next) {
-		ESourceGroup *group = l->data;
-		GSList *sources = NULL, *m;
-		sources = e_source_group_peek_sources (group);
-		for (m = sources; m != NULL; m = m->next) {
-			ESource *source = m->data;
-			const char *p;
-
-			p = e_source_get_property (source, "completion");
-
-			if (p != NULL && strcmp (p, "true") == 0) {
-				char *uri = g_strdup_printf ("%s/%s", e_source_group_peek_base_uri (group), e_source_peek_relative_uri (source));
-				EBook *book = e_book_new_from_uri (uri, NULL);
-				if (book != NULL) {
-					books = g_slist_prepend (books, book);
-					e_book_open(book, TRUE, NULL);
-				}
-				g_free (uri);
-			}
-		}
-	}
+    source_list = e_source_list_new_for_gconf_default ("/apps/evolution/addressbook/sources");
+    if (source_list == NULL) {
+        return;
+    }
+
+    list = e_source_list_peek_groups (source_list);
+
+    for (l = list; l != NULL; l = l->next) {
+        ESourceGroup *group = l->data;
+        GSList *sources = NULL, *m;
+        sources = e_source_group_peek_sources (group);
+        for (m = sources; m != NULL; m = m->next) {
+            ESource *source = m->data;
+            const char *p;
+
+            p = e_source_get_property (source, "completion");
+
+            if (p != NULL && strcmp (p, "true") == 0) {
+                char *uri = g_strdup_printf ("%s/%s", e_source_group_peek_base_uri (group), e_source_peek_relative_uri (source));
+                EBook *book = e_book_new_from_uri (uri, NULL);
+                if (book != NULL) {
+                    books = g_slist_prepend (books, book);
+                    e_book_open(book, TRUE, NULL);
+                }
+                g_free (uri);
+            }
+        }
+    }
 
-	g_object_unref (source_list);
+    g_object_unref (source_list);
 }
 
 int
 num_address_books_with_completion (void)
 {
-	int result = 0;
-	GSList *list, *l;
-	ESourceList *source_list;
-
-	source_list = e_source_list_new_for_gconf_default ("/apps/evolution/addressbook/sources");
-	if (source_list == NULL) {
-		return 0;
-	}
-
-	list = e_source_list_peek_groups (source_list);
-
-	for (l = list; l != NULL; l = l->next) {
-		ESourceGroup *group = l->data;
-		GSList *sources = NULL, *m;
-		sources = e_source_group_peek_sources (group);
-		for (m = sources; m != NULL; m = m->next) {
-			ESource *source = m->data;
-			const char *p;
-
-			p = e_source_get_property (source, "completion");
-
-			if (p != NULL && strcmp (p, "true") == 0) {
-				result++;
-			}
-		}
-	}
+    int result = 0;
+    GSList *list, *l;
+    ESourceList *source_list;
+
+    source_list = e_source_list_new_for_gconf_default ("/apps/evolution/addressbook/sources");
+    if (source_list == NULL) {
+        return 0;
+    }
+
+    list = e_source_list_peek_groups (source_list);
+
+    for (l = list; l != NULL; l = l->next) {
+        ESourceGroup *group = l->data;
+        GSList *sources = NULL, *m;
+        sources = e_source_group_peek_sources (group);
+        for (m = sources; m != NULL; m = m->next) {
+            ESource *source = m->data;
+            const char *p;
+
+            p = e_source_get_property (source, "completion");
+
+            if (p != NULL && strcmp (p, "true") == 0) {
+                result++;
+            }
+        }
+    }
 
-	g_object_unref (source_list);
-	return result;
+    g_object_unref (source_list);
+    return result;
 }
 
 void
 set_pixbuf_size (int size)
 {
-	pixbuf_size = size;
+    pixbuf_size = size;
 }
 
 void
@@ -273,32 +277,32 @@ search_async (const char         *query,
               SearchAsyncHandler  handler,
               gpointer            user_data)
 {
-	GSList *iter;
+    GSList *iter;
 
-	EBookQuery* book_query = create_query (query);
+    EBookQuery* book_query = create_query (query);
 
-	Handler_And_Data *had = g_new (Handler_And_Data, 1);
-	had->handler = handler;
-	had->user_data = user_data;
-	had->hits = NULL;
-	had->max_results_remaining = max_results;
-	had->book_views_remaining = 0;
-	for (iter = books; iter != NULL; iter = iter->next) {
-		EBook *book = (EBook *) iter->data;
-		EBookView *book_view = NULL;
-		e_book_get_book_view (book, book_query, NULL, max_results, &book_view, NULL);
-		if (book_view != NULL) {
-			had->book_views_remaining++;
-			g_signal_connect (book_view, "contacts_added", (GCallback) view_contacts_added_cb, had);
-			g_signal_connect (book_view, "sequence_complete", (GCallback) view_completed_cb, had);
-			e_book_view_start (book_view);
-		}
-	}
-	if (had->book_views_remaining == 0) {
-		g_free (had);
-	}
+    Handler_And_Data *had = g_new (Handler_And_Data, 1);
+    had->handler = handler;
+    had->user_data = user_data;
+    had->hits = NULL;
+    had->max_results_remaining = max_results;
+    had->book_views_remaining = 0;
+    for (iter = books; iter != NULL; iter = iter->next) {
+        EBook *book = (EBook *) iter->data;
+        EBookView *book_view = NULL;
+        e_book_get_book_view (book, book_query, NULL, max_results, &book_view, NULL);
+        if (book_view != NULL) {
+            had->book_views_remaining++;
+            g_signal_connect (book_view, "contacts_added", (GCallback) view_contacts_added_cb, had);
+            g_signal_connect (book_view, "sequence_complete", (GCallback) view_completed_cb, had);
+            e_book_view_start (book_view);
+        }
+    }
+    if (had->book_views_remaining == 0) {
+        g_free (had);
+    }
 
-	e_book_query_unref (book_query);
+    e_book_query_unref (book_query);
 }
 
 /*
@@ -310,35 +314,41 @@ GList *
 search_sync (const char *query,
              int         max_results)
 {
-	GSList *iter = NULL;
-	GList *contacts = NULL;
-	GList *hits = NULL;
-
-	EBookQuery* book_query = create_query (query);
-	for (iter = books; iter != NULL; iter = iter->next) {
-		if (max_results <= 0) {
-			break;
-		}
-		EBook *book = (EBook *) iter->data;
-		e_book_get_contacts (book, book_query, &contacts, NULL);
-		for (; contacts != NULL; contacts = g_list_next (contacts)) {
-			EContact *contact;
-			Hit *hit;
-
-			contact = E_CONTACT (contacts->data);
-			hit = g_new (Hit, 1);
-			hit->email = g_strdup ((char*) e_contact_get_const (contact, E_CONTACT_EMAIL_1));
-			hit->text = g_strdup ((char*) e_contact_get_const (contact, E_CONTACT_NAME_OR_ORG));
-			hit->pixbuf = pixbuf_from_contact (contact);
-
-			hits = g_list_append (hits, hit);
-			max_results--;
-			if (max_results <= 0) {
-				break;
-			}
-		}
-	}
-	e_book_query_unref (book_query);
+    GSList *iter = NULL;
+    GList *contacts = NULL;
+    GList *hits = NULL;
+
+    EBookQuery* book_query = create_query (query);
+    for (iter = books; iter != NULL; iter = iter->next) {
+        if (max_results <= 0) {
+            break;
+        }
+        EBook *book = (EBook *) iter->data;
+        e_book_get_contacts (book, book_query, &contacts, NULL);
+        for (; contacts != NULL; contacts = g_list_next (contacts)) {
+            EContact *contact;
+            Hit *hit;
+
+            contact = E_CONTACT (contacts->data);
+            hit = g_new (Hit, 1);
+            hit->email = g_strdup ((char*) e_contact_get_const (contact, E_CONTACT_EMAIL_1));
+            hit->text = g_strdup ((char*) e_contact_get_const (contact, E_CONTACT_NAME_OR_ORG));
+            hit->address_home = g_strdup ((char*) e_contact_get_const (contact, E_CONTACT_ADDRESS_LABEL_HOME));
+            hit->address_work = g_strdup ((char*) e_contact_get_const (contact, E_CONTACT_ADDRESS_LABEL_WORK));
+            hit->phone_home = g_strdup ((char*) e_contact_get_const (contact, E_CONTACT_PHONE_HOME));
+            hit->phone_business = g_strdup ((char*) e_contact_get_const (contact, E_CONTACT_PHONE_BUSINESS));
+            hit->phone_mobile = g_strdup ((char*) e_contact_get_const (contact, E_CONTACT_PHONE_MOBILE));
+            hit->homepage = g_strdup ((char*) e_contact_get_const (contact, E_CONTACT_HOMEPAGE_URL));
+            hit->pixbuf = pixbuf_from_contact (contact);
+
+            hits = g_list_append (hits, hit);
+            max_results--;
+            if (max_results <= 0) {
+                break;
+            }
+        }
+    }
+    e_book_query_unref (book_query);
 
-	return hits;
+    return hits;
 }
Index: deskbar/evolution/evolution.h
===================================================================
RCS file: /cvs/gnome/deskbar-applet/deskbar/evolution/evolution.h,v
retrieving revision 1.2
diff -u -p -r1.2 evolution.h
--- deskbar/evolution/evolution.h	23 Nov 2005 06:12:52 -0000	1.2
+++ deskbar/evolution/evolution.h	2 Mar 2006 22:23:09 -0000
@@ -10,6 +10,12 @@ G_BEGIN_DECLS
 typedef struct _Hit {
 	gchar *text;
 	gchar *email;
+	gchar *address_home;
+	gchar *address_work;
+	gchar *phone_home;
+	gchar *phone_business;
+	gchar *phone_mobile;
+	gchar *homepage;
 	GdkPixbuf *pixbuf;
 } Hit;
 
Index: deskbar/handlers/evolution.py
===================================================================
RCS file: /cvs/gnome/deskbar-applet/deskbar/handlers/evolution.py,v
retrieving revision 1.19
diff -u -p -r1.19 evolution.py
--- deskbar/handlers/evolution.py	22 Feb 2006 15:10:04 -0000	1.19
+++ deskbar/handlers/evolution.py	2 Mar 2006 22:23:09 -0000
@@ -41,7 +41,6 @@ class EvolutionMatch(deskbar.Match.Match
 		}
 		
 	def get_verb(self):
-		#translators: First %s is the contact full name, second %s is the email address
 		return _("Send Email to <b>%(name)s</b> (%(email)s)")
 	
 	def get_hash(self, text=None):
@@ -57,7 +56,9 @@ class EvolutionHandler(deskbar.Handler.H
 	def query(self, query):
 		hits = deskbar.evolution.search_sync(query, deskbar.DEFAULT_RESULTS_PER_HANDLER)
 		matches = []
-		for name, email, pixbuf in hits:
+		for hit in hits:
+			print hit
+			name, email, pixbuf, address_home, address_work, phone_home, phone_business, phone_mobile, homepage = hit
 			if name == None or email == None:
 				continue
 			


[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]