summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorJonathan Blandford <jrb@redhat.com>2001-08-27 19:19:24 +0000
committerJonathan Blandford <jrb@src.gnome.org>2001-08-27 19:19:24 +0000
commit892496c8e70aaad8c40549033c01fd0d5ea16033 (patch)
tree8deeb4f47c191d91599f8bddd3b356895c1498fc
parentd70c0b40777c8f658bbba819d7ef5f0efdbdd639 (diff)
downloadgdk-pixbuf-892496c8e70aaad8c40549033c01fd0d5ea16033.tar.gz
Use the GTK selection types rather than GtkTreeSelectionMode.
Mon Aug 27 15:18:14 2001 Jonathan Blandford <jrb@redhat.com> * gtk/gtktreeselection.c (gtk_tree_selection_set_mode): Use the GTK selection types rather than GtkTreeSelectionMode. * docs/Changes-2.0: Add comment about selection change.
-rw-r--r--ChangeLog7
-rw-r--r--ChangeLog.pre-2-07
-rw-r--r--ChangeLog.pre-2-107
-rw-r--r--ChangeLog.pre-2-27
-rw-r--r--ChangeLog.pre-2-47
-rw-r--r--ChangeLog.pre-2-67
-rw-r--r--ChangeLog.pre-2-87
-rw-r--r--docs/Changes-2.0.txt5
-rw-r--r--gtk/gtkenums.h2
-rw-r--r--gtk/gtktreeselection.c55
-rw-r--r--gtk/gtktreeselection.h12
-rw-r--r--gtk/gtktreeview.c6
12 files changed, 88 insertions, 41 deletions
diff --git a/ChangeLog b/ChangeLog
index 2dfb82e93..ea714aeaa 100644
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,3 +1,10 @@
+Mon Aug 27 15:18:14 2001 Jonathan Blandford <jrb@redhat.com>
+
+ * gtk/gtktreeselection.c (gtk_tree_selection_set_mode): Use the
+ GTK selection types rather than GtkTreeSelectionMode.
+
+ * docs/Changes-2.0: Add comment about selection change.
+
Mon Aug 27 14:21:30 2001 Jonathan Blandford <jrb@redhat.com>
* gtk/gtkenums.h (GtkSelectionMode): deprecate
diff --git a/ChangeLog.pre-2-0 b/ChangeLog.pre-2-0
index 2dfb82e93..ea714aeaa 100644
--- a/ChangeLog.pre-2-0
+++ b/ChangeLog.pre-2-0
@@ -1,3 +1,10 @@
+Mon Aug 27 15:18:14 2001 Jonathan Blandford <jrb@redhat.com>
+
+ * gtk/gtktreeselection.c (gtk_tree_selection_set_mode): Use the
+ GTK selection types rather than GtkTreeSelectionMode.
+
+ * docs/Changes-2.0: Add comment about selection change.
+
Mon Aug 27 14:21:30 2001 Jonathan Blandford <jrb@redhat.com>
* gtk/gtkenums.h (GtkSelectionMode): deprecate
diff --git a/ChangeLog.pre-2-10 b/ChangeLog.pre-2-10
index 2dfb82e93..ea714aeaa 100644
--- a/ChangeLog.pre-2-10
+++ b/ChangeLog.pre-2-10
@@ -1,3 +1,10 @@
+Mon Aug 27 15:18:14 2001 Jonathan Blandford <jrb@redhat.com>
+
+ * gtk/gtktreeselection.c (gtk_tree_selection_set_mode): Use the
+ GTK selection types rather than GtkTreeSelectionMode.
+
+ * docs/Changes-2.0: Add comment about selection change.
+
Mon Aug 27 14:21:30 2001 Jonathan Blandford <jrb@redhat.com>
* gtk/gtkenums.h (GtkSelectionMode): deprecate
diff --git a/ChangeLog.pre-2-2 b/ChangeLog.pre-2-2
index 2dfb82e93..ea714aeaa 100644
--- a/ChangeLog.pre-2-2
+++ b/ChangeLog.pre-2-2
@@ -1,3 +1,10 @@
+Mon Aug 27 15:18:14 2001 Jonathan Blandford <jrb@redhat.com>
+
+ * gtk/gtktreeselection.c (gtk_tree_selection_set_mode): Use the
+ GTK selection types rather than GtkTreeSelectionMode.
+
+ * docs/Changes-2.0: Add comment about selection change.
+
Mon Aug 27 14:21:30 2001 Jonathan Blandford <jrb@redhat.com>
* gtk/gtkenums.h (GtkSelectionMode): deprecate
diff --git a/ChangeLog.pre-2-4 b/ChangeLog.pre-2-4
index 2dfb82e93..ea714aeaa 100644
--- a/ChangeLog.pre-2-4
+++ b/ChangeLog.pre-2-4
@@ -1,3 +1,10 @@
+Mon Aug 27 15:18:14 2001 Jonathan Blandford <jrb@redhat.com>
+
+ * gtk/gtktreeselection.c (gtk_tree_selection_set_mode): Use the
+ GTK selection types rather than GtkTreeSelectionMode.
+
+ * docs/Changes-2.0: Add comment about selection change.
+
Mon Aug 27 14:21:30 2001 Jonathan Blandford <jrb@redhat.com>
* gtk/gtkenums.h (GtkSelectionMode): deprecate
diff --git a/ChangeLog.pre-2-6 b/ChangeLog.pre-2-6
index 2dfb82e93..ea714aeaa 100644
--- a/ChangeLog.pre-2-6
+++ b/ChangeLog.pre-2-6
@@ -1,3 +1,10 @@
+Mon Aug 27 15:18:14 2001 Jonathan Blandford <jrb@redhat.com>
+
+ * gtk/gtktreeselection.c (gtk_tree_selection_set_mode): Use the
+ GTK selection types rather than GtkTreeSelectionMode.
+
+ * docs/Changes-2.0: Add comment about selection change.
+
Mon Aug 27 14:21:30 2001 Jonathan Blandford <jrb@redhat.com>
* gtk/gtkenums.h (GtkSelectionMode): deprecate
diff --git a/ChangeLog.pre-2-8 b/ChangeLog.pre-2-8
index 2dfb82e93..ea714aeaa 100644
--- a/ChangeLog.pre-2-8
+++ b/ChangeLog.pre-2-8
@@ -1,3 +1,10 @@
+Mon Aug 27 15:18:14 2001 Jonathan Blandford <jrb@redhat.com>
+
+ * gtk/gtktreeselection.c (gtk_tree_selection_set_mode): Use the
+ GTK selection types rather than GtkTreeSelectionMode.
+
+ * docs/Changes-2.0: Add comment about selection change.
+
Mon Aug 27 14:21:30 2001 Jonathan Blandford <jrb@redhat.com>
* gtk/gtkenums.h (GtkSelectionMode): deprecate
diff --git a/docs/Changes-2.0.txt b/docs/Changes-2.0.txt
index 9b2371f07..97799cb95 100644
--- a/docs/Changes-2.0.txt
+++ b/docs/Changes-2.0.txt
@@ -454,3 +454,8 @@ Incompatible Changes from GTK+-1.2 to GTK+-2.0:
* gtk_image_new() now takes no arguments and creates an empty GtkImage
widget. To create a GtkImage widget from a GdkImage (the least
common usage of GdkImage), use gtk_image_new_from_image.
+
+* GTK_SELECTION_EXTENDED is now deprecated, and neither the
+ GtkList/GtkTree nor the GtkCList/GtkCTree support
+ GTK_SELECTION_EXTENDED anymore. However, the old extended behavior
+ replaces MULTIPLE behavior.
diff --git a/gtk/gtkenums.h b/gtk/gtkenums.h
index 94c5c0d09..b62414ccd 100644
--- a/gtk/gtkenums.h
+++ b/gtk/gtkenums.h
@@ -320,7 +320,7 @@ typedef enum
GTK_SELECTION_SINGLE,
GTK_SELECTION_BROWSE,
GTK_SELECTION_MULTIPLE,
- GTK_SELECTION_EXTENDED == GTK_SELECTION_MULTIPLE /* Deprecated */
+ GTK_SELECTION_EXTENDED = GTK_SELECTION_MULTIPLE /* Deprecated */
} GtkSelectionMode;
/* Shadow types */
diff --git a/gtk/gtktreeselection.c b/gtk/gtktreeselection.c
index fe74d602c..b09d00781 100644
--- a/gtk/gtktreeselection.c
+++ b/gtk/gtktreeselection.c
@@ -91,7 +91,7 @@ gtk_tree_selection_class_init (GtkTreeSelectionClass *class)
static void
gtk_tree_selection_init (GtkTreeSelection *selection)
{
- selection->type = GTK_TREE_SELECTION_SINGLE;
+ selection->type = GTK_SELECTION_SINGLE;
}
static void
@@ -169,19 +169,20 @@ _gtk_tree_selection_set_tree_view (GtkTreeSelection *selection,
* @type: The selection mode
*
* Sets the selection mode of the @selection. If the previous type was
- * #GTK_TREE_SELECTION_MULTI and @type is #GTK_TREE_SELECTION_SINGLE, then
- * the anchor is kept selected, if it was previously selected.
+ * #GTK_SELECTION_MULTIPLE and, then the anchor is kept selected, if it was
+ * previously selected.
**/
void
-gtk_tree_selection_set_mode (GtkTreeSelection *selection,
- GtkTreeSelectionMode type)
+gtk_tree_selection_set_mode (GtkTreeSelection *selection,
+ GtkSelectionMode type)
{
g_return_if_fail (GTK_IS_TREE_SELECTION (selection));
if (selection->type == type)
return;
- if (type == GTK_TREE_SELECTION_SINGLE)
+ if (type == GTK_SELECTION_SINGLE ||
+ type == GTK_SELECTION_BROWSE)
{
GtkRBTree *tree = NULL;
GtkRBNode *node = NULL;
@@ -227,10 +228,10 @@ gtk_tree_selection_set_mode (GtkTreeSelection *selection,
*
* Return value: the current selection mode
**/
-GtkTreeSelectionMode
+GtkSelectionMode
gtk_tree_selection_get_mode (GtkTreeSelection *selection)
{
- g_return_val_if_fail (GTK_IS_TREE_SELECTION (selection), GTK_TREE_SELECTION_SINGLE);
+ g_return_val_if_fail (GTK_IS_TREE_SELECTION (selection), GTK_SELECTION_SINGLE);
return selection->type;
}
@@ -290,10 +291,10 @@ gtk_tree_selection_get_tree_view (GtkTreeSelection *selection)
* @iter: The #GtkTreeIter, or NULL.
*
* Sets @iter to the currently selected node if @selection is set to
- * #GTK_TREE_SELECTION_SINGLE. @iter may be NULL if you just want to test if
- * @selection has any selected nodes. @model is filled with the current model
- * as a convenience. This function will not work if you use @selection is
- * #GTK_TREE_SELECTION_MULTI.
+ * #GTK_SELECTION_SINGLE or #GTK_SELECTION_BROWSE. @iter may be NULL if you
+ * just want to test if @selection has any selected nodes. @model is filled
+ * with the current model as a convenience. This function will not work if you
+ * use @selection is #GTK_SELECTION_MULTIPLE.
*
* Return value: TRUE, if there is a selected node.
**/
@@ -308,7 +309,7 @@ gtk_tree_selection_get_selected (GtkTreeSelection *selection,
gboolean retval;
g_return_val_if_fail (GTK_IS_TREE_SELECTION (selection), FALSE);
- g_return_val_if_fail (selection->type == GTK_TREE_SELECTION_SINGLE, FALSE);
+ g_return_val_if_fail (selection->type != GTK_SELECTION_MULTIPLE, FALSE);
g_return_val_if_fail (selection->tree_view != NULL, FALSE);
g_return_val_if_fail (selection->tree_view->priv->model != NULL, FALSE);
@@ -380,7 +381,8 @@ gtk_tree_selection_selected_foreach (GtkTreeSelection *selection,
selection->tree_view->priv->tree->root == NULL)
return;
- if (selection->type == GTK_TREE_SELECTION_SINGLE)
+ if (selection->type == GTK_SELECTION_SINGLE ||
+ selection->type == GTK_SELECTION_BROWSE)
{
if (gtk_tree_row_reference_valid (selection->tree_view->priv->anchor))
{
@@ -492,7 +494,7 @@ gtk_tree_selection_select_path (GtkTreeSelection *selection,
if (node == NULL || GTK_RBNODE_FLAG_SET (node, GTK_RBNODE_IS_SELECTED))
return;
- if (selection->type == GTK_TREE_SELECTION_MULTI)
+ if (selection->type == GTK_SELECTION_MULTIPLE)
state = GDK_CONTROL_MASK;
_gtk_tree_selection_internal_select_node (selection,
@@ -652,8 +654,8 @@ gtk_tree_selection_real_select_all (GtkTreeSelection *selection)
* gtk_tree_selection_select_all:
* @selection: A #GtkTreeSelection.
*
- * Selects all the nodes. @selection is must be set to
- * #GTK_TREE_SELECTION_MULTI mode.
+ * Selects all the nodes. @selection is must be set to #GTK_SELECTION_MULTIPLE
+ * mode.
**/
void
gtk_tree_selection_select_all (GtkTreeSelection *selection)
@@ -662,7 +664,7 @@ gtk_tree_selection_select_all (GtkTreeSelection *selection)
g_return_if_fail (selection->tree_view != NULL);
if (selection->tree_view->priv->tree == NULL)
return;
- g_return_if_fail (selection->type != GTK_TREE_SELECTION_MULTI);
+ g_return_if_fail (selection->type != GTK_SELECTION_MULTIPLE);
if (gtk_tree_selection_real_select_all (selection))
g_signal_emit (G_OBJECT (selection), tree_selection_signals[CHANGED], 0);
@@ -692,7 +694,8 @@ gtk_tree_selection_real_unselect_all (GtkTreeSelection *selection)
{
struct _TempTuple *tuple;
- if (selection->type == GTK_TREE_SELECTION_SINGLE)
+ if (selection->type == GTK_SELECTION_SINGLE ||
+ selection->type == GTK_SELECTION_BROWSE)
{
GtkRBTree *tree = NULL;
GtkRBNode *node = NULL;
@@ -881,10 +884,12 @@ _gtk_tree_selection_internal_select_node (GtkTreeSelection *selection,
if (selection->tree_view->priv->anchor)
anchor_path = gtk_tree_row_reference_get_path (selection->tree_view->priv->anchor);
- if (selection->type == GTK_TREE_SELECTION_SINGLE)
+ if (selection->type == GTK_SELECTION_SINGLE ||
+ selection->type == GTK_SELECTION_BROWSE)
{
/* Did we try to select the same node again? */
- if (anchor_path && gtk_tree_path_compare (path, anchor_path) == 0)
+ if (selection->type == GTK_SELECTION_SINGLE &&
+ anchor_path && gtk_tree_path_compare (path, anchor_path) == 0)
{
if ((state & GDK_CONTROL_MASK) == GDK_CONTROL_MASK)
{
@@ -921,7 +926,7 @@ _gtk_tree_selection_internal_select_node (GtkTreeSelection *selection,
}
}
}
- else if (selection->type == GTK_TREE_SELECTION_MULTI)
+ else if (selection->type == GTK_SELECTION_MULTIPLE)
{
if (((state & GDK_SHIFT_MASK) == GDK_SHIFT_MASK) && (anchor_path == NULL))
{
@@ -983,12 +988,6 @@ _gtk_tree_selection_internal_select_node (GtkTreeSelection *selection,
/* NOTE: Any {un,}selection ever done _MUST_ be done through this function!
*/
-/* FIXME: user_func can screw up GTK_TREE_SELECTION_SINGLE. If it prevents
- * unselection of a node, it can keep more then one node selected.
- */
-/* Perhaps the correct solution is to prevent selecting the new node, if
- * we fail to unselect the old node.
- */
static gint
gtk_tree_selection_real_select_node (GtkTreeSelection *selection,
GtkRBTree *tree,
diff --git a/gtk/gtktreeselection.h b/gtk/gtktreeselection.h
index d349337a4..11286bdab 100644
--- a/gtk/gtktreeselection.h
+++ b/gtk/gtktreeselection.h
@@ -34,12 +34,6 @@ extern "C" {
#define GTK_IS_TREE_SELECTION_CLASS(klass) (GTK_CHECK_CLASS_TYPE ((obj), GTK_TYPE_TREE_SELECTION))
#define GTK_TREE_SELECTION_GET_CLASS(obj) (GTK_CHECK_GET_CLASS ((obj), GTK_TYPE_TREE_SELECTION, GtkTreeSelectionClass))
-typedef enum
-{
- GTK_TREE_SELECTION_SINGLE,
- GTK_TREE_SELECTION_MULTI
-} GtkTreeSelectionMode;
-
typedef gboolean (* GtkTreeSelectionFunc) (GtkTreeSelection *selection,
GtkTreeModel *model,
GtkTreePath *path,
@@ -56,7 +50,7 @@ struct _GtkTreeSelection
/*< private >*/
GtkTreeView *tree_view;
- GtkTreeSelectionMode type;
+ GtkSelectionMode type;
GtkTreeSelectionFunc user_func;
gpointer user_data;
GtkDestroyNotify destroy;
@@ -73,8 +67,8 @@ struct _GtkTreeSelectionClass
GtkType gtk_tree_selection_get_type (void);
void gtk_tree_selection_set_mode (GtkTreeSelection *selection,
- GtkTreeSelectionMode type);
-GtkTreeSelectionMode gtk_tree_selection_get_mode (GtkTreeSelection *selection);
+ GtkSelectionMode type);
+GtkSelectionMode gtk_tree_selection_get_mode (GtkTreeSelection *selection);
void gtk_tree_selection_set_select_function (GtkTreeSelection *selection,
GtkTreeSelectionFunc func,
gpointer data,
diff --git a/gtk/gtktreeview.c b/gtk/gtktreeview.c
index 05815800b..42cedc951 100644
--- a/gtk/gtktreeview.c
+++ b/gtk/gtktreeview.c
@@ -5693,10 +5693,10 @@ gtk_tree_view_focus_to_cursor (GtkTreeView *tree_view)
cursor_path = gtk_tree_path_new_root ();
gtk_tree_row_reference_free (tree_view->priv->cursor);
- if (tree_view->priv->selection->type == GTK_TREE_SELECTION_SINGLE)
- gtk_tree_view_real_set_cursor (tree_view, cursor_path, TRUE);
- else
+ if (tree_view->priv->selection->type == GTK_SELECTION_MULTIPLE)
gtk_tree_view_real_set_cursor (tree_view, cursor_path, FALSE);
+ else
+ gtk_tree_view_real_set_cursor (tree_view, cursor_path, TRUE);
}
gtk_tree_path_free (cursor_path);
}