Skip to content

Releases: gircore/gir.core

0.8.0-preview.1

12 Mar 17:26
a1ff833

Choose a tag to compare

0.8.0-preview.1 Pre-release
Pre-release

This release is the first preview of the upcoming 0.8.0 release. To get an overview of the planned features of the 0.8.0 release please see the corresponding milestone.

Important
This release includes GTK composite support which is a major milestone for the GirCore project. To reach this goal there were some breaking changes necessary. Those mainly affect the usage of Gtk.Builder, the creation of subclasses and to a lesser extent the creation of native classes. In total those changes are a first step to allow deeper integration with the GObject type system.

The API was held as backwards compatible as possible. Warnings are raised for APIs which will be removed in a later release (0.9.0). Please read ahead carefully to get an overview of the breaking changes and how to resolve them.

As the deeper GObject integration required modifications in the memory management code, there might be memory related bugs. If anything comes up please open an issue.

Noteworthy

  • Feature: Composite template support, details below (#1405, #1395, #1425, #1419, #1442, #1437, #1455, #1466)
  • Feature: New GdkWayland-4.0 nuget packages (#1423)
  • Feature: out / ref enums are now supported (#1459)
  • Feature: out opaque typed records are now supported (#1463)
  • Sample: New dropdown sample (#1428)
  • Sample: New async-UI sample (#1461)

Breaking changes

The following sections describe the breaking changes and how to solve them. A more detailed explanation why the breaking changes are necessary can be found in the explanation of the diagnostic message 1007. Issue 1441 describes the available feature set between versions.

Instance creation

Since the beginning of GirCore constructors of GObjects were rendered as static factory methods. There is one exception: It is possible to create instances with a parameterless constructor or an array of ConstructArgument. As GObject itself expects all objects to be creatable without a parameterized class specific constructor this public constructor will be marked as obsolete and a new factory method will be rendered as an alternative. This means the API is not yet removed but its usage is discouraged as the deeper integration with GObject requires a workaround to make it work.

var obj = new MyObject(); // GirCore 1007 warning
var obj = new MyObject([]); // GirCore 1007 warning
var obj = MyObject.NewWithProperties([]); //No warning

Subclasses

To make subclasses work they will rely on source generators to integrate dotnet deeply with the GObject type system. This requires some unsafe code to be rendered as C will call directly into dotnet code. For this to work projects using GObject based subclasses must set <AllowUnsafeBlocks>true</AllowUnsafeBlocks> in their csproj files.

The creation of subclasses includes several scenarios. The classic dotnet way of subclassing via a parent parameterless constructor now raises a warning. Please note that the Initialize method is called always if an instance of the subclass is created. Even if the instance is created by the GObject type system itself. Therefore it is safe to mark the member _value as not null.

public class MyObject : GObject.Object
{
    private string _value;

    public MyObject() // GirCore 1007 warning
    {
        _value = "test";
    }
} 

[GObject.Subclass<GObject.Object>]
public partial class MyObject
{
    private string _value;

    [MemberNotNull(nameof(_value))]
    partial void Initialize() // No warning
    {
        _value = "test";
    } 
}

For code that uses parameterized constructors without the GObject.SubclassAttribute a warning is emitted. Please note that _value got nullable in the reworked code. This is a direct result from the deeper GObject integration as GObject requires objects to be creatable without any explicit parameterized constructor.

public class MyObject : GObject.Object
{
    private string _value;

    public MyObject(string value)  // GirCore 1007 warning
    {
        _value = value;
    }
}

[GObject.Subclass<GObject.Object>]
public partial class MyObject
{
    private string? _value;
    
    public static MyObject NewWithValue(string value) // No warning
    {
        var obj = MyObject.NewWithProperties([]);
        obj._value = value;

        return obj;
    }
}

Code that already used the GObject.SubclassAttribute with a parameterized constructor must migrate as this() is not available anymore.

//Emits a compiler error
[GObject.Subclass<GObject.Object>]
public partial class MyObject
{
    private string _value;
    
    public MyObject(string value) : this()
    {
        _value = value;
    }
}

//Emits no compiler error, uses a static factory method
[GObject.Subclass<GObject.Object>]
public partial class MyObject
{
    private string? _value;
    
    public static MyObject NewWithValue(string value)
    {
        var obj = MyObject.NewWithProperties([]);
        obj._value = value;

        return obj;
    }
}

Gtk.Builder and composite templates

To create some Gtk UI based on XML templates GirCore used Gtk.Builder. The user was required to inject instances created by Gtk.Builder into the dependency chain with some internal code needed to make it work at all. The deeper integration with the GObject type system in combination with composite template support allows to write UI classes like they should be.

Any Gtk.Builder based view classes must be migrated as the deeper type system integration does not support injecting arbitrary pointers without resulting memory management issues. Additionally Gtk.Builder implementation in GirCore does not connect members anymore. It is just doing what it was intended for: Creating Gtk.Widget hierarchies from a given XML file. The composite template support is a replacement for the original advertised workaround to mimic composite template like behaviour with Gtk.Builder.

Please note that the Gtk.Label in the composite sample must not be marked as nullable. The Gtk.Connect attributes tells the source generator that the member will be initialized by the template so it generates the MemberNotNullAttribute automatically in the background.

Another improvement over the Gtk.Builder variant is that Gtk.Template allows to specify a Gtk.TemplateLoader. Gtk.AssemblyResource is a Gtk.TemplateLoader which expects template files to be available as a dotnet assembly resource. By implementing a custom Gtk.TemplateLoader it is possible to load composite templates from any location.

Gtk.Subclass gained a new optional prameter: qualifiedName. This allows to specify the native name of the subclass. It makes it easier to reference the class in template files. If no qualifiedName is supplied the generated native class name is [namespace].[classname]. If the qualifiedName is set the generated native class name is [qualifiedName].

For a complete working sample of composite widgets please see the samples in the repository.

// Old Gtk.Builder way
public class SampleTestDialog : Gtk.Dialog
{
    [Gtk.Connect("my_label")]
    private readonly Gtk.Label _label;

    private SampleTestDialog(Gtk.Builder builder, string name) : base(new Gtk.Internal.DialogHandle(builder.GetPointer(name), false))
    {
        builder.Connect(this);
        _label.Label_ = "With support for connected members!";
    }

    public SampleTestDialog() : this(new Gtk.Builder("SampleTestDialog.ui"), "dialog")
    {
    }
}

//New Gtk composite templates
[GObject.Subclass<Gtk.Dialog>(qualifiedName: nameof(SampleTestDialog))]
[Gtk.Template<Gtk.AssemblyResource>("SampleTestDialog.ui")]
public partial class SampleTestDialog
{
    [Gtk.Connect("my_label")]
    private Gtk.Label _label;

    partial void Initialize()
    {
        _label.Label_ = "With support for connected members!";
    }
}

That's all for 0.8.0-preview.1. A big thanks goes to all contributors which made this release possible through code contributions and providing feedback through issues or the matrix channel.

What's Changed

Read more

0.7.0

18 Dec 08:35
dce3253

Choose a tag to compare

This is the first release of 0.7.0.

Please be aware that there are some breaking changes:

  • Due to improved API generation string[] parameters may not need an explicit size parameter anymore.
  • Gst.Application.Init was removed. Gstreamer does not provide an Application class. This was a relict from the very beginning of the project and was a result of missing binding for gst_init which is now available as Gst.Functions.Init.

There is a new ecosystem page on the homepage. Anyone interested in promoting their GirCore related library is welcome to open a pull request.

Noteworthy

Since 0.7.0-preview.3

  • Fix: Gtk.FontDialog.ChooseFaceAsync (#1350)
  • Fix: InvalidCastException on certain APIs (#1331)
  • Feature: Improved Glib.PtrArray support (#1349, #1361) thanks @alansartorio
  • Feature: Dotnet 10 support (#1370 based on work from @kashifsoofi)
  • Feature: Bindings for GdkWin32 (#1359)
  • Feature: Add Gtk.CustomSorter.New<T> as a generic variant of Gtk.CustomSorter.New. See samples for usage (#1375)
  • Fix + Feature: Improved generation of native non null termainted string arrays. The public API does not require a length parameter anymore as the length is determined automatically. This changes allows to generate more string array related APIs. (#1379)

0.7.0-preview.3

  • Feature: Add support for the GNOME 49 SDK including GTK 4.20 and libadwaita 1.8.
  • Fix: Properties of type Long are now always working as expected (#1311)
  • Feature: First steps to improve support for native GLib.SList. See the unit tests for example usage (#1317)
  • Feature: New Pango methods and constants which are not available in the GIR file (#1320, #1321)
  • Feature: Allow a Cairo.ImageSurface to be directly created from GLib.Bytes (#1322)

0.7.0-preview.2

  • Signals which are part of an interface are now available in the bindings (#1302).
  • A new convenience function to retrieve a GLib.Bytes region as ReadOnlySpan (#1306).
  • Thanks to @czirok for adding bindings for librsvg (#1263).
  • Thanks to @toomasz for adding bindings for GstApp which is part of GStreamer (#1276).
  • Thanks to @AeonLucid for contributing support for callbacks which are nested in classes (#1290).
  • Thanks to @UrtsiSantsi and @kashifsoofi for their ongoing support of the project.

0.7.0-preview.1

  • Update to GNOME 48 which includes GTK 4.18 and libadwaita 1.7 (#1237).
  • Bindings for libsecret are now available as a nuget package (#1236).
  • The gir.core SynchronizationContext now implements the Send method allowing users to dispatch actions into the main thread (#1222).
  • Several bug fixes and improvements in regard to closures and signal handling (#1238, #1247, #1248)
  • A bug fix which allows to properly set uint64 based properties (#1259).

What's Changed

Read more

0.7.0-preview.3

04 Nov 20:56
f15dc08

Choose a tag to compare

0.7.0-preview.3 Pre-release
Pre-release

This release is the third preview of the upcoming 0.7.0 release. To get an overview of the planned features of the 0.7.0 release please see the corresponding milestone.

This release adds support for the GNOME 49 SDK including GTK 4.20 and libadwaita 1.8.

Noteworthy

  • Fix: Properties of type Long are now always working as expected (#1311)
  • Feature: First steps to improve support for native GLib.SList. See the unit tests for example usage (#1317)
  • Feature: New Pango methods and constants which are not available in the GIR file (#1320, #1321)
  • Feature: Allow a Cairo.ImageSurface to be directly created from GLib.Bytes (#1322)

What's Changed

  • Rename existing Long-Testers by @badcel in #1309
  • Rename long tester by @badcel in #1312
  • Properly support Long / ULong / Int64 / UInt64 properties by @badcel in #1311
  • Add GObject.Object to generic type constraint of instance factory/wrapper by @ousnius in #1316
  • GLib.SList: Add IEnumerable and related extensions by @ousnius in #1317
  • Add Pango CSS scale factor constants by @ousnius in #1321
  • Fix typo in exception for TypedRecord ParameterConverter by @ousnius in #1323
  • Add Pango unit conversion/rounding functions from C function macros by @ousnius in #1320
  • Generate methods with typed records as out parameter (non-nullable, no transfer) by @ousnius in #1324
  • Cairo: Support ImageSurface for data by @badcel in #1322
  • Bump AwesomeAssertions from 9.1.0 to 9.2.0 by @dependabot[bot] in #1326
  • Bump actions/checkout from 4 to 5 by @dependabot[bot] in #1300
  • Bump AwesomeAssertions from 9.2.0 to 9.2.1 by @dependabot[bot] in #1333
  • Update to GNOME 49 by @badcel in #1336

New Contributors

Full Changelog: 0.7.0-preview.2...0.7.0-preview.3

0.7.0-preview.2

23 Aug 19:36
a70b1f3

Choose a tag to compare

0.7.0-preview.2 Pre-release
Pre-release

This release is the second preview of the upcoming 0.7.0 release. To get an overview of the planned features of the 0.7.0 release please see the corresponding milestone.

Noteworthy

  • Signals which are part of an interface are now available in the bindings (#1302).
  • A new convenience function to retrieve a GLib.Bytes region as ReadOnlySpan (#1306).
  • Thanks to @czirok for adding bindings for librsvg (#1263).
  • Thanks to @toomasz for adding bindings for GstApp which is part of GStreamer (#1276).
  • Thanks to @AeonLucid for contributing support for callbacks which are nested in classes (#1290).
  • Thanks to @UrtsiSantsi and @kashifsoofi for their ongoing support of the project.

What's Changed

New Contributors

Full Changelog: 0.7.0-preview.1...0.7.0-preview.2

0.7.0-preview.1

26 May 19:57
c7b3fea

Choose a tag to compare

0.7.0-preview.1 Pre-release
Pre-release

This release is the first preview of the upcoming 0.7.0 release. To get an overview of the planned features of the 0.7.0 release please see the corresponding milestone.

Noteworthy

  • Update to GNOME 48 which includes GTK 4.18 and libadwaita 1.7 (#1237).
  • Bindings for libsecret are now available as a nuget package (#1236).
  • The gir.core SynchronizationContext now implements the Send method allowing users to dispatch actions into the main thread (#1222).
  • Several bug fixes and improvements in regard to closures and signal handling (#1238, #1247, #1248)
  • A bug fix which allows to properly set uint64 based properties (#1259).

What's Changed

New Contributors

Full Changelog: 0.6.3...0.7.0-preview.1

0.6.3

26 Feb 21:23
41992a3

Choose a tag to compare

This is a follow up release to 0.6.2. This release adds some missing bits to GObject-2.0.Integration, adds IDisposable support on interfaces and fixes a bug in several async methods.

Noteworthy

  • GObject-2.0.Integration: Subclassing now supports global namespaces (#1188)
  • GObject-2.0.Integration: Generates a partial Initialize() method to allow custom initialization of an object no matter if it is created by dotnet or C code. (#1189). See the Gridview-Sample to see how to use the new method.
  • Several GTK async methods now support a nullable parent window (#1199)
  • Interfaces implement IDisposable (#1203)

What's Changed

New Contributors

Full Changelog: 0.6.2...0.6.3

0.6.2

09 Feb 13:46
2398542

Choose a tag to compare

This is a follow up release to preview.1. Please be aware that this release includes several breaking changes.

The release 0.6.0 / 0.6.1 were skipped as there were problems with the publishing of the nugets:

  • For 0.6.0 the new GObject-2.0.Integration package had an empty symbol package which resulted in an upload error.
  • For 0.6.1 there were nuget packages created for the tutorial projects which were missing nuget informations thus resulting in an upload error.

The partially uploaded packages got unlisted. This is the reason why this release has the version number 0.6.2.

Noteworthy

Since 0.6.0-preview.1

  • Support for .NET 9.0 added. Support for .NET 6.0 and .NET 7.0 got removed.
  • Rework of the GObject.Object instantiation process. Those changes remove the reflection code for object instantiation and subclassing. This brings NativeAOT support a lot closer.
  • Internal: Support individual SafeHandles for classes allowing to report native memory consumption. This improves the garbage collection behavior of the dotnet runtime as classes like Gdk.Pixbuf tend to reference large portions of native memory.

0.6.0-preview.1

  • Update to GNOME 47 which includes GTK 4.16 and libadwaita 1.6.
  • The dummy implementation of INotifyPropertyChanged on GObject.Object was removed.
  • Propertydefinitions have a new Notify / Unnotifymethod which simplifies registration for property specific notifications. For details see the FAQ.
  • The size of the C long datatype on windows is now always 32 bit. On unix it corresponds to 64 / 32 bit depending on the system architecture. In earlier releases it was always 64 bit which was only correct for 64 bit unix systems.
  • The size of C gsize is now equivalent to nint. In earlier releases it was equal to long which was wrong on 32 bit based systems.
  • Fixed implementation of the memory pressure feature of records. In earlier releases memory pressure was only removed if Dispose was called. Now memory pressure is released automatically for records. The feature is not yet implemented for classes and will be part the full 0.6.0 release.
  • First steps to publish the GirCore generator as a dotnet tool.

Breaking changes

Changed public APIs

  • Obsolete interface GLib.IHandle got removed
  • Obsolete interface GObject.IObject got removed
  • GObject.Object new primary constructor requires a ObjectHandle. protected constructors using ConstructArgument[] or IntPtr got removed.
  • GObject.Object method protected virtual void Initialize() got removed. To execute instance initialization either use a custom constructor or custom ObjectHandle.
  • GdkPixbuf.PixbufLoader.FromBytes got removed as it was a purely cosmetic helper function which is not available as native code. The following code shows the corresponding code to recreate the original behavior:
using var bytes = Bytes.New(data);
var pixbufLoader = PixbufLoader.New();
pixbufLoader.WriteBytes(bytes);
pixbufLoader.Close();

var pixbuf = pixbufLoader.GetPixbuf()  ?? throw new Exception("No pixbuf loaded");

Subclass changes

To implement reflection free instantiation and subclassing the data which the reflection based code retrieved during runtime must be available during compile time to register the class with the GObject typesystem. This is done automatically for all classes which are part of the GirCore nuget packages. If custom classes inherit from some GObject.Object this code must be written otherwise the new class is not properly registered with the GObject typesystem.

The boiler plate code needed to properly register a class can be completly avoided if the new nuget package GObject-2.0.Integration is used. This package provides a source generator which generates the needed code if the SubclassAttribute is set on the custom GObject subclass. Please see the following sample and refer to the FAQ:

[Subclass<GObject.Object>]
public partial class Data
{
    public string? MyString { get; set; }

    public Data(string myString) : this()
    {
        MyString = myString;
    }
}

What's Changed

New Contributors

Full Changelog: 0.5.0...0.6.2

0.6.0-preview.1

07 Nov 20:33
ead37a8

Choose a tag to compare

0.6.0-preview.1 Pre-release
Pre-release

This release is the first preview of the upcoming 0.6.0 release. To get an overview of the planned features of the 0.6.0 release please see the corresponding milestone.

Noteworthy

  • Update to GNOME 47 which includes GTK 4.16 and libadwaita 1.6.
  • The dummy implementation of INotifyPropertyChanged on GObject.Object was removed.
  • Propertydefinitions have a new Notify / Unnotifymethod which simplifies registration for property specific notifications. For details see the FAQ.
  • The size of the C long datatype on windows is now always 32 bit. On unix it corresponds to 64 / 32 bit depending on the system architecture. In earlier releases it was always 64 bit which was only correct for 64 bit unix systems.
  • The size of C gsize is now equivalent to nint. In earlier releases it was equal to long which was wrong on 32 bit based systems.
  • Fixed implementation of the memory pressure feature of records. In earlier releases memory pressure was only removed if Dispose was called. Now memory pressure is released automatically for records. The feature is not yet implemented for classes and will be part the full 0.6.0 release.
  • First steps to publish the GirCore generator as a dotnet tool.

What's Changed

  • Remove INotifyPropertyChanged by @badcel in #1061
  • Property: Add Notify / Unnotify methods by @badcel in #1062
  • Improve long handling for structs by @badcel in #1065
  • Remove duplicate semicolon in return statements by @adamreeve in #1068
  • Map "gssize" to native integers by @badcel in #1069
  • Improve long handling 2 by @badcel in #1067
  • Add nullable annotation to nullable string array parameters in internal methods by @adamreeve in #1079
  • Disable rendering code for repositories only required via includes by @adamreeve in #1086
  • documenting System.DllNotFoundException troubleshooting by @lamg in #1085
  • Improve struct freeing by @badcel in #1072
  • Improve logging by @badcel in #1093
  • Support loading repositories from files embedded as resources in GirTool by @adamreeve in #1091
  • Readme: Update status by @badcel in #1096
  • Generator: Support opaque typed records with copy / free annotations by @badcel in #1088
  • Support copy annotation typed records by @badcel in #1103
  • Add new modifier to class methods that hide base class methods by @adamreeve in #1097
  • Add DBus sample to read desktop appearance color scheme by @badcel in #1110
  • Foreign typed records: Implement IDisposable by @badcel in #1112
  • Foreign typed records: Require to implement a handle release manually by @badcel in #1113
  • Opaque typed records: Support adding memory pressure by @badcel in #1114
  • ImageSurface: Support memory pressure by @badcel in #1115
  • GObject.Type: Mark struct as readonly and make it a record by @badcel in #1117
  • Improve alias support by @badcel in #1119
  • GObject.Type: Add IsFundamental method by @badcel in #1123
  • Differentiate between Long and CLong by @badcel in #1126
  • Object: Fix ToggleNotify called after callback is disposed by @badcel in #1128
  • Update gir files by @badcel in #1132
  • Refactor GdkPixbuf-2.0.Tests by @badcel in #1133
  • Update macos runner to version 14 by @badcel in #1134

New Contributors

Full Changelog: 0.5.0...0.6.0-preview.1

0.5.0

08 May 19:18
386b22a

Choose a tag to compare

This release is the final version of the 0.5.0 release. This is a follow up release to preview.4.

Noteworthy

Since 0.5.0-preview.4

  • All bindings were updated to support the GNOME SDK version 46. Among other things this adds support for GTK 4.14 and libadwaita 1.5. (#1052)
  • The libraries get build explicitly for .NET 8 (#1038). Remark: If support for .NET 6 / 7 is dropped those versions will get droped from GirCore with the following release, too
  • preview.4 added support for typed records but was missing a parameterless constructors. (#1002 )
  • Support for foreign records was added (#1010 )
  • Support for untyped records was added (#1013)
  • Support for untyped foreign records was added (#1029)
  • New samples for GTK were created by @kashifsoofi (#1022, #1024)
  • A bug was fixed if an object was not freed on main thread (#1045)
  • A bug was fixed if an interface was passed as a parameter into a method / function (#1055)
  • The homepage got updated with new content and a new docfx version (#1039, #1040)

0.5.0-preview.4

  • This release adds support for typed records constructors, methods, functions and fields. Previously in the public record API there was only the record type available without any possibility to access it's data. If you used some custom code to access this data please verify if you can replace this code with the newly available API. In general the available API surface should have improved significantly. (#965, #985, #986, #994)
  • The generation of typed records lead to several API breaks in the GObject namespace especially for the class GObject.Value. Those manually written methods originated from the very beginning of the project which were leaning into the direction to divert a lot farther from the original API. API breaks happened in other namespaces, too as manually written bindings got replaced by generated bindings which often have a slightly different method signature. (#981, #982, #991)
  • Enumerations got rebased on int instead of long to match their C definition. (#989)
  • More bindings for async methods (#993)

0.5.0-preview.3

  • Update to the latest Gnome SDK version 45. This includes GTK 4.12 and Libadwaita 1.4
  • Improved API surface for opaque records which are not registered in the GObject type system.

0.5.0-preview.2

  • More bindings for async methods (#953).
  • The parameterless Gio.Application.Run method got removed as it is not part of the official Gio Api. Additionally Gio.Application.RunWithSynchronizationContext now has a parameter to provide arguments. To achieve the original behaviour just pass null as a parameter (#956).
  • Fixed a bug introduced in preview.1 which caused an exception if an opaque typed record was used in a GObject.Value (#959).

0.5.0-preview.1

  • The Gtk-4.0.DependencyInjection project was removed as there is not one way to do dependency injection right. Every project needs to find it's own solution.
  • Improved API surface for opaque records which are registered as boxed types with the GObject type system.

What's Changed since 0.5.0-preview.4

Full Changelog since 0.4.0: 0.4.0...0.5.0

0.5.0-preview.4

13 Jan 11:31
ce3bceb

Choose a tag to compare

0.5.0-preview.4 Pre-release
Pre-release

This release is the fourth preview of the upcoming 0.5.0 release. This is a follow up release to preview.3.

Noteworthy:

  • This release adds support for typed records constructors, methods, functions and fields. Previously in the public record API there was only the record type available without any possibility to access it's data. If you used some custom code to access this data please verify if you can replace this code with the newly available API. In general the available API surface should have improved significantly. (#965, #985, #986, #994)
  • The generation of typed records lead to several API breaks in the GObject namespace especially for the class GObject.Value. Those manually written methods originated from the very beginning of the project which were leaning into the direction to divert a lot farther from the original API. API breaks happened in other namespaces, too as manually written bindings got replaced by generated bindings which often have a slightly different method signature. (#981, #982, #991)
  • Enumerations got rebased on int instead of long to match their C definition. (#989)
  • More bindings for async methods (#993)

If you encounter any errors, missing features or encounter problems to adopt to the new version please open an issue.

Important

There is currently no public parameterless constructor available for typed records. To create a new instance of a typed record you need to create a managed handle first. For example to create an instance of Gdk.Rgba it would be: new Gdk.RGBA(RGBAManagedHandle.Create()). There will be a new parameterless constructor in the next version.

What's Changed

New Contributors

Full Changelog: 0.5.0-preview.3...0.5.0-preview.4