From 438ec0453fe48303c6c4c1115f32c7e28517a800 Mon Sep 17 00:00:00 2001 From: FichteFoll Date: Tue, 10 Sep 2019 04:05:55 +0200 Subject: Add debug prints for chosen action and succcess --- dragon.c | 33 +++++++++++++++++++++++++++------ 1 file changed, 27 insertions(+), 6 deletions(-) diff --git a/dragon.c b/dragon.c index 3378ff1..f19a215 100644 --- a/dragon.c +++ b/dragon.c @@ -48,7 +48,6 @@ bool print_path = false; struct draggable_thing { char *text; char *uri; - guint last_time; }; // MODE_ALL @@ -71,11 +70,6 @@ void button_clicked(GtkWidget *widget, gpointer user_data) { } } -void drag_end(GtkWidget *widget, GdkDragContext *context, gpointer user_data) { - if (and_exit) - gtk_main_quit(); -} - void drag_data_get(GtkWidget *widget, GdkDragContext *context, GtkSelectionData *data, @@ -111,6 +105,33 @@ void drag_data_get(GtkWidget *widget, } } +void drag_end(GtkWidget *widget, GdkDragContext *context, gpointer user_data) { + if (verbose) { + gboolean succeeded = gdk_drag_drop_succeeded(context); + GdkDragAction action = gdk_drag_context_get_selected_action (context); + char* action_str; + switch (action) { + case GDK_ACTION_COPY: + action_str = "COPY"; break; + case GDK_ACTION_MOVE: + action_str = "MOVE"; break; + case GDK_ACTION_LINK: + action_str = "LINK"; break; + case GDK_ACTION_ASK: + action_str = "ASK"; break; + default: + action_str = malloc(sizeof(char) * 20); + snprintf(action_str, 20, "invalid (%d)", action); + break; + } + fprintf(stderr, "Selected drop action: %s; Succeeded: %d\n", action_str, succeeded); + if (action_str[0] == 'i') + free(action_str); + } + if (and_exit) + gtk_main_quit(); +} + GtkButton *add_button(char *label, struct draggable_thing *dragdata, int type) { GtkWidget *button = gtk_button_new_with_label(label); -- cgit