]> git.0d.be Git - empathy.git/blob - tests/interactive/test-empathy-contact-blocking-dialog.c
Merge remote-tracking branch 'glassrose/add-All-service-selection-in-debug-window'
[empathy.git] / tests / interactive / test-empathy-contact-blocking-dialog.c
1 /*
2  * Copyright (C) 2011 Collabora Ltd.
3  *
4  * This program is free software; you can redistribute it and/or
5  * modify it under the terms of the GNU General Public License as
6  * published by the Free Software Foundation; either version 2 of the
7  * License, or (at your option) any later version.
8  *
9  * This program is distributed in the hope that it will be useful,
10  * but WITHOUT ANY WARRANTY; without even the implied warranty of
11  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
12  * General Public License for more details.
13  *
14  * You should have received a copy of the GNU General Public
15  * License along with this program; if not, write to the
16  * Free Software Foundation, Inc., 59 Temple Place - Suite 330,
17  * Boston, MA 02111-1307, USA.
18  *
19  * Authors: Danielle Madeley <danielle.madeley@collabora.co.uk>
20  */
21
22 #include <config.h>
23
24 #include <gtk/gtk.h>
25
26 #include <libempathy/empathy-client-factory.h>
27
28 #include <libempathy-gtk/empathy-ui-utils.h>
29 #include <libempathy-gtk/empathy-contact-blocking-dialog.h>
30
31 static void
32 am_prepare_cb (GObject *source,
33     GAsyncResult *result,
34     gpointer user_data)
35 {
36     GMainLoop *loop = user_data;
37     GtkWidget *dialog;
38
39     dialog = empathy_contact_blocking_dialog_new (NULL);
40
41     gtk_dialog_run (GTK_DIALOG (dialog));
42
43     g_main_loop_quit (loop);
44 }
45
46 int
47 main (int argc,
48     char **argv)
49   {
50     EmpathyClientFactory *factory;
51     TpAccountManager *am;
52     GMainLoop *loop;
53
54     gtk_init (&argc, &argv);
55     empathy_gtk_init ();
56
57     /* The blocking dialog needs the contact list for the contacts completion
58      * so we prepare it first. */
59     factory = empathy_client_factory_dup ();
60
61     tp_simple_client_factory_add_connection_features_varargs (
62         TP_SIMPLE_CLIENT_FACTORY (factory),
63         TP_CONNECTION_FEATURE_CONTACT_LIST,
64         NULL);
65
66     am = tp_account_manager_dup ();
67
68     loop = g_main_loop_new (NULL, FALSE);
69
70     tp_proxy_prepare_async (am, NULL, am_prepare_cb, loop);
71
72     g_main_loop_run (loop);
73
74     g_object_unref (am);
75     return 0;
76   }