aboutsummaryrefslogtreecommitdiff
path: root/dragon.c
diff options
context:
space:
mode:
authorFichteFoll <fichtefoll2@googlemail.com>2019-09-10 04:05:55 +0200
committerMichael Homer <mwh@ecs.vuw.ac.nz>2019-11-02 12:58:18 +1300
commit438ec0453fe48303c6c4c1115f32c7e28517a800 (patch)
tree9d77bb7a96c10534512433bb46f5326fdad674ba /dragon.c
parentFix debug printing of URIs in drag_all mode (diff)
downloaddragon-438ec0453fe48303c6c4c1115f32c7e28517a800.tar.gz
dragon-438ec0453fe48303c6c4c1115f32c7e28517a800.tar.bz2
dragon-438ec0453fe48303c6c4c1115f32c7e28517a800.zip
Add debug prints for chosen action and succcess
Diffstat (limited to 'dragon.c')
-rw-r--r--dragon.c33
1 files 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);
bgstack15