File: main.cc

package info (click to toggle)
gtkmm2.4 1%3A2.24.4-1.1
  • links: PTS, VCS
  • area: main
  • in suites: jessie, jessie-kfreebsd
  • size: 74,416 kB
  • ctags: 20,265
  • sloc: xml: 80,438; sh: 11,064; cpp: 8,013; perl: 236; makefile: 224
file content (38 lines) | stat: -rw-r--r-- 877 bytes parent folder | download | duplicates (11)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
#include <gtkmm.h>


GQuark quark_test = 0;

void initialize_quark()
{
  if(!quark_test)
  {
    //g_warning("initializing quark.");
    quark_test = g_quark_from_static_string("quarktestmurrayc");
  }
}

void on_object_qdata_destroyed(gpointer data)
{
  //This doesn't seem to be called:
  g_warning("on_object_qdata_destroyed():  c instance=%p", (void*)data);
}

int main(int argc, char**argv)
{
  Gtk::Main app(&argc, &argv);

  Gtk::Dialog* pDialog = new Gtk::Dialog();
  Gtk::VBox* pBox = pDialog->get_vbox();

  //Set a quark and a callback:
  initialize_quark();
  int a = 0; // (This doesn't work unless we have a non-null value for the 3rd parameter.)
  g_object_set_qdata_full((GObject*)pBox->gobj(), quark_test, &a, &on_object_qdata_destroyed); 

  g_warning("vbox refcount=%d", G_OBJECT(pBox->gobj())->ref_count);

  delete pDialog;

  g_warning("after delete");
}