dnd: make sidebar show "new bookmark" only for folders

Make sure sidebar shows "new bookmark" only when folders
are being dragged.

https://bugzilla.gnome.org/show_bug.cgi?id=754513
This commit is contained in:
Nelson Benítez León 2017-08-13 19:46:08 +05:00 committed by Carlos Soriano
parent 611f381d56
commit f0c81e22a3
4 changed files with 30 additions and 2 deletions

View file

@ -1459,6 +1459,7 @@ drag_begin_callback (GtkWidget *widget,
double x1, y1, x2, y2, winx, winy;
int x_offset, y_offset;
int start_x, start_y;
GList *dragged_files;
container = NAUTILUS_CANVAS_CONTAINER (widget);
window = NAUTILUS_WINDOW (gtk_widget_get_toplevel (GTK_WIDGET (container)));
@ -1491,7 +1492,12 @@ drag_begin_callback (GtkWidget *widget,
container->details->dnd_source_info->selection_cache = nautilus_drag_create_selection_cache (widget,
each_icon_get_data_binder);
nautilus_window_start_dnd (window, context);
dragged_files = nautilus_drag_file_list_from_selection_list (drag_info->selection_cache);
if (nautilus_file_list_are_all_folders (dragged_files))
{
nautilus_window_start_dnd (window, context);
}
g_list_free_full (dragged_files, g_object_unref);
}
void

View file

@ -4204,6 +4204,21 @@ nautilus_file_list_filter (GList *files,
return filtered;
}
gboolean
nautilus_file_list_are_all_folders (const GList *files)
{
const GList *l;
for (l = files; l != NULL; l = l->next)
{
if (!nautilus_file_is_directory (NAUTILUS_FILE (l->data)))
{
return FALSE;
}
}
return TRUE;
}
char *
nautilus_file_get_metadata (NautilusFile *file,
const char *key,

View file

@ -503,6 +503,7 @@ GList * nautilus_file_list_filter (GList
GList **failed,
NautilusFileFilterFunc filter_function,
gpointer user_data);
gboolean nautilus_file_list_are_all_folders (const GList *files);
/* DND */
gboolean nautilus_drag_can_accept_item (NautilusFile *drop_target_item,
const char *item_uri);

View file

@ -176,6 +176,7 @@ drag_begin_callback (GtkWidget *widget,
{
cairo_surface_t *surface;
NautilusWindow *window;
GList *dragged_files;
window = nautilus_files_view_get_window (NAUTILUS_FILES_VIEW (view));
surface = get_drag_surface (view);
@ -195,7 +196,12 @@ drag_begin_callback (GtkWidget *widget,
view->details->drag_source_info->selection_cache = nautilus_drag_create_selection_cache (view,
each_item_get_data_binder);
nautilus_window_start_dnd (window, context);
dragged_files = nautilus_drag_file_list_from_selection_list (view->details->drag_source_info->selection_cache);
if (nautilus_file_list_are_all_folders (dragged_files))
{
nautilus_window_start_dnd (window, context);
}
g_list_free_full (dragged_files, g_object_unref);
}
static void