]> git.0d.be Git - empathy.git/blob - tests/contact-run-until-ready-2.c
Updated Basque translation.
[empathy.git] / tests / contact-run-until-ready-2.c
1 #include <stdlib.h>
2
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>
8
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)
17 {
18         if (!is_pending) {
19                 return;
20         }
21
22         g_print ("Contact handle=%d alias=%s\n",
23                  empathy_contact_get_handle (contact),
24                  empathy_contact_get_name (contact));
25
26         empathy_contact_run_until_ready (contact,
27                                          EMPATHY_CONTACT_READY_NAME,
28                                          NULL);
29
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));
34
35         g_object_unref (manager);
36         gtk_main_quit ();
37 }
38
39 static gboolean
40 callback (gpointer data)
41 {
42         EmpathyContactManager *manager;
43
44         manager = empathy_contact_manager_dup_singleton ();
45         g_signal_connect (manager, "pendings-changed",
46                           G_CALLBACK (pending_cb),
47                           NULL);
48
49         return FALSE;
50 }
51
52 int
53 main (int argc, char **argv)
54 {
55         gtk_init (&argc, &argv);
56
57         g_idle_add (callback, NULL);
58
59         gtk_main ();
60
61         return EXIT_SUCCESS;
62 }
63