Control: retitle -1 tone-generator: Depends on deprecated dbus-glib
On Thu, 28 Aug 2025 at 06:28:06 +0000, Mike Gabriel wrote:
tone-generator uses dbus_connection_setup_with_g_main() from
dbus-glib-lowlevel.h. How can that be replaced?
https://sources.debian.org/src/tone-generator/1.6.1-5/src/dbusif.c?hl=94#L94
Indeed, the dependency is not unnecessary in this case. I was checking
codesearch for the usual dbus-glib API patterns like dbus_g, but one of
the many design flaws of dbus-glib is that it doesn't use a consistent
namespace...
There are two main routes this could go:
If the developer prefers to use GLib more consistently, one route is to
move from dbus-glib + libdbus to GDBus. This is a thread-aware,
thread-safe implementation of D-Bus using GLib conventions such as
GMainContext and the GVariant representation of D-Bus data types.
It would take some porting, but does not add a dependency (because
dbus-glib already depends on libgio-2.0, the library that contains
GDBus).
Or, tone-generator could vendor a copy of dbus-gmain (the small subset
of dbus-glib that it is actually using) to attach libdbus to the GLib
main loop. This is dangerous for multi-threaded code (libdbus is *meant
to be* thread-safe, but does not have a particularly coherent threading
model, which makes it unlikely to be *actually* thread-safe) but should
be OK if it's single-threaded. For more details please see
<https://gitlab.freedesktop.org/dbus/dbus-glib/-/tree/dbus-gmain?ref_type=heads>,
which can be used with `git submodule` or `git subtree`, or by copying
dbus-gmain.[ch]. There is no independent shared library for dbus-gmain.
A third option would be to use some other D-Bus implementation, like
sd-bus.
smcv