add new sigc++2 directory
[ardour.git] / libs / gtkmm2 / tests / wrap_existing / main.cc
1 #include <gtkmm.h>
2
3
4 GQuark quark_test = 0;
5
6 void initialize_quark()
7 {
8   if(!quark_test)
9   {
10     //g_warning("initializing quark.");
11     quark_test = g_quark_from_static_string("quarktestmurrayc");
12   }
13 }
14
15 void on_object_qdata_destroyed(gpointer data)
16 {
17   //This doesn't seem to be called:
18   g_warning("on_object_qdata_destroyed():  c instance=%p", (void*)data);
19 }
20
21 int main(int argc, char**argv)
22 {
23   Gtk::Main app(&argc, &argv);
24
25   Gtk::Dialog* pDialog = new Gtk::Dialog();
26   Gtk::VBox* pBox = pDialog->get_vbox();
27
28   //Set a quark and a callback:
29   initialize_quark();
30   int a = 0; // (This doesn't work unless we have a non-null value for the 3rd parameter.)
31   g_object_set_qdata_full((GObject*)pBox->gobj(), quark_test, &a, &on_object_qdata_destroyed); 
32
33   g_warning("vbox refcount=%d", G_OBJECT(pBox->gobj())->ref_count);
34
35   delete pDialog;
36
37   g_warning("after delete");
38 }