[nautilus/wip/antoniof/gnome-42: 64/72] Revert "files-view: Stop connecting to GtkFileChooser::current-folder-changed"
- From: António Fernandes <antoniof src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [nautilus/wip/antoniof/gnome-42: 64/72] Revert "files-view: Stop connecting to GtkFileChooser::current-folder-changed"
- Date: Fri, 11 Feb 2022 19:28:02 +0000 (UTC)
commit b9e939ae383226b05e2acdc2e17faa5ff2f8971e
Author: António Fernandes <antoniof gnome org>
Date: Fri Feb 11 19:06:12 2022 +0000
Revert "files-view: Stop connecting to GtkFileChooser::current-folder-changed"
This reverts commit f9197e0ee01c1d4494ddbb90f7e3b717d02930e3.
src/nautilus-files-view.c | 39 +++++++++++++++++++++++++++++++++++++++
1 file changed, 39 insertions(+)
---
diff --git a/src/nautilus-files-view.c b/src/nautilus-files-view.c
index 93270c9bf..0e8908e8e 100644
--- a/src/nautilus-files-view.c
+++ b/src/nautilus-files-view.c
@@ -5823,6 +5823,42 @@ 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,
@@ -5916,6 +5952,9 @@ copy_or_move_selection (NautilusFilesView *view,
}
gtk_file_chooser_set_current_folder_file (GTK_FILE_CHOOSER (dialog), location, NULL);
+ 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]