diff options
author | Jonathan Blandford <jrb@redhat.com> | 2001-10-10 05:35:12 +0000 |
---|---|---|
committer | Jonathan Blandford <jrb@src.gnome.org> | 2001-10-10 05:35:12 +0000 |
commit | 57cc0e955633b06e3a610479e8b7ebcfa501a322 (patch) | |
tree | c6cd8cb59c2f2c633267c28ef0fbe8e32d72d730 | |
parent | b48389f36f9756ff75969ab3cb10ee520e3a0bfb (diff) | |
download | gdk-pixbuf-57cc0e955633b06e3a610479e8b7ebcfa501a322.tar.gz |
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
-rw-r--r-- | ChangeLog | 6 | ||||
-rw-r--r-- | ChangeLog.pre-2-0 | 6 | ||||
-rw-r--r-- | ChangeLog.pre-2-10 | 6 | ||||
-rw-r--r-- | ChangeLog.pre-2-2 | 6 | ||||
-rw-r--r-- | ChangeLog.pre-2-4 | 6 | ||||
-rw-r--r-- | ChangeLog.pre-2-6 | 6 | ||||
-rw-r--r-- | ChangeLog.pre-2-8 | 6 | ||||
-rw-r--r-- | gtk/gtktreeselection.c | 65 | ||||
-rw-r--r-- | gtk/gtktreeselection.h | 4 |
9 files changed, 111 insertions, 0 deletions
@@ -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, diff --git a/ChangeLog.pre-2-0 b/ChangeLog.pre-2-0 index a94f00432..f4c06360f 100644 --- a/ChangeLog.pre-2-0 +++ b/ChangeLog.pre-2-0 @@ -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, diff --git a/ChangeLog.pre-2-10 b/ChangeLog.pre-2-10 index a94f00432..f4c06360f 100644 --- a/ChangeLog.pre-2-10 +++ b/ChangeLog.pre-2-10 @@ -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, diff --git a/ChangeLog.pre-2-2 b/ChangeLog.pre-2-2 index a94f00432..f4c06360f 100644 --- a/ChangeLog.pre-2-2 +++ b/ChangeLog.pre-2-2 @@ -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, diff --git a/ChangeLog.pre-2-4 b/ChangeLog.pre-2-4 index a94f00432..f4c06360f 100644 --- a/ChangeLog.pre-2-4 +++ b/ChangeLog.pre-2-4 @@ -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, diff --git a/ChangeLog.pre-2-6 b/ChangeLog.pre-2-6 index a94f00432..f4c06360f 100644 --- a/ChangeLog.pre-2-6 +++ b/ChangeLog.pre-2-6 @@ -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, diff --git a/ChangeLog.pre-2-8 b/ChangeLog.pre-2-8 index a94f00432..f4c06360f 100644 --- a/ChangeLog.pre-2-8 +++ b/ChangeLog.pre-2-8 @@ -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, diff --git a/gtk/gtktreeselection.c b/gtk/gtktreeselection.c index cbf2c43a5..947c27ef5 100644 --- a/gtk/gtktreeselection.c +++ b/gtk/gtktreeselection.c @@ -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; diff --git a/gtk/gtktreeselection.h b/gtk/gtktreeselection.h index 2ef1a31e7..e172a61df 100644 --- a/gtk/gtktreeselection.h +++ b/gtk/gtktreeselection.h @@ -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, |