// Package gio was automatically generated by github.com/bnema/puregotk DO NOT EDIT package gio import ( "structs" "unsafe" "github.com/ebitengine/purego" "github.com/bnema/puregotk/pkg/core" "github.com/bnema/puregotk/v4/gobject" "github.com/bnema/puregotk/v4/gobject/types" ) type TcpConnectionClass struct { _ structs.HostLayout ParentClass SocketConnectionClass } func (x *TcpConnectionClass) GoPointer() uintptr { return uintptr(unsafe.Pointer(x)) } type TcpConnectionPrivate struct { _ structs.HostLayout } func (x *TcpConnectionPrivate) GoPointer() uintptr { return uintptr(unsafe.Pointer(x)) } // This is the subclass of [class@Gio.SocketConnection] that is created // for TCP/IP sockets. type TcpConnection struct { SocketConnection } var xTcpConnectionGLibType func() types.GType func TcpConnectionGLibType() types.GType { return xTcpConnectionGLibType() } func TcpConnectionNewFromInternalPtr(ptr uintptr) *TcpConnection { cls := &TcpConnection{} cls.Ptr = ptr return cls } var xTcpConnectionGetGracefulDisconnect func(uintptr) bool // Checks if graceful disconnects are used. See // g_tcp_connection_set_graceful_disconnect(). func (x *TcpConnection) GetGracefulDisconnect() bool { cret := xTcpConnectionGetGracefulDisconnect(x.GoPointer()) return cret } var xTcpConnectionSetGracefulDisconnect func(uintptr, bool) // This enables graceful disconnects on close. A graceful disconnect // means that we signal the receiving end that the connection is terminated // and wait for it to close the connection before closing the connection. // // A graceful disconnect means that we can be sure that we successfully sent // all the outstanding data to the other end, or get an error reported. // However, it also means we have to wait for all the data to reach the // other side and for it to acknowledge this by closing the socket, which may // take a while. For this reason it is disabled by default. func (x *TcpConnection) SetGracefulDisconnect(GracefulDisconnectVar bool) { xTcpConnectionSetGracefulDisconnect(x.GoPointer(), GracefulDisconnectVar) } func (c *TcpConnection) GoPointer() uintptr { if c == nil { return 0 } return c.Ptr } func (c *TcpConnection) SetGoPointer(ptr uintptr) { c.Ptr = ptr } // SetPropertyGracefulDisconnect sets the "graceful-disconnect" property. // Whether [method@Gio.IOStream.close] does a graceful disconnect. func (x *TcpConnection) SetPropertyGracefulDisconnect(value bool) { var v gobject.Value v.Init(gobject.TypeBooleanVal) v.SetBoolean(value) x.SetProperty("graceful-disconnect", &v) } // GetPropertyGracefulDisconnect gets the "graceful-disconnect" property. // Whether [method@Gio.IOStream.close] does a graceful disconnect. func (x *TcpConnection) GetPropertyGracefulDisconnect() bool { var v gobject.Value x.GetProperty("graceful-disconnect", &v) return v.GetBoolean() } func init() { core.SetPackageName("GIO", "gio-2.0") core.SetSharedLibraries("GIO", []string{"libgio-2.0.so.0"}) var libs []uintptr for _, libPath := range core.GetPaths("GIO") { lib, err := purego.Dlopen(libPath, purego.RTLD_NOW|purego.RTLD_GLOBAL) if err != nil { panic(err) } libs = append(libs, lib) } core.PuregoSafeRegister(&xTcpConnectionGLibType, libs, "g_tcp_connection_get_type") core.PuregoSafeRegister(&xTcpConnectionGetGracefulDisconnect, libs, "g_tcp_connection_get_graceful_disconnect") core.PuregoSafeRegister(&xTcpConnectionSetGracefulDisconnect, libs, "g_tcp_connection_set_graceful_disconnect") }