diff options
Diffstat (limited to 'vendor/github.com/gotk3/gotk3/glib')
32 files changed, 0 insertions, 4681 deletions
diff --git a/vendor/github.com/gotk3/gotk3/glib/application.go b/vendor/github.com/gotk3/gotk3/glib/application.go deleted file mode 100644 index 81ad34e..0000000 --- a/vendor/github.com/gotk3/gotk3/glib/application.go +++ /dev/null @@ -1,219 +0,0 @@ -package glib - -// #include <gio/gio.h> -// #include <glib.h> -// #include <glib-object.h> -// #include "glib.go.h" -import "C" -import "unsafe" - -// Application is a representation of GApplication. -type Application struct { - *Object - - // Interfaces - IActionMap - IActionGroup -} - -// native() returns a pointer to the underlying GApplication. -func (v *Application) native() *C.GApplication { - if v == nil || v.GObject == nil { - return nil - } - return C.toGApplication(unsafe.Pointer(v.GObject)) -} - -func (v *Application) Native() uintptr { - return uintptr(unsafe.Pointer(v.native())) -} - -func marshalApplication(p uintptr) (interface{}, error) { - c := C.g_value_get_object((*C.GValue)(unsafe.Pointer(p))) - return wrapApplication(wrapObject(unsafe.Pointer(c))), nil -} - -func wrapApplication(obj *Object) *Application { - am := wrapActionMap(obj) - ag := wrapActionGroup(obj) - return &Application{obj, am, ag} -} - -// ApplicationIDIsValid is a wrapper around g_application_id_is_valid(). -func ApplicationIDIsValid(id string) bool { - cstr1 := (*C.gchar)(C.CString(id)) - defer C.free(unsafe.Pointer(cstr1)) - - return gobool(C.g_application_id_is_valid(cstr1)) -} - -// ApplicationNew is a wrapper around g_application_new(). -func ApplicationNew(appID string, flags ApplicationFlags) *Application { - cstr1 := (*C.gchar)(C.CString(appID)) - defer C.free(unsafe.Pointer(cstr1)) - - c := C.g_application_new(cstr1, C.GApplicationFlags(flags)) - if c == nil { - return nil - } - return wrapApplication(wrapObject(unsafe.Pointer(c))) -} - -// GetApplicationID is a wrapper around g_application_get_application_id(). -func (v *Application) GetApplicationID() string { - c := C.g_application_get_application_id(v.native()) - - return C.GoString((*C.char)(c)) -} - -// SetApplicationID is a wrapper around g_application_set_application_id(). -func (v *Application) SetApplicationID(id string) { - cstr1 := (*C.gchar)(C.CString(id)) - defer C.free(unsafe.Pointer(cstr1)) - - C.g_application_set_application_id(v.native(), cstr1) -} - -// GetInactivityTimeout is a wrapper around g_application_get_inactivity_timeout(). -func (v *Application) GetInactivityTimeout() uint { - return uint(C.g_application_get_inactivity_timeout(v.native())) -} - -// SetInactivityTimeout is a wrapper around g_application_set_inactivity_timeout(). -func (v *Application) SetInactivityTimeout(timeout uint) { - C.g_application_set_inactivity_timeout(v.native(), C.guint(timeout)) -} - -// GetFlags is a wrapper around g_application_get_flags(). -func (v *Application) GetFlags() ApplicationFlags { - return ApplicationFlags(C.g_application_get_flags(v.native())) -} - -// SetFlags is a wrapper around g_application_set_flags(). -func (v *Application) SetFlags(flags ApplicationFlags) { - C.g_application_set_flags(v.native(), C.GApplicationFlags(flags)) -} - -// Only available in GLib 2.42+ -// // GetResourceBasePath is a wrapper around g_application_get_resource_base_path(). -// func (v *Application) GetResourceBasePath() string { -// c := C.g_application_get_resource_base_path(v.native()) - -// return C.GoString((*C.char)(c)) -// } - -// Only available in GLib 2.42+ -// // SetResourceBasePath is a wrapper around g_application_set_resource_base_path(). -// func (v *Application) SetResourceBasePath(bp string) { -// cstr1 := (*C.gchar)(C.CString(bp)) -// defer C.free(unsafe.Pointer(cstr1)) - -// C.g_application_set_resource_base_path(v.native(), cstr1) -// } - -// GetDbusObjectPath is a wrapper around g_application_get_dbus_object_path(). -func (v *Application) GetDbusObjectPath() string { - c := C.g_application_get_dbus_object_path(v.native()) - - return C.GoString((*C.char)(c)) -} - -// GetIsRegistered is a wrapper around g_application_get_is_registered(). -func (v *Application) GetIsRegistered() bool { - return gobool(C.g_application_get_is_registered(v.native())) -} - -// GetIsRemote is a wrapper around g_application_get_is_remote(). -func (v *Application) GetIsRemote() bool { - return gobool(C.g_application_get_is_remote(v.native())) -} - -// Hold is a wrapper around g_application_hold(). -func (v *Application) Hold() { - C.g_application_hold(v.native()) -} - -// Release is a wrapper around g_application_release(). -func (v *Application) Release() { - C.g_application_release(v.native()) -} - -// Quit is a wrapper around g_application_quit(). -func (v *Application) Quit() { - C.g_application_quit(v.native()) -} - -// Activate is a wrapper around g_application_activate(). -func (v *Application) Activate() { - C.g_application_activate(v.native()) -} - -// SendNotification is a wrapper around g_application_send_notification(). -func (v *Application) SendNotification(id string, notification *Notification) { - cstr1 := (*C.gchar)(C.CString(id)) - defer C.free(unsafe.Pointer(cstr1)) - - C.g_application_send_notification(v.native(), cstr1, notification.native()) -} - -// WithdrawNotification is a wrapper around g_application_withdraw_notification(). -func (v *Application) WithdrawNotification(id string) { - cstr1 := (*C.gchar)(C.CString(id)) - defer C.free(unsafe.Pointer(cstr1)) - - C.g_application_withdraw_notification(v.native(), cstr1) -} - -// SetDefault is a wrapper around g_application_set_default(). -func (v *Application) SetDefault() { - C.g_application_set_default(v.native()) -} - -// ApplicationGetDefault is a wrapper around g_application_get_default(). -func ApplicationGetDefault() *Application { - c := C.g_application_get_default() - if c == nil { - return nil - } - return wrapApplication(wrapObject(unsafe.Pointer(c))) -} - -// MarkBusy is a wrapper around g_application_mark_busy(). -func (v *Application) MarkBusy() { - C.g_application_mark_busy(v.native()) -} - -// UnmarkBusy is a wrapper around g_application_unmark_busy(). -func (v *Application) UnmarkBusy() { - C.g_application_unmark_busy(v.native()) -} - -// Run is a wrapper around g_application_run(). -func (v *Application) Run(args []string) int { - cargs := C.make_strings(C.int(len(args))) - defer C.destroy_strings(cargs) - - for i, arg := range args { - cstr := C.CString(arg) - defer C.free(unsafe.Pointer(cstr)) - C.set_string(cargs, C.int(i), (*C.char)(cstr)) - } - - return int(C.g_application_run(v.native(), C.int(len(args)), cargs)) -} - -// Only available in GLib 2.44+ -// // GetIsBusy is a wrapper around g_application_get_is_busy(). -// func (v *Application) GetIsBusy() bool { -// return gobool(C.g_application_get_is_busy(v.native())) -// } - -// void g_application_bind_busy_property () -// void g_application_unbind_busy_property () -// gboolean g_application_register () // requires GCancellable -// void g_application_set_action_group () // Deprecated since 2.32 -// GDBusConnection * g_application_get_dbus_connection () // No support for GDBusConnection -// void g_application_open () // Needs GFile -// void g_application_add_main_option_entries () //Needs GOptionEntry -// void g_application_add_main_option () //Needs GOptionFlags and GOptionArg -// void g_application_add_option_group () // Needs GOptionGroup diff --git a/vendor/github.com/gotk3/gotk3/glib/connect.go b/vendor/github.com/gotk3/gotk3/glib/connect.go deleted file mode 100644 index 9cd9a0e..0000000 --- a/vendor/github.com/gotk3/gotk3/glib/connect.go +++ /dev/null @@ -1,116 +0,0 @@ -package glib - -// #include <glib.h> -// #include <glib-object.h> -// #include "glib.go.h" -import "C" -import ( - "errors" - "reflect" - "unsafe" -) - -/* - * Events - */ - -type SignalHandle uint - -func (v *Object) connectClosure(after bool, detailedSignal string, f interface{}, userData ...interface{}) (SignalHandle, error) { - if len(userData) > 1 { - return 0, errors.New("userData len must be 0 or 1") - } - - cstr := C.CString(detailedSignal) - defer C.free(unsafe.Pointer(cstr)) - - closure, err := ClosureNew(f, userData...) - if err != nil { - return 0, err - } - - C._g_closure_add_finalize_notifier(closure) - - c := C.g_signal_connect_closure(C.gpointer(v.native()), - (*C.gchar)(cstr), closure, gbool(after)) - handle := SignalHandle(c) - - // Map the signal handle to the closure. - signals[handle] = closure - - return handle, nil -} - -// Connect is a wrapper around g_signal_connect_closure(). f must be -// a function with a signaure matching the callback signature for -// detailedSignal. userData must either 0 or 1 elements which can -// be optionally passed to f. If f takes less arguments than it is -// passed from the GLib runtime, the extra arguments are ignored. -// -// Arguments for f must be a matching Go equivalent type for the -// C callback, or an interface type which the value may be packed in. -// If the type is not suitable, a runtime panic will occur when the -// signal is emitted. -func (v *Object) Connect(detailedSignal string, f interface{}, userData ...interface{}) (SignalHandle, error) { - return v.connectClosure(false, detailedSignal, f, userData...) -} - -// ConnectAfter is a wrapper around g_signal_connect_closure(). f must be -// a function with a signaure matching the callback signature for -// detailedSignal. userData must either 0 or 1 elements which can -// be optionally passed to f. If f takes less arguments than it is -// passed from the GLib runtime, the extra arguments are ignored. -// -// Arguments for f must be a matching Go equivalent type for the -// C callback, or an interface type which the value may be packed in. -// If the type is not suitable, a runtime panic will occur when the -// signal is emitted. -// -// The difference between Connect and ConnectAfter is that the latter -// will be invoked after the default handler, not before. -func (v *Object) ConnectAfter(detailedSignal string, f interface{}, userData ...interface{}) (SignalHandle, error) { - return v.connectClosure(true, detailedSignal, f, userData...) -} - -// ClosureNew creates a new GClosure and adds its callback function -// to the internally-maintained map. It's exported for visibility to other -// gotk3 packages and shouldn't be used in application code. -func ClosureNew(f interface{}, marshalData ...interface{}) (*C.GClosure, error) { - // Create a reflect.Value from f. This is called when the - // returned GClosure runs. - rf := reflect.ValueOf(f) - - // Create closure context which points to the reflected func. - cc := closureContext{rf: rf} - - // Closures can only be created from funcs. - if rf.Type().Kind() != reflect.Func { - return nil, errors.New("value is not a func") - } - - if len(marshalData) > 0 { - cc.userData = reflect.ValueOf(marshalData[0]) - } - - c := C._g_closure_new() - - // Associate the GClosure with rf. rf will be looked up in this - // map by the closure when the closure runs. - closures.Lock() - closures.m[c] = cc - closures.Unlock() - - return c, nil -} - -// removeClosure removes a closure from the internal closures map. This is -// needed to prevent a leak where Go code can access the closure context -// (along with rf and userdata) even after an object has been destroyed and -// the GClosure is invalidated and will never run. -// -//export removeClosure -func removeClosure(_ C.gpointer, closure *C.GClosure) { - closures.Lock() - delete(closures.m, closure) - closures.Unlock() -} diff --git a/vendor/github.com/gotk3/gotk3/glib/gaction.go b/vendor/github.com/gotk3/gotk3/glib/gaction.go deleted file mode 100644 index 94bc32e..0000000 --- a/vendor/github.com/gotk3/gotk3/glib/gaction.go +++ /dev/null @@ -1,215 +0,0 @@ -package glib - -// #include <gio/gio.h> -// #include <glib.h> -// #include <glib-object.h> -// #include "glib.go.h" -import "C" -import "unsafe" - -// Action is a representation of glib's GAction GInterface. -type Action struct { - *Object -} - -// IAction is an interface type implemented by all structs -// embedding an Action. It is meant to be used as an argument type -// for wrapper functions that wrap around a C function taking a -// GAction. -type IAction interface { - toGAction() *C.GAction - toAction() *Action -} - -func (v *Action) toGAction() *C.GAction { - if v == nil { - return nil - } - return v.native() -} - -func (v *Action) toAction() *Action { - return v -} - -// gboolean g_action_parse_detailed_name (const gchar *detailed_name, gchar **action_name, GVariant **target_value, GError **error); -// gchar * g_action_print_detailed_name (const gchar *action_name, GVariant *target_value); - -// native() returns a pointer to the underlying GAction. -func (v *Action) native() *C.GAction { - if v == nil || v.GObject == nil { - return nil - } - return C.toGAction(unsafe.Pointer(v.GObject)) -} - -func (v *Action) Native() uintptr { - return uintptr(unsafe.Pointer(v.native())) -} - -func marshalAction(p uintptr) (interface{}, error) { - c := C.g_value_get_object((*C.GValue)(unsafe.Pointer(p))) - return wrapAction(wrapObject(unsafe.Pointer(c))), nil -} - -func wrapAction(obj *Object) *Action { - return &Action{obj} -} - -// ActionNameIsValid is a wrapper around g_action_name_is_valid -func ActionNameIsValid(actionName string) bool { - cstr := (*C.gchar)(C.CString(actionName)) - return gobool(C.g_action_name_is_valid(cstr)) -} - -// GetName is a wrapper around g_action_get_name -func (v *Action) GetName() string { - return C.GoString((*C.char)(C.g_action_get_name(v.native()))) -} - -// GetEnabled is a wrapper around g_action_get_enabled -func (v *Action) GetEnabled() bool { - return gobool(C.g_action_get_enabled(v.native())) -} - -// GetState is a wrapper around g_action_get_state -func (v *Action) GetState() *Variant { - c := C.g_action_get_state(v.native()) - if c == nil { - return nil - } - return newVariant((*C.GVariant)(c)) -} - -// GetStateHint is a wrapper around g_action_get_state_hint -func (v *Action) GetStateHint() *Variant { - c := C.g_action_get_state_hint(v.native()) - if c == nil { - return nil - } - return newVariant((*C.GVariant)(c)) -} - -// GetParameterType is a wrapper around g_action_get_parameter_type -func (v *Action) GetParameterType() *VariantType { - c := C.g_action_get_parameter_type(v.native()) - if c == nil { - return nil - } - return newVariantType((*C.GVariantType)(c)) -} - -// GetStateType is a wrapper around g_action_get_state_type -func (v *Action) GetStateType() *VariantType { - c := C.g_action_get_state_type(v.native()) - if c == nil { - return nil - } - return newVariantType((*C.GVariantType)(c)) -} - -// ChangeState is a wrapper around g_action_change_state -func (v *Action) ChangeState(value *Variant) { - C.g_action_change_state(v.native(), value.native()) -} - -// Activate is a wrapper around g_action_activate -func (v *Action) Activate(parameter *Variant) { - C.g_action_activate(v.native(), parameter.native()) -} - -// SimpleAction is a representation of GSimpleAction -type SimpleAction struct { - Action -} - -func (v *SimpleAction) native() *C.GSimpleAction { - if v == nil || v.GObject == nil { - return nil - } - return C.toGSimpleAction(unsafe.Pointer(v.GObject)) -} - -func (v *SimpleAction) Native() uintptr { - return uintptr(unsafe.Pointer(v.native())) -} - -func marshalSimpleAction(p uintptr) (interface{}, error) { - c := C.g_value_get_object((*C.GValue)(unsafe.Pointer(p))) - return wrapSimpleAction(wrapObject(unsafe.Pointer(c))), nil -} - -func wrapSimpleAction(obj *Object) *SimpleAction { - return &SimpleAction{Action{obj}} -} - -// SimpleActionNew is a wrapper around g_simple_action_new -func SimpleActionNew(name string, parameterType *VariantType) *SimpleAction { - c := C.g_simple_action_new((*C.gchar)(C.CString(name)), parameterType.native()) - if c == nil { - return nil - } - return wrapSimpleAction(wrapObject(unsafe.Pointer(c))) -} - -// SimpleActionNewStateful is a wrapper around g_simple_action_new_stateful -func SimpleActionNewStateful(name string, parameterType *VariantType, state *Variant) *SimpleAction { - c := C.g_simple_action_new_stateful((*C.gchar)(C.CString(name)), parameterType.native(), state.native()) - if c == nil { - return nil - } - return wrapSimpleAction(wrapObject(unsafe.Pointer(c))) -} - -// SetEnabled is a wrapper around g_simple_action_set_enabled -func (v *SimpleAction) SetEnabled(enabled bool) { - C.g_simple_action_set_enabled(v.native(), gbool(enabled)) -} - -// SetState is a wrapper around g_simple_action_set_state -// This should only be called by the implementor of the action. -// Users of the action should not attempt to directly modify the 'state' property. -// Instead, they should call ChangeState [g_action_change_state()] to request the change. -func (v *SimpleAction) SetState(value *Variant) { - C.g_simple_action_set_state(v.native(), value.native()) -} - -// SetStateHint is a wrapper around g_simple_action_set_state_hint -// GLib 2.44 only (currently no build tags, so commented out) -/*func (v *SimpleAction) SetStateHint(stateHint *Variant) { - C.g_simple_action_set_state_hint(v.native(), stateHint.native()) -}*/ - -// PropertyAction is a representation of GPropertyAction -type PropertyAction struct { - Action -} - -func (v *PropertyAction) native() *C.GPropertyAction { - if v == nil || v.GObject == nil { - return nil - } - return C.toGPropertyAction(unsafe.Pointer(v.GObject)) -} - -func (v *PropertyAction) Native() uintptr { - return uintptr(unsafe.Pointer(v.native())) -} - -func marshalPropertyAction(p uintptr) (interface{}, error) { - c := C.g_value_get_object((*C.GValue)(unsafe.Pointer(p))) - return wrapPropertyAction(wrapObject(unsafe.Pointer(c))), nil -} - -func wrapPropertyAction(obj *Object) *PropertyAction { - return &PropertyAction{Action{obj}} -} - -// PropertyActionNew is a wrapper around g_property_action_new -func PropertyActionNew(name string, object *Object, propertyName string) *PropertyAction { - c := C.g_property_action_new((*C.gchar)(C.CString(name)), C.gpointer(unsafe.Pointer(object.native())), (*C.gchar)(C.CString(propertyName))) - if c == nil { - return nil - } - return wrapPropertyAction(wrapObject(unsafe.Pointer(c))) -} diff --git a/vendor/github.com/gotk3/gotk3/glib/gactiongroup.go b/vendor/github.com/gotk3/gotk3/glib/gactiongroup.go deleted file mode 100644 index 4c1c654..0000000 --- a/vendor/github.com/gotk3/gotk3/glib/gactiongroup.go +++ /dev/null @@ -1,113 +0,0 @@ -package glib - -// #include <gio/gio.h> -// #include <glib.h> -// #include <glib-object.h> -// #include "glib.go.h" -import "C" -import "unsafe" - -// IActionGroup is an interface representation of ActionGroup, -// used to avoid duplication when embedding the type in a wrapper of another GObject-based type. -type IActionGroup interface { - Native() uintptr - - HasAction(actionName string) bool - GetActionEnabled(actionName string) bool - GetActionParameterType(actionName string) *VariantType - GetActionStateType(actionName string) *VariantType - GetActionState(actionName string) *Variant - GetActionStateHint(actionName string) *Variant - ChangeActionState(actionName string, value *Variant) - Activate(actionName string, parameter *Variant) -} - -// ActionGroup is a representation of glib's GActionGroup GInterface -type ActionGroup struct { - *Object -} - -// g_action_group_list_actions() -// g_action_group_query_action() -// should only called from implementations: -// g_action_group_action_added -// g_action_group_action_removed -// g_action_group_action_enabled_changed -// g_action_group_action_state_changed - -// native() returns a pointer to the underlying GActionGroup. -func (v *ActionGroup) native() *C.GActionGroup { - if v == nil || v.GObject == nil { - return nil - } - return C.toGActionGroup(unsafe.Pointer(v.GObject)) -} - -func (v *ActionGroup) Native() uintptr { - return uintptr(unsafe.Pointer(v.native())) -} - -func marshalActionGroup(p uintptr) (interface{}, error) { - c := C.g_value_get_object((*C.GValue)(unsafe.Pointer(p))) - return wrapActionGroup(wrapObject(unsafe.Pointer(c))), nil -} - -func wrapActionGroup(obj *Object) *ActionGroup { - return &ActionGroup{obj} -} - -// HasAction is a wrapper around g_action_group_has_action(). -func (v *ActionGroup) HasAction(actionName string) bool { - return gobool(C.g_action_group_has_action(v.native(), (*C.gchar)(C.CString(actionName)))) -} - -// GetActionEnabled is a wrapper around g_action_group_get_action_enabled(). -func (v *ActionGroup) GetActionEnabled(actionName string) bool { - return gobool(C.g_action_group_get_action_enabled(v.native(), (*C.gchar)(C.CString(actionName)))) -} - -// GetActionParameterType is a wrapper around g_action_group_get_action_parameter_type(). -func (v *ActionGroup) GetActionParameterType(actionName string) *VariantType { - c := C.g_action_group_get_action_parameter_type(v.native(), (*C.gchar)(C.CString(actionName))) - if c == nil { - return nil - } - return newVariantType((*C.GVariantType)(c)) -} - -// GetActionStateType is a wrapper around g_action_group_get_action_state_type(). -func (v *ActionGroup) GetActionStateType(actionName string) *VariantType { - c := C.g_action_group_get_action_state_type(v.native(), (*C.gchar)(C.CString(actionName))) - if c == nil { - return nil - } - return newVariantType((*C.GVariantType)(c)) -} - -// GetActionState is a wrapper around g_action_group_get_action_state(). -func (v *ActionGroup) GetActionState(actionName string) *Variant { - c := C.g_action_group_get_action_state(v.native(), (*C.gchar)(C.CString(actionName))) - if c == nil { - return nil - } - return newVariant((*C.GVariant)(c)) -} - -// GetActionStateHint is a wrapper around g_action_group_get_action_state_hint(). -func (v *ActionGroup) GetActionStateHint(actionName string) *Variant { - c := C.g_action_group_get_action_state_hint(v.native(), (*C.gchar)(C.CString(actionName))) - if c == nil { - return nil - } - return newVariant((*C.GVariant)(c)) -} - -// ChangeActionState is a wrapper around g_action_group_change_action_state -func (v *ActionGroup) ChangeActionState(actionName string, value *Variant) { - C.g_action_group_change_action_state(v.native(), (*C.gchar)(C.CString(actionName)), value.native()) -} - -// Activate is a wrapper around g_action_group_activate_action -func (v *ActionGroup) Activate(actionName string, parameter *Variant) { - C.g_action_group_activate_action(v.native(), (*C.gchar)(C.CString(actionName)), parameter.native()) -} diff --git a/vendor/github.com/gotk3/gotk3/glib/gactionmap.go b/vendor/github.com/gotk3/gotk3/glib/gactionmap.go deleted file mode 100644 index f5b8998..0000000 --- a/vendor/github.com/gotk3/gotk3/glib/gactionmap.go +++ /dev/null @@ -1,66 +0,0 @@ -package glib - -// #include <gio/gio.h> -// #include <glib.h> -// #include <glib-object.h> -// #include "glib.go.h" -import "C" -import "unsafe" - -// IActionMap is an interface representation of ActionMap, -// used to avoid duplication when embedding the type in a wrapper of another GObject-based type. -type IActionMap interface { - Native() uintptr - - LookupAction(actionName string) *Action - AddAction(action IAction) - RemoveAction(actionName string) -} - -// ActionMap is a representation of glib's GActionMap GInterface -type ActionMap struct { - *Object -} - -// void g_action_map_add_action_entries (GActionMap *action_map, const GActionEntry *entries, gint n_entries, gpointer user_data); -// struct GActionEntry - -// native() returns a pointer to the underlying GActionMap. -func (v *ActionMap) native() *C.GActionMap { - if v == nil || v.GObject == nil { - return nil - } - return C.toGActionMap(unsafe.Pointer(v.GObject)) -} - -func (v *ActionMap) Native() uintptr { - return uintptr(unsafe.Pointer(v.native())) -} - -func marshalActionMap(p uintptr) (interface{}, error) { - c := C.g_value_get_object((*C.GValue)(unsafe.Pointer(p))) - return wrapActionMap(wrapObject(unsafe.Pointer(c))), nil -} - -func wrapActionMap(obj *Object) *ActionMap { - return &ActionMap{obj} -} - -// LookupAction is a wrapper around g_action_map_lookup_action -func (v *ActionMap) LookupAction(actionName string) *Action { - c := C.g_action_map_lookup_action(v.native(), (*C.gchar)(C.CString(actionName))) - if c == nil { - return nil - } - return wrapAction(wrapObject(unsafe.Pointer(c))) -} - -// AddAction is a wrapper around g_action_map_add_action -func (v *ActionMap) AddAction(action IAction) { - C.g_action_map_add_action(v.native(), action.toGAction()) -} - -// RemoveAction is a wrapper around g_action_map_remove_action -func (v *ActionMap) RemoveAction(actionName string) { - C.g_action_map_remove_action(v.native(), (*C.gchar)(C.CString(actionName))) -} diff --git a/vendor/github.com/gotk3/gotk3/glib/gbinding.go b/vendor/github.com/gotk3/gotk3/glib/gbinding.go deleted file mode 100644 index 133ce12..0000000 --- a/vendor/github.com/gotk3/gotk3/glib/gbinding.go +++ /dev/null @@ -1,98 +0,0 @@ -package glib - -// #include <gio/gio.h> -// #include <glib.h> -// #include <glib-object.h> -// #include "glib.go.h" -import "C" -import "unsafe" - -type BindingFlags int - -const ( - BINDING_DEFAULT BindingFlags = C.G_BINDING_DEFAULT - BINDING_BIDIRECTIONAL BindingFlags = C.G_BINDING_BIDIRECTIONAL - BINDING_SYNC_CREATE = C.G_BINDING_SYNC_CREATE - BINDING_INVERT_BOOLEAN = C.G_BINDING_INVERT_BOOLEAN -) - -type Binding struct { - *Object -} - -func (v *Binding) native() *C.GBinding { - if v == nil || v.GObject == nil { - return nil - } - return C.toGBinding(unsafe.Pointer(v.GObject)) -} - -func marshalBinding(p uintptr) (interface{}, error) { - c := C.g_value_get_object((*C.GValue)(unsafe.Pointer(p))) - return &Binding{wrapObject(unsafe.Pointer(c))}, nil -} - -// Creates a binding between source property on source and target property on -// target . Whenever the source property is changed the target_property is -// updated using the same value. -func BindProperty(source *Object, sourceProperty string, - target *Object, targetProperty string, - flags BindingFlags) *Binding { - srcStr := (*C.gchar)(C.CString(sourceProperty)) - defer C.free(unsafe.Pointer(srcStr)) - tgtStr := (*C.gchar)(C.CString(targetProperty)) - defer C.free(unsafe.Pointer(tgtStr)) - obj := C.g_object_bind_property( - C.gpointer(source.GObject), srcStr, - C.gpointer(target.GObject), tgtStr, - C.GBindingFlags(flags), - ) - if obj == nil { - return nil - } - return &Binding{wrapObject(unsafe.Pointer(obj))} -} - -// Explicitly releases the binding between the source and the target property -// expressed by Binding -func (v *Binding) Unbind() { - C.g_binding_unbind(v.native()) -} - -// Retrieves the GObject instance used as the source of the binding -func (v *Binding) GetSource() *Object { - obj := C.g_binding_get_source(v.native()) - if obj == nil { - return nil - } - return wrapObject(unsafe.Pointer(obj)) -} - -// Retrieves the name of the property of “source” used as the source of -// the binding. -func (v *Binding) GetSourceProperty() string { - s := C.g_binding_get_source_property(v.native()) - return C.GoString((*C.char)(s)) -} - -// Retrieves the GObject instance used as the target of the binding. -func (v *Binding) GetTarget() *Object { - obj := C.g_binding_get_target(v.native()) - if obj == nil { - return nil - } - return wrapObject(unsafe.Pointer(obj)) -} - -// Retrieves the name of the property of “target” used as the target of -// the binding. -func (v *Binding) GetTargetProperty() string { - s := C.g_binding_get_target_property(v.native()) - return C.GoString((*C.char)(s)) -} - -// Retrieves the flags passed when constructing the GBinding. -func (v *Binding) GetFlags() BindingFlags { - flags := C.g_binding_get_flags(v.native()) - return BindingFlags(flags) -} diff --git a/vendor/github.com/gotk3/gotk3/glib/glib.go b/vendor/github.com/gotk3/gotk3/glib/glib.go deleted file mode 100644 index 523a711..0000000 --- a/vendor/github.com/gotk3/gotk3/glib/glib.go +++ /dev/null @@ -1,1371 +0,0 @@ -// Copyright (c) 2013-2014 Conformal Systems <info@conformal.com> -// -// This file originated from: http://opensource.conformal.com/ -// -// Permission to use, copy, modify, and distribute this software for any -// purpose with or without fee is hereby granted, provided that the above -// copyright notice and this permission notice appear in all copies. -// -// THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES -// WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF -// MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR -// ANY SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES -// WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN -// ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF -// OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE. - -// Package glib provides Go bindings for GLib 2. Supports version 2.36 -// and later. -package glib - -// #cgo pkg-config: gio-2.0 glib-2.0 gobject-2.0 -// #include <gio/gio.h> -// #include <glib.h> -// #include <glib-object.h> -// #include "glib.go.h" -import "C" - -import ( - "errors" - "fmt" - "os" - "reflect" - "runtime" - "sync" - "unsafe" -) - -/* - * Type conversions - */ - -func gbool(b bool) C.gboolean { - if b { - return C.gboolean(1) - } - return C.gboolean(0) -} -func gobool(b C.gboolean) bool { - if b != 0 { - return true - } - return false -} - -/* - * Unexported vars - */ - -type closureContext struct { - rf reflect.Value - userData reflect.Value -} - -var ( - errNilPtr = errors.New("cgo returned unexpected nil pointer") - - closures = struct { - sync.RWMutex - m map[*C.GClosure]closureContext - }{ - m: make(map[*C.GClosure]closureContext), - } - - signals = make(map[SignalHandle]*C.GClosure) -) - -/* - * Constants - */ - -// Type is a representation of GLib's GType. -type Type uint - -const ( - TYPE_INVALID Type = C.G_TYPE_INVALID - TYPE_NONE Type = C.G_TYPE_NONE - TYPE_INTERFACE Type = C.G_TYPE_INTERFACE - TYPE_CHAR Type = C.G_TYPE_CHAR - TYPE_UCHAR Type = C.G_TYPE_UCHAR - TYPE_BOOLEAN Type = C.G_TYPE_BOOLEAN - TYPE_INT Type = C.G_TYPE_INT - TYPE_UINT Type = C.G_TYPE_UINT - TYPE_LONG Type = C.G_TYPE_LONG - TYPE_ULONG Type = C.G_TYPE_ULONG - TYPE_INT64 Type = C.G_TYPE_INT64 - TYPE_UINT64 Type = C.G_TYPE_UINT64 - TYPE_ENUM Type = C.G_TYPE_ENUM - TYPE_FLAGS Type = C.G_TYPE_FLAGS - TYPE_FLOAT Type = C.G_TYPE_FLOAT - TYPE_DOUBLE Type = C.G_TYPE_DOUBLE - TYPE_STRING Type = C.G_TYPE_STRING - TYPE_POINTER Type = C.G_TYPE_POINTER - TYPE_BOXED Type = C.G_TYPE_BOXED - TYPE_PARAM Type = C.G_TYPE_PARAM - TYPE_OBJECT Type = C.G_TYPE_OBJECT - TYPE_VARIANT Type = C.G_TYPE_VARIANT -) - -// Name is a wrapper around g_type_name(). -func (t Type) Name() string { - return C.GoString((*C.char)(C.g_type_name(C.GType(t)))) -} - -// Depth is a wrapper around g_type_depth(). -func (t Type) Depth() uint { - return uint(C.g_type_depth(C.GType(t))) -} - -// Parent is a wrapper around g_type_parent(). -func (t Type) Parent() Type { - return Type(C.g_type_parent(C.GType(t))) -} - -// UserDirectory is a representation of GLib's GUserDirectory. -type UserDirectory int - -const ( - USER_DIRECTORY_DESKTOP UserDirectory = C.G_USER_DIRECTORY_DESKTOP - USER_DIRECTORY_DOCUMENTS UserDirectory = C.G_USER_DIRECTORY_DOCUMENTS - USER_DIRECTORY_DOWNLOAD UserDirectory = C.G_USER_DIRECTORY_DOWNLOAD - USER_DIRECTORY_MUSIC UserDirectory = C.G_USER_DIRECTORY_MUSIC - USER_DIRECTORY_PICTURES UserDirectory = C.G_USER_DIRECTORY_PICTURES - USER_DIRECTORY_PUBLIC_SHARE UserDirectory = C.G_USER_DIRECTORY_PUBLIC_SHARE - USER_DIRECTORY_TEMPLATES UserDirectory = C.G_USER_DIRECTORY_TEMPLATES - USER_DIRECTORY_VIDEOS UserDirectory = C.G_USER_DIRECTORY_VIDEOS -) - -const USER_N_DIRECTORIES int = C.G_USER_N_DIRECTORIES - -/* - * GApplicationFlags - */ - -type ApplicationFlags int - -const ( - APPLICATION_FLAGS_NONE ApplicationFlags = C.G_APPLICATION_FLAGS_NONE - APPLICATION_IS_SERVICE ApplicationFlags = C.G_APPLICATION_IS_SERVICE - APPLICATION_HANDLES_OPEN ApplicationFlags = C.G_APPLICATION_HANDLES_OPEN - APPLICATION_HANDLES_COMMAND_LINE ApplicationFlags = C.G_APPLICATION_HANDLES_COMMAND_LINE - APPLICATION_SEND_ENVIRONMENT ApplicationFlags = C.G_APPLICATION_SEND_ENVIRONMENT - APPLICATION_NON_UNIQUE ApplicationFlags = C.G_APPLICATION_NON_UNIQUE -) - -// goMarshal is called by the GLib runtime when a closure needs to be invoked. -// The closure will be invoked with as many arguments as it can take, from 0 to -// the full amount provided by the call. If the closure asks for more parameters -// than there are to give, a warning is printed to stderr and the closure is -// not run. -// -//export goMarshal -func goMarshal(closure *C.GClosure, retValue *C.GValue, - nParams C.guint, params *C.GValue, - invocationHint C.gpointer, marshalData *C.GValue) { - - // Get the context associated with this callback closure. - closures.RLock() - cc := closures.m[closure] - closures.RUnlock() - - // Get number of parameters passed in. If user data was saved with the - // closure context, increment the total number of parameters. - nGLibParams := int(nParams) - nTotalParams := nGLibParams - if cc.userData.IsValid() { - nTotalParams++ - } - - // Get number of parameters from the callback closure. If this exceeds - // the total number of marshaled parameters, a warning will be printed - // to stderr, and the callback will not be run. - nCbParams := cc.rf.Type().NumIn() - if nCbParams > nTotalParams { - fmt.Fprintf(os.Stderr, - "too many closure args: have %d, max allowed %d\n", - nCbParams, nTotalParams) - return - } - - // Create a slice of reflect.Values as arguments to call the function. - gValues := gValueSlice(params, nCbParams) - args := make([]reflect.Value, 0, nCbParams) - - // Fill beginning of args, up to the minimum of the total number of callback - // parameters and parameters from the glib runtime. - for i := 0; i < nCbParams && i < nGLibParams; i++ { - v := &Value{&gValues[i]} - val, err := v.GoValue() - if err != nil { - fmt.Fprintf(os.Stderr, - "no suitable Go value for arg %d: %v\n", i, err) - return - } - rv := reflect.ValueOf(val) - args = append(args, rv.Convert(cc.rf.Type().In(i))) - } - - // If non-nil user data was passed in and not all args have been set, - // get and set the reflect.Value directly from the GValue. - if cc.userData.IsValid() && len(args) < cap(args) { - args = append(args, cc.userData.Convert(cc.rf.Type().In(nCbParams-1))) - } - - // Call closure with args. If the callback returns one or more - // values, save the GValue equivalent of the first. - rv := cc.rf.Call(args) - if retValue != nil && len(rv) > 0 { - if g, err := GValue(rv[0].Interface()); err != nil { - fmt.Fprintf(os.Stderr, - "cannot save callback return value: %v", err) - } else { - *retValue = *g.native() - } - } -} - -// gValueSlice converts a C array of GValues to a Go slice. -func gValueSlice(values *C.GValue, nValues int) (slice []C.GValue) { - header := (*reflect.SliceHeader)((unsafe.Pointer(&slice))) - header.Cap = nValues - header.Len = nValues - header.Data = uintptr(unsafe.Pointer(values)) - return -} - -/* - * Main event loop - */ - -type SourceHandle uint - -// IdleAdd adds an idle source to the default main event loop -// context. After running once, the source func will be removed -// from the main event loop, unless f returns a single bool true. -// -// This function will cause a panic when f eventually runs if the -// types of args do not match those of f. -func IdleAdd(f interface{}, args ...interface{}) (SourceHandle, error) { - // f must be a func with no parameters. - rf := reflect.ValueOf(f) - if rf.Type().Kind() != reflect.Func { - return 0, errors.New("f is not a function") - } - - // Create an idle source func to be added to the main loop context. - idleSrc := C.g_idle_source_new() - if idleSrc == nil { - return 0, errNilPtr - } - return sourceAttach(idleSrc, rf, args...) -} - -// TimeoutAdd adds an timeout source to the default main event loop -// context. After running once, the source func will be removed -// from the main event loop, unless f returns a single bool true. -// -// This function will cause a panic when f eventually runs if the -// types of args do not match those of f. -// timeout is in milliseconds -func TimeoutAdd(timeout uint, f interface{}, args ...interface{}) (SourceHandle, error) { - // f must be a func with no parameters. - rf := reflect.ValueOf(f) - if rf.Type().Kind() != reflect.Func { - return 0, errors.New("f is not a function") - } - - // Create a timeout source func to be added to the main loop context. - timeoutSrc := C.g_timeout_source_new(C.guint(timeout)) - if timeoutSrc == nil { - return 0, errNilPtr - } - - return sourceAttach(timeoutSrc, rf, args...) -} - -// sourceAttach attaches a source to the default main loop context. -func sourceAttach(src *C.struct__GSource, rf reflect.Value, args ...interface{}) (SourceHandle, error) { - if src == nil { - return 0, errNilPtr - } - - // rf must be a func with no parameters. - if rf.Type().Kind() != reflect.Func { - C.g_source_destroy(src) - return 0, errors.New("rf is not a function") - } - - // Create a new GClosure from f that invalidates itself when - // f returns false. The error is ignored here, as this will - // always be a function. - var closure *C.GClosure - closure, _ = ClosureNew(rf.Interface(), args...) - - // Remove closure context when closure is finalized. - C._g_closure_add_finalize_notifier(closure) - - // Set closure to run as a callback when the idle source runs. - C.g_source_set_closure(src, closure) - - // Attach the idle source func to the default main event loop - // context. - cid := C.g_source_attach(src, nil) - return SourceHandle(cid), nil -} - -/* - * Miscellaneous Utility Functions - */ - -// GetHomeDir is a wrapper around g_get_home_dir(). -func GetHomeDir() string { - c := C.g_get_home_dir() - return C.GoString((*C.char)(c)) -} - -// GetUserCacheDir is a wrapper around g_get_user_cache_dir(). -func GetUserCacheDir() string { - c := C.g_get_user_cache_dir() - return C.GoString((*C.char)(c)) -} - -// GetUserDataDir is a wrapper around g_get_user_data_dir(). -func GetUserDataDir() string { - c := C.g_get_user_data_dir() - return C.GoString((*C.char)(c)) -} - -// GetUserConfigDir is a wrapper around g_get_user_config_dir(). -func GetUserConfigDir() string { - c := C.g_get_user_config_dir() - return C.GoString((*C.char)(c)) -} - -// GetUserRuntimeDir is a wrapper around g_get_user_runtime_dir(). -func GetUserRuntimeDir() string { - c := C.g_get_user_runtime_dir() - return C.GoString((*C.char)(c)) -} - -// GetUserSpecialDir is a wrapper around g_get_user_special_dir(). A -// non-nil error is returned in the case that g_get_user_special_dir() -// returns NULL to differentiate between NULL and an empty string. -func GetUserSpecialDir(directory UserDirectory) (string, error) { - c := C.g_get_user_special_dir(C.GUserDirectory(directory)) - if c == nil { - return "", errNilPtr - } - return C.GoString((*C.char)(c)), nil -} - -/* - * GObject - */ - -// IObject is an interface type implemented by Object and all types which embed -// an Object. It is meant to be used as a type for function arguments which -// require GObjects or any subclasses thereof. -type IObject interface { - toGObject() *C.GObject - toObject() *Object -} - -// Object is a representation of GLib's GObject. -type Object struct { - GObject *C.GObject -} - -func (v *Object) toGObject() *C.GObject { - if v == nil { - return nil - } - return v.native() -} - -func (v *Object) toObject() *Object { - return v -} - -// newObject creates a new Object from a GObject pointer. -func newObject(p *C.GObject) *Object { - return &Object{GObject: p} -} - -// native returns a pointer to the underlying GObject. -func (v *Object) native() *C.GObject { - if v == nil || v.GObject == nil { - return nil - } - p := unsafe.Pointer(v.GObject) - return C.toGObject(p) -} - -// Take wraps a unsafe.Pointer as a glib.Object, taking ownership of it. -// This function is exported for visibility in other gotk3 packages and -// is not meant to be used by applications. -func Take(ptr unsafe.Pointer) *Object { - obj := newObject(ToGObject(ptr)) - - if obj.IsFloating() { - obj.RefSink() - } else { - obj.Ref() - } - - runtime.SetFinalizer(obj, (*Object).Unref) - return obj -} - -// Native returns a pointer to the underlying GObject. -func (v *Object) Native() uintptr { - return uintptr(unsafe.Pointer(v.native())) -} - -// IsA is a wrapper around g_type_is_a(). -func (v *Object) IsA(typ Type) bool { - return gobool(C.g_type_is_a(C.GType(v.TypeFromInstance()), C.GType(typ))) -} - -// TypeFromInstance is a wrapper around g_type_from_instance(). -func (v *Object) TypeFromInstance() Type { - c := C._g_type_from_instance(C.gpointer(unsafe.Pointer(v.native()))) - return Type(c) -} - -// ToGObject type converts an unsafe.Pointer as a native C GObject. -// This function is exported for visibility in other gotk3 packages and -// is not meant to be used by applications. -func ToGObject(p unsafe.Pointer) *C.GObject { - return C.toGObject(p) -} - -// Ref is a wrapper around g_object_ref(). -func (v *Object) Ref() { - C.g_object_ref(C.gpointer(v.GObject)) -} - -// Unref is a wrapper around g_object_unref(). -func (v *Object) Unref() { - C.g_object_unref(C.gpointer(v.GObject)) -} - -// RefSink is a wrapper around g_object_ref_sink(). -func (v *Object) RefSink() { - C.g_object_ref_sink(C.gpointer(v.GObject)) -} - -// IsFloating is a wrapper around g_object_is_floating(). -func (v *Object) IsFloating() bool { - c := C.g_object_is_floating(C.gpointer(v.GObject)) - return gobool(c) -} - -// ForceFloating is a wrapper around g_object_force_floating(). -func (v *Object) ForceFloating() { - C.g_object_force_floating(v.GObject) -} - -// StopEmission is a wrapper around g_signal_stop_emission_by_name(). -func (v *Object) StopEmission(s string) { - cstr := C.CString(s) - defer C.free(unsafe.Pointer(cstr)) - C.g_signal_stop_emission_by_name((C.gpointer)(v.GObject), - (*C.gchar)(cstr)) -} - -// Set is a wrapper around g_object_set(). However, unlike -// g_object_set(), this function only sets one name value pair. Make -// multiple calls to this function to set multiple properties. -func (v *Object) Set(name string, value interface{}) error { - return v.SetProperty(name, value) - /* - cstr := C.CString(name) - defer C.free(unsafe.Pointer(cstr)) - - if _, ok := value.(Object); ok { - value = value.(Object).GObject - } - - // Can't call g_object_set() as it uses a variable arg list, use a - // wrapper instead - var p unsafe.Pointer - switch v := value.(type) { - case bool: - c := gbool(v) - p = unsafe.Pointer(&c) - - case int8: - c := C.gint8(v) - p = unsafe.Pointer(&c) - - case int16: - c := C.gint16(v) - p = unsafe.Pointer(&c) - - case int32: - c := C.gint32(v) - p = unsafe.Pointer(&c) - - case int64: - c := C.gint64(v) - p = unsafe.Pointer(&c) - - case int: - c := C.gint(v) - p = unsafe.Pointer(&c) - - case uint8: - c := C.guchar(v) - p = unsafe.Pointer(&c) - - case uint16: - c := C.guint16(v) - p = unsafe.Pointer(&c) - - case uint32: - c := C.guint32(v) - p = unsafe.Pointer(&c) - - case uint64: - c := C.guint64(v) - p = unsafe.Pointer(&c) - - case uint: - c := C.guint(v) - p = unsafe.Pointer(&c) - - case uintptr: - p = unsafe.Pointer(C.gpointer(v)) - - case float32: - c := C.gfloat(v) - p = unsafe.Pointer(&c) - - case float64: - c := C.gdouble(v) - p = unsafe.Pointer(&c) - - case string: - cstr := C.CString(v) - defer C.g_free(C.gpointer(unsafe.Pointer(cstr))) - p = unsafe.Pointer(&cstr) - - default: - if pv, ok := value.(unsafe.Pointer); ok { - p = pv - } else { - val := reflect.ValueOf(value) - switch val.Kind() { - case reflect.Int, reflect.Int8, reflect.Int16, - reflect.Int32, reflect.Int64: - c := C.int(val.Int()) - p = unsafe.Pointer(&c) - - case reflect.Uintptr, reflect.Ptr, reflect.UnsafePointer: - p = unsafe.Pointer(C.gpointer(val.Pointer())) - } - } - } - if p == nil { - return errors.New("Unable to perform type conversion") - } - C._g_object_set_one(C.gpointer(v.GObject), (*C.gchar)(cstr), p) - return nil*/ -} - -// GetPropertyType returns the Type of a property of the underlying GObject. -// If the property is missing it will return TYPE_INVALID and an error. -func (v *Object) GetPropertyType(name string) (Type, error) { - cstr := C.CString(name) - defer C.free(unsafe.Pointer(cstr)) - - paramSpec := C.g_object_class_find_property(C._g_object_get_class(v.native()), (*C.gchar)(cstr)) - if paramSpec == nil { - return TYPE_INVALID, errors.New("couldn't find Property") - } - return Type(paramSpec.value_type), nil -} - -// GetProperty is a wrapper around g_object_get_property(). -func (v *Object) GetProperty(name string) (interface{}, error) { - cstr := C.CString(name) - defer C.free(unsafe.Pointer(cstr)) - - t, err := v.GetPropertyType(name) - if err != nil { - return nil, err - } - - p, err := ValueInit(t) - if err != nil { - return nil, errors.New("unable to allocate value") - } - C.g_object_get_property(v.GObject, (*C.gchar)(cstr), p.native()) - return p.GoValue() -} - -// SetProperty is a wrapper around g_object_set_property(). -func (v *Object) SetProperty(name string, value interface{}) error { - cstr := C.CString(name) - defer C.free(unsafe.Pointer(cstr)) - - if _, ok := value.(Object); ok { - value = value.(Object).GObject - } - - p, err := GValue(value) - if err != nil { - return errors.New("Unable to perform type conversion") - } - C.g_object_set_property(v.GObject, (*C.gchar)(cstr), p.native()) - return nil -} - -// pointerVal attempts to return an unsafe.Pointer for value. -// Not all types are understood, in which case a nil Pointer -// is returned. -/*func pointerVal(value interface{}) unsafe.Pointer { - var p unsafe.Pointer - switch v := value.(type) { - case bool: - c := gbool(v) - p = unsafe.Pointer(&c) - - case int8: - c := C.gint8(v) - p = unsafe.Pointer(&c) - - case int16: - c := C.gint16(v) - p = unsafe.Pointer(&c) - - case int32: - c := C.gint32(v) - p = unsafe.Pointer(&c) - - case int64: - c := C.gint64(v) - p = unsafe.Pointer(&c) - - case int: - c := C.gint(v) - p = unsafe.Pointer(&c) - - case uint8: - c := C.guchar(v) - p = unsafe.Pointer(&c) - - case uint16: - c := C.guint16(v) - p = unsafe.Pointer(&c) - - case uint32: - c := C.guint32(v) - p = unsafe.Pointer(&c) - - case uint64: - c := C.guint64(v) - p = unsafe.Pointer(&c) - - case uint: - c := C.guint(v) - p = unsafe.Pointer(&c) - - case uintptr: - p = unsafe.Pointer(C.gpointer(v)) - - case float32: - c := C.gfloat(v) - p = unsafe.Pointer(&c) - - case float64: - c := C.gdouble(v) - p = unsafe.Pointer(&c) - - case string: - cstr := C.CString(v) - defer C.free(unsafe.Pointer(cstr)) - p = unsafe.Pointer(cstr) - - default: - if pv, ok := value.(unsafe.Pointer); ok { - p = pv - } else { - val := reflect.ValueOf(value) - switch val.Kind() { - case reflect.Int, reflect.Int8, reflect.Int16, - reflect.Int32, reflect.Int64: - c := C.int(val.Int()) - p = unsafe.Pointer(&c) - - case reflect.Uintptr, reflect.Ptr, reflect.UnsafePointer: - p = unsafe.Pointer(C.gpointer(val.Pointer())) - } - } - } - - return p -}*/ - -/* - * GObject Signals - */ - -// Emit is a wrapper around g_signal_emitv() and emits the signal -// specified by the string s to an Object. Arguments to callback -// functions connected to this signal must be specified in args. Emit() -// returns an interface{} which must be type asserted as the Go -// equivalent type to the return value for native C callback. -// -// Note that this code is unsafe in that the types of values in args are -// not checked against whether they are suitable for the callback. -func (v *Object) Emit(s string, args ...interface{}) (interface{}, error) { - cstr := C.CString(s) - defer C.free(unsafe.Pointer(cstr)) - - // Create array of this instance and arguments - valv := C.alloc_gvalue_list(C.int(len(args)) + 1) - defer C.free(unsafe.Pointer(valv)) - - // Add args and valv - val, err := GValue(v) - if err != nil { - return nil, errors.New("Error converting Object to GValue: " + err.Error()) - } - C.val_list_insert(valv, C.int(0), val.native()) - for i := range args { - val, err := GValue(args[i]) - if err != nil { - return nil, fmt.Errorf("Error converting arg %d to GValue: %s", i, err.Error()) - } - C.val_list_insert(valv, C.int(i+1), val.native()) - } - - t := v.TypeFromInstance() - // TODO: use just the signal name - id := C.g_signal_lookup((*C.gchar)(cstr), C.GType(t)) - - ret, err := ValueAlloc() - if err != nil { - return nil, errors.New("Error creating Value for return value") - } - C.g_signal_emitv(valv, id, C.GQuark(0), ret.native()) - - return ret.GoValue() -} - -// HandlerBlock is a wrapper around g_signal_handler_block(). -func (v *Object) HandlerBlock(handle SignalHandle) { - C.g_signal_handler_block(C.gpointer(v.GObject), C.gulong(handle)) -} - -// HandlerUnblock is a wrapper around g_signal_handler_unblock(). -func (v *Object) HandlerUnblock(handle SignalHandle) { - C.g_signal_handler_unblock(C.gpointer(v.GObject), C.gulong(handle)) -} - -// HandlerDisconnect is a wrapper around g_signal_handler_disconnect(). -func (v *Object) HandlerDisconnect(handle SignalHandle) { - C.g_signal_handler_disconnect(C.gpointer(v.GObject), C.gulong(handle)) - C.g_closure_invalidate(signals[handle]) - delete(closures.m, signals[handle]) - delete(signals, handle) -} - -// Wrapper function for new objects with reference management. -func wrapObject(ptr unsafe.Pointer) *Object { - obj := &Object{ToGObject(ptr)} - - if obj.IsFloating() { - obj.RefSink() - } else { - obj.Ref() - } - - runtime.SetFinalizer(obj, (*Object).Unref) - return obj -} - -/* - * GInitiallyUnowned - */ - -// InitiallyUnowned is a representation of GLib's GInitiallyUnowned. -type InitiallyUnowned struct { - // This must be a pointer so copies of the ref-sinked object - // do not outlive the original object, causing an unref - // finalizer to prematurely run. - *Object -} - -// Native returns a pointer to the underlying GObject. This is implemented -// here rather than calling Native on the embedded Object to prevent a nil -// pointer dereference. -func (v *InitiallyUnowned) Native() uintptr { - if v == nil || v.Object == nil { - return uintptr(unsafe.Pointer(nil)) - } - return v.Object.Native() -} - -/* - * GValue - */ - -// Value is a representation of GLib's GValue. -// -// Don't allocate Values on the stack or heap manually as they may not -// be properly unset when going out of scope. Instead, use ValueAlloc(), -// which will set the runtime finalizer to unset the Value after it has -// left scope. -type Value struct { - GValue *C.GValue -} - -// native returns a pointer to the underlying GValue. -func (v *Value) native() *C.GValue { - return v.GValue -} - -// Native returns a pointer to the underlying GValue. -func (v *Value) Native() unsafe.Pointer { - return unsafe.Pointer(v.native()) -} - -// ValueAlloc allocates a Value and sets a runtime finalizer to call -// g_value_unset() on the underlying GValue after leaving scope. -// ValueAlloc() returns a non-nil error if the allocation failed. -func ValueAlloc() (*Value, error) { - c := C._g_value_alloc() - if c == nil { - return nil, errNilPtr - } - - v := &Value{c} - - //An allocated GValue is not guaranteed to hold a value that can be unset - //We need to double check before unsetting, to prevent: - //`g_value_unset: assertion 'G_IS_VALUE (value)' failed` - runtime.SetFinalizer(v, func(f *Value) { - if t, _, err := f.Type(); err != nil || t == TYPE_INVALID || t == TYPE_NONE { - C.g_free(C.gpointer(f.native())) - return - } - - f.unset() - }) - - return v, nil -} - -// ValueInit is a wrapper around g_value_init() and allocates and -// initializes a new Value with the Type t. A runtime finalizer is set -// to call g_value_unset() on the underlying GValue after leaving scope. -// ValueInit() returns a non-nil error if the allocation failed. -func ValueInit(t Type) (*Value, error) { - c := C._g_value_init(C.GType(t)) - if c == nil { - return nil, errNilPtr - } - - v := &Value{c} - - runtime.SetFinalizer(v, (*Value).unset) - return v, nil -} - -// ValueFromNative returns a type-asserted pointer to the Value. -func ValueFromNative(l unsafe.Pointer) *Value { - //TODO why it does not add finalizer to the value? - return &Value{(*C.GValue)(l)} -} - -func (v *Value) unset() { - C.g_value_unset(v.native()) -} - -// Type is a wrapper around the G_VALUE_HOLDS_GTYPE() macro and -// the g_value_get_gtype() function. GetType() returns TYPE_INVALID if v -// does not hold a Type, or otherwise returns the Type of v. -func (v *Value) Type() (actual Type, fundamental Type, err error) { - if !gobool(C._g_is_value(v.native())) { - return actual, fundamental, errors.New("invalid GValue") - } - cActual := C._g_value_type(v.native()) - cFundamental := C._g_value_fundamental(cActual) - return Type(cActual), Type(cFundamental), nil -} - -// GValue converts a Go type to a comparable GValue. GValue() -// returns a non-nil error if the conversion was unsuccessful. -func GValue(v interface{}) (gvalue *Value, err error) { - if v == nil { - val, err := ValueInit(TYPE_POINTER) - if err != nil { - return nil, err - } - val.SetPointer(uintptr(unsafe.Pointer(nil))) - return val, nil - } - - switch e := v.(type) { - case bool: - val, err := ValueInit(TYPE_BOOLEAN) - if err != nil { - return nil, err - } - val.SetBool(e) - return val, nil - - case int8: - val, err := ValueInit(TYPE_CHAR) - if err != nil { - return nil, err - } - val.SetSChar(e) - return val, nil - - case int64: - val, err := ValueInit(TYPE_INT64) - if err != nil { - return nil, err - } - val.SetInt64(e) - return val, nil - - case int: - val, err := ValueInit(TYPE_INT) - if err != nil { - return nil, err - } - val.SetInt(e) - return val, nil - - case uint8: - val, err := ValueInit(TYPE_UCHAR) - if err != nil { - return nil, err - } - val.SetUChar(e) - return val, nil - - case uint64: - val, err := ValueInit(TYPE_UINT64) - if err != nil { - return nil, err - } - val.SetUInt64(e) - return val, nil - - case uint: - val, err := ValueInit(TYPE_UINT) - if err != nil { - return nil, err - } - val.SetUInt(e) - return val, nil - - case float32: - val, err := ValueInit(TYPE_FLOAT) - if err != nil { - return nil, err - } - val.SetFloat(e) - return val, nil - - case float64: - val, err := ValueInit(TYPE_DOUBLE) - if err != nil { - return nil, err - } - val.SetDouble(e) - return val, nil - - case string: - val, err := ValueInit(TYPE_STRING) - if err != nil { - return nil, err - } - val.SetString(e) - return val, nil - - case *Object: - val, err := ValueInit(TYPE_OBJECT) - if err != nil { - return nil, err - } - val.SetInstance(uintptr(unsafe.Pointer(e.GObject))) - return val, nil - - default: - /* Try this since above doesn't catch constants under other types */ - rval := reflect.ValueOf(v) - switch rval.Kind() { - case reflect.Int8: - val, err := ValueInit(TYPE_CHAR) - if err != nil { - return nil, err - } - val.SetSChar(int8(rval.Int())) - return val, nil - - case reflect.Int16: - return nil, errors.New("Type not implemented") - - case reflect.Int32: - return nil, errors.New("Type not implemented") - - case reflect.Int64: - val, err := ValueInit(TYPE_INT64) - if err != nil { - return nil, err - } - val.SetInt64(rval.Int()) - return val, nil - - case reflect.Int: - val, err := ValueInit(TYPE_INT) - if err != nil { - return nil, err - } - val.SetInt(int(rval.Int())) - return val, nil - - case reflect.Uintptr, reflect.Ptr: - val, err := ValueInit(TYPE_POINTER) - if err != nil { - return nil, err - } - val.SetPointer(rval.Pointer()) - return val, nil - } - } - - return nil, errors.New("Type not implemented") -} - -// GValueMarshaler is a marshal function to convert a GValue into an -// appropriate Go type. The uintptr parameter is a *C.GValue. -type GValueMarshaler func(uintptr) (interface{}, error) - -// TypeMarshaler represents an actual type and it's associated marshaler. -type TypeMarshaler struct { - T Type - F GValueMarshaler -} - -// RegisterGValueMarshalers adds marshalers for several types to the -// internal marshalers map. Once registered, calling GoValue on any -// Value witha registered type will return the data returned by the -// marshaler. -func RegisterGValueMarshalers(tm []TypeMarshaler) { - gValueMarshalers.register(tm) -} - -type marshalMap map[Type]GValueMarshaler - -// gValueMarshalers is a map of Glib types to functions to marshal a -// GValue to a native Go type. -var gValueMarshalers = marshalMap{ - TYPE_INVALID: marshalInvalid, - TYPE_NONE: marshalNone, - TYPE_INTERFACE: marshalInterface, - TYPE_CHAR: marshalChar, - TYPE_UCHAR: marshalUchar, - TYPE_BOOLEAN: marshalBoolean, - TYPE_INT: marshalInt, - TYPE_LONG: marshalLong, - TYPE_ENUM: marshalEnum, - TYPE_INT64: marshalInt64, - TYPE_UINT: marshalUint, - TYPE_ULONG: marshalUlong, - TYPE_FLAGS: marshalFlags, - TYPE_UINT64: marshalUint64, - TYPE_FLOAT: marshalFloat, - TYPE_DOUBLE: marshalDouble, - TYPE_STRING: marshalString, - TYPE_POINTER: marshalPointer, - TYPE_BOXED: marshalBoxed, - TYPE_OBJECT: marshalObject, - TYPE_VARIANT: marshalVariant, -} - -func (m marshalMap) register(tm []TypeMarshaler) { - for i := range tm { - m[tm[i].T] = tm[i].F - } -} - -func (m marshalMap) lookup(v *Value) (GValueMarshaler, error) { - actual, fundamental, err := v.Type() - if err != nil { - return nil, err - } - - if f, ok := m[actual]; ok { - return f, nil - } - if f, ok := m[fundamental]; ok { - return f, nil - } - return nil, errors.New("missing marshaler for type") -} - -func marshalInvalid(uintptr) (interface{}, error) { - return nil, errors.New("invalid type") -} - -func marshalNone(uintptr) (interface{}, error) { - return nil, nil -} - -func marshalInterface(uintptr) (interface{}, error) { - return nil, errors.New("interface conversion not yet implemented") -} - -func marshalChar(p uintptr) (interface{}, error) { - c := C.g_value_get_schar((*C.GValue)(unsafe.Pointer(p))) - return int8(c), nil -} - -func marshalUchar(p uintptr) (interface{}, error) { - c := C.g_value_get_uchar((*C.GValue)(unsafe.Pointer(p))) - return uint8(c), nil -} - -func marshalBoolean(p uintptr) (interface{}, error) { - c := C.g_value_get_boolean((*C.GValue)(unsafe.Pointer(p))) - return gobool(c), nil -} - -func marshalInt(p uintptr) (interface{}, error) { - c := C.g_value_get_int((*C.GValue)(unsafe.Pointer(p))) - return int(c), nil -} - -func marshalLong(p uintptr) (interface{}, error) { - c := C.g_value_get_long((*C.GValue)(unsafe.Pointer(p))) - return int(c), nil -} - -func marshalEnum(p uintptr) (interface{}, error) { - c := C.g_value_get_enum((*C.GValue)(unsafe.Pointer(p))) - return int(c), nil -} - -func marshalInt64(p uintptr) (interface{}, error) { - c := C.g_value_get_int64((*C.GValue)(unsafe.Pointer(p))) - return int64(c), nil -} - -func marshalUint(p uintptr) (interface{}, error) { - c := C.g_value_get_uint((*C.GValue)(unsafe.Pointer(p))) - return uint(c), nil -} - -func marshalUlong(p uintptr) (interface{}, error) { - c := C.g_value_get_ulong((*C.GValue)(unsafe.Pointer(p))) - return uint(c), nil -} - -func marshalFlags(p uintptr) (interface{}, error) { - c := C.g_value_get_flags((*C.GValue)(unsafe.Pointer(p))) - return uint(c), nil -} - -func marshalUint64(p uintptr) (interface{}, error) { - c := C.g_value_get_uint64((*C.GValue)(unsafe.Pointer(p))) - return uint64(c), nil -} - -func marshalFloat(p uintptr) (interface{}, error) { - c := C.g_value_get_float((*C.GValue)(unsafe.Pointer(p))) - return float32(c), nil -} - -func marshalDouble(p uintptr) (interface{}, error) { - c := C.g_value_get_double((*C.GValue)(unsafe.Pointer(p))) - return float64(c), nil -} - -func marshalString(p uintptr) (interface{}, error) { - c := C.g_value_get_string((*C.GValue)(unsafe.Pointer(p))) - return C.GoString((*C.char)(c)), nil -} - -func marshalBoxed(p uintptr) (interface{}, error) { - c := C.g_value_get_boxed((*C.GValue)(unsafe.Pointer(p))) - return uintptr(unsafe.Pointer(c)), nil -} - -func marshalPointer(p uintptr) (interface{}, error) { - c := C.g_value_get_pointer((*C.GValue)(unsafe.Pointer(p))) - return unsafe.Pointer(c), nil -} - -func marshalObject(p uintptr) (interface{}, error) { - c := C.g_value_get_object((*C.GValue)(unsafe.Pointer(p))) - return newObject((*C.GObject)(c)), nil -} - -func marshalVariant(p uintptr) (interface{}, error) { - return nil, errors.New("variant conversion not yet implemented") -} - -// GoValue converts a Value to comparable Go type. GoValue() -// returns a non-nil error if the conversion was unsuccessful. The -// returned interface{} must be type asserted as the actual Go -// representation of the Value. -// -// This function is a wrapper around the many g_value_get_*() -// functions, depending on the type of the Value. -func (v *Value) GoValue() (interface{}, error) { - f, err := gValueMarshalers.lookup(v) - if err != nil { - return nil, err - } - - //No need to add finalizer because it is already done by ValueAlloc and ValueInit - rv, err := f(uintptr(unsafe.Pointer(v.native()))) - return rv, err -} - -// SetBool is a wrapper around g_value_set_boolean(). -func (v *Value) SetBool(val bool) { - C.g_value_set_boolean(v.native(), gbool(val)) -} - -// SetSChar is a wrapper around g_value_set_schar(). -func (v *Value) SetSChar(val int8) { - C.g_value_set_schar(v.native(), C.gint8(val)) -} - -// SetInt64 is a wrapper around g_value_set_int64(). -func (v *Value) SetInt64(val int64) { - C.g_value_set_int64(v.native(), C.gint64(val)) -} - -// SetInt is a wrapper around g_value_set_int(). -func (v *Value) SetInt(val int) { - C.g_value_set_int(v.native(), C.gint(val)) -} - -// SetUChar is a wrapper around g_value_set_uchar(). -func (v *Value) SetUChar(val uint8) { - C.g_value_set_uchar(v.native(), C.guchar(val)) -} - -// SetUInt64 is a wrapper around g_value_set_uint64(). -func (v *Value) SetUInt64(val uint64) { - C.g_value_set_uint64(v.native(), C.guint64(val)) -} - -// SetUInt is a wrapper around g_value_set_uint(). -func (v *Value) SetUInt(val uint) { - C.g_value_set_uint(v.native(), C.guint(val)) -} - -// SetFloat is a wrapper around g_value_set_float(). -func (v *Value) SetFloat(val float32) { - C.g_value_set_float(v.native(), C.gfloat(val)) -} - -// SetDouble is a wrapper around g_value_set_double(). -func (v *Value) SetDouble(val float64) { - C.g_value_set_double(v.native(), C.gdouble(val)) -} - -// SetString is a wrapper around g_value_set_string(). -func (v *Value) SetString(val string) { - cstr := C.CString(val) - defer C.free(unsafe.Pointer(cstr)) - C.g_value_set_string(v.native(), (*C.gchar)(cstr)) -} - -// SetInstance is a wrapper around g_value_set_instance(). -func (v *Value) SetInstance(instance uintptr) { - C.g_value_set_instance(v.native(), C.gpointer(instance)) -} - -// SetPointer is a wrapper around g_value_set_pointer(). -func (v *Value) SetPointer(p uintptr) { - C.g_value_set_pointer(v.native(), C.gpointer(p)) -} - -// GetPointer is a wrapper around g_value_get_pointer(). -func (v *Value) GetPointer() unsafe.Pointer { - return unsafe.Pointer(C.g_value_get_pointer(v.native())) -} - -// GetString is a wrapper around g_value_get_string(). GetString() -// returns a non-nil error if g_value_get_string() returned a NULL -// pointer to distinguish between returning a NULL pointer and returning -// an empty string. -func (v *Value) GetString() (string, error) { - c := C.g_value_get_string(v.native()) - if c == nil { - return "", errNilPtr - } - return C.GoString((*C.char)(c)), nil -} - -type Signal struct { - name string - signalId C.guint -} - -func SignalNew(s string) (*Signal, error) { - cstr := C.CString(s) - defer C.free(unsafe.Pointer(cstr)) - - signalId := C._g_signal_new((*C.gchar)(cstr)) - - if signalId == 0 { - return nil, fmt.Errorf("invalid signal name: %s", s) - } - - return &Signal{ - name: s, - signalId: signalId, - }, nil -} - -func (s *Signal) String() string { - return s.name -} - -type Quark uint32 - -// GetApplicationName is a wrapper around g_get_application_name(). -func GetApplicationName() string { - c := C.g_get_application_name() - - return C.GoString((*C.char)(c)) -} - -// SetApplicationName is a wrapper around g_set_application_name(). -func SetApplicationName(name string) { - cstr := (*C.gchar)(C.CString(name)) - defer C.free(unsafe.Pointer(cstr)) - - C.g_set_application_name(cstr) -} - -// InitI18n initializes the i18n subsystem. -func InitI18n(domain string, dir string) { - domainStr := C.CString(domain) - defer C.free(unsafe.Pointer(domainStr)) - - dirStr := C.CString(dir) - defer C.free(unsafe.Pointer(dirStr)) - - C.init_i18n(domainStr, dirStr) -} - -// Local localizes a string using gettext -func Local(input string) string { - cstr := C.CString(input) - defer C.free(unsafe.Pointer(cstr)) - - return C.GoString(C.localize(cstr)) -} diff --git a/vendor/github.com/gotk3/gotk3/glib/glib.go.h b/vendor/github.com/gotk3/gotk3/glib/glib.go.h deleted file mode 100644 index 55a324b..0000000 --- a/vendor/github.com/gotk3/gotk3/glib/glib.go.h +++ /dev/null @@ -1,259 +0,0 @@ -/* - * Copyright (c) 2013-2014 Conformal Systems <info@conformal.com> - * - * This file originated from: http://opensource.conformal.com/ - * - * Permission to use, copy, modify, and distribute this software for any - * purpose with or without fee is hereby granted, provided that the above - * copyright notice and this permission notice appear in all copies. - * - * THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES - * WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF - * MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR - * ANY SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES - * WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN - * ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF - * OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE. - */ - -#ifndef __GLIB_GO_H__ -#define __GLIB_GO_H__ - -#include <stdint.h> -#include <stdlib.h> -#include <stdio.h> - -#include <gio/gio.h> -#define G_SETTINGS_ENABLE_BACKEND -#include <gio/gsettingsbackend.h> -#include <glib.h> -#include <glib-object.h> -#include <glib/gi18n.h> -#include <locale.h> - -/* GObject Type Casting */ -static GObject * -toGObject(void *p) -{ - return (G_OBJECT(p)); -} - -static GAction * -toGAction(void *p) -{ - return (G_ACTION(p)); -} - -static GActionGroup * -toGActionGroup(void *p) -{ - return (G_ACTION_GROUP(p)); -} - -static GActionMap * -toGActionMap(void *p) -{ - return (G_ACTION_MAP(p)); -} - -static GSimpleAction * -toGSimpleAction(void *p) -{ - return (G_SIMPLE_ACTION(p)); -} - -static GSimpleActionGroup * -toGSimpleActionGroup(void *p) -{ - return (G_SIMPLE_ACTION_GROUP(p)); -} - -static GPropertyAction * -toGPropertyAction(void *p) -{ - return (G_PROPERTY_ACTION(p)); -} - -static GMenuModel * -toGMenuModel(void *p) -{ - return (G_MENU_MODEL(p)); -} - -static GMenu * -toGMenu(void *p) -{ - return (G_MENU(p)); -} - -static GMenuItem * -toGMenuItem(void *p) -{ - return (G_MENU_ITEM(p)); -} - -static GNotification * -toGNotification(void *p) -{ - return (G_NOTIFICATION(p)); -} - -static GApplication * -toGApplication(void *p) -{ - return (G_APPLICATION(p)); -} - -static GSettings * -toGSettings(void *p) -{ - return (G_SETTINGS(p)); -} - -static GSettingsBackend * -toGSettingsBackend(void *p) -{ - return (G_SETTINGS_BACKEND(p)); -} - -static GBinding* -toGBinding(void *p) -{ - return (G_BINDING(p)); -} - -static GType -_g_type_from_instance(gpointer instance) -{ - return (G_TYPE_FROM_INSTANCE(instance)); -} - -/* Wrapper to avoid variable arg list */ -static void -_g_object_set_one(gpointer object, const gchar *property_name, void *val) -{ - g_object_set(object, property_name, *(gpointer **)val, NULL); -} - -static GValue * -alloc_gvalue_list(int n) -{ - GValue *valv; - - valv = g_new0(GValue, n); - return (valv); -} - -static void -val_list_insert(GValue *valv, int i, GValue *val) -{ - valv[i] = *val; -} - -/* - * GValue - */ - -static GValue * -_g_value_alloc() -{ - return (g_new0(GValue, 1)); -} - -static GValue * -_g_value_init(GType g_type) -{ - GValue *value; - - value = g_new0(GValue, 1); - return (g_value_init(value, g_type)); -} - -static gboolean -_g_is_value(GValue *val) -{ - return (G_IS_VALUE(val)); -} - -static GType -_g_value_type(GValue *val) -{ - return (G_VALUE_TYPE(val)); -} - -static GType -_g_value_fundamental(GType type) -{ - return (G_TYPE_FUNDAMENTAL(type)); -} - -static GObjectClass * -_g_object_get_class (GObject *object) -{ - return (G_OBJECT_GET_CLASS(object)); -} - -/* - * Closure support - */ - -extern void goMarshal(GClosure *, GValue *, guint, GValue *, gpointer, GValue *); - -static GClosure * -_g_closure_new() -{ - GClosure *closure; - - closure = g_closure_new_simple(sizeof(GClosure), NULL); - g_closure_set_marshal(closure, (GClosureMarshal)(goMarshal)); - return (closure); -} - -extern void removeClosure(gpointer, GClosure *); - -static void -_g_closure_add_finalize_notifier(GClosure *closure) -{ - g_closure_add_finalize_notifier(closure, NULL, removeClosure); -} - -static inline guint _g_signal_new(const gchar *name) { - return g_signal_new(name, - G_TYPE_OBJECT, - G_SIGNAL_RUN_FIRST | G_SIGNAL_ACTION, - 0, NULL, NULL, - g_cclosure_marshal_VOID__POINTER, - G_TYPE_NONE, - 0); -} - -static void init_i18n(const char *domain, const char *dir) { - setlocale(LC_ALL, ""); - bindtextdomain(domain, dir); - bind_textdomain_codeset(domain, "UTF-8"); - textdomain(domain); -} - -static const char* localize(const char *string) { - return _(string); -} - -static inline char** make_strings(int count) { - return (char**)malloc(sizeof(char*) * count); -} - -static inline void destroy_strings(char** strings) { - free(strings); -} - -static inline char* get_string(char** strings, int n) { - return strings[n]; -} - -static inline void set_string(char** strings, int n, char* str) { - strings[n] = str; -} - -static inline gchar** next_gcharptr(gchar** s) { return (s+1); } - -#endif diff --git a/vendor/github.com/gotk3/gotk3/glib/glib_extension.go b/vendor/github.com/gotk3/gotk3/glib/glib_extension.go deleted file mode 100644 index f96286a..0000000 --- a/vendor/github.com/gotk3/gotk3/glib/glib_extension.go +++ /dev/null @@ -1,18 +0,0 @@ -//glib_extension contains definitions and functions to interface between glib/gtk/gio and go universe - -package glib - -import ( - "reflect" -) - -// Should be implemented by any class which need special conversion like -// gtk.Application -> gio.Application -type IGlibConvert interface { - // If conversion can't be done, the function has to panic with a message that it can't convert to type - Convert(reflect.Type) reflect.Value -} - -var ( - IGlibConvertType reflect.Type -) diff --git a/vendor/github.com/gotk3/gotk3/glib/glib_test.go b/vendor/github.com/gotk3/gotk3/glib/glib_test.go deleted file mode 100644 index 14344a4..0000000 --- a/vendor/github.com/gotk3/gotk3/glib/glib_test.go +++ /dev/null @@ -1,58 +0,0 @@ -package glib_test - -import ( - "runtime" - "testing" - - "github.com/gotk3/gotk3/glib" - "github.com/gotk3/gotk3/gtk" -) - -func init() { - gtk.Init(nil) -} - -// TestConnectNotifySignal ensures that property notification signals (those -// whose name begins with "notify::") are queried by the name "notify" (with the -// "::" and the property name omitted). This is because the signal is "notify" -// and the characters after the "::" are not recognized by the signal system. -// -// See -// https://developer.gnome.org/gobject/stable/gobject-The-Base-Object-Type.html#GObject-notify -// for background, and -// https://developer.gnome.org/gobject/stable/gobject-Signals.html#g-signal-new -// for the specification of valid signal names. -func TestConnectNotifySignal(t *testing.T) { - runtime.LockOSThread() - - // Create any GObject that has defined properties. - spacing := 0 - box, _ := gtk.BoxNew(gtk.ORIENTATION_HORIZONTAL, spacing) - - // Connect to a "notify::" signal to listen on property changes. - box.Connect("notify::spacing", func() { - gtk.MainQuit() - }) - - glib.IdleAdd(func(s string) bool { - t.Log(s) - spacing++ - box.SetSpacing(spacing) - return true - }, "IdleAdd executed") - - gtk.Main() -} - -/*At this moment Visionect specific*/ -func TestTimeoutAdd(t *testing.T) { - runtime.LockOSThread() - - glib.TimeoutAdd(2500, func(s string) bool { - t.Log(s) - gtk.MainQuit() - return false - }, "TimeoutAdd executed") - - gtk.Main() -} diff --git a/vendor/github.com/gotk3/gotk3/glib/gmain_context.go b/vendor/github.com/gotk3/gotk3/glib/gmain_context.go deleted file mode 100644 index 86ffd89..0000000 --- a/vendor/github.com/gotk3/gotk3/glib/gmain_context.go +++ /dev/null @@ -1,31 +0,0 @@ -package glib - -// #include <gio/gio.h> -// #include <glib.h> -// #include <glib-object.h> -// #include "glib.go.h" -import "C" - -type MainContext C.GMainContext - -// native returns a pointer to the underlying GMainContext. -func (v *MainContext) native() *C.GMainContext { - if v == nil { - return nil - } - return (*C.GMainContext)(v) -} - -// MainContextDefault is a wrapper around g_main_context_default(). -func MainContextDefault() *MainContext { - c := C.g_main_context_default() - if c == nil { - return nil - } - return (*MainContext)(c) -} - -// MainDepth is a wrapper around g_main_depth(). -func MainDepth() int { - return int(C.g_main_depth()) -} diff --git a/vendor/github.com/gotk3/gotk3/glib/gsimpleactiongroup.go b/vendor/github.com/gotk3/gotk3/glib/gsimpleactiongroup.go deleted file mode 100644 index f96936e..0000000 --- a/vendor/github.com/gotk3/gotk3/glib/gsimpleactiongroup.go +++ /dev/null @@ -1,58 +0,0 @@ -package glib - -// #include <gio/gio.h> -// #include <glib.h> -// #include <glib-object.h> -// #include "glib.go.h" -import "C" -import ( - "unsafe" -) - -// SimpleActionGroup is a representation of glib's GSimpleActionGroup -type SimpleActionGroup struct { - *Object - - // Interfaces - IActionMap - IActionGroup -} - -// deprecated since 2.38: -// g_simple_action_group_lookup() -// g_simple_action_group_insert() -// g_simple_action_group_remove() -// g_simple_action_group_add_entries() -// -> See implementations in ActionMap - -// native() returns a pointer to the underlying GSimpleActionGroup. -func (v *SimpleActionGroup) native() *C.GSimpleActionGroup { - if v == nil || v.GObject == nil { - return nil - } - return C.toGSimpleActionGroup(unsafe.Pointer(v.GObject)) -} - -func (v *SimpleActionGroup) Native() uintptr { - return uintptr(unsafe.Pointer(v.native())) -} - -func marshalSimpleActionGroup(p uintptr) (interface{}, error) { - c := C.g_value_get_object((*C.GValue)(unsafe.Pointer(p))) - return wrapSimpleActionGroup(wrapObject(unsafe.Pointer(c))), nil -} - -func wrapSimpleActionGroup(obj *Object) *SimpleActionGroup { - am := wrapActionMap(obj) - ag := wrapActionGroup(obj) - return &SimpleActionGroup{obj, am, ag} -} - -// SimpleActionGroupNew is a wrapper around g_simple_action_group_new -func SimpleActionGroupNew() *SimpleActionGroup { - c := C.g_simple_action_group_new() - if c == nil { - return nil - } - return wrapSimpleActionGroup(wrapObject(unsafe.Pointer(c))) -} diff --git a/vendor/github.com/gotk3/gotk3/glib/gsimpleactiongroup_test.go b/vendor/github.com/gotk3/gotk3/glib/gsimpleactiongroup_test.go deleted file mode 100644 index 0982bc6..0000000 --- a/vendor/github.com/gotk3/gotk3/glib/gsimpleactiongroup_test.go +++ /dev/null @@ -1,70 +0,0 @@ -package glib - -import ( - "testing" -) - -func TestSimpleActionGroupNew(t *testing.T) { - sag := SimpleActionGroupNew() - if sag == nil { - t.Error("SimpleActionGroupNew returned nil") - } - - if sag.IActionGroup == nil { - t.Error("Embedded IActionGroup is nil") - } - if sag.IActionMap == nil { - t.Error("Embedded IActionGroup is nil") - } -} - -func TestSimpleActionGroup_AddAction_RemoveAction_HasAction(t *testing.T) { - sag := SimpleActionGroupNew() - if sag == nil { - t.Error("SimpleActionGroup returned nil") - } - - // Check before: empty - hasAction := sag.HasAction("nope") - if hasAction { - t.Error("Action group contained unexpected action 'nope'") - } - hasAction = sag.HasAction("yepp") - if hasAction { - t.Error("Action group contained unexpected action 'yepp'") - } - - // Add a new action - act := SimpleActionNew("yepp", nil) - if act == nil { - t.Error("SimpleActionNew returned nil") - } - sag.AddAction(act) - - // Check that it exists - hasAction = sag.HasAction("nope") - if hasAction { - t.Error("Action group contained unexpected action 'nope'") - } - hasAction = sag.HasAction("yepp") - if !hasAction { - t.Error("Action group did not contain action 'yepp' after adding it") - } - - // Remove the action again - sag.RemoveAction("yepp") - - // Check that it was removed - hasAction = sag.HasAction("nope") - if hasAction { - t.Error("Action group contained unexpected action 'nope'") - } - hasAction = sag.HasAction("yepp") - if hasAction { - t.Error("Action group contained unexpected action 'yepp'") - } - - // NoFail check: removing a non-existing action - sag.RemoveAction("yepp") - sag.RemoveAction("nope") -} diff --git a/vendor/github.com/gotk3/gotk3/glib/gsource.go b/vendor/github.com/gotk3/gotk3/glib/gsource.go deleted file mode 100644 index f11e711..0000000 --- a/vendor/github.com/gotk3/gotk3/glib/gsource.go +++ /dev/null @@ -1,26 +0,0 @@ -package glib - -// #include <gio/gio.h> -// #include <glib.h> -// #include <glib-object.h> -// #include "glib.go.h" -import "C" - -type Source C.GSource - -// native returns a pointer to the underlying GSource. -func (v *Source) native() *C.GSource { - if v == nil { - return nil - } - return (*C.GSource)(v) -} - -// MainCurrentSource is a wrapper around g_main_current_source(). -func MainCurrentSource() *Source { - c := C.g_main_current_source() - if c == nil { - return nil - } - return (*Source)(c) -} diff --git a/vendor/github.com/gotk3/gotk3/glib/gvariant.go b/vendor/github.com/gotk3/gotk3/glib/gvariant.go deleted file mode 100644 index 39e175d..0000000 --- a/vendor/github.com/gotk3/gotk3/glib/gvariant.go +++ /dev/null @@ -1,284 +0,0 @@ -//GVariant : GVariant — strongly typed value datatype -// https://developer.gnome.org/glib/2.26/glib-GVariant.html - -package glib - -// #include "gvariant.go.h" -// #include "glib.go.h" -import "C" - -import ( - "fmt" - "unsafe" -) - -/* - * GVariant - */ - -// IVariant is an interface type implemented by Variant and all types which embed -// an Variant. It is meant to be used as a type for function arguments which -// require GVariants or any subclasses thereof. -type IVariant interface { - ToGVariant() *C.GVariant - ToVariant() *Variant -} - -// A Variant is a representation of GLib's GVariant. -type Variant struct { - GVariant *C.GVariant -} - -// ToGVariant exposes the underlying *C.GVariant type for this Variant, -// necessary to implement IVariant. -func (v *Variant) ToGVariant() *C.GVariant { - if v == nil { - return nil - } - return v.native() -} - -// ToVariant returns this Variant, necessary to implement IVariant. -func (v *Variant) ToVariant() *Variant { - return v -} - -// newVariant creates a new Variant from a GVariant pointer. -func newVariant(p *C.GVariant) *Variant { - return &Variant{GVariant: p} -} - -// VariantFromUnsafePointer returns a Variant from an unsafe pointer. -// XXX: unnecessary footgun? -//func VariantFromUnsafePointer(p unsafe.Pointer) *Variant { -// return &Variant{C.toGVariant(p)} -//} - -// native returns a pointer to the underlying GVariant. -func (v *Variant) native() *C.GVariant { - if v == nil || v.GVariant == nil { - return nil - } - return v.GVariant -} - -// Native returns a pointer to the underlying GVariant. -func (v *Variant) Native() uintptr { - return uintptr(unsafe.Pointer(v.native())) -} - -// TypeString returns the g variant type string for this variant. -func (v *Variant) TypeString() string { - // the string returned from this belongs to GVariant and must not be freed. - return C.GoString((*C.char)(C.g_variant_get_type_string(v.native()))) -} - -// IsContainer returns true if the variant is a container and false otherwise. -func (v *Variant) IsContainer() bool { - return gobool(C.g_variant_is_container(v.native())) -} - -// IsFloating returns true if the variant has a floating reference count. -// XXX: this isn't useful without ref_sink/take_ref, which are themselves -// perhaps not useful for most Go code that may use variants. -//func (v *Variant) IsFloating() bool { -// return gobool(C.g_variant_is_floating(v.native())) -//} - -// GetBoolean returns the bool value of this variant. -func (v *Variant) GetBoolean() bool { - return gobool(C.g_variant_get_boolean(v.native())) -} - -// GetString returns the string value of the variant. -func (v *Variant) GetString() string { - var len C.gsize - gc := C.g_variant_get_string(v.native(), &len) - defer C.g_free(C.gpointer(gc)) - return C.GoStringN((*C.char)(gc), (C.int)(len)) -} - -// GetStrv returns a slice of strings from this variant. It wraps -// g_variant_get_strv, but returns copies of the strings instead. -func (v *Variant) GetStrv() []string { - gstrv := C.g_variant_get_strv(v.native(), nil) - // we do not own the memory for these strings, so we must not use strfreev - // but we must free the actual pointer we receive. - c := gstrv - defer C.g_free(C.gpointer(gstrv)) - var strs []string - - for *c != nil { - strs = append(strs, C.GoString((*C.char)(*c))) - c = C.next_gcharptr(c) - } - return strs -} - -// GetInt returns the int64 value of the variant if it is an integer type, and -// an error otherwise. It wraps variouns `g_variant_get_*` functions dealing -// with integers of different sizes. -func (v *Variant) GetInt() (int64, error) { - t := v.Type().String() - var i int64 - switch t { - case "y": - i = int64(C.g_variant_get_byte(v.native())) - case "n": - i = int64(C.g_variant_get_int16(v.native())) - case "q": - i = int64(C.g_variant_get_uint16(v.native())) - case "i": - i = int64(C.g_variant_get_int32(v.native())) - case "u": - i = int64(C.g_variant_get_uint32(v.native())) - case "x": - i = int64(C.g_variant_get_int64(v.native())) - case "t": - i = int64(C.g_variant_get_uint64(v.native())) - default: - return 0, fmt.Errorf("variant type %s not an integer type", t) - } - return i, nil -} - -// Type returns the VariantType for this variant. -func (v *Variant) Type() *VariantType { - return newVariantType(C.g_variant_get_type(v.native())) -} - -// IsType returns true if the variant's type matches t. -func (v *Variant) IsType(t *VariantType) bool { - return gobool(C.g_variant_is_of_type(v.native(), t.native())) -} - -// String wraps g_variant_print(). It returns a string understood -// by g_variant_parse(). -func (v *Variant) String() string { - gc := C.g_variant_print(v.native(), gbool(false)) - defer C.g_free(C.gpointer(gc)) - return C.GoString((*C.char)(gc)) -} - -// AnnotatedString wraps g_variant_print(), but returns a type-annotated -// string. -func (v *Variant) AnnotatedString() string { - gc := C.g_variant_print(v.native(), gbool(true)) - defer C.g_free(C.gpointer(gc)) - return C.GoString((*C.char)(gc)) -} - -//void g_variant_unref () -//GVariant * g_variant_ref () -//GVariant * g_variant_ref_sink () -//GVariant * g_variant_take_ref () -//gint g_variant_compare () -//GVariantClass g_variant_classify () -//gboolean g_variant_check_format_string () -//void g_variant_get () -//void g_variant_get_va () -//GVariant * g_variant_new () -//GVariant * g_variant_new_va () -//GVariant * g_variant_new_boolean () -//GVariant * g_variant_new_byte () -//GVariant * g_variant_new_int16 () -//GVariant * g_variant_new_uint16 () -//GVariant * g_variant_new_int32 () -//GVariant * g_variant_new_uint32 () -//GVariant * g_variant_new_int64 () -//GVariant * g_variant_new_uint64 () -//GVariant * g_variant_new_handle () -//GVariant * g_variant_new_double () -//GVariant * g_variant_new_string () -//GVariant * g_variant_new_take_string () -//GVariant * g_variant_new_printf () -//GVariant * g_variant_new_object_path () -//gboolean g_variant_is_object_path () -//GVariant * g_variant_new_signature () -//gboolean g_variant_is_signature () -//GVariant * g_variant_new_variant () -//GVariant * g_variant_new_strv () -//GVariant * g_variant_new_objv () -//GVariant * g_variant_new_bytestring () -//GVariant * g_variant_new_bytestring_array () -//guchar g_variant_get_byte () -//gint16 g_variant_get_int16 () -//guint16 g_variant_get_uint16 () -//gint32 g_variant_get_int32 () -//guint32 g_variant_get_uint32 () -//gint64 g_variant_get_int64 () -//guint64 g_variant_get_uint64 () -//gint32 g_variant_get_handle () -//gdouble g_variant_get_double () -//const gchar * g_variant_get_string () -//gchar * g_variant_dup_string () -//GVariant * g_variant_get_variant () -//const gchar ** g_variant_get_strv () -//gchar ** g_variant_dup_strv () -//const gchar ** g_variant_get_objv () -//gchar ** g_variant_dup_objv () -//const gchar * g_variant_get_bytestring () -//gchar * g_variant_dup_bytestring () -//const gchar ** g_variant_get_bytestring_array () -//gchar ** g_variant_dup_bytestring_array () -//GVariant * g_variant_new_maybe () -//GVariant * g_variant_new_array () -//GVariant * g_variant_new_tuple () -//GVariant * g_variant_new_dict_entry () -//GVariant * g_variant_new_fixed_array () -//GVariant * g_variant_get_maybe () -//gsize g_variant_n_children () -//GVariant * g_variant_get_child_value () -//void g_variant_get_child () -//GVariant * g_variant_lookup_value () -//gboolean g_variant_lookup () -//gconstpointer g_variant_get_fixed_array () -//gsize g_variant_get_size () -//gconstpointer g_variant_get_data () -//GBytes * g_variant_get_data_as_bytes () -//void g_variant_store () -//GVariant * g_variant_new_from_data () -//GVariant * g_variant_new_from_bytes () -//GVariant * g_variant_byteswap () -//GVariant * g_variant_get_normal_form () -//gboolean g_variant_is_normal_form () -//guint g_variant_hash () -//gboolean g_variant_equal () -//gchar * g_variant_print () -//GString * g_variant_print_string () -//GVariantIter * g_variant_iter_copy () -//void g_variant_iter_free () -//gsize g_variant_iter_init () -//gsize g_variant_iter_n_children () -//GVariantIter * g_variant_iter_new () -//GVariant * g_variant_iter_next_value () -//gboolean g_variant_iter_next () -//gboolean g_variant_iter_loop () -//void g_variant_builder_unref () -//GVariantBuilder * g_variant_builder_ref () -//GVariantBuilder * g_variant_builder_new () -//void g_variant_builder_init () -//void g_variant_builder_clear () -//void g_variant_builder_add_value () -//void g_variant_builder_add () -//void g_variant_builder_add_parsed () -//GVariant * g_variant_builder_end () -//void g_variant_builder_open () -//void g_variant_builder_close () -//void g_variant_dict_unref () -//GVariantDict * g_variant_dict_ref () -//GVariantDict * g_variant_dict_new () -//void g_variant_dict_init () -//void g_variant_dict_clear () -//gboolean g_variant_dict_contains () -//gboolean g_variant_dict_lookup () -//GVariant * g_variant_dict_lookup_value () -//void g_variant_dict_insert () -//void g_variant_dict_insert_value () -//gboolean g_variant_dict_remove () -//GVariant * g_variant_dict_end () -//#define G_VARIANT_PARSE_ERROR -//GVariant * g_variant_parse () -//GVariant * g_variant_new_parsed_va () -//GVariant * g_variant_new_parsed () -//gchar * g_variant_parse_error_print_context () diff --git a/vendor/github.com/gotk3/gotk3/glib/gvariant.go.h b/vendor/github.com/gotk3/gotk3/glib/gvariant.go.h deleted file mode 100644 index 01d732e..0000000 --- a/vendor/github.com/gotk3/gotk3/glib/gvariant.go.h +++ /dev/null @@ -1,40 +0,0 @@ -// Same copyright and license as the rest of the files in this project - -//GVariant : GVariant — strongly typed value datatype -// https://developer.gnome.org/glib/2.26/glib-GVariant.html - -#ifndef __GVARIANT_GO_H__ -#define __GVARIANT_GO_H__ - -#include <stdint.h> -#include <stdlib.h> -#include <stdio.h> -#include <glib.h> - -// Type Casting - -static GVariant * -toGVariant(void *p) -{ - return (GVariant*)p; -} - -static GVariantBuilder * -toGVariantBuilder(void *p) -{ - return (GVariantBuilder*)p; -} - -static GVariantDict * -toGVariantDict(void *p) -{ - return (GVariantDict*)p; -} - -static GVariantIter * -toGVariantIter(void *p) -{ - return (GVariantIter*)p; -} - -#endif diff --git a/vendor/github.com/gotk3/gotk3/glib/gvariant_test.go b/vendor/github.com/gotk3/gotk3/glib/gvariant_test.go deleted file mode 100644 index 796b662..0000000 --- a/vendor/github.com/gotk3/gotk3/glib/gvariant_test.go +++ /dev/null @@ -1,14 +0,0 @@ -// Same copyright and license as the rest of the files in this project - -package glib_test - -import ( - "testing" -) - -func Test_AcceleratorParse(t *testing.T) { - /* - testVariant := &Variant{} - t.Log("native: " + testVariant.Native()) - */ -} diff --git a/vendor/github.com/gotk3/gotk3/glib/gvariantbuilder.go b/vendor/github.com/gotk3/gotk3/glib/gvariantbuilder.go deleted file mode 100644 index c18e787..0000000 --- a/vendor/github.com/gotk3/gotk3/glib/gvariantbuilder.go +++ /dev/null @@ -1,52 +0,0 @@ -// Same copyright and license as the rest of the files in this project - -// GVariant : GVariant — strongly typed value datatype -// https://developer.gnome.org/glib/2.26/glib-GVariant.html - -package glib - -// #include <glib.h> -// #include <glib-object.h> -// #include "glib.go.h" -// #include "gvariant.go.h" -import "C" -import "unsafe" - -/* - * GVariantBuilder - */ - -// VariantBuilder is a representation of GLib's VariantBuilder. -type VariantBuilder struct { - GVariantBuilder *C.GVariantBuilder -} - -func (v *VariantBuilder) toGVariantBuilder() *C.GVariantBuilder { - if v == nil { - return nil - } - return v.native() -} - -func (v *VariantBuilder) toVariantBuilder() *VariantBuilder { - return v -} - -// newVariantBuilder creates a new VariantBuilder from a GVariantBuilder pointer. -func newVariantBuilder(p *C.GVariantBuilder) *VariantBuilder { - return &VariantBuilder{GVariantBuilder: p} -} - -// native returns a pointer to the underlying GVariantBuilder. -func (v *VariantBuilder) native() *C.GVariantBuilder { - if v == nil || v.GVariantBuilder == nil { - return nil - } - p := unsafe.Pointer(v.GVariantBuilder) - return C.toGVariantBuilder(p) -} - -// Native returns a pointer to the underlying GVariantBuilder. -func (v *VariantBuilder) Native() uintptr { - return uintptr(unsafe.Pointer(v.native())) -} diff --git a/vendor/github.com/gotk3/gotk3/glib/gvariantclass.go b/vendor/github.com/gotk3/gotk3/glib/gvariantclass.go deleted file mode 100644 index aea0618..0000000 --- a/vendor/github.com/gotk3/gotk3/glib/gvariantclass.go +++ /dev/null @@ -1,39 +0,0 @@ -// Same copyright and license as the rest of the files in this project - -//GVariant : GVariant — strongly typed value datatype -// https://developer.gnome.org/glib/2.26/glib-GVariant.html - -package glib - -// #include <glib.h> -// #include <glib-object.h> -// #include "glib.go.h" -// #include "gvariant.go.h" -import "C" - -/* - * GVariantClass - */ - -type VariantClass int - -const ( - VARIANT_CLASS_BOOLEAN VariantClass = C.G_VARIANT_CLASS_BOOLEAN //The GVariant is a boolean. - VARIANT_CLASS_BYTE VariantClass = C.G_VARIANT_CLASS_BYTE //The GVariant is a byte. - VARIANT_CLASS_INT16 VariantClass = C.G_VARIANT_CLASS_INT16 //The GVariant is a signed 16 bit integer. - VARIANT_CLASS_UINT16 VariantClass = C.G_VARIANT_CLASS_UINT16 //The GVariant is an unsigned 16 bit integer. - VARIANT_CLASS_INT32 VariantClass = C.G_VARIANT_CLASS_INT32 //The GVariant is a signed 32 bit integer. - VARIANT_CLASS_UINT32 VariantClass = C.G_VARIANT_CLASS_UINT32 //The GVariant is an unsigned 32 bit integer. - VARIANT_CLASS_INT64 VariantClass = C.G_VARIANT_CLASS_INT64 //The GVariant is a signed 64 bit integer. - VARIANT_CLASS_UINT64 VariantClass = C.G_VARIANT_CLASS_UINT64 //The GVariant is an unsigned 64 bit integer. - VARIANT_CLASS_HANDLE VariantClass = C.G_VARIANT_CLASS_HANDLE //The GVariant is a file handle index. - VARIANT_CLASS_DOUBLE VariantClass = C.G_VARIANT_CLASS_DOUBLE //The GVariant is a double precision floating point value. - VARIANT_CLASS_STRING VariantClass = C.G_VARIANT_CLASS_STRING //The GVariant is a normal string. - VARIANT_CLASS_OBJECT_PATH VariantClass = C.G_VARIANT_CLASS_OBJECT_PATH //The GVariant is a D-Bus object path string. - VARIANT_CLASS_SIGNATURE VariantClass = C.G_VARIANT_CLASS_SIGNATURE //The GVariant is a D-Bus signature string. - VARIANT_CLASS_VARIANT VariantClass = C.G_VARIANT_CLASS_VARIANT //The GVariant is a variant. - VARIANT_CLASS_MAYBE VariantClass = C.G_VARIANT_CLASS_MAYBE //The GVariant is a maybe-typed value. - VARIANT_CLASS_ARRAY VariantClass = C.G_VARIANT_CLASS_ARRAY //The GVariant is an array. - VARIANT_CLASS_TUPLE VariantClass = C.G_VARIANT_CLASS_TUPLE //The GVariant is a tuple. - VARIANT_CLASS_DICT_ENTRY VariantClass = C.G_VARIANT_CLASS_DICT_ENTRY //The GVariant is a dictionary entry. -) diff --git a/vendor/github.com/gotk3/gotk3/glib/gvariantdict.go b/vendor/github.com/gotk3/gotk3/glib/gvariantdict.go deleted file mode 100644 index e682008..0000000 --- a/vendor/github.com/gotk3/gotk3/glib/gvariantdict.go +++ /dev/null @@ -1,52 +0,0 @@ -// Same copyright and license as the rest of the files in this project - -//GVariant : GVariant — strongly typed value datatype -// https://developer.gnome.org/glib/2.26/glib-GVariant.html - -package glib - -// #include <glib.h> -// #include <glib-object.h> -// #include "glib.go.h" -// #include "gvariant.go.h" -import "C" -import "unsafe" - -/* - * GVariantDict - */ - -// VariantDict is a representation of GLib's VariantDict. -type VariantDict struct { - GVariantDict *C.GVariantDict -} - -func (v *VariantDict) toGVariantDict() *C.GVariantDict { - if v == nil { - return nil - } - return v.native() -} - -func (v *VariantDict) toVariantDict() *VariantDict { - return v -} - -// newVariantDict creates a new VariantDict from a GVariantDict pointer. -func newVariantDict(p *C.GVariantDict) *VariantDict { - return &VariantDict{GVariantDict: p} -} - -// native returns a pointer to the underlying GVariantDict. -func (v *VariantDict) native() *C.GVariantDict { - if v == nil || v.GVariantDict == nil { - return nil - } - p := unsafe.Pointer(v.GVariantDict) - return C.toGVariantDict(p) -} - -// Native returns a pointer to the underlying GVariantDict. -func (v *VariantDict) Native() uintptr { - return uintptr(unsafe.Pointer(v.native())) -} diff --git a/vendor/github.com/gotk3/gotk3/glib/gvariantiter.go b/vendor/github.com/gotk3/gotk3/glib/gvariantiter.go deleted file mode 100644 index 17b55ae..0000000 --- a/vendor/github.com/gotk3/gotk3/glib/gvariantiter.go +++ /dev/null @@ -1,52 +0,0 @@ -// Same copyright and license as the rest of the files in this project - -//GVariant : GVariant — strongly typed value datatype -// https://developer.gnome.org/glib/2.26/glib-GVariant.html - -package glib - -// #include <glib.h> -// #include <glib-object.h> -// #include "glib.go.h" -// #include "gvariant.go.h" -import "C" -import "unsafe" - -/* - * GVariantIter - */ - -// VariantIter is a representation of GLib's GVariantIter. -type VariantIter struct { - GVariantIter *C.GVariantIter -} - -func (v *VariantIter) toGVariantIter() *C.GVariantIter { - if v == nil { - return nil - } - return v.native() -} - -func (v *VariantIter) toVariantIter() *VariantIter { - return v -} - -// newVariantIter creates a new VariantIter from a GVariantIter pointer. -func newVariantIter(p *C.GVariantIter) *VariantIter { - return &VariantIter{GVariantIter: p} -} - -// native returns a pointer to the underlying GVariantIter. -func (v *VariantIter) native() *C.GVariantIter { - if v == nil || v.GVariantIter == nil { - return nil - } - p := unsafe.Pointer(v.GVariantIter) - return C.toGVariantIter(p) -} - -// Native returns a pointer to the underlying GVariantIter. -func (v *VariantIter) Native() uintptr { - return uintptr(unsafe.Pointer(v.native())) -} diff --git a/vendor/github.com/gotk3/gotk3/glib/gvarianttype.go b/vendor/github.com/gotk3/gotk3/glib/gvarianttype.go deleted file mode 100644 index 0efe421..0000000 --- a/vendor/github.com/gotk3/gotk3/glib/gvarianttype.go +++ /dev/null @@ -1,60 +0,0 @@ -// Same copyright and license as the rest of the files in this project - -//GVariant : GVariant — strongly typed value datatype -// https://developer.gnome.org/glib/2.26/glib-GVariant.html - -package glib - -// #include <glib.h> -// #include "gvarianttype.go.h" -import "C" - -// A VariantType is a wrapper for the GVariantType, which encodes type -// information for GVariants. -type VariantType struct { - GVariantType *C.GVariantType -} - -func (v *VariantType) native() *C.GVariantType { - if v == nil { - return nil - } - return v.GVariantType -} - -// String returns a copy of this VariantType's type string. -func (v *VariantType) String() string { - ch := C.g_variant_type_dup_string(v.native()) - defer C.g_free(C.gpointer(ch)) - return C.GoString((*C.char)(ch)) -} - -func newVariantType(v *C.GVariantType) *VariantType { - return &VariantType{v} -} - -// Variant types for comparing between them. Cannot be const because -// they are pointers. -var ( - VARIANT_TYPE_BOOLEAN = newVariantType(C._G_VARIANT_TYPE_BOOLEAN) - VARIANT_TYPE_BYTE = newVariantType(C._G_VARIANT_TYPE_BYTE) - VARIANT_TYPE_INT16 = newVariantType(C._G_VARIANT_TYPE_INT16) - VARIANT_TYPE_UINT16 = newVariantType(C._G_VARIANT_TYPE_UINT16) - VARIANT_TYPE_INT32 = newVariantType(C._G_VARIANT_TYPE_INT32) - VARIANT_TYPE_UINT32 = newVariantType(C._G_VARIANT_TYPE_UINT32) - VARIANT_TYPE_INT64 = newVariantType(C._G_VARIANT_TYPE_INT64) - VARIANT_TYPE_UINT64 = newVariantType(C._G_VARIANT_TYPE_UINT64) - VARIANT_TYPE_HANDLE = newVariantType(C._G_VARIANT_TYPE_HANDLE) - VARIANT_TYPE_DOUBLE = newVariantType(C._G_VARIANT_TYPE_DOUBLE) - VARIANT_TYPE_STRING = newVariantType(C._G_VARIANT_TYPE_STRING) - VARIANT_TYPE_ANY = newVariantType(C._G_VARIANT_TYPE_ANY) - VARIANT_TYPE_BASIC = newVariantType(C._G_VARIANT_TYPE_BASIC) - VARIANT_TYPE_TUPLE = newVariantType(C._G_VARIANT_TYPE_TUPLE) - VARIANT_TYPE_UNIT = newVariantType(C._G_VARIANT_TYPE_UNIT) - VARIANT_TYPE_DICTIONARY = newVariantType(C._G_VARIANT_TYPE_DICTIONARY) - VARIANT_TYPE_STRING_ARRAY = newVariantType(C._G_VARIANT_TYPE_STRING_ARRAY) - VARIANT_TYPE_OBJECT_PATH_ARRAY = newVariantType(C._G_VARIANT_TYPE_OBJECT_PATH_ARRAY) - VARIANT_TYPE_BYTESTRING = newVariantType(C._G_VARIANT_TYPE_BYTESTRING) - VARIANT_TYPE_BYTESTRING_ARRAY = newVariantType(C._G_VARIANT_TYPE_BYTESTRING_ARRAY) - VARIANT_TYPE_VARDICT = newVariantType(C._G_VARIANT_TYPE_VARDICT) -) diff --git a/vendor/github.com/gotk3/gotk3/glib/gvarianttype.go.h b/vendor/github.com/gotk3/gotk3/glib/gvarianttype.go.h deleted file mode 100644 index a2195de..0000000 --- a/vendor/github.com/gotk3/gotk3/glib/gvarianttype.go.h +++ /dev/null @@ -1,37 +0,0 @@ -// Same copyright and license as the rest of the files in this project - -//GVariant : GVariant — strongly typed value datatype -// https://developer.gnome.org/glib/2.26/glib-GVariant.html - -#ifndef __GVARIANTTYPE_GO_H__ -#define __GVARIANTTYPE_GO_H__ - -const GVariantType* _G_VARIANT_TYPE_BOOLEAN = G_VARIANT_TYPE_BOOLEAN; -const GVariantType* _G_VARIANT_TYPE_BYTE = G_VARIANT_TYPE_BYTE; -const GVariantType* _G_VARIANT_TYPE_INT16 = G_VARIANT_TYPE_INT16; -const GVariantType* _G_VARIANT_TYPE_UINT16 = G_VARIANT_TYPE_UINT16; -const GVariantType* _G_VARIANT_TYPE_INT32 = G_VARIANT_TYPE_INT32; -const GVariantType* _G_VARIANT_TYPE_UINT32 = G_VARIANT_TYPE_UINT32; -const GVariantType* _G_VARIANT_TYPE_INT64 = G_VARIANT_TYPE_INT64; -const GVariantType* _G_VARIANT_TYPE_UINT64 = G_VARIANT_TYPE_UINT64; -const GVariantType* _G_VARIANT_TYPE_HANDLE = G_VARIANT_TYPE_HANDLE; -const GVariantType* _G_VARIANT_TYPE_DOUBLE = G_VARIANT_TYPE_DOUBLE; -const GVariantType* _G_VARIANT_TYPE_STRING = G_VARIANT_TYPE_STRING; -const GVariantType* _G_VARIANT_TYPE_OBJECT_PATH = G_VARIANT_TYPE_OBJECT_PATH; -const GVariantType* _G_VARIANT_TYPE_SIGNATURE = G_VARIANT_TYPE_SIGNATURE; -const GVariantType* _G_VARIANT_TYPE_VARIANT = G_VARIANT_TYPE_VARIANT; -const GVariantType* _G_VARIANT_TYPE_ANY = G_VARIANT_TYPE_ANY; -const GVariantType* _G_VARIANT_TYPE_BASIC = G_VARIANT_TYPE_BASIC; -const GVariantType* _G_VARIANT_TYPE_MAYBE = G_VARIANT_TYPE_MAYBE; -const GVariantType* _G_VARIANT_TYPE_ARRAY = G_VARIANT_TYPE_ARRAY; -const GVariantType* _G_VARIANT_TYPE_TUPLE = G_VARIANT_TYPE_TUPLE; -const GVariantType* _G_VARIANT_TYPE_UNIT = G_VARIANT_TYPE_UNIT; -const GVariantType* _G_VARIANT_TYPE_DICT_ENTRY = G_VARIANT_TYPE_DICT_ENTRY; -const GVariantType* _G_VARIANT_TYPE_DICTIONARY = G_VARIANT_TYPE_DICTIONARY; -const GVariantType* _G_VARIANT_TYPE_STRING_ARRAY = G_VARIANT_TYPE_STRING_ARRAY; -const GVariantType* _G_VARIANT_TYPE_OBJECT_PATH_ARRAY = G_VARIANT_TYPE_OBJECT_PATH_ARRAY; -const GVariantType* _G_VARIANT_TYPE_BYTESTRING = G_VARIANT_TYPE_BYTESTRING; -const GVariantType* _G_VARIANT_TYPE_BYTESTRING_ARRAY = G_VARIANT_TYPE_BYTESTRING_ARRAY; -const GVariantType* _G_VARIANT_TYPE_VARDICT = G_VARIANT_TYPE_VARDICT; - -#endif diff --git a/vendor/github.com/gotk3/gotk3/glib/list.go b/vendor/github.com/gotk3/gotk3/glib/list.go deleted file mode 100644 index 250e426..0000000 --- a/vendor/github.com/gotk3/gotk3/glib/list.go +++ /dev/null @@ -1,155 +0,0 @@ -package glib - -// #include <glib.h> -// #include <glib-object.h> -// #include "glib.go.h" -import "C" -import "unsafe" - -/* - * Linked Lists - */ - -// List is a representation of Glib's GList. -type List struct { - list *C.struct__GList - // If set, dataWrap is called every time NthDataWrapped() - // or DataWrapped() is called to wrap raw underlying - // value into appropriate type. - dataWrap func(unsafe.Pointer) interface{} -} - -func WrapList(obj uintptr) *List { - return wrapList((*C.struct__GList)(unsafe.Pointer(obj))) -} - -func wrapList(obj *C.struct__GList) *List { - if obj == nil { - return nil - } - return &List{list: obj} -} - -func (v *List) wrapNewHead(obj *C.struct__GList) *List { - if obj == nil { - return nil - } - return &List{ - list: obj, - dataWrap: v.dataWrap, - } -} - -func (v *List) Native() uintptr { - return uintptr(unsafe.Pointer(v.list)) -} - -func (v *List) native() *C.struct__GList { - if v == nil || v.list == nil { - return nil - } - return v.list -} - -// DataWapper sets wrap functions, which is called during NthDataWrapped() -// and DataWrapped(). It's used to cast raw C data into appropriate -// Go structures and types every time that data is retreived. -func (v *List) DataWrapper(fn func(unsafe.Pointer) interface{}) { - if v == nil { - return - } - v.dataWrap = fn -} - -// Append is a wrapper around g_list_append(). -func (v *List) Append(data uintptr) *List { - glist := C.g_list_append(v.native(), C.gpointer(data)) - return v.wrapNewHead(glist) -} - -// Prepend is a wrapper around g_list_prepend(). -func (v *List) Prepend(data uintptr) *List { - glist := C.g_list_prepend(v.native(), C.gpointer(data)) - return v.wrapNewHead(glist) -} - -// Insert is a wrapper around g_list_insert(). -func (v *List) Insert(data uintptr, position int) *List { - glist := C.g_list_insert(v.native(), C.gpointer(data), C.gint(position)) - return v.wrapNewHead(glist) -} - -// Length is a wrapper around g_list_length(). -func (v *List) Length() uint { - return uint(C.g_list_length(v.native())) -} - -// nthDataRaw is a wrapper around g_list_nth_data(). -func (v *List) nthDataRaw(n uint) unsafe.Pointer { - return unsafe.Pointer(C.g_list_nth_data(v.native(), C.guint(n))) -} - -// Nth() is a wrapper around g_list_nth(). -func (v *List) Nth(n uint) *List { - list := wrapList(C.g_list_nth(v.native(), C.guint(n))) - list.DataWrapper(v.dataWrap) - return list -} - -// NthDataWrapped acts the same as g_list_nth_data(), but passes -// retrieved value before returning through wrap function, set by DataWrapper(). -// If no wrap function is set, it returns raw unsafe.Pointer. -func (v *List) NthData(n uint) interface{} { - ptr := v.nthDataRaw(n) - if v.dataWrap != nil { - return v.dataWrap(ptr) - } - return ptr -} - -// Free is a wrapper around g_list_free(). -func (v *List) Free() { - C.g_list_free(v.native()) -} - -// Next is a wrapper around the next struct field -func (v *List) Next() *List { - return v.wrapNewHead(v.native().next) -} - -// Previous is a wrapper around the prev struct field -func (v *List) Previous() *List { - return v.wrapNewHead(v.native().prev) -} - -// dataRaw is a wrapper around the data struct field -func (v *List) dataRaw() unsafe.Pointer { - return unsafe.Pointer(v.native().data) -} - -// DataWrapped acts the same as data struct field, but passes -// retrieved value before returning through wrap function, set by DataWrapper(). -// If no wrap function is set, it returns raw unsafe.Pointer. -func (v *List) Data() interface{} { - ptr := v.dataRaw() - if v.dataWrap != nil { - return v.dataWrap(ptr) - } - return ptr -} - -// Foreach acts the same as g_list_foreach(). -// No user_data argument is implemented because of Go clojure capabilities. -func (v *List) Foreach(fn func(item interface{})) { - for l := v; l != nil; l = l.Next() { - fn(l.Data()) - } -} - -// FreeFull acts the same as g_list_free_full(). -// Calling list.FreeFull(fn) is equivalent to calling list.Foreach(fn) and -// list.Free() sequentially. -func (v *List) FreeFull(fn func(item interface{})) { - v.Foreach(fn) - v.Free() -} diff --git a/vendor/github.com/gotk3/gotk3/glib/list_test.go b/vendor/github.com/gotk3/gotk3/glib/list_test.go deleted file mode 100644 index 66e3693..0000000 --- a/vendor/github.com/gotk3/gotk3/glib/list_test.go +++ /dev/null @@ -1,76 +0,0 @@ -package glib - -import ( - "fmt" - "testing" - "unsafe" -) - -func TestList_Basics(t *testing.T) { - list := (&List{}).Append(0).Append(1).Append(2) - if list.Length() != 3 { - t.Errorf("Length of list with 3 appended elements must be 3. (Got %v).", list.Length()) - } - - list = (&List{}).Prepend(0).Prepend(1).Prepend(2) - if list.Length() != 3 { - t.Errorf("Length of list with 3 prepended elements must be 3. (Got %v).", list.Length()) - } - - list = (&List{}).Insert(0, 0).Insert(1, 0).Insert(2, 0) - if list.Length() != 3 { - t.Errorf("Length of list with 3 inserted elements must be 3. (Got %v).", list.Length()) - } -} - -func TestList_DataWrapper(t *testing.T) { - list := (&List{}).Append(0).Append(1).Append(2) - list.DataWrapper(func(ptr unsafe.Pointer) interface{} { - return fmt.Sprintf("Value %v", uintptr(ptr)) - }) - - i := 0 - for l := list; l != nil; l = l.Next() { - expect := fmt.Sprintf("Value %v", i) - i++ - actual, ok := l.Data().(string) - if !ok { - t.Error("DataWrapper must have returned a string!") - } - if actual != expect { - t.Errorf("DataWrapper returned unexpected result. Expected '%v', got '%v'.", expect, actual) - } - } -} - -func TestList_Foreach(t *testing.T) { - list := (&List{}).Append(0).Append(1).Append(2) - list.DataWrapper(func(ptr unsafe.Pointer) interface{} { - return int(uintptr(ptr) + 1) - }) - - sum := 0 - list.Foreach(func(item interface{}) { - sum += item.(int) - }) - - if sum != 6 { - t.Errorf("Foreach resulted into wrong sum. Got %v, expected %v.", sum, 6) - } -} - -func TestList_Nth(t *testing.T) { - list := (&List{}).Append(0).Append(1).Append(2) - list.DataWrapper(func(ptr unsafe.Pointer) interface{} { - return int(uintptr(ptr) + 1) - }) - - for i := uint(0); i < 3; i++ { - nth := list.Nth(i).Data().(int) - nthData := list.NthData(i).(int) - - if nth != nthData { - t.Errorf("%v's element didn't match. Nth->Data returned %v; NthData returned %v.", i, nth, nthData) - } - } -} diff --git a/vendor/github.com/gotk3/gotk3/glib/menu.go b/vendor/github.com/gotk3/gotk3/glib/menu.go deleted file mode 100644 index ce9d268..0000000 --- a/vendor/github.com/gotk3/gotk3/glib/menu.go +++ /dev/null @@ -1,350 +0,0 @@ -package glib - -// #include <gio/gio.h> -// #include <glib.h> -// #include <glib-object.h> -// #include "glib.go.h" -import "C" -import "unsafe" - -// MenuModel is a representation of GMenuModel. -type MenuModel struct { - *Object -} - -// native() returns a pointer to the underlying GMenuModel. -func (v *MenuModel) native() *C.GMenuModel { - if v == nil || v.GObject == nil { - return nil - } - return C.toGMenuModel(unsafe.Pointer(v.GObject)) -} - -func (v *MenuModel) Native() uintptr { - return uintptr(unsafe.Pointer(v.native())) -} - -func marshalMenuModel(p uintptr) (interface{}, error) { - c := C.g_value_get_object((*C.GValue)(unsafe.Pointer(p))) - return wrapMenuModel(wrapObject(unsafe.Pointer(c))), nil -} - -func wrapMenuModel(obj *Object) *MenuModel { - return &MenuModel{obj} -} - -// IsMutable is a wrapper around g_menu_model_is_mutable(). -func (v *MenuModel) IsMutable() bool { - return gobool(C.g_menu_model_is_mutable(v.native())) -} - -// GetNItems is a wrapper around g_menu_model_get_n_items(). -func (v *MenuModel) GetNItems() int { - return int(C.g_menu_model_get_n_items(v.native())) -} - -// GetItemLink is a wrapper around g_menu_model_get_item_link(). -func (v *MenuModel) GetItemLink(index int, link string) *MenuModel { - cstr := (*C.gchar)(C.CString(link)) - defer C.free(unsafe.Pointer(cstr)) - c := C.g_menu_model_get_item_link(v.native(), C.gint(index), cstr) - if c == nil { - return nil - } - return wrapMenuModel(wrapObject(unsafe.Pointer(c))) -} - -// ItemsChanged is a wrapper around g_menu_model_items_changed(). -func (v *MenuModel) ItemsChanged(position, removed, added int) { - C.g_menu_model_items_changed(v.native(), C.gint(position), C.gint(removed), C.gint(added)) -} - -// GVariant * g_menu_model_get_item_attribute_value () -// gboolean g_menu_model_get_item_attribute () -// GMenuAttributeIter * g_menu_model_iterate_item_attributes () -// GMenuLinkIter * g_menu_model_iterate_item_links () - -// Menu is a representation of GMenu. -type Menu struct { - MenuModel -} - -// native() returns a pointer to the underlying GMenu. -func (m *Menu) native() *C.GMenu { - if m == nil || m.GObject == nil { - return nil - } - p := unsafe.Pointer(m.GObject) - return C.toGMenu(p) -} - -func marshalMenu(p uintptr) (interface{}, error) { - c := C.g_value_get_object((*C.GValue)(unsafe.Pointer(p))) - return wrapMenu(wrapObject(unsafe.Pointer(c))), nil -} - -func wrapMenu(obj *Object) *Menu { - return &Menu{MenuModel{obj}} -} - -// MenuNew is a wrapper around g_menu_new(). -func MenuNew() *Menu { - c := C.g_menu_new() - if c == nil { - return nil - } - return wrapMenu(wrapObject(unsafe.Pointer(c))) -} - -// Freeze is a wrapper around g_menu_freeze(). -func (v *Menu) Freeze() { - C.g_menu_freeze(v.native()) -} - -// Insert is a wrapper around g_menu_insert(). -func (v *Menu) Insert(position int, label, detailed_action string) { - cstr1 := (*C.gchar)(C.CString(label)) - defer C.free(unsafe.Pointer(cstr1)) - - cstr2 := (*C.gchar)(C.CString(detailed_action)) - defer C.free(unsafe.Pointer(cstr2)) - - C.g_menu_insert(v.native(), C.gint(position), cstr1, cstr2) -} - -// Prepend is a wrapper around g_menu_prepend(). -func (v *Menu) Prepend(label, detailed_action string) { - cstr1 := (*C.gchar)(C.CString(label)) - defer C.free(unsafe.Pointer(cstr1)) - - cstr2 := (*C.gchar)(C.CString(detailed_action)) - defer C.free(unsafe.Pointer(cstr2)) - - C.g_menu_prepend(v.native(), cstr1, cstr2) -} - -// Append is a wrapper around g_menu_append(). -func (v *Menu) Append(label, detailed_action string) { - cstr1 := (*C.gchar)(C.CString(label)) - defer C.free(unsafe.Pointer(cstr1)) - - cstr2 := (*C.gchar)(C.CString(detailed_action)) - defer C.free(unsafe.Pointer(cstr2)) - - C.g_menu_append(v.native(), cstr1, cstr2) -} - -// InsertItem is a wrapper around g_menu_insert_item(). -func (v *Menu) InsertItem(position int, item *MenuItem) { - C.g_menu_insert_item(v.native(), C.gint(position), item.native()) -} - -// AppendItem is a wrapper around g_menu_append_item(). -func (v *Menu) AppendItem(item *MenuItem) { - C.g_menu_append_item(v.native(), item.native()) -} - -// PrependItem is a wrapper around g_menu_prepend_item(). -func (v *Menu) PrependItem(item *MenuItem) { - C.g_menu_prepend_item(v.native(), item.native()) -} - -// InsertSection is a wrapper around g_menu_insert_section(). -func (v *Menu) InsertSection(position int, label string, section *MenuModel) { - cstr1 := (*C.gchar)(C.CString(label)) - defer C.free(unsafe.Pointer(cstr1)) - - C.g_menu_insert_section(v.native(), C.gint(position), cstr1, section.native()) -} - -// PrependSection is a wrapper around g_menu_prepend_section(). -func (v *Menu) PrependSection(label string, section *MenuModel) { - cstr1 := (*C.gchar)(C.CString(label)) - defer C.free(unsafe.Pointer(cstr1)) - - C.g_menu_prepend_section(v.native(), cstr1, section.native()) -} - -// AppendSection is a wrapper around g_menu_append_section(). -func (v *Menu) AppendSection(label string, section *MenuModel) { - cstr1 := (*C.gchar)(C.CString(label)) - defer C.free(unsafe.Pointer(cstr1)) - - C.g_menu_append_section(v.native(), cstr1, section.native()) -} - -// InsertSectionWithoutLabel is a wrapper around g_menu_insert_section() -// with label set to null. -func (v *Menu) InsertSectionWithoutLabel(position int, section *MenuModel) { - C.g_menu_insert_section(v.native(), C.gint(position), nil, section.native()) -} - -// PrependSectionWithoutLabel is a wrapper around -// g_menu_prepend_section() with label set to null. -func (v *Menu) PrependSectionWithoutLabel(section *MenuModel) { - C.g_menu_prepend_section(v.native(), nil, section.native()) -} - -// AppendSectionWithoutLabel is a wrapper around g_menu_append_section() -// with label set to null. -func (v *Menu) AppendSectionWithoutLabel(section *MenuModel) { - C.g_menu_append_section(v.native(), nil, section.native()) -} - -// InsertSubmenu is a wrapper around g_menu_insert_submenu(). -func (v *Menu) InsertSubmenu(position int, label string, submenu *MenuModel) { - cstr1 := (*C.gchar)(C.CString(label)) - defer C.free(unsafe.Pointer(cstr1)) - - C.g_menu_insert_submenu(v.native(), C.gint(position), cstr1, submenu.native()) -} - -// PrependSubmenu is a wrapper around g_menu_prepend_submenu(). -func (v *Menu) PrependSubmenu(label string, submenu *MenuModel) { - cstr1 := (*C.gchar)(C.CString(label)) - defer C.free(unsafe.Pointer(cstr1)) - - C.g_menu_prepend_submenu(v.native(), cstr1, submenu.native()) -} - -// AppendSubmenu is a wrapper around g_menu_append_submenu(). -func (v *Menu) AppendSubmenu(label string, submenu *MenuModel) { - cstr1 := (*C.gchar)(C.CString(label)) - defer C.free(unsafe.Pointer(cstr1)) - - C.g_menu_append_submenu(v.native(), cstr1, submenu.native()) -} - -// Remove is a wrapper around g_menu_remove(). -func (v *Menu) Remove(position int) { - C.g_menu_remove(v.native(), C.gint(position)) -} - -// RemoveAll is a wrapper around g_menu_remove_all(). -func (v *Menu) RemoveAll() { - C.g_menu_remove_all(v.native()) -} - -// MenuItem is a representation of GMenuItem. -type MenuItem struct { - *Object -} - -// native() returns a pointer to the underlying GMenuItem. -func (m *MenuItem) native() *C.GMenuItem { - if m == nil || m.GObject == nil { - return nil - } - p := unsafe.Pointer(m.GObject) - return C.toGMenuItem(p) -} - -func marshalMenuItem(p uintptr) (interface{}, error) { - c := C.g_value_get_object((*C.GValue)(unsafe.Pointer(p))) - return wrapMenuItem(wrapObject(unsafe.Pointer(c))), nil -} - -func wrapMenuItem(obj *Object) *MenuItem { - return &MenuItem{obj} -} - -// MenuItemNew is a wrapper around g_menu_item_new(). -func MenuItemNew(label, detailed_action string) *MenuItem { - cstr1 := (*C.gchar)(C.CString(label)) - defer C.free(unsafe.Pointer(cstr1)) - - cstr2 := (*C.gchar)(C.CString(detailed_action)) - defer C.free(unsafe.Pointer(cstr2)) - - c := C.g_menu_item_new(cstr1, cstr2) - if c == nil { - return nil - } - return wrapMenuItem(wrapObject(unsafe.Pointer(c))) -} - -// MenuItemNewSection is a wrapper around g_menu_item_new_section(). -func MenuItemNewSection(label string, section *MenuModel) *MenuItem { - cstr1 := (*C.gchar)(C.CString(label)) - defer C.free(unsafe.Pointer(cstr1)) - - c := C.g_menu_item_new_section(cstr1, section.native()) - if c == nil { - return nil - } - return wrapMenuItem(wrapObject(unsafe.Pointer(c))) -} - -// MenuItemNewSubmenu is a wrapper around g_menu_item_new_submenu(). -func MenuItemNewSubmenu(label string, submenu *MenuModel) *MenuItem { - cstr1 := (*C.gchar)(C.CString(label)) - defer C.free(unsafe.Pointer(cstr1)) - - c := C.g_menu_item_new_submenu(cstr1, submenu.native()) - if c == nil { - return nil - } - return wrapMenuItem(wrapObject(unsafe.Pointer(c))) -} - -// MenuItemNewFromModel is a wrapper around g_menu_item_new_from_model(). -func MenuItemNewFromModel(model *MenuModel, index int) *MenuItem { - c := C.g_menu_item_new_from_model(model.native(), C.gint(index)) - if c == nil { - return nil - } - return wrapMenuItem(wrapObject(unsafe.Pointer(c))) -} - -//SetLabel is a wrapper around g_menu_item_set_label(). -func (v *MenuItem) SetLabel(label string) { - cstr1 := (*C.gchar)(C.CString(label)) - defer C.free(unsafe.Pointer(cstr1)) - - C.g_menu_item_set_label(v.native(), cstr1) -} - -//SetDetailedAction is a wrapper around g_menu_item_set_detailed_action(). -func (v *MenuItem) SetDetailedAction(act string) { - cstr1 := (*C.gchar)(C.CString(act)) - defer C.free(unsafe.Pointer(cstr1)) - - C.g_menu_item_set_detailed_action(v.native(), cstr1) -} - -//SetSection is a wrapper around g_menu_item_set_section(). -func (v *MenuItem) SetSection(section *MenuModel) { - C.g_menu_item_set_section(v.native(), section.native()) -} - -//SetSubmenu is a wrapper around g_menu_item_set_submenu(). -func (v *MenuItem) SetSubmenu(submenu *MenuModel) { - C.g_menu_item_set_submenu(v.native(), submenu.native()) -} - -//GetLink is a wrapper around g_menu_item_get_link(). -func (v *MenuItem) GetLink(link string) *MenuModel { - cstr1 := (*C.gchar)(C.CString(link)) - defer C.free(unsafe.Pointer(cstr1)) - - c := C.g_menu_item_get_link(v.native(), cstr1) - if c == nil { - return nil - } - return wrapMenuModel(wrapObject(unsafe.Pointer(c))) -} - -//SetLink is a wrapper around g_menu_item_Set_link(). -func (v *MenuItem) SetLink(link string, model *MenuModel) { - cstr1 := (*C.gchar)(C.CString(link)) - defer C.free(unsafe.Pointer(cstr1)) - - C.g_menu_item_set_link(v.native(), cstr1, model.native()) -} - -// void g_menu_item_set_action_and_target_value () -// void g_menu_item_set_action_and_target () -// GVariant * g_menu_item_get_attribute_value () -// gboolean g_menu_item_get_attribute () -// void g_menu_item_set_attribute_value () -// void g_menu_item_set_attribute () diff --git a/vendor/github.com/gotk3/gotk3/glib/notifications.go b/vendor/github.com/gotk3/gotk3/glib/notifications.go deleted file mode 100644 index 9f1ec6a..0000000 --- a/vendor/github.com/gotk3/gotk3/glib/notifications.go +++ /dev/null @@ -1,105 +0,0 @@ -package glib - -// #include <gio/gio.h> -// #include <glib.h> -// #include <glib-object.h> -// #include "glib.go.h" -import "C" -import "unsafe" - -// Only available from 2.42 -// // NotificationPriority is a representation of GLib's GNotificationPriority. -// type NotificationPriority int - -// const ( -// NOTIFICATION_PRIORITY_NORMAL NotificationPriority = C.G_NOTIFICATION_PRIORITY_NORMAL -// NOTIFICATION_PRIORITY_LOW NotificationPriority = C.G_NOTIFICATION_PRIORITY_LOW -// NOTIFICATION_PRIORITY_HIGH NotificationPriority = C.G_NOTIFICATION_PRIORITY_HIGH -// NOTIFICATION_PRIORITY_URGENT NotificationPriority = C.G_NOTIFICATION_PRIORITY_URGENT -// ) - -// Notification is a representation of GNotification. -type Notification struct { - *Object -} - -// native() returns a pointer to the underlying GNotification. -func (v *Notification) native() *C.GNotification { - if v == nil || v.GObject == nil { - return nil - } - return C.toGNotification(unsafe.Pointer(v.GObject)) -} - -func (v *Notification) Native() uintptr { - return uintptr(unsafe.Pointer(v.native())) -} - -func marshalNotification(p uintptr) (interface{}, error) { - c := C.g_value_get_object((*C.GValue)(unsafe.Pointer(p))) - return wrapNotification(wrapObject(unsafe.Pointer(c))), nil -} - -func wrapNotification(obj *Object) *Notification { - return &Notification{obj} -} - -// NotificationNew is a wrapper around g_notification_new(). -func NotificationNew(title string) *Notification { - cstr1 := (*C.gchar)(C.CString(title)) - defer C.free(unsafe.Pointer(cstr1)) - - c := C.g_notification_new(cstr1) - if c == nil { - return nil - } - return wrapNotification(wrapObject(unsafe.Pointer(c))) -} - -// SetTitle is a wrapper around g_notification_set_title(). -func (v *Notification) SetTitle(title string) { - cstr1 := (*C.gchar)(C.CString(title)) - defer C.free(unsafe.Pointer(cstr1)) - - C.g_notification_set_title(v.native(), cstr1) -} - -// SetBody is a wrapper around g_notification_set_body(). -func (v *Notification) SetBody(body string) { - cstr1 := (*C.gchar)(C.CString(body)) - defer C.free(unsafe.Pointer(cstr1)) - - C.g_notification_set_body(v.native(), cstr1) -} - -// Only available from 2.42 -// // SetPriority is a wrapper around g_notification_set_priority(). -// func (v *Notification) SetPriority(prio NotificationPriority) { -// C.g_notification_set_priority(v.native(), C.GNotificationPriority(prio)) -// } - -// SetDefaultAction is a wrapper around g_notification_set_default_action(). -func (v *Notification) SetDefaultAction(detailedAction string) { - cstr1 := (*C.gchar)(C.CString(detailedAction)) - defer C.free(unsafe.Pointer(cstr1)) - - C.g_notification_set_default_action(v.native(), cstr1) -} - -// AddButton is a wrapper around g_notification_add_button(). -func (v *Notification) AddButton(label, detailedAction string) { - cstr1 := (*C.gchar)(C.CString(label)) - defer C.free(unsafe.Pointer(cstr1)) - - cstr2 := (*C.gchar)(C.CString(detailedAction)) - defer C.free(unsafe.Pointer(cstr2)) - - C.g_notification_add_button(v.native(), cstr1, cstr2) -} - -// void g_notification_set_default_action_and_target () // requires varargs -// void g_notification_set_default_action_and_target_value () // requires variant -// void g_notification_add_button_with_target () // requires varargs -// void g_notification_add_button_with_target_value () //requires variant -// void g_notification_set_urgent () // Deprecated, so not implemented -// void g_notification_set_icon () // Requires support for GIcon, which we don't have yet. diff --git a/vendor/github.com/gotk3/gotk3/glib/settings.go b/vendor/github.com/gotk3/gotk3/glib/settings.go deleted file mode 100644 index 1bca146..0000000 --- a/vendor/github.com/gotk3/gotk3/glib/settings.go +++ /dev/null @@ -1,304 +0,0 @@ -package glib - -// #include <gio/gio.h> -// #include <glib.h> -// #include <glib-object.h> -// #include "glib.go.h" -import "C" -import "unsafe" - -// Settings is a representation of GSettings. -type Settings struct { - *Object -} - -// native() returns a pointer to the underlying GSettings. -func (v *Settings) native() *C.GSettings { - if v == nil || v.GObject == nil { - return nil - } - return C.toGSettings(unsafe.Pointer(v.GObject)) -} - -func (v *Settings) Native() uintptr { - return uintptr(unsafe.Pointer(v.native())) -} - -func marshalSettings(p uintptr) (interface{}, error) { - c := C.g_value_get_object((*C.GValue)(unsafe.Pointer(p))) - return wrapSettings(wrapObject(unsafe.Pointer(c))), nil -} - -func wrapSettings(obj *Object) *Settings { - return &Settings{obj} -} - -func wrapFullSettings(obj *C.GSettings) *Settings { - if obj == nil { - return nil - } - return wrapSettings(wrapObject(unsafe.Pointer(obj))) -} - -// SettingsNew is a wrapper around g_settings_new(). -func SettingsNew(schemaID string) *Settings { - cstr := (*C.gchar)(C.CString(schemaID)) - defer C.free(unsafe.Pointer(cstr)) - - return wrapFullSettings(C.g_settings_new(cstr)) -} - -// SettingsNewWithPath is a wrapper around g_settings_new_with_path(). -func SettingsNewWithPath(schemaID, path string) *Settings { - cstr1 := (*C.gchar)(C.CString(schemaID)) - defer C.free(unsafe.Pointer(cstr1)) - - cstr2 := (*C.gchar)(C.CString(path)) - defer C.free(unsafe.Pointer(cstr2)) - - return wrapFullSettings(C.g_settings_new_with_path(cstr1, cstr2)) -} - -// SettingsNewWithBackend is a wrapper around g_settings_new_with_backend(). -func SettingsNewWithBackend(schemaID string, backend *SettingsBackend) *Settings { - cstr1 := (*C.gchar)(C.CString(schemaID)) - defer C.free(unsafe.Pointer(cstr1)) - - return wrapFullSettings(C.g_settings_new_with_backend(cstr1, backend.native())) -} - -// SettingsNewWithBackendAndPath is a wrapper around g_settings_new_with_backend_and_path(). -func SettingsNewWithBackendAndPath(schemaID string, backend *SettingsBackend, path string) *Settings { - cstr1 := (*C.gchar)(C.CString(schemaID)) - defer C.free(unsafe.Pointer(cstr1)) - - cstr2 := (*C.gchar)(C.CString(path)) - defer C.free(unsafe.Pointer(cstr2)) - - return wrapFullSettings(C.g_settings_new_with_backend_and_path(cstr1, backend.native(), cstr2)) -} - -// SettingsNewFull is a wrapper around g_settings_new_full(). -func SettingsNewFull(schema *SettingsSchema, backend *SettingsBackend, path string) *Settings { - cstr1 := (*C.gchar)(C.CString(path)) - defer C.free(unsafe.Pointer(cstr1)) - - return wrapFullSettings(C.g_settings_new_full(schema.native(), backend.native(), cstr1)) -} - -// SettingsSync is a wrapper around g_settings_sync(). -func SettingsSync() { - C.g_settings_sync() -} - -// IsWritable is a wrapper around g_settings_is_writable(). -func (v *Settings) IsWritable(name string) bool { - cstr1 := (*C.gchar)(C.CString(name)) - defer C.free(unsafe.Pointer(cstr1)) - - return gobool(C.g_settings_is_writable(v.native(), cstr1)) -} - -// Delay is a wrapper around g_settings_delay(). -func (v *Settings) Delay() { - C.g_settings_delay(v.native()) -} - -// Apply is a wrapper around g_settings_apply(). -func (v *Settings) Apply() { - C.g_settings_apply(v.native()) -} - -// Revert is a wrapper around g_settings_revert(). -func (v *Settings) Revert() { - C.g_settings_revert(v.native()) -} - -// GetHasUnapplied is a wrapper around g_settings_get_has_unapplied(). -func (v *Settings) GetHasUnapplied() bool { - return gobool(C.g_settings_get_has_unapplied(v.native())) -} - -// GetChild is a wrapper around g_settings_get_child(). -func (v *Settings) GetChild(name string) *Settings { - cstr1 := (*C.gchar)(C.CString(name)) - defer C.free(unsafe.Pointer(cstr1)) - - return wrapFullSettings(C.g_settings_get_child(v.native(), cstr1)) -} - -// Reset is a wrapper around g_settings_reset(). -func (v *Settings) Reset(name string) { - cstr1 := (*C.gchar)(C.CString(name)) - defer C.free(unsafe.Pointer(cstr1)) - - C.g_settings_reset(v.native(), cstr1) -} - -// ListChildren is a wrapper around g_settings_list_children(). -func (v *Settings) ListChildren() []string { - return toGoStringArray(C.g_settings_list_children(v.native())) -} - -// GetBoolean is a wrapper around g_settings_get_boolean(). -func (v *Settings) GetBoolean(name string) bool { - cstr1 := (*C.gchar)(C.CString(name)) - defer C.free(unsafe.Pointer(cstr1)) - - return gobool(C.g_settings_get_boolean(v.native(), cstr1)) -} - -// SetBoolean is a wrapper around g_settings_set_boolean(). -func (v *Settings) SetBoolean(name string, value bool) bool { - cstr1 := (*C.gchar)(C.CString(name)) - defer C.free(unsafe.Pointer(cstr1)) - - return gobool(C.g_settings_set_boolean(v.native(), cstr1, gbool(value))) -} - -// GetInt is a wrapper around g_settings_get_int(). -func (v *Settings) GetInt(name string) int { - cstr1 := (*C.gchar)(C.CString(name)) - defer C.free(unsafe.Pointer(cstr1)) - - return int(C.g_settings_get_int(v.native(), cstr1)) -} - -// SetInt is a wrapper around g_settings_set_int(). -func (v *Settings) SetInt(name string, value int) bool { - cstr1 := (*C.gchar)(C.CString(name)) - defer C.free(unsafe.Pointer(cstr1)) - - return gobool(C.g_settings_set_int(v.native(), cstr1, C.gint(value))) -} - -// GetUInt is a wrapper around g_settings_get_uint(). -func (v *Settings) GetUInt(name string) uint { - cstr1 := (*C.gchar)(C.CString(name)) - defer C.free(unsafe.Pointer(cstr1)) - - return uint(C.g_settings_get_uint(v.native(), cstr1)) -} - -// SetUInt is a wrapper around g_settings_set_uint(). -func (v *Settings) SetUInt(name string, value uint) bool { - cstr1 := (*C.gchar)(C.CString(name)) - defer C.free(unsafe.Pointer(cstr1)) - - return gobool(C.g_settings_set_uint(v.native(), cstr1, C.guint(value))) -} - -// GetDouble is a wrapper around g_settings_get_double(). -func (v *Settings) GetDouble(name string) float64 { - cstr1 := (*C.gchar)(C.CString(name)) - defer C.free(unsafe.Pointer(cstr1)) - - return float64(C.g_settings_get_double(v.native(), cstr1)) -} - -// SetDouble is a wrapper around g_settings_set_double(). -func (v *Settings) SetDouble(name string, value float64) bool { - cstr1 := (*C.gchar)(C.CString(name)) - defer C.free(unsafe.Pointer(cstr1)) - - return gobool(C.g_settings_set_double(v.native(), cstr1, C.gdouble(value))) -} - -// GetString is a wrapper around g_settings_get_string(). -func (v *Settings) GetString(name string) string { - cstr1 := (*C.gchar)(C.CString(name)) - defer C.free(unsafe.Pointer(cstr1)) - - return C.GoString((*C.char)(C.g_settings_get_string(v.native(), cstr1))) -} - -// SetString is a wrapper around g_settings_set_string(). -func (v *Settings) SetString(name string, value string) bool { - cstr1 := (*C.gchar)(C.CString(name)) - defer C.free(unsafe.Pointer(cstr1)) - - cstr2 := (*C.gchar)(C.CString(value)) - defer C.free(unsafe.Pointer(cstr2)) - - return gobool(C.g_settings_set_string(v.native(), cstr1, cstr2)) -} - -// GetEnum is a wrapper around g_settings_get_enum(). -func (v *Settings) GetEnum(name string) int { - cstr1 := (*C.gchar)(C.CString(name)) - defer C.free(unsafe.Pointer(cstr1)) - - return int(C.g_settings_get_enum(v.native(), cstr1)) -} - -// GetStrv is a wrapper around g_settings_get_strv(). -func (v *Settings) GetStrv(name string) []string { - cstr1 := (*C.gchar)(C.CString(name)) - defer C.free(unsafe.Pointer(cstr1)) - return toGoStringArray(C.g_settings_get_strv(v.native(), cstr1)) -} - -// SetStrv is a wrapper around g_settings_set_strv(). -func (v *Settings) SetStrv(name string, values []string) bool { - cstr1 := (*C.gchar)(C.CString(name)) - defer C.free(unsafe.Pointer(cstr1)) - - cvalues := make([]*C.gchar, len(values)) - for i, accel := range values { - cvalues[i] = (*C.gchar)(C.CString(accel)) - defer C.free(unsafe.Pointer(cvalues[i])) - } - cvalues = append(cvalues, nil) - - return gobool(C.g_settings_set_strv(v.native(), cstr1, &cvalues[0])) -} - -// SetEnum is a wrapper around g_settings_set_enum(). -func (v *Settings) SetEnum(name string, value int) bool { - cstr1 := (*C.gchar)(C.CString(name)) - defer C.free(unsafe.Pointer(cstr1)) - - return gobool(C.g_settings_set_enum(v.native(), cstr1, C.gint(value))) -} - -// GetFlags is a wrapper around g_settings_get_flags(). -func (v *Settings) GetFlags(name string) uint { - cstr1 := (*C.gchar)(C.CString(name)) - defer C.free(unsafe.Pointer(cstr1)) - - return uint(C.g_settings_get_flags(v.native(), cstr1)) -} - -// SetFlags is a wrapper around g_settings_set_flags(). -func (v *Settings) SetFlags(name string, value uint) bool { - cstr1 := (*C.gchar)(C.CString(name)) - defer C.free(unsafe.Pointer(cstr1)) - - return gobool(C.g_settings_set_flags(v.native(), cstr1, C.guint(value))) -} - -func (v *Settings) GetValue(name string) *Variant { - cstr := (*C.gchar)(C.CString(name)) - defer C.free(unsafe.Pointer(cstr)) - return newVariant(C.g_settings_get_value(v.native(), cstr)) -} - -// GVariant * g_settings_get_value () -// gboolean g_settings_set_value () -// GVariant * g_settings_get_user_value () -// GVariant * g_settings_get_default_value () -// const gchar * const * g_settings_list_schemas () -// const gchar * const * g_settings_list_relocatable_schemas () -// gchar ** g_settings_list_keys () -// GVariant * g_settings_get_range () -// gboolean g_settings_range_check () -// void g_settings_get () -// gboolean g_settings_set () -// gpointer g_settings_get_mapped () -// void g_settings_bind () -// void g_settings_bind_with_mapping () -// void g_settings_bind_writable () -// void g_settings_unbind () -// gaction * g_settings_create_action () -// gchar ** g_settings_get_strv () -// gboolean g_settings_set_strv () diff --git a/vendor/github.com/gotk3/gotk3/glib/settings_backend.go b/vendor/github.com/gotk3/gotk3/glib/settings_backend.go deleted file mode 100644 index 3579ee4..0000000 --- a/vendor/github.com/gotk3/gotk3/glib/settings_backend.go +++ /dev/null @@ -1,70 +0,0 @@ -package glib - -// #include <glib.h> -// #include <glib-object.h> -// #include "glib.go.h" -import "C" -import "unsafe" - -// SettingsBackend is a representation of GSettingsBackend. -type SettingsBackend struct { - *Object -} - -// native() returns a pointer to the underlying GSettingsBackend. -func (v *SettingsBackend) native() *C.GSettingsBackend { - if v == nil || v.GObject == nil { - return nil - } - return C.toGSettingsBackend(unsafe.Pointer(v.GObject)) -} - -func (v *SettingsBackend) Native() uintptr { - return uintptr(unsafe.Pointer(v.native())) -} - -func marshalSettingsBackend(p uintptr) (interface{}, error) { - c := C.g_value_get_object((*C.GValue)(unsafe.Pointer(p))) - return wrapSettingsBackend(wrapObject(unsafe.Pointer(c))), nil -} - -func wrapSettingsBackend(obj *Object) *SettingsBackend { - return &SettingsBackend{obj} -} - -// SettingsBackendGetDefault is a wrapper around g_settings_backend_get_default(). -func SettingsBackendGetDefault() *SettingsBackend { - return wrapSettingsBackend(wrapObject(unsafe.Pointer(C.g_settings_backend_get_default()))) -} - -// KeyfileSettingsBackendNew is a wrapper around g_keyfile_settings_backend_new(). -func KeyfileSettingsBackendNew(filename, rootPath, rootGroup string) *SettingsBackend { - cstr1 := (*C.gchar)(C.CString(filename)) - defer C.free(unsafe.Pointer(cstr1)) - - cstr2 := (*C.gchar)(C.CString(rootPath)) - defer C.free(unsafe.Pointer(cstr2)) - - cstr3 := (*C.gchar)(C.CString(rootGroup)) - defer C.free(unsafe.Pointer(cstr3)) - - return wrapSettingsBackend(wrapObject(unsafe.Pointer(C.g_keyfile_settings_backend_new(cstr1, cstr2, cstr3)))) -} - -// MemorySettingsBackendNew is a wrapper around g_memory_settings_backend_new(). -func MemorySettingsBackendNew() *SettingsBackend { - return wrapSettingsBackend(wrapObject(unsafe.Pointer(C.g_memory_settings_backend_new()))) -} - -// NullSettingsBackendNew is a wrapper around g_null_settings_backend_new(). -func NullSettingsBackendNew() *SettingsBackend { - return wrapSettingsBackend(wrapObject(unsafe.Pointer(C.g_null_settings_backend_new()))) -} - -// void g_settings_backend_changed () -// void g_settings_backend_path_changed () -// void g_settings_backend_keys_changed () -// void g_settings_backend_path_writable_changed () -// void g_settings_backend_writable_changed () -// void g_settings_backend_changed_tree () -// void g_settings_backend_flatten_tree () diff --git a/vendor/github.com/gotk3/gotk3/glib/settings_schema.go b/vendor/github.com/gotk3/gotk3/glib/settings_schema.go deleted file mode 100644 index 41839b1..0000000 --- a/vendor/github.com/gotk3/gotk3/glib/settings_schema.go +++ /dev/null @@ -1,95 +0,0 @@ -package glib - -// #include <gio/gio.h> -// #include <glib.h> -// #include <glib-object.h> -// #include "glib.go.h" -import "C" -import "unsafe" - -// SettingsSchema is a representation of GSettingsSchema. -type SettingsSchema struct { - schema *C.GSettingsSchema -} - -func wrapSettingsSchema(obj *C.GSettingsSchema) *SettingsSchema { - if obj == nil { - return nil - } - return &SettingsSchema{obj} -} - -func (v *SettingsSchema) Native() uintptr { - return uintptr(unsafe.Pointer(v.schema)) -} - -func (v *SettingsSchema) native() *C.GSettingsSchema { - if v == nil || v.schema == nil { - return nil - } - return v.schema -} - -// Ref() is a wrapper around g_settings_schema_ref(). -func (v *SettingsSchema) Ref() *SettingsSchema { - return wrapSettingsSchema(C.g_settings_schema_ref(v.native())) -} - -// Unref() is a wrapper around g_settings_schema_unref(). -func (v *SettingsSchema) Unref() { - C.g_settings_schema_unref(v.native()) -} - -// GetID() is a wrapper around g_settings_schema_get_id(). -func (v *SettingsSchema) GetID() string { - return C.GoString((*C.char)(C.g_settings_schema_get_id(v.native()))) -} - -// GetPath() is a wrapper around g_settings_schema_get_path(). -func (v *SettingsSchema) GetPath() string { - return C.GoString((*C.char)(C.g_settings_schema_get_path(v.native()))) -} - -// HasKey() is a wrapper around g_settings_schema_has_key(). -func (v *SettingsSchema) HasKey(v1 string) bool { - cstr := (*C.gchar)(C.CString(v1)) - defer C.free(unsafe.Pointer(cstr)) - - return gobool(C.g_settings_schema_has_key(v.native(), cstr)) -} - -func toGoStringArray(c **C.gchar) []string { - var strs []string - originalc := c - defer C.g_strfreev(originalc) - - for *c != nil { - strs = append(strs, C.GoString((*C.char)(*c))) - c = C.next_gcharptr(c) - } - - return strs - -} - -// // ListChildren() is a wrapper around g_settings_schema_list_children(). -// func (v *SettingsSchema) ListChildren() []string { -// return toGoStringArray(C.g_settings_schema_list_children(v.native())) -// } - -// // ListKeys() is a wrapper around g_settings_schema_list_keys(). -// func (v *SettingsSchema) ListKeys() []string { -// return toGoStringArray(C.g_settings_schema_list_keys(v.native())) -// } - -// const GVariantType * g_settings_schema_key_get_value_type () -// GVariant * g_settings_schema_key_get_default_value () -// GVariant * g_settings_schema_key_get_range () -// gboolean g_settings_schema_key_range_check () -// const gchar * g_settings_schema_key_get_name () -// const gchar * g_settings_schema_key_get_summary () -// const gchar * g_settings_schema_key_get_description () - -// GSettingsSchemaKey * g_settings_schema_get_key () -// GSettingsSchemaKey * g_settings_schema_key_ref () -// void g_settings_schema_key_unref () diff --git a/vendor/github.com/gotk3/gotk3/glib/settings_schema_source.go b/vendor/github.com/gotk3/gotk3/glib/settings_schema_source.go deleted file mode 100644 index a66a4c1..0000000 --- a/vendor/github.com/gotk3/gotk3/glib/settings_schema_source.go +++ /dev/null @@ -1,69 +0,0 @@ -package glib - -// #include <gio/gio.h> -// #include <glib.h> -// #include <glib-object.h> -// #include "glib.go.h" -import "C" -import "unsafe" - -// SettingsSchemaSource is a representation of GSettingsSchemaSource. -type SettingsSchemaSource struct { - source *C.GSettingsSchemaSource -} - -func wrapSettingsSchemaSource(obj *C.GSettingsSchemaSource) *SettingsSchemaSource { - if obj == nil { - return nil - } - return &SettingsSchemaSource{obj} -} - -func (v *SettingsSchemaSource) Native() uintptr { - return uintptr(unsafe.Pointer(v.source)) -} - -func (v *SettingsSchemaSource) native() *C.GSettingsSchemaSource { - if v == nil || v.source == nil { - return nil - } - return v.source -} - -// SettingsSchemaSourceGetDefault is a wrapper around g_settings_schema_source_get_default(). -func SettingsSchemaSourceGetDefault() *SettingsSchemaSource { - return wrapSettingsSchemaSource(C.g_settings_schema_source_get_default()) -} - -// Ref() is a wrapper around g_settings_schema_source_ref(). -func (v *SettingsSchemaSource) Ref() *SettingsSchemaSource { - return wrapSettingsSchemaSource(C.g_settings_schema_source_ref(v.native())) -} - -// Unref() is a wrapper around g_settings_schema_source_unref(). -func (v *SettingsSchemaSource) Unref() { - C.g_settings_schema_source_unref(v.native()) -} - -// SettingsSchemaSourceNewFromDirectory() is a wrapper around g_settings_schema_source_new_from_directory(). -func SettingsSchemaSourceNewFromDirectory(dir string, parent *SettingsSchemaSource, trusted bool) *SettingsSchemaSource { - cstr := (*C.gchar)(C.CString(dir)) - defer C.free(unsafe.Pointer(cstr)) - - return wrapSettingsSchemaSource(C.g_settings_schema_source_new_from_directory(cstr, parent.native(), gbool(trusted), nil)) -} - -// Lookup() is a wrapper around g_settings_schema_source_lookup(). -func (v *SettingsSchemaSource) Lookup(schema string, recursive bool) *SettingsSchema { - cstr := (*C.gchar)(C.CString(schema)) - defer C.free(unsafe.Pointer(cstr)) - - return wrapSettingsSchema(C.g_settings_schema_source_lookup(v.native(), cstr, gbool(recursive))) -} - -// ListSchemas is a wrapper around g_settings_schema_source_list_schemas(). -func (v *SettingsSchemaSource) ListSchemas(recursive bool) (nonReolcatable, relocatable []string) { - var nonRel, rel **C.gchar - C.g_settings_schema_source_list_schemas(v.native(), gbool(recursive), &nonRel, &rel) - return toGoStringArray(nonRel), toGoStringArray(rel) -} diff --git a/vendor/github.com/gotk3/gotk3/glib/slist.go b/vendor/github.com/gotk3/gotk3/glib/slist.go deleted file mode 100644 index 134e682..0000000 --- a/vendor/github.com/gotk3/gotk3/glib/slist.go +++ /dev/null @@ -1,109 +0,0 @@ -package glib - -// #include <glib.h> -// #include <glib-object.h> -// #include "glib.go.h" -import "C" -import "unsafe" - -// SList is a representation of Glib's GSList. A SList must be manually freed -// by either calling Free() or FreeFull() -type SList struct { - list *C.struct__GSList -} - -func WrapSList(obj uintptr) *SList { - return wrapSList((*C.struct__GSList)(unsafe.Pointer(obj))) -} - -func wrapSList(obj *C.struct__GSList) *SList { - if obj == nil { - return nil - } - - //NOTE a list should be freed by calling either - //g_slist_free() or g_slist_free_full(). However, it's not possible to use a - //finalizer for this. - return &SList{obj} -} - -func (v *SList) Native() uintptr { - return uintptr(unsafe.Pointer(v.list)) -} - -func (v *SList) native() *C.struct__GSList { - if v == nil || v.list == nil { - return nil - } - return v.list -} - -func (v *SList) Append(data uintptr) *SList { - ret := C.g_slist_append(v.native(), C.gpointer(data)) - if ret == v.native() { - return v - } - - return wrapSList(ret) -} - -// Length is a wrapper around g_slist_length(). -func (v *SList) Length() uint { - return uint(C.g_slist_length(v.native())) -} - -// Next is a wrapper around the next struct field -func (v *SList) Next() *SList { - n := v.native() - if n == nil { - return nil - } - - return wrapSList(n.next) -} - -// Foreach acts the same as g_slist_foreach(). -// No user_data argument is implemented because of Go clojure capabilities. -func (v *SList) Foreach(fn func(ptr unsafe.Pointer)) { - for l := v; l != nil; l = l.Next() { - fn(unsafe.Pointer(l.native().data)) - } -} - -// Free is a wrapper around g_slist_free(). -func (v *SList) Free() { - C.g_slist_free(v.native()) - v.list = nil -} - -// FreeFull is a wrapper around g_slist_free_full(). -func (v *SList) FreeFull() { - //TODO implement GDestroyNotify callback - C.g_slist_free_full(v.native(), nil) - v.list = nil -} - -// GSList * g_slist_alloc () -// GSList * g_slist_prepend () -// GSList * g_slist_insert () -// GSList * g_slist_insert_before () -// GSList * g_slist_insert_sorted () -// GSList * g_slist_remove () -// GSList * g_slist_remove_link () -// GSList * g_slist_delete_link () -// GSList * g_slist_remove_all () -// void g_slist_free_1 () -// GSList * g_slist_copy () -// GSList * g_slist_copy_deep () -// GSList * g_slist_reverse () -// GSList * g_slist_insert_sorted_with_data () -// GSList * g_slist_sort () -// GSList * g_slist_sort_with_data () -// GSList * g_slist_concat () -// GSList * g_slist_last () -// GSList * g_slist_nth () -// gpointer g_slist_nth_data () -// GSList * g_slist_find () -// GSList * g_slist_find_custom () -// gint g_slist_position () -// gint g_slist_index () |