mirror of
https://gitlab.gnome.org/GNOME/gtk.git
synced 2025-01-15 14:50:06 +00:00
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);
|
canvas_items = g_list_append (canvas_items, item);
|
||||||
drop_item = NULL;
|
drop_item = NULL;
|
||||||
|
|
||||||
gtk_drag_finish (context, TRUE, FALSE, time);
|
gtk_drag_finish (context, TRUE, time);
|
||||||
} else
|
} else
|
||||||
{
|
{
|
||||||
drop_item = item;
|
drop_item = item;
|
||||||
|
@ -3030,7 +3030,7 @@ gtk_calendar_drag_data_received (GtkWidget *widget,
|
|||||||
{
|
{
|
||||||
g_warning ("Received invalid date data");
|
g_warning ("Received invalid date data");
|
||||||
g_date_free (date);
|
g_date_free (date);
|
||||||
gtk_drag_finish (context, FALSE, FALSE, time);
|
gtk_drag_finish (context, FALSE, time);
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -3039,7 +3039,7 @@ gtk_calendar_drag_data_received (GtkWidget *widget,
|
|||||||
year = g_date_get_year (date);
|
year = g_date_get_year (date);
|
||||||
g_date_free (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));
|
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,
|
gtk_drag_finish (data->context,
|
||||||
size > 0,
|
size > 0,
|
||||||
(gdk_drag_context_get_selected_action (data->context) == GDK_ACTION_MOVE),
|
|
||||||
data->time);
|
data->time);
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -519,8 +518,6 @@ gtk_drag_get_source_widget (GdkDragContext *context)
|
|||||||
* gtk_drag_finish: (method)
|
* gtk_drag_finish: (method)
|
||||||
* @context: the drag context
|
* @context: the drag context
|
||||||
* @success: a flag indicating whether the drop was successful
|
* @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
|
* @time_: the timestamp from the #GtkWidget::drag-drop signal
|
||||||
*
|
*
|
||||||
* Informs the drag source that the drop is finished, and
|
* Informs the drag source that the drop is finished, and
|
||||||
@ -529,19 +526,11 @@ gtk_drag_get_source_widget (GdkDragContext *context)
|
|||||||
void
|
void
|
||||||
gtk_drag_finish (GdkDragContext *context,
|
gtk_drag_finish (GdkDragContext *context,
|
||||||
gboolean success,
|
gboolean success,
|
||||||
gboolean del,
|
|
||||||
guint32 time)
|
guint32 time)
|
||||||
{
|
{
|
||||||
GdkAtom target = NULL;
|
|
||||||
|
|
||||||
g_return_if_fail (GDK_IS_DRAG_CONTEXT (context));
|
g_return_if_fail (GDK_IS_DRAG_CONTEXT (context));
|
||||||
|
|
||||||
if (success && del)
|
if (success && gdk_drag_context_get_selected_action (context) == GDK_ACTION_MOVE)
|
||||||
{
|
|
||||||
target = gdk_atom_intern_static_string ("DELETE");
|
|
||||||
}
|
|
||||||
|
|
||||||
if (target != NULL)
|
|
||||||
{
|
{
|
||||||
GtkWidget *selection_widget = gtk_drag_get_ipc_widget_for_display (gdk_window_get_display (gdk_drag_context_get_source_window (context)));
|
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,
|
gtk_selection_convert (selection_widget,
|
||||||
gdk_drag_get_selection (context),
|
gdk_drag_get_selection (context),
|
||||||
target,
|
gdk_atom_intern_static_string ("DELETE"),
|
||||||
time);
|
time);
|
||||||
}
|
}
|
||||||
|
else
|
||||||
if (!(success && del))
|
{
|
||||||
gdk_drop_finish (context, success, time);
|
gdk_drop_finish (context, success, time);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
@ -710,7 +700,7 @@ gtk_drag_selection_received (GtkWidget *widget,
|
|||||||
target = gtk_selection_data_get_target (selection_data);
|
target = gtk_selection_data_get_target (selection_data);
|
||||||
if (target == gdk_atom_intern_static_string ("DELETE"))
|
if (target == gdk_atom_intern_static_string ("DELETE"))
|
||||||
{
|
{
|
||||||
gtk_drag_finish (context, TRUE, FALSE, time);
|
gdk_drop_finish (context, TRUE, time);
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
@ -745,7 +735,6 @@ gtk_drag_selection_received (GtkWidget *widget,
|
|||||||
|
|
||||||
gtk_drag_finish (context,
|
gtk_drag_finish (context,
|
||||||
(gtk_selection_data_get_length (selection_data) >= 0),
|
(gtk_selection_data_get_length (selection_data) >= 0),
|
||||||
(gdk_drag_context_get_selected_action (context) == GDK_ACTION_MOVE),
|
|
||||||
time);
|
time);
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -1034,7 +1023,7 @@ gtk_drag_dest_drop (GtkWidget *widget,
|
|||||||
|
|
||||||
if (target == NULL)
|
if (target == NULL)
|
||||||
{
|
{
|
||||||
gtk_drag_finish (context, FALSE, FALSE, time);
|
gtk_drag_finish (context, FALSE, time);
|
||||||
return TRUE;
|
return TRUE;
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
|
@ -47,7 +47,6 @@ void gtk_drag_get_data (GtkWidget *widget,
|
|||||||
GDK_AVAILABLE_IN_ALL
|
GDK_AVAILABLE_IN_ALL
|
||||||
void gtk_drag_finish (GdkDragContext *context,
|
void gtk_drag_finish (GdkDragContext *context,
|
||||||
gboolean success,
|
gboolean success,
|
||||||
gboolean del,
|
|
||||||
guint32 time_);
|
guint32 time_);
|
||||||
|
|
||||||
GDK_AVAILABLE_IN_ALL
|
GDK_AVAILABLE_IN_ALL
|
||||||
|
@ -8922,7 +8922,7 @@ gtk_entry_drag_drop (GtkWidget *widget,
|
|||||||
gtk_drag_get_data (widget, context, target, time);
|
gtk_drag_get_data (widget, context, target, time);
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
gtk_drag_finish (context, FALSE, FALSE, time);
|
gtk_drag_finish (context, FALSE, time);
|
||||||
|
|
||||||
return TRUE;
|
return TRUE;
|
||||||
}
|
}
|
||||||
@ -9026,12 +9026,12 @@ gtk_entry_drag_data_received (GtkWidget *widget,
|
|||||||
end_change (entry);
|
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
|
else
|
||||||
{
|
{
|
||||||
/* Drag and drop didn't happen! */
|
/* Drag and drop didn't happen! */
|
||||||
gtk_drag_finish (context, FALSE, FALSE, time);
|
gtk_drag_finish (context, FALSE, time);
|
||||||
}
|
}
|
||||||
|
|
||||||
g_free (str);
|
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);
|
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
|
static void
|
||||||
|
@ -6539,7 +6539,6 @@ gtk_icon_view_drag_data_received (GtkWidget *widget,
|
|||||||
|
|
||||||
gtk_drag_finish (context,
|
gtk_drag_finish (context,
|
||||||
accepted,
|
accepted,
|
||||||
(gdk_drag_context_get_selected_action (context) == GDK_ACTION_MOVE),
|
|
||||||
time);
|
time);
|
||||||
|
|
||||||
gtk_tree_path_free (dest_row);
|
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);
|
child = (void*) gtk_selection_data_get_data (data);
|
||||||
|
|
||||||
do_detach_tab (GTK_NOTEBOOK (source_widget), notebook, *child);
|
do_detach_tab (GTK_NOTEBOOK (source_widget), notebook, *child);
|
||||||
gtk_drag_finish (context, TRUE, FALSE, time);
|
gtk_drag_finish (context, TRUE, time);
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
gtk_drag_finish (context, FALSE, FALSE, time);
|
gtk_drag_finish (context, FALSE, time);
|
||||||
}
|
}
|
||||||
|
|
||||||
/* Private GtkContainer Methods :
|
/* Private GtkContainer Methods :
|
||||||
|
@ -2101,7 +2101,7 @@ drag_data_received_callback (GtkWidget *list_box,
|
|||||||
|
|
||||||
out:
|
out:
|
||||||
sidebar->drop_occurred = FALSE;
|
sidebar->drop_occurred = FALSE;
|
||||||
gtk_drag_finish (context, success, FALSE, time);
|
gtk_drag_finish (context, success, time);
|
||||||
stop_drop_feedback (sidebar);
|
stop_drop_feedback (sidebar);
|
||||||
g_free (target_uri);
|
g_free (target_uri);
|
||||||
}
|
}
|
||||||
|
@ -8049,7 +8049,7 @@ gtk_text_view_drag_drop (GtkWidget *widget,
|
|||||||
if (target != NULL)
|
if (target != NULL)
|
||||||
gtk_drag_get_data (widget, context, target, time);
|
gtk_drag_get_data (widget, context, target, time);
|
||||||
else
|
else
|
||||||
gtk_drag_finish (context, FALSE, FALSE, time);
|
gtk_drag_finish (context, FALSE, time);
|
||||||
|
|
||||||
return TRUE;
|
return TRUE;
|
||||||
}
|
}
|
||||||
@ -8155,9 +8155,7 @@ gtk_text_view_drag_data_received (GtkWidget *widget,
|
|||||||
insert_text_data (text_view, &drop_point, selection_data);
|
insert_text_data (text_view, &drop_point, selection_data);
|
||||||
|
|
||||||
done:
|
done:
|
||||||
gtk_drag_finish (context, success,
|
gtk_drag_finish (context, success, time);
|
||||||
success && gdk_drag_context_get_selected_action (context) == GDK_ACTION_MOVE,
|
|
||||||
time);
|
|
||||||
|
|
||||||
if (success)
|
if (success)
|
||||||
{
|
{
|
||||||
|
@ -7902,10 +7902,7 @@ gtk_tree_view_drag_data_received (GtkWidget *widget,
|
|||||||
accepted = TRUE;
|
accepted = TRUE;
|
||||||
}
|
}
|
||||||
|
|
||||||
gtk_drag_finish (context,
|
gtk_drag_finish (context, accepted, time);
|
||||||
accepted,
|
|
||||||
(gdk_drag_context_get_selected_action (context) == GDK_ACTION_MOVE),
|
|
||||||
time);
|
|
||||||
|
|
||||||
if (gtk_tree_path_get_depth (dest_row) == 1 &&
|
if (gtk_tree_path_get_depth (dest_row) == 1 &&
|
||||||
gtk_tree_path_get_indices (dest_row)[0] == 0 &&
|
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)
|
gtk_selection_data_get_format (selection_data) == 8)
|
||||||
{
|
{
|
||||||
g_print ("Received \"%s\" in trashcan\n", (gchar *) gtk_selection_data_get_data (selection_data));
|
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;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
gtk_drag_finish (context, FALSE, FALSE, time);
|
gtk_drag_finish (context, FALSE, time);
|
||||||
}
|
}
|
||||||
|
|
||||||
void
|
void
|
||||||
@ -393,11 +393,11 @@ label_drag_data_received (GtkWidget *widget,
|
|||||||
gtk_selection_data_get_format (selection_data) == 8)
|
gtk_selection_data_get_format (selection_data) == 8)
|
||||||
{
|
{
|
||||||
g_print ("Received \"%s\" in label\n", (gchar *) gtk_selection_data_get_data (selection_data));
|
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;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
gtk_drag_finish (context, FALSE, FALSE, time);
|
gtk_drag_finish (context, FALSE, time);
|
||||||
}
|
}
|
||||||
|
|
||||||
void
|
void
|
||||||
|
Loading…
Reference in New Issue
Block a user