g_object_add_toggle_ref

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



My high level Nim wrapper (https://github.com/StefanSalewski/nim-gi2)
is indeed basically working.

Currently I am using g_object_add_toggle_ref() and
g_object_set_qdata(). The first for the garbage collection tasks, and
the later for retrieving the proxy object from the associated GTK
GObject, for example when functions like gtk_widget_get_parent() are
used. That seems to work, but I have the feeling of some redundancy.
Both gobject functions are passed the address of my proxy object. But
g_object_add_toggle_ref() seems to offer no support to get the address
back, that is why I use additional g_object_set_qdata() which allows me
to get back the proxy address with g_object_get_qdata().


proc gtk_button_new*(): ptr Button00 {.
    importc: "gtk_button_new", libprag.}

proc newButton*(): Button =
  new(result, finalizeGObject)
  result.impl = gtk_button_new()
  GC_ref(result)
  g_object_add_toggle_ref(result.impl, toggleNotify, addr(result[]))
  assert(g_object_get_qdata(result.impl, Quark) == nil)
  g_object_set_qdata(result.impl, Quark, addr(result[]))
_______________________________________________
gtk-list mailing list
gtk-list@xxxxxxxxx
https://mail.gnome.org/mailman/listinfo/gtk-list




[Index of Archives]     [Touch Screen Library]     [GIMP Users]     [Gnome]     [KDE]     [Yosemite News]     [Steve's Art]

  Powered by Linux