Planned changes for libgnome-desktop in GNOME 42

Libgnome-desktop currently has a dependency on GTK 3. Various applications, including GNOME Control Center, are in the process of being ported to GTK 4 for GNOME 42, which means untangling dependencies like libgnome-desktop.

Libgnome-desktop has no API stability guarantee, so projects using it will need to ensure that they are ported to the changes in the library.

Currently, the following parts of libgnome-desktop depend on GTK or GDK:

  • GnomeBG: a collection of background rendering utility API
    • GnomeBGCrossfade: support for cross-fading two background images on a GdkWindow
  • GnomeRR: a collection of utilities for querying the physical and logical displays
  • various tests

I have looked in the Debian code search for users of GnomeBGCrossfade, and found nothing outside of libgnome-desktop and the internal copy of libgnome-desktop shipped by Cinnamon, so this API will be removed in GNOME 42.

While GnomeBGSlideShow does not depend on GTK, I’ve also checked and the only user of this API is Phosh; this API will likely be removed as well, but I’m going to contact the Phosh developers to see if they can either stop using it, or copy it in tree.

GnomeRR and GnomeBG will require some porting for GTK4, or ideally stop using GTK altogether.

Ideally, libgnome-desktop will stop depending on GTK; if that proves to be impossible, then it will be split into two separate library:

  • libgnome-desktop-base-4.0, containing all the non-GUI/non-windowing system related API
  • libgnome-desktop-ui-4.0, containing all the GUI/windowing system related API

to allow for phased deprecations and porting to newer versions of GTK in the future.

The overall goal, though, is to try and move as much as possible out of libgnome-desktop and into the core GNOME platform.

Feedback from current users of libgnome-desktop is welcome.

4 Likes

It appears that it may be possible to drop gnome_start_systemd_scope if this was completed: https://gitlab.gnome.org/GNOME/glib/-/merge_requests/1596

gnome-shell as well.

1 Like

Indeed, I was thwarted in my grepping of the jhbuild moduleset by the switch between master and main branches.

We can keep BGSlideShow in libgnome-desktop, since it’s used by two components. Though, to be fair, they do the same thing (window management) so I would not be entirely against projects copy-pasting that code.

I always assumed that control-center was using BGSlideShow as well (or at least did so in that past).

It turns out that that’s not the case, so I’m not against moving the code into gnome-shell either.

I’m using <libgnome-desktop/gnome-languages.h> just because of gnome_get_language_from_locale() in https://github.com/gkarsay/parlatype/ (main branch, not released yet). I think I could get e.g. the String “english” for my input “en” with other libraries as well, but only gnome-desktop gives me translations for all those strings for free.

If you move this into GTK core, please don’t make it private.

And if I had a free wish (I know I haven’t): please make it build on WIN32 as well.

We should move that into GLib, at most, not GTK; the main blocker is that it requires the iso-codes XML files on Unix, and that there are no known implementations for non-Unix systems.

If you know how, then by all means: we can have it on Windows.

I agree this would be useful to have in GLib. Currently Epiphany copies these files to avoid depending on gnome-desktop. That would be my recommendation to other apps as well. I don’t recommend depending on gnome-desktop unless you are a core app (even then, Epiphany is a core app and still copies the code to avoid the dependency) because it is unstable and will break on you in the future.

If you know how, then by all means: we can have it on Windows.

I don’t know how. I hope to release my program first and then I might have a look. gnome-desktop depends on things like gio-unix-2.0 so it can’t build on WIN32.

Yeah, that’s not going to change. Libgnome-desktop is a library that contains code shared by GNOME system components, so it’ll never be portable.

Sadly, libgnome-desktop also contains some API that should be part of the application platform but nobody has yet come up with a way to do that; until that API is moved into the corresponding core platform library, you have two options:

  • depend on libgnome-desktop, and thus not be portable
  • copy-paste the code into your application, and figure out a way to make it portable

Thanks for the hint! Looking at Epiphany made it quite easy to copy the right files and to modify and integrate them.

Thanks for working on this, Emmanuele!

With the planned changes, there will be no need to keep a copy of the thumbnailing code in nautilus as part of moving to GTK4.

1 Like

This topic was automatically closed 30 days after the last reply. New replies are no longer allowed.