[nautilus] trash-bar: Add link to autodelete settings



commit 658ad9d9e82e0a1e4edcf2841476bde3561504ff
Author: Eric <8319652+edaigle users noreply github com>
Date:   Thu Jul 8 11:05:01 2021 -0400

    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

 src/nautilus-trash-bar.c | 31 ++++++++++++++++++++++++++++++-
 1 file changed, 30 insertions(+), 1 deletion(-)
---
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);
@@ -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);


[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]