Commit e2b876ac authored by Alexander Larsson's avatar Alexander Larsson Committed by Alexander Larsson

Add nautilus_drag_uris_local

2008-01-15  Alexander Larsson  <alexl@redhat.com>

        * libnautilus-private/nautilus-dnd.[ch]:
	Add nautilus_drag_uris_local
	
        * libnautilus-private/nautilus-tree-view-drag-dest.c:
	Don't copy/move files if you dnd within the same
	location (#508216)



svn path=/trunk/; revision=13610
parent d0ae165f
2008-01-15 Alexander Larsson <alexl@redhat.com>
* libnautilus-private/nautilus-dnd.[ch]:
Add nautilus_drag_uris_local
* libnautilus-private/nautilus-tree-view-drag-dest.c:
Don't copy/move files if you dnd within the same
location (#508216)
2008-01-15 Alexander Larsson <alexl@redhat.com>
* src/file-manager/fm-directory-view.c:
......
......@@ -202,9 +202,9 @@ nautilus_drag_build_selection_list (GtkSelectionData *data)
return result;
}
gboolean
nautilus_drag_items_local (const char *target_uri_string, const GList *selection_list)
static gboolean
nautilus_drag_file_local_internal (const char *target_uri_string,
const char *first_source_uri)
{
/* check if the first item on the list has target_uri_string as a parent
* FIXME:
......@@ -214,15 +214,12 @@ nautilus_drag_items_local (const char *target_uri_string, const GList *selection
GFile *target, *item, *parent;
gboolean result;
/* must have at least one item */
g_assert (selection_list);
result = FALSE;
target = g_file_new_for_uri (target_uri_string);
/* get the parent URI of the first item in the selection */
item = g_file_new_for_uri (((NautilusDragSelectionItem *)selection_list->data)->uri);
item = g_file_new_for_uri (first_source_uri);
parent = g_file_get_parent (item);
g_object_unref (item);
......@@ -232,6 +229,27 @@ nautilus_drag_items_local (const char *target_uri_string, const GList *selection
}
return result;
}
gboolean
nautilus_drag_uris_local (const char *target_uri,
const GList *source_uri_list)
{
/* must have at least one item */
g_assert (source_uri_list);
return nautilus_drag_file_local_internal (target_uri, source_uri_list->data);
}
gboolean
nautilus_drag_items_local (const char *target_uri_string,
const GList *selection_list)
{
/* must have at least one item */
g_assert (selection_list);
return nautilus_drag_file_local_internal (target_uri_string,
((NautilusDragSelectionItem *)selection_list->data)->uri);
}
gboolean
......
......@@ -117,6 +117,8 @@ void nautilus_drag_destroy_selection_list (GList
GList *nautilus_drag_build_selection_list (GtkSelectionData *data);
gboolean nautilus_drag_items_local (const char *target_uri,
const GList *selection_list);
gboolean nautilus_drag_uris_local (const char *target_uri,
const GList *source_uri_list);
gboolean nautilus_drag_items_in_trash (const GList *selection_list);
gboolean nautilus_drag_items_on_desktop (const GList *selection_list);
void nautilus_drag_default_drop_action_for_icons (GdkDragContext *context,
......
......@@ -581,11 +581,13 @@ receive_uris (NautilusTreeViewDragDest *dest,
}
if (context->action > 0) {
g_signal_emit (dest, signals[MOVE_COPY_ITEMS], 0,
source_uris,
drop_target,
context->action,
x, y);
if (!nautilus_drag_uris_local (drop_target, source_uris)) {
g_signal_emit (dest, signals[MOVE_COPY_ITEMS], 0,
source_uris,
drop_target,
context->action,
x, y);
}
}
g_free (drop_target);
......
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