g_object_add_toggle_ref
- From: Stefan Salewski <mail ssalewski de>
- To: gtk-list gnome org
- Subject: g_object_add_toggle_ref
- Date: Sat, 03 Jun 2017 15:37:49 +0200
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[]))
[Date Prev][
Date Next] [Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]