gnu: gnome-settings-daemon: Add "guix gc" to low disk space notification.
[jackhill/guix/guix.git] / gnu / packages / patches / gnome-settings-daemon-gc.patch
1 This patch adds a "guix gc" button to the low disk space notification
2 that 'gsd-housekeeping' emits.
3
4 diff --git a/plugins/housekeeping/gsd-disk-space.c b/plugins/housekeeping/gsd-disk-space.c
5 index bd3437e..89027d8 100644
6 --- a/plugins/housekeeping/gsd-disk-space.c
7 +++ b/plugins/housekeeping/gsd-disk-space.c
8 @@ -546,6 +546,21 @@ empty_trash_callback (NotifyNotification *n,
9 notify_notification_close (n, NULL);
10 }
11
12 +static void
13 +guix_gc_callback (NotifyNotification *n,
14 + const char *action)
15 +{
16 + const gchar *argv[] = { "guix", "gc", NULL };
17 +
18 + g_assert (action != NULL);
19 + g_assert (strcmp (action, "run-guix-gc") == 0);
20 +
21 + g_spawn_async (NULL, (gchar **) argv, NULL, G_SPAWN_SEARCH_PATH,
22 + NULL, NULL, NULL, NULL);
23 +
24 + notify_notification_close (n, NULL);
25 +}
26 +
27 static void
28 on_notification_closed (NotifyNotification *n)
29 {
30 @@ -591,6 +606,13 @@ ldsm_notify (const char *summary,
31 g_free);
32 }
33
34 + notify_notification_add_action (notification,
35 + "run-guix-gc",
36 + _("Collect Unused Guix Items"),
37 + (NotifyActionCallback) guix_gc_callback,
38 + NULL,
39 + NULL);
40 +
41 has_trash = ldsm_mount_has_trash (mount_path);
42
43 if (has_trash) {