trash-bar: Add autodelete label

Nautilus currently provides no indication that GNOME Settings allows
users to configure automatic emptying of the trash. This commit adds
a subtitle to the trash bar, informing users whether or not automatic
emptying is currently enabled.

Relates: https://gitlab.gnome.org/GNOME/nautilus/-/issues/1790
This commit is contained in:
Eric 2021-07-08 11:01:15 -04:00 committed by António Fernandes
parent c8c683941d
commit 4e02d0ffbd
3 changed files with 16 additions and 0 deletions

View file

@ -41,6 +41,7 @@ GSettings *gtk_filechooser_preferences;
GSettings *gnome_lockdown_preferences;
GSettings *gnome_background_preferences;
GSettings *gnome_interface_preferences;
GSettings *gnome_privacy_preferences;
void
nautilus_global_preferences_init (void)
@ -65,4 +66,5 @@ nautilus_global_preferences_init (void)
gnome_lockdown_preferences = g_settings_new ("org.gnome.desktop.lockdown");
gnome_background_preferences = g_settings_new ("org.gnome.desktop.background");
gnome_interface_preferences = g_settings_new ("org.gnome.desktop.interface");
gnome_privacy_preferences = g_settings_new ("org.gnome.desktop.privacy");
}

View file

@ -152,5 +152,6 @@ extern GSettings *gtk_filechooser_preferences;
extern GSettings *gnome_lockdown_preferences;
extern GSettings *gnome_background_preferences;
extern GSettings *gnome_interface_preferences;
extern GSettings *gnome_privacy_preferences;
G_END_DECLS

View file

@ -25,11 +25,13 @@
#include "nautilus-trash-bar.h"
#include "nautilus-global-preferences.h"
#include "nautilus-files-view.h"
#include "nautilus-file-operations.h"
#include "nautilus-file-utilities.h"
#include "nautilus-file.h"
#include "nautilus-trash-monitor.h"
#include "nautilus-ui-utilities.h"
enum
{
@ -188,6 +190,7 @@ nautilus_trash_bar_init (NautilusTrashBar *bar)
{
GtkWidget *content_area, *action_area, *w;
GtkWidget *label;
GtkWidget *subtitle;
PangoAttrList *attrs;
content_area = gtk_info_bar_get_content_area (GTK_INFO_BAR (bar));
@ -202,9 +205,19 @@ nautilus_trash_bar_init (NautilusTrashBar *bar)
gtk_label_set_attributes (GTK_LABEL (label), attrs);
pango_attr_list_unref (attrs);
subtitle = gtk_label_new (_("Trashed items are automatically deleted after a period of time"));
g_settings_bind (gnome_privacy_preferences,
"remove-old-trash-files",
subtitle,
"visible",
G_SETTINGS_BIND_GET);
gtk_widget_show (label);
gtk_container_add (GTK_CONTAINER (content_area), label);
gtk_container_add (GTK_CONTAINER (content_area), subtitle);
w = gtk_info_bar_add_button (GTK_INFO_BAR (bar),
_("_Restore"),
TRASH_BAR_RESPONSE_RESTORE);