Update python binding
[empathy.git] / tests / contact-run-until-ready-2.c
blob42653411602fb0a1929c1017fac1aa436dad7cf1
1 #include <stdlib.h>
3 #include <glib.h>
4 #include <gtk/gtk.h>
5 #include <libempathy/empathy-contact-factory.h>
6 #include <libempathy/empathy-contact-manager.h>
7 #include <libmissioncontrol/mc-account.h>
9 static void
10 pending_cb (EmpathyContactManager *manager,
11 EmpathyContact *contact,
12 EmpathyContact *actor,
13 guint reason,
14 gchar *message,
15 gboolean is_pending,
16 gpointer data)
18 if (!is_pending) {
19 return;
22 g_print ("Contact handle=%d alias=%s\n",
23 empathy_contact_get_handle (contact),
24 empathy_contact_get_name (contact));
26 empathy_contact_run_until_ready (contact,
27 EMPATHY_CONTACT_READY_NAME,
28 NULL);
30 g_print ("Contact ready: handle=%d alias=%s ready=%d\n",
31 empathy_contact_get_handle (contact),
32 empathy_contact_get_name (contact),
33 empathy_contact_get_ready (contact));
35 g_object_unref (manager);
36 gtk_main_quit ();
39 static gboolean
40 callback (gpointer data)
42 EmpathyContactManager *manager;
44 manager = empathy_contact_manager_dup_singleton ();
45 g_signal_connect (manager, "pendings-changed",
46 G_CALLBACK (pending_cb),
47 NULL);
49 return FALSE;
52 int
53 main (int argc, char **argv)
55 gtk_init (&argc, &argv);
57 g_idle_add (callback, NULL);
59 gtk_main ();
61 return EXIT_SUCCESS;