From 5b0a6a52c18668685f9ad8fdc96d799aec8a620a Mon Sep 17 00:00:00 2001 From: Benjamin Otte Date: Mon, 14 May 2018 16:44:43 +0200 Subject: [PATCH] dnd: Get rid of gtk_drag_finish() It's just a wrapper around gdk_drag_finish(), so use that one instead. --- docs/reference/gtk/gtk4-sections.txt | 1 - gtk/gtkcalendar.c | 4 ++-- gtk/gtkdnd.c | 23 ++--------------------- gtk/gtkdnd.h | 4 ---- gtk/gtkdragdest.c | 2 +- gtk/gtkdragdest.h | 4 ++-- gtk/gtkentry.c | 6 +++--- gtk/gtkfilechooserbutton.c | 2 +- gtk/gtkiconview.c | 2 +- gtk/gtknotebook.c | 4 ++-- gtk/gtkplacessidebar.c | 2 +- gtk/gtktextview.c | 4 ++-- gtk/gtktreeview.c | 2 +- gtk/gtkwidget.c | 14 +++++++------- tests/testdnd.c | 8 ++++---- 15 files changed, 29 insertions(+), 53 deletions(-) diff --git a/docs/reference/gtk/gtk4-sections.txt b/docs/reference/gtk/gtk4-sections.txt index 0ddedb183c..a09f54192a 100644 --- a/docs/reference/gtk/gtk4-sections.txt +++ b/docs/reference/gtk/gtk4-sections.txt @@ -5024,7 +5024,6 @@ gtk_drag_dest_add_image_targets gtk_drag_dest_add_uri_targets gtk_drag_dest_set_track_motion gtk_drag_dest_get_track_motion -gtk_drag_finish gtk_drag_get_data gtk_drag_get_source_widget gtk_drag_highlight diff --git a/gtk/gtkcalendar.c b/gtk/gtkcalendar.c index e7546b90f3..7d01a1e55f 100644 --- a/gtk/gtkcalendar.c +++ b/gtk/gtkcalendar.c @@ -3058,7 +3058,7 @@ gtk_calendar_drag_data_received (GtkWidget *widget, { g_warning ("Received invalid date data"); g_date_free (date); - gtk_drag_finish (context, FALSE, time); + gdk_drag_finish (context, FALSE, time); return; } @@ -3067,7 +3067,7 @@ gtk_calendar_drag_data_received (GtkWidget *widget, year = g_date_get_year (date); g_date_free (date); - gtk_drag_finish (context, TRUE, time); + gdk_drag_finish (context, TRUE, time); g_object_freeze_notify (G_OBJECT (calendar)); diff --git a/gtk/gtkdnd.c b/gtk/gtkdnd.c index 748c191d29..515b8f6bad 100644 --- a/gtk/gtkdnd.c +++ b/gtk/gtkdnd.c @@ -202,7 +202,7 @@ gtk_drag_get_data_finish (GtkDragGetData *data, if (site && site->flags & GTK_DEST_DEFAULT_DROP) { - gtk_drag_finish (data->context, + gdk_drag_finish (data->context, size > 0, data->time); } @@ -336,25 +336,6 @@ gtk_drag_get_source_widget (GdkDragContext *context) return NULL; } -/** - * gtk_drag_finish: - * @context: the drag context - * @success: a flag indicating whether the drop was successful - * @time_: the timestamp from the #GtkWidget::drag-drop signal - * - * Informs the drag source that the drop is finished, and - * that the data of the drag will no longer be required. - */ -void -gtk_drag_finish (GdkDragContext *context, - gboolean success, - guint32 time) -{ - g_return_if_fail (GDK_IS_DRAG_CONTEXT (context)); - - gdk_drag_finish (context, success, time); -} - /** * gtk_drag_highlight: (method) * @widget: a widget to highlight @@ -751,7 +732,7 @@ gtk_drag_dest_drop (GtkWidget *widget, if (target == NULL) { - gtk_drag_finish (context, FALSE, time); + gdk_drag_finish (context, FALSE, time); return TRUE; } else diff --git a/gtk/gtkdnd.h b/gtk/gtkdnd.h index c6aa57743b..df791ba6be 100644 --- a/gtk/gtkdnd.h +++ b/gtk/gtkdnd.h @@ -44,10 +44,6 @@ void gtk_drag_get_data (GtkWidget *widget, GdkDragContext *context, GdkAtom target, guint32 time_); -GDK_AVAILABLE_IN_ALL -void gtk_drag_finish (GdkDragContext *context, - gboolean success, - guint32 time_); GDK_AVAILABLE_IN_ALL GtkWidget *gtk_drag_get_source_widget (GdkDragContext *context); diff --git a/gtk/gtkdragdest.c b/gtk/gtkdragdest.c index ade77fb8db..e5b65b398f 100644 --- a/gtk/gtkdragdest.c +++ b/gtk/gtkdragdest.c @@ -115,7 +115,7 @@ gtk_drag_dest_set_internal (GtkWidget *widget, * behaviors described by @flags make some assumptions, that can conflict * with your own signal handlers. For instance #GTK_DEST_DEFAULT_DROP causes * invokations of gdk_drag_status() in the context of #GtkWidget::drag-motion, - * and invokations of gtk_drag_finish() in #GtkWidget::drag-data-received. + * and invokations of gdk_drag_finish() in #GtkWidget::drag-data-received. * Especially the later is dramatic, when your own #GtkWidget::drag-motion * handler calls gtk_drag_get_data() to inspect the dragged data. * diff --git a/gtk/gtkdragdest.h b/gtk/gtkdragdest.h index 9fc1d3ee31..b8c9587152 100644 --- a/gtk/gtkdragdest.h +++ b/gtk/gtkdragdest.h @@ -49,9 +49,9 @@ G_BEGIN_DECLS * @GTK_DEST_DEFAULT_DROP: If set for a widget, when a drop occurs, GTK+ will * will check if the drag matches this widget’s list of possible formats and * actions. If so, GTK+ will call gtk_drag_get_data() on behalf of the widget. - * Whether or not the drop is successful, GTK+ will call gtk_drag_finish(). If + * Whether or not the drop is successful, GTK+ will call gdk_drag_finish(). If * the action was a move, then if the drag was successful, then %TRUE will be - * passed for the @delete parameter to gtk_drag_finish(). + * passed for the @delete parameter to gdk_drag_finish(). * @GTK_DEST_DEFAULT_ALL: If set, specifies that all default actions should * be taken. * diff --git a/gtk/gtkentry.c b/gtk/gtkentry.c index 7a7ce7268e..f6a05f3d27 100644 --- a/gtk/gtkentry.c +++ b/gtk/gtkentry.c @@ -8623,7 +8623,7 @@ gtk_entry_drag_drop (GtkWidget *widget, gtk_drag_get_data (widget, context, target, time); } else - gtk_drag_finish (context, FALSE, time); + gdk_drag_finish (context, FALSE, time); return TRUE; } @@ -8730,12 +8730,12 @@ gtk_entry_drag_data_received (GtkWidget *widget, end_change (entry); } - gtk_drag_finish (context, TRUE, time); + gdk_drag_finish (context, TRUE, time); } else { /* Drag and drop didn't happen! */ - gtk_drag_finish (context, FALSE, time); + gdk_drag_finish (context, FALSE, time); } g_free (str); diff --git a/gtk/gtkfilechooserbutton.c b/gtk/gtkfilechooserbutton.c index 2da9fb0c3f..782b620e05 100644 --- a/gtk/gtkfilechooserbutton.c +++ b/gtk/gtkfilechooserbutton.c @@ -1255,7 +1255,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, drag_time); + gdk_drag_finish (context, TRUE, drag_time); } static void diff --git a/gtk/gtkiconview.c b/gtk/gtkiconview.c index bcd42a02b0..f9ef471200 100644 --- a/gtk/gtkiconview.c +++ b/gtk/gtkiconview.c @@ -6422,7 +6422,7 @@ gtk_icon_view_drag_data_received (GtkWidget *widget, accepted = TRUE; } - gtk_drag_finish (context, + gdk_drag_finish (context, accepted, time); diff --git a/gtk/gtknotebook.c b/gtk/gtknotebook.c index 1d1cda8e1f..4953f33e44 100644 --- a/gtk/gtknotebook.c +++ b/gtk/gtknotebook.c @@ -3265,10 +3265,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, time); + gdk_drag_finish (context, TRUE, time); } else - gtk_drag_finish (context, FALSE, time); + gdk_drag_finish (context, FALSE, time); } /* Private GtkContainer Methods : diff --git a/gtk/gtkplacessidebar.c b/gtk/gtkplacessidebar.c index 64e5e3c720..0d298cdfb2 100644 --- a/gtk/gtkplacessidebar.c +++ b/gtk/gtkplacessidebar.c @@ -2094,7 +2094,7 @@ drag_data_received_callback (GtkWidget *list_box, out: sidebar->drop_occurred = FALSE; - gtk_drag_finish (context, success, time); + gdk_drag_finish (context, success, time); stop_drop_feedback (sidebar); g_free (target_uri); } diff --git a/gtk/gtktextview.c b/gtk/gtktextview.c index 2c2e773ab7..07f76b3926 100644 --- a/gtk/gtktextview.c +++ b/gtk/gtktextview.c @@ -7859,7 +7859,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, time); + gdk_drag_finish (context, FALSE, time); return TRUE; } @@ -7965,7 +7965,7 @@ gtk_text_view_drag_data_received (GtkWidget *widget, insert_text_data (text_view, &drop_point, selection_data); done: - gtk_drag_finish (context, success, time); + gdk_drag_finish (context, success, time); if (success) { diff --git a/gtk/gtktreeview.c b/gtk/gtktreeview.c index 7364a2dab0..43a43523cb 100644 --- a/gtk/gtktreeview.c +++ b/gtk/gtktreeview.c @@ -7793,7 +7793,7 @@ gtk_tree_view_drag_data_received (GtkWidget *widget, accepted = TRUE; } - gtk_drag_finish (context, accepted, time); + gdk_drag_finish (context, accepted, time); if (gtk_tree_path_get_depth (dest_row) == 1 && gtk_tree_path_get_indices (dest_row)[0] == 0 && diff --git a/gtk/gtkwidget.c b/gtk/gtkwidget.c index 69a5d2219b..7dbed089fb 100644 --- a/gtk/gtkwidget.c +++ b/gtk/gtkwidget.c @@ -1951,8 +1951,8 @@ gtk_widget_class_init (GtkWidgetClass *klass) * the cursor position is in a drop zone or not. If it is not in a drop * zone, it returns %FALSE and no further processing is necessary. * Otherwise, the handler returns %TRUE. In this case, the handler must - * ensure that gtk_drag_finish() is called to let the source know that - * the drop is done. The call to gtk_drag_finish() can be done either + * ensure that gdk_drag_finish() is called to let the source know that + * the drop is done. The call to gdk_drag_finish() can be done either * directly or in a #GtkWidget::drag-data-received handler which gets * triggered by calling gtk_drag_get_data() to receive the data for one * or more of the supported targets. @@ -2015,15 +2015,15 @@ gtk_widget_class_init (GtkWidgetClass *klass) * If the data was received in response to a #GtkWidget::drag-drop signal * (and this is the last target to be received), the handler for this * signal is expected to process the received data and then call - * gtk_drag_finish(), setting the @success parameter depending on + * gdk_drag_finish(), setting the @success parameter depending on * whether the data was processed successfully. * * Applications must create some means to determine why the signal was emitted - * and therefore whether to call gdk_drag_status() or gtk_drag_finish(). + * and therefore whether to call gdk_drag_status() or gdk_drag_finish(). * * The handler may inspect the selected action with * gdk_drag_context_get_selected_action() before calling - * gtk_drag_finish(), e.g. to implement %GDK_ACTION_ASK as + * gdk_drag_finish(), e.g. to implement %GDK_ACTION_ASK as * shown in the following example: * |[ * void @@ -2062,10 +2062,10 @@ gtk_widget_class_init (GtkWidgetClass *klass) * action = GDK_ACTION_COPY; * } * - * gtk_drag_finish (context, TRUE, action == GDK_ACTION_MOVE, time); + * gdk_drag_finish (context, TRUE, action == GDK_ACTION_MOVE, time); * } * else - * gtk_drag_finish (context, FALSE, FALSE, time); + * gdk_drag_finish (context, FALSE, FALSE, time); * } * ]| */ diff --git a/tests/testdnd.c b/tests/testdnd.c index 462ef14192..a819a8f824 100644 --- a/tests/testdnd.c +++ b/tests/testdnd.c @@ -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, time); + gdk_drag_finish (context, TRUE, time); return; } - gtk_drag_finish (context, FALSE, time); + gdk_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, time); + gdk_drag_finish (context, TRUE, time); return; } - gtk_drag_finish (context, FALSE, time); + gdk_drag_finish (context, FALSE, time); } void -- 2.30.2