Mercurial > geeqie
diff src/bar_keywords.c @ 1393:79b32088ecc4
show a label instead of the default drag icon
author | nadvornik |
---|---|
date | Sun, 08 Mar 2009 10:25:24 +0000 |
parents | d1b32a69b40a |
children | bec57fa486f4 |
line wrap: on
line diff
--- a/src/bar_keywords.c Sun Mar 08 09:56:40 2009 +0000 +++ b/src/bar_keywords.c Sun Mar 08 10:25:24 2009 +0000 @@ -490,15 +490,32 @@ { gchar *name = keyword_get_name(keyword_tree, &child_iter); gtk_selection_data_set_text(selection_data, name, -1); -printf("name %s\n", name); g_free(name); } break; } } -static void bar_pane_keywords_dnd_begin(GtkWidget *treeview, GdkDragContext *context, gpointer data) +static void bar_pane_keywords_dnd_begin(GtkWidget *tree_view, GdkDragContext *context, gpointer data) { + GtkTreeIter iter; + GtkTreeModel *model; + GtkTreeIter child_iter; + GtkTreeModel *keyword_tree; + gchar *name; + + GtkTreeSelection *sel = gtk_tree_view_get_selection(GTK_TREE_VIEW(tree_view)); + + if (!gtk_tree_selection_get_selected(sel, &model, &iter)) return; + + keyword_tree = gtk_tree_model_filter_get_model(GTK_TREE_MODEL_FILTER(model)); + gtk_tree_model_filter_convert_iter_to_child_iter(GTK_TREE_MODEL_FILTER(model), &child_iter, &iter); + + name = keyword_get_name(keyword_tree, &child_iter); + + dnd_set_drag_label(tree_view, context, name); + g_free(name); + } static void bar_pane_keywords_dnd_end(GtkWidget *widget, GdkDragContext *context, gpointer data)