forked from AuroraMiddleware/gtk
Emit drag-perform-drop when we need the caller to do the drop action
Signed-off-by: Federico Mena Quintero <federico@gnome.org>
This commit is contained in:
parent
221ea9d4c5
commit
4fe86f1d10
@ -47,6 +47,12 @@
|
|||||||
* * Nautilus needs to connect to "drag-action-ask", and return the
|
* * Nautilus needs to connect to "drag-action-ask", and return the
|
||||||
* appropriate action after running a popup menu. It needs to call
|
* appropriate action after running a popup menu. It needs to call
|
||||||
* nautilus_drag_drop_action_ask().
|
* nautilus_drag_drop_action_ask().
|
||||||
|
*
|
||||||
|
* * Nautilus needs to connect to "drag-perform-drop", and call
|
||||||
|
* nautilus_file_operations_copy_move() as appropriate.
|
||||||
|
* nautilus_file_operations_copy_move (uris, NULL, drop_uri,
|
||||||
|
* real_action, GTK_WIDGET (tree_view),
|
||||||
|
* NULL, NULL);
|
||||||
*/
|
*/
|
||||||
|
|
||||||
#include "config.h"
|
#include "config.h"
|
||||||
@ -1496,7 +1502,7 @@ drag_leave_callback (GtkTreeView *tree_view,
|
|||||||
|
|
||||||
/* Takes an array of URIs and turns it into a list of string URIs */
|
/* Takes an array of URIs and turns it into a list of string URIs */
|
||||||
static GList *
|
static GList *
|
||||||
build_uri_list (char **uris)
|
build_uri_list (const char **uris)
|
||||||
{
|
{
|
||||||
GList *result;
|
GList *result;
|
||||||
int i;
|
int i;
|
||||||
@ -1576,7 +1582,7 @@ drag_data_received_callback (GtkWidget *widget,
|
|||||||
char **uris;
|
char **uris;
|
||||||
|
|
||||||
uris = gtk_selection_data_get_uris (selection_data);
|
uris = gtk_selection_data_get_uris (selection_data);
|
||||||
sidebar->drag_list = build_uri_list (uris);
|
sidebar->drag_list = build_uri_list ((const char **) uris);
|
||||||
g_strfreev (uris);
|
g_strfreev (uris);
|
||||||
} else {
|
} else {
|
||||||
sidebar->drag_list = NULL;
|
sidebar->drag_list = NULL;
|
||||||
@ -1632,7 +1638,8 @@ drag_data_received_callback (GtkWidget *widget,
|
|||||||
}
|
}
|
||||||
} else {
|
} else {
|
||||||
GdkDragAction real_action;
|
GdkDragAction real_action;
|
||||||
GList *uris;
|
char **uris;
|
||||||
|
GList *uri_list;
|
||||||
char *drop_uri;
|
char *drop_uri;
|
||||||
|
|
||||||
/* file transfer requested */
|
/* file transfer requested */
|
||||||
@ -1641,7 +1648,6 @@ drag_data_received_callback (GtkWidget *widget,
|
|||||||
if (real_action == GDK_ACTION_ASK)
|
if (real_action == GDK_ACTION_ASK)
|
||||||
real_action = emit_drag_action_ask (sidebar, gdk_drag_context_get_actions (context));
|
real_action = emit_drag_action_ask (sidebar, gdk_drag_context_get_actions (context));
|
||||||
|
|
||||||
#if DO_NOT_COMPILE
|
|
||||||
if (real_action > 0) {
|
if (real_action > 0) {
|
||||||
model = gtk_tree_view_get_model (tree_view);
|
model = gtk_tree_view_get_model (tree_view);
|
||||||
|
|
||||||
@ -1652,11 +1658,11 @@ drag_data_received_callback (GtkWidget *widget,
|
|||||||
|
|
||||||
switch (info) {
|
switch (info) {
|
||||||
case TEXT_URI_LIST:
|
case TEXT_URI_LIST:
|
||||||
uris = build_uri_list ((const gchar *) gtk_selection_data_get_data (selection_data));
|
uris = gtk_selection_data_get_uris (selection_data);
|
||||||
nautilus_file_operations_copy_move (uris, NULL, drop_uri,
|
uri_list = build_uri_list ((const char **) uris);
|
||||||
real_action, GTK_WIDGET (tree_view),
|
emit_drag_perform_drop (sidebar, uri_list, drop_uri, real_action);
|
||||||
NULL, NULL);
|
g_list_free_full (uri_list, g_free);
|
||||||
g_list_free_full (uris, g_free);
|
g_strfreev (uris);
|
||||||
success = TRUE;
|
success = TRUE;
|
||||||
break;
|
break;
|
||||||
case GTK_TREE_MODEL_ROW:
|
case GTK_TREE_MODEL_ROW:
|
||||||
@ -1669,7 +1675,6 @@ drag_data_received_callback (GtkWidget *widget,
|
|||||||
|
|
||||||
g_free (drop_uri);
|
g_free (drop_uri);
|
||||||
}
|
}
|
||||||
#endif
|
|
||||||
}
|
}
|
||||||
|
|
||||||
out:
|
out:
|
||||||
|
Loading…
Reference in New Issue
Block a user