new function, #61923 (gtk_tree_selection_path_is_selected): Ditto
Wed Oct 10 01:19:04 2001 Jonathan Blandford <jrb@redhat.com> * gtk/gtktreeselection.c (gtk_tree_selection_iter_is_selected): new function, #61923 (gtk_tree_selection_path_is_selected): Ditto
This commit is contained in:
committed by
Jonathan Blandford
parent
b48389f36f
commit
57cc0e9556
@ -604,6 +604,71 @@ gtk_tree_selection_unselect_iter (GtkTreeSelection *selection,
|
||||
gtk_tree_path_free (path);
|
||||
}
|
||||
|
||||
/**
|
||||
* gtk_tree_selection_path_is_selected:
|
||||
* @selection: A #GtkTreeSelection.
|
||||
* @path: A #GtkTreePath to check selection on.
|
||||
*
|
||||
* Returns %TRUE if the row pointed to by @path is currently selected. If @path
|
||||
* does not point to a valid location, %FALSE is returned
|
||||
*
|
||||
* Return value: %TRUE if @path is selected.
|
||||
**/
|
||||
gboolean
|
||||
gtk_tree_selection_path_is_selected (GtkTreeSelection *selection,
|
||||
GtkTreePath *path)
|
||||
{
|
||||
GtkRBNode *node;
|
||||
GtkRBTree *tree;
|
||||
|
||||
g_return_val_if_fail (GTK_IS_TREE_SELECTION (selection), FALSE);
|
||||
g_return_val_if_fail (path != NULL, FALSE);
|
||||
g_return_val_if_fail (selection->tree_view != NULL, FALSE);
|
||||
g_return_val_if_fail (selection->tree_view->priv->model != NULL, FALSE);
|
||||
|
||||
_gtk_tree_view_find_node (selection->tree_view,
|
||||
path,
|
||||
&tree,
|
||||
&node);
|
||||
|
||||
if ((node == NULL) || !GTK_RBNODE_FLAG_SET (node, GTK_RBNODE_IS_SELECTED))
|
||||
return FALSE;
|
||||
|
||||
return TRUE;
|
||||
}
|
||||
|
||||
/**
|
||||
* gtk_tree_selection_iter_is_selected:
|
||||
* @selection: A #GtkTreeSelection
|
||||
* @iter: A valid #GtkTreeIter
|
||||
*
|
||||
* Returns %TRUE if the row pointed to by @path is currently selected.
|
||||
*
|
||||
* Return value: %TRUE, if @iter is selected
|
||||
**/
|
||||
gboolean
|
||||
gtk_tree_selection_iter_is_selected (GtkTreeSelection *selection,
|
||||
GtkTreeIter *iter)
|
||||
{
|
||||
GtkTreePath *path;
|
||||
gboolean retval;
|
||||
|
||||
g_return_val_if_fail (GTK_IS_TREE_SELECTION (selection), FALSE);
|
||||
g_return_val_if_fail (iter != NULL, FALSE);
|
||||
g_return_val_if_fail (selection->tree_view != NULL, FALSE);
|
||||
g_return_val_if_fail (selection->tree_view->priv->model != NULL, FALSE);
|
||||
|
||||
path = gtk_tree_model_get_path (selection->tree_view->priv->model, iter);
|
||||
if (path == NULL)
|
||||
return FALSE;
|
||||
|
||||
retval = gtk_tree_selection_path_is_selected (selection, path);
|
||||
gtk_tree_path_free (path);
|
||||
|
||||
return retval;
|
||||
}
|
||||
|
||||
|
||||
/* Wish I was in python, right now... */
|
||||
struct _TempTuple {
|
||||
GtkTreeSelection *selection;
|
||||
|
||||
Reference in New Issue
Block a user