[nautilus/wip/antoniof/gtk4-preparation-file-chooser-api: 14/16] files-view: Stop connecting to GtkFileChooser::current-folder-changed




commit f9197e0ee01c1d4494ddbb90f7e3b717d02930e3
Author: António Fernandes <antoniof gnome org>
Date:   Sun Dec 26 01:07:06 2021 +0000

    files-view: Stop connecting to GtkFileChooser::current-folder-changed
    
    The signal is gone in GTK 4.
    
    We have been using it to disable the action button if the destination
    is a descendant of selection, which is not allowed for copy/move.
    
    Ideally, we should reimplement this feature as a mode in our main
    window, instead of using a file chooser. Until then, we can rely on
    our file operations code to impede and warn about a copy-move operation.

 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 55a98f3b6..79c2985c0 100644
--- a/src/nautilus-files-view.c
+++ b/src/nautilus-files-view.c
@@ -5883,42 +5883,6 @@ copy_data_free (CopyCallbackData *data)
     g_free (data);
 }
 
-static gboolean
-uri_is_parent_of_selection (GList      *selection,
-                            const char *uri)
-{
-    gboolean found;
-    GList *l;
-    GFile *file;
-
-    found = FALSE;
-
-    file = g_file_new_for_uri (uri);
-    for (l = selection; !found && l != NULL; l = l->next)
-    {
-        GFile *parent;
-        parent = nautilus_file_get_parent_location (l->data);
-        found = g_file_equal (file, parent);
-        g_object_unref (parent);
-    }
-    g_object_unref (file);
-    return found;
-}
-
-static void
-on_destination_dialog_folder_changed (GtkFileChooser *chooser,
-                                      gpointer        user_data)
-{
-    CopyCallbackData *copy_data = user_data;
-    char *uri;
-    gboolean found;
-
-    uri = gtk_file_chooser_get_current_folder_uri (chooser);
-    found = uri_is_parent_of_selection (copy_data->selection, uri);
-    gtk_dialog_set_response_sensitive (GTK_DIALOG (chooser), GTK_RESPONSE_OK, !found);
-    g_free (uri);
-}
-
 static void
 on_destination_dialog_response (GtkDialog *dialog,
                                 gint       response_id,
@@ -6012,9 +5976,6 @@ copy_or_move_selection (NautilusFilesView *view,
 
     gtk_file_chooser_set_current_folder_uri (GTK_FILE_CHOOSER (dialog), uri);
     g_free (uri);
-    g_signal_connect (dialog, "current-folder-changed",
-                      G_CALLBACK (on_destination_dialog_folder_changed),
-                      copy_data);
     g_signal_connect (dialog, "response",
                       G_CALLBACK (on_destination_dialog_response),
                       copy_data);


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