summaryrefslogtreecommitdiff
path: root/gtk/gtktreednd.c
diff options
context:
space:
mode:
authorHavoc Pennington <hp@redhat.com>2001-01-31 00:57:49 +0000
committerHavoc Pennington <hp@src.gnome.org>2001-01-31 00:57:49 +0000
commit5cd2993201f1d9d4866928cf2ffa2abbbf2a30ab (patch)
tree185b848c7285523e6f6e4ca6f242d9f480bb834f /gtk/gtktreednd.c
parenta8e3c2058da86049ab3778f6494f6bdf99f18e44 (diff)
downloadgtk+-5cd2993201f1d9d4866928cf2ffa2abbbf2a30ab.tar.gz
fix bug in here where prev pointer was set to the wrong thing
2001-01-30 Havoc Pennington <hp@redhat.com> * gtk/gtkliststore.c (gtk_list_store_insert_before): fix bug in here where prev pointer was set to the wrong thing * gtk/gtktreemodel.c (gtk_tree_path_is_ancestor): new function (gtk_tree_path_is_descendant): new function * gtk/gtkliststore.c (gtk_list_store_iter_n_children): return cached length (gtk_list_store_get_iter): don't modify iter if we can't get the path. * gtk/gtkliststore.h (struct _GtkListStore): cache the length * gtk/gtktreednd.h: add virtual function row_drop_possible() to GtkTreeDragDest * gtk/gtktreestore.c (copy_node_data): fix varargs type error that was causing segfault * gtk/gtktreedatalist.c (_gtk_tree_data_list_node_copy): set next pointer to NULL * gtk/gtktreestore.c (gtk_tree_store_append): fix memleak * gtk/gtkliststore.c (gtk_list_store_iter_next): don't modify iter on returning FALSE (gtk_list_store_iter_children): ditto (gtk_list_store_iter_nth_child): ditto (gtk_list_store_iter_nth_child): ditto (gtk_list_store_iter_parent): ditto * gtk/gtktreestore.c (gtk_tree_store_get_path): g_return_if_fail on iter->user_data != NULL instead of silently accepting it. (gtk_tree_store_iter_next): ditto. Also, don't modify iter unless we are returning TRUE. (gtk_tree_store_iter_children): ditto (gtk_tree_store_iter_nth_child): ditto (gtk_tree_store_iter_parent): ditto (gtk_tree_store_insert): remove handling of parent->user_data == NULL, replace with parent == NULL * gtk/gtktreemodel.c (inserted_callback): put some fixes in here, and a comment explaining things * gtk/gtktreestore.c: add GtkTreeDragSource/GtkTreeDragDest interface support to GtkTreeStore. * gtk/gtktreemodel.c (gtk_tree_path_prev): didn't properly return FALSE if no prev, fix * gtk/gtktreeview.c (set_source_row): use a row reference (set_dest_row): use a row reference
Diffstat (limited to 'gtk/gtktreednd.c')
-rw-r--r--gtk/gtktreednd.c32
1 files changed, 32 insertions, 0 deletions
diff --git a/gtk/gtktreednd.c b/gtk/gtktreednd.c
index f798022c25..bdf9e4abde 100644
--- a/gtk/gtktreednd.c
+++ b/gtk/gtktreednd.c
@@ -155,6 +155,38 @@ gtk_tree_drag_dest_drag_data_received (GtkTreeDragDest *drag_dest,
return (* iface->drag_data_received) (drag_dest, dest, selection_data);
}
+
+/**
+ * gtk_tree_drag_dest_drop_possible:
+ * @drag_dest: a #GtkTreeDragDest
+ * @src_model: #GtkTreeModel being dragged from
+ * @src_path: row being dragged
+ * @dest_path: destination row
+ *
+ * Determines whether a drop is possible before the given @dest_path,
+ * at the same depth as @dest_path. i.e., can we drop @src_model such
+ * that it now resides at @dest_path. @dest_path does not have to
+ * exist; the return value will almost certainly be %FALSE if the
+ * parent of @dest_path doesn't exist, though.
+ *
+ * Return value: %TRUE if a drop is possible before @dest_path
+ **/
+gboolean
+gtk_tree_drag_dest_row_drop_possible (GtkTreeDragDest *drag_dest,
+ GtkTreeModel *src_model,
+ GtkTreePath *src_path,
+ GtkTreePath *dest_path)
+{
+ GtkTreeDragDestIface *iface = GTK_TREE_DRAG_DEST_GET_IFACE (drag_dest);
+
+ g_return_val_if_fail (iface->row_drop_possible != NULL, FALSE);
+ g_return_val_if_fail (GTK_IS_TREE_MODEL (src_model), FALSE);
+ g_return_val_if_fail (src_path != NULL, FALSE);
+ g_return_val_if_fail (dest_path != NULL, FALSE);
+
+ return (* iface->row_drop_possible) (drag_dest, src_model, src_path, dest_path);
+}
+
typedef struct _TreeRowData TreeRowData;
struct _TreeRowData