mirror of
https://git.jami.net/savoirfairelinux/jami-daemon.git
synced 2025-08-12 22:09:25 +08:00
* #19035: addressbook: add standalone test
This commit is contained in:
@ -1 +1 @@
|
||||
SUBDIRS=evolution
|
||||
SUBDIRS=evolution test
|
||||
|
4
plugins/addressbook/test/Makefile.am
Normal file
4
plugins/addressbook/test/Makefile.am
Normal 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
|
51
plugins/addressbook/test/test_addressbook.c
Normal file
51
plugins/addressbook/test/test_addressbook.c
Normal 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;
|
||||
}
|
@ -48,6 +48,7 @@ AC_CONFIG_FILES([
|
||||
Makefile
|
||||
addressbook/evolution/Makefile
|
||||
addressbook/Makefile
|
||||
addressbook/test/Makefile
|
||||
])
|
||||
AC_OUTPUT
|
||||
|
||||
|
Reference in New Issue
Block a user