News from GLib 2.58

Next September, GLib will hit version 2.58. There have been a few changes during the past two development cycles, most notably the improvement of the Meson build, which in turn led to an improved portability of GLib to platforms such as Windows, macOS, and Android. It is time to take stock of the current status of GLib, and to highlight some of the changes that will impact GLib-based code.

  • Meson – Thanks to the ongoing work of Nirbheek Chauhan and Xavier Claessens, the Meson build has been constantly improving, to the point that we can start switching to it as the default build system. The plan—as outlined on the mailing list—is to release GLib 2.58 using Meson, while keeping the Autotools build in tree and available in the release archive; then, we’ll drop the Autotools build during the following development cycle, and release GLib 2.60 without Autotools support. Linux distributors are very much welcome to start testing the Meson build in their builders; we’ve been running the Meson build as part of our CI process for a while, now, but more exposure will bring out eventual regressions that we missed; additionally, it would be stellar if people with different toolchains than GCC/Clang/MSVC would start trying the Meson build and report bugs. In the meantime, if you’re using GLib on macOS and Windows, we already recommend you switch to Meson to build GLib, as it’s easier and better integrated with those platforms than Autotools
  • Reliability and portability – GLib switched to GitLab alongside the rest of GNOME, which meant being able to run continuous integration outside of the GNOME Continuous builds. Now we run CI on multiple toolchains, multiple build systems, and multiple platforms for every commit and merge request, which significantly reduces the chances of a broken build. We’ve also improved the code coverage in the test suite. Of course, we could always do better; for instance, we don’t have a CI runner for macOS and the Solaris family of OSes, and more runners for the *BSD family would be greatly appreciated. We’ve issued a call for help, if you have a spare machine and some bandwidth that you can donate
  • File monitoring on *BSD – Apropos the *BSD family, the kqueue backend for file monitoring in GIO has been completely overhauled by Martin Pieuchot and Ting-Wei Lan; the new code is simpler, more robust, and passes all the tests
  • Use posix_spawn() for efficient process launching — Thanks to Daniel Drake, GLib now can use posix_spawn() under specific circumstances, if the platform’s C library supports it; this allows hitting fast paths in the kernel, compared to manually calling fork() + exec(); those fast paths are especially beneficial when running on memory constrained platforms
  • Reference counting types and allocations — GLib uses reference counting as a memory management and garbage collection mechanism in many of its types, but lacks the public API to allow other people to implement the same semantics in their own data structures; this leads to much copy-pasting and re-implementations, and typically to things like undefined behavior when it comes to saturation and thread safety. GLib 2.58 has a grefcount and a gatomicrefcount types, alongside their API, to reduce this duplication. Additionally, taking a cue from other languages like Rust, GLib provides a way to add reference counting semantics on memory allocations, by adding a low level API that allows you to allocate structures that do not have a reference count field, and automatically add reference counting semantics to them
  • Deprecations – A few soft deprecations have become real deprecations in this last development cycle:
      • g_type_class_add_private() has finally been deprecated, five years after we introduced the instance private data macros; if you’re still using that function in your class initialization, please switch to G_DEFINE_TYPE_WITH_PRIVATE or G_ADD_PRIVATE
      • g_main_context_wait() is officially deprecated, but you should have already seen run time warnings about its use
      • gtester, the GTest harness provided by GLib, is deprecated; if you’re using Autotools, you should use the TAP harness that comes with Automake

There have been lots of contributions in GLib, in this past cycle, thanks to the tireless efforts of Philip Withnall; he’s been instrumental in reviewing patches, triaging bugs, and implementing changes in the development process of the project. The switch over to GitLab has also improved the contribution process, with many more developers opening merge requests:

  • 2.54.0..c182cd68: 968 changesets from 143 developers, up from 412 changesets and 68 developers during the 2.53 development cycle
  • A total of 31851 lines added, 27976 removed (delta: +3875)
Developers with the most changesets
Philip Withnall 303 31.3%
Xavier Claessens 79 8.2%
Emmanuele Bassi 69 7.1%
Christoph Reiter 42 4.3%
Ting-Wei Lan 21 2.2%
Chun-wei Fan 21 2.2%
Nirbheek Chauhan 21 2.2%
Ondrej Holy 20 2.1%
Руслан Ижбулатов 20 2.1%
Mikhail Zabaluev 20 2.1%
Simon McVittie 15 1.5%
Matthias Clasen 14 1.4%
Christian Hergert 13 1.3%
Iñigo Martínez 12 1.2%
Bastien Nocera 10 1.0%
Rafal Luzynski 9 0.9%
Michael Catanzaro 9 0.9%
Will Thompson 8 0.8%
Allison Lortie 8 0.8%
Daniel Boles 8 0.8%

Make sure to test your code with GLib 2.57.2, the next development snapshot towards the 2.58.0 stable release.

GTK+ 2.15.3 unstable release

This is the third development release leading up to GTK+ 2.16.
8 bugs fixed in this release!

  • General:
    • Keyboard shortcut handling has been changed, to help with a longstanding complaint about the way GTK+ handles multiple layouts. GTK+ now only uses keys from groups other than the current group if they are not present in the current group. Feedback on this change is appreciated.

Read the original announcement for more info and downloads.

GLib 2.19.6 unstable release

This is the sixth development release leading up to GLib 2.20.
7 bugs fixed in this release!

  • General
    • New format macro to print goffset data: G_OFFSET_FORMAT
  • GIO:
    • Add a GFilter{Input,Output}Stream::close-base-stream properties which determine whether the base stream will be closed when the filter stream is finalized.
    • g_data_input_stream_read_line and …_read_until have asynchronous variants now.

Read the original announcement for more info and downloads.

GTK+ 2.15.2 unstable release

This is the second development release leading up to GTK+ 2.16.
4 bugs fixed in this release!

  • GtkAction:
    • Make toolitems pick up icon names from actions
    • Draw proxies of radio actions properly
    • Make menu proxies of recent actions work
    • Avoid accidental activations when changing actions on proxies
    • Make derived button classes work as proxies
  • Input methods
    • Avoid an assertion due to early use of input methods
  • GtkScale
    • Avoid a segfault in the marker drawing code
  • GtkImageMenuItem
    • Add a property to override the show-menu-images setting

Read the original announcement for more info and downloads.

GTK+ 2.15.1 unstable release

This is the first development release leading up to GTK+ 2.16.
35 bugs fixed in this release!

  • GtkFileChooser:
    • Remember the file chooser’s size across invocations
    • Handle uris that are entered in the entry
    • Improve autocompletion, in particular for uris
  • GtkEntry:
    • New property “im-module” for selecting input methods per-widget
    • New icon-related API got renamed for consistency
    • Added properties and setters for icon tooltips
  • GtkTextView:
    • New property “im-module” for selecting input methods per-widget
    • New signal “paste-done” to allow better handling of async pasting
  • GtkScale:
    • New api to add annotated marks: gtk_scale_add_mark.
  • GtkAction:
    • Rework the way actions and proxies interact, to make the interaction less ad hoc, more extensible, and better suited for support in GUI builders like glade. To be used as a proxy, a widget must now implement the GtkActivatable interface, and GtkActivatable implementations are responsible for syncing their appearance with the action and for activating the action. All the widgets that are commonly used as proxies implement GtkActivatable now. This is a big change, and it is not unlikely to break some current users of GtkAction, so feedback about problems caused by this is appreciated.
    • Add a “gicon” property to specify the icon with a GIcon
  • GDK:
    • On X11, GDK now caches cursors to avoid cursor theming overhead
    • New cursor type for blank cursors: GDK_BLANK_CURSOR
  • New deprecations:
    • gtk_scale_Button_get_orientation()
    • gtk_scale_button_set_orientation()
    • gtk_action_connect_proxy()
    • gtk_action_disconnect_proxy()
    • gtk_widget_get_action()
    • gtk_action_block_activate_from()
    • gtk_action_unblock_activate_from()
    • direct access to “gtk-action” object data
  • Changes that are relevant for translators:
    • Navigation and Media stock labels have separate message contexts now
    • The caps lock warning string has been changed

Read the original announcement for more info and downloads.

GTK+ 2.15.0 unstable release

This is the first development release leading up to GTK+ 2.16.

Overview of changes between 2.14.x and 2.15.0:

  • GtkFileChooser
    • Optionally shows file sizes
    • Mounts volumes when necessary
    • Picks better mime icons
  • GtkEntry
    • Can show icons at either side of the entry, which can be made clickable, drag sources, etc
    • Can show progress information
    • Picks the best available placeholder character for invisible entries unless it is explicitly set. See the invisible-char-set property
    • Input methods work again in invisible entries
    • Invisible entries can optionally display a caps-lock warning. This can be turned off with the caps-lock-warning property
  • GtkStatusIcon
  • GtkLinkButton
    • Respects user-defined tooltips
    • Has a default url hook
  • GtkBuilder
    • Can construct menus
    • Can associate accel groups with windows
    • Child properties can now be translatable, e.g. GtkAssistant::page-title
  • GtkOrientable
    • A new interface implemented by all widgets that have horizontal and vertical variants
    • Printing support
    • Print-to-file can save to non-local files
    • Page rendering can be deferred to a thread to avoid blocking the mainloop
  • GDK
    • GdkKeymap emits a state-changed signal when the Caps Lock state changes
  • Newly deprecated functions:
    • gdk_window_get_toplevels(),
    • gtk_font_selection_dialog_get_apply_button(),
    • gtk_status_icon_set_tooltip(),
    • gtk_toolbar_set_orientation()
  • Changes that are relevant for theme authors
    • The GtkMenu::arrow-placement style property allow more space efficient layout of scrolling menus
    • Submenu arrows can be scaled relative to the font size, with the
    • GtkMenuItem::arrow-scaling style property
    • Themes can set the GtkDialog::content-area-spacing style property to change the spacing between elements of the content area
    • The GtkEntry::state-hint style property can be used to make GTK+ pass the correct state when drawing the background of entries
    • The GtkEntry::prelight style property can be used to suppress prelighting of icons in entries on mouse-over
  • Changes that are relevant for translators
    • GTK+ has been switched to use the two-argument C_() macro instead of Q_() for messages with context

Read the original announcement for more information including bug fixes and download locations.