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
This commit is contained in:
Eric 2021-07-08 11:05:01 -04:00 committed by António Fernandes
parent 4e02d0ffbd
commit 658ad9d9e8

View file

@ -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);
@ -218,6 +241,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);