]> git.0d.be Git - empathy.git/blob - tests/interactive/test-empathy-contact-blocking-dialog.c
Merge branch 'gnome-3-8'
[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 "empathy-client-factory.h"
27 #include "empathy-contact-blocking-dialog.h"
28 #include "empathy-ui-utils.h"
29
30 static void
31 am_prepare_cb (GObject *source,
32     GAsyncResult *result,
33     gpointer user_data)
34 {
35     GMainLoop *loop = user_data;
36     GtkWidget *dialog;
37
38     dialog = empathy_contact_blocking_dialog_new (NULL);
39
40     gtk_dialog_run (GTK_DIALOG (dialog));
41
42     g_main_loop_quit (loop);
43 }
44
45 int
46 main (int argc,
47     char **argv)
48   {
49     EmpathyClientFactory *factory;
50     TpAccountManager *am;
51     GMainLoop *loop;
52
53     gtk_init (&argc, &argv);
54     empathy_gtk_init ();
55
56     /* The blocking dialog needs the contact list for the contacts completion
57      * so we prepare it first. */
58     factory = empathy_client_factory_dup ();
59
60     tp_simple_client_factory_add_connection_features_varargs (
61         TP_SIMPLE_CLIENT_FACTORY (factory),
62         TP_CONNECTION_FEATURE_CONTACT_LIST,
63         NULL);
64
65     am = tp_account_manager_dup ();
66
67     loop = g_main_loop_new (NULL, FALSE);
68
69     tp_proxy_prepare_async (am, NULL, am_prepare_cb, loop);
70
71     g_main_loop_run (loop);
72
73     g_object_unref (am);
74     return 0;
75   }