Skip to content

2.1.0

Latest

Choose a tag to compare

@makoni makoni released this 04 Dec 19:04

Text hidden by an invisible tag is part of a buffer's text again — an app that folds text and saves text no longer loses what it folded. Also fixed: getProperty(_:) for non-integer properties, ListBox.remove(_:), and popovers that leaked with their parent. retainUntilClose() is deprecated: it leaked every non-window widget it was called on, and is no longer needed. Builds, DocC and the test suite are now free of warnings.

Added

  • SignalConnection.isConnected — whether the handler is still connected: false after disconnect(), once the object is gone, or when GLib refused the connection in the first place (an unknown signal name, for one).

Fixed

Hidden text is part of the buffer's text. TextBuffer.text, selectedText and text(in:), SourceBuffer.text and TextView.text read the buffer with include_hidden_chars = FALSE, so text under an invisible tag was missing from what they returned. An app that folds sections with such a tag and saves text wrote the file back without the folded sections — Swifty Notes lost every section collapsed in its outline on the next save. text(in:) also disagreed with its own offsets, which count hidden characters. All five getters now include hidden text. (#9)

getProperty(_:) reads a property as its own type. It prepared an int value for every property, which GLib refuses to copy anything else into: a string or boolean came back empty with a GLib-GObject-CRITICAL, and passing that value to setProperty wrote the wrong type. The value now takes the type from the property's GParamSpec. (#8)

ListBox.remove(_:) removes the row of a widget you appended. GTK wraps an appended, prepended or inserted widget in a GtkListBoxRow, and gtk_list_box_remove only takes rows: handed the widget, it warned "Tried to remove non-child" and left the row in the list. The wrapping row is removed now. (#11)

Popovers no longer outlive — and leak with — a destroyed parent. Popover / PopoverMenu present(from:) and PopoverMenu.setParent(_:) attached the popover with gtk_widget_set_parent and never detached it. GTK containers unparent only their own children, so the parent was finalized with the popover still attached ("Finalizing … but it still has children left") and the popover leaked with it. A destroy handler on the parent, connected with g_signal_connect_object so it keeps neither side alive, now detaches it. present(from:) also no longer re-parents on every call when the parent is the same. (#11)

retainUntilClose() no longer leaks non-window widgets. It captured the wrapper in a destroy handler, a reference cycle under the toggle-reference wrappers (destroy only fires at the last unref), so a dialog it was called on was never finalized. See the upgrade notes. (#10, closes #7)

Clean builds against libadwaita 1.10. AdwTabViewShortcuts.none is a computed property, so it no longer draws the "produces an empty option set" warning where libadwaita marks the enum as flags; EnumListModel and EnumListItem call the adw_enum_list_* functions libadwaita 1.10 deprecated through CAdwaita shims (their replacement, GTK 4.24's GtkEnumList, is above the GTK 4.14 floor). (#8)

Changed / upgrade notes

  • ⚠️ The text getters now include text hidden by an invisible tag. Code that relied on hidden text being left out — to compute what is visible, say — now gets the whole buffer. If you need only the visible text, read it with gtk_text_buffer_get_text(…, include_hidden_chars: 0) yourself.
  • ⚠️ retainUntilClose() is deprecated and does nothing. Remove the calls: a presented dialog or popover stays alive, with its wrapper and every handler that captures it weakly, while GTK shows it, and both are freed once it closes. Keep a reference yourself only for a widget you build now and present later.
  • ⚠️ getProperty(_:) returns a value of the property's own type. Read it with the matching accessor (stringValue, boolValue, …): intValue on a string or boolean property gives 0 and a GLib critical. Integer properties are unchanged.
  • AdwTabViewShortcuts.none is a computed static var instead of a static let; source-compatible.

Docs

  • Lifetime guide: the transient-widget section shows plain present(_:) instead of retainUntilClose().
  • Menu examples in PopoverMenuBar, MenuButton, PopoverMenu and the Context Menus guide called APIs that do not exist (append(label:…), MenuButton(iconName:), PopoverMenu(), menuModel on MenuButton); they use the real ones now and were compile-checked. The getProperty example compiles too.
  • Flatpak guide and README: GNOME 51 with the swift6//26.08 extension (Swift 6.4). The 24.08 branch they showed ships Swift 6.2, below this package's 6.3 floor.
  • TextBuffer.text notes that setting it is irreversible and refused inside a user action; stopSignalEmission(named:) notes that GLib logs a critical outside an emission.
  • DocC builds without warnings (ambiguous GtkWindow links, a cross-module SignalConnection link, a stale task(_:) link).

Internal

  • Zero compiler warnings on Linux and macOS (133 before, nearly all in tests). Assertions the compiler called always true now check what the test is about: the GType a wrapper created, isConnected, the properties a preset sets, handlers that actually run.
  • The test suite logs no GTK warnings. recordingGLibWarnings { } collects them for assertions by observing the library's own log writer through an internal logWriterObserver: GLib allows one writer per process and aborts on a second.
  • Dialog ownership tests (Linux): a presented dialog outlives its wrapper while shown and finalizes once closed, on libadwaita 1.5 and 1.9.
  • Demo Flatpak on GNOME 51 (it no longer built on GNOME 48); actions/checkout v7; swift-docc-plugin 1.5.0 (within from: "1.3.0").
  • EnumListModel / EnumListItem moved out of Generated/ and onto the code generator's hand-written list.

Full Changelog: 2.0.2...2.1.0