[file-roller/wip/gtk4: 51/54] location button: only show directories in the file chooser




commit b51c21e5af1229f490650f9f06341dff3611d0f1
Author: Paolo Bacchilega <paobac src gnome org>
Date:   Sun Oct 2 12:07:05 2022 +0200

    location button: only show directories in the file chooser

 src/fr-location-button.c | 5 +++++
 1 file changed, 5 insertions(+)
---
diff --git a/src/fr-location-button.c b/src/fr-location-button.c
index 4b609413..adb81b4b 100644
--- a/src/fr-location-button.c
+++ b/src/fr-location-button.c
@@ -187,6 +187,11 @@ clicked_cb (GtkButton *button,
        gtk_native_dialog_set_modal (GTK_NATIVE_DIALOG (private->chooser), TRUE);
        if (private->location != NULL)
                gtk_file_chooser_set_file (GTK_FILE_CHOOSER (private->chooser), private->location, NULL);
+
+       GtkFileFilter *filter = gtk_file_filter_new ();
+       gtk_file_filter_add_mime_type (filter, "inode/directory");
+       gtk_file_chooser_set_filter (GTK_FILE_CHOOSER (private->chooser), filter);
+
        g_signal_connect (private->chooser,
                          "response",
                          G_CALLBACK (file_chooser_response_cb),


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