diff options
author | Jonathan Blandford <jrb@redhat.com> | 2001-10-31 20:20:12 +0000 |
---|---|---|
committer | Jonathan Blandford <jrb@src.gnome.org> | 2001-10-31 20:20:12 +0000 |
commit | 30f9fab4b418b1adc94bd4a49a987477481a460a (patch) | |
tree | dd5ea3e0d4d503d6742cbd748a552c0b9643b31e /gtk/gtktreeselection.c | |
parent | c49351c86bfb7168561a7a813a4d9e65e8d69cd9 (diff) | |
download | gtk+-30f9fab4b418b1adc94bd4a49a987477481a460a.tar.gz |
Add GTK_SELECTION_NONE enum, #61695
Wed Oct 31 14:45:08 2001 Jonathan Blandford <jrb@redhat.com>
* gtk/gtkenums.h (enum): Add GTK_SELECTION_NONE enum, #61695
* gtk/gtktreeselection.c (gtk_tree_selection_set_mode): Handle new
GTK_SELECTION_NONE enum.
(_gtk_tree_selection_internal_select_node): ditto
* gtk/gtkcellrenderer.h (struct _GtkCellRendererClass): add
constness.
* gtk/gtkcellrenderertoggle.c: more yummy constness.
* gtk/gtkclist.c (gtk_clist_set_selection_mode): g_return_if_fail
if mode == GTK_SELECTION_NONE
Diffstat (limited to 'gtk/gtktreeselection.c')
-rw-r--r-- | gtk/gtktreeselection.c | 39 |
1 files changed, 29 insertions, 10 deletions
diff --git a/gtk/gtktreeselection.c b/gtk/gtktreeselection.c index 6e67d72d4f..01ec82dac3 100644 --- a/gtk/gtktreeselection.c +++ b/gtk/gtktreeselection.c @@ -176,22 +176,33 @@ void gtk_tree_selection_set_mode (GtkTreeSelection *selection, GtkSelectionMode type) { + GtkTreeSelectionFunc tmp_func; g_return_if_fail (GTK_IS_TREE_SELECTION (selection)); if (selection->type == type) return; - if (type == GTK_SELECTION_SINGLE || - type == GTK_SELECTION_BROWSE) + + if (type == GTK_SELECTION_NONE) + { + gtk_tree_row_reference_free (selection->tree_view->priv->anchor); + /* We do this so that we unconditionally unset all rows + */ + tmp_func = selection->user_func; + selection->user_func = NULL; + gtk_tree_selection_unselect_all (selection); + selection->user_func = tmp_func; + } + else if (type == GTK_SELECTION_SINGLE || + type == GTK_SELECTION_BROWSE) { GtkRBTree *tree = NULL; GtkRBNode *node = NULL; gint selected = FALSE; + GtkTreePath *anchor_path = NULL; if (selection->tree_view->priv->anchor) { - GtkTreePath *anchor_path; - anchor_path = gtk_tree_row_reference_get_path (selection->tree_view->priv->anchor); if (anchor_path) @@ -203,19 +214,25 @@ gtk_tree_selection_set_mode (GtkTreeSelection *selection, if (node && GTK_RBNODE_FLAG_SET (node, GTK_RBNODE_IS_SELECTED)) selected = TRUE; - - gtk_tree_path_free (anchor_path); } } - /* FIXME: if user_func is set, then it needs to unconditionally unselect - * all. + + /* We do this so that we unconditionally unset all rows */ + tmp_func = selection->user_func; + selection->user_func = NULL; gtk_tree_selection_unselect_all (selection); + selection->user_func = tmp_func; - /* FIXME are we properly emitting the selection_changed signal here? */ if (node && selected) - GTK_RBNODE_SET_FLAG (node, GTK_RBNODE_IS_SELECTED); + _gtk_tree_selection_internal_select_node (selection, + node, + tree, + anchor_path, + 0); + gtk_tree_path_free (anchor_path); } + selection->type = type; } @@ -955,6 +972,8 @@ _gtk_tree_selection_internal_select_node (GtkTreeSelection *selection, gint dirty = FALSE; GtkTreePath *anchor_path = NULL; + if (selection->type == GTK_SELECTION_NONE) + return; if (selection->tree_view->priv->anchor) anchor_path = gtk_tree_row_reference_get_path (selection->tree_view->priv->anchor); |