diff options
author | Benjamin Otte <otte@redhat.com> | 2018-05-16 04:50:24 +0200 |
---|---|---|
committer | Benjamin Otte <otte@redhat.com> | 2018-06-18 23:49:52 +0200 |
commit | 6d7cb2b78195e486995e0f4f821e8e17b0b89eea (patch) | |
tree | cf40cdae75c44971b32744ef2fb1a2db9f03bd99 /gtk/gtkcalendar.c | |
parent | a862ca41c5645cb399ea3b439ba58e01cae32162 (diff) | |
download | gtk+-6d7cb2b78195e486995e0f4f821e8e17b0b89eea.tar.gz |
dnd: Make drag-data-received use a GdkDrop
Diffstat (limited to 'gtk/gtkcalendar.c')
-rw-r--r-- | gtk/gtkcalendar.c | 34 |
1 files changed, 16 insertions, 18 deletions
diff --git a/gtk/gtkcalendar.c b/gtk/gtkcalendar.c index 2eed203950..5ee5aad32f 100644 --- a/gtk/gtkcalendar.c +++ b/gtk/gtkcalendar.c @@ -312,9 +312,8 @@ static void gtk_calendar_drag_data_get (GtkWidget *widget, GtkSelectionData *selection_data, guint time); static void gtk_calendar_drag_data_received (GtkWidget *widget, - GdkDragContext *context, - GtkSelectionData *selection_data, - guint time); + GdkDrop *drop, + GtkSelectionData *selection_data); static gboolean gtk_calendar_drag_motion (GtkWidget *widget, GdkDragContext *context, gint x, @@ -2926,18 +2925,18 @@ gtk_calendar_drag_data_get (GtkWidget *widget, * since the data doesn’t result from a drop. */ static void -set_status_pending (GdkDragContext *context, - GdkDragAction suggested_action) +set_status_pending (GdkDrop *drop, + GdkDragAction suggested_action) { - g_object_set_data (G_OBJECT (context), + g_object_set_data (G_OBJECT (drop), I_("gtk-calendar-status-pending"), GINT_TO_POINTER (suggested_action)); } static GdkDragAction -get_status_pending (GdkDragContext *context) +get_status_pending (GdkDrop *drop) { - return GPOINTER_TO_INT (g_object_get_data (G_OBJECT (context), + return GPOINTER_TO_INT (g_object_get_data (G_OBJECT (drop), "gtk-calendar-status-pending")); } @@ -2970,9 +2969,9 @@ gtk_calendar_drag_motion (GtkWidget *widget, target = gtk_drag_dest_find_target (widget, context, NULL); if (target == NULL || gdk_drag_context_get_suggested_action (context) == 0) gdk_drag_status (context, 0, time); - else if (get_status_pending (context) == 0) + else if (get_status_pending (GDK_DROP (context)) == 0) { - set_status_pending (context, gdk_drag_context_get_suggested_action (context)); + set_status_pending (GDK_DROP (context), gdk_drag_context_get_suggested_action (context)); gtk_drag_get_data (widget, context, target, time); } @@ -3002,9 +3001,8 @@ gtk_calendar_drag_drop (GtkWidget *widget, static void gtk_calendar_drag_data_received (GtkWidget *widget, - GdkDragContext *context, - GtkSelectionData *selection_data, - guint time) + GdkDrop *drop, + GtkSelectionData *selection_data) { GtkCalendar *calendar = GTK_CALENDAR (widget); GtkCalendarPrivate *priv = calendar->priv; @@ -3013,11 +3011,11 @@ gtk_calendar_drag_data_received (GtkWidget *widget, GDate *date; GdkDragAction suggested_action; - suggested_action = get_status_pending (context); + suggested_action = get_status_pending (drop); if (suggested_action) { - set_status_pending (context, 0); + set_status_pending (drop, 0); /* We are getting this data due to a request in drag_motion, * rather than due to a request in drag_drop, so we are just @@ -3038,7 +3036,7 @@ gtk_calendar_drag_data_received (GtkWidget *widget, else suggested_action = 0; - gdk_drag_status (context, suggested_action, time); + gdk_drop_status (drop, suggested_action); return; } @@ -3055,7 +3053,7 @@ gtk_calendar_drag_data_received (GtkWidget *widget, { g_warning ("Received invalid date data"); g_date_free (date); - gdk_drag_finish (context, FALSE, time); + gdk_drop_finish (drop, 0); return; } @@ -3064,7 +3062,7 @@ gtk_calendar_drag_data_received (GtkWidget *widget, year = g_date_get_year (date); g_date_free (date); - gdk_drag_finish (context, TRUE, time); + gdk_drop_finish (drop, suggested_action); g_object_freeze_notify (G_OBJECT (calendar)); |