Sanitize GtkRowReference.

Wed Feb 28 16:36:46 2001  Jonathan Blandford  <jrb@redhat.com>

	* gtk/gtktreemodel.c (gtk_tree_row_reference_*): Sanitize
	GtkRowReference.
This commit is contained in:
Jonathan Blandford
2001-02-28 21:37:50 +00:00
committed by Jonathan Blandford
parent 56a2f2c628
commit f7382221cd
12 changed files with 535 additions and 483 deletions

View File

@ -1,3 +1,8 @@
Wed Feb 28 16:36:46 2001 Jonathan Blandford <jrb@redhat.com>
* gtk/gtktreemodel.c (gtk_tree_row_reference_*): Sanitize
GtkRowReference.
2001-02-28 Havoc Pennington <hp@redhat.com> 2001-02-28 Havoc Pennington <hp@redhat.com>
* gtk/gtkwidget.h (struct _GtkWidgetClass): Remove draw_focus and * gtk/gtkwidget.h (struct _GtkWidgetClass): Remove draw_focus and

View File

@ -1,3 +1,8 @@
Wed Feb 28 16:36:46 2001 Jonathan Blandford <jrb@redhat.com>
* gtk/gtktreemodel.c (gtk_tree_row_reference_*): Sanitize
GtkRowReference.
2001-02-28 Havoc Pennington <hp@redhat.com> 2001-02-28 Havoc Pennington <hp@redhat.com>
* gtk/gtkwidget.h (struct _GtkWidgetClass): Remove draw_focus and * gtk/gtkwidget.h (struct _GtkWidgetClass): Remove draw_focus and

View File

@ -1,3 +1,8 @@
Wed Feb 28 16:36:46 2001 Jonathan Blandford <jrb@redhat.com>
* gtk/gtktreemodel.c (gtk_tree_row_reference_*): Sanitize
GtkRowReference.
2001-02-28 Havoc Pennington <hp@redhat.com> 2001-02-28 Havoc Pennington <hp@redhat.com>
* gtk/gtkwidget.h (struct _GtkWidgetClass): Remove draw_focus and * gtk/gtkwidget.h (struct _GtkWidgetClass): Remove draw_focus and

View File

@ -1,3 +1,8 @@
Wed Feb 28 16:36:46 2001 Jonathan Blandford <jrb@redhat.com>
* gtk/gtktreemodel.c (gtk_tree_row_reference_*): Sanitize
GtkRowReference.
2001-02-28 Havoc Pennington <hp@redhat.com> 2001-02-28 Havoc Pennington <hp@redhat.com>
* gtk/gtkwidget.h (struct _GtkWidgetClass): Remove draw_focus and * gtk/gtkwidget.h (struct _GtkWidgetClass): Remove draw_focus and

View File

@ -1,3 +1,8 @@
Wed Feb 28 16:36:46 2001 Jonathan Blandford <jrb@redhat.com>
* gtk/gtktreemodel.c (gtk_tree_row_reference_*): Sanitize
GtkRowReference.
2001-02-28 Havoc Pennington <hp@redhat.com> 2001-02-28 Havoc Pennington <hp@redhat.com>
* gtk/gtkwidget.h (struct _GtkWidgetClass): Remove draw_focus and * gtk/gtkwidget.h (struct _GtkWidgetClass): Remove draw_focus and

View File

@ -1,3 +1,8 @@
Wed Feb 28 16:36:46 2001 Jonathan Blandford <jrb@redhat.com>
* gtk/gtktreemodel.c (gtk_tree_row_reference_*): Sanitize
GtkRowReference.
2001-02-28 Havoc Pennington <hp@redhat.com> 2001-02-28 Havoc Pennington <hp@redhat.com>
* gtk/gtkwidget.h (struct _GtkWidgetClass): Remove draw_focus and * gtk/gtkwidget.h (struct _GtkWidgetClass): Remove draw_focus and

View File

@ -1,3 +1,8 @@
Wed Feb 28 16:36:46 2001 Jonathan Blandford <jrb@redhat.com>
* gtk/gtktreemodel.c (gtk_tree_row_reference_*): Sanitize
GtkRowReference.
2001-02-28 Havoc Pennington <hp@redhat.com> 2001-02-28 Havoc Pennington <hp@redhat.com>
* gtk/gtkwidget.h (struct _GtkWidgetClass): Remove draw_focus and * gtk/gtkwidget.h (struct _GtkWidgetClass): Remove draw_focus and

File diff suppressed because it is too large Load Diff

View File

@ -135,69 +135,76 @@ gboolean gtk_tree_path_is_ancestor (GtkTreePath *path,
gboolean gtk_tree_path_is_descendant (GtkTreePath *path, gboolean gtk_tree_path_is_descendant (GtkTreePath *path,
GtkTreePath *ancestor); GtkTreePath *ancestor);
/* Row reference (an object that tracks model changes so it refers to the /* Row reference (an object that tracks model changes so it refers to the same
* same row always; a path refers to a position, not a fixed row) * row always; a path refers to a position, not a fixed row). You almost always
* want to call gtk_tree_row_reference_new.
*/ */
GtkTreeRowReference *gtk_tree_row_reference_new (GtkTreeModel *model, GtkTreeRowReference *gtk_tree_row_reference_new (GtkTreeModel *model,
GtkTreePath *path); GtkTreePath *path);
/* returns NULL if the row was deleted or the model was destroyed. */ GtkTreeRowReference *gtk_tree_row_reference_new_proxy (GObject *proxy,
GtkTreePath *gtk_tree_row_reference_get_path (GtkTreeRowReference *reference); GtkTreeModel *model,
void gtk_tree_row_reference_free (GtkTreeRowReference *reference); GtkTreePath *path);
GtkTreePath *gtk_tree_row_reference_get_path (GtkTreeRowReference *reference);
void gtk_tree_row_reference_free (GtkTreeRowReference *reference);
/* These two functions are only needed if you created the row reference with a
* proxy object */
void gtk_tree_row_reference_inserted (GObject *proxy,
GtkTreePath *path);
void gtk_tree_row_reference_deleted (GObject *proxy,
GtkTreePath *path);
/* GtkTreeIter operations */ /* GtkTreeIter operations */
GtkTreeIter *gtk_tree_iter_copy (GtkTreeIter *iter); GtkTreeIter * gtk_tree_iter_copy (GtkTreeIter *iter);
void gtk_tree_iter_free (GtkTreeIter *iter); void gtk_tree_iter_free (GtkTreeIter *iter);
GtkType gtk_tree_model_get_type (void) G_GNUC_CONST; GtkType gtk_tree_model_get_type (void) G_GNUC_CONST;
GtkTreeModelFlags gtk_tree_model_get_flags (GtkTreeModel *tree_model); GtkTreeModelFlags gtk_tree_model_get_flags (GtkTreeModel *tree_model);
gint gtk_tree_model_get_n_columns (GtkTreeModel *tree_model);
/* Column information */ GType gtk_tree_model_get_column_type (GtkTreeModel *tree_model,
gint gtk_tree_model_get_n_columns (GtkTreeModel *tree_model); gint index);
GType gtk_tree_model_get_column_type (GtkTreeModel *tree_model,
gint index);
/* Iterator movement */ /* Iterator movement */
gboolean gtk_tree_model_get_iter (GtkTreeModel *tree_model, gboolean gtk_tree_model_get_iter (GtkTreeModel *tree_model,
GtkTreeIter *iter, GtkTreeIter *iter,
GtkTreePath *path); GtkTreePath *path);
gboolean gtk_tree_model_get_first (GtkTreeModel *tree_model, gboolean gtk_tree_model_get_first (GtkTreeModel *tree_model,
GtkTreeIter *iter); GtkTreeIter *iter);
GtkTreePath *gtk_tree_model_get_path (GtkTreeModel *tree_model, GtkTreePath * gtk_tree_model_get_path (GtkTreeModel *tree_model,
GtkTreeIter *iter); GtkTreeIter *iter);
void gtk_tree_model_get_value (GtkTreeModel *tree_model, void gtk_tree_model_get_value (GtkTreeModel *tree_model,
GtkTreeIter *iter, GtkTreeIter *iter,
gint column, gint column,
GValue *value); GValue *value);
gboolean gtk_tree_model_iter_next (GtkTreeModel *tree_model, gboolean gtk_tree_model_iter_next (GtkTreeModel *tree_model,
GtkTreeIter *iter); GtkTreeIter *iter);
gboolean gtk_tree_model_iter_children (GtkTreeModel *tree_model, gboolean gtk_tree_model_iter_children (GtkTreeModel *tree_model,
GtkTreeIter *iter, GtkTreeIter *iter,
GtkTreeIter *parent); GtkTreeIter *parent);
gboolean gtk_tree_model_iter_has_child (GtkTreeModel *tree_model, gboolean gtk_tree_model_iter_has_child (GtkTreeModel *tree_model,
GtkTreeIter *iter); GtkTreeIter *iter);
gint gtk_tree_model_iter_n_children (GtkTreeModel *tree_model, gint gtk_tree_model_iter_n_children (GtkTreeModel *tree_model,
GtkTreeIter *iter); GtkTreeIter *iter);
gboolean gtk_tree_model_iter_nth_child (GtkTreeModel *tree_model, gboolean gtk_tree_model_iter_nth_child (GtkTreeModel *tree_model,
GtkTreeIter *iter, GtkTreeIter *iter,
GtkTreeIter *parent, GtkTreeIter *parent,
gint n); gint n);
gboolean gtk_tree_model_iter_parent (GtkTreeModel *tree_model, gboolean gtk_tree_model_iter_parent (GtkTreeModel *tree_model,
GtkTreeIter *iter, GtkTreeIter *iter,
GtkTreeIter *child); GtkTreeIter *child);
void gtk_tree_model_ref_iter (GtkTreeModel *tree_model, void gtk_tree_model_ref_iter (GtkTreeModel *tree_model,
GtkTreeIter *iter); GtkTreeIter *iter);
void gtk_tree_model_unref_iter (GtkTreeModel *tree_model, void gtk_tree_model_unref_iter (GtkTreeModel *tree_model,
GtkTreeIter *iter); GtkTreeIter *iter);
void gtk_tree_model_get (GtkTreeModel *tree_model,
GtkTreeIter *iter,
...);
void gtk_tree_model_get_valist (GtkTreeModel *tree_model,
GtkTreeIter *iter,
va_list var_args);
void gtk_tree_model_get (GtkTreeModel *tree_model,
GtkTreeIter *iter,
...);
void gtk_tree_model_get_valist (GtkTreeModel *tree_model,
GtkTreeIter *iter,
va_list var_args);
/* Signals */ /* Signals */
void gtk_tree_model_changed (GtkTreeModel *tree_model, void gtk_tree_model_changed (GtkTreeModel *tree_model,

View File

@ -210,11 +210,9 @@ GtkTreeSelection* _gtk_tree_selection_new_with_tree_view (GtkTreeView *tree
void _gtk_tree_selection_set_tree_view (GtkTreeSelection *selection, void _gtk_tree_selection_set_tree_view (GtkTreeSelection *selection,
GtkTreeView *tree_view); GtkTreeView *tree_view);
GtkTreeRowReference *_gtk_tree_row_reference_new_from_view (GtkTreePath *path);
void _gtk_tree_row_reference_inserted (GtkTreeRowReference *reference,
GtkTreePath *path);
gboolean _gtk_tree_row_reference_deleted (GtkTreeRowReference *reference,
GtkTreePath *path);
#ifdef __cplusplus #ifdef __cplusplus
} }
#endif /* __cplusplus */ #endif /* __cplusplus */

View File

@ -103,10 +103,10 @@ gtk_tree_selection_finalize (GObject *object)
/** /**
* _gtk_tree_selection_new: * _gtk_tree_selection_new:
* *
* Creates a new #GtkTreeSelection object. This function should not be invoked, * Creates a new #GtkTreeSelection object. This function should not be invoked,
* as each #GtkTreeView will create it's own #GtkTreeSelection. * as each #GtkTreeView will create it's own #GtkTreeSelection.
* *
* Return value: A newly created #GtkTreeSelection object. * Return value: A newly created #GtkTreeSelection object.
**/ **/
GtkTreeSelection* GtkTreeSelection*
@ -122,10 +122,10 @@ _gtk_tree_selection_new (void)
/** /**
* _gtk_tree_selection_new_with_tree_view: * _gtk_tree_selection_new_with_tree_view:
* @tree_view: The #GtkTreeView. * @tree_view: The #GtkTreeView.
* *
* Creates a new #GtkTreeSelection object. This function should not be invoked, * Creates a new #GtkTreeSelection object. This function should not be invoked,
* as each #GtkTreeView will create it's own #GtkTreeSelection. * as each #GtkTreeView will create it's own #GtkTreeSelection.
* *
* Return value: A newly created #GtkTreeSelection object. * Return value: A newly created #GtkTreeSelection object.
**/ **/
GtkTreeSelection* GtkTreeSelection*
@ -146,7 +146,7 @@ _gtk_tree_selection_new_with_tree_view (GtkTreeView *tree_view)
* _gtk_tree_selection_set_tree_view: * _gtk_tree_selection_set_tree_view:
* @selection: A #GtkTreeSelection. * @selection: A #GtkTreeSelection.
* @tree_view: The #GtkTreeView. * @tree_view: The #GtkTreeView.
* *
* Sets the #GtkTreeView of @selection. This function should not be invoked, as * Sets the #GtkTreeView of @selection. This function should not be invoked, as
* it is used internally by #GtkTreeView. * it is used internally by #GtkTreeView.
**/ **/
@ -167,7 +167,7 @@ _gtk_tree_selection_set_tree_view (GtkTreeSelection *selection,
* gtk_tree_selection_set_mode: * gtk_tree_selection_set_mode:
* @selection: A #GtkTreeSelection. * @selection: A #GtkTreeSelection.
* @type: The selection type. * @type: The selection type.
* *
* Sets the selection type of the @selection. If the previous type was * Sets the selection type of the @selection. If the previous type was
* #GTK_TREE_SELECTION_MULTI and @type is #GTK_TREE_SELECTION_SINGLE, then * #GTK_TREE_SELECTION_MULTI and @type is #GTK_TREE_SELECTION_SINGLE, then
* the anchor is kept selected, if it was previously selected. * the anchor is kept selected, if it was previously selected.
@ -200,7 +200,7 @@ gtk_tree_selection_set_mode (GtkTreeSelection *selection,
anchor_path, anchor_path,
&tree, &tree,
&node); &node);
if (node && GTK_RBNODE_FLAG_SET (node, GTK_RBNODE_IS_SELECTED)) if (node && GTK_RBNODE_FLAG_SET (node, GTK_RBNODE_IS_SELECTED))
selected = TRUE; selected = TRUE;
@ -225,7 +225,7 @@ gtk_tree_selection_set_mode (GtkTreeSelection *selection,
* @func: The selection function. * @func: The selection function.
* @data: The selection function's data. * @data: The selection function's data.
* @destroy: The destroy function for user data. May be NULL. * @destroy: The destroy function for user data. May be NULL.
* *
* Sets the selection function. If set, this function is called before any node * Sets the selection function. If set, this function is called before any node
* is selected or unselected, giving some control over which nodes are selected. * is selected or unselected, giving some control over which nodes are selected.
**/ **/
@ -247,9 +247,9 @@ gtk_tree_selection_set_select_function (GtkTreeSelection *selection,
/** /**
* gtk_tree_selection_get_user_data: * gtk_tree_selection_get_user_data:
* @selection: A #GtkTreeSelection. * @selection: A #GtkTreeSelection.
* *
* Returns the user data for the selection function. * Returns the user data for the selection function.
* *
* Return value: The user data. * Return value: The user data.
**/ **/
gpointer gpointer
@ -274,13 +274,13 @@ gtk_tree_selection_get_tree_view (GtkTreeSelection *selection)
* @selection: A #GtkTreeSelection. * @selection: A #GtkTreeSelection.
* @model: A pointer set to the #GtkTreeModel, or NULL. * @model: A pointer set to the #GtkTreeModel, or NULL.
* @iter: The #GtkTreeIter, or NULL. * @iter: The #GtkTreeIter, or NULL.
* *
* Sets @iter to the currently selected node if @selection is set to * Sets @iter to the currently selected node if @selection is set to
* #GTK_TREE_SELECTION_SINGLE. @iter may be NULL if you just want to test if * #GTK_TREE_SELECTION_SINGLE. @iter may be NULL if you just want to test if
* @selection has any selected nodes. @model is filled with the current model * @selection has any selected nodes. @model is filled with the current model
* as a convenience. This function will not work if you use @selection is * as a convenience. This function will not work if you use @selection is
* #GTK_TREE_SELECTION_MULTI. * #GTK_TREE_SELECTION_MULTI.
* *
* Return value: TRUE, if there is a selected node. * Return value: TRUE, if there is a selected node.
**/ **/
gboolean gboolean
@ -292,7 +292,7 @@ gtk_tree_selection_get_selected (GtkTreeSelection *selection,
GtkRBNode *node; GtkRBNode *node;
GtkTreePath *anchor_path; GtkTreePath *anchor_path;
gboolean retval; gboolean retval;
g_return_val_if_fail (selection != NULL, FALSE); g_return_val_if_fail (selection != NULL, FALSE);
g_return_val_if_fail (GTK_IS_TREE_SELECTION (selection), FALSE); g_return_val_if_fail (GTK_IS_TREE_SELECTION (selection), FALSE);
g_return_val_if_fail (selection->type == GTK_TREE_SELECTION_SINGLE, FALSE); g_return_val_if_fail (selection->type == GTK_TREE_SELECTION_SINGLE, FALSE);
@ -301,7 +301,7 @@ gtk_tree_selection_get_selected (GtkTreeSelection *selection,
if (model) if (model)
*model = selection->tree_view->priv->model; *model = selection->tree_view->priv->model;
if (selection->tree_view->priv->anchor == NULL) if (selection->tree_view->priv->anchor == NULL)
return FALSE; return FALSE;
@ -309,7 +309,7 @@ gtk_tree_selection_get_selected (GtkTreeSelection *selection,
if (anchor_path == NULL) if (anchor_path == NULL)
return FALSE; return FALSE;
if (iter == NULL) if (iter == NULL)
{ {
gtk_tree_path_free (anchor_path); gtk_tree_path_free (anchor_path);
@ -317,7 +317,7 @@ gtk_tree_selection_get_selected (GtkTreeSelection *selection,
} }
retval = FALSE; retval = FALSE;
if (!_gtk_tree_view_find_node (selection->tree_view, if (!_gtk_tree_view_find_node (selection->tree_view,
anchor_path, anchor_path,
&tree, &tree,
@ -336,7 +336,7 @@ gtk_tree_selection_get_selected (GtkTreeSelection *selection,
} }
gtk_tree_path_free (anchor_path); gtk_tree_path_free (anchor_path);
return retval; return retval;
} }
@ -345,7 +345,7 @@ gtk_tree_selection_get_selected (GtkTreeSelection *selection,
* @selection: A #GtkTreeSelection. * @selection: A #GtkTreeSelection.
* @func: The function to call for each selected node. * @func: The function to call for each selected node.
* @data: user data to pass to the function. * @data: user data to pass to the function.
* *
* Calls a function for each selected node. * Calls a function for each selected node.
**/ **/
void void
@ -442,7 +442,7 @@ gtk_tree_selection_selected_foreach (GtkTreeSelection *selection,
* gtk_tree_selection_select_path: * gtk_tree_selection_select_path:
* @selection: A #GtkTreeSelection. * @selection: A #GtkTreeSelection.
* @path: The #GtkTreePath to be selected. * @path: The #GtkTreePath to be selected.
* *
* Select the row at @path. * Select the row at @path.
**/ **/
void void
@ -480,7 +480,7 @@ gtk_tree_selection_select_path (GtkTreeSelection *selection,
* gtk_tree_selection_unselect_path: * gtk_tree_selection_unselect_path:
* @selection: A #GtkTreeSelection. * @selection: A #GtkTreeSelection.
* @path: The #GtkTreePath to be unselected. * @path: The #GtkTreePath to be unselected.
* *
* Unselects the row at @path. * Unselects the row at @path.
**/ **/
void void
@ -514,7 +514,7 @@ gtk_tree_selection_unselect_path (GtkTreeSelection *selection,
* gtk_tree_selection_select_iter: * gtk_tree_selection_select_iter:
* @selection: A #GtkTreeSelection. * @selection: A #GtkTreeSelection.
* @iter: The #GtkTreeIter to be selected. * @iter: The #GtkTreeIter to be selected.
* *
* Selects the specified iterator. * Selects the specified iterator.
**/ **/
void void
@ -544,7 +544,7 @@ gtk_tree_selection_select_iter (GtkTreeSelection *selection,
* gtk_tree_selection_unselect_iter: * gtk_tree_selection_unselect_iter:
* @selection: A #GtkTreeSelection. * @selection: A #GtkTreeSelection.
* @iter: The #GtkTreeIter to be unselected. * @iter: The #GtkTreeIter to be unselected.
* *
* Unselects the specified iterator. * Unselects the specified iterator.
**/ **/
void void
@ -612,7 +612,7 @@ gtk_tree_selection_real_select_all (GtkTreeSelection *selection)
gint dirty; gint dirty;
/* Just select the last row */ /* Just select the last row */
dirty = gtk_tree_selection_real_unselect_all (selection); dirty = gtk_tree_selection_real_unselect_all (selection);
tree = selection->tree_view->priv->tree; tree = selection->tree_view->priv->tree;
@ -638,7 +638,7 @@ gtk_tree_selection_real_select_all (GtkTreeSelection *selection)
else else
{ {
/* Mark all nodes selected */ /* Mark all nodes selected */
tuple = g_new (struct _TempTuple, 1); tuple = g_new (struct _TempTuple, 1);
tuple->selection = selection; tuple->selection = selection;
tuple->dirty = FALSE; tuple->dirty = FALSE;
@ -661,7 +661,7 @@ gtk_tree_selection_real_select_all (GtkTreeSelection *selection)
/** /**
* gtk_tree_selection_select_all: * gtk_tree_selection_select_all:
* @selection: A #GtkTreeSelection. * @selection: A #GtkTreeSelection.
* *
* Selects all the nodes. If the type of @selection is * Selects all the nodes. If the type of @selection is
* #GTK_TREE_SELECTION_SINGLE, then the last row is selected. * #GTK_TREE_SELECTION_SINGLE, then the last row is selected.
**/ **/
@ -706,7 +706,7 @@ gtk_tree_selection_real_unselect_all (GtkTreeSelection *selection)
GtkRBTree *tree = NULL; GtkRBTree *tree = NULL;
GtkRBNode *node = NULL; GtkRBNode *node = NULL;
GtkTreePath *anchor_path; GtkTreePath *anchor_path;
if (selection->tree_view->priv->anchor == NULL) if (selection->tree_view->priv->anchor == NULL)
return FALSE; return FALSE;
@ -714,7 +714,7 @@ gtk_tree_selection_real_unselect_all (GtkTreeSelection *selection)
if (anchor_path == NULL) if (anchor_path == NULL)
return FALSE; return FALSE;
_gtk_tree_view_find_node (selection->tree_view, _gtk_tree_view_find_node (selection->tree_view,
anchor_path, anchor_path,
&tree, &tree,
@ -724,7 +724,7 @@ gtk_tree_selection_real_unselect_all (GtkTreeSelection *selection)
if (tree == NULL) if (tree == NULL)
return FALSE; return FALSE;
if (GTK_RBNODE_FLAG_SET (node, GTK_RBNODE_IS_SELECTED)) if (GTK_RBNODE_FLAG_SET (node, GTK_RBNODE_IS_SELECTED))
{ {
if (gtk_tree_selection_real_select_node (selection, tree, node, FALSE)) if (gtk_tree_selection_real_select_node (selection, tree, node, FALSE))
@ -737,17 +737,17 @@ gtk_tree_selection_real_unselect_all (GtkTreeSelection *selection)
return FALSE; return FALSE;
} }
else else
{ {
tuple = g_new (struct _TempTuple, 1); tuple = g_new (struct _TempTuple, 1);
tuple->selection = selection; tuple->selection = selection;
tuple->dirty = FALSE; tuple->dirty = FALSE;
_gtk_rbtree_traverse (selection->tree_view->priv->tree, _gtk_rbtree_traverse (selection->tree_view->priv->tree,
selection->tree_view->priv->tree->root, selection->tree_view->priv->tree->root,
G_PRE_ORDER, G_PRE_ORDER,
unselect_all_helper, unselect_all_helper,
tuple); tuple);
if (tuple->dirty) if (tuple->dirty)
{ {
g_free (tuple); g_free (tuple);
@ -761,7 +761,7 @@ gtk_tree_selection_real_unselect_all (GtkTreeSelection *selection)
/** /**
* gtk_tree_selection_unselect_all: * gtk_tree_selection_unselect_all:
* @selection: A #GtkTreeSelection. * @selection: A #GtkTreeSelection.
* *
* Unselects all the nodes. * Unselects all the nodes.
**/ **/
void void
@ -873,7 +873,7 @@ gtk_tree_selection_real_select_range (GtkTreeSelection *selection,
* @selection: A #GtkTreeSelection. * @selection: A #GtkTreeSelection.
* @start_path: The initial node of the range. * @start_path: The initial node of the range.
* @end_path: The final node of the range. * @end_path: The final node of the range.
* *
* Selects a range of nodes, determined by @start_path and @end_path inclusive. * Selects a range of nodes, determined by @start_path and @end_path inclusive.
**/ **/
void void
@ -931,7 +931,7 @@ _gtk_tree_selection_internal_select_node (GtkTreeSelection *selection,
if (gtk_tree_selection_real_select_node (selection, tree, node, TRUE)) if (gtk_tree_selection_real_select_node (selection, tree, node, TRUE))
{ {
selection->tree_view->priv->anchor = selection->tree_view->priv->anchor =
gtk_tree_row_reference_new (selection->tree_view->priv->model, path); gtk_tree_row_reference_new_proxy (G_OBJECT (selection->tree_view), selection->tree_view->priv->model, path);
} }
} }
} }
@ -941,7 +941,7 @@ _gtk_tree_selection_internal_select_node (GtkTreeSelection *selection,
{ {
dirty = TRUE; dirty = TRUE;
selection->tree_view->priv->anchor = selection->tree_view->priv->anchor =
gtk_tree_row_reference_new (selection->tree_view->priv->model, path); gtk_tree_row_reference_new_proxy (G_OBJECT (selection->tree_view), selection->tree_view->priv->model, path);
} }
} }
} }
@ -952,10 +952,9 @@ _gtk_tree_selection_internal_select_node (GtkTreeSelection *selection,
{ {
if (selection->tree_view->priv->anchor) if (selection->tree_view->priv->anchor)
gtk_tree_row_reference_free (selection->tree_view->priv->anchor); gtk_tree_row_reference_free (selection->tree_view->priv->anchor);
selection->tree_view->priv->anchor = selection->tree_view->priv->anchor =
gtk_tree_row_reference_new (selection->tree_view->priv->model, gtk_tree_row_reference_new_proxy (G_OBJECT (selection->tree_view), selection->tree_view->priv->model, path);
path);
dirty = gtk_tree_selection_real_select_node (selection, tree, node, TRUE); dirty = gtk_tree_selection_real_select_node (selection, tree, node, TRUE);
} }
else if ((state & (GDK_CONTROL_MASK|GDK_SHIFT_MASK)) == (GDK_SHIFT_MASK|GDK_CONTROL_MASK)) else if ((state & (GDK_CONTROL_MASK|GDK_SHIFT_MASK)) == (GDK_SHIFT_MASK|GDK_CONTROL_MASK))
@ -969,10 +968,9 @@ _gtk_tree_selection_internal_select_node (GtkTreeSelection *selection,
flags = node->flags; flags = node->flags;
if (selection->tree_view->priv->anchor) if (selection->tree_view->priv->anchor)
gtk_tree_row_reference_free (selection->tree_view->priv->anchor); gtk_tree_row_reference_free (selection->tree_view->priv->anchor);
selection->tree_view->priv->anchor = selection->tree_view->priv->anchor =
gtk_tree_row_reference_new (selection->tree_view->priv->model, gtk_tree_row_reference_new_proxy (G_OBJECT (selection->tree_view), selection->tree_view->priv->model, path);
path);
if ((flags & GTK_RBNODE_IS_SELECTED) == GTK_RBNODE_IS_SELECTED) if ((flags & GTK_RBNODE_IS_SELECTED) == GTK_RBNODE_IS_SELECTED)
dirty |= gtk_tree_selection_real_select_node (selection, tree, node, FALSE); dirty |= gtk_tree_selection_real_select_node (selection, tree, node, FALSE);
@ -992,18 +990,17 @@ _gtk_tree_selection_internal_select_node (GtkTreeSelection *selection,
if (selection->tree_view->priv->anchor) if (selection->tree_view->priv->anchor)
gtk_tree_row_reference_free (selection->tree_view->priv->anchor); gtk_tree_row_reference_free (selection->tree_view->priv->anchor);
selection->tree_view->priv->anchor = selection->tree_view->priv->anchor =
gtk_tree_row_reference_new (selection->tree_view->priv->model, gtk_tree_row_reference_new_proxy (G_OBJECT (selection->tree_view), selection->tree_view->priv->model, path);
path);
dirty |= gtk_tree_selection_real_select_node (selection, tree, node, TRUE); dirty |= gtk_tree_selection_real_select_node (selection, tree, node, TRUE);
} }
} }
if (anchor_path) if (anchor_path)
gtk_tree_path_free (anchor_path); gtk_tree_path_free (anchor_path);
if (dirty) if (dirty)
gtk_signal_emit (GTK_OBJECT (selection), tree_selection_signals[SELECTION_CHANGED]); gtk_signal_emit (GTK_OBJECT (selection), tree_selection_signals[SELECTION_CHANGED]);
} }
@ -1038,7 +1035,7 @@ gtk_tree_selection_real_select_node (GtkTreeSelection *selection,
selected = TRUE; selected = TRUE;
gtk_tree_path_free (path); gtk_tree_path_free (path);
} }
if (selected == TRUE) if (selected == TRUE)
{ {
node->flags ^= GTK_RBNODE_IS_SELECTED; node->flags ^= GTK_RBNODE_IS_SELECTED;

View File

@ -2184,8 +2184,7 @@ gtk_tree_view_focus (GtkContainer *container,
gtk_tree_row_reference_free (tree_view->priv->cursor); gtk_tree_row_reference_free (tree_view->priv->cursor);
tree_view->priv->cursor = tree_view->priv->cursor =
gtk_tree_row_reference_new (tree_view->priv->model, gtk_tree_row_reference_new_proxy (G_OBJECT (tree_view), tree_view->priv->model, tmp_path);
tmp_path);
cursor_path = tmp_path; cursor_path = tmp_path;
} }
@ -2231,8 +2230,7 @@ gtk_tree_view_focus (GtkContainer *container,
gtk_tree_row_reference_free (tree_view->priv->cursor); gtk_tree_row_reference_free (tree_view->priv->cursor);
tree_view->priv->cursor = tree_view->priv->cursor =
gtk_tree_row_reference_new (tree_view->priv->model, gtk_tree_row_reference_new_proxy (G_OBJECT (tree_view), tree_view->priv->model, tmp_path);
tmp_path);
cursor_path = tmp_path; cursor_path = tmp_path;
} }
@ -2262,8 +2260,7 @@ gtk_tree_view_focus (GtkContainer *container,
gtk_tree_row_reference_free (tree_view->priv->cursor); gtk_tree_row_reference_free (tree_view->priv->cursor);
tree_view->priv->cursor = tree_view->priv->cursor =
gtk_tree_row_reference_new (tree_view->priv->model, gtk_tree_row_reference_new_proxy (G_OBJECT (tree_view), tree_view->priv->model, tmp_path);
tmp_path);
cursor_path = tmp_path; cursor_path = tmp_path;
gtk_tree_selection_select_path (tree_view->priv->selection, gtk_tree_selection_select_path (tree_view->priv->selection,
@ -2364,8 +2361,7 @@ gtk_tree_view_focus (GtkContainer *container,
cursor_path, cursor_path,
state); state);
tree_view->priv->cursor = gtk_tree_row_reference_new (tree_view->priv->model, tree_view->priv->cursor = gtk_tree_row_reference_new_proxy (G_OBJECT (tree_view), tree_view->priv->model, cursor_path);
cursor_path);
/* draw the newly-selected row */ /* draw the newly-selected row */
@ -2547,6 +2543,9 @@ gtk_tree_view_inserted (GtkTreeModel *model,
} }
else if (iter == NULL) else if (iter == NULL)
gtk_tree_model_get_iter (model, iter, path); gtk_tree_model_get_iter (model, iter, path);
/* Update all row-references */
gtk_tree_row_reference_inserted (G_OBJECT (data), path);
depth = gtk_tree_path_get_depth (path); depth = gtk_tree_path_get_depth (path);
indices = gtk_tree_path_get_indices (path); indices = gtk_tree_path_get_indices (path);
@ -2704,7 +2703,9 @@ gtk_tree_view_deleted (GtkTreeModel *model,
if (tree == NULL) if (tree == NULL)
return; return;
gtk_tree_row_reference_deleted (G_OBJECT (data), path);
/* next, update the selection */ /* next, update the selection */
if (tree_view->priv->anchor) if (tree_view->priv->anchor)
{ {
@ -5383,8 +5384,7 @@ gtk_tree_view_set_drag_dest_row (GtkTreeView *tree_view,
if (path) if (path)
{ {
tree_view->priv->drag_dest_row = tree_view->priv->drag_dest_row =
gtk_tree_row_reference_new (tree_view->priv->model, gtk_tree_row_reference_new_proxy (G_OBJECT (tree_view), tree_view->priv->model, path);
path);
gtk_tree_view_queue_draw_path (tree_view, path, NULL); gtk_tree_view_queue_draw_path (tree_view, path, NULL);
} }
else else