forked from AuroraMiddleware/gtk
dnd: Remove "delete" argument from gtk_drag_finish()
The argument is ignored by anything but X11. It's treated like suggested_action == MOVE. So do that in gtk_drag_finish(), too.
This commit is contained in:
parent
803cbd576f
commit
7a17865b22
@ -322,7 +322,7 @@ interactive_canvas_drag_data_received (GtkWidget *widget,
|
||||
canvas_items = g_list_append (canvas_items, item);
|
||||
drop_item = NULL;
|
||||
|
||||
gtk_drag_finish (context, TRUE, FALSE, time);
|
||||
gtk_drag_finish (context, TRUE, time);
|
||||
} else
|
||||
{
|
||||
drop_item = item;
|
||||
|
@ -3030,7 +3030,7 @@ gtk_calendar_drag_data_received (GtkWidget *widget,
|
||||
{
|
||||
g_warning ("Received invalid date data");
|
||||
g_date_free (date);
|
||||
gtk_drag_finish (context, FALSE, FALSE, time);
|
||||
gtk_drag_finish (context, FALSE, time);
|
||||
return;
|
||||
}
|
||||
|
||||
@ -3039,7 +3039,7 @@ gtk_calendar_drag_data_received (GtkWidget *widget,
|
||||
year = g_date_get_year (date);
|
||||
g_date_free (date);
|
||||
|
||||
gtk_drag_finish (context, TRUE, FALSE, time);
|
||||
gtk_drag_finish (context, TRUE, time);
|
||||
|
||||
|
||||
g_object_freeze_notify (G_OBJECT (calendar));
|
||||
|
27
gtk/gtkdnd.c
27
gtk/gtkdnd.c
@ -378,7 +378,6 @@ gtk_drag_get_data_finish (GtkDragGetData *data,
|
||||
|
||||
gtk_drag_finish (data->context,
|
||||
size > 0,
|
||||
(gdk_drag_context_get_selected_action (data->context) == GDK_ACTION_MOVE),
|
||||
data->time);
|
||||
}
|
||||
|
||||
@ -519,8 +518,6 @@ gtk_drag_get_source_widget (GdkDragContext *context)
|
||||
* gtk_drag_finish: (method)
|
||||
* @context: the drag context
|
||||
* @success: a flag indicating whether the drop was successful
|
||||
* @del: a flag indicating whether the source should delete the
|
||||
* original data. (This should be %TRUE for a move)
|
||||
* @time_: the timestamp from the #GtkWidget::drag-drop signal
|
||||
*
|
||||
* Informs the drag source that the drop is finished, and
|
||||
@ -529,19 +526,11 @@ gtk_drag_get_source_widget (GdkDragContext *context)
|
||||
void
|
||||
gtk_drag_finish (GdkDragContext *context,
|
||||
gboolean success,
|
||||
gboolean del,
|
||||
guint32 time)
|
||||
{
|
||||
GdkAtom target = NULL;
|
||||
|
||||
g_return_if_fail (GDK_IS_DRAG_CONTEXT (context));
|
||||
|
||||
if (success && del)
|
||||
{
|
||||
target = gdk_atom_intern_static_string ("DELETE");
|
||||
}
|
||||
|
||||
if (target != NULL)
|
||||
if (success && gdk_drag_context_get_selected_action (context) == GDK_ACTION_MOVE)
|
||||
{
|
||||
GtkWidget *selection_widget = gtk_drag_get_ipc_widget_for_display (gdk_window_get_display (gdk_drag_context_get_source_window (context)));
|
||||
|
||||
@ -554,12 +543,13 @@ gtk_drag_finish (GdkDragContext *context,
|
||||
|
||||
gtk_selection_convert (selection_widget,
|
||||
gdk_drag_get_selection (context),
|
||||
target,
|
||||
gdk_atom_intern_static_string ("DELETE"),
|
||||
time);
|
||||
}
|
||||
|
||||
if (!(success && del))
|
||||
gdk_drop_finish (context, success, time);
|
||||
else
|
||||
{
|
||||
gdk_drop_finish (context, success, time);
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
@ -710,7 +700,7 @@ gtk_drag_selection_received (GtkWidget *widget,
|
||||
target = gtk_selection_data_get_target (selection_data);
|
||||
if (target == gdk_atom_intern_static_string ("DELETE"))
|
||||
{
|
||||
gtk_drag_finish (context, TRUE, FALSE, time);
|
||||
gdk_drop_finish (context, TRUE, time);
|
||||
}
|
||||
else
|
||||
{
|
||||
@ -745,7 +735,6 @@ gtk_drag_selection_received (GtkWidget *widget,
|
||||
|
||||
gtk_drag_finish (context,
|
||||
(gtk_selection_data_get_length (selection_data) >= 0),
|
||||
(gdk_drag_context_get_selected_action (context) == GDK_ACTION_MOVE),
|
||||
time);
|
||||
}
|
||||
|
||||
@ -1034,7 +1023,7 @@ gtk_drag_dest_drop (GtkWidget *widget,
|
||||
|
||||
if (target == NULL)
|
||||
{
|
||||
gtk_drag_finish (context, FALSE, FALSE, time);
|
||||
gtk_drag_finish (context, FALSE, time);
|
||||
return TRUE;
|
||||
}
|
||||
else
|
||||
|
@ -47,7 +47,6 @@ void gtk_drag_get_data (GtkWidget *widget,
|
||||
GDK_AVAILABLE_IN_ALL
|
||||
void gtk_drag_finish (GdkDragContext *context,
|
||||
gboolean success,
|
||||
gboolean del,
|
||||
guint32 time_);
|
||||
|
||||
GDK_AVAILABLE_IN_ALL
|
||||
|
@ -8922,7 +8922,7 @@ gtk_entry_drag_drop (GtkWidget *widget,
|
||||
gtk_drag_get_data (widget, context, target, time);
|
||||
}
|
||||
else
|
||||
gtk_drag_finish (context, FALSE, FALSE, time);
|
||||
gtk_drag_finish (context, FALSE, time);
|
||||
|
||||
return TRUE;
|
||||
}
|
||||
@ -9026,12 +9026,12 @@ gtk_entry_drag_data_received (GtkWidget *widget,
|
||||
end_change (entry);
|
||||
}
|
||||
|
||||
gtk_drag_finish (context, TRUE, gdk_drag_context_get_selected_action (context) == GDK_ACTION_MOVE, time);
|
||||
gtk_drag_finish (context, TRUE, time);
|
||||
}
|
||||
else
|
||||
{
|
||||
/* Drag and drop didn't happen! */
|
||||
gtk_drag_finish (context, FALSE, FALSE, time);
|
||||
gtk_drag_finish (context, FALSE, time);
|
||||
}
|
||||
|
||||
g_free (str);
|
||||
|
@ -1265,7 +1265,7 @@ gtk_file_chooser_button_drag_data_received (GtkWidget *widget,
|
||||
g_signal_emit (button, file_chooser_button_signals[FILE_SET], 0);
|
||||
}
|
||||
|
||||
gtk_drag_finish (context, TRUE, FALSE, drag_time);
|
||||
gtk_drag_finish (context, TRUE, drag_time);
|
||||
}
|
||||
|
||||
static void
|
||||
|
@ -6539,7 +6539,6 @@ gtk_icon_view_drag_data_received (GtkWidget *widget,
|
||||
|
||||
gtk_drag_finish (context,
|
||||
accepted,
|
||||
(gdk_drag_context_get_selected_action (context) == GDK_ACTION_MOVE),
|
||||
time);
|
||||
|
||||
gtk_tree_path_free (dest_row);
|
||||
|
@ -3308,10 +3308,10 @@ gtk_notebook_drag_data_received (GtkWidget *widget,
|
||||
child = (void*) gtk_selection_data_get_data (data);
|
||||
|
||||
do_detach_tab (GTK_NOTEBOOK (source_widget), notebook, *child);
|
||||
gtk_drag_finish (context, TRUE, FALSE, time);
|
||||
gtk_drag_finish (context, TRUE, time);
|
||||
}
|
||||
else
|
||||
gtk_drag_finish (context, FALSE, FALSE, time);
|
||||
gtk_drag_finish (context, FALSE, time);
|
||||
}
|
||||
|
||||
/* Private GtkContainer Methods :
|
||||
|
@ -2101,7 +2101,7 @@ drag_data_received_callback (GtkWidget *list_box,
|
||||
|
||||
out:
|
||||
sidebar->drop_occurred = FALSE;
|
||||
gtk_drag_finish (context, success, FALSE, time);
|
||||
gtk_drag_finish (context, success, time);
|
||||
stop_drop_feedback (sidebar);
|
||||
g_free (target_uri);
|
||||
}
|
||||
|
@ -8049,7 +8049,7 @@ gtk_text_view_drag_drop (GtkWidget *widget,
|
||||
if (target != NULL)
|
||||
gtk_drag_get_data (widget, context, target, time);
|
||||
else
|
||||
gtk_drag_finish (context, FALSE, FALSE, time);
|
||||
gtk_drag_finish (context, FALSE, time);
|
||||
|
||||
return TRUE;
|
||||
}
|
||||
@ -8155,9 +8155,7 @@ gtk_text_view_drag_data_received (GtkWidget *widget,
|
||||
insert_text_data (text_view, &drop_point, selection_data);
|
||||
|
||||
done:
|
||||
gtk_drag_finish (context, success,
|
||||
success && gdk_drag_context_get_selected_action (context) == GDK_ACTION_MOVE,
|
||||
time);
|
||||
gtk_drag_finish (context, success, time);
|
||||
|
||||
if (success)
|
||||
{
|
||||
|
@ -7902,10 +7902,7 @@ gtk_tree_view_drag_data_received (GtkWidget *widget,
|
||||
accepted = TRUE;
|
||||
}
|
||||
|
||||
gtk_drag_finish (context,
|
||||
accepted,
|
||||
(gdk_drag_context_get_selected_action (context) == GDK_ACTION_MOVE),
|
||||
time);
|
||||
gtk_drag_finish (context, accepted, time);
|
||||
|
||||
if (gtk_tree_path_get_depth (dest_row) == 1 &&
|
||||
gtk_tree_path_get_indices (dest_row)[0] == 0 &&
|
||||
|
@ -375,11 +375,11 @@ target_drag_data_received (GtkWidget *widget,
|
||||
gtk_selection_data_get_format (selection_data) == 8)
|
||||
{
|
||||
g_print ("Received \"%s\" in trashcan\n", (gchar *) gtk_selection_data_get_data (selection_data));
|
||||
gtk_drag_finish (context, TRUE, FALSE, time);
|
||||
gtk_drag_finish (context, TRUE, time);
|
||||
return;
|
||||
}
|
||||
|
||||
gtk_drag_finish (context, FALSE, FALSE, time);
|
||||
gtk_drag_finish (context, FALSE, time);
|
||||
}
|
||||
|
||||
void
|
||||
@ -393,11 +393,11 @@ label_drag_data_received (GtkWidget *widget,
|
||||
gtk_selection_data_get_format (selection_data) == 8)
|
||||
{
|
||||
g_print ("Received \"%s\" in label\n", (gchar *) gtk_selection_data_get_data (selection_data));
|
||||
gtk_drag_finish (context, TRUE, FALSE, time);
|
||||
gtk_drag_finish (context, TRUE, time);
|
||||
return;
|
||||
}
|
||||
|
||||
gtk_drag_finish (context, FALSE, FALSE, time);
|
||||
gtk_drag_finish (context, FALSE, time);
|
||||
}
|
||||
|
||||
void
|
||||
|
Loading…
Reference in New Issue
Block a user