summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--ChangeLog11
-rw-r--r--ChangeLog.pre-2-011
-rw-r--r--ChangeLog.pre-2-1011
-rw-r--r--ChangeLog.pre-2-211
-rw-r--r--ChangeLog.pre-2-411
-rw-r--r--ChangeLog.pre-2-611
-rw-r--r--ChangeLog.pre-2-811
-rw-r--r--gtk/gtkcellrenderertoggle.c17
-rw-r--r--gtk/gtktreemodel.c2
-rw-r--r--gtk/gtktreeprivate.h28
-rw-r--r--gtk/gtktreeview.c262
-rw-r--r--gtk/gtktreeview.h6
-rw-r--r--gtk/gtktreeviewcolumn.c164
-rw-r--r--gtk/treestoretest.c24
-rw-r--r--tests/testtreecolumns.c192
-rw-r--r--tests/treestoretest.c24
16 files changed, 569 insertions, 227 deletions
diff --git a/ChangeLog b/ChangeLog
index bb5f3ab08d..91d70d3001 100644
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,3 +1,14 @@
+Thu Mar 1 19:50:56 2001 Jonathan Blandford <jrb@redhat.com>
+
+ * gtk/gtktreeviewcolumn.c (_gtk_tree_view_column_realize_button):
+ Move handling of buttons fully in gtktreeviewcolumn. This code is
+ less interrelated then it was, but it still requires the
+ GtkTreeView to map it.
+
+ * test/testtreecolumn.c: Now I can add a column to one view,
+ remove it, add it to the another view, remove it, then re-add it
+ to the first. Nifty.
+
Thu Mar 1 13:14:27 GMT 2001 Tony Gale <gale@gtk.org>
* docs/tutorial/gtk-tut.sgml: Minor corrections
diff --git a/ChangeLog.pre-2-0 b/ChangeLog.pre-2-0
index bb5f3ab08d..91d70d3001 100644
--- a/ChangeLog.pre-2-0
+++ b/ChangeLog.pre-2-0
@@ -1,3 +1,14 @@
+Thu Mar 1 19:50:56 2001 Jonathan Blandford <jrb@redhat.com>
+
+ * gtk/gtktreeviewcolumn.c (_gtk_tree_view_column_realize_button):
+ Move handling of buttons fully in gtktreeviewcolumn. This code is
+ less interrelated then it was, but it still requires the
+ GtkTreeView to map it.
+
+ * test/testtreecolumn.c: Now I can add a column to one view,
+ remove it, add it to the another view, remove it, then re-add it
+ to the first. Nifty.
+
Thu Mar 1 13:14:27 GMT 2001 Tony Gale <gale@gtk.org>
* docs/tutorial/gtk-tut.sgml: Minor corrections
diff --git a/ChangeLog.pre-2-10 b/ChangeLog.pre-2-10
index bb5f3ab08d..91d70d3001 100644
--- a/ChangeLog.pre-2-10
+++ b/ChangeLog.pre-2-10
@@ -1,3 +1,14 @@
+Thu Mar 1 19:50:56 2001 Jonathan Blandford <jrb@redhat.com>
+
+ * gtk/gtktreeviewcolumn.c (_gtk_tree_view_column_realize_button):
+ Move handling of buttons fully in gtktreeviewcolumn. This code is
+ less interrelated then it was, but it still requires the
+ GtkTreeView to map it.
+
+ * test/testtreecolumn.c: Now I can add a column to one view,
+ remove it, add it to the another view, remove it, then re-add it
+ to the first. Nifty.
+
Thu Mar 1 13:14:27 GMT 2001 Tony Gale <gale@gtk.org>
* docs/tutorial/gtk-tut.sgml: Minor corrections
diff --git a/ChangeLog.pre-2-2 b/ChangeLog.pre-2-2
index bb5f3ab08d..91d70d3001 100644
--- a/ChangeLog.pre-2-2
+++ b/ChangeLog.pre-2-2
@@ -1,3 +1,14 @@
+Thu Mar 1 19:50:56 2001 Jonathan Blandford <jrb@redhat.com>
+
+ * gtk/gtktreeviewcolumn.c (_gtk_tree_view_column_realize_button):
+ Move handling of buttons fully in gtktreeviewcolumn. This code is
+ less interrelated then it was, but it still requires the
+ GtkTreeView to map it.
+
+ * test/testtreecolumn.c: Now I can add a column to one view,
+ remove it, add it to the another view, remove it, then re-add it
+ to the first. Nifty.
+
Thu Mar 1 13:14:27 GMT 2001 Tony Gale <gale@gtk.org>
* docs/tutorial/gtk-tut.sgml: Minor corrections
diff --git a/ChangeLog.pre-2-4 b/ChangeLog.pre-2-4
index bb5f3ab08d..91d70d3001 100644
--- a/ChangeLog.pre-2-4
+++ b/ChangeLog.pre-2-4
@@ -1,3 +1,14 @@
+Thu Mar 1 19:50:56 2001 Jonathan Blandford <jrb@redhat.com>
+
+ * gtk/gtktreeviewcolumn.c (_gtk_tree_view_column_realize_button):
+ Move handling of buttons fully in gtktreeviewcolumn. This code is
+ less interrelated then it was, but it still requires the
+ GtkTreeView to map it.
+
+ * test/testtreecolumn.c: Now I can add a column to one view,
+ remove it, add it to the another view, remove it, then re-add it
+ to the first. Nifty.
+
Thu Mar 1 13:14:27 GMT 2001 Tony Gale <gale@gtk.org>
* docs/tutorial/gtk-tut.sgml: Minor corrections
diff --git a/ChangeLog.pre-2-6 b/ChangeLog.pre-2-6
index bb5f3ab08d..91d70d3001 100644
--- a/ChangeLog.pre-2-6
+++ b/ChangeLog.pre-2-6
@@ -1,3 +1,14 @@
+Thu Mar 1 19:50:56 2001 Jonathan Blandford <jrb@redhat.com>
+
+ * gtk/gtktreeviewcolumn.c (_gtk_tree_view_column_realize_button):
+ Move handling of buttons fully in gtktreeviewcolumn. This code is
+ less interrelated then it was, but it still requires the
+ GtkTreeView to map it.
+
+ * test/testtreecolumn.c: Now I can add a column to one view,
+ remove it, add it to the another view, remove it, then re-add it
+ to the first. Nifty.
+
Thu Mar 1 13:14:27 GMT 2001 Tony Gale <gale@gtk.org>
* docs/tutorial/gtk-tut.sgml: Minor corrections
diff --git a/ChangeLog.pre-2-8 b/ChangeLog.pre-2-8
index bb5f3ab08d..91d70d3001 100644
--- a/ChangeLog.pre-2-8
+++ b/ChangeLog.pre-2-8
@@ -1,3 +1,14 @@
+Thu Mar 1 19:50:56 2001 Jonathan Blandford <jrb@redhat.com>
+
+ * gtk/gtktreeviewcolumn.c (_gtk_tree_view_column_realize_button):
+ Move handling of buttons fully in gtktreeviewcolumn. This code is
+ less interrelated then it was, but it still requires the
+ GtkTreeView to map it.
+
+ * test/testtreecolumn.c: Now I can add a column to one view,
+ remove it, add it to the another view, remove it, then re-add it
+ to the first. Nifty.
+
Thu Mar 1 13:14:27 GMT 2001 Tony Gale <gale@gtk.org>
* docs/tutorial/gtk-tut.sgml: Minor corrections
diff --git a/gtk/gtkcellrenderertoggle.c b/gtk/gtkcellrenderertoggle.c
index 2213f3c16b..78dfaf6525 100644
--- a/gtk/gtkcellrenderertoggle.c
+++ b/gtk/gtkcellrenderertoggle.c
@@ -347,3 +347,20 @@ gtk_cell_renderer_toggle_get_radio (GtkCellRendererToggle *toggle)
return toggle->radio;
}
+
+gboolean
+gtk_cell_renderer_toggle_get_active (GtkCellRendererToggle *toggle)
+{
+ g_return_val_if_fail (GTK_IS_CELL_RENDERER_TOGGLE (toggle), FALSE);
+
+ return toggle->active;
+}
+
+void
+gtk_cell_renderer_toggle_set_active (GtkCellRendererToggle *toggle,
+ gboolean setting)
+{
+ g_return_if_fail (GTK_IS_CELL_RENDERER_TOGGLE (toggle));
+
+ g_object_set (G_OBJECT (toggle), "active", setting, NULL);
+}
diff --git a/gtk/gtktreemodel.c b/gtk/gtktreemodel.c
index 052eddb3c0..5b55cd0dec 100644
--- a/gtk/gtktreemodel.c
+++ b/gtk/gtktreemodel.c
@@ -1277,7 +1277,7 @@ gtk_tree_row_reference_new_proxy (GObject *proxy,
refs = g_new (RowRefList, 1);
refs->list = NULL;
- if (model == proxy)
+ if (G_OBJECT (model) == proxy)
connect_ref_callbacks (model);
g_object_set_data_full (G_OBJECT (proxy),
diff --git a/gtk/gtktreeprivate.h b/gtk/gtktreeprivate.h
index 7e2e59ab8f..1ed5818ae8 100644
--- a/gtk/gtktreeprivate.h
+++ b/gtk/gtktreeprivate.h
@@ -29,6 +29,25 @@ extern "C" {
#include <gtk/gtktreeselection.h>
#include <gtk/gtkrbtree.h>
+
+/* the width of the column resize windows */
+#define TREE_VIEW_EXPANDER_WIDTH 14
+#define TREE_VIEW_EXPANDER_HEIGHT 14
+
+/* The TREE_VIEW_VERTICAL_SEPARATOR is the space between rows. The
+ * GTK_RBNODE_GET_HEIGHT() value includes the separators; the offset
+ * of each row points to the center of the inter-row space. For an odd
+ * separator, the extra pixel by convention goes _below_ the row. So
+ * a node in the rbtree owns TREE_VIEW_VERTICAL_SEPARATOR/2 pixels
+ * above the row, and TREE_VIEW_VERTICAL_SEPARATOR/2 +
+ * TREE_VIEW_VERTICAL_SEPARATOR%2 pixels below the row.
+ */
+
+#define TREE_VIEW_VERTICAL_SEPARATOR 2
+#define TREE_VIEW_HORIZONTAL_SEPARATOR 0
+
+#define TREE_VIEW_DRAG_WIDTH 6
+
typedef enum
{
GTK_TREE_VIEW_IS_LIST = 1 << 0,
@@ -202,8 +221,13 @@ GtkTreePath *_gtk_tree_view_find_path (GtkTreeView *tree_v
void _gtk_tree_view_update_size (GtkTreeView *tree_view);
-void _gtk_tree_view_column_set_tree_view (GtkTreeViewColumn *column,
- GtkTreeView *tree_view);
+void _gtk_tree_view_column_create_button (GtkTreeViewColumn *column);
+void _gtk_tree_view_column_realize_button (GtkTreeViewColumn *column);
+void _gtk_tree_view_column_unrealize_button (GtkTreeViewColumn *column);
+void _gtk_tree_view_column_set_tree_view (GtkTreeViewColumn *column,
+ GtkTreeView *tree_view);
+void _gtk_tree_view_column_unset_tree_view (GtkTreeViewColumn *column);
+
GtkTreeSelection* _gtk_tree_selection_new (void);
GtkTreeSelection* _gtk_tree_selection_new_with_tree_view (GtkTreeView *tree_view);
diff --git a/gtk/gtktreeview.c b/gtk/gtktreeview.c
index fed2bd1098..38dfe1b7e4 100644
--- a/gtk/gtktreeview.c
+++ b/gtk/gtktreeview.c
@@ -34,22 +34,6 @@
#include <gdk/gdkkeysyms.h>
-/* the width of the column resize windows */
-#define TREE_VIEW_DRAG_WIDTH 6
-#define TREE_VIEW_EXPANDER_WIDTH 14
-#define TREE_VIEW_EXPANDER_HEIGHT 14
-
-/* The TREE_VIEW_VERTICAL_SEPARATOR is the space between rows. The
- * GTK_RBNODE_GET_HEIGHT() value includes the separators; the offset
- * of each row points to the center of the inter-row space. For an odd
- * separator, the extra pixel by convention goes _below_ the row. So
- * a node in the rbtree owns TREE_VIEW_VERTICAL_SEPARATOR/2 pixels
- * above the row, and TREE_VIEW_VERTICAL_SEPARATOR/2 +
- * TREE_VIEW_VERTICAL_SEPARATOR%2 pixels below the row.
- */
-
-#define TREE_VIEW_VERTICAL_SEPARATOR 2
-#define TREE_VIEW_HORIZONTAL_SEPARATOR 0
/* The "background" areas of all rows/cells add up to cover the entire tree.
* The background includes all inter-row and inter-cell spacing.
@@ -218,11 +202,11 @@ static void gtk_tree_view_discover_dirty (GtkTreeView *tree_view,
GtkTreeIter *iter,
gint depth);
static void gtk_tree_view_check_dirty (GtkTreeView *tree_view);
+#if 0
static void gtk_tree_view_create_button (GtkTreeView *tree_view,
gint i);
static void gtk_tree_view_create_buttons (GtkTreeView *tree_view);
-static void gtk_tree_view_button_clicked (GtkWidget *widget,
- gpointer data);
+#endif
static void gtk_tree_view_clamp_node_visible (GtkTreeView *tree_view,
GtkRBTree *tree,
GtkRBNode *node);
@@ -375,57 +359,6 @@ gtk_tree_view_finalize (GObject *object)
*/
static void
-gtk_tree_view_realize_buttons (GtkTreeView *tree_view)
-{
- GList *list;
- GtkTreeViewColumn *column;
- GdkWindowAttr attr;
- guint attributes_mask;
-
- g_return_if_fail (GTK_WIDGET_REALIZED (tree_view));
- g_return_if_fail (tree_view->priv->header_window != NULL);
-
- attr.window_type = GDK_WINDOW_CHILD;
- attr.wclass = GDK_INPUT_ONLY;
- attr.visual = gtk_widget_get_visual (GTK_WIDGET (tree_view));
- attr.colormap = gtk_widget_get_colormap (GTK_WIDGET (tree_view));
- attr.event_mask = gtk_widget_get_events (GTK_WIDGET (tree_view));
- attr.event_mask = (GDK_BUTTON_PRESS_MASK |
- GDK_BUTTON_RELEASE_MASK |
- GDK_POINTER_MOTION_MASK |
- GDK_POINTER_MOTION_HINT_MASK |
- GDK_KEY_PRESS_MASK);
- attributes_mask = GDK_WA_CURSOR | GDK_WA_X | GDK_WA_Y;
- attr.cursor = gdk_cursor_new (GDK_SB_H_DOUBLE_ARROW);
- tree_view->priv->cursor_drag = attr.cursor;
-
- attr.y = 0;
- attr.width = TREE_VIEW_DRAG_WIDTH;
- attr.height = tree_view->priv->header_height;
-
- for (list = tree_view->priv->columns; list; list = list->next)
- {
- column = list->data;
- if (column->button)
- {
- if (column->visible == FALSE)
- continue;
- if (column->window != NULL)
- continue;
-
- gtk_widget_set_parent_window (column->button,
- tree_view->priv->header_window);
-
- attr.x = (column->button->allocation.x + column->button->allocation.width) - 3;
-
- column->window = gdk_window_new (tree_view->priv->header_window,
- &attr, attributes_mask);
- gdk_window_set_user_data (column->window, tree_view);
- }
- }
-}
-
-static void
gtk_tree_view_realize (GtkWidget *widget)
{
GList *tmp_list;
@@ -518,7 +451,10 @@ gtk_tree_view_realize (GtkWidget *widget)
gtk_widget_set_parent_window (child->widget, tree_view->priv->bin_window);
}
- gtk_tree_view_realize_buttons (GTK_TREE_VIEW (widget));
+
+ for (tmp_list = tree_view->priv->columns; tmp_list; tmp_list = tmp_list->next)
+ _gtk_tree_view_column_realize_button (GTK_TREE_VIEW_COLUMN (tmp_list->data));
+
_gtk_tree_view_update_size (GTK_TREE_VIEW (widget));
if (tree_view->priv->scroll_to_path != NULL ||
@@ -542,6 +478,7 @@ static void
gtk_tree_view_unrealize (GtkWidget *widget)
{
GtkTreeView *tree_view;
+ GList *list;
g_return_if_fail (widget != NULL);
g_return_if_fail (GTK_IS_TREE_VIEW (widget));
@@ -559,9 +496,10 @@ gtk_tree_view_unrealize (GtkWidget *widget)
gtk_timeout_remove (tree_view->priv->open_dest_timeout);
tree_view->priv->open_dest_timeout = 0;
}
-
- /* FIXME where do we clear column->window for each column? */
-
+
+ for (list = tree_view->priv->columns; list; list = list->next)
+ _gtk_tree_view_column_unrealize_button (GTK_TREE_VIEW_COLUMN (list->data));
+
gdk_window_set_user_data (tree_view->priv->bin_window, NULL);
gdk_window_destroy (tree_view->priv->bin_window);
tree_view->priv->bin_window = NULL;
@@ -3066,28 +3004,7 @@ gtk_tree_view_check_dirty (GtkTreeView *tree_view)
column->dirty = FALSE;
}
}
-
-static void
-gtk_tree_view_create_button (GtkTreeView *tree_view,
- gint i)
-{
- GtkWidget *button;
- GtkTreeViewColumn *column;
-
- column = g_list_nth (tree_view->priv->columns, i)->data;
- gtk_widget_push_composite_child ();
- button = column->button = gtk_button_new ();
- gtk_widget_pop_composite_child ();
-
- gtk_widget_set_parent (button, GTK_WIDGET (tree_view));\
-
- gtk_signal_connect (GTK_OBJECT (button), "clicked",
- (GtkSignalFunc) gtk_tree_view_button_clicked,
- (gpointer) tree_view);
-
- gtk_widget_show (button);
-}
-
+#if 0
static void
gtk_tree_view_create_buttons (GtkTreeView *tree_view)
{
@@ -3150,27 +3067,7 @@ gtk_tree_view_create_buttons (GtkTreeView *tree_view)
if (GTK_WIDGET_MAPPED (tree_view))
gtk_tree_view_map_buttons (tree_view);
}
-
-static void
-gtk_tree_view_button_clicked (GtkWidget *widget,
- gpointer data)
-{
- GList *list;
- GtkTreeView *tree_view;
-
- g_return_if_fail (widget != NULL);
- g_return_if_fail (GTK_IS_TREE_VIEW (data));
-
- tree_view = GTK_TREE_VIEW (data);
-
- /* find the column whose button was pressed */
- for (list = tree_view->priv->columns; list; list = list->next)
- if (GTK_TREE_VIEW_COLUMN (list->data)->button == widget)
- break;
-
- if (list)
- gtk_tree_view_column_clicked (GTK_TREE_VIEW_COLUMN (list->data));
-}
+#endif
/* Make sure the node is visible vertically */
static void
@@ -3617,7 +3514,7 @@ gtk_tree_view_setup_model (GtkTreeView *tree_view)
gtk_tree_path_free (path);
- gtk_tree_view_create_buttons (tree_view);
+ // gtk_tree_view_create_buttons (tree_view);
GTK_TREE_VIEW_SET_FLAG (tree_view, GTK_TREE_VIEW_MODEL_SETUP);
}
@@ -3640,40 +3537,26 @@ gtk_tree_view_set_model (GtkTreeView *tree_view,
if (tree_view->priv->model != NULL)
{
-
- /* No longer do this. */
-#if 0
- for (list = tree_view->priv->columns; list; list = list->next)
- {
- column = list->data;
- if (column->button)
- {
- gtk_widget_unparent (column->button);
- gdk_window_set_user_data (column->window, NULL);
- gdk_window_destroy (column->window);
- }
- }
-#endif
if (GTK_TREE_VIEW_FLAG_SET (tree_view, GTK_TREE_VIEW_MODEL_SETUP))
{
- gtk_signal_disconnect_by_func (GTK_OBJECT (tree_view->priv->model),
- gtk_tree_view_changed,
- tree_view);
- gtk_signal_disconnect_by_func (GTK_OBJECT (tree_view->priv->model),
- gtk_tree_view_inserted,
- tree_view);
- gtk_signal_disconnect_by_func (GTK_OBJECT (tree_view->priv->model),
- gtk_tree_view_child_toggled,
- tree_view);
- gtk_signal_disconnect_by_func (GTK_OBJECT (tree_view->priv->model),
- gtk_tree_view_deleted,
- tree_view);
+ g_signal_handlers_disconnect_matched (G_OBJECT (tree_view->priv->model),
+ G_SIGNAL_MATCH_FUNC,
+ 0, 0, NULL,
+ gtk_tree_view_changed, NULL);
+ g_signal_handlers_disconnect_matched (G_OBJECT (tree_view->priv->model),
+ G_SIGNAL_MATCH_FUNC,
+ 0, 0, NULL,
+ gtk_tree_view_inserted, NULL);
+ g_signal_handlers_disconnect_matched (G_OBJECT (tree_view->priv->model),
+ G_SIGNAL_MATCH_FUNC,
+ 0, 0, NULL,
+ gtk_tree_view_child_toggled, NULL);
+ g_signal_handlers_disconnect_matched (G_OBJECT (tree_view->priv->model),
+ G_SIGNAL_MATCH_FUNC,
+ 0, 0, NULL,
+ gtk_tree_view_deleted, NULL);
_gtk_rbtree_free (tree_view->priv->tree);
}
-#if 0
- g_list_free (tree_view->priv->columns);
- tree_view->priv->columns = NULL;
-#endif
if (tree_view->priv->drag_dest_row)
gtk_tree_row_reference_free (tree_view->priv->drag_dest_row);
@@ -4014,15 +3897,7 @@ gtk_tree_view_append_column (GtkTreeView *tree_view,
g_return_val_if_fail (GTK_IS_TREE_VIEW_COLUMN (column), -1);
g_return_val_if_fail (column->tree_view == NULL, -1);
- g_object_ref (G_OBJECT (column));
- tree_view->priv->columns = g_list_append (tree_view->priv->columns, column);
- column->tree_view = GTK_WIDGET (tree_view);
-
- tree_view->priv->n_columns++;
-
- /* FIXME create header for the new column! */
-
- return tree_view->priv->n_columns;
+ return gtk_tree_view_insert_column (tree_view, column, -1);
}
@@ -4048,11 +3923,11 @@ gtk_tree_view_remove_column (GtkTreeView *tree_view,
tree_view->priv->columns = g_list_remove (tree_view->priv->columns,
column);
column->tree_view = NULL;
+ _gtk_tree_view_column_unset_tree_view (column);
+
g_object_unref (G_OBJECT (column));
tree_view->priv->n_columns--;
-
- /* FIXME destroy header for the column! */
return tree_view->priv->n_columns;
}
@@ -4063,7 +3938,8 @@ gtk_tree_view_remove_column (GtkTreeView *tree_view,
* @column: The #GtkTreeViewColumn to be inserted.
* @position: The position to insert @column in.
*
- * This inserts the @column into the @tree_view at @position.
+ * This inserts the @column into the @tree_view at @position. If @position is
+ * -1, then the column is inserted at the end.
*
* Return value: The number of columns in @tree_view after insertion.
**/
@@ -4081,17 +3957,72 @@ gtk_tree_view_insert_column (GtkTreeView *tree_view,
g_object_ref (G_OBJECT (column));
tree_view->priv->columns = g_list_insert (tree_view->priv->columns,
- column, position);
- column->tree_view = GTK_WIDGET (tree_view);
+ column, position);
+
+ _gtk_tree_view_column_set_tree_view (column, tree_view);
+
+ _gtk_tree_view_column_create_button (column);
tree_view->priv->n_columns++;
- /* FIXME create header for the column! */
return tree_view->priv->n_columns;
}
/**
+ * gtk_tree_view_insert_column_with_attributes:
+ * @tree_view: A #GtkTreeView
+ * @position: The position to insert the new column in.
+ * @title: The title to set the header to.
+ * @cell: The #GtkCellRenderer.
+ * @Varargs: A NULL terminated list of attributes.
+ *
+ * Creates a new #GtkTreeViewColumn and inserts it into the @tree_view at
+ * @position. If @position is -1, then the newly created column is inserted at
+ * the end. The column is initialized with the attributes given.
+ *
+ * Return value: The number of columns in @tree_view after insertion.
+ **/
+gint
+gtk_tree_view_insert_column_with_attributes (GtkTreeView *tree_view,
+ gint position,
+ gchar *title,
+ GtkCellRenderer *cell,
+ ...)
+{
+ GtkTreeViewColumn *column;
+ gchar *attribute;
+ va_list args;
+ gint column_id;
+
+ g_return_val_if_fail (tree_view != NULL, -1);
+ g_return_val_if_fail (GTK_IS_TREE_VIEW (tree_view), -1);
+
+ column = gtk_tree_view_column_new ();
+
+ gtk_tree_view_column_set_title (column, title);
+ gtk_tree_view_column_set_cell_renderer (column, cell);
+
+ va_start (args, cell);
+
+ attribute = va_arg (args, gchar *);
+
+ while (attribute != NULL)
+ {
+ column_id = va_arg (args, gint);
+ gtk_tree_view_column_add_attribute (column, attribute, column_id);
+ attribute = va_arg (args, gchar *);
+ }
+
+ va_end (args);
+
+ gtk_tree_view_insert_column (tree_view, column, position);
+ g_object_unref (column);
+
+ return tree_view->priv->n_columns;
+}
+
+/**
* gtk_tree_view_get_column:
* @tree_view: A #GtkTreeView.
* @n: The position of the column, counting from 0.
@@ -4420,13 +4351,6 @@ gtk_tree_view_get_background_xrange (GtkTreeView *tree_view,
}
}
-void
-_gtk_tree_view_column_set_tree_view (GtkTreeViewColumn *column,
- GtkTreeView *tree_view)
-{
- column->tree_view = tree_view;
-}
-
static void
gtk_tree_view_get_cell_xrange (GtkTreeView *tree_view,
GtkRBTree *tree,
diff --git a/gtk/gtktreeview.h b/gtk/gtktreeview.h
index cb23a4e906..49ae1a4a82 100644
--- a/gtk/gtktreeview.h
+++ b/gtk/gtktreeview.h
@@ -99,6 +99,12 @@ gint gtk_tree_view_remove_column (GtkTreeView *tr
gint gtk_tree_view_insert_column (GtkTreeView *tree_view,
GtkTreeViewColumn *column,
gint position);
+gint gtk_tree_view_insert_column_with_attributes (GtkTreeView *tree_view,
+ gint position,
+ gchar *title,
+ GtkCellRenderer *cell,
+ ...);
+
GtkTreeViewColumn *gtk_tree_view_get_column (GtkTreeView *tree_view,
gint n);
diff --git a/gtk/gtktreeviewcolumn.c b/gtk/gtktreeviewcolumn.c
index a6d38d4514..98d09986f6 100644
--- a/gtk/gtktreeviewcolumn.c
+++ b/gtk/gtktreeviewcolumn.c
@@ -18,6 +18,7 @@
*/
#include "gtktreeviewcolumn.h"
+#include "gtktreeview.h"
#include "gtktreeprivate.h"
#include "gtksignal.h"
#include "gtkbutton.h"
@@ -459,6 +460,141 @@ gtk_real_tree_column_clicked (GtkTreeViewColumn *tree_column)
}
+
+
+
+void
+_gtk_tree_view_column_create_button (GtkTreeViewColumn *column)
+{
+ GtkTreeView *tree_view;
+ GtkWidget *child;
+ GtkWidget *hbox;
+
+ tree_view = (GtkTreeView *) column->tree_view;
+
+ g_return_if_fail (tree_view != NULL);
+ g_return_if_fail (GTK_IS_TREE_VIEW (tree_view));
+ g_return_if_fail (column->button == NULL);
+
+ gtk_widget_push_composite_child ();
+ column->button = gtk_button_new ();
+ gtk_widget_pop_composite_child ();
+
+ /* make sure we own a reference to it as well. */
+ gtk_widget_set_parent (column->button, GTK_WIDGET (tree_view));
+
+ /* gtk_signal_connect (GTK_OBJECT (button), "clicked",
+ (GtkSignalFunc) gtk_tree_view_button_clicked,
+ (gpointer) tree_view);*/
+
+ column->alignment = gtk_alignment_new (column->xalign, 0.5, 0.0, 0.0);
+
+ hbox = gtk_hbox_new (FALSE, 2);
+ column->arrow = gtk_arrow_new (GTK_ARROW_DOWN, GTK_SHADOW_IN);
+
+ if (column->child)
+ child = column->child;
+ else
+ {
+ child = gtk_label_new (column->title);
+ gtk_widget_show (child);
+ }
+
+ if (column->xalign <= 0.5)
+ gtk_box_pack_end (GTK_BOX (hbox), column->arrow, FALSE, FALSE, 0);
+ else
+ gtk_box_pack_start (GTK_BOX (hbox), column->arrow, FALSE, FALSE, 0);
+
+ gtk_box_pack_start (GTK_BOX (hbox), column->alignment, TRUE, TRUE, 0);
+
+ gtk_container_add (GTK_CONTAINER (column->alignment), child);
+ gtk_container_add (GTK_CONTAINER (column->button), hbox);
+
+ if (column->visible)
+ gtk_widget_show (column->button);
+
+ gtk_widget_show (hbox);
+ gtk_widget_show (column->alignment);
+}
+
+void
+_gtk_tree_view_column_realize_button (GtkTreeViewColumn *column)
+{
+ GtkTreeView *tree_view;
+ GdkWindowAttr attr;
+ guint attributes_mask;
+
+ tree_view = (GtkTreeView *)column->tree_view;
+
+ g_return_if_fail (tree_view != NULL);
+ g_return_if_fail (GTK_IS_TREE_VIEW (tree_view));
+ g_return_if_fail (GTK_WIDGET_REALIZED (tree_view));
+ g_return_if_fail (tree_view->priv->header_window != NULL);
+ g_return_if_fail (column->button != NULL);
+
+ attr.window_type = GDK_WINDOW_CHILD;
+ attr.wclass = GDK_INPUT_ONLY;
+ attr.visual = gtk_widget_get_visual (GTK_WIDGET (tree_view));
+ attr.colormap = gtk_widget_get_colormap (GTK_WIDGET (tree_view));
+ attr.event_mask = gtk_widget_get_events (GTK_WIDGET (tree_view));
+ attr.event_mask = (GDK_BUTTON_PRESS_MASK |
+ GDK_BUTTON_RELEASE_MASK |
+ GDK_POINTER_MOTION_MASK |
+ GDK_POINTER_MOTION_HINT_MASK |
+ GDK_KEY_PRESS_MASK);
+ attributes_mask = GDK_WA_CURSOR | GDK_WA_X | GDK_WA_Y;
+ attr.cursor = gdk_cursor_new (GDK_SB_H_DOUBLE_ARROW);
+ tree_view->priv->cursor_drag = attr.cursor;
+
+ attr.y = 0;
+ attr.width = TREE_VIEW_DRAG_WIDTH;
+ attr.height = tree_view->priv->header_height;
+
+ gtk_widget_set_parent_window (column->button, tree_view->priv->header_window);
+
+ attr.x = (column->button->allocation.x + column->button->allocation.width) - 3;
+
+ column->window = gdk_window_new (tree_view->priv->header_window,
+ &attr, attributes_mask);
+ gdk_window_set_user_data (column->window, tree_view);
+}
+
+void
+_gtk_tree_view_column_unrealize_button (GtkTreeViewColumn *column)
+{
+ g_return_if_fail (column != NULL);
+ g_return_if_fail (column->window != NULL);
+
+ gdk_window_set_user_data (column->window, NULL);
+ gdk_window_destroy (column->window);
+ column->window = NULL;
+}
+
+void
+_gtk_tree_view_column_set_tree_view (GtkTreeViewColumn *column,
+ GtkTreeView *tree_view)
+{
+ column->tree_view = GTK_WIDGET (tree_view);
+}
+
+void
+_gtk_tree_view_column_unset_tree_view (GtkTreeViewColumn *column)
+{
+ if (column->tree_view && column->button)
+ {
+ gtk_container_remove (GTK_CONTAINER (column->tree_view), column->button);
+ g_print ("removing the button\n");
+ }
+
+ column->tree_view = NULL;
+ column->button = NULL;
+}
+
+
+
+/* Public Functions */
+
+
/**
* gtk_tree_view_column_new:
*
@@ -756,22 +892,25 @@ gtk_tree_view_column_set_visible (GtkTreeViewColumn *tree_column,
tree_column->visible = visible;
- if (visible)
- {
- gtk_widget_show (tree_column->button);
- if (GTK_WIDGET_REALIZED (tree_column->tree_view))
- gdk_window_show (tree_column->window);
- }
- else
+ if (tree_column->tree_view != NULL)
{
- gtk_widget_hide (tree_column->button);
+ if (visible)
+ {
+ gtk_widget_show (tree_column->button);
+ if (GTK_WIDGET_REALIZED (tree_column->tree_view))
+ gdk_window_show (tree_column->window);
+ }
+ else
+ {
+ gtk_widget_hide (tree_column->button);
+ if (GTK_WIDGET_REALIZED (tree_column->tree_view))
+ gdk_window_hide (tree_column->window);
+ }
+
if (GTK_WIDGET_REALIZED (tree_column->tree_view))
- gdk_window_hide (tree_column->window);
+ _gtk_tree_view_update_size (GTK_TREE_VIEW (tree_column->tree_view));
}
- if (GTK_WIDGET_REALIZED (tree_column->tree_view))
- _gtk_tree_view_update_size (GTK_TREE_VIEW (tree_column->tree_view));
-
g_object_notify (G_OBJECT (tree_column), "visible");
}
@@ -1424,3 +1563,4 @@ gtk_tree_view_column_get_sort_order (GtkTreeViewColumn *tree_column)
return tree_column->sort_order;
}
+
diff --git a/gtk/treestoretest.c b/gtk/treestoretest.c
index 1b2222f2b4..688054ba3b 100644
--- a/gtk/treestoretest.c
+++ b/gtk/treestoretest.c
@@ -273,10 +273,10 @@ make_window (gint view_type)
/* buttons */
button = gtk_button_new_with_label ("gtk_tree_store_remove");
gtk_box_pack_start (GTK_BOX (vbox), button, FALSE, FALSE, 0);
- gtk_signal_connect (GTK_OBJECT (selection),
- "selection_changed",
- selection_changed,
- button);
+ g_signal_connect (G_OBJECT (selection),
+ "selection_changed",
+ selection_changed,
+ button);
gtk_signal_connect (GTK_OBJECT (button), "clicked", iter_remove, tree_view);
gtk_widget_set_sensitive (button, FALSE);
@@ -293,19 +293,19 @@ make_window (gint view_type)
button = gtk_button_new_with_label ("gtk_tree_store_insert_before");
gtk_box_pack_start (GTK_BOX (vbox), button, FALSE, FALSE, 0);
gtk_signal_connect (GTK_OBJECT (button), "clicked", iter_insert_before, tree_view);
- gtk_signal_connect (GTK_OBJECT (selection),
- "selection_changed",
- selection_changed,
- button);
+ g_signal_connect (G_OBJECT (selection),
+ "selection_changed",
+ selection_changed,
+ button);
gtk_widget_set_sensitive (button, FALSE);
button = gtk_button_new_with_label ("gtk_tree_store_insert_after");
gtk_box_pack_start (GTK_BOX (vbox), button, FALSE, FALSE, 0);
gtk_signal_connect (GTK_OBJECT (button), "clicked", iter_insert_after, tree_view);
- gtk_signal_connect (GTK_OBJECT (selection),
- "selection_changed",
- selection_changed,
- button);
+ g_signal_connect (GTK_OBJECT (selection),
+ "selection_changed",
+ selection_changed,
+ button);
gtk_widget_set_sensitive (button, FALSE);
button = gtk_button_new_with_label ("gtk_tree_store_prepend");
diff --git a/tests/testtreecolumns.c b/tests/testtreecolumns.c
index 8be6e1bc61..6cd75c11fd 100644
--- a/tests/testtreecolumns.c
+++ b/tests/testtreecolumns.c
@@ -1,19 +1,26 @@
#include <gtk/gtk.h>
+
GtkWidget *left_tree_view;
-GtkWidget *right_tree_view;
+GtkWidget *top_right_tree_view;
+GtkWidget *bottom_right_tree_view;
GtkTreeModel *left_tree_model;
-GtkTreeModel *right_tree_model;
+GtkTreeModel *top_right_tree_model;
+GtkTreeModel *bottom_right_tree_model;
+GtkWidget *sample_tree_view_top;
+GtkWidget *sample_tree_view_bottom;
static void
add_clicked (GtkWidget *button, gpointer data)
{
GtkTreeIter iter;
GtkTreeViewColumn *column;
+ GtkCellRenderer *cell;
static gint i = 0;
-
gchar *label = g_strdup_printf ("Column %d", i);
- column = gtk_tree_view_column_new ();
+
+ cell = gtk_cell_renderer_text_new ();
+ column = gtk_tree_view_column_new_with_attributes (label, cell, "text", 0, NULL);
gtk_list_store_append (GTK_LIST_STORE (left_tree_model), &iter);
gtk_list_store_set (GTK_LIST_STORE (left_tree_model), &iter, 0, label, 1, column, -1);
g_free (label);
@@ -21,12 +28,71 @@ add_clicked (GtkWidget *button, gpointer data)
}
static void
+get_visible (GtkTreeViewColumn *tree_column,
+ GtkCellRenderer *cell,
+ GtkTreeModel *tree_model,
+ GtkTreeIter *iter,
+ gpointer data)
+{
+ GtkTreeViewColumn *column;
+
+ gtk_tree_model_get (tree_model, iter, 1, &column, -1);
+ if (column)
+ gtk_cell_renderer_toggle_set_active (GTK_CELL_RENDERER_TOGGLE (cell),
+ column->visible);
+}
+
+static void
+set_visible (GtkCellRendererToggle *cell,
+ gchar *path_str,
+ gpointer data)
+{
+ GtkTreeView *tree_view = (GtkTreeView *) data;
+ GtkTreeViewColumn *column;
+ GtkTreeModel *model;
+ GtkTreeIter iter;
+ GtkTreePath *path = gtk_tree_path_new_from_string (path_str);
+
+ model = gtk_tree_view_get_model (tree_view);
+
+ gtk_tree_model_get_iter (model, &iter, path);
+ gtk_tree_model_get (model, &iter, 1, &column, -1);
+
+ if (column)
+ {
+ gtk_tree_view_column_set_visible (column, ! gtk_tree_view_column_get_visible (column));
+ gtk_tree_model_changed (model, path, &iter);
+ }
+ gtk_tree_path_free (path);
+}
+
+static void
add_left_clicked (GtkWidget *button, gpointer data)
{
+ GtkTreeIter iter;
+ gchar *label;
+ GtkTreeViewColumn *column;
+
+ GtkTreeSelection *selection = gtk_tree_view_get_selection (GTK_TREE_VIEW (data));
+
+ gtk_tree_selection_get_selected (selection, NULL, &iter);
+ gtk_tree_model_get (gtk_tree_view_get_model (GTK_TREE_VIEW (data)),
+ &iter, 0, &label, 1, &column, -1);
+
+ if (GTK_WIDGET (data) == top_right_tree_view)
+ gtk_tree_view_remove_column (GTK_TREE_VIEW (sample_tree_view_top), column);
+ else
+ gtk_tree_view_remove_column (GTK_TREE_VIEW (sample_tree_view_bottom), column);
+
+ gtk_list_store_remove (GTK_LIST_STORE (gtk_tree_view_get_model (GTK_TREE_VIEW (data))), &iter);
+ gtk_list_store_append (GTK_LIST_STORE (left_tree_model), &iter);
+ gtk_list_store_set (GTK_LIST_STORE (left_tree_model), &iter, 0, label, 1, column, -1);
+ g_free (label);
}
+
static void
add_right_clicked (GtkWidget *button, gpointer data)
{
@@ -41,8 +107,13 @@ add_right_clicked (GtkWidget *button, gpointer data)
&iter, 0, &label, 1, &column, -1);
gtk_list_store_remove (GTK_LIST_STORE (left_tree_model), &iter);
- gtk_list_store_append (GTK_LIST_STORE (right_tree_model), &iter);
- gtk_list_store_set (GTK_LIST_STORE (right_tree_model), &iter, 0, label, 1, column, -1);
+ gtk_list_store_append (GTK_LIST_STORE (gtk_tree_view_get_model (GTK_TREE_VIEW (data))), &iter);
+ gtk_list_store_set (GTK_LIST_STORE (gtk_tree_view_get_model (GTK_TREE_VIEW (data))), &iter, 0, label, 1, column, -1);
+
+ if (GTK_WIDGET (data) == top_right_tree_view)
+ gtk_tree_view_append_column (GTK_TREE_VIEW (sample_tree_view_top), column);
+ else
+ gtk_tree_view_append_column (GTK_TREE_VIEW (sample_tree_view_bottom), column);
g_free (label);
}
@@ -59,14 +130,50 @@ int
main (int argc, char *argv[])
{
GtkWidget *window;
- GtkWidget *hbox, *vbox, *bbox;
+ GtkWidget *hbox, *vbox;
+ GtkWidget *vbox2, *bbox;
GtkWidget *button;
GtkTreeViewColumn *column;
GtkCellRenderer *cell;
GtkWidget *swindow;
+ GtkTreeModel *sample_model;
+ gint i;
gtk_init (&argc, &argv);
+ /* First initialize all the models for signal purposes */
+ left_tree_model = (GtkTreeModel *) gtk_list_store_new_with_types (2, G_TYPE_STRING, GTK_TYPE_POINTER);
+ top_right_tree_model = (GtkTreeModel *) gtk_list_store_new_with_types (2, G_TYPE_STRING, GTK_TYPE_POINTER);
+ bottom_right_tree_model = (GtkTreeModel *) gtk_list_store_new_with_types (2, G_TYPE_STRING, GTK_TYPE_POINTER);
+ top_right_tree_view = gtk_tree_view_new_with_model (top_right_tree_model);
+ bottom_right_tree_view = gtk_tree_view_new_with_model (bottom_right_tree_model);
+ sample_model = (GtkTreeModel *) gtk_list_store_new_with_types (1, G_TYPE_STRING);
+
+ for (i = 0; i < 10; i++)
+ {
+ GtkTreeIter iter;
+ gchar *string = g_strdup_printf ("%d", i);
+ gtk_list_store_append (GTK_LIST_STORE (sample_model), &iter);
+ gtk_list_store_set (GTK_LIST_STORE (sample_model), &iter, 0, string, -1);
+ g_free (string);
+ }
+
+ /* Set up the test windows. */
+ window = gtk_window_new (GTK_WINDOW_TOPLEVEL);
+ swindow = gtk_scrolled_window_new (NULL, NULL);
+ sample_tree_view_top = gtk_tree_view_new_with_model (sample_model);
+ gtk_container_add (GTK_CONTAINER (window), swindow);
+ gtk_container_add (GTK_CONTAINER (swindow), sample_tree_view_top);
+ gtk_widget_show_all (window);
+
+ window = gtk_window_new (GTK_WINDOW_TOPLEVEL);
+ swindow = gtk_scrolled_window_new (NULL, NULL);
+ sample_tree_view_bottom = gtk_tree_view_new_with_model (sample_model);
+ gtk_container_add (GTK_CONTAINER (window), swindow);
+ gtk_container_add (GTK_CONTAINER (swindow), sample_tree_view_bottom);
+ gtk_widget_show_all (window);
+
+ /* Set up the main window */
window = gtk_window_new (GTK_WINDOW_TOPLEVEL);
gtk_window_set_default_size (GTK_WINDOW (window), 500, 300);
vbox = gtk_vbox_new (FALSE, 8);
@@ -76,42 +183,89 @@ main (int argc, char *argv[])
hbox = gtk_hbox_new (FALSE, 8);
gtk_box_pack_start (GTK_BOX (vbox), hbox, TRUE, TRUE, 0);
+ /* Left Pane */
cell = gtk_cell_renderer_text_new ();
- g_object_set (G_OBJECT (cell), "foreground", "black", NULL);
- left_tree_model = (GtkTreeModel *) gtk_list_store_new_with_types (2, G_TYPE_STRING, GTK_TYPE_POINTER);
+
swindow = gtk_scrolled_window_new (NULL, NULL);
gtk_scrolled_window_set_policy (GTK_SCROLLED_WINDOW (swindow), GTK_POLICY_AUTOMATIC, GTK_POLICY_AUTOMATIC);
left_tree_view = gtk_tree_view_new_with_model (left_tree_model);
gtk_container_add (GTK_CONTAINER (swindow), left_tree_view);
- column = gtk_tree_view_column_new_with_attributes ("Unattached Columns", cell, "text", 0, NULL);
+ gtk_tree_view_insert_column_with_attributes (GTK_TREE_VIEW (left_tree_view), -1,
+ "Unattached Columns", cell, "text", 0, NULL);
+ cell = gtk_cell_renderer_toggle_new ();
+ g_signal_connect (G_OBJECT (cell), "toggled", set_visible, left_tree_view);
+ column = gtk_tree_view_column_new_with_attributes ("Visible", cell, NULL);
gtk_tree_view_append_column (GTK_TREE_VIEW (left_tree_view), column);
+ g_object_unref (G_OBJECT (column));
+ gtk_tree_view_column_set_cell_data_func (column, get_visible, NULL, NULL);
gtk_box_pack_start (GTK_BOX (hbox), swindow, TRUE, TRUE, 0);
+ /* Middle Pane */
+ vbox2 = gtk_vbox_new (FALSE, 8);
+ gtk_box_pack_start (GTK_BOX (hbox), vbox2, FALSE, FALSE, 0);
+
+ bbox = gtk_vbutton_box_new ();
+ gtk_button_box_set_layout (GTK_BUTTON_BOX (bbox), GTK_BUTTONBOX_SPREAD);
+ gtk_button_box_set_child_size (GTK_BUTTON_BOX (bbox), 0, 0);
+ gtk_box_pack_start (GTK_BOX (vbox2), bbox, TRUE, TRUE, 0);
+
+ button = gtk_button_new_with_label ("<<");
+ gtk_widget_set_sensitive (button, FALSE);
+ gtk_signal_connect (GTK_OBJECT (button), "clicked", GTK_SIGNAL_FUNC (add_left_clicked), top_right_tree_view);
+ gtk_signal_connect (GTK_OBJECT (gtk_tree_view_get_selection (GTK_TREE_VIEW (top_right_tree_view))),
+ "selection-changed", GTK_SIGNAL_FUNC (selection_changed), button);
+ gtk_box_pack_start (GTK_BOX (bbox), button, FALSE, FALSE, 0);
+
+ button = gtk_button_new_with_label (">>");
+ gtk_widget_set_sensitive (button, FALSE);
+ gtk_signal_connect (GTK_OBJECT (button), "clicked", GTK_SIGNAL_FUNC (add_right_clicked), top_right_tree_view);
+ gtk_signal_connect (GTK_OBJECT (gtk_tree_view_get_selection (GTK_TREE_VIEW (left_tree_view))),
+ "selection-changed", GTK_SIGNAL_FUNC (selection_changed), button);
+ gtk_box_pack_start (GTK_BOX (bbox), button, FALSE, FALSE, 0);
+
bbox = gtk_vbutton_box_new ();
gtk_button_box_set_layout (GTK_BUTTON_BOX (bbox), GTK_BUTTONBOX_SPREAD);
gtk_button_box_set_child_size (GTK_BUTTON_BOX (bbox), 0, 0);
- gtk_box_pack_start (GTK_BOX (hbox), bbox, FALSE, FALSE, 0);
+ gtk_box_pack_start (GTK_BOX (vbox2), bbox, TRUE, TRUE, 0);
button = gtk_button_new_with_label ("<<");
- gtk_signal_connect (GTK_OBJECT (button), "clicked", GTK_SIGNAL_FUNC (add_left_clicked), NULL);
+ gtk_widget_set_sensitive (button, FALSE);
+ gtk_signal_connect (GTK_OBJECT (button), "clicked", GTK_SIGNAL_FUNC (add_left_clicked), bottom_right_tree_view);
+ gtk_signal_connect (GTK_OBJECT (gtk_tree_view_get_selection (GTK_TREE_VIEW (bottom_right_tree_view))),
+ "selection-changed", GTK_SIGNAL_FUNC (selection_changed), button);
gtk_box_pack_start (GTK_BOX (bbox), button, FALSE, FALSE, 0);
button = gtk_button_new_with_label (">>");
gtk_widget_set_sensitive (button, FALSE);
- gtk_signal_connect (GTK_OBJECT (button), "clicked", GTK_SIGNAL_FUNC (add_right_clicked), NULL);
+ gtk_signal_connect (GTK_OBJECT (button), "clicked", GTK_SIGNAL_FUNC (add_right_clicked), bottom_right_tree_view);
gtk_signal_connect (GTK_OBJECT (gtk_tree_view_get_selection (GTK_TREE_VIEW (left_tree_view))),
"selection-changed", GTK_SIGNAL_FUNC (selection_changed), button);
gtk_box_pack_start (GTK_BOX (bbox), button, FALSE, FALSE, 0);
+
+ /* Right Pane */
+ vbox2 = gtk_vbox_new (FALSE, 8);
+ gtk_box_pack_start (GTK_BOX (hbox), vbox2, TRUE, TRUE, 0);
+
swindow = gtk_scrolled_window_new (NULL, NULL);
gtk_scrolled_window_set_policy (GTK_SCROLLED_WINDOW (swindow), GTK_POLICY_AUTOMATIC, GTK_POLICY_AUTOMATIC);
- right_tree_model = (GtkTreeModel *) gtk_list_store_new_with_types (2, G_TYPE_STRING, GTK_TYPE_POINTER);
- right_tree_view = gtk_tree_view_new_with_model (right_tree_model);
- column = gtk_tree_view_column_new_with_attributes ("Unattached Columns", cell, "text", 0, NULL);
- gtk_tree_view_append_column (GTK_TREE_VIEW (right_tree_view), column);
- gtk_container_add (GTK_CONTAINER (swindow), right_tree_view);
- gtk_box_pack_start (GTK_BOX (hbox), swindow, TRUE, TRUE, 0);
+ gtk_tree_view_set_headers_visible (GTK_TREE_VIEW (top_right_tree_view), FALSE);
+ cell = gtk_cell_renderer_text_new ();
+ gtk_tree_view_insert_column_with_attributes (GTK_TREE_VIEW (top_right_tree_view), -1,
+ NULL, cell, "text", 0, NULL);
+ gtk_container_add (GTK_CONTAINER (swindow), top_right_tree_view);
+ gtk_box_pack_start (GTK_BOX (vbox2), swindow, TRUE, TRUE, 0);
+
+ swindow = gtk_scrolled_window_new (NULL, NULL);
+ gtk_scrolled_window_set_policy (GTK_SCROLLED_WINDOW (swindow), GTK_POLICY_AUTOMATIC, GTK_POLICY_AUTOMATIC);
+ gtk_tree_view_set_headers_visible (GTK_TREE_VIEW (bottom_right_tree_view), FALSE);
+ cell = gtk_cell_renderer_text_new ();
+ gtk_tree_view_insert_column_with_attributes (GTK_TREE_VIEW (bottom_right_tree_view), -1,
+ NULL, cell, "text", 0, NULL);
+ gtk_container_add (GTK_CONTAINER (swindow), bottom_right_tree_view);
+ gtk_box_pack_start (GTK_BOX (vbox2), swindow, TRUE, TRUE, 0);
+
gtk_box_pack_start (GTK_BOX (vbox), gtk_hseparator_new (), FALSE, FALSE, 0);
hbox = gtk_hbox_new (FALSE, 8);
diff --git a/tests/treestoretest.c b/tests/treestoretest.c
index 1b2222f2b4..688054ba3b 100644
--- a/tests/treestoretest.c
+++ b/tests/treestoretest.c
@@ -273,10 +273,10 @@ make_window (gint view_type)
/* buttons */
button = gtk_button_new_with_label ("gtk_tree_store_remove");
gtk_box_pack_start (GTK_BOX (vbox), button, FALSE, FALSE, 0);
- gtk_signal_connect (GTK_OBJECT (selection),
- "selection_changed",
- selection_changed,
- button);
+ g_signal_connect (G_OBJECT (selection),
+ "selection_changed",
+ selection_changed,
+ button);
gtk_signal_connect (GTK_OBJECT (button), "clicked", iter_remove, tree_view);
gtk_widget_set_sensitive (button, FALSE);
@@ -293,19 +293,19 @@ make_window (gint view_type)
button = gtk_button_new_with_label ("gtk_tree_store_insert_before");
gtk_box_pack_start (GTK_BOX (vbox), button, FALSE, FALSE, 0);
gtk_signal_connect (GTK_OBJECT (button), "clicked", iter_insert_before, tree_view);
- gtk_signal_connect (GTK_OBJECT (selection),
- "selection_changed",
- selection_changed,
- button);
+ g_signal_connect (G_OBJECT (selection),
+ "selection_changed",
+ selection_changed,
+ button);
gtk_widget_set_sensitive (button, FALSE);
button = gtk_button_new_with_label ("gtk_tree_store_insert_after");
gtk_box_pack_start (GTK_BOX (vbox), button, FALSE, FALSE, 0);
gtk_signal_connect (GTK_OBJECT (button), "clicked", iter_insert_after, tree_view);
- gtk_signal_connect (GTK_OBJECT (selection),
- "selection_changed",
- selection_changed,
- button);
+ g_signal_connect (GTK_OBJECT (selection),
+ "selection_changed",
+ selection_changed,
+ button);
gtk_widget_set_sensitive (button, FALSE);
button = gtk_button_new_with_label ("gtk_tree_store_prepend");