Bug 498010, 546005 - fix assertion in gtk_tree_view_set_cursor_on_cell

Instead of failing with warning on !tree_view->priv->tree, return
silently when tree_view->priv->model is NULL.  Clarified in the
documentation that for invalid paths (and every path is invalid when no
model is set), the function will fail silently although the current
cursor will be unset.

Fixes bugs 498010 and 546005.
This commit is contained in:
Kristian Rietveld 2009-07-30 13:58:25 +02:00
parent 531c7e535b
commit ff10f9ce02

View File

@ -12517,6 +12517,9 @@ gtk_tree_view_get_cursor (GtkTreeView *tree_view,
* This function is often followed by @gtk_widget_grab_focus (@tree_view)
* in order to give keyboard focus to the widget. Please note that editing
* can only happen when the widget is realized.
*
* If @path is invalid for @model, the current cursor (if any) will be unset
* and the function will return without failing.
**/
void
gtk_tree_view_set_cursor (GtkTreeView *tree_view,
@ -12548,6 +12551,9 @@ gtk_tree_view_set_cursor (GtkTreeView *tree_view,
* widget. Please note that editing can only happen when the widget is
* realized.
*
* If @path is invalid for @model, the current cursor (if any) will be unset
* and the function will return without failing.
*
* Since: 2.2
**/
void
@ -12558,9 +12564,12 @@ gtk_tree_view_set_cursor_on_cell (GtkTreeView *tree_view,
gboolean start_editing)
{
g_return_if_fail (GTK_IS_TREE_VIEW (tree_view));
g_return_if_fail (tree_view->priv->tree != NULL);
g_return_if_fail (path != NULL);
g_return_if_fail (focus_column == NULL || GTK_IS_TREE_VIEW_COLUMN (focus_column));
if (!tree_view->priv->model)
return;
if (focus_cell)
{
g_return_if_fail (focus_column);