diff options
author | Eric <8319652+edaigle@users.noreply.github.com> | 2021-07-08 11:05:01 -0400 |
---|---|---|
committer | António Fernandes <antoniof@gnome.org> | 2021-08-13 14:56:52 +0100 |
commit | 658ad9d9e82e0a1e4edcf2841476bde3561504ff (patch) | |
tree | 169877c5767d259dbf72f3eb91170f4326c155cb | |
parent | 4e02d0ffbde23d59e84a66c9d5cf1e88b76135e9 (diff) | |
download | nautilus-658ad9d9e82e0a1e4edcf2841476bde3561504ff.tar.gz |
trash-bar: Add link to autodelete settings
Nautilus currently provides no indication that GNOME Settings allows
users to configure automatic emptying of the trash. This commit adds
a button to the trash bar which links to the corresponding configuration
panel in Settings, allowing users to configure autodelete.
Fixes: https://gitlab.gnome.org/GNOME/nautilus/-/issues/1790
-rw-r--r-- | src/nautilus-trash-bar.c | 31 |
1 files changed, 30 insertions, 1 deletions
diff --git a/src/nautilus-trash-bar.c b/src/nautilus-trash-bar.c index 4f7d7e2d9..d458fa862 100644 --- a/src/nautilus-trash-bar.c +++ b/src/nautilus-trash-bar.c @@ -41,7 +41,8 @@ enum enum { - TRASH_BAR_RESPONSE_EMPTY = 1, + TRASH_BAR_RESPONSE_AUTODELETE = 1, + TRASH_BAR_RESPONSE_EMPTY, TRASH_BAR_RESPONSE_RESTORE }; @@ -164,6 +165,28 @@ trash_bar_response_cb (GtkInfoBar *infobar, switch (response_id) { + case TRASH_BAR_RESPONSE_AUTODELETE: + { + g_autoptr (GAppInfo) app_info = NULL; + g_autoptr (GError) error = NULL; + + app_info = g_app_info_create_from_commandline ("gnome-control-center usage", + NULL, + G_APP_INFO_CREATE_NONE, + NULL); + + g_app_info_launch (app_info, NULL, NULL, &error); + + if (error) + { + show_dialog (_("There was an error launching the application."), + error->message, + GTK_WINDOW (window), + GTK_MESSAGE_ERROR); + } + } + break; + case TRASH_BAR_RESPONSE_EMPTY: { nautilus_file_operations_empty_trash (window, TRUE, NULL); @@ -219,6 +242,12 @@ nautilus_trash_bar_init (NautilusTrashBar *bar) gtk_container_add (GTK_CONTAINER (content_area), subtitle); w = gtk_info_bar_add_button (GTK_INFO_BAR (bar), + _("_Settings"), + TRASH_BAR_RESPONSE_AUTODELETE); + gtk_widget_set_tooltip_text (w, + _("Display system controls for trash content")); + + w = gtk_info_bar_add_button (GTK_INFO_BAR (bar), _("_Restore"), TRASH_BAR_RESPONSE_RESTORE); gtk_widget_set_tooltip_text (w, |