* #19035: addressbook: add standalone test

This commit is contained in:
Tristan Matthews
2013-02-12 14:40:38 -05:00
parent d670bbc7ee
commit 42f38427a4
4 changed files with 57 additions and 1 deletions

View File

@ -1 +1 @@
SUBDIRS=evolution
SUBDIRS=evolution test

View File

@ -0,0 +1,4 @@
check_PROGRAMS = test_addressbook
test_addressbook_CFLAGS=@GTK_CFLAGS@ -I$(top_builddir)/addressbook/evolution/
test_addressbook_LDADD=@GTK_LIBS@ $(top_builddir)/addressbook/evolution/libevladdrbook.so

View File

@ -0,0 +1,51 @@
#include <gtk/gtk.h>
#include "addressbook.h"
/**
* Callback called after all book have been processed
*/
static void
add_contact(const gchar *name, const char *phone, GdkPixbuf *photo)
{
}
static void
handler_async_search(GList *hits, gpointer user_data)
{
AddressBook_Config *addressbook_config = user_data;
for (GList *i = hits; i != NULL; i = i->next) {
GdkPixbuf *photo = NULL;
Hit *entry = i->data;
if (!entry)
continue;
add_contact(entry->name, entry->phone_home, photo);
g_free(entry->name);
g_free(entry->phone_home);
g_free(entry);
}
g_list_free(hits);
}
int
main(int argc, char *argv[])
{
gtk_init(&argc, &argv);
GtkWidget *window = gtk_window_new(GTK_WINDOW_TOPLEVEL);
g_signal_connect(window, "destroy", G_CALLBACK(gtk_main_quit), NULL);
gtk_widget_show(window);
addressbook_init();
gtk_main();
return 0;
}

View File

@ -48,6 +48,7 @@ AC_CONFIG_FILES([
Makefile
addressbook/evolution/Makefile
addressbook/Makefile
addressbook/test/Makefile
])
AC_OUTPUT