-
Notifications
You must be signed in to change notification settings - Fork 4
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
37 changed files
with
1,130 additions
and
15 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,28 @@ | ||
package sn.gnome.glib.fluent | ||
|
||
import sn.gnome.glib.internal.{GQuark, GError, g_error_free} | ||
import scala.scalanative.unsafe.* | ||
|
||
enum GResult[+A]: | ||
case Error(domain: GQuark, code: Int, message: String) | ||
case Ok(value: A) | ||
|
||
object GResult: | ||
inline def wrap[A](inline f: Ptr[Ptr[GError]] => A): GResult[A] = | ||
val st = stackalloc[Ptr[GError]]() | ||
val raw = f(st) | ||
val errorPtr = !st | ||
|
||
if errorPtr != null then | ||
val err = !errorPtr | ||
val result = GResult.Error( | ||
err.domain, | ||
err.code.value, | ||
fromCString(err.message.asInstanceOf[CString]) | ||
) | ||
g_error_free(errorPtr) | ||
result | ||
else Ok(raw) | ||
end if | ||
end wrap | ||
end GResult |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,43 @@ | ||
package sn.gnome.gobject.fluent | ||
|
||
import _root_.sn.gnome.gobject.internal.* | ||
|
||
import _root_.scala.scalanative.unsafe.* | ||
|
||
import sn.gnome.glib.internal.gchar | ||
import sn.gnome.gobject.fluent.Object | ||
import sn.gnome.gobject.internal.GBinding | ||
import sn.gnome.gobject.internal.GBindingFlags | ||
|
||
class Binding(raw: Ptr[GBinding]) extends Object(raw.asInstanceOf): | ||
override def getUnsafeRawPointer(): Ptr[Byte] = this.raw.asInstanceOf | ||
|
||
def dupSource(): Object = new Object( | ||
g_binding_dup_source(this.raw.asInstanceOf).asInstanceOf | ||
) | ||
|
||
def dupTarget(): Object = new Object( | ||
g_binding_dup_target(this.raw.asInstanceOf).asInstanceOf | ||
) | ||
|
||
def getFlags(): GBindingFlags = g_binding_get_flags(this.raw.asInstanceOf) | ||
|
||
def getSource(): Object = new Object( | ||
g_binding_get_source(this.raw.asInstanceOf).asInstanceOf | ||
) | ||
|
||
def getSourceProperty()(using Zone): String = fromCString( | ||
g_binding_get_source_property(this.raw.asInstanceOf).asInstanceOf | ||
) | ||
|
||
def getTarget(): Object = new Object( | ||
g_binding_get_target(this.raw.asInstanceOf).asInstanceOf | ||
) | ||
|
||
def getTargetProperty()(using Zone): String = fromCString( | ||
g_binding_get_target_property(this.raw.asInstanceOf).asInstanceOf | ||
) | ||
|
||
def unbind(): Unit = g_binding_unbind(this.raw.asInstanceOf) | ||
|
||
end Binding |
93 changes: 93 additions & 0 deletions
93
gobject/src/main/scala/generated/fluent/BindingGroup.scala
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,93 @@ | ||
package sn.gnome.gobject.fluent | ||
|
||
import _root_.sn.gnome.gobject.internal.* | ||
|
||
import _root_.scala.scalanative.unsafe.* | ||
|
||
import sn.gnome.glib.internal.GDestroyNotify | ||
import sn.gnome.glib.internal.gchar | ||
import sn.gnome.glib.internal.gpointer | ||
import sn.gnome.gobject.fluent.Object | ||
import sn.gnome.gobject.internal.GBindingFlags | ||
import sn.gnome.gobject.internal.GBindingGroup | ||
import sn.gnome.gobject.internal.GBindingTransformFunc | ||
import sn.gnome.gobject.internal.GClosure | ||
|
||
class BindingGroup(raw: Ptr[GBindingGroup]) extends Object(raw.asInstanceOf): | ||
override def getUnsafeRawPointer(): Ptr[Byte] = this.raw.asInstanceOf | ||
|
||
def bind( | ||
source_property: String | CString, | ||
target: Object, | ||
target_property: String | CString, | ||
flags: GBindingFlags | ||
)(using Zone): Unit = g_binding_group_bind( | ||
this.raw.asInstanceOf, | ||
__sn_extract_string(source_property).asInstanceOf[Ptr[gchar]], | ||
gpointer(target.getUnsafeRawPointer().asInstanceOf.asInstanceOf[Ptr[Byte]]), | ||
__sn_extract_string(target_property).asInstanceOf[Ptr[gchar]], | ||
flags | ||
) | ||
|
||
def bindFull( | ||
source_property: String | CString, | ||
target: Object, | ||
target_property: String | CString, | ||
flags: GBindingFlags, | ||
transform_to: GBindingTransformFunc, | ||
transform_from: GBindingTransformFunc, | ||
user_data: Ptr[Byte], | ||
user_data_destroy: GDestroyNotify | ||
)(using Zone): Unit = g_binding_group_bind_full( | ||
this.raw.asInstanceOf, | ||
__sn_extract_string(source_property).asInstanceOf[Ptr[gchar]], | ||
gpointer(target.getUnsafeRawPointer().asInstanceOf.asInstanceOf[Ptr[Byte]]), | ||
__sn_extract_string(target_property).asInstanceOf[Ptr[gchar]], | ||
flags, | ||
transform_to, | ||
transform_from, | ||
gpointer(user_data), | ||
user_data_destroy | ||
) | ||
|
||
def bindWithClosures( | ||
source_property: String | CString, | ||
target: Object, | ||
target_property: String | CString, | ||
flags: GBindingFlags, | ||
transform_to: Ptr[GClosure], | ||
transform_from: Ptr[GClosure] | ||
)(using Zone): Unit = g_binding_group_bind_with_closures( | ||
this.raw.asInstanceOf, | ||
__sn_extract_string(source_property).asInstanceOf[Ptr[gchar]], | ||
gpointer(target.getUnsafeRawPointer().asInstanceOf.asInstanceOf[Ptr[Byte]]), | ||
__sn_extract_string(target_property).asInstanceOf[Ptr[gchar]], | ||
flags, | ||
transform_to, | ||
transform_from | ||
) | ||
|
||
def dupSource(): Object = new Object( | ||
g_binding_group_dup_source(this.raw.asInstanceOf).asInstanceOf | ||
) | ||
|
||
def setSource(source: Object): Unit = g_binding_group_set_source( | ||
this.raw.asInstanceOf, | ||
gpointer(source.getUnsafeRawPointer().asInstanceOf.asInstanceOf[Ptr[Byte]]) | ||
) | ||
|
||
private inline def __sn_extract_string(str: String | CString)(using | ||
Zone | ||
): CString = | ||
str match | ||
case s: String => toCString(s) | ||
case s: CString => s | ||
end match | ||
end __sn_extract_string | ||
end BindingGroup | ||
|
||
object BindingGroup: | ||
def apply(): BindingGroup = new BindingGroup( | ||
g_binding_group_new().asInstanceOf | ||
) | ||
end BindingGroup |
14 changes: 14 additions & 0 deletions
14
gobject/src/main/scala/generated/fluent/InitiallyUnowned.scala
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,14 @@ | ||
package sn.gnome.gobject.fluent | ||
|
||
import _root_.sn.gnome.gobject.internal.* | ||
|
||
import _root_.scala.scalanative.unsafe.* | ||
|
||
import sn.gnome.gobject.fluent.Object | ||
import sn.gnome.gobject.internal.GInitiallyUnowned | ||
|
||
class InitiallyUnowned(raw: Ptr[GInitiallyUnowned]) | ||
extends Object(raw.asInstanceOf): | ||
override def getUnsafeRawPointer(): Ptr[Byte] = this.raw.asInstanceOf | ||
|
||
end InitiallyUnowned |
Oops, something went wrong.