From 81fa1aebe4f5d50de704738e04a955f9569566b9 Mon Sep 17 00:00:00 2001 From: Adrian Vovk Date: Thu, 31 Jul 2025 20:51:18 -0400 Subject: [PATCH 1/2] notify: Revert: Switch to systemd service Starting with GNOME 49, gnome-session no longer uses .desktop files to launch session services. Instead, only systemd is used --- diff --git a/src/notify/gnome-disk-utility-notify.service.in b/src/notify/gnome-disk-utility-notify.service.in deleted file mode 100644 index 75b25b71d..000000000 --- a/src/notify/gnome-disk-utility-notify.service.in +++ /dev/null @@ -1,11 +0,00 @@ -[Unit] -Description=Disk Health Notifications -PartOf=gnome-session.target -After=gnome-session.target - -[Service] -Type=dbus -BusName=org.gnome.Disks.NotificationMonitor -ExecStart=@libexecdir@/gnome-disk-utility-notify -Restart=on-failure -Slice=app.slice diff --git a/src/notify/meson.build b/src/notify/meson.build index 8ef29ff71..2afad3f46 100644 --- a/src/notify/meson.build +++ b/src/notify/meson.build @@ -11,7 +11,7 @@ deps = [ ] executable( - 'gnome-disk-utility-notify', + 'gsd-disk-utility-notify', sources, include_directories: top_inc, dependencies: deps, @@ -21,9 +21,9 @@ executable( configure_file( - input: 'gnome-disk-utility-notify.service.in', + input: 'org.gnome.SettingsDaemon.DiskUtilityNotify.desktop.in', output: '@BASENAME@', configuration: {'libexecdir': gdu_prefix / gdu_libexecdir}, install: true, - install_dir: systemd_user_unit_dir, + install_dir: gdu_sysconfdir / 'xdg/autostart', ) diff --git a/src/notify/org.gnome.SettingsDaemon.DiskUtilityNotify.desktop.in b/src/notify/org.gnome.SettingsDaemon.DiskUtilityNotify.desktop.in new file mode 100644 index 000000000..8e2a561b6 --- /dev/null +++ b/src/notify/org.gnome.SettingsDaemon.DiskUtilityNotify.desktop.in @@ -0,0 +1,7 @@ +[Desktop Entry] +Type=Application +Name=gnome-disk-utility notification plugin for GNOME Settings Daemon +Exec=@libexecdir@/gsd-disk-utility-notify +OnlyShowIn=GNOME; +NoDisplay=true +X-GNOME-AutoRestart=true -- GitLab From 20633c20fb3c9543159a3a23ea48957de7e9ccbc Mon Sep 17 00:00:00 2001 From: Adrian Vovk Date: Thu, 31 Jul 2025 20:55:33 -0400 Subject: [PATCH 2/2] notify: Drop legacy entrypoint These stopped being used when gnome-settings-daemon switched from plugins to distinct services --- diff --git a/src/notify/gdusdmanager.c b/src/notify/gdusdmanager.c new file mode 100644 index 000000000..bb07bfabb --- /dev/null +++ b/src/notify/gdusdmanager.c @@ -0,0 +1,126 @@ +/* + * Copyright (C) 2012-2013 Red Hat, Inc. + * + * Licensed under GPL version 2 or later. + * + * Author: David Zeuthen + */ + +#include "config.h" + +#include +#include +#include + +#include "gdusdmanager.h" +#include "gdusdmonitor.h" + +#include + +struct GduSdManagerClass; +typedef struct GduSdManagerClass GduSdManagerClass; + +struct GduSdManager +{ + GObject parent_instance; + GduSdMonitor *monitor; + guint name_owner_id; +}; + +struct GduSdManagerClass +{ + GObjectClass parent_class; +}; + +static gboolean gdu_sd_manager_start (GduSdManager *, GError **); +static void gdu_sd_manager_stop (GduSdManager *); + +static GduSdManager *gdu_sd_manager_new (void); + +G_DEFINE_TYPE (GduSdManager, gdu_sd_manager, G_TYPE_OBJECT) +GNOME_SETTINGS_PLUGIN_REGISTER (GduSd, gdu_sd) + +static void +name_acquired_handler (GDBusConnection *connection, + const gchar *name, + gpointer user_data) +{ + GduSdManager *manager = GDU_SD_MANAGER (user_data); + g_warn_if_fail (manager->monitor == NULL); + g_clear_object (&manager->monitor); + manager->monitor = gdu_sd_monitor_new (); +} + +static void +name_lost_handler (GDBusConnection *connection, + const gchar *name, + gpointer user_data) +{ + GduSdManager *manager = GDU_SD_MANAGER (user_data); + g_clear_object (&manager->monitor); +} + +static void +gdu_sd_manager_init (GduSdManager *manager) +{ +} + +static void +gdu_sd_manager_finalize (GObject *object) +{ + GduSdManager *manager = GDU_SD_MANAGER (object); + + gdu_sd_manager_stop (manager); + + G_OBJECT_CLASS (gdu_sd_manager_parent_class)->finalize (object); +} + +static gboolean +gdu_sd_manager_start (GduSdManager *manager, + GError **error) +{ + /* The reason for claiming a unique name is so it's easier to test + * code changes - it helps ensure that only one instance of + * GduSdMonitor is running at any one time. See also testplugin.c. + */ + if (manager->name_owner_id == 0) + { + manager->name_owner_id = g_bus_own_name (G_BUS_TYPE_SESSION, + "org.gnome.Disks.NotificationMonitor", + G_BUS_NAME_OWNER_FLAGS_ALLOW_REPLACEMENT | + G_BUS_NAME_OWNER_FLAGS_REPLACE, + NULL, /* bus_acquired_handler */ + name_acquired_handler, + name_lost_handler, + manager, + NULL); /* GDestroyNotify */ + } + + return TRUE; +} + +static void +gdu_sd_manager_stop (GduSdManager *manager) +{ + if (manager->name_owner_id == 0) + { + g_bus_unown_name (manager->name_owner_id); + manager->name_owner_id = 0; + } + + g_clear_object (&manager->monitor); +} + +static void +gdu_sd_manager_class_init (GduSdManagerClass *klass) +{ + GObjectClass *object_class = G_OBJECT_CLASS (klass); + + object_class->finalize = gdu_sd_manager_finalize; +} + +static GduSdManager * +gdu_sd_manager_new (void) +{ + return g_object_new (GDU_TYPE_SD_MANAGER, NULL); +} diff --git a/src/notify/gdusdmanager.h b/src/notify/gdusdmanager.h new file mode 100644 index 000000000..79eafcfeb --- /dev/null +++ a/src/notify/gdusdmanager.h @@ -0,0 +1,32 @@ +/* + * Copyright (C) 2012-2013 Red Hat, Inc. + * + * Licensed under GPL version 2 or later. + * + * Author: David Zeuthen + */ + +#ifndef __GDU_SD_PLUGIN_H__ +#define __GDU_SD_PLUGIN_H__ + +#include +#include +#include + +G_BEGIN_DECLS + +#define GDU_TYPE_SD_MANAGER (gdu_sd_manager_get_type ()) +#define GDU_SD_MANAGER(o) (G_TYPE_CHECK_INSTANCE_CAST ((o), GDU_TYPE_SD_MANAGER, GduSdManager)) +#define GDU_IS_SD_MANAGER(o) (G_TYPE_CHECK_INSTANCE_TYPE ((o), GDU_TYPE_SD_MANAGER)) + +struct GduSdManager; +typedef struct GduSdManager GduSdManager; + +GType gdu_sd_manager_get_type (void) G_GNUC_CONST; + +/* All the plugins must implement this function */ +G_MODULE_EXPORT GType register_gnome_settings_plugin (GTypeModule *module); + +G_END_DECLS + +#endif /* __GDU_SD_PLUGIN_H__ */ -- GitLab