Commit 57479a86 authored by Owen Taylor's avatar Owen Taylor Committed by Owen Taylor

Add row_draggable() vfunc, and wrapper function.

Mon Nov  5 22:34:29 2001  Owen Taylor  <otaylor@redhat.com>

	* gtk/gtktreednd.[ch] (struct _GtkTreeDragSourceIface):
	Add row_draggable() vfunc, and wrapper function.

	* gtk/gtktreednd.[ch] (struct _GtkTreeDragDestIface): Make
	row_drop_possible take a GtkSelectionData, rather than
	model/row pair.

	* gtk/gtktreestore.c gtk/gtkliststore.c: Update for
	new DND interfaces.

	* gtk/gtktreeview.[ch]: Remove the row_draggable_func
	location_dropable_func from gtk_tree_view_set_rows_drag_source/dest.
	and rename them to enable_model_drag_source/dest.

	* gtk/treeviewcolumn.c: Add DND of columns between rows.
	Still can't drop _to_ the left tree, but other places
	work.

	* gtk/gtktreeview.c (unset_reorderable): Unset the
	reorderable property if unset/enable_model_drag_source/dest
	are called manually.

	* gtk/gtktreestore.c (gtk_tree_store_row_drop_possible):
	Correct for change in depth count handling.

	* gtk/gtktreeview.c (gtk_tree_view_create_row_drag_icon):
	Pass in a expose area to gtk_tree_view_column_cell_render()
parent 9bb17278
Mon Nov 5 22:34:29 2001 Owen Taylor <otaylor@redhat.com>
* gtk/gtktreednd.[ch] (struct _GtkTreeDragSourceIface):
Add row_draggable() vfunc, and wrapper function.
* gtk/gtktreednd.[ch] (struct _GtkTreeDragDestIface): Make
row_drop_possible take a GtkSelectionData, rather than
model/row pair.
* gtk/gtktreestore.c gtk/gtkliststore.c: Update for
new DND interfaces.
* gtk/gtktreeview.[ch]: Remove the row_draggable_func
location_dropable_func from gtk_tree_view_set_rows_drag_source/dest.
and rename them to enable_model_drag_source/dest.
* gtk/treeviewcolumn.c: Add DND of columns between rows.
Still can't drop _to_ the left tree, but other places
work.
* gtk/gtktreeview.c (unset_reorderable): Unset the
reorderable property if unset/enable_model_drag_source/dest
are called manually.
* gtk/gtktreestore.c (gtk_tree_store_row_drop_possible):
Correct for change in depth count handling.
* gtk/gtktreeview.c (gtk_tree_view_create_row_drag_icon):
Pass in a expose area to gtk_tree_view_column_cell_render()
2001-11-06 Havoc Pennington <hp@redhat.com>
* demos/gtk-demo/textview.c (easter_egg_callback): wacky easter egg
......
Mon Nov 5 22:34:29 2001 Owen Taylor <otaylor@redhat.com>
* gtk/gtktreednd.[ch] (struct _GtkTreeDragSourceIface):
Add row_draggable() vfunc, and wrapper function.
* gtk/gtktreednd.[ch] (struct _GtkTreeDragDestIface): Make
row_drop_possible take a GtkSelectionData, rather than
model/row pair.
* gtk/gtktreestore.c gtk/gtkliststore.c: Update for
new DND interfaces.
* gtk/gtktreeview.[ch]: Remove the row_draggable_func
location_dropable_func from gtk_tree_view_set_rows_drag_source/dest.
and rename them to enable_model_drag_source/dest.
* gtk/treeviewcolumn.c: Add DND of columns between rows.
Still can't drop _to_ the left tree, but other places
work.
* gtk/gtktreeview.c (unset_reorderable): Unset the
reorderable property if unset/enable_model_drag_source/dest
are called manually.
* gtk/gtktreestore.c (gtk_tree_store_row_drop_possible):
Correct for change in depth count handling.
* gtk/gtktreeview.c (gtk_tree_view_create_row_drag_icon):
Pass in a expose area to gtk_tree_view_column_cell_render()
2001-11-06 Havoc Pennington <hp@redhat.com>
* demos/gtk-demo/textview.c (easter_egg_callback): wacky easter egg
......
Mon Nov 5 22:34:29 2001 Owen Taylor <otaylor@redhat.com>
* gtk/gtktreednd.[ch] (struct _GtkTreeDragSourceIface):
Add row_draggable() vfunc, and wrapper function.
* gtk/gtktreednd.[ch] (struct _GtkTreeDragDestIface): Make
row_drop_possible take a GtkSelectionData, rather than
model/row pair.
* gtk/gtktreestore.c gtk/gtkliststore.c: Update for
new DND interfaces.
* gtk/gtktreeview.[ch]: Remove the row_draggable_func
location_dropable_func from gtk_tree_view_set_rows_drag_source/dest.
and rename them to enable_model_drag_source/dest.
* gtk/treeviewcolumn.c: Add DND of columns between rows.
Still can't drop _to_ the left tree, but other places
work.
* gtk/gtktreeview.c (unset_reorderable): Unset the
reorderable property if unset/enable_model_drag_source/dest
are called manually.
* gtk/gtktreestore.c (gtk_tree_store_row_drop_possible):
Correct for change in depth count handling.
* gtk/gtktreeview.c (gtk_tree_view_create_row_drag_icon):
Pass in a expose area to gtk_tree_view_column_cell_render()
2001-11-06 Havoc Pennington <hp@redhat.com>
* demos/gtk-demo/textview.c (easter_egg_callback): wacky easter egg
......
Mon Nov 5 22:34:29 2001 Owen Taylor <otaylor@redhat.com>
* gtk/gtktreednd.[ch] (struct _GtkTreeDragSourceIface):
Add row_draggable() vfunc, and wrapper function.
* gtk/gtktreednd.[ch] (struct _GtkTreeDragDestIface): Make
row_drop_possible take a GtkSelectionData, rather than
model/row pair.
* gtk/gtktreestore.c gtk/gtkliststore.c: Update for
new DND interfaces.
* gtk/gtktreeview.[ch]: Remove the row_draggable_func
location_dropable_func from gtk_tree_view_set_rows_drag_source/dest.
and rename them to enable_model_drag_source/dest.
* gtk/treeviewcolumn.c: Add DND of columns between rows.
Still can't drop _to_ the left tree, but other places
work.
* gtk/gtktreeview.c (unset_reorderable): Unset the
reorderable property if unset/enable_model_drag_source/dest
are called manually.
* gtk/gtktreestore.c (gtk_tree_store_row_drop_possible):
Correct for change in depth count handling.
* gtk/gtktreeview.c (gtk_tree_view_create_row_drag_icon):
Pass in a expose area to gtk_tree_view_column_cell_render()
2001-11-06 Havoc Pennington <hp@redhat.com>
* demos/gtk-demo/textview.c (easter_egg_callback): wacky easter egg
......
Mon Nov 5 22:34:29 2001 Owen Taylor <otaylor@redhat.com>
* gtk/gtktreednd.[ch] (struct _GtkTreeDragSourceIface):
Add row_draggable() vfunc, and wrapper function.
* gtk/gtktreednd.[ch] (struct _GtkTreeDragDestIface): Make
row_drop_possible take a GtkSelectionData, rather than
model/row pair.
* gtk/gtktreestore.c gtk/gtkliststore.c: Update for
new DND interfaces.
* gtk/gtktreeview.[ch]: Remove the row_draggable_func
location_dropable_func from gtk_tree_view_set_rows_drag_source/dest.
and rename them to enable_model_drag_source/dest.
* gtk/treeviewcolumn.c: Add DND of columns between rows.
Still can't drop _to_ the left tree, but other places
work.
* gtk/gtktreeview.c (unset_reorderable): Unset the
reorderable property if unset/enable_model_drag_source/dest
are called manually.
* gtk/gtktreestore.c (gtk_tree_store_row_drop_possible):
Correct for change in depth count handling.
* gtk/gtktreeview.c (gtk_tree_view_create_row_drag_icon):
Pass in a expose area to gtk_tree_view_column_cell_render()
2001-11-06 Havoc Pennington <hp@redhat.com>
* demos/gtk-demo/textview.c (easter_egg_callback): wacky easter egg
......
Mon Nov 5 22:34:29 2001 Owen Taylor <otaylor@redhat.com>
* gtk/gtktreednd.[ch] (struct _GtkTreeDragSourceIface):
Add row_draggable() vfunc, and wrapper function.
* gtk/gtktreednd.[ch] (struct _GtkTreeDragDestIface): Make
row_drop_possible take a GtkSelectionData, rather than
model/row pair.
* gtk/gtktreestore.c gtk/gtkliststore.c: Update for
new DND interfaces.
* gtk/gtktreeview.[ch]: Remove the row_draggable_func
location_dropable_func from gtk_tree_view_set_rows_drag_source/dest.
and rename them to enable_model_drag_source/dest.
* gtk/treeviewcolumn.c: Add DND of columns between rows.
Still can't drop _to_ the left tree, but other places
work.
* gtk/gtktreeview.c (unset_reorderable): Unset the
reorderable property if unset/enable_model_drag_source/dest
are called manually.
* gtk/gtktreestore.c (gtk_tree_store_row_drop_possible):
Correct for change in depth count handling.
* gtk/gtktreeview.c (gtk_tree_view_create_row_drag_icon):
Pass in a expose area to gtk_tree_view_column_cell_render()
2001-11-06 Havoc Pennington <hp@redhat.com>
* demos/gtk-demo/textview.c (easter_egg_callback): wacky easter egg
......
Mon Nov 5 22:34:29 2001 Owen Taylor <otaylor@redhat.com>
* gtk/gtktreednd.[ch] (struct _GtkTreeDragSourceIface):
Add row_draggable() vfunc, and wrapper function.
* gtk/gtktreednd.[ch] (struct _GtkTreeDragDestIface): Make
row_drop_possible take a GtkSelectionData, rather than
model/row pair.
* gtk/gtktreestore.c gtk/gtkliststore.c: Update for
new DND interfaces.
* gtk/gtktreeview.[ch]: Remove the row_draggable_func
location_dropable_func from gtk_tree_view_set_rows_drag_source/dest.
and rename them to enable_model_drag_source/dest.
* gtk/treeviewcolumn.c: Add DND of columns between rows.
Still can't drop _to_ the left tree, but other places
work.
* gtk/gtktreeview.c (unset_reorderable): Unset the
reorderable property if unset/enable_model_drag_source/dest
are called manually.
* gtk/gtktreestore.c (gtk_tree_store_row_drop_possible):
Correct for change in depth count handling.
* gtk/gtktreeview.c (gtk_tree_view_create_row_drag_icon):
Pass in a expose area to gtk_tree_view_column_cell_render()
2001-11-06 Havoc Pennington <hp@redhat.com>
* demos/gtk-demo/textview.c (easter_egg_callback): wacky easter egg
......
......@@ -84,9 +84,8 @@ static gboolean gtk_list_store_drag_data_received (GtkTreeDragDest *drag_dest,
GtkTreePath *dest,
GtkSelectionData *selection_data);
static gboolean gtk_list_store_row_drop_possible (GtkTreeDragDest *drag_dest,
GtkTreeModel *src_model,
GtkTreePath *src_path,
GtkTreePath *dest_path);
GtkTreePath *dest_path,
GtkSelectionData *selection_data);
/* sortable */
......@@ -1407,29 +1406,39 @@ gtk_list_store_drag_data_received (GtkTreeDragDest *drag_dest,
}
static gboolean
gtk_list_store_row_drop_possible (GtkTreeDragDest *drag_dest,
GtkTreeModel *src_model,
GtkTreePath *src_path,
GtkTreePath *dest_path)
gtk_list_store_row_drop_possible (GtkTreeDragDest *drag_dest,
GtkTreePath *dest_path,
GtkSelectionData *selection_data)
{
gint *indices;
GtkTreeModel *src_model = NULL;
GtkTreePath *src_path = NULL;
gboolean retval = FALSE;
g_return_val_if_fail (GTK_IS_LIST_STORE (drag_dest), FALSE);
if (!gtk_tree_get_row_drag_data (selection_data,
&src_model,
&src_path))
goto out;
if (src_model != GTK_TREE_MODEL (drag_dest))
return FALSE;
goto out;
if (gtk_tree_path_get_depth (dest_path) != 1)
return FALSE;
goto out;
/* can drop before any existing node, or before one past any existing. */
indices = gtk_tree_path_get_indices (dest_path);
if (indices[0] <= GTK_LIST_STORE (drag_dest)->length)
return TRUE;
else
return FALSE;
retval = TRUE;
out:
gtk_tree_path_free (src_path);
return retval;
}
......
......@@ -73,6 +73,31 @@ gtk_tree_drag_dest_get_type (void)
return our_type;
}
/**
* gtk_tree_drag_source_row_draggable:
* @drag_source: a #GtkTreeDragSource
* @path: row on which user is initiating a drag
*
* Asks the #GtkTreeDragSource whether a particular row can be used as
* the source of a DND operation. If the source doesn't implement
* this interface, the row is assumed draggable.
*
* Return value: %TRUE if the row can be dragged
**/
gboolean
gtk_tree_drag_source_row_draggable (GtkTreeDragSource *drag_source,
GtkTreePath *path)
{
GtkTreeDragSourceIface *iface = GTK_TREE_DRAG_SOURCE_GET_IFACE (drag_source);
g_return_val_if_fail (path != NULL, FALSE);
if (iface->row_draggable)
return (* iface->row_draggable) (drag_source, path);
else
return TRUE;
}
/**
* gtk_tree_drag_source_drag_data_delete:
......@@ -159,13 +184,12 @@ gtk_tree_drag_dest_drag_data_received (GtkTreeDragDest *drag_dest,
/**
* 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
* @selection_data: the data being dragged
*
* 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
* at the same depth as @dest_path. i.e., can we drop the data in
* @selection_data at that location. @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.
*
......@@ -173,18 +197,16 @@ gtk_tree_drag_dest_drag_data_received (GtkTreeDragDest *drag_dest,
**/
gboolean
gtk_tree_drag_dest_row_drop_possible (GtkTreeDragDest *drag_dest,
GtkTreeModel *src_model,
GtkTreePath *src_path,
GtkTreePath *dest_path)
GtkTreePath *dest_path,
GtkSelectionData *selection_data)
{
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 (selection_data != NULL, FALSE);
g_return_val_if_fail (dest_path != NULL, FALSE);
return (* iface->row_drop_possible) (drag_dest, src_model, src_path, dest_path);
return (* iface->row_drop_possible) (drag_dest, dest_path, selection_data);
}
typedef struct _TreeRowData TreeRowData;
......
......@@ -41,6 +41,9 @@ struct _GtkTreeDragSourceIface
/* VTable - not signals */
gboolean (* row_draggable) (GtkTreeDragSource *drag_source,
GtkTreePath *path);
gboolean (* drag_data_get) (GtkTreeDragSource *drag_source,
GtkTreePath *path,
GtkSelectionData *selection_data);
......@@ -51,6 +54,10 @@ struct _GtkTreeDragSourceIface
GType gtk_tree_drag_source_get_type (void) G_GNUC_CONST;
/* Returns whether the given row can be dragged */
gboolean gtk_tree_drag_source_row_draggable (GtkTreeDragSource *drag_source,
GtkTreePath *path);
/* Deletes the given row, or returns FALSE if it can't */
gboolean gtk_tree_drag_source_drag_data_delete (GtkTreeDragSource *drag_source,
GtkTreePath *path);
......@@ -81,9 +88,8 @@ struct _GtkTreeDragDestIface
GtkSelectionData *selection_data);
gboolean (* row_drop_possible) (GtkTreeDragDest *drag_dest,
GtkTreeModel *src_model,
GtkTreePath *src_path,
GtkTreePath *dest_path);
GtkTreePath *dest_path,
GtkSelectionData *selection_data);
};
GType gtk_tree_drag_dest_get_type (void) G_GNUC_CONST;
......@@ -98,9 +104,8 @@ gboolean gtk_tree_drag_dest_drag_data_received (GtkTreeDragDest *drag_dest,
/* Returns TRUE if we can drop before path; path may not exist. */
gboolean gtk_tree_drag_dest_row_drop_possible (GtkTreeDragDest *drag_dest,
GtkTreeModel *src_model,
GtkTreePath *src_path,
GtkTreePath *dest_path);
GtkTreePath *dest_path,
GtkSelectionData *selection_data);
/* The selection data would normally have target type GTK_TREE_MODEL_ROW in this
......
......@@ -83,9 +83,8 @@ static gboolean gtk_tree_store_drag_data_received (GtkTreeDragDest *drag_dest,
GtkTreePath *dest,
GtkSelectionData *selection_data);
static gboolean gtk_tree_store_row_drop_possible (GtkTreeDragDest *drag_dest,
GtkTreeModel *src_model,
GtkTreePath *src_path,
GtkTreePath *dest_path);
GtkTreePath *dest_path,
GtkSelectionData *selection_data);
/* Sortable Interfaces */
......@@ -1587,45 +1586,55 @@ gtk_tree_store_drag_data_received (GtkTreeDragDest *drag_dest,
}
static gboolean
gtk_tree_store_row_drop_possible (GtkTreeDragDest *drag_dest,
GtkTreeModel *src_model,
GtkTreePath *src_path,
GtkTreePath *dest_path)
gtk_tree_store_row_drop_possible (GtkTreeDragDest *drag_dest,
GtkTreePath *dest_path,
GtkSelectionData *selection_data)
{
GtkTreeModel *src_model = NULL;
GtkTreePath *src_path = NULL;
GtkTreePath *tmp = NULL;
gboolean retval = FALSE;
if (!gtk_tree_get_row_drag_data (selection_data,
&src_model,
&src_path))
goto out;
/* can only drag to ourselves */
if (src_model != GTK_TREE_MODEL (drag_dest))
return FALSE;
goto out;
/* Can't drop into ourself. */
if (gtk_tree_path_is_ancestor (src_path,
dest_path))
return FALSE;
goto out;
/* Can't drop if dest_path's parent doesn't exist */
{
GtkTreeIter iter;
GtkTreePath *tmp = gtk_tree_path_copy (dest_path);
/* if we can't go up, we know the parent exists, the root
* always exists.
*/
if (gtk_tree_path_up (tmp))
if (gtk_tree_path_get_depth (dest_path) > 1)
{
if (!gtk_tree_model_get_iter (GTK_TREE_MODEL (drag_dest),
&iter, tmp))
{
if (tmp)
gtk_tree_path_free (tmp);
return FALSE;
}
tmp = gtk_tree_path_copy (dest_path);
gtk_tree_path_up (tmp);
if (!gtk_tree_model_get_iter (GTK_TREE_MODEL (drag_dest),
&iter, tmp))
goto out;
}
if (tmp)
gtk_tree_path_free (tmp);
}
/* Can otherwise drop anywhere. */
return TRUE;
retval = TRUE;
out:
if (src_path)
gtk_tree_path_free (src_path);
if (tmp)
gtk_tree_path_free (tmp);
return retval;
}
/* Sorting */
......
......@@ -77,10 +77,8 @@ struct _TreeViewDragInfo
GdkModifierType start_button_mask;
GtkTargetList *source_target_list;
GdkDragAction source_actions;
GClosure *row_draggable_closure;
GtkTargetList *dest_target_list;
GClosure *location_droppable_closure;
guint source_set : 1;
guint dest_set : 1;
......@@ -2463,6 +2461,9 @@ gtk_tree_view_motion (GtkWidget *widget,
/* Warning: Very scary function.
* Modify at your own risk
*
* KEEP IN SYNC WITH gtk_tree_view_create_row_drag_icon()!
* FIXME: It's not...
*/
static gboolean
gtk_tree_view_bin_expose (GtkWidget *widget,
......@@ -3127,23 +3128,15 @@ clear_source_info (TreeViewDragInfo *di)
if (di->source_target_list)
gtk_target_list_unref (di->source_target_list);
if (di->row_draggable_closure)
g_closure_unref (di->row_draggable_closure);
di->source_target_list = NULL;
di->row_draggable_closure = NULL;
}
static void
clear_dest_info (TreeViewDragInfo *di)
{
if (di->location_droppable_closure)
g_closure_unref (di->location_droppable_closure);
if (di->dest_target_list)
gtk_target_list_unref (di->dest_target_list);
di->location_droppable_closure = NULL;
di->dest_target_list = NULL;
}
......@@ -3464,25 +3457,26 @@ gtk_tree_view_maybe_begin_dragging_row (GtkTreeView *tree_view,
gint button;
gint cell_x, cell_y;
GtkTreeModel *model;
gboolean retval = FALSE;
di = get_info (tree_view);
if (di == NULL)
return FALSE;
goto out;
if (tree_view->priv->pressed_button < 0)
return FALSE;
goto out;
if (!gtk_drag_check_threshold (GTK_WIDGET (tree_view),
tree_view->priv->press_start_x,
tree_view->priv->press_start_y,
event->x, event->y))
return FALSE;
goto out;
model = gtk_tree_view_get_model (tree_view);
if (model == NULL)
return FALSE;
goto out;
button = tree_view->priv->pressed_button;
tree_view->priv->pressed_button = -1;
......@@ -3497,16 +3491,21 @@ gtk_tree_view_maybe_begin_dragging_row (GtkTreeView *tree_view,
&cell_y);
if (path == NULL)
return FALSE;
goto out;
/* FIXME if the path doesn't match the row_draggable predicate,
* return FALSE and free path
*/
if (!GTK_IS_TREE_DRAG_SOURCE (model) ||
!gtk_tree_drag_source_row_draggable (GTK_TREE_DRAG_SOURCE (model),
path))
goto out;
/* FIXME Check whether we're a start button, if not return FALSE and
* free path
*/
/* Now we can begin the drag */
retval = TRUE;
context = gtk_drag_begin (GTK_WIDGET (tree_view),
di->source_target_list,
di->source_actions,
......@@ -3533,9 +3532,12 @@ gtk_tree_view_maybe_begin_dragging_row (GtkTreeView *tree_view,
}
set_source_row (context, model, path);
gtk_tree_path_free (path);
return TRUE;
out:
if (path)
gtk_tree_path_free (path);
return retval;
}
......@@ -3822,24 +3824,10 @@ gtk_tree_view_drag_data_received (GtkWidget *widget,
if (suggested_action)
{
GtkTreeModel *src_model = NULL;
GtkTreePath *src_path = NULL;
if (!gtk_tree_get_row_drag_data (selection_data,
&src_model,
&src_path))
suggested_action = 0;
if (suggested_action)
{
if (!gtk_tree_drag_dest_row_drop_possible (GTK_TREE_DRAG_DEST (model),
src_model,
src_path,
path))
suggested_action = 0;
gtk_tree_path_free (src_path);
}
if (!gtk_tree_drag_dest_row_drop_possible (GTK_TREE_DRAG_DEST (model),
path,
selection_data))
suggested_action = 0;
}
gdk_drag_status (context, suggested_action, time);
......@@ -7996,17 +7984,15 @@ gtk_tree_view_set_reorderable (GtkTreeView *tree_view,
if (reorderable)
{
gtk_tree_view_set_rows_drag_source (tree_view,
GDK_BUTTON1_MASK,
row_targets,
G_N_ELEMENTS (row_targets),
GDK_ACTION_MOVE,
NULL, NULL);
gtk_tree_view_set_rows_drag_dest (tree_view,
row_targets,
G_N_ELEMENTS (row_targets),
GDK_ACTION_MOVE,
NULL, NULL);
gtk_tree_view_enable_model_drag_source (tree_view,
GDK_BUTTON1_MASK,
row_targets,
G_N_ELEMENTS (row_targets),
GDK_ACTION_MOVE);
gtk_tree_view_enable_model_drag_dest (tree_view,
row_targets,
G_N_ELEMENTS (row_targets),
GDK_ACTION_MOVE);
}
else
{
......@@ -8475,15 +8461,22 @@ gtk_tree_view_tree_to_widget_coords (GtkTreeView *tree_view,
*wy = ty - tree_view->priv->vadjustment->value;
}
static void
unset_reorderable (GtkTreeView *tree_view)
{
if (tree_view->priv->reorderable)
{
tree_view->priv->reorderable = FALSE;
g_object_notify (G_OBJECT (tree_view), "reorderable");
}
}
void
gtk_tree_view_set_rows_drag_source (GtkTreeView *tree_view,
GdkModifierType start_button_mask,
const GtkTargetEntry *targets,
gint n_targets,
GdkDragAction actions,
GtkTreeViewDraggableFunc row_draggable_func,
gpointer user_data)
gtk_tree_view_enable_model_drag_source (GtkTreeView *tree_view,
GdkModifierType start_button_mask,
const GtkTargetEntry *targets,
gint n_targets,
GdkDragAction actions)
{
TreeViewDragInfo *di;
......@@ -8496,24 +8489,16 @@ gtk_tree_view_set_rows_drag_source (GtkTreeView *tree_view,
di->source_target_list = gtk_target_list_new (targets, n_targets);
di->source_actions = actions;
if (row_draggable_func)
{
di->row_draggable_closure = g_cclosure_new ((GCallback) row_draggable_func,
user_data, NULL);
g_closure_ref (di->row_draggable_closure);
g_closure_sink (di->row_draggable_closure);
}
di->source_set = TRUE;
unset_reorderable (tree_view);
}
void
gtk_tree_view_set_rows_drag_dest (GtkTreeView *tree_view,
const GtkTargetEntry *targets,
gint n_targets,
GdkDragAction actions,
GtkTreeViewDroppableFunc location_droppable_func,
gpointer user_data)
gtk_tree_view_enable_model_drag_dest (GtkTreeView *tree_view,
const GtkTargetEntry *targets,
gint n_targets,
GdkDragAction actions)
{
TreeViewDragInfo *di;
......@@ -8531,15 +8516,9 @@ gtk_tree_view_set_rows_drag_dest (GtkTreeView *tree_view,
if (targets)
di->dest_target_list = gtk_target_list_new (targets, n_targets);
if (location_droppable_func)
{
di->location_droppable_closure = g_cclosure_new ((GCallback) location_droppable_func,
user_data, NULL);
g_closure_ref (di->location_droppable_closure);
g_closure_sink (di->location_droppable_closure);
}
di->dest_set = TRUE;
unset_reorderable (tree_view);
}
void
......@@ -8562,6 +8541,8 @@ gtk_tree_view_unset_rows_drag_source (GtkTreeView *tree_view)
if (!di->dest_set && !di->source_set)
remove_info (tree_view);
}
unset_reorderable (tree_view);
}
void
......@@ -8585,6 +8566,8 @@ gtk_tree_view_unset_rows_drag_dest (GtkTreeView *tree_view)
if (!di->dest_set && !di->source_set)