]> git.0d.be Git - empathy.git/blob - tests/interactive/test-empathy-roster-view.c
f01b8b6adbe6f88f8e5a643c672e5e6358a0216f
[empathy.git] / tests / interactive / test-empathy-roster-view.c
1 #include <config.h>
2
3 #include <libempathy-gtk/empathy-roster-view.h>
4 #include <libempathy-gtk/empathy-ui-utils.h>
5
6 static gboolean show_offline = FALSE;
7
8 static GOptionEntry entries[] =
9 {
10   { "offline", 0, 0, G_OPTION_ARG_NONE, &show_offline, "Show offline contacts", NULL },
11   { NULL }
12 };
13
14 int
15 main (int argc,
16     char **argv)
17 {
18   GtkWidget *window, *view, *scrolled;
19   EmpathyIndividualManager *mgr;
20   GError *error = NULL;
21   GOptionContext *context;
22
23   gtk_init (&argc, &argv);
24   empathy_gtk_init ();
25
26   context = g_option_context_new ("- test tree model performance");
27   g_option_context_add_main_entries (context, entries, GETTEXT_PACKAGE);
28   g_option_context_add_group (context, gtk_get_option_group (TRUE));
29   if (!g_option_context_parse (context, &argc, &argv, &error))
30     {
31       g_print ("option parsing failed: %s\n", error->message);
32       return 1;
33     }
34
35   window = gtk_window_new (GTK_WINDOW_TOPLEVEL);
36
37   empathy_set_css_provider (window);
38
39   mgr = empathy_individual_manager_dup_singleton ();
40
41   view = empathy_roster_view_new (mgr);
42
43   empathy_roster_view_show_offline (EMPATHY_ROSTER_VIEW (view), show_offline);
44
45   g_object_unref (mgr);
46
47   scrolled = gtk_scrolled_window_new (NULL, NULL);
48   gtk_scrolled_window_set_policy (GTK_SCROLLED_WINDOW (scrolled),
49       GTK_POLICY_NEVER, GTK_POLICY_AUTOMATIC);
50
51   egg_list_box_add_to_scrolled (EGG_LIST_BOX (view),
52       GTK_SCROLLED_WINDOW (scrolled));
53   gtk_container_add (GTK_CONTAINER (window), scrolled);
54
55   gtk_window_set_default_size (GTK_WINDOW (window), 300, 600);
56   gtk_widget_show_all (window);
57
58   g_signal_connect_swapped (window, "destroy",
59       G_CALLBACK (gtk_main_quit), NULL);
60
61   gtk_main ();
62
63   return 0;
64 }