Skip to content

Commit

Permalink
Generate VariantType type and its methods.
Browse files Browse the repository at this point in the history
  • Loading branch information
pekim committed Dec 26, 2018
1 parent b1c37a0 commit 2d127ce
Show file tree
Hide file tree
Showing 18 changed files with 738 additions and 33 deletions.
1 change: 0 additions & 1 deletion internal/gir-files/GLib-2.0-addenda.gir
Original file line number Diff line number Diff line change
Expand Up @@ -121,6 +121,5 @@
<!-- the types in some method do not appear to match the data in gir file -->
<record blacklist="true" name="IConv"/>
<record blacklist="true" name="IOChannel"/>
<record blacklist="true" name="VariantType"/>
</namespace>
</repository>
51 changes: 49 additions & 2 deletions lib/gio/class-2.26.go
Original file line number Diff line number Diff line change
Expand Up @@ -423,7 +423,7 @@ func DBusConnectionNewSync(stream *IOStream, guid string, flags DBusConnectionFl
// g_dbus_connection_new_for_address : unsupported parameter callback : no type generator for AsyncReadyCallback (GAsyncReadyCallback) for param callback
// Unsupported : g_dbus_connection_add_filter : unsupported parameter filter_function : no type generator for DBusMessageFilterFunction (GDBusMessageFilterFunction) for param filter_function

// Unsupported : g_dbus_connection_call : unsupported parameter reply_type : Blacklisted record : GVariantType
// Unsupported : g_dbus_connection_call : unsupported parameter callback : no type generator for AsyncReadyCallback (GAsyncReadyCallback) for param callback

// CallFinish is a wrapper around the C function g_dbus_connection_call_finish.
func (recv *DBusConnection) CallFinish(res *AsyncResult) (*glib.Variant, error) {
Expand All @@ -445,7 +445,54 @@ func (recv *DBusConnection) CallFinish(res *AsyncResult) (*glib.Variant, error)
return retGo, goError
}

// Unsupported : g_dbus_connection_call_sync : unsupported parameter reply_type : Blacklisted record : GVariantType
// CallSync is a wrapper around the C function g_dbus_connection_call_sync.
func (recv *DBusConnection) CallSync(busName string, objectPath string, interfaceName string, methodName string, parameters *glib.Variant, replyType *glib.VariantType, flags DBusCallFlags, timeoutMsec int32, cancellable *Cancellable) (*glib.Variant, error) {
c_bus_name := C.CString(busName)
defer C.free(unsafe.Pointer(c_bus_name))

c_object_path := C.CString(objectPath)
defer C.free(unsafe.Pointer(c_object_path))

c_interface_name := C.CString(interfaceName)
defer C.free(unsafe.Pointer(c_interface_name))

c_method_name := C.CString(methodName)
defer C.free(unsafe.Pointer(c_method_name))

c_parameters := (*C.GVariant)(C.NULL)
if parameters != nil {
c_parameters = (*C.GVariant)(parameters.ToC())
}

c_reply_type := (*C.GVariantType)(C.NULL)
if replyType != nil {
c_reply_type = (*C.GVariantType)(replyType.ToC())
}

c_flags := (C.GDBusCallFlags)(flags)

c_timeout_msec := (C.gint)(timeoutMsec)

c_cancellable := (*C.GCancellable)(C.NULL)
if cancellable != nil {
c_cancellable = (*C.GCancellable)(cancellable.ToC())
}

var cThrowableError *C.GError

retC := C.g_dbus_connection_call_sync((*C.GDBusConnection)(recv.native), c_bus_name, c_object_path, c_interface_name, c_method_name, c_parameters, c_reply_type, c_flags, c_timeout_msec, c_cancellable, &cThrowableError)
retGo := glib.VariantNewFromC(unsafe.Pointer(retC))

var goError error = nil
if cThrowableError != nil {
goThrowableError := glib.ErrorNewFromC(unsafe.Pointer(cThrowableError))
goError = goThrowableError

C.g_error_free(cThrowableError)
}

return retGo, goError
}

// Unsupported : g_dbus_connection_close : unsupported parameter callback : no type generator for AsyncReadyCallback (GAsyncReadyCallback) for param callback

Expand Down
45 changes: 43 additions & 2 deletions lib/gio/class-2.28.go
Original file line number Diff line number Diff line change
Expand Up @@ -820,9 +820,50 @@ func simpleaction_activateHandler(_ *C.GObject, c_parameter *C.GVariant, data C.
callback(parameter)
}

// Unsupported : g_simple_action_new : unsupported parameter parameter_type : Blacklisted record : GVariantType
// SimpleActionNew is a wrapper around the C function g_simple_action_new.
func SimpleActionNew(name string, parameterType *glib.VariantType) *SimpleAction {
c_name := C.CString(name)
defer C.free(unsafe.Pointer(c_name))

c_parameter_type := (*C.GVariantType)(C.NULL)
if parameterType != nil {
c_parameter_type = (*C.GVariantType)(parameterType.ToC())
}

retC := C.g_simple_action_new(c_name, c_parameter_type)
retGo := SimpleActionNewFromC(unsafe.Pointer(retC))

if retC != nil {
C.g_object_unref((C.gpointer)(retC))
}

return retGo
}

// SimpleActionNewStateful is a wrapper around the C function g_simple_action_new_stateful.
func SimpleActionNewStateful(name string, parameterType *glib.VariantType, state *glib.Variant) *SimpleAction {
c_name := C.CString(name)
defer C.free(unsafe.Pointer(c_name))

c_parameter_type := (*C.GVariantType)(C.NULL)
if parameterType != nil {
c_parameter_type = (*C.GVariantType)(parameterType.ToC())
}

c_state := (*C.GVariant)(C.NULL)
if state != nil {
c_state = (*C.GVariant)(state.ToC())
}

retC := C.g_simple_action_new_stateful(c_name, c_parameter_type, c_state)
retGo := SimpleActionNewFromC(unsafe.Pointer(retC))

// Unsupported : g_simple_action_new_stateful : unsupported parameter parameter_type : Blacklisted record : GVariantType
if retC != nil {
C.g_object_unref((C.gpointer)(retC))
}

return retGo
}

// SetEnabled is a wrapper around the C function g_simple_action_set_enabled.
func (recv *SimpleAction) SetEnabled(enabled bool) {
Expand Down
60 changes: 58 additions & 2 deletions lib/gio/class-2.30.go
Original file line number Diff line number Diff line change
Expand Up @@ -37,7 +37,7 @@ import (
*/
import "C"

// Unsupported : g_dbus_connection_call_with_unix_fd_list : unsupported parameter reply_type : Blacklisted record : GVariantType
// Unsupported : g_dbus_connection_call_with_unix_fd_list : unsupported parameter callback : no type generator for AsyncReadyCallback (GAsyncReadyCallback) for param callback

// CallWithUnixFdListFinish is a wrapper around the C function g_dbus_connection_call_with_unix_fd_list_finish.
func (recv *DBusConnection) CallWithUnixFdListFinish(res *AsyncResult) (*glib.Variant, *UnixFDList, error) {
Expand All @@ -63,7 +63,63 @@ func (recv *DBusConnection) CallWithUnixFdListFinish(res *AsyncResult) (*glib.Va
return retGo, outFdList, goError
}

// Unsupported : g_dbus_connection_call_with_unix_fd_list_sync : unsupported parameter reply_type : Blacklisted record : GVariantType
// CallWithUnixFdListSync is a wrapper around the C function g_dbus_connection_call_with_unix_fd_list_sync.
func (recv *DBusConnection) CallWithUnixFdListSync(busName string, objectPath string, interfaceName string, methodName string, parameters *glib.Variant, replyType *glib.VariantType, flags DBusCallFlags, timeoutMsec int32, fdList *UnixFDList, cancellable *Cancellable) (*glib.Variant, *UnixFDList, error) {
c_bus_name := C.CString(busName)
defer C.free(unsafe.Pointer(c_bus_name))

c_object_path := C.CString(objectPath)
defer C.free(unsafe.Pointer(c_object_path))

c_interface_name := C.CString(interfaceName)
defer C.free(unsafe.Pointer(c_interface_name))

c_method_name := C.CString(methodName)
defer C.free(unsafe.Pointer(c_method_name))

c_parameters := (*C.GVariant)(C.NULL)
if parameters != nil {
c_parameters = (*C.GVariant)(parameters.ToC())
}

c_reply_type := (*C.GVariantType)(C.NULL)
if replyType != nil {
c_reply_type = (*C.GVariantType)(replyType.ToC())
}

c_flags := (C.GDBusCallFlags)(flags)

c_timeout_msec := (C.gint)(timeoutMsec)

c_fd_list := (*C.GUnixFDList)(C.NULL)
if fdList != nil {
c_fd_list = (*C.GUnixFDList)(fdList.ToC())
}

var c_out_fd_list *C.GUnixFDList

c_cancellable := (*C.GCancellable)(C.NULL)
if cancellable != nil {
c_cancellable = (*C.GCancellable)(cancellable.ToC())
}

var cThrowableError *C.GError

retC := C.g_dbus_connection_call_with_unix_fd_list_sync((*C.GDBusConnection)(recv.native), c_bus_name, c_object_path, c_interface_name, c_method_name, c_parameters, c_reply_type, c_flags, c_timeout_msec, c_fd_list, &c_out_fd_list, c_cancellable, &cThrowableError)
retGo := glib.VariantNewFromC(unsafe.Pointer(retC))

var goError error = nil
if cThrowableError != nil {
goThrowableError := glib.ErrorNewFromC(unsafe.Pointer(cThrowableError))
goError = goThrowableError

C.g_error_free(cThrowableError)
}

outFdList := UnixFDListNewFromC(unsafe.Pointer(c_out_fd_list))

return retGo, outFdList, goError
}

// DBusInterfaceSkeleton is a wrapper around the C record GDBusInterfaceSkeleton.
type DBusInterfaceSkeleton struct {
Expand Down
18 changes: 17 additions & 1 deletion lib/gio/class-2.32.go
Original file line number Diff line number Diff line change
Expand Up @@ -1206,7 +1206,23 @@ func (recv *MenuModel) GetItemAttribute(itemIndex int32, attribute string, forma
return retGo
}

// Unsupported : g_menu_model_get_item_attribute_value : unsupported parameter expected_type : Blacklisted record : GVariantType
// GetItemAttributeValue is a wrapper around the C function g_menu_model_get_item_attribute_value.
func (recv *MenuModel) GetItemAttributeValue(itemIndex int32, attribute string, expectedType *glib.VariantType) *glib.Variant {
c_item_index := (C.gint)(itemIndex)

c_attribute := C.CString(attribute)
defer C.free(unsafe.Pointer(c_attribute))

c_expected_type := (*C.GVariantType)(C.NULL)
if expectedType != nil {
c_expected_type = (*C.GVariantType)(expectedType.ToC())
}

retC := C.g_menu_model_get_item_attribute_value((*C.GMenuModel)(recv.native), c_item_index, c_attribute, c_expected_type)
retGo := glib.VariantNewFromC(unsafe.Pointer(retC))

return retGo
}

// GetItemLink is a wrapper around the C function g_menu_model_get_item_link.
func (recv *MenuModel) GetItemLink(itemIndex int32, link string) *MenuModel {
Expand Down
16 changes: 15 additions & 1 deletion lib/gio/class-2.34.go
Original file line number Diff line number Diff line change
Expand Up @@ -243,7 +243,21 @@ func (recv *MenuItem) GetAttribute(attribute string, formatString string, args .
return retGo
}

// Unsupported : g_menu_item_get_attribute_value : unsupported parameter expected_type : Blacklisted record : GVariantType
// GetAttributeValue is a wrapper around the C function g_menu_item_get_attribute_value.
func (recv *MenuItem) GetAttributeValue(attribute string, expectedType *glib.VariantType) *glib.Variant {
c_attribute := C.CString(attribute)
defer C.free(unsafe.Pointer(c_attribute))

c_expected_type := (*C.GVariantType)(C.NULL)
if expectedType != nil {
c_expected_type = (*C.GVariantType)(expectedType.ToC())
}

retC := C.g_menu_item_get_attribute_value((*C.GMenuItem)(recv.native), c_attribute, c_expected_type)
retGo := glib.VariantNewFromC(unsafe.Pointer(retC))

return retGo
}

// GetLink is a wrapper around the C function g_menu_item_get_link.
func (recv *MenuItem) GetLink(link string) *MenuModel {
Expand Down
18 changes: 17 additions & 1 deletion lib/gio/function-2.30.go
Original file line number Diff line number Diff line change
Expand Up @@ -26,7 +26,23 @@ import (
// #include <stdlib.h>
import "C"

// Unsupported : g_dbus_gvalue_to_gvariant : unsupported parameter type : Blacklisted record : GVariantType
// DbusGvalueToGvariant is a wrapper around the C function g_dbus_gvalue_to_gvariant.
func DbusGvalueToGvariant(gvalue *gobject.Value, type_ *glib.VariantType) *glib.Variant {
c_gvalue := (*C.GValue)(C.NULL)
if gvalue != nil {
c_gvalue = (*C.GValue)(gvalue.ToC())
}

c_type := (*C.GVariantType)(C.NULL)
if type_ != nil {
c_type = (*C.GVariantType)(type_.ToC())
}

retC := C.g_dbus_gvalue_to_gvariant(c_gvalue, c_type)
retGo := glib.VariantNewFromC(unsafe.Pointer(retC))

return retGo
}

// DbusGvariantToGvalue is a wrapper around the C function g_dbus_gvariant_to_gvalue.
func DbusGvariantToGvalue(value *glib.Variant) *gobject.Value {
Expand Down
58 changes: 54 additions & 4 deletions lib/gio/interface-2.28.go
Original file line number Diff line number Diff line change
Expand Up @@ -91,7 +91,18 @@ func (recv *Action) GetName() string {
return retGo
}

// Unsupported : g_action_get_parameter_type : return type : Blacklisted record : GVariantType
// GetParameterType is a wrapper around the C function g_action_get_parameter_type.
func (recv *Action) GetParameterType() *glib.VariantType {
retC := C.g_action_get_parameter_type((*C.GAction)(recv.native))
var retGo (*glib.VariantType)
if retC == nil {
retGo = nil
} else {
retGo = glib.VariantTypeNewFromC(unsafe.Pointer(retC))
}

return retGo
}

// GetState is a wrapper around the C function g_action_get_state.
func (recv *Action) GetState() *glib.Variant {
Expand All @@ -114,7 +125,18 @@ func (recv *Action) GetStateHint() *glib.Variant {
return retGo
}

// Unsupported : g_action_get_state_type : return type : Blacklisted record : GVariantType
// GetStateType is a wrapper around the C function g_action_get_state_type.
func (recv *Action) GetStateType() *glib.VariantType {
retC := C.g_action_get_state_type((*C.GAction)(recv.native))
var retGo (*glib.VariantType)
if retC == nil {
retGo = nil
} else {
retGo = glib.VariantTypeNewFromC(unsafe.Pointer(retC))
}

return retGo
}

type signalActionGroupActionAddedDetail struct {
callback ActionGroupSignalActionAddedCallback
Expand Down Expand Up @@ -457,7 +479,21 @@ func (recv *ActionGroup) GetActionEnabled(actionName string) bool {
return retGo
}

// Unsupported : g_action_group_get_action_parameter_type : return type : Blacklisted record : GVariantType
// GetActionParameterType is a wrapper around the C function g_action_group_get_action_parameter_type.
func (recv *ActionGroup) GetActionParameterType(actionName string) *glib.VariantType {
c_action_name := C.CString(actionName)
defer C.free(unsafe.Pointer(c_action_name))

retC := C.g_action_group_get_action_parameter_type((*C.GActionGroup)(recv.native), c_action_name)
var retGo (*glib.VariantType)
if retC == nil {
retGo = nil
} else {
retGo = glib.VariantTypeNewFromC(unsafe.Pointer(retC))
}

return retGo
}

// GetActionState is a wrapper around the C function g_action_group_get_action_state.
func (recv *ActionGroup) GetActionState(actionName string) *glib.Variant {
Expand Down Expand Up @@ -491,7 +527,21 @@ func (recv *ActionGroup) GetActionStateHint(actionName string) *glib.Variant {
return retGo
}

// Unsupported : g_action_group_get_action_state_type : return type : Blacklisted record : GVariantType
// GetActionStateType is a wrapper around the C function g_action_group_get_action_state_type.
func (recv *ActionGroup) GetActionStateType(actionName string) *glib.VariantType {
c_action_name := C.CString(actionName)
defer C.free(unsafe.Pointer(c_action_name))

retC := C.g_action_group_get_action_state_type((*C.GActionGroup)(recv.native), c_action_name)
var retGo (*glib.VariantType)
if retC == nil {
retGo = nil
} else {
retGo = glib.VariantTypeNewFromC(unsafe.Pointer(retC))
}

return retGo
}

// HasAction is a wrapper around the C function g_action_group_has_action.
func (recv *ActionGroup) HasAction(actionName string) bool {
Expand Down
31 changes: 30 additions & 1 deletion lib/gio/interface-2.32.go
Original file line number Diff line number Diff line change
Expand Up @@ -25,7 +25,36 @@ import (
// #include <stdlib.h>
import "C"

// Unsupported : g_action_group_query_action : unsupported parameter parameter_type : Blacklisted record : GVariantType
// QueryAction is a wrapper around the C function g_action_group_query_action.
func (recv *ActionGroup) QueryAction(actionName string) (bool, bool, *glib.VariantType, *glib.VariantType, *glib.Variant, *glib.Variant) {
c_action_name := C.CString(actionName)
defer C.free(unsafe.Pointer(c_action_name))

var c_enabled C.gboolean

var c_parameter_type *C.GVariantType

var c_state_type *C.GVariantType

var c_state_hint *C.GVariant

var c_state *C.GVariant

retC := C.g_action_group_query_action((*C.GActionGroup)(recv.native), c_action_name, &c_enabled, &c_parameter_type, &c_state_type, &c_state_hint, &c_state)
retGo := retC == C.TRUE

enabled := c_enabled == C.TRUE

parameterType := glib.VariantTypeNewFromC(unsafe.Pointer(c_parameter_type))

stateType := glib.VariantTypeNewFromC(unsafe.Pointer(c_state_type))

stateHint := glib.VariantNewFromC(unsafe.Pointer(c_state_hint))

state := glib.VariantNewFromC(unsafe.Pointer(c_state))

return retGo, enabled, parameterType, stateType, stateHint, state
}

// AddAction is a wrapper around the C function g_action_map_add_action.
func (recv *ActionMap) AddAction(action *Action) {
Expand Down
Loading

0 comments on commit 2d127ce

Please sign in to comment.