[nautilus/wip/antoniof/gtk4-preparation-file-chooser-api: 2/3] files-view: Stop setting custom filechooser filter




commit 051080f3f927a1014ee11bbc462147a51082c2d8
Author: António Fernandes <antoniof gnome org>
Date:   Wed Dec 22 23:43:51 2021 +0000

    files-view: Stop setting custom filechooser filter
    
    We set a custom filter to prevent selecting a folder that's part of the
    selection as the destination to move that selection.
    
    GTK 4 doesn't support custom filters, and the available options don't
    fit this purpose.
    
    Just remove it. It's safe: we popup an error dialog saying you can't
    move a folder into iself. Of course, it would better not to allow the user to make this
    mistake, but let's we can't have everything.

 src/nautilus-files-view.c | 39 ---------------------------------------
 1 file changed, 39 deletions(-)
---
diff --git a/src/nautilus-files-view.c b/src/nautilus-files-view.c
index 64ca4377b..4b22f58e1 100644
--- a/src/nautilus-files-view.c
+++ b/src/nautilus-files-view.c
@@ -5963,28 +5963,6 @@ on_destination_dialog_response (GtkDialog *dialog,
     gtk_widget_destroy (GTK_WIDGET (dialog));
 }
 
-static gboolean
-destination_dialog_filter_cb (const GtkFileFilterInfo *filter_info,
-                              gpointer                 user_data)
-{
-    GList *selection = user_data;
-    GList *l;
-
-    for (l = selection; l != NULL; l = l->next)
-    {
-        char *uri;
-        uri = nautilus_file_get_uri (l->data);
-        if (strcmp (uri, filter_info->uri) == 0)
-        {
-            g_free (uri);
-            return FALSE;
-        }
-        g_free (uri);
-    }
-
-    return TRUE;
-}
-
 static GList *
 get_selected_folders (GList *selection)
 {
@@ -6046,23 +6024,6 @@ copy_or_move_selection (NautilusFilesView *view,
     copy_data->selection = selection;
     copy_data->is_move = is_move;
 
-    if (selection != NULL)
-    {
-        GtkFileFilter *filter;
-        GList *folders;
-
-        folders = get_selected_folders (selection);
-
-        filter = gtk_file_filter_new ();
-        gtk_file_filter_add_custom (filter,
-                                    GTK_FILE_FILTER_URI,
-                                    destination_dialog_filter_cb,
-                                    folders,
-                                    (GDestroyNotify) nautilus_file_list_free);
-        gtk_file_chooser_set_filter (GTK_FILE_CHOOSER (dialog), filter);
-    }
-
-
     if (nautilus_view_is_searching (NAUTILUS_VIEW (view)))
     {
         directory = nautilus_search_directory_get_base_model (NAUTILUS_SEARCH_DIRECTORY (priv->model));


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