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:
Jonathan Blandford 2001-10-10 05:35:12 +00:00 committed by Jonathan Blandford
parent b48389f36f
commit 57cc0e9556
9 changed files with 111 additions and 0 deletions

View File

@ -1,3 +1,9 @@
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
Tue Oct 9 17:40:24 2001 Jonathan Blandford <jrb@redhat.com>
* gtk/gtktreestore.c (gtk_tree_store_finalize): We're a gobject,

View File

@ -1,3 +1,9 @@
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
Tue Oct 9 17:40:24 2001 Jonathan Blandford <jrb@redhat.com>
* gtk/gtktreestore.c (gtk_tree_store_finalize): We're a gobject,

View File

@ -1,3 +1,9 @@
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
Tue Oct 9 17:40:24 2001 Jonathan Blandford <jrb@redhat.com>
* gtk/gtktreestore.c (gtk_tree_store_finalize): We're a gobject,

View File

@ -1,3 +1,9 @@
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
Tue Oct 9 17:40:24 2001 Jonathan Blandford <jrb@redhat.com>
* gtk/gtktreestore.c (gtk_tree_store_finalize): We're a gobject,

View File

@ -1,3 +1,9 @@
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
Tue Oct 9 17:40:24 2001 Jonathan Blandford <jrb@redhat.com>
* gtk/gtktreestore.c (gtk_tree_store_finalize): We're a gobject,

View File

@ -1,3 +1,9 @@
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
Tue Oct 9 17:40:24 2001 Jonathan Blandford <jrb@redhat.com>
* gtk/gtktreestore.c (gtk_tree_store_finalize): We're a gobject,

View File

@ -1,3 +1,9 @@
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
Tue Oct 9 17:40:24 2001 Jonathan Blandford <jrb@redhat.com>
* gtk/gtktreestore.c (gtk_tree_store_finalize): We're a gobject,

View File

@ -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;

View File

@ -95,6 +95,10 @@ void gtk_tree_selection_select_iter (GtkTreeSelection
GtkTreeIter *iter);
void gtk_tree_selection_unselect_iter (GtkTreeSelection *selection,
GtkTreeIter *iter);
gboolean gtk_tree_selection_path_is_selected (GtkTreeSelection *selection,
GtkTreePath *path);
gboolean gtk_tree_selection_iter_is_selected (GtkTreeSelection *selection,
GtkTreeIter *iter);
void gtk_tree_selection_select_all (GtkTreeSelection *selection);
void gtk_tree_selection_unselect_all (GtkTreeSelection *selection);
void gtk_tree_selection_select_range (GtkTreeSelection *selection,