From 5ac625c5ed08aef07124ff6a17ea701e10136590 Mon Sep 17 00:00:00 2001 From: Felipe Borges Date: Mon, 20 Jan 2025 14:47:18 +0100 Subject: [PATCH] Disambiguate mount points with same name on "Low Disk Space" notifications When there's more than one mount point with the same name, we show the mount path instead. Related: RHEL-74248 --- gnome-settings-daemon.spec | 3 + ...biguate-mount-names-in-notifications.patch | 71 +++++++++++++++++++ 2 files changed, 74 insertions(+) create mode 100644 housekeeping-disambiguate-mount-names-in-notifications.patch diff --git a/gnome-settings-daemon.spec b/gnome-settings-daemon.spec index 6355e7f..e3f7959 100644 --- a/gnome-settings-daemon.spec +++ b/gnome-settings-daemon.spec @@ -28,6 +28,9 @@ Source0: https://download.gnome.org/sources/%{name}/%{major_version}/%{na # https://issues.redhat.com/browse/RHEL-30294 Patch0: power-server-sleep-type-default.patch +# https://issues.redhat.com/browse/RHEL-74248 +Patch1: housekeeping-disambiguate-mount-names-in-notifications.patch + BuildRequires: gcc BuildRequires: gettext BuildRequires: meson >= 0.49.0 diff --git a/housekeeping-disambiguate-mount-names-in-notifications.patch b/housekeeping-disambiguate-mount-names-in-notifications.patch new file mode 100644 index 0000000..a3dc06e --- /dev/null +++ b/housekeeping-disambiguate-mount-names-in-notifications.patch @@ -0,0 +1,71 @@ +From 0d6208bfaceaa9f27d30ff0f38e3accf7bd56f95 Mon Sep 17 00:00:00 2001 +From: Felipe Borges +Date: Wed, 15 Jan 2025 15:26:19 +0100 +Subject: [PATCH] housekeeping: Disambiguate mount point names in notifications + +There might be mount-points with same name, so when that's the case, +let's show the path instead. + +Related: RHEL-11910 +--- + plugins/housekeeping/gsd-disk-space.c | 18 +++++++++++++++--- + 1 file changed, 15 insertions(+), 3 deletions(-) + +diff --git a/plugins/housekeeping/gsd-disk-space.c b/plugins/housekeeping/gsd-disk-space.c +index c5ae8f6b..aff85205 100644 +--- a/plugins/housekeeping/gsd-disk-space.c ++++ b/plugins/housekeeping/gsd-disk-space.c +@@ -670,7 +670,8 @@ ldsm_notify (const char *summary, + + static void + ldsm_notify_for_mount (LdsmMountInfo *mount, +- gboolean multiple_volumes) ++ gboolean multiple_volumes, ++ gboolean is_ambiguous_name) + { + gboolean has_trash; + gchar *name; +@@ -688,7 +689,7 @@ ldsm_notify_for_mount (LdsmMountInfo *mount, + free_space_str = g_format_size (free_space); + + if (multiple_volumes) { +- summary = g_strdup_printf (_("Low Disk Space on “%s”"), name); ++ summary = g_strdup_printf (_("Low Disk Space on “%s”"), is_ambiguous_name ? path : name); + if (has_trash) { + body = g_strdup_printf (_("The volume “%s” has only %s disk space remaining. You may free up some space by emptying the trash."), + name, +@@ -778,8 +779,10 @@ ldsm_maybe_warn_mounts (GList *mounts, + gboolean multiple_volumes) + { + GList *l; ++ GHashTable *mount_names; + gboolean done = FALSE; + ++ mount_names = g_hash_table_new (g_str_hash, g_str_equal); + for (l = mounts; l != NULL; l = l->next) { + LdsmMountInfo *mount_info = l->data; + LdsmMountInfo *previous_mount_info; +@@ -832,10 +835,19 @@ ldsm_maybe_warn_mounts (GList *mounts, + } + + if (show_notify) { +- ldsm_notify_for_mount (mount_info, multiple_volumes); ++ g_autofree gchar *mount_name = NULL; ++ gboolean is_ambiguous_name = FALSE; ++ ++ mount_name = g_unix_mount_guess_name (mount_info->mount); ++ is_ambiguous_name = g_hash_table_contains (mount_names, mount_name); ++ g_hash_table_add (mount_names, mount_name); ++ ++ ldsm_notify_for_mount (mount_info, multiple_volumes, is_ambiguous_name); + done = TRUE; + } + } ++ ++ g_hash_table_destroy (mount_names); + } + + static gboolean +-- +2.37.1 +