Commit 249d46e9 authored by William Jon McCann's avatar William Jon McCann

Disallow selecting source dirs for target dir

https://bugzilla.gnome.org/show_bug.cgi?id=679579
parent 75fcef36
......@@ -5973,6 +5973,40 @@ 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)
{
GList *folders;
GList *l;
folders = NULL;
for (l = selection; l != NULL; l = l->next) {
if (nautilus_file_is_directory (l->data))
folders = g_list_prepend (folders, nautilus_file_ref (l->data));
}
return g_list_reverse (folders);
}
static void
add_window_location_bookmarks (CopyCallbackData *data)
{
......@@ -6020,6 +6054,21 @@ copy_or_move_selection (NautilusView *view,
add_window_location_bookmarks (copy_data);
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);
}
uri = nautilus_directory_get_uri (view->details->model);
gtk_file_chooser_set_current_folder_uri (GTK_FILE_CHOOSER (dialog), uri);
g_free (uri);
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment