Add doc files to dist and fix version number in NEWS.
[mmediamanager.git] / test / clients / test-gtk-union.c
blob11f99476157d9aa18a29cce25ac722baf3308ae2
1 #include <gtk/gtk.h>
2 #include <glib.h>
3 #include <libmmanager/mm.h>
4 #include <libmmanager-gtk/mm-gtk.h>
6 static gboolean
7 filter_closed_cb (GtkWidget *toplevel,
8 GdkEvent *event,
9 GPtrArray *data)
11 MMGtkFilterBuilder *builder = g_ptr_array_index (data, 0);
12 MMCategory *cat = g_ptr_array_index (data, 1);
13 MMFilter *filter;
14 MMHitCollection *hits;
15 MMGtkHitView *view;
16 GtkWidget *window3;
18 filter = mm_gtk_filter_builder_get_filter (builder);
19 hits = mm_category_get_hits (cat, filter, NULL);
20 view = mm_gtk_hit_view_new (hits);
21 gtk_widget_show (GTK_WIDGET (view));
23 window3 = gtk_window_new (GTK_WINDOW_TOPLEVEL);
24 gtk_container_add (GTK_CONTAINER (window3), GTK_WIDGET (view));
25 gtk_widget_show (window3);
27 return FALSE;
30 static void
31 cat_selected_cb (MMGtkApplicationView *view,
32 MMCategory *cat,
33 GtkWidget *toplevel)
35 MMGtkFilterBuilder *builder;
36 GtkWidget *window2;
37 GPtrArray *data;
39 builder = mm_gtk_filter_builder_new (cat);
40 gtk_widget_show (GTK_WIDGET (builder));
41 window2 = gtk_window_new (GTK_WINDOW_TOPLEVEL);
42 gtk_container_add (GTK_CONTAINER (window2), GTK_WIDGET (builder));
43 gtk_widget_show (window2);
45 data = g_ptr_array_sized_new (2);
46 g_ptr_array_add (data, builder);
47 g_ptr_array_add (data, cat);
49 g_signal_connect (window2, "delete-event",
50 G_CALLBACK (filter_closed_cb),
51 data);
54 int main (int argc, char **argv)
56 GtkWidget *toplevel;
57 MMGtkApplicationView *view;
59 gtk_init (&argc, &argv);
61 toplevel = gtk_window_new (GTK_WINDOW_TOPLEVEL);
62 g_signal_connect (toplevel, "delete-event", G_CALLBACK (gtk_main_quit), NULL);
63 view = mm_gtk_application_view_new ();
64 g_signal_connect (view, "category-selected",
65 G_CALLBACK (cat_selected_cb), toplevel);
66 gtk_widget_show (GTK_WIDGET (view));
68 gtk_container_add (GTK_CONTAINER (toplevel), GTK_WIDGET (view));
69 gtk_widget_show (toplevel);
71 gtk_main ();