mirror of https://github.com/subgraph/fw-daemon
You can not select more than 25 topics
Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
45 lines
874 B
45 lines
874 B
package gtk
|
|
|
|
// #cgo pkg-config: gtk+-3.0
|
|
// #include <gtk/gtk.h>
|
|
import "C"
|
|
import (
|
|
"unsafe"
|
|
|
|
"github.com/gotk3/gotk3/glib"
|
|
)
|
|
|
|
//export goBuilderConnect
|
|
func goBuilderConnect(builder *C.GtkBuilder,
|
|
object *C.GObject,
|
|
signal_name *C.gchar,
|
|
handler_name *C.gchar,
|
|
connect_object *C.GObject,
|
|
flags C.GConnectFlags,
|
|
user_data C.gpointer) {
|
|
|
|
builderSignals.Lock()
|
|
signals, ok := builderSignals.m[builder]
|
|
builderSignals.Unlock()
|
|
|
|
if !ok {
|
|
panic("no signal mapping defined for this GtkBuilder")
|
|
}
|
|
|
|
h := C.GoString((*C.char)(handler_name))
|
|
s := C.GoString((*C.char)(signal_name))
|
|
|
|
handler, ok := signals[h]
|
|
if !ok {
|
|
return
|
|
}
|
|
|
|
if object == nil {
|
|
panic("unexpected nil object from builder")
|
|
}
|
|
|
|
//TODO: figure out a better way to get a glib.Object from a *C.GObject
|
|
gobj := glib.Object{glib.ToGObject(unsafe.Pointer(object))}
|
|
gobj.Connect(s, handler)
|
|
}
|