[gtk+/treeview-refactor-staging] Removed all variables from GtkTreeViewColumn and created GtkTreeViewColumnPrivate
- From: Tristan Van Berkom <tvb src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [gtk+/treeview-refactor-staging] Removed all variables from GtkTreeViewColumn and created GtkTreeViewColumnPrivate
- Date: Tue, 30 Nov 2010 05:26:27 +0000 (UTC)
commit ab876dc317322775e521a6a59349538491b5d2a5
Author: Tristan Van Berkom <tristan van berkom gmail com>
Date: Tue Nov 30 14:29:45 2010 +0900
Removed all variables from GtkTreeViewColumn and created GtkTreeViewColumnPrivate
Some details:
- button_request was not needed, consult the minimum request of the button
- gtk_tree_view_column_get_button() needed to be public as people can set
tooltips on the button (and libgail accesses the button).
gtk/gtktreeprivate.h | 48 ++-
gtk/gtktreeview.c | 371 +++++++++-----
gtk/gtktreeviewcolumn.c | 1028 +++++++++++++++++++++++--------------
gtk/gtktreeviewcolumn.h | 57 +--
modules/other/gail/gailtreeview.c | 2 +-
tests/testtooltips.c | 2 +-
6 files changed, 924 insertions(+), 584 deletions(-)
---
diff --git a/gtk/gtktreeprivate.h b/gtk/gtktreeprivate.h
index 8e11e18..1a5f9b3 100644
--- a/gtk/gtktreeprivate.h
+++ b/gtk/gtktreeprivate.h
@@ -414,6 +414,20 @@ void _gtk_tree_view_remove_editable (GtkTreeView *tree_v
GtkTreeViewColumn *column,
GtkCellEditable *cell_editable);
+void _gtk_tree_view_install_mark_rows_col_dirty (GtkTreeView *tree_view);
+void _gtk_tree_view_column_autosize (GtkTreeView *tree_view,
+ GtkTreeViewColumn *column);
+
+
+GtkTreeSelection* _gtk_tree_selection_new (void);
+GtkTreeSelection* _gtk_tree_selection_new_with_tree_view (GtkTreeView *tree_view);
+void _gtk_tree_selection_set_tree_view (GtkTreeSelection *selection,
+ GtkTreeView *tree_view);
+gboolean _gtk_tree_selection_row_is_selectable (GtkTreeSelection *selection,
+ GtkRBNode *node,
+ GtkTreePath *path);
+
+
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,
@@ -434,22 +448,10 @@ gboolean _gtk_tree_view_column_cell_event (GtkTreeViewColumn *tree_column,
const GdkRectangle *background_area,
const GdkRectangle *cell_area,
guint flags);
-void _gtk_tree_view_install_mark_rows_col_dirty (GtkTreeView *tree_view);
-void _gtk_tree_view_column_autosize (GtkTreeView *tree_view,
- GtkTreeViewColumn *column);
-
-gboolean _gtk_tree_view_column_has_editable_cell (GtkTreeViewColumn *column);
-GtkCellRenderer *_gtk_tree_view_column_get_edited_cell (GtkTreeViewColumn *column);
-GtkCellRenderer *_gtk_tree_view_column_get_cell_at_pos (GtkTreeViewColumn *column,
- gint x);
-
-GtkTreeSelection* _gtk_tree_selection_new (void);
-GtkTreeSelection* _gtk_tree_selection_new_with_tree_view (GtkTreeView *tree_view);
-void _gtk_tree_selection_set_tree_view (GtkTreeSelection *selection,
- GtkTreeView *tree_view);
-gboolean _gtk_tree_selection_row_is_selectable (GtkTreeSelection *selection,
- GtkRBNode *node,
- GtkTreePath *path);
+gboolean _gtk_tree_view_column_has_editable_cell(GtkTreeViewColumn *column);
+GtkCellRenderer *_gtk_tree_view_column_get_edited_cell (GtkTreeViewColumn *column);
+GtkCellRenderer *_gtk_tree_view_column_get_cell_at_pos (GtkTreeViewColumn *column,
+ gint x);
void _gtk_tree_view_column_cell_render (GtkTreeViewColumn *tree_column,
cairo_t *cr,
@@ -467,6 +469,20 @@ gboolean _gtk_tree_view_column_cell_focus (GtkTreeViewColumn *tree_colu
gboolean right);
void _gtk_tree_view_column_cell_set_dirty (GtkTreeViewColumn *tree_column,
gboolean install_handler);
+gboolean _gtk_tree_view_column_cell_get_dirty (GtkTreeViewColumn *tree_column);
+GdkWindow *_gtk_tree_view_column_get_window (GtkTreeViewColumn *column);
+
+void _gtk_tree_view_column_set_requested_width (GtkTreeViewColumn *column,
+ gint width);
+gint _gtk_tree_view_column_get_requested_width (GtkTreeViewColumn *column);
+void _gtk_tree_view_column_set_resized_width (GtkTreeViewColumn *column,
+ gint width);
+gint _gtk_tree_view_column_get_resized_width (GtkTreeViewColumn *column);
+void _gtk_tree_view_column_set_use_resized_width (GtkTreeViewColumn *column,
+ gboolean use_resized_width);
+gboolean _gtk_tree_view_column_get_use_resized_width (GtkTreeViewColumn *column);
+gint _gtk_tree_view_column_get_drag_x (GtkTreeViewColumn *column);
+GtkCellAreaContext *_gtk_tree_view_column_get_context (GtkTreeViewColumn *column);
G_END_DECLS
diff --git a/gtk/gtktreeview.c b/gtk/gtktreeview.c
index 84948aa..a8b1790 100644
--- a/gtk/gtktreeview.c
+++ b/gtk/gtktreeview.c
@@ -45,6 +45,7 @@
#include "gtktreemodelsort.h"
#include "gtktooltip.h"
#include "gtkscrollable.h"
+#include "gtkcelllayout.h"
#include "gtkprivate.h"
#include "gtkwidgetprivate.h"
#include "gtkentryprivate.h"
@@ -1786,26 +1787,32 @@ gtk_tree_view_map_buttons (GtkTreeView *tree_view)
if (GTK_TREE_VIEW_FLAG_SET (tree_view, GTK_TREE_VIEW_HEADERS_VISIBLE))
{
GtkTreeViewColumn *column;
+ GtkWidget *button;
+ GdkWindow *window;
for (list = tree_view->priv->columns; list; list = list->next)
{
column = list->data;
- if (gtk_widget_get_visible (column->button) &&
- !gtk_widget_get_mapped (column->button))
- gtk_widget_map (column->button);
+ button = gtk_tree_view_column_get_button (column);
+
+ if (gtk_widget_get_visible (button) &&
+ !gtk_widget_get_mapped (button))
+ gtk_widget_map (button);
}
for (list = tree_view->priv->columns; list; list = list->next)
{
column = list->data;
if (gtk_tree_view_column_get_visible (column) == FALSE)
continue;
+
+ window = _gtk_tree_view_column_get_window (column);
if (gtk_tree_view_column_get_resizable (column))
{
- gdk_window_raise (column->window);
- gdk_window_show (column->window);
+ gdk_window_raise (window);
+ gdk_window_show (window);
}
else
- gdk_window_hide (column->window);
+ gdk_window_hide (window);
}
gdk_window_show (tree_view->priv->header_window);
}
@@ -2028,16 +2035,16 @@ gtk_tree_view_size_request_columns (GtkTreeView *tree_view)
{
for (list = tree_view->priv->columns; list; list = list->next)
{
- GtkRequisition requisition;
+ GtkRequisition requisition;
GtkTreeViewColumn *column = list->data;
+ GtkWidget *button = gtk_tree_view_column_get_button (column);
- if (column->button == NULL)
+ if (button == NULL)
continue;
column = list->data;
- gtk_widget_get_preferred_size (column->button, &requisition, NULL);
- column->button_request = requisition.width;
+ gtk_widget_get_preferred_size (button, &requisition, NULL);
tree_view->priv->header_height = MAX (tree_view->priv->header_height, requisition.height);
}
}
@@ -2073,9 +2080,9 @@ gtk_tree_view_update_size (GtkTreeView *tree_view)
if (!gtk_tree_view_column_get_visible (column))
continue;
- if (column->use_resized_width)
+ if (_gtk_tree_view_column_get_use_resized_width (column))
{
- real_requested_width = column->resized_width;
+ real_requested_width = _gtk_tree_view_column_get_resized_width (column);
}
else if (gtk_tree_view_column_get_sizing (column) == GTK_TREE_VIEW_COLUMN_FIXED)
{
@@ -2083,11 +2090,16 @@ gtk_tree_view_update_size (GtkTreeView *tree_view)
}
else if (GTK_TREE_VIEW_FLAG_SET (tree_view, GTK_TREE_VIEW_HEADERS_VISIBLE))
{
- real_requested_width = MAX (column->requested_width, column->button_request);
+ GtkWidget *button = gtk_tree_view_column_get_button (column);
+ gint button_request;
+
+ gtk_widget_get_preferred_width (button, &button_request, NULL);
+
+ real_requested_width = MAX (_gtk_tree_view_column_get_requested_width (column), button_request);
}
else
{
- real_requested_width = column->requested_width;
+ real_requested_width = _gtk_tree_view_column_get_requested_width (column);
}
min_width = gtk_tree_view_column_get_min_width (column);
@@ -2235,9 +2247,9 @@ gtk_tree_view_get_real_requested_width_from_column (GtkTreeView *tree_view
gint max_width, min_width;
gint real_requested_width;
- if (column->use_resized_width)
+ if (_gtk_tree_view_column_get_use_resized_width (column))
{
- real_requested_width = column->resized_width;
+ real_requested_width = _gtk_tree_view_column_get_resized_width (column);
}
else if (gtk_tree_view_column_get_sizing (column) == GTK_TREE_VIEW_COLUMN_FIXED)
{
@@ -2245,11 +2257,16 @@ gtk_tree_view_get_real_requested_width_from_column (GtkTreeView *tree_view
}
else if (GTK_TREE_VIEW_FLAG_SET (tree_view, GTK_TREE_VIEW_HEADERS_VISIBLE))
{
- real_requested_width = MAX (column->requested_width, column->button_request);
+ GtkWidget *button = gtk_tree_view_column_get_button (column);
+ gint button_request;
+
+ gtk_widget_get_preferred_width (button, &button_request, NULL);
+
+ real_requested_width = MAX (_gtk_tree_view_column_get_requested_width (column), button_request);
}
else
{
- real_requested_width = column->requested_width;
+ real_requested_width = _gtk_tree_view_column_get_requested_width (column);
if (real_requested_width < 0)
real_requested_width = 0;
}
@@ -2359,6 +2376,8 @@ gtk_tree_view_size_allocate_columns (GtkWidget *widget,
list != (rtl ? first_column->prev : last_column->next);
list = (rtl ? list->prev : list->next))
{
+ GtkWidget *button;
+ GdkWindow *window;
gint real_requested_width = 0;
gint internal_column_width = 0;
gint old_width, column_width;
@@ -2374,13 +2393,15 @@ gtk_tree_view_size_allocate_columns (GtkWidget *widget,
if (column == tree_view->priv->drag_column)
{
GtkAllocation drag_allocation;
+ GtkWidget *button;
+
+ button = gtk_tree_view_column_get_button (tree_view->priv->drag_column);
drag_allocation.x = 0;
drag_allocation.y = 0;
drag_allocation.width = gdk_window_get_width (tree_view->priv->drag_window);
drag_allocation.height = gdk_window_get_height (tree_view->priv->drag_window);
- gtk_widget_size_allocate (tree_view->priv->drag_column->button,
- &drag_allocation);
+ gtk_widget_size_allocate (button, &drag_allocation);
width += drag_allocation.width;
continue;
}
@@ -2430,10 +2451,13 @@ gtk_tree_view_size_allocate_columns (GtkWidget *widget,
if (column_width > old_width)
column_changed = TRUE;
- gtk_widget_size_allocate (column->button, &allocation);
+ button = gtk_tree_view_column_get_button (column);
+ window = _gtk_tree_view_column_get_window (column);
+
+ gtk_widget_size_allocate (button, &allocation);
- if (column->window)
- gdk_window_move_resize (column->window,
+ if (window)
+ gdk_window_move_resize (window,
allocation.x + (rtl ? 0 : allocation.width) - TREE_VIEW_DRAG_WIDTH/2,
allocation.y,
TREE_VIEW_DRAG_WIDTH, allocation.height);
@@ -2773,7 +2797,7 @@ gtk_tree_view_button_press (GtkWidget *widget,
if (!gtk_tree_view_column_get_visible (candidate))
continue;
- background_area.width = candidate->width;
+ background_area.width = gtk_tree_view_column_get_width (candidate);
if ((background_area.x > (gint) event->x) ||
(background_area.x + background_area.width <= (gint) event->x))
{
@@ -2847,7 +2871,8 @@ gtk_tree_view_button_press (GtkWidget *widget,
&background_area,
&cell_area, flags))
{
- cell_editable = gtk_cell_area_get_edit_widget (column->cell_area);
+ GtkCellArea *area = gtk_cell_layout_get_area (GTK_CELL_LAYOUT (column));
+ cell_editable = gtk_cell_area_get_edit_widget (area);
if (cell_editable != NULL)
{
@@ -2990,22 +3015,23 @@ gtk_tree_view_button_press (GtkWidget *widget,
for (i = 0, list = tree_view->priv->columns; list; list = list->next, i++)
{
column = list->data;
- if (event->window == column->window &&
+ if (event->window == _gtk_tree_view_column_get_window (column) &&
gtk_tree_view_column_get_resizable (column) &&
- column->window)
+ _gtk_tree_view_column_get_window (column))
{
+ GtkWidget *button;
GtkAllocation button_allocation;
gpointer drag_data;
if (event->type == GDK_2BUTTON_PRESS &&
gtk_tree_view_column_get_sizing (column) != GTK_TREE_VIEW_COLUMN_AUTOSIZE)
{
- column->use_resized_width = FALSE;
+ _gtk_tree_view_column_set_use_resized_width (column, FALSE);
_gtk_tree_view_column_autosize (tree_view, column);
return TRUE;
}
- if (gdk_pointer_grab (column->window, FALSE,
+ if (gdk_pointer_grab (_gtk_tree_view_column_get_window (column), FALSE,
GDK_POINTER_MOTION_HINT_MASK |
GDK_BUTTON1_MOTION_MASK |
GDK_BUTTON_RELEASE_MASK,
@@ -3014,8 +3040,9 @@ gtk_tree_view_button_press (GtkWidget *widget,
gtk_grab_add (widget);
GTK_TREE_VIEW_SET_FLAG (tree_view, GTK_TREE_VIEW_IN_COLUMN_RESIZE);
- column->resized_width = gtk_tree_view_column_get_width (column) -
- tree_view->priv->last_extra_space_per_column;
+
+ _gtk_tree_view_column_set_resized_width (column, gtk_tree_view_column_get_width (column) -
+ tree_view->priv->last_extra_space_per_column);
/* block attached dnd signal handler */
drag_data = g_object_get_data (G_OBJECT (widget), "gtk-site-data");
@@ -3025,7 +3052,8 @@ gtk_tree_view_button_press (GtkWidget *widget,
0, 0, NULL, NULL,
drag_data);
- gtk_widget_get_allocation (column->button, &button_allocation);
+ button = gtk_tree_view_column_get_button (column);
+ gtk_widget_get_allocation (button, &button_allocation);
tree_view->priv->drag_pos = i;
tree_view->priv->x_drag = button_allocation.x + (rtl ? 0 : button_allocation.width);
@@ -3044,6 +3072,7 @@ gtk_tree_view_button_release_drag_column (GtkWidget *widget,
GdkEventButton *event)
{
GtkTreeView *tree_view;
+ GtkWidget *button;
GList *l;
gboolean rtl;
@@ -3054,21 +3083,22 @@ gtk_tree_view_button_release_drag_column (GtkWidget *widget,
gdk_display_keyboard_ungrab (gtk_widget_get_display (widget), GDK_CURRENT_TIME);
/* Move the button back */
- g_object_ref (tree_view->priv->drag_column->button);
- gtk_container_remove (GTK_CONTAINER (tree_view), tree_view->priv->drag_column->button);
- gtk_widget_set_parent_window (tree_view->priv->drag_column->button, tree_view->priv->header_window);
- gtk_widget_set_parent (tree_view->priv->drag_column->button, GTK_WIDGET (tree_view));
- g_object_unref (tree_view->priv->drag_column->button);
+ button = gtk_tree_view_column_get_button (tree_view->priv->drag_column);
+ g_object_ref (button);
+ gtk_container_remove (GTK_CONTAINER (tree_view), button);
+ gtk_widget_set_parent_window (button, tree_view->priv->header_window);
+ gtk_widget_set_parent (button, GTK_WIDGET (tree_view));
+ g_object_unref (button);
gtk_widget_queue_resize (widget);
if (gtk_tree_view_column_get_resizable (tree_view->priv->drag_column))
{
- gdk_window_raise (tree_view->priv->drag_column->window);
- gdk_window_show (tree_view->priv->drag_column->window);
+ gdk_window_raise (_gtk_tree_view_column_get_window (tree_view->priv->drag_column));
+ gdk_window_show (_gtk_tree_view_column_get_window (tree_view->priv->drag_column));
}
else
- gdk_window_hide (tree_view->priv->drag_column->window);
+ gdk_window_hide (_gtk_tree_view_column_get_window (tree_view->priv->drag_column));
- gtk_widget_grab_focus (tree_view->priv->drag_column->button);
+ gtk_widget_grab_focus (button);
if (rtl)
{
@@ -3387,7 +3417,8 @@ prelight_or_select (GtkTreeView *tree_view,
if (tree_view->priv->hover_selection &&
(mode == GTK_SELECTION_SINGLE || mode == GTK_SELECTION_BROWSE) &&
!(tree_view->priv->edited_column &&
- gtk_cell_area_get_edit_widget (tree_view->priv->edited_column->cell_area)))
+ gtk_cell_area_get_edit_widget
+ (gtk_cell_layout_get_area (GTK_CELL_LAYOUT (tree_view->priv->edited_column)))))
{
if (node)
{
@@ -3502,16 +3533,19 @@ gtk_tree_view_motion_draw_column_motion_arrow (GtkTreeView *tree_view)
{
GtkAllocation left_allocation, right_allocation;
GdkRectangle visible_rect;
+ GtkWidget *button;
gtk_tree_view_get_visible_rect (tree_view, &visible_rect);
if (reorder->left_column)
{
- gtk_widget_get_allocation (reorder->left_column->button, &left_allocation);
+ button = gtk_tree_view_column_get_button (reorder->left_column);
+ gtk_widget_get_allocation (button, &left_allocation);
x = left_allocation.x + left_allocation.width;
}
else
{
- gtk_widget_get_allocation (reorder->right_column->button, &right_allocation);
+ button = gtk_tree_view_column_get_button (reorder->right_column);
+ gtk_widget_get_allocation (button, &right_allocation);
x = right_allocation.x;
}
@@ -3529,6 +3563,7 @@ gtk_tree_view_motion_draw_column_motion_arrow (GtkTreeView *tree_view)
if (tree_view->priv->drag_column_window_state != DRAG_COLUMN_WINDOW_STATE_ORIGINAL)
{
GtkAllocation drag_allocation;
+ GtkWidget *button;
if (tree_view->priv->drag_highlight_window)
{
@@ -3537,11 +3572,12 @@ gtk_tree_view_motion_draw_column_motion_arrow (GtkTreeView *tree_view)
gdk_window_destroy (tree_view->priv->drag_highlight_window);
}
+ button = gtk_tree_view_column_get_button (tree_view->priv->drag_column);
attributes.window_type = GDK_WINDOW_CHILD;
attributes.wclass = GDK_INPUT_OUTPUT;
attributes.x = tree_view->priv->drag_column_x;
attributes.y = 0;
- gtk_widget_get_allocation (tree_view->priv->drag_column->button, &drag_allocation);
+ gtk_widget_get_allocation (button, &drag_allocation);
width = attributes.width = drag_allocation.width;
height = attributes.height = drag_allocation.height;
attributes.visual = gtk_widget_get_visual (GTK_WIDGET (tree_view));
@@ -3570,6 +3606,7 @@ gtk_tree_view_motion_draw_column_motion_arrow (GtkTreeView *tree_view)
else if (arrow_type == DRAG_COLUMN_WINDOW_STATE_ARROW)
{
GtkAllocation button_allocation;
+ GtkWidget *button;
width = tree_view->priv->expander_size;
@@ -3577,13 +3614,15 @@ gtk_tree_view_motion_draw_column_motion_arrow (GtkTreeView *tree_view)
gdk_window_get_origin (tree_view->priv->header_window, &x, &y);
if (reorder->left_column)
{
- gtk_widget_get_allocation (reorder->left_column->button, &button_allocation);
+ button = gtk_tree_view_column_get_button (reorder->left_column);
+ gtk_widget_get_allocation (button, &button_allocation);
x += button_allocation.x + button_allocation.width - width/2;
height = button_allocation.height;
}
else
{
- gtk_widget_get_allocation (reorder->right_column->button, &button_allocation);
+ button = gtk_tree_view_column_get_button (reorder->right_column);
+ gtk_widget_get_allocation (button, &button_allocation);
x += button_allocation.x - width/2;
height = button_allocation.height;
}
@@ -3640,6 +3679,7 @@ gtk_tree_view_motion_draw_column_motion_arrow (GtkTreeView *tree_view)
arrow_type == DRAG_COLUMN_WINDOW_STATE_ARROW_RIGHT)
{
GtkAllocation allocation;
+ GtkWidget *button;
width = tree_view->priv->expander_size;
@@ -3655,12 +3695,14 @@ gtk_tree_view_motion_draw_column_motion_arrow (GtkTreeView *tree_view)
if (reorder->left_column)
{
- gtk_widget_get_allocation (reorder->left_column->button, &allocation);
+ button = gtk_tree_view_column_get_button (reorder->left_column);
+ gtk_widget_get_allocation (button, &allocation);
height = allocation.height;
}
else
{
- gtk_widget_get_allocation (reorder->right_column->button, &allocation);
+ button = gtk_tree_view_column_get_button (reorder->right_column);
+ gtk_widget_get_allocation (button, &allocation);
height = allocation.height;
}
@@ -3754,10 +3796,14 @@ gtk_tree_view_motion_resize_column (GtkWidget *widget,
if (x != tree_view->priv->x_drag &&
(new_width != gtk_tree_view_column_get_fixed_width (column)))
{
- column->use_resized_width = TRUE;
- column->resized_width = new_width;
+ _gtk_tree_view_column_set_use_resized_width (column, TRUE);
+
if (gtk_tree_view_column_get_expand (column))
- column->resized_width -= tree_view->priv->last_extra_space_per_column;
+ new_width -= tree_view->priv->last_extra_space_per_column;
+
+ _gtk_tree_view_column_set_resized_width (column, new_width);
+
+
gtk_widget_queue_resize (widget);
}
@@ -3848,6 +3894,7 @@ gtk_tree_view_motion_drag_column (GtkWidget *widget,
GtkAllocation allocation, button_allocation;
GtkTreeView *tree_view = (GtkTreeView *) widget;
GtkTreeViewColumn *column = tree_view->priv->drag_column;
+ GtkWidget *button;
gint x, y;
/* Sanity Check */
@@ -3855,11 +3902,13 @@ gtk_tree_view_motion_drag_column (GtkWidget *widget,
(event->window != tree_view->priv->drag_window))
return FALSE;
+ button = gtk_tree_view_column_get_button (column);
+
/* Handle moving the header */
gdk_window_get_position (tree_view->priv->drag_window, &x, &y);
gtk_widget_get_allocation (widget, &allocation);
- gtk_widget_get_allocation (column->button, &button_allocation);
- x = CLAMP (x + (gint)event->x - column->drag_x, 0,
+ gtk_widget_get_allocation (button, &button_allocation);
+ x = CLAMP (x + (gint)event->x - _gtk_tree_view_column_get_drag_x (column), 0,
MAX (tree_view->priv->width, allocation.width) - button_allocation.width);
gdk_window_move (tree_view->priv->drag_window, x, y);
@@ -5113,6 +5162,7 @@ gtk_tree_view_draw (GtkWidget *widget,
cairo_t *cr)
{
GtkTreeView *tree_view = GTK_TREE_VIEW (widget);
+ GtkWidget *button;
if (gtk_cairo_should_draw_window (cr, tree_view->priv->bin_window))
{
@@ -5152,18 +5202,20 @@ gtk_tree_view_draw (GtkWidget *widget,
continue;
if (gtk_tree_view_column_get_visible (column))
- gtk_container_propagate_draw (GTK_CONTAINER (tree_view),
- column->button,
- cr);
+ {
+ button = gtk_tree_view_column_get_button (column);
+ gtk_container_propagate_draw (GTK_CONTAINER (tree_view),
+ button, cr);
+ }
}
}
if (tree_view->priv->drag_window &&
gtk_cairo_should_draw_window (cr, tree_view->priv->drag_window))
{
+ button = gtk_tree_view_column_get_button (tree_view->priv->drag_column);
gtk_container_propagate_draw (GTK_CONTAINER (tree_view),
- tree_view->priv->drag_column->button,
- cr);
+ button, cr);
}
return TRUE;
@@ -5388,6 +5440,7 @@ gtk_tree_view_key_press (GtkWidget *widget,
GdkEventKey *event)
{
GtkTreeView *tree_view = (GtkTreeView *) widget;
+ GtkWidget *button;
if (tree_view->priv->rubber_band_status)
{
@@ -5419,8 +5472,9 @@ gtk_tree_view_key_press (GtkWidget *widget,
focus_column = focus_column->next)
{
GtkTreeViewColumn *column = GTK_TREE_VIEW_COLUMN (focus_column->data);
-
- if (gtk_widget_has_focus (column->button))
+
+ button = gtk_tree_view_column_get_button (column);
+ if (gtk_widget_has_focus (button))
break;
}
@@ -5442,54 +5496,62 @@ gtk_tree_view_key_press (GtkWidget *widget,
|| event->keyval == (rtl ? GDK_KEY_KP_Right : GDK_KEY_KP_Left))
{
GtkRequisition button_req;
- gint old_width = column->resized_width;
+ gint old_width = _gtk_tree_view_column_get_resized_width (column);
+ gint new_width;
+
+ button = gtk_tree_view_column_get_button (column);
- gtk_widget_get_preferred_size (column->button, &button_req, NULL);
+ gtk_widget_get_preferred_size (button, &button_req, NULL);
- column->resized_width = MAX (column->resized_width,
- gtk_tree_view_column_get_width (column));
- column->resized_width -= 2;
- if (column->resized_width < 0)
- column->resized_width = 0;
+ new_width = MAX (old_width, gtk_tree_view_column_get_width (column));
+ new_width -= 2;
+ if (new_width < 0)
+ new_width = 0;
+
+ _gtk_tree_view_column_set_resized_width (column, new_width);
min_width = gtk_tree_view_column_get_min_width (column);
if (min_width == -1)
- column->resized_width = MAX (button_req.width,
- column->resized_width);
+ new_width = MAX (button_req.width, new_width);
else
{
- column->resized_width = MAX (min_width,
- column->resized_width);
+ new_width = MAX (min_width, new_width);
}
max_width = gtk_tree_view_column_get_max_width (column);
if (max_width != -1)
- column->resized_width = MIN (column->resized_width, max_width);
+ new_width = MIN (new_width, max_width);
- column->use_resized_width = TRUE;
+ _gtk_tree_view_column_set_use_resized_width (column, TRUE);
- if (column->resized_width != old_width)
- gtk_widget_queue_resize (widget);
+ if (new_width != old_width)
+ {
+ _gtk_tree_view_column_set_resized_width (column, new_width);
+ gtk_widget_queue_resize (widget);
+ }
else
gtk_widget_error_bell (widget);
}
else if (event->keyval == (rtl ? GDK_KEY_Left : GDK_KEY_Right)
|| event->keyval == (rtl ? GDK_KEY_KP_Left : GDK_KEY_KP_Right))
{
- gint old_width = column->resized_width;
+ gint old_width = _gtk_tree_view_column_get_resized_width (column);
+ gint new_width;
- column->resized_width = MAX (column->resized_width,
- gtk_tree_view_column_get_width (column));
- column->resized_width += 2;
+ new_width = MAX (old_width, gtk_tree_view_column_get_width (column));
+ new_width += 2;
max_width = gtk_tree_view_column_get_max_width (column);
if (max_width != -1)
- column->resized_width = MIN (column->resized_width, max_width);
+ new_width = MIN (new_width, max_width);
- column->use_resized_width = TRUE;
+ _gtk_tree_view_column_set_use_resized_width (column, TRUE);
- if (column->resized_width != old_width)
- gtk_widget_queue_resize (widget);
+ if (new_width != old_width)
+ {
+ _gtk_tree_view_column_set_resized_width (column, new_width);
+ gtk_widget_queue_resize (widget);
+ }
else
gtk_widget_error_bell (widget);
}
@@ -5839,7 +5901,8 @@ validate_row (GtkTreeView *tree_view,
if (!gtk_tree_view_column_get_visible (column))
continue;
- if (GTK_RBNODE_FLAG_SET (node, GTK_RBNODE_COLUMN_INVALID) && !column->dirty)
+ if (GTK_RBNODE_FLAG_SET (node, GTK_RBNODE_COLUMN_INVALID) &&
+ !_gtk_tree_view_column_cell_get_dirty (column))
continue;
gtk_tree_view_column_cell_set_cell_data (column, tree_view->priv->model, iter,
@@ -5881,10 +5944,10 @@ validate_row (GtkTreeView *tree_view,
tmp_width += grid_line_width;
}
- if (tmp_width > column->requested_width)
+ if (tmp_width > _gtk_tree_view_column_get_requested_width (column))
{
retval = TRUE;
- column->requested_width = tmp_width;
+ _gtk_tree_view_column_set_requested_width (column, tmp_width);
}
}
@@ -7753,8 +7816,12 @@ gtk_tree_view_remove (GtkContainer *container,
while (tmp_list)
{
GtkTreeViewColumn *column;
+ GtkWidget *button;
+
column = tmp_list->data;
- if (column->button == widget)
+ button = gtk_tree_view_column_get_button (column);
+
+ if (button == widget)
{
gtk_widget_unparent (widget);
return;
@@ -7772,6 +7839,7 @@ gtk_tree_view_forall (GtkContainer *container,
GtkTreeView *tree_view = GTK_TREE_VIEW (container);
GtkTreeViewChild *child = NULL;
GtkTreeViewColumn *column;
+ GtkWidget *button;
GList *tmp_list;
tmp_list = tree_view->priv->children;
@@ -7788,9 +7856,10 @@ gtk_tree_view_forall (GtkContainer *container,
for (tmp_list = tree_view->priv->columns; tmp_list; tmp_list = tmp_list->next)
{
column = tmp_list->data;
+ button = gtk_tree_view_column_get_button (column);
- if (column->button)
- (* callback) (column->button, callback_data);
+ if (button)
+ (* callback) (button, callback_data);
}
}
@@ -7809,7 +7878,7 @@ gtk_tree_view_has_can_focus_cell (GtkTreeView *tree_view)
if (!gtk_tree_view_column_get_visible (column))
continue;
- if (gtk_cell_area_is_activatable (column->cell_area))
+ if (gtk_cell_area_is_activatable (gtk_cell_layout_get_area (GTK_CELL_LAYOUT (column))))
return TRUE;
}
@@ -7911,7 +7980,7 @@ gtk_tree_view_header_focus (GtkTreeView *tree_view,
{
GtkTreeViewColumn *column;
GtkWidget *focus_child;
-
+ GtkWidget *button;
GList *last_column, *first_column;
GList *tmp_list;
gboolean rtl;
@@ -7925,8 +7994,9 @@ gtk_tree_view_header_focus (GtkTreeView *tree_view,
while (first_column)
{
column = GTK_TREE_VIEW_COLUMN (first_column->data);
+ button = gtk_tree_view_column_get_button (column);
- if (gtk_widget_get_can_focus (column->button) &&
+ if (gtk_widget_get_can_focus (button) &&
gtk_tree_view_column_get_visible (column) &&
(gtk_tree_view_column_get_clickable (column) ||
gtk_tree_view_column_get_reorderable (column)))
@@ -7943,8 +8013,9 @@ gtk_tree_view_header_focus (GtkTreeView *tree_view,
while (last_column)
{
column = GTK_TREE_VIEW_COLUMN (last_column->data);
+ button = gtk_tree_view_column_get_button (column);
- if (gtk_widget_get_can_focus (column->button) &&
+ if (gtk_widget_get_can_focus (button) &&
gtk_tree_view_column_get_visible (column) &&
(gtk_tree_view_column_get_clickable (column) ||
gtk_tree_view_column_get_reorderable (column)))
@@ -7963,11 +8034,16 @@ gtk_tree_view_header_focus (GtkTreeView *tree_view,
case GTK_DIR_DOWN:
if (focus_child == NULL)
{
- if (tree_view->priv->focus_column != NULL &&
- gtk_widget_get_can_focus (tree_view->priv->focus_column->button))
- focus_child = tree_view->priv->focus_column->button;
+ if (tree_view->priv->focus_column != NULL)
+ button = gtk_tree_view_column_get_button (tree_view->priv->focus_column);
+ else
+ button = NULL;
+
+ if (button && gtk_widget_get_can_focus (button))
+ focus_child = button;
else
- focus_child = GTK_TREE_VIEW_COLUMN (first_column->data)->button;
+ focus_child = gtk_tree_view_column_get_button (GTK_TREE_VIEW_COLUMN (first_column->data));
+
gtk_widget_grab_focus (focus_child);
break;
}
@@ -7978,11 +8054,12 @@ gtk_tree_view_header_focus (GtkTreeView *tree_view,
if (focus_child == NULL)
{
if (tree_view->priv->focus_column != NULL)
- focus_child = tree_view->priv->focus_column->button;
+ focus_child = gtk_tree_view_column_get_button (tree_view->priv->focus_column);
else if (dir == GTK_DIR_LEFT)
- focus_child = GTK_TREE_VIEW_COLUMN (last_column->data)->button;
+ focus_child = gtk_tree_view_column_get_button (GTK_TREE_VIEW_COLUMN (last_column->data));
else
- focus_child = GTK_TREE_VIEW_COLUMN (first_column->data)->button;
+ focus_child = gtk_tree_view_column_get_button (GTK_TREE_VIEW_COLUMN (first_column->data));
+
gtk_widget_grab_focus (focus_child);
break;
}
@@ -7996,7 +8073,7 @@ gtk_tree_view_header_focus (GtkTreeView *tree_view,
/* We need to move the focus among the row of buttons. */
for (tmp_list = tree_view->priv->columns; tmp_list; tmp_list = tmp_list->next)
- if (GTK_TREE_VIEW_COLUMN (tmp_list->data)->button == focus_child)
+ if (gtk_tree_view_column_get_button (GTK_TREE_VIEW_COLUMN (tmp_list->data)) == focus_child)
break;
if ((tmp_list == first_column && dir == (rtl ? GTK_DIR_RIGHT : GTK_DIR_LEFT))
@@ -8009,6 +8086,7 @@ gtk_tree_view_header_focus (GtkTreeView *tree_view,
while (tmp_list)
{
GtkTreeViewColumn *column;
+ GtkWidget *button;
if (dir == (rtl ? GTK_DIR_LEFT : GTK_DIR_RIGHT))
tmp_list = tmp_list->next;
@@ -8021,12 +8099,13 @@ gtk_tree_view_header_focus (GtkTreeView *tree_view,
break;
}
column = tmp_list->data;
- if (column->button &&
+ button = gtk_tree_view_column_get_button (column);
+ if (button &&
gtk_tree_view_column_get_visible (column) &&
- gtk_widget_get_can_focus (column->button))
+ gtk_widget_get_can_focus (button))
{
- focus_child = column->button;
- gtk_widget_grab_focus (column->button);
+ focus_child = button;
+ gtk_widget_grab_focus (button);
break;
}
}
@@ -8041,7 +8120,7 @@ gtk_tree_view_header_focus (GtkTreeView *tree_view,
if (focus_child)
{
for (tmp_list = tree_view->priv->columns; tmp_list; tmp_list = tmp_list->next)
- if (GTK_TREE_VIEW_COLUMN (tmp_list->data)->button == focus_child)
+ if (gtk_tree_view_column_get_button (GTK_TREE_VIEW_COLUMN (tmp_list->data)) == focus_child)
{
tree_view->priv->focus_column = GTK_TREE_VIEW_COLUMN (tmp_list->data);
break;
@@ -8213,7 +8292,7 @@ gtk_tree_view_set_focus_child (GtkContainer *container,
for (list = tree_view->priv->columns; list; list = list->next)
{
- if (GTK_TREE_VIEW_COLUMN (list->data)->button == child)
+ if (gtk_tree_view_column_get_button (GTK_TREE_VIEW_COLUMN (list->data)) == child)
{
tree_view->priv->focus_column = GTK_TREE_VIEW_COLUMN (list->data);
break;
@@ -8601,7 +8680,6 @@ gtk_tree_view_row_has_child_toggled (GtkTreeModel *model,
for (list = tree_view->priv->columns; list; list = list->next)
if (gtk_tree_view_column_get_visible (GTK_TREE_VIEW_COLUMN (list->data)))
{
- GTK_TREE_VIEW_COLUMN (list->data)->dirty = TRUE;
_gtk_tree_view_column_cell_set_dirty (GTK_TREE_VIEW_COLUMN (list->data), TRUE);
break;
}
@@ -8990,7 +9068,7 @@ gtk_tree_view_clamp_column_visible (GtkTreeView *tree_view,
if (column == NULL)
return;
- gtk_widget_get_allocation (column->button, &allocation);
+ gtk_widget_get_allocation (gtk_tree_view_column_get_button (column), &allocation);
x = allocation.x;
width = allocation.width;
@@ -9354,11 +9432,16 @@ gtk_tree_view_set_column_drag_info (GtkTreeView *tree_view,
if (tmp_list->next != NULL)
{
GtkAllocation right_allocation, left_allocation;
+ GtkWidget *left_button, *right_button;
g_assert (tmp_list->next->data);
- gtk_widget_get_allocation (reorder->right_column->button, &right_allocation);
- gtk_widget_get_allocation (((GtkTreeViewColumnReorder *)tmp_list->next->data)->left_column->button, &left_allocation);
+ right_button = gtk_tree_view_column_get_button (reorder->right_column);
+ left_button = gtk_tree_view_column_get_button
+ (((GtkTreeViewColumnReorder *)tmp_list->next->data)->left_column);
+
+ gtk_widget_get_allocation (right_button, &right_allocation);
+ gtk_widget_get_allocation (left_button, &left_allocation);
left = reorder->right_align = (right_allocation.x + right_allocation.width + left_allocation.x) / 2;
}
else
@@ -9379,6 +9462,7 @@ _gtk_tree_view_column_start_drag (GtkTreeView *tree_view,
GtkAllocation button_allocation;
GdkScreen *screen = gtk_widget_get_screen (GTK_WIDGET (tree_view));
GdkDisplay *display = gdk_screen_get_display (screen);
+ GtkWidget *button;
g_return_if_fail (tree_view->priv->column_drag_info == NULL);
g_return_if_fail (tree_view->priv->cur_reorder == NULL);
@@ -9388,12 +9472,14 @@ _gtk_tree_view_column_start_drag (GtkTreeView *tree_view,
if (tree_view->priv->column_drag_info == NULL)
return;
+ button = gtk_tree_view_column_get_button (column);
+
if (tree_view->priv->drag_window == NULL)
{
GdkWindowAttr attributes;
guint attributes_mask;
- gtk_widget_get_allocation (column->button, &button_allocation);
+ gtk_widget_get_allocation (button, &button_allocation);
attributes.window_type = GDK_WINDOW_CHILD;
attributes.wclass = GDK_INPUT_OUTPUT;
@@ -9414,17 +9500,17 @@ _gtk_tree_view_column_start_drag (GtkTreeView *tree_view,
gdk_display_pointer_ungrab (display, GDK_CURRENT_TIME);
gdk_display_keyboard_ungrab (display, GDK_CURRENT_TIME);
- gtk_grab_remove (column->button);
+ gtk_grab_remove (button);
send_event = gdk_event_new (GDK_LEAVE_NOTIFY);
send_event->crossing.send_event = TRUE;
- send_event->crossing.window = g_object_ref (gtk_button_get_event_window (GTK_BUTTON (column->button)));
+ send_event->crossing.window = g_object_ref (gtk_button_get_event_window (GTK_BUTTON (button)));
send_event->crossing.subwindow = NULL;
send_event->crossing.detail = GDK_NOTIFY_ANCESTOR;
send_event->crossing.time = GDK_CURRENT_TIME;
gdk_event_set_device (send_event, device);
- gtk_propagate_event (column->button, send_event);
+ gtk_propagate_event (button, send_event);
gdk_event_free (send_event);
send_event = gdk_event_new (GDK_BUTTON_RELEASE);
@@ -9440,22 +9526,22 @@ _gtk_tree_view_column_start_drag (GtkTreeView *tree_view,
send_event->button.y_root = 0;
gdk_event_set_device (send_event, device);
- gtk_propagate_event (column->button, send_event);
+ gtk_propagate_event (button, send_event);
gdk_event_free (send_event);
/* Kids, don't try this at home */
- g_object_ref (column->button);
- gtk_container_remove (GTK_CONTAINER (tree_view), column->button);
- gtk_widget_set_parent_window (column->button, tree_view->priv->drag_window);
- gtk_widget_set_parent (column->button, GTK_WIDGET (tree_view));
- g_object_unref (column->button);
+ g_object_ref (button);
+ gtk_container_remove (GTK_CONTAINER (tree_view), button);
+ gtk_widget_set_parent_window (button, tree_view->priv->drag_window);
+ gtk_widget_set_parent (button, GTK_WIDGET (tree_view));
+ g_object_unref (button);
- gtk_widget_get_allocation (column->button, &button_allocation);
+ gtk_widget_get_allocation (button, &button_allocation);
tree_view->priv->drag_column_x = button_allocation.x;
allocation = button_allocation;
allocation.x = 0;
- gtk_widget_size_allocate (column->button, &allocation);
- gtk_widget_set_parent_window (column->button, tree_view->priv->drag_window);
+ gtk_widget_size_allocate (button, &allocation);
+ gtk_widget_set_parent_window (button, tree_view->priv->drag_window);
tree_view->priv->drag_column = column;
gdk_window_show (tree_view->priv->drag_window);
@@ -10527,12 +10613,14 @@ gtk_tree_view_real_start_interactive_search (GtkTreeView *tree_view,
for (list = tree_view->priv->columns; list; list = list->next)
{
GtkTreeViewColumn *column;
+ GtkWidget *button;
column = list->data;
if (!gtk_tree_view_column_get_visible (column))
continue;
- if (gtk_widget_has_focus (column->button))
+ button = gtk_tree_view_column_get_button (column);
+ if (gtk_widget_has_focus (button))
{
found_focus = TRUE;
break;
@@ -10613,14 +10701,14 @@ gtk_tree_view_new_column_width (GtkTreeView *tree_view,
*/
rtl = (gtk_widget_get_direction (GTK_WIDGET (tree_view)) == GTK_TEXT_DIR_RTL);
column = g_list_nth (tree_view->priv->columns, i)->data;
- gtk_widget_get_allocation (column->button, &allocation);
+ gtk_widget_get_allocation (gtk_tree_view_column_get_button (column), &allocation);
width = rtl ? (allocation.x + allocation.width - *x) : (*x - allocation.x);
/* Clamp down the value */
min_width = gtk_tree_view_column_get_min_width (column);
if (min_width == -1)
{
- gtk_widget_get_preferred_size (column->button, &button_req, NULL);
+ gtk_widget_get_preferred_size (gtk_tree_view_column_get_button (column), &button_req, NULL);
width = MAX (button_req.width, width);
}
else
@@ -10737,8 +10825,10 @@ gtk_tree_view_adjustment_changed (GtkAdjustment *adjustment,
GList *list;
GtkTreeViewChild *child = NULL;
GtkCellEditable *edit_widget;
+ GtkCellArea *area;
- edit_widget = gtk_cell_area_get_edit_widget (tree_view->priv->edited_column->cell_area);
+ area = gtk_cell_layout_get_area (GTK_CELL_LAYOUT (tree_view->priv->edited_column));
+ edit_widget = gtk_cell_area_get_edit_widget (area);
if (GTK_IS_WIDGET (edit_widget))
{
adjust_allocation (GTK_WIDGET (edit_widget), 0, dy);
@@ -11149,6 +11239,7 @@ gtk_tree_view_set_headers_visible (GtkTreeView *tree_view,
GList *list;
GtkTreeViewColumn *column;
GtkAllocation allocation;
+ GtkWidget *button;
g_return_if_fail (GTK_IS_TREE_VIEW (tree_view));
@@ -11182,7 +11273,8 @@ gtk_tree_view_set_headers_visible (GtkTreeView *tree_view,
for (list = tree_view->priv->columns; list; list = list->next)
{
column = list->data;
- gtk_widget_unmap (column->button);
+ button = gtk_tree_view_column_get_button (column);
+ gtk_widget_unmap (button);
}
gdk_window_hide (tree_view->priv->header_window);
}
@@ -11347,7 +11439,7 @@ gtk_tree_view_append_column (GtkTreeView *tree_view,
{
g_return_val_if_fail (GTK_IS_TREE_VIEW (tree_view), -1);
g_return_val_if_fail (GTK_IS_TREE_VIEW_COLUMN (column), -1);
- g_return_val_if_fail (column->tree_view == NULL, -1);
+ g_return_val_if_fail (gtk_tree_view_column_get_tree_view (column) == NULL, -1);
return gtk_tree_view_insert_column (tree_view, column, -1);
}
@@ -11368,7 +11460,7 @@ gtk_tree_view_remove_column (GtkTreeView *tree_view,
{
g_return_val_if_fail (GTK_IS_TREE_VIEW (tree_view), -1);
g_return_val_if_fail (GTK_IS_TREE_VIEW_COLUMN (column), -1);
- g_return_val_if_fail (column->tree_view == GTK_WIDGET (tree_view), -1);
+ g_return_val_if_fail (gtk_tree_view_column_get_tree_view (column) == GTK_WIDGET (tree_view), -1);
if (tree_view->priv->focus_column == column)
tree_view->priv->focus_column = NULL;
@@ -11440,7 +11532,7 @@ gtk_tree_view_insert_column (GtkTreeView *tree_view,
{
g_return_val_if_fail (GTK_IS_TREE_VIEW (tree_view), -1);
g_return_val_if_fail (GTK_IS_TREE_VIEW_COLUMN (column), -1);
- g_return_val_if_fail (column->tree_view == NULL, -1);
+ g_return_val_if_fail (gtk_tree_view_column_get_tree_view (column) == NULL, -1);
if (tree_view->priv->fixed_height_mode)
g_return_val_if_fail (gtk_tree_view_column_get_sizing (column)
@@ -12878,7 +12970,8 @@ gtk_tree_view_set_cursor_on_cell (GtkTreeView *tree_view,
/* cancel the current editing, if it exists */
if (tree_view->priv->edited_column &&
- gtk_cell_area_get_edit_widget (tree_view->priv->edited_column->cell_area))
+ gtk_cell_area_get_edit_widget
+ (gtk_cell_layout_get_area (GTK_CELL_LAYOUT (tree_view->priv->edited_column))))
gtk_tree_view_stop_editing (tree_view, TRUE);
gtk_tree_view_real_set_cursor (tree_view, path, TRUE, TRUE);
@@ -13091,7 +13184,7 @@ gtk_tree_view_get_cell_area (GtkTreeView *tree_view,
g_return_if_fail (GTK_IS_TREE_VIEW (tree_view));
g_return_if_fail (column == NULL || GTK_IS_TREE_VIEW_COLUMN (column));
g_return_if_fail (rect != NULL);
- g_return_if_fail (!column || column->tree_view == (GtkWidget *) tree_view);
+ g_return_if_fail (!column || gtk_tree_view_column_get_tree_view (column) == (GtkWidget *) tree_view);
g_return_if_fail (gtk_widget_get_realized (GTK_WIDGET (tree_view)));
gtk_widget_style_get (GTK_WIDGET (tree_view),
@@ -13106,7 +13199,7 @@ gtk_tree_view_get_cell_area (GtkTreeView *tree_view,
if (column)
{
- gtk_widget_get_allocation (column->button, &allocation);
+ gtk_widget_get_allocation (gtk_tree_view_column_get_button (column), &allocation);
rect->x = allocation.x + horizontal_separator/2;
rect->width = allocation.width - horizontal_separator;
}
@@ -14908,8 +15001,8 @@ gtk_tree_view_start_editing (GtkTreeView *tree_view,
focus_column,
&cell_area);
- if (gtk_cell_area_activate (focus_column->cell_area,
- focus_column->cell_area_context,
+ if (gtk_cell_area_activate (gtk_cell_layout_get_area (GTK_CELL_LAYOUT (focus_column)),
+ _gtk_tree_view_column_get_context (focus_column),
GTK_WIDGET (tree_view),
&cell_area,
flags))
@@ -14975,7 +15068,7 @@ gtk_tree_view_stop_editing (GtkTreeView *tree_view,
*/
column = tree_view->priv->edited_column;
- gtk_cell_area_stop_editing (column->cell_area, cancel_editing);
+ gtk_cell_area_stop_editing (gtk_cell_layout_get_area (GTK_CELL_LAYOUT (column)), cancel_editing);
tree_view->priv->edited_column = NULL;
}
diff --git a/gtk/gtktreeviewcolumn.c b/gtk/gtktreeviewcolumn.c
index 363082c..e74e937 100644
--- a/gtk/gtktreeviewcolumn.c
+++ b/gtk/gtktreeviewcolumn.c
@@ -56,34 +56,6 @@
*/
-enum
-{
- PROP_0,
- PROP_VISIBLE,
- PROP_RESIZABLE,
- PROP_WIDTH,
- PROP_SPACING,
- PROP_SIZING,
- PROP_FIXED_WIDTH,
- PROP_MIN_WIDTH,
- PROP_MAX_WIDTH,
- PROP_TITLE,
- PROP_EXPAND,
- PROP_CLICKABLE,
- PROP_WIDGET,
- PROP_ALIGNMENT,
- PROP_REORDERABLE,
- PROP_SORT_INDICATOR,
- PROP_SORT_ORDER,
- PROP_SORT_COLUMN_ID
-};
-
-enum
-{
- CLICKED,
- LAST_SIGNAL
-};
-
/* Type methods */
static void gtk_tree_view_column_cell_layout_init (GtkCellLayoutIface *iface);
@@ -146,6 +118,87 @@ static void gtk_tree_view_column_set_attributesv (GtkTreeViewColum
/* GtkBuildable implementation */
static void gtk_tree_view_column_buildable_init (GtkBuildableIface *iface);
+
+struct _GtkTreeViewColumnPrivate
+{
+ GtkWidget *tree_view;
+ GtkWidget *button;
+ GtkWidget *child;
+ GtkWidget *arrow;
+ GtkWidget *alignment;
+ GdkWindow *window;
+ gfloat xalign;
+ gulong property_changed_signal;
+
+ /* Sizing fields */
+ /* see gtk+/doc/tree-column-sizing.txt for more information on them */
+ GtkTreeViewColumnSizing column_type;
+ gint requested_width;
+ gint resized_width;
+ gint width;
+ gint fixed_width;
+ gint min_width;
+ gint max_width;
+
+ /* dragging columns */
+ gint drag_x;
+ gint drag_y;
+
+ gchar *title;
+
+ /* Sorting */
+ gulong sort_clicked_signal;
+ gulong sort_column_changed_signal;
+ gint sort_column_id;
+ GtkSortType sort_order;
+
+ /* Cell area */
+ GtkCellArea *cell_area;
+ GtkCellAreaContext *cell_area_context;
+ gulong add_editable_signal;
+ gulong remove_editable_signal;
+ gulong context_changed_signal;
+
+ /* Flags */
+ guint visible : 1;
+ guint resizable : 1;
+ guint clickable : 1;
+ guint dirty : 1;
+ guint show_sort_indicator : 1;
+ guint maybe_reordered : 1;
+ guint reorderable : 1;
+ guint use_resized_width : 1;
+ guint expand : 1;
+};
+
+enum
+{
+ PROP_0,
+ PROP_VISIBLE,
+ PROP_RESIZABLE,
+ PROP_WIDTH,
+ PROP_SPACING,
+ PROP_SIZING,
+ PROP_FIXED_WIDTH,
+ PROP_MIN_WIDTH,
+ PROP_MAX_WIDTH,
+ PROP_TITLE,
+ PROP_EXPAND,
+ PROP_CLICKABLE,
+ PROP_WIDGET,
+ PROP_ALIGNMENT,
+ PROP_REORDERABLE,
+ PROP_SORT_INDICATOR,
+ PROP_SORT_ORDER,
+ PROP_SORT_COLUMN_ID
+};
+
+enum
+{
+ CLICKED,
+ LAST_SIGNAL
+};
+
static guint tree_column_signals[LAST_SIGNAL] = { 0 };
G_DEFINE_TYPE_WITH_CODE (GtkTreeViewColumn, gtk_tree_view_column, G_TYPE_INITIALLY_UNOWNED,
@@ -336,6 +389,8 @@ gtk_tree_view_column_class_init (GtkTreeViewColumnClass *class)
G_MAXINT,
-1,
GTK_PARAM_READWRITE));
+
+ g_type_class_add_private (class, sizeof (GtkTreeViewColumnPrivate));
}
static void
@@ -355,37 +410,44 @@ gtk_tree_view_column_cell_layout_init (GtkCellLayoutIface *iface)
static void
gtk_tree_view_column_init (GtkTreeViewColumn *tree_column)
{
- tree_column->button = NULL;
- tree_column->xalign = 0.0;
- tree_column->width = 0;
- tree_column->requested_width = -1;
- tree_column->min_width = -1;
- tree_column->max_width = -1;
- tree_column->resized_width = 0;
- tree_column->column_type = GTK_TREE_VIEW_COLUMN_GROW_ONLY;
- tree_column->visible = TRUE;
- tree_column->resizable = FALSE;
- tree_column->expand = FALSE;
- tree_column->clickable = FALSE;
- tree_column->dirty = TRUE;
- tree_column->sort_order = GTK_SORT_ASCENDING;
- tree_column->show_sort_indicator = FALSE;
- tree_column->property_changed_signal = 0;
- tree_column->sort_clicked_signal = 0;
- tree_column->sort_column_changed_signal = 0;
- tree_column->sort_column_id = -1;
- tree_column->reorderable = FALSE;
- tree_column->maybe_reordered = FALSE;
- tree_column->fixed_width = 1;
- tree_column->use_resized_width = FALSE;
- tree_column->title = g_strdup ("");
-
- tree_column->cell_area = gtk_cell_area_box_new ();
- gtk_cell_area_set_style_detail (tree_column->cell_area, "treeview");
- tree_column->cell_area_context = gtk_cell_area_create_context (tree_column->cell_area);
-
- tree_column->context_changed_signal =
- g_signal_connect (tree_column->cell_area_context, "notify",
+ GtkTreeViewColumnPrivate *priv;
+
+ tree_column->priv = G_TYPE_INSTANCE_GET_PRIVATE (tree_column,
+ GTK_TYPE_TREE_VIEW_COLUMN,
+ GtkTreeViewColumnPrivate);
+ priv = tree_column->priv;
+
+ priv->button = NULL;
+ priv->xalign = 0.0;
+ priv->width = 0;
+ priv->requested_width = -1;
+ priv->min_width = -1;
+ priv->max_width = -1;
+ priv->resized_width = 0;
+ priv->column_type = GTK_TREE_VIEW_COLUMN_GROW_ONLY;
+ priv->visible = TRUE;
+ priv->resizable = FALSE;
+ priv->expand = FALSE;
+ priv->clickable = FALSE;
+ priv->dirty = TRUE;
+ priv->sort_order = GTK_SORT_ASCENDING;
+ priv->show_sort_indicator = FALSE;
+ priv->property_changed_signal = 0;
+ priv->sort_clicked_signal = 0;
+ priv->sort_column_changed_signal = 0;
+ priv->sort_column_id = -1;
+ priv->reorderable = FALSE;
+ priv->maybe_reordered = FALSE;
+ priv->fixed_width = 1;
+ priv->use_resized_width = FALSE;
+ priv->title = g_strdup ("");
+
+ priv->cell_area = gtk_cell_area_box_new ();
+ gtk_cell_area_set_style_detail (priv->cell_area, "treeview");
+ priv->cell_area_context = gtk_cell_area_create_context (priv->cell_area);
+
+ priv->context_changed_signal =
+ g_signal_connect (priv->cell_area_context, "notify",
G_CALLBACK (gtk_tree_view_column_context_changed), tree_column);
}
@@ -393,26 +455,30 @@ gtk_tree_view_column_init (GtkTreeViewColumn *tree_column)
static void
gtk_tree_view_column_dispose (GObject *object)
{
- GtkTreeViewColumn *tree_column = (GtkTreeViewColumn *) object;
+ GtkTreeViewColumn *tree_column = (GtkTreeViewColumn *) object;
+ GtkTreeViewColumnPrivate *priv = tree_column->priv;
- if (tree_column->cell_area_context)
- {
- g_object_unref (tree_column->cell_area_context);
+ if (priv->cell_area_context)
+ {
+ g_signal_handler_disconnect (priv->cell_area_context,
+ priv->context_changed_signal);
+
+ g_object_unref (priv->cell_area_context);
- g_signal_handler_disconnect (tree_column->cell_area_context,
- tree_column->context_changed_signal);
- tree_column->context_changed_signal = 0;
+ priv->cell_area_context = NULL;
+ priv->context_changed_signal = 0;
}
- if (tree_column->cell_area)
+ if (priv->cell_area)
{
- g_object_unref (tree_column->cell_area);
+ g_object_unref (priv->cell_area);
+ priv->cell_area = NULL;
}
- if (tree_column->child)
+ if (priv->child)
{
- g_object_unref (tree_column->child);
- tree_column->child = NULL;
+ g_object_unref (priv->child);
+ priv->child = NULL;
}
G_OBJECT_CLASS (gtk_tree_view_column_parent_class)->dispose (object);
@@ -421,9 +487,10 @@ gtk_tree_view_column_dispose (GObject *object)
static void
gtk_tree_view_column_finalize (GObject *object)
{
- GtkTreeViewColumn *tree_column = (GtkTreeViewColumn *) object;
+ GtkTreeViewColumn *tree_column = (GtkTreeViewColumn *) object;
+ GtkTreeViewColumnPrivate *priv = tree_column->priv;
- g_free (tree_column->title);
+ g_free (priv->title);
G_OBJECT_CLASS (gtk_tree_view_column_parent_class)->finalize (object);
}
@@ -634,12 +701,10 @@ gtk_tree_view_column_get_property (GObject *object,
static GtkCellArea *
gtk_tree_view_column_cell_layout_get_area (GtkCellLayout *cell_layout)
{
- GtkTreeViewColumn *column;
+ GtkTreeViewColumn *column = GTK_TREE_VIEW_COLUMN (cell_layout);
+ GtkTreeViewColumnPrivate *priv = column->priv;
- g_return_val_if_fail (GTK_IS_TREE_VIEW_COLUMN (cell_layout), NULL);
- column = GTK_TREE_VIEW_COLUMN (cell_layout);
-
- return column->cell_area;
+ return priv->cell_area;
}
/* Button handling code
@@ -647,42 +712,43 @@ gtk_tree_view_column_cell_layout_get_area (GtkCellLayout *cell_layout)
static void
gtk_tree_view_column_create_button (GtkTreeViewColumn *tree_column)
{
+ GtkTreeViewColumnPrivate *priv = tree_column->priv;
GtkTreeView *tree_view;
GtkWidget *child;
GtkWidget *hbox;
- tree_view = (GtkTreeView *) tree_column->tree_view;
+ tree_view = (GtkTreeView *) priv->tree_view;
g_return_if_fail (GTK_IS_TREE_VIEW (tree_view));
- g_return_if_fail (tree_column->button == NULL);
+ g_return_if_fail (priv->button == NULL);
gtk_widget_push_composite_child ();
- tree_column->button = gtk_button_new ();
- gtk_widget_add_events (tree_column->button, GDK_POINTER_MOTION_MASK);
+ priv->button = gtk_button_new ();
+ gtk_widget_add_events (priv->button, GDK_POINTER_MOTION_MASK);
gtk_widget_pop_composite_child ();
/* make sure we own a reference to it as well. */
if (tree_view->priv->header_window)
- gtk_widget_set_parent_window (tree_column->button, tree_view->priv->header_window);
- gtk_widget_set_parent (tree_column->button, GTK_WIDGET (tree_view));
+ gtk_widget_set_parent_window (priv->button, tree_view->priv->header_window);
+ gtk_widget_set_parent (priv->button, GTK_WIDGET (tree_view));
- g_signal_connect (tree_column->button, "event",
+ g_signal_connect (priv->button, "event",
G_CALLBACK (gtk_tree_view_column_button_event),
tree_column);
- g_signal_connect (tree_column->button, "clicked",
+ g_signal_connect (priv->button, "clicked",
G_CALLBACK (gtk_tree_view_column_button_clicked),
tree_column);
- tree_column->alignment = gtk_alignment_new (tree_column->xalign, 0.5, 0.0, 0.0);
+ priv->alignment = gtk_alignment_new (priv->xalign, 0.5, 0.0, 0.0);
hbox = gtk_box_new (GTK_ORIENTATION_HORIZONTAL, 2);
- tree_column->arrow = gtk_arrow_new (GTK_ARROW_DOWN, GTK_SHADOW_IN);
+ priv->arrow = gtk_arrow_new (GTK_ARROW_DOWN, GTK_SHADOW_IN);
- if (tree_column->child)
- child = tree_column->child;
+ if (priv->child)
+ child = priv->child;
else
{
- child = gtk_label_new (tree_column->title);
+ child = gtk_label_new (priv->title);
gtk_widget_show (child);
}
@@ -690,24 +756,25 @@ gtk_tree_view_column_create_button (GtkTreeViewColumn *tree_column)
G_CALLBACK (gtk_tree_view_column_mnemonic_activate),
tree_column);
- if (tree_column->xalign <= 0.5)
- gtk_box_pack_end (GTK_BOX (hbox), tree_column->arrow, FALSE, FALSE, 0);
+ if (priv->xalign <= 0.5)
+ gtk_box_pack_end (GTK_BOX (hbox), priv->arrow, FALSE, FALSE, 0);
else
- gtk_box_pack_start (GTK_BOX (hbox), tree_column->arrow, FALSE, FALSE, 0);
+ gtk_box_pack_start (GTK_BOX (hbox), priv->arrow, FALSE, FALSE, 0);
- gtk_box_pack_start (GTK_BOX (hbox), tree_column->alignment, TRUE, TRUE, 0);
+ gtk_box_pack_start (GTK_BOX (hbox), priv->alignment, TRUE, TRUE, 0);
- gtk_container_add (GTK_CONTAINER (tree_column->alignment), child);
- gtk_container_add (GTK_CONTAINER (tree_column->button), hbox);
+ gtk_container_add (GTK_CONTAINER (priv->alignment), child);
+ gtk_container_add (GTK_CONTAINER (priv->button), hbox);
gtk_widget_show (hbox);
- gtk_widget_show (tree_column->alignment);
+ gtk_widget_show (priv->alignment);
gtk_tree_view_column_update_button (tree_column);
}
static void
gtk_tree_view_column_update_button (GtkTreeViewColumn *tree_column)
{
+ GtkTreeViewColumnPrivate *priv = tree_column->priv;
gint sort_column_id = -1;
GtkWidget *hbox;
GtkWidget *alignment;
@@ -716,38 +783,38 @@ gtk_tree_view_column_update_button (GtkTreeViewColumn *tree_column)
GtkArrowType arrow_type = GTK_ARROW_NONE;
GtkTreeModel *model;
- if (tree_column->tree_view)
- model = gtk_tree_view_get_model (GTK_TREE_VIEW (tree_column->tree_view));
+ if (priv->tree_view)
+ model = gtk_tree_view_get_model (GTK_TREE_VIEW (priv->tree_view));
else
model = NULL;
/* Create a button if necessary */
- if (tree_column->visible &&
- tree_column->button == NULL &&
- tree_column->tree_view &&
- gtk_widget_get_realized (tree_column->tree_view))
+ if (priv->visible &&
+ priv->button == NULL &&
+ priv->tree_view &&
+ gtk_widget_get_realized (priv->tree_view))
gtk_tree_view_column_create_button (tree_column);
- if (! tree_column->button)
+ if (! priv->button)
return;
- hbox = gtk_bin_get_child (GTK_BIN (tree_column->button));
- alignment = tree_column->alignment;
- arrow = tree_column->arrow;
+ hbox = gtk_bin_get_child (GTK_BIN (priv->button));
+ alignment = priv->alignment;
+ arrow = priv->arrow;
current_child = gtk_bin_get_child (GTK_BIN (alignment));
/* Set up the actual button */
- gtk_alignment_set (GTK_ALIGNMENT (alignment), tree_column->xalign,
+ gtk_alignment_set (GTK_ALIGNMENT (alignment), priv->xalign,
0.5, 0.0, 0.0);
- if (tree_column->child)
+ if (priv->child)
{
- if (current_child != tree_column->child)
+ if (current_child != priv->child)
{
gtk_container_remove (GTK_CONTAINER (alignment),
current_child);
gtk_container_add (GTK_CONTAINER (alignment),
- tree_column->child);
+ priv->child);
}
}
else
@@ -762,9 +829,9 @@ gtk_tree_view_column_update_button (GtkTreeViewColumn *tree_column)
g_return_if_fail (GTK_IS_LABEL (current_child));
- if (tree_column->title)
+ if (priv->title)
gtk_label_set_text_with_mnemonic (GTK_LABEL (current_child),
- tree_column->title);
+ priv->title);
else
gtk_label_set_text_with_mnemonic (GTK_LABEL (current_child),
"");
@@ -775,15 +842,15 @@ gtk_tree_view_column_update_button (GtkTreeViewColumn *tree_column)
&sort_column_id,
NULL);
- if (tree_column->show_sort_indicator)
+ if (priv->show_sort_indicator)
{
gboolean alternative;
- g_object_get (gtk_widget_get_settings (tree_column->tree_view),
+ g_object_get (gtk_widget_get_settings (priv->tree_view),
"gtk-alternative-sort-arrows", &alternative,
NULL);
- switch (tree_column->sort_order)
+ switch (priv->sort_order)
{
case GTK_SORT_ASCENDING:
arrow_type = alternative ? GTK_ARROW_UP : GTK_ARROW_DOWN;
@@ -810,7 +877,7 @@ gtk_tree_view_column_update_button (GtkTreeViewColumn *tree_column)
g_object_ref (arrow);
gtk_container_remove (GTK_CONTAINER (hbox), arrow);
- if (tree_column->xalign <= 0.5)
+ if (priv->xalign <= 0.5)
{
gtk_box_pack_end (GTK_BOX (hbox), arrow, FALSE, FALSE, 0);
}
@@ -822,52 +889,52 @@ gtk_tree_view_column_update_button (GtkTreeViewColumn *tree_column)
}
g_object_unref (arrow);
- if (tree_column->show_sort_indicator
- || (GTK_IS_TREE_SORTABLE (model) && tree_column->sort_column_id >= 0))
+ if (priv->show_sort_indicator
+ || (GTK_IS_TREE_SORTABLE (model) && priv->sort_column_id >= 0))
gtk_widget_show (arrow);
else
gtk_widget_hide (arrow);
/* It's always safe to hide the button. It isn't always safe to show it, as
* if you show it before it's realized, it'll get the wrong window. */
- if (tree_column->button &&
- tree_column->tree_view != NULL &&
- gtk_widget_get_realized (tree_column->tree_view))
+ if (priv->button &&
+ priv->tree_view != NULL &&
+ gtk_widget_get_realized (priv->tree_view))
{
- if (tree_column->visible)
+ if (priv->visible)
{
- gtk_widget_show_now (tree_column->button);
- if (tree_column->window)
+ gtk_widget_show_now (priv->button);
+ if (priv->window)
{
- if (tree_column->resizable)
+ if (priv->resizable)
{
- gdk_window_show (tree_column->window);
- gdk_window_raise (tree_column->window);
+ gdk_window_show (priv->window);
+ gdk_window_raise (priv->window);
}
else
{
- gdk_window_hide (tree_column->window);
+ gdk_window_hide (priv->window);
}
}
}
else
{
- gtk_widget_hide (tree_column->button);
- if (tree_column->window)
- gdk_window_hide (tree_column->window);
+ gtk_widget_hide (priv->button);
+ if (priv->window)
+ gdk_window_hide (priv->window);
}
}
- if (tree_column->reorderable || tree_column->clickable)
+ if (priv->reorderable || priv->clickable)
{
- gtk_widget_set_can_focus (tree_column->button, TRUE);
+ gtk_widget_set_can_focus (priv->button, TRUE);
}
else
{
- gtk_widget_set_can_focus (tree_column->button, FALSE);
- if (gtk_widget_has_focus (tree_column->button))
+ gtk_widget_set_can_focus (priv->button, FALSE);
+ if (gtk_widget_has_focus (priv->button))
{
- GtkWidget *toplevel = gtk_widget_get_toplevel (tree_column->tree_view);
+ GtkWidget *toplevel = gtk_widget_get_toplevel (priv->tree_view);
if (gtk_widget_is_toplevel (toplevel))
{
gtk_window_set_focus (GTK_WINDOW (toplevel), NULL);
@@ -877,8 +944,8 @@ gtk_tree_view_column_update_button (GtkTreeViewColumn *tree_column)
/* Queue a resize on the assumption that we always want to catch all changes
* and columns don't change all that often.
*/
- if (gtk_widget_get_realized (tree_column->tree_view))
- gtk_widget_queue_resize (tree_column->tree_view);
+ if (gtk_widget_get_realized (priv->tree_view))
+ gtk_widget_queue_resize (priv->tree_view);
}
@@ -890,40 +957,42 @@ gtk_tree_view_column_button_event (GtkWidget *widget,
GdkEvent *event,
gpointer data)
{
- GtkTreeViewColumn *column = (GtkTreeViewColumn *) data;
+ GtkTreeViewColumn *column = (GtkTreeViewColumn *) data;
+ GtkTreeViewColumnPrivate *priv = column->priv;
g_return_val_if_fail (event != NULL, FALSE);
if (event->type == GDK_BUTTON_PRESS &&
- column->reorderable &&
+ priv->reorderable &&
((GdkEventButton *)event)->button == 1)
{
- column->maybe_reordered = TRUE;
+ priv->maybe_reordered = TRUE;
gdk_window_get_pointer (gtk_button_get_event_window (GTK_BUTTON (widget)),
- &column->drag_x,
- &column->drag_y,
+ &priv->drag_x,
+ &priv->drag_y,
NULL);
gtk_widget_grab_focus (widget);
}
if (event->type == GDK_BUTTON_RELEASE ||
event->type == GDK_LEAVE_NOTIFY)
- column->maybe_reordered = FALSE;
+ priv->maybe_reordered = FALSE;
if (event->type == GDK_MOTION_NOTIFY &&
- column->maybe_reordered &&
+ priv->maybe_reordered &&
(gtk_drag_check_threshold (widget,
- column->drag_x,
- column->drag_y,
+ priv->drag_x,
+ priv->drag_y,
(gint) ((GdkEventMotion *)event)->x,
(gint) ((GdkEventMotion *)event)->y)))
{
- column->maybe_reordered = FALSE;
- _gtk_tree_view_column_start_drag (GTK_TREE_VIEW (column->tree_view), column,
+ priv->maybe_reordered = FALSE;
+ _gtk_tree_view_column_start_drag (GTK_TREE_VIEW (priv->tree_view), column,
event->motion.device);
return TRUE;
}
- if (column->clickable == FALSE)
+
+ if (priv->clickable == FALSE)
{
switch (event->type)
{
@@ -954,17 +1023,20 @@ gtk_tree_view_column_mnemonic_activate (GtkWidget *widget,
gboolean group_cycling,
gpointer data)
{
- GtkTreeViewColumn *column = (GtkTreeViewColumn *)data;
+ GtkTreeViewColumn *column = (GtkTreeViewColumn *)data;
+ GtkTreeViewColumnPrivate *priv = column->priv;
g_return_val_if_fail (GTK_IS_TREE_VIEW_COLUMN (column), FALSE);
- GTK_TREE_VIEW (column->tree_view)->priv->focus_column = column;
- if (column->clickable)
- gtk_button_clicked (GTK_BUTTON (column->button));
- else if (gtk_widget_get_can_focus (column->button))
- gtk_widget_grab_focus (column->button);
+ /* XXX Direct access to treeview */
+ GTK_TREE_VIEW (priv->tree_view)->priv->focus_column = column;
+
+ if (priv->clickable)
+ gtk_button_clicked (GTK_BUTTON (priv->button));
+ else if (gtk_widget_get_can_focus (priv->button))
+ gtk_widget_grab_focus (priv->button);
else
- gtk_widget_grab_focus (column->tree_view);
+ gtk_widget_grab_focus (priv->tree_view);
return TRUE;
}
@@ -973,6 +1045,7 @@ static void
gtk_tree_view_model_sort_column_changed (GtkTreeSortable *sortable,
GtkTreeViewColumn *column)
{
+ GtkTreeViewColumnPrivate *priv = column->priv;
gint sort_column_id;
GtkSortType order;
@@ -980,7 +1053,7 @@ gtk_tree_view_model_sort_column_changed (GtkTreeSortable *sortable,
&sort_column_id,
&order))
{
- if (sort_column_id == column->sort_column_id)
+ if (sort_column_id == priv->sort_column_id)
{
gtk_tree_view_column_set_sort_indicator (column, TRUE);
gtk_tree_view_column_set_sort_order (column, order);
@@ -1000,74 +1073,80 @@ static void
gtk_tree_view_column_sort (GtkTreeViewColumn *tree_column,
gpointer data)
{
+ GtkTreeViewColumnPrivate *priv = tree_column->priv;
+ GtkTreeModel *model;
+ GtkTreeSortable *sortable;
gint sort_column_id;
GtkSortType order;
gboolean has_sort_column;
gboolean has_default_sort_func;
- g_return_if_fail (tree_column->tree_view != NULL);
+ g_return_if_fail (priv->tree_view != NULL);
+
+ model = gtk_tree_view_get_model (GTK_TREE_VIEW (priv->tree_view));
+ sortable = GTK_TREE_SORTABLE (model);
has_sort_column =
- gtk_tree_sortable_get_sort_column_id (GTK_TREE_SORTABLE (GTK_TREE_VIEW (tree_column->tree_view)->priv->model),
+ gtk_tree_sortable_get_sort_column_id (sortable,
&sort_column_id,
&order);
has_default_sort_func =
- gtk_tree_sortable_has_default_sort_func (GTK_TREE_SORTABLE (GTK_TREE_VIEW (tree_column->tree_view)->priv->model));
+ gtk_tree_sortable_has_default_sort_func (sortable);
if (has_sort_column &&
- sort_column_id == tree_column->sort_column_id)
+ sort_column_id == priv->sort_column_id)
{
if (order == GTK_SORT_ASCENDING)
- gtk_tree_sortable_set_sort_column_id (GTK_TREE_SORTABLE (GTK_TREE_VIEW (tree_column->tree_view)->priv->model),
- tree_column->sort_column_id,
+ gtk_tree_sortable_set_sort_column_id (sortable,
+ priv->sort_column_id,
GTK_SORT_DESCENDING);
else if (order == GTK_SORT_DESCENDING && has_default_sort_func)
- gtk_tree_sortable_set_sort_column_id (GTK_TREE_SORTABLE (GTK_TREE_VIEW (tree_column->tree_view)->priv->model),
+ gtk_tree_sortable_set_sort_column_id (sortable,
GTK_TREE_SORTABLE_DEFAULT_SORT_COLUMN_ID,
GTK_SORT_ASCENDING);
else
- gtk_tree_sortable_set_sort_column_id (GTK_TREE_SORTABLE (GTK_TREE_VIEW (tree_column->tree_view)->priv->model),
- tree_column->sort_column_id,
+ gtk_tree_sortable_set_sort_column_id (sortable,
+ priv->sort_column_id,
GTK_SORT_ASCENDING);
}
else
{
- gtk_tree_sortable_set_sort_column_id (GTK_TREE_SORTABLE (GTK_TREE_VIEW (tree_column->tree_view)->priv->model),
- tree_column->sort_column_id,
+ gtk_tree_sortable_set_sort_column_id (sortable,
+ priv->sort_column_id,
GTK_SORT_ASCENDING);
}
}
-
static void
gtk_tree_view_column_setup_sort_column_id_callback (GtkTreeViewColumn *tree_column)
{
+ GtkTreeViewColumnPrivate *priv = tree_column->priv;
GtkTreeModel *model;
- if (tree_column->tree_view == NULL)
+ if (priv->tree_view == NULL)
return;
- model = gtk_tree_view_get_model (GTK_TREE_VIEW (tree_column->tree_view));
+ model = gtk_tree_view_get_model (GTK_TREE_VIEW (priv->tree_view));
if (model == NULL)
return;
if (GTK_IS_TREE_SORTABLE (model) &&
- tree_column->sort_column_id != -1)
+ priv->sort_column_id != -1)
{
gint real_sort_column_id;
GtkSortType real_order;
- if (tree_column->sort_column_changed_signal == 0)
- tree_column->sort_column_changed_signal =
+ if (priv->sort_column_changed_signal == 0)
+ priv->sort_column_changed_signal =
g_signal_connect (model, "sort-column-changed",
G_CALLBACK (gtk_tree_view_model_sort_column_changed),
tree_column);
-
+
if (gtk_tree_sortable_get_sort_column_id (GTK_TREE_SORTABLE (model),
&real_sort_column_id,
&real_order) &&
- (real_sort_column_id == tree_column->sort_column_id))
+ (real_sort_column_id == priv->sort_column_id))
{
gtk_tree_view_column_set_sort_indicator (tree_column, TRUE);
gtk_tree_view_column_set_sort_order (tree_column, real_order);
@@ -1105,12 +1184,13 @@ gtk_tree_view_column_add_editable_callback (GtkCellArea *area,
const gchar *path_string,
gpointer user_data)
{
- GtkTreePath *path;
- GtkTreeViewColumn *column = user_data;
+ GtkTreeViewColumn *column = user_data;
+ GtkTreeViewColumnPrivate *priv = column->priv;
+ GtkTreePath *path;
path = gtk_tree_path_new_from_string (path_string);
- _gtk_tree_view_add_editable (GTK_TREE_VIEW (column->tree_view),
+ _gtk_tree_view_add_editable (GTK_TREE_VIEW (priv->tree_view),
column,
path,
edit_widget,
@@ -1125,9 +1205,10 @@ gtk_tree_view_column_remove_editable_callback (GtkCellArea *area,
GtkCellEditable *edit_widget,
gpointer user_data)
{
- GtkTreeViewColumn *column = user_data;
+ GtkTreeViewColumn *column = user_data;
+ GtkTreeViewColumnPrivate *priv = column->priv;
- _gtk_tree_view_remove_editable (GTK_TREE_VIEW (column->tree_view),
+ _gtk_tree_view_remove_editable (GTK_TREE_VIEW (priv->tree_view),
column,
edit_widget);
}
@@ -1135,28 +1216,29 @@ gtk_tree_view_column_remove_editable_callback (GtkCellArea *area,
/* Exported Private Functions.
* These should only be called by gtktreeview.c or gtktreeviewcolumn.c
*/
-
void
_gtk_tree_view_column_realize_button (GtkTreeViewColumn *column)
{
+ GtkTreeViewColumnPrivate *priv = column->priv;
GtkAllocation allocation;
GtkTreeView *tree_view;
GdkWindowAttr attr;
guint attributes_mask;
gboolean rtl;
- tree_view = (GtkTreeView *)column->tree_view;
- rtl = (gtk_widget_get_direction (GTK_WIDGET (tree_view)) == GTK_TEXT_DIR_RTL);
+ tree_view = (GtkTreeView *)priv->tree_view;
+ rtl = (gtk_widget_get_direction (priv->tree_view) == GTK_TEXT_DIR_RTL);
g_return_if_fail (GTK_IS_TREE_VIEW (tree_view));
- g_return_if_fail (gtk_widget_get_realized (GTK_WIDGET (tree_view)));
- g_return_if_fail (tree_view->priv->header_window != NULL);
- g_return_if_fail (column->button != NULL);
+ g_return_if_fail (gtk_widget_get_realized (priv->tree_view));
+ g_return_if_fail (priv->button != NULL);
- gtk_widget_set_parent_window (column->button, tree_view->priv->header_window);
+ /* XXX Access to GtkTreeView->priv */
+ g_return_if_fail (tree_view->priv->header_window != NULL);
+ gtk_widget_set_parent_window (priv->button, tree_view->priv->header_window);
- if (column->visible)
- gtk_widget_show (column->button);
+ if (priv->visible)
+ gtk_widget_show (priv->button);
attr.window_type = GDK_WINDOW_CHILD;
attr.wclass = GDK_INPUT_ONLY;
@@ -1174,11 +1256,11 @@ _gtk_tree_view_column_realize_button (GtkTreeViewColumn *column)
attr.width = TREE_VIEW_DRAG_WIDTH;
attr.height = tree_view->priv->header_height;
- gtk_widget_get_allocation (column->button, &allocation);
- attr.x = (allocation.x + (rtl ? 0 : allocation.width)) - TREE_VIEW_DRAG_WIDTH / 2;
- column->window = gdk_window_new (tree_view->priv->header_window,
+ gtk_widget_get_allocation (priv->button, &allocation);
+ attr.x = (allocation.x + (rtl ? 0 : allocation.width)) - TREE_VIEW_DRAG_WIDTH / 2;
+ priv->window = gdk_window_new (tree_view->priv->header_window,
&attr, attributes_mask);
- gdk_window_set_user_data (column->window, tree_view);
+ gdk_window_set_user_data (priv->window, tree_view);
gtk_tree_view_column_update_button (column);
@@ -1188,23 +1270,29 @@ _gtk_tree_view_column_realize_button (GtkTreeViewColumn *column)
void
_gtk_tree_view_column_unrealize_button (GtkTreeViewColumn *column)
{
+ GtkTreeViewColumnPrivate *priv;
+
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;
+ priv = column->priv;
+ g_return_if_fail (priv->window != NULL);
+
+ gdk_window_set_user_data (priv->window, NULL);
+ gdk_window_destroy (priv->window);
+ priv->window = NULL;
}
void
_gtk_tree_view_column_unset_model (GtkTreeViewColumn *column,
GtkTreeModel *old_model)
{
- if (column->sort_column_changed_signal)
+ GtkTreeViewColumnPrivate *priv = column->priv;
+
+ if (priv->sort_column_changed_signal)
{
g_signal_handler_disconnect (old_model,
- column->sort_column_changed_signal);
- column->sort_column_changed_signal = 0;
+ priv->sort_column_changed_signal);
+ priv->sort_column_changed_signal = 0;
}
gtk_tree_view_column_set_sort_indicator (column, FALSE);
}
@@ -1213,25 +1301,27 @@ void
_gtk_tree_view_column_set_tree_view (GtkTreeViewColumn *column,
GtkTreeView *tree_view)
{
- g_assert (column->tree_view == NULL);
+ GtkTreeViewColumnPrivate *priv = column->priv;
+
+ g_assert (priv->tree_view == NULL);
- column->tree_view = GTK_WIDGET (tree_view);
+ priv->tree_view = GTK_WIDGET (tree_view);
gtk_tree_view_column_create_button (column);
- column->add_editable_signal =
- g_signal_connect (column->cell_area, "add-editable",
- G_CALLBACK (gtk_tree_view_column_add_editable_callback),
- column);
- column->remove_editable_signal =
- g_signal_connect (column->cell_area, "remove-editable",
- G_CALLBACK (gtk_tree_view_column_remove_editable_callback),
- column);
-
- column->property_changed_signal =
- g_signal_connect_swapped (tree_view,
- "notify::model",
- G_CALLBACK (gtk_tree_view_column_setup_sort_column_id_callback),
- column);
+ priv->add_editable_signal =
+ g_signal_connect (priv->cell_area, "add-editable",
+ G_CALLBACK (gtk_tree_view_column_add_editable_callback),
+ column);
+ priv->remove_editable_signal =
+ g_signal_connect (priv->cell_area, "remove-editable",
+ G_CALLBACK (gtk_tree_view_column_remove_editable_callback),
+ column);
+
+ priv->property_changed_signal =
+ g_signal_connect_swapped (tree_view,
+ "notify::model",
+ G_CALLBACK (gtk_tree_view_column_setup_sort_column_id_callback),
+ column);
gtk_tree_view_column_setup_sort_column_id_callback (column);
}
@@ -1239,34 +1329,37 @@ _gtk_tree_view_column_set_tree_view (GtkTreeViewColumn *column,
void
_gtk_tree_view_column_unset_tree_view (GtkTreeViewColumn *column)
{
- if (column->tree_view && column->button)
+ GtkTreeViewColumnPrivate *priv = column->priv;
+
+ if (priv->tree_view && priv->button)
{
- gtk_container_remove (GTK_CONTAINER (column->tree_view), column->button);
+ gtk_container_remove (GTK_CONTAINER (priv->tree_view), priv->button);
}
- if (column->property_changed_signal)
+ if (priv->property_changed_signal)
{
- g_signal_handler_disconnect (column->tree_view, column->property_changed_signal);
- column->property_changed_signal = 0;
+ g_signal_handler_disconnect (priv->tree_view, priv->property_changed_signal);
+ priv->property_changed_signal = 0;
}
- if (column->sort_column_changed_signal)
+ if (priv->sort_column_changed_signal)
{
- g_signal_handler_disconnect (gtk_tree_view_get_model (GTK_TREE_VIEW (column->tree_view)),
- column->sort_column_changed_signal);
- column->sort_column_changed_signal = 0;
+ g_signal_handler_disconnect (gtk_tree_view_get_model (GTK_TREE_VIEW (priv->tree_view)),
+ priv->sort_column_changed_signal);
+ priv->sort_column_changed_signal = 0;
}
- column->tree_view = NULL;
- column->button = NULL;
+ priv->tree_view = NULL;
+ priv->button = NULL;
}
gboolean
_gtk_tree_view_column_has_editable_cell (GtkTreeViewColumn *column)
{
+ GtkTreeViewColumnPrivate *priv = column->priv;
gboolean ret = FALSE;
GList *list, *cells;
- cells = gtk_cell_layout_get_cells (GTK_CELL_LAYOUT (column->cell_area));
+ cells = gtk_cell_layout_get_cells (GTK_CELL_LAYOUT (priv->cell_area));
for (list = cells; list; list = list->next)
{
@@ -1291,7 +1384,9 @@ _gtk_tree_view_column_has_editable_cell (GtkTreeViewColumn *column)
GtkCellRenderer *
_gtk_tree_view_column_get_edited_cell (GtkTreeViewColumn *column)
{
- return gtk_cell_area_get_edited_cell (column->cell_area);
+ GtkTreeViewColumnPrivate *priv = column->priv;
+
+ return gtk_cell_area_get_edited_cell (priv->cell_area);
}
/* Public Functions */
@@ -1440,18 +1535,19 @@ gtk_tree_view_column_set_attributesv (GtkTreeViewColumn *tree_column,
GtkCellRenderer *cell_renderer,
va_list args)
{
+ GtkTreeViewColumnPrivate *priv = tree_column->priv;
gchar *attribute;
gint column;
attribute = va_arg (args, gchar *);
- gtk_cell_layout_clear_attributes (GTK_CELL_LAYOUT (tree_column->cell_area),
+ gtk_cell_layout_clear_attributes (GTK_CELL_LAYOUT (priv->cell_area),
cell_renderer);
while (attribute != NULL)
{
column = va_arg (args, gint);
- gtk_cell_layout_add_attribute (GTK_CELL_LAYOUT (tree_column->cell_area),
+ gtk_cell_layout_add_attribute (GTK_CELL_LAYOUT (priv->cell_area),
cell_renderer, attribute, column);
attribute = va_arg (args, gchar *);
}
@@ -1540,12 +1636,16 @@ void
gtk_tree_view_column_set_spacing (GtkTreeViewColumn *tree_column,
gint spacing)
{
+ GtkTreeViewColumnPrivate *priv;
+
g_return_if_fail (GTK_IS_TREE_VIEW_COLUMN (tree_column));
g_return_if_fail (spacing >= 0);
- gtk_cell_area_box_set_spacing (GTK_CELL_AREA_BOX (tree_column->cell_area),
+ priv = tree_column->priv;
+
+ gtk_cell_area_box_set_spacing (GTK_CELL_AREA_BOX (priv->cell_area),
spacing);
- if (tree_column->tree_view)
+ if (priv->tree_view)
_gtk_tree_view_column_cell_set_dirty (tree_column, TRUE);
}
@@ -1560,9 +1660,13 @@ gtk_tree_view_column_set_spacing (GtkTreeViewColumn *tree_column,
gint
gtk_tree_view_column_get_spacing (GtkTreeViewColumn *tree_column)
{
+ GtkTreeViewColumnPrivate *priv;
+
g_return_val_if_fail (GTK_IS_TREE_VIEW_COLUMN (tree_column), 0);
- return gtk_cell_area_box_get_spacing (GTK_CELL_AREA_BOX (tree_column->cell_area));
+ priv = tree_column->priv;
+
+ return gtk_cell_area_box_get_spacing (GTK_CELL_AREA_BOX (priv->cell_area));
}
/* Options for manipulating the columns */
@@ -1578,16 +1682,19 @@ void
gtk_tree_view_column_set_visible (GtkTreeViewColumn *tree_column,
gboolean visible)
{
+ GtkTreeViewColumnPrivate *priv;
+
g_return_if_fail (GTK_IS_TREE_VIEW_COLUMN (tree_column));
+ priv = tree_column->priv;
visible = !! visible;
- if (tree_column->visible == visible)
+ if (priv->visible == visible)
return;
- tree_column->visible = visible;
+ priv->visible = visible;
- if (tree_column->visible)
+ if (priv->visible)
_gtk_tree_view_column_cell_set_dirty (tree_column, TRUE);
gtk_tree_view_column_update_button (tree_column);
@@ -1608,7 +1715,7 @@ gtk_tree_view_column_get_visible (GtkTreeViewColumn *tree_column)
{
g_return_val_if_fail (GTK_IS_TREE_VIEW_COLUMN (tree_column), FALSE);
- return tree_column->visible;
+ return tree_column->priv->visible;
}
/**
@@ -1625,16 +1732,19 @@ void
gtk_tree_view_column_set_resizable (GtkTreeViewColumn *tree_column,
gboolean resizable)
{
+ GtkTreeViewColumnPrivate *priv;
+
g_return_if_fail (GTK_IS_TREE_VIEW_COLUMN (tree_column));
+ priv = tree_column->priv;
resizable = !! resizable;
- if (tree_column->resizable == resizable)
+ if (priv->resizable == resizable)
return;
- tree_column->resizable = resizable;
+ priv->resizable = resizable;
- if (resizable && tree_column->column_type == GTK_TREE_VIEW_COLUMN_AUTOSIZE)
+ if (resizable && priv->column_type == GTK_TREE_VIEW_COLUMN_AUTOSIZE)
gtk_tree_view_column_set_sizing (tree_column, GTK_TREE_VIEW_COLUMN_GROW_ONLY);
gtk_tree_view_column_update_button (tree_column);
@@ -1655,7 +1765,7 @@ gtk_tree_view_column_get_resizable (GtkTreeViewColumn *tree_column)
{
g_return_val_if_fail (GTK_IS_TREE_VIEW_COLUMN (tree_column), FALSE);
- return tree_column->resizable;
+ return tree_column->priv->resizable;
}
@@ -1670,9 +1780,13 @@ void
gtk_tree_view_column_set_sizing (GtkTreeViewColumn *tree_column,
GtkTreeViewColumnSizing type)
{
+ GtkTreeViewColumnPrivate *priv;
+
g_return_if_fail (GTK_IS_TREE_VIEW_COLUMN (tree_column));
- if (type == tree_column->column_type)
+ priv = tree_column->priv;
+
+ if (type == priv->column_type)
return;
if (type == GTK_TREE_VIEW_COLUMN_AUTOSIZE)
@@ -1682,13 +1796,13 @@ gtk_tree_view_column_set_sizing (GtkTreeViewColumn *tree_column,
/* I was clearly on crack when I wrote this. I'm not sure what's supposed to
* be below so I'll leave it until I figure it out.
*/
- if (tree_column->column_type == GTK_TREE_VIEW_COLUMN_AUTOSIZE &&
- tree_column->requested_width != -1)
+ if (priv->column_type == GTK_TREE_VIEW_COLUMN_AUTOSIZE &&
+ priv->requested_width != -1)
{
- gtk_tree_view_column_set_sizing (tree_column, tree_column->requested_width);
+ gtk_tree_view_column_set_sizing (tree_column, priv->requested_width);
}
#endif
- tree_column->column_type = type;
+ priv->column_type = type;
gtk_tree_view_column_update_button (tree_column);
@@ -1708,7 +1822,7 @@ gtk_tree_view_column_get_sizing (GtkTreeViewColumn *tree_column)
{
g_return_val_if_fail (GTK_IS_TREE_VIEW_COLUMN (tree_column), 0);
- return tree_column->column_type;
+ return tree_column->priv->column_type;
}
/**
@@ -1724,7 +1838,7 @@ gtk_tree_view_column_get_width (GtkTreeViewColumn *tree_column)
{
g_return_val_if_fail (GTK_IS_TREE_VIEW_COLUMN (tree_column), 0);
- return tree_column->width;
+ return tree_column->priv->width;
}
void
@@ -1732,10 +1846,14 @@ _gtk_tree_view_column_set_width (GtkTreeViewColumn *tree_column,
int width,
int internal_width)
{
+ GtkTreeViewColumnPrivate *priv;
+
g_return_if_fail (GTK_IS_TREE_VIEW_COLUMN (tree_column));
- gtk_cell_area_context_allocate (tree_column->cell_area_context, internal_width, -1);
- tree_column->width = width;
+ priv = tree_column->priv;
+
+ gtk_cell_area_context_allocate (priv->cell_area_context, internal_width, -1);
+ priv->width = width;
g_object_notify (G_OBJECT (tree_column), "width");
}
@@ -1755,17 +1873,21 @@ void
gtk_tree_view_column_set_fixed_width (GtkTreeViewColumn *tree_column,
gint fixed_width)
{
+ GtkTreeViewColumnPrivate *priv;
+
g_return_if_fail (GTK_IS_TREE_VIEW_COLUMN (tree_column));
g_return_if_fail (fixed_width > 0);
- tree_column->fixed_width = fixed_width;
- tree_column->use_resized_width = FALSE;
+ priv = tree_column->priv;
+
+ priv->fixed_width = fixed_width;
+ priv->use_resized_width = FALSE;
- if (tree_column->tree_view &&
- gtk_widget_get_realized (tree_column->tree_view) &&
- tree_column->column_type == GTK_TREE_VIEW_COLUMN_FIXED)
+ if (priv->tree_view &&
+ gtk_widget_get_realized (priv->tree_view) &&
+ priv->column_type == GTK_TREE_VIEW_COLUMN_FIXED)
{
- gtk_widget_queue_resize (tree_column->tree_view);
+ gtk_widget_queue_resize (priv->tree_view);
}
g_object_notify (G_OBJECT (tree_column), "fixed-width");
@@ -1785,7 +1907,7 @@ gtk_tree_view_column_get_fixed_width (GtkTreeViewColumn *tree_column)
{
g_return_val_if_fail (GTK_IS_TREE_VIEW_COLUMN (tree_column), 0);
- return tree_column->fixed_width;
+ return tree_column->priv->fixed_width;
}
/**
@@ -1800,32 +1922,36 @@ void
gtk_tree_view_column_set_min_width (GtkTreeViewColumn *tree_column,
gint min_width)
{
+ GtkTreeViewColumnPrivate *priv;
+
g_return_if_fail (GTK_IS_TREE_VIEW_COLUMN (tree_column));
g_return_if_fail (min_width >= -1);
- if (min_width == tree_column->min_width)
+ priv = tree_column->priv;
+
+ if (min_width == priv->min_width)
return;
- if (tree_column->visible &&
- tree_column->tree_view != NULL &&
- gtk_widget_get_realized (tree_column->tree_view))
+ if (priv->visible &&
+ priv->tree_view != NULL &&
+ gtk_widget_get_realized (priv->tree_view))
{
- if (min_width > tree_column->width)
- gtk_widget_queue_resize (tree_column->tree_view);
+ if (min_width > priv->width)
+ gtk_widget_queue_resize (priv->tree_view);
}
- tree_column->min_width = min_width;
+ priv->min_width = min_width;
g_object_freeze_notify (G_OBJECT (tree_column));
- if (tree_column->max_width != -1 && tree_column->max_width < min_width)
+ if (priv->max_width != -1 && priv->max_width < min_width)
{
- tree_column->max_width = min_width;
+ priv->max_width = min_width;
g_object_notify (G_OBJECT (tree_column), "max-width");
}
g_object_notify (G_OBJECT (tree_column), "min-width");
g_object_thaw_notify (G_OBJECT (tree_column));
- if (tree_column->column_type == GTK_TREE_VIEW_COLUMN_AUTOSIZE)
- _gtk_tree_view_column_autosize (GTK_TREE_VIEW (tree_column->tree_view),
+ if (priv->column_type == GTK_TREE_VIEW_COLUMN_AUTOSIZE)
+ _gtk_tree_view_column_autosize (GTK_TREE_VIEW (priv->tree_view),
tree_column);
}
@@ -1843,7 +1969,7 @@ gtk_tree_view_column_get_min_width (GtkTreeViewColumn *tree_column)
{
g_return_val_if_fail (GTK_IS_TREE_VIEW_COLUMN (tree_column), -1);
- return tree_column->min_width;
+ return tree_column->priv->min_width;
}
/**
@@ -1860,32 +1986,36 @@ void
gtk_tree_view_column_set_max_width (GtkTreeViewColumn *tree_column,
gint max_width)
{
+ GtkTreeViewColumnPrivate *priv;
+
g_return_if_fail (GTK_IS_TREE_VIEW_COLUMN (tree_column));
g_return_if_fail (max_width >= -1);
- if (max_width == tree_column->max_width)
+ priv = tree_column->priv;
+
+ if (max_width == priv->max_width)
return;
- if (tree_column->visible &&
- tree_column->tree_view != NULL &&
- gtk_widget_get_realized (tree_column->tree_view))
+ if (priv->visible &&
+ priv->tree_view != NULL &&
+ gtk_widget_get_realized (priv->tree_view))
{
- if (max_width != -1 && max_width < tree_column->width)
- gtk_widget_queue_resize (tree_column->tree_view);
+ if (max_width != -1 && max_width < priv->width)
+ gtk_widget_queue_resize (priv->tree_view);
}
- tree_column->max_width = max_width;
+ priv->max_width = max_width;
g_object_freeze_notify (G_OBJECT (tree_column));
- if (max_width != -1 && max_width < tree_column->min_width)
+ if (max_width != -1 && max_width < priv->min_width)
{
- tree_column->min_width = max_width;
+ priv->min_width = max_width;
g_object_notify (G_OBJECT (tree_column), "min-width");
}
g_object_notify (G_OBJECT (tree_column), "max-width");
g_object_thaw_notify (G_OBJECT (tree_column));
- if (tree_column->column_type == GTK_TREE_VIEW_COLUMN_AUTOSIZE)
- _gtk_tree_view_column_autosize (GTK_TREE_VIEW (tree_column->tree_view),
+ if (priv->column_type == GTK_TREE_VIEW_COLUMN_AUTOSIZE)
+ _gtk_tree_view_column_autosize (GTK_TREE_VIEW (priv->tree_view),
tree_column);
}
@@ -1903,7 +2033,7 @@ gtk_tree_view_column_get_max_width (GtkTreeViewColumn *tree_column)
{
g_return_val_if_fail (GTK_IS_TREE_VIEW_COLUMN (tree_column), -1);
- return tree_column->max_width;
+ return tree_column->priv->max_width;
}
/**
@@ -1916,12 +2046,16 @@ gtk_tree_view_column_get_max_width (GtkTreeViewColumn *tree_column)
void
gtk_tree_view_column_clicked (GtkTreeViewColumn *tree_column)
{
+ GtkTreeViewColumnPrivate *priv;
+
g_return_if_fail (GTK_IS_TREE_VIEW_COLUMN (tree_column));
- if (tree_column->visible &&
- tree_column->button &&
- tree_column->clickable)
- gtk_button_clicked (GTK_BUTTON (tree_column->button));
+ priv = tree_column->priv;
+
+ if (priv->visible &&
+ priv->button &&
+ priv->clickable)
+ gtk_button_clicked (GTK_BUTTON (priv->button));
}
/**
@@ -1936,13 +2070,16 @@ void
gtk_tree_view_column_set_title (GtkTreeViewColumn *tree_column,
const gchar *title)
{
- gchar *new_title;
-
+ GtkTreeViewColumnPrivate *priv;
+ gchar *new_title;
+
g_return_if_fail (GTK_IS_TREE_VIEW_COLUMN (tree_column));
+ priv = tree_column->priv;
+
new_title = g_strdup (title);
- g_free (tree_column->title);
- tree_column->title = new_title;
+ g_free (priv->title);
+ priv->title = new_title;
gtk_tree_view_column_update_button (tree_column);
g_object_notify (G_OBJECT (tree_column), "title");
@@ -1962,7 +2099,7 @@ gtk_tree_view_column_get_title (GtkTreeViewColumn *tree_column)
{
g_return_val_if_fail (GTK_IS_TREE_VIEW_COLUMN (tree_column), NULL);
- return tree_column->title;
+ return tree_column->priv->title;
}
/**
@@ -1981,25 +2118,29 @@ void
gtk_tree_view_column_set_expand (GtkTreeViewColumn *tree_column,
gboolean expand)
{
+ GtkTreeViewColumnPrivate *priv;
+
g_return_if_fail (GTK_IS_TREE_VIEW_COLUMN (tree_column));
+ priv = tree_column->priv;
+
expand = expand?TRUE:FALSE;
- if (tree_column->expand == expand)
+ if (priv->expand == expand)
return;
- tree_column->expand = expand;
+ priv->expand = expand;
- if (tree_column->visible &&
- tree_column->tree_view != NULL &&
- gtk_widget_get_realized (tree_column->tree_view))
+ if (priv->visible &&
+ priv->tree_view != NULL &&
+ gtk_widget_get_realized (priv->tree_view))
{
/* We want to continue using the original width of the
* column that includes additional space added by the user
* resizing the columns and possibly extra (expanded) space, which
* are not included in the resized width.
*/
- tree_column->use_resized_width = FALSE;
+ priv->use_resized_width = FALSE;
- gtk_widget_queue_resize (tree_column->tree_view);
+ gtk_widget_queue_resize (priv->tree_view);
}
g_object_notify (G_OBJECT (tree_column), "expand");
@@ -2020,7 +2161,7 @@ gtk_tree_view_column_get_expand (GtkTreeViewColumn *tree_column)
{
g_return_val_if_fail (GTK_IS_TREE_VIEW_COLUMN (tree_column), FALSE);
- return tree_column->expand;
+ return tree_column->priv->expand;
}
/**
@@ -2035,13 +2176,17 @@ void
gtk_tree_view_column_set_clickable (GtkTreeViewColumn *tree_column,
gboolean clickable)
{
+ GtkTreeViewColumnPrivate *priv;
+
g_return_if_fail (GTK_IS_TREE_VIEW_COLUMN (tree_column));
+ priv = tree_column->priv;
+
clickable = !! clickable;
- if (tree_column->clickable == clickable)
+ if (priv->clickable == clickable)
return;
- tree_column->clickable = clickable;
+ priv->clickable = clickable;
gtk_tree_view_column_update_button (tree_column);
g_object_notify (G_OBJECT (tree_column), "clickable");
}
@@ -2059,7 +2204,7 @@ gtk_tree_view_column_get_clickable (GtkTreeViewColumn *tree_column)
{
g_return_val_if_fail (GTK_IS_TREE_VIEW_COLUMN (tree_column), FALSE);
- return tree_column->clickable;
+ return tree_column->priv->clickable;
}
/**
@@ -2074,16 +2219,20 @@ void
gtk_tree_view_column_set_widget (GtkTreeViewColumn *tree_column,
GtkWidget *widget)
{
+ GtkTreeViewColumnPrivate *priv;
+
g_return_if_fail (GTK_IS_TREE_VIEW_COLUMN (tree_column));
g_return_if_fail (widget == NULL || GTK_IS_WIDGET (widget));
+ priv = tree_column->priv;
+
if (widget)
g_object_ref_sink (widget);
- if (tree_column->child)
- g_object_unref (tree_column->child);
+ if (priv->child)
+ g_object_unref (priv->child);
- tree_column->child = widget;
+ priv->child = widget;
gtk_tree_view_column_update_button (tree_column);
g_object_notify (G_OBJECT (tree_column), "widget");
}
@@ -2103,7 +2252,7 @@ gtk_tree_view_column_get_widget (GtkTreeViewColumn *tree_column)
{
g_return_val_if_fail (GTK_IS_TREE_VIEW_COLUMN (tree_column), NULL);
- return tree_column->child;
+ return tree_column->priv->child;
}
/**
@@ -2119,14 +2268,18 @@ void
gtk_tree_view_column_set_alignment (GtkTreeViewColumn *tree_column,
gfloat xalign)
{
+ GtkTreeViewColumnPrivate *priv;
+
g_return_if_fail (GTK_IS_TREE_VIEW_COLUMN (tree_column));
+ priv = tree_column->priv;
+
xalign = CLAMP (xalign, 0.0, 1.0);
- if (tree_column->xalign == xalign)
+ if (priv->xalign == xalign)
return;
- tree_column->xalign = xalign;
+ priv->xalign = xalign;
gtk_tree_view_column_update_button (tree_column);
g_object_notify (G_OBJECT (tree_column), "alignment");
}
@@ -2145,7 +2298,7 @@ gtk_tree_view_column_get_alignment (GtkTreeViewColumn *tree_column)
{
g_return_val_if_fail (GTK_IS_TREE_VIEW_COLUMN (tree_column), 0.5);
- return tree_column->xalign;
+ return tree_column->priv->xalign;
}
/**
@@ -2160,15 +2313,19 @@ void
gtk_tree_view_column_set_reorderable (GtkTreeViewColumn *tree_column,
gboolean reorderable)
{
+ GtkTreeViewColumnPrivate *priv;
+
g_return_if_fail (GTK_IS_TREE_VIEW_COLUMN (tree_column));
+ priv = tree_column->priv;
+
/* if (reorderable)
gtk_tree_view_column_set_clickable (tree_column, TRUE);*/
- if (tree_column->reorderable == (reorderable?TRUE:FALSE))
+ if (priv->reorderable == (reorderable?TRUE:FALSE))
return;
- tree_column->reorderable = (reorderable?TRUE:FALSE);
+ priv->reorderable = (reorderable?TRUE:FALSE);
gtk_tree_view_column_update_button (tree_column);
g_object_notify (G_OBJECT (tree_column), "reorderable");
}
@@ -2186,7 +2343,7 @@ gtk_tree_view_column_get_reorderable (GtkTreeViewColumn *tree_column)
{
g_return_val_if_fail (GTK_IS_TREE_VIEW_COLUMN (tree_column), FALSE);
- return tree_column->reorderable;
+ return tree_column->priv->reorderable;
}
@@ -2202,29 +2359,33 @@ void
gtk_tree_view_column_set_sort_column_id (GtkTreeViewColumn *tree_column,
gint sort_column_id)
{
+ GtkTreeViewColumnPrivate *priv;
+
g_return_if_fail (GTK_IS_TREE_VIEW_COLUMN (tree_column));
g_return_if_fail (sort_column_id >= -1);
- if (tree_column->sort_column_id == sort_column_id)
+ priv = tree_column->priv;
+
+ if (priv->sort_column_id == sort_column_id)
return;
- tree_column->sort_column_id = sort_column_id;
+ priv->sort_column_id = sort_column_id;
/* Handle unsetting the id */
if (sort_column_id == -1)
{
- GtkTreeModel *model = gtk_tree_view_get_model (GTK_TREE_VIEW (tree_column->tree_view));
+ GtkTreeModel *model = gtk_tree_view_get_model (GTK_TREE_VIEW (priv->tree_view));
- if (tree_column->sort_clicked_signal)
+ if (priv->sort_clicked_signal)
{
- g_signal_handler_disconnect (tree_column, tree_column->sort_clicked_signal);
- tree_column->sort_clicked_signal = 0;
+ g_signal_handler_disconnect (tree_column, priv->sort_clicked_signal);
+ priv->sort_clicked_signal = 0;
}
- if (tree_column->sort_column_changed_signal)
+ if (priv->sort_column_changed_signal)
{
- g_signal_handler_disconnect (model, tree_column->sort_column_changed_signal);
- tree_column->sort_column_changed_signal = 0;
+ g_signal_handler_disconnect (model, priv->sort_column_changed_signal);
+ priv->sort_column_changed_signal = 0;
}
gtk_tree_view_column_set_sort_order (tree_column, GTK_SORT_ASCENDING);
@@ -2236,11 +2397,11 @@ gtk_tree_view_column_set_sort_column_id (GtkTreeViewColumn *tree_column,
gtk_tree_view_column_set_clickable (tree_column, TRUE);
- if (! tree_column->sort_clicked_signal)
- tree_column->sort_clicked_signal = g_signal_connect (tree_column,
- "clicked",
- G_CALLBACK (gtk_tree_view_column_sort),
- NULL);
+ if (! priv->sort_clicked_signal)
+ priv->sort_clicked_signal = g_signal_connect (tree_column,
+ "clicked",
+ G_CALLBACK (gtk_tree_view_column_sort),
+ NULL);
gtk_tree_view_column_setup_sort_column_id_callback (tree_column);
g_object_notify (G_OBJECT (tree_column), "sort-column-id");
@@ -2262,7 +2423,7 @@ gtk_tree_view_column_get_sort_column_id (GtkTreeViewColumn *tree_column)
{
g_return_val_if_fail (GTK_IS_TREE_VIEW_COLUMN (tree_column), 0);
- return tree_column->sort_column_id;
+ return tree_column->priv->sort_column_id;
}
/**
@@ -2284,10 +2445,10 @@ gtk_tree_view_column_set_sort_indicator (GtkTreeViewColumn *tree_column,
setting = setting != FALSE;
- if (setting == tree_column->show_sort_indicator)
+ if (setting == tree_column->priv->show_sort_indicator)
return;
- tree_column->show_sort_indicator = setting;
+ tree_column->priv->show_sort_indicator = setting;
gtk_tree_view_column_update_button (tree_column);
g_object_notify (G_OBJECT (tree_column), "sort-indicator");
}
@@ -2305,7 +2466,7 @@ gtk_tree_view_column_get_sort_indicator (GtkTreeViewColumn *tree_column)
{
g_return_val_if_fail (GTK_IS_TREE_VIEW_COLUMN (tree_column), FALSE);
- return tree_column->show_sort_indicator;
+ return tree_column->priv->show_sort_indicator;
}
/**
@@ -2331,10 +2492,10 @@ gtk_tree_view_column_set_sort_order (GtkTreeViewColumn *tree_column,
{
g_return_if_fail (GTK_IS_TREE_VIEW_COLUMN (tree_column));
- if (order == tree_column->sort_order)
+ if (order == tree_column->priv->sort_order)
return;
- tree_column->sort_order = order;
+ tree_column->priv->sort_order = order;
gtk_tree_view_column_update_button (tree_column);
g_object_notify (G_OBJECT (tree_column), "sort-order");
}
@@ -2352,7 +2513,7 @@ gtk_tree_view_column_get_sort_order (GtkTreeViewColumn *tree_column)
{
g_return_val_if_fail (GTK_IS_TREE_VIEW_COLUMN (tree_column), 0);
- return tree_column->sort_order;
+ return tree_column->priv->sort_order;
}
/**
@@ -2380,7 +2541,7 @@ gtk_tree_view_column_cell_set_cell_data (GtkTreeViewColumn *tree_column,
if (tree_model == NULL)
return;
- gtk_cell_area_apply_attributes (tree_column->cell_area, tree_model, iter,
+ gtk_cell_area_apply_attributes (tree_column->priv->cell_area, tree_model, iter,
is_expander, is_expanded);
}
@@ -2404,10 +2565,13 @@ gtk_tree_view_column_cell_get_size (GtkTreeViewColumn *tree_column,
gint *width,
gint *height)
{
+ GtkTreeViewColumnPrivate *priv;
int focus_line_width;
g_return_if_fail (GTK_IS_TREE_VIEW_COLUMN (tree_column));
+ priv = tree_column->priv;
+
if (height)
* height = 0;
if (width)
@@ -2421,26 +2585,26 @@ gtk_tree_view_column_cell_get_size (GtkTreeViewColumn *tree_column,
* get less width than expected (due to subtraction of focus_line_width?)
* and will unnecessarily wrap.
*/
- gtk_widget_style_get (tree_column->tree_view,
+ gtk_widget_style_get (priv->tree_view,
"focus-line-width", &focus_line_width,
NULL);
- g_signal_handler_block (tree_column->cell_area_context,
- tree_column->context_changed_signal);
+ g_signal_handler_block (priv->cell_area_context,
+ priv->context_changed_signal);
- gtk_cell_area_get_preferred_width (tree_column->cell_area,
- tree_column->cell_area_context,
- tree_column->tree_view,
+ gtk_cell_area_get_preferred_width (priv->cell_area,
+ priv->cell_area_context,
+ priv->tree_view,
width, NULL);
- gtk_cell_area_get_preferred_height_for_width (tree_column->cell_area,
- tree_column->cell_area_context,
- tree_column->tree_view,
+ gtk_cell_area_get_preferred_height_for_width (priv->cell_area,
+ priv->cell_area_context,
+ priv->tree_view,
*width + focus_line_width * 2,
height,
NULL);
- g_signal_handler_unblock (tree_column->cell_area_context,
- tree_column->context_changed_signal);
+ g_signal_handler_unblock (priv->cell_area_context,
+ priv->context_changed_signal);
}
@@ -2463,15 +2627,19 @@ _gtk_tree_view_column_cell_render (GtkTreeViewColumn *tree_column,
guint flags,
gboolean draw_focus)
{
+ GtkTreeViewColumnPrivate *priv;
+
g_return_if_fail (GTK_IS_TREE_VIEW_COLUMN (tree_column));
g_return_if_fail (cr != NULL);
g_return_if_fail (background_area != NULL);
g_return_if_fail (cell_area != NULL);
+ priv = tree_column->priv;
+
cairo_save (cr);
- gtk_cell_area_render (tree_column->cell_area, tree_column->cell_area_context,
- tree_column->tree_view, cr,
+ gtk_cell_area_render (priv->cell_area, priv->cell_area_context,
+ priv->tree_view, cr,
background_area, cell_area, flags,
draw_focus);
@@ -2487,15 +2655,29 @@ _gtk_tree_view_column_cell_event (GtkTreeViewColumn *tree_column,
const GdkRectangle *cell_area,
guint flags)
{
+ GtkTreeViewColumnPrivate *priv;
+
g_return_val_if_fail (GTK_IS_TREE_VIEW_COLUMN (tree_column), FALSE);
+ priv = tree_column->priv;
+
/* FIXME: Should we pass background area here as well?
* What will happen to the path_string and editable widget
* variables?
+ *
+ * Answer, No dont pass background area... editable widgets
+ * grab the pointer and keyboard so the treeview doesnt
+ * recieve these events while editable widgets are editing.
+ *
+ * Also it's important that gtk_cell_area_apply_attributes be
+ * called before passing the event to the cell (maybe we need to
+ * instead use the path_string here to apply the attributes ?,
+ * if the attributes are applied, the underlying CellArea knows
+ * the path string, which is expected when handling events).
*/
- return gtk_cell_area_event (tree_column->cell_area,
- tree_column->cell_area_context,
- tree_column->tree_view,
+ return gtk_cell_area_event (priv->cell_area,
+ priv->cell_area_context,
+ priv->tree_view,
event,
cell_area,
flags);
@@ -2529,8 +2711,9 @@ _gtk_tree_view_column_cell_focus (GtkTreeViewColumn *tree_column,
{
gboolean rtl;
GtkDirectionType direction = 0;
+ GtkTreeViewColumnPrivate *priv = tree_column->priv;
- rtl = gtk_widget_get_direction (GTK_WIDGET (tree_column->tree_view)) == GTK_TEXT_DIR_RTL;
+ rtl = gtk_widget_get_direction (priv->tree_view) == GTK_TEXT_DIR_RTL;
switch (count)
{
@@ -2546,9 +2729,11 @@ _gtk_tree_view_column_cell_focus (GtkTreeViewColumn *tree_column,
/* if we are the current focus column and have multiple editable cells,
* try to select the next one, else move the focus to the next column
*/
- if (GTK_TREE_VIEW (tree_column->tree_view)->priv->focus_column == tree_column)
+
+ /* XXX Access to GtkTreeViewPrivate */
+ if (GTK_TREE_VIEW (priv->tree_view)->priv->focus_column == tree_column)
{
- if (gtk_cell_area_focus (tree_column->cell_area, direction))
+ if (gtk_cell_area_focus (priv->cell_area, direction))
/* Focus stays in this column, so we are done */
return TRUE;
@@ -2556,18 +2741,18 @@ _gtk_tree_view_column_cell_focus (GtkTreeViewColumn *tree_column,
if (count == -1 && !left)
{
direction = GTK_DIR_RIGHT;
- gtk_cell_area_focus (tree_column->cell_area, direction);
+ gtk_cell_area_focus (priv->cell_area, direction);
}
else if (count == 1 && !right)
{
direction = GTK_DIR_LEFT;
- gtk_cell_area_focus (tree_column->cell_area, direction);
+ gtk_cell_area_focus (priv->cell_area, direction);
}
return FALSE;
}
- return gtk_cell_area_focus (tree_column->cell_area, direction);
+ return gtk_cell_area_focus (priv->cell_area, direction);
}
/**
@@ -2585,10 +2770,13 @@ gtk_tree_view_column_cell_is_visible (GtkTreeViewColumn *tree_column)
{
GList *list;
GList *cells;
+ GtkTreeViewColumnPrivate *priv;
g_return_val_if_fail (GTK_IS_TREE_VIEW_COLUMN (tree_column), FALSE);
- cells = gtk_cell_layout_get_cells (GTK_CELL_LAYOUT (tree_column->cell_area));
+ priv = tree_column->priv;
+
+ cells = gtk_cell_layout_get_cells (GTK_CELL_LAYOUT (priv->cell_area));
for (list = cells; list; list = list->next)
{
if (gtk_cell_renderer_get_visible (list->data))
@@ -2620,28 +2808,37 @@ gtk_tree_view_column_focus_cell (GtkTreeViewColumn *tree_column,
g_return_if_fail (GTK_IS_TREE_VIEW_COLUMN (tree_column));
g_return_if_fail (GTK_IS_CELL_RENDERER (cell));
- gtk_cell_area_set_focus_cell (tree_column->cell_area, cell);
+ gtk_cell_area_set_focus_cell (tree_column->priv->cell_area, cell);
}
void
_gtk_tree_view_column_cell_set_dirty (GtkTreeViewColumn *tree_column,
gboolean install_handler)
{
- tree_column->dirty = TRUE;
- tree_column->requested_width = -1;
- tree_column->width = 0;
+ GtkTreeViewColumnPrivate *priv = tree_column->priv;
+
+ priv->dirty = TRUE;
+ priv->requested_width = -1;
+ priv->width = 0;
- if (tree_column->tree_view &&
- gtk_widget_get_realized (tree_column->tree_view))
+ if (priv->tree_view &&
+ gtk_widget_get_realized (priv->tree_view))
{
if (install_handler)
- _gtk_tree_view_install_mark_rows_col_dirty (GTK_TREE_VIEW (tree_column->tree_view));
+ _gtk_tree_view_install_mark_rows_col_dirty (GTK_TREE_VIEW (priv->tree_view));
else
- GTK_TREE_VIEW (tree_column->tree_view)->priv->mark_rows_col_dirty = TRUE;
- gtk_widget_queue_resize (tree_column->tree_view);
+ /* XXX Access to GtkTreeViewPrivate */
+ GTK_TREE_VIEW (priv->tree_view)->priv->mark_rows_col_dirty = TRUE;
+ gtk_widget_queue_resize (priv->tree_view);
}
}
+gboolean
+_gtk_tree_view_column_cell_get_dirty (GtkTreeViewColumn *tree_column)
+{
+ return tree_column->priv->dirty;
+}
+
/**
* gtk_tree_view_column_cell_get_position:
* @tree_column: a #GtkTreeViewColumn
@@ -2662,13 +2859,19 @@ gtk_tree_view_column_cell_get_position (GtkTreeViewColumn *tree_column,
gint *start_pos,
gint *width)
{
+ GtkTreeViewColumnPrivate *priv;
GdkRectangle zero_cell_area = { 0, };
GdkRectangle allocation;
+ g_return_val_if_fail (GTK_IS_TREE_VIEW_COLUMN (tree_column), FALSE);
+ g_return_val_if_fail (GTK_IS_CELL_RENDERER (cell_renderer), FALSE);
+
+ priv = tree_column->priv;
+
/* FIXME: Could use a boolean return value for invalid cells */
- gtk_cell_area_get_cell_allocation (tree_column->cell_area,
- tree_column->cell_area_context,
- tree_column->tree_view,
+ gtk_cell_area_get_cell_allocation (priv->cell_area,
+ priv->cell_area_context,
+ priv->tree_view,
cell_renderer,
&zero_cell_area,
&allocation);
@@ -2695,7 +2898,7 @@ gtk_tree_view_column_queue_resize (GtkTreeViewColumn *tree_column)
{
g_return_if_fail (GTK_IS_TREE_VIEW_COLUMN (tree_column));
- if (tree_column->tree_view)
+ if (tree_column->priv->tree_view)
_gtk_tree_view_column_cell_set_dirty (tree_column, TRUE);
}
@@ -2717,5 +2920,80 @@ gtk_tree_view_column_get_tree_view (GtkTreeViewColumn *tree_column)
{
g_return_val_if_fail (GTK_IS_TREE_VIEW_COLUMN (tree_column), NULL);
- return tree_column->tree_view;
+ return tree_column->priv->tree_view;
+}
+
+/**
+ * gtk_tree_view_column_get_button:
+ * @tree_column: A #GtkTreeViewColumn
+ *
+ * Returns the button used in the treeview column header
+ *
+ * Return value: (transfer none): The button for the column header.
+ *
+ * Since: 3.0
+ */
+GtkWidget *
+gtk_tree_view_column_get_button (GtkTreeViewColumn *tree_column)
+{
+ g_return_val_if_fail (GTK_IS_TREE_VIEW_COLUMN (tree_column), NULL);
+
+ return tree_column->priv->button;
+}
+
+GdkWindow *
+_gtk_tree_view_column_get_window (GtkTreeViewColumn *column)
+{
+ return column->priv->window;
+}
+
+void
+_gtk_tree_view_column_set_requested_width (GtkTreeViewColumn *column,
+ gint width)
+{
+ column->priv->requested_width = width;
+}
+
+gint
+_gtk_tree_view_column_get_requested_width (GtkTreeViewColumn *column)
+{
+ return column->priv->requested_width;
+}
+
+void
+_gtk_tree_view_column_set_resized_width (GtkTreeViewColumn *column,
+ gint width)
+{
+ column->priv->resized_width = width;
+}
+
+gint
+_gtk_tree_view_column_get_resized_width (GtkTreeViewColumn *column)
+{
+ return column->priv->resized_width;
+}
+
+void
+_gtk_tree_view_column_set_use_resized_width (GtkTreeViewColumn *column,
+ gboolean use_resized_width)
+{
+ column->priv->use_resized_width = use_resized_width;
+}
+
+gboolean
+_gtk_tree_view_column_get_use_resized_width (GtkTreeViewColumn *column)
+{
+ return column->priv->use_resized_width;
+}
+
+gint
+_gtk_tree_view_column_get_drag_x (GtkTreeViewColumn *column)
+{
+ return column->priv->drag_x;
+}
+
+GtkCellAreaContext *
+_gtk_tree_view_column_get_context (GtkTreeViewColumn *column)
+{
+ return column->priv->cell_area_context;
}
diff --git a/gtk/gtktreeviewcolumn.h b/gtk/gtktreeviewcolumn.h
index 631052b..ac2807b 100644
--- a/gtk/gtktreeviewcolumn.h
+++ b/gtk/gtktreeviewcolumn.h
@@ -40,8 +40,9 @@ G_BEGIN_DECLS
#define GTK_IS_TREE_VIEW_COLUMN_CLASS(klass) (G_TYPE_CHECK_CLASS_TYPE ((klass), GTK_TYPE_TREE_VIEW_COLUMN))
#define GTK_TREE_VIEW_COLUMN_GET_CLASS(obj) (G_TYPE_INSTANCE_GET_CLASS ((obj), GTK_TYPE_TREE_VIEW_COLUMN, GtkTreeViewColumnClass))
-typedef struct _GtkTreeViewColumn GtkTreeViewColumn;
-typedef struct _GtkTreeViewColumnClass GtkTreeViewColumnClass;
+typedef struct _GtkTreeViewColumn GtkTreeViewColumn;
+typedef struct _GtkTreeViewColumnClass GtkTreeViewColumnClass;
+typedef struct _GtkTreeViewColumnPrivate GtkTreeViewColumnPrivate;
/**
* GtkTreeViewColumnSizing:
@@ -86,56 +87,7 @@ struct _GtkTreeViewColumn
{
GInitiallyUnowned parent_instance;
- GtkWidget *GSEAL (tree_view);
- GtkWidget *GSEAL (button);
- GtkWidget *GSEAL (child);
- GtkWidget *GSEAL (arrow);
- GtkWidget *GSEAL (alignment);
- GdkWindow *GSEAL (window);
- gfloat GSEAL (xalign);
- gulong GSEAL (property_changed_signal);
-
- /* Sizing fields */
- /* see gtk+/doc/tree-column-sizing.txt for more information on them */
- GtkTreeViewColumnSizing GSEAL (column_type);
- gint GSEAL (requested_width);
- gint GSEAL (button_request);
- gint GSEAL (resized_width);
- gint GSEAL (width);
- gint GSEAL (fixed_width);
- gint GSEAL (min_width);
- gint GSEAL (max_width);
-
- /* dragging columns */
- gint GSEAL (drag_x);
- gint GSEAL (drag_y);
-
- gchar *GSEAL (title);
-
- /* Sorting */
- gulong GSEAL (sort_clicked_signal);
- gulong GSEAL (sort_column_changed_signal);
- gint GSEAL (sort_column_id);
- GtkSortType GSEAL (sort_order);
-
- /* Cell area */
- GtkCellArea *cell_area;
- GtkCellAreaContext *cell_area_context;
-
- gulong add_editable_signal;
- gulong remove_editable_signal;
- gulong context_changed_signal;
-
- /* Flags */
- guint GSEAL (visible) : 1;
- guint GSEAL (resizable) : 1;
- guint GSEAL (clickable) : 1;
- guint GSEAL (dirty) : 1;
- guint GSEAL (show_sort_indicator) : 1;
- guint GSEAL (maybe_reordered) : 1;
- guint GSEAL (reorderable) : 1;
- guint GSEAL (use_resized_width) : 1;
- guint GSEAL (expand) : 1;
+ GtkTreeViewColumnPrivate *priv;
};
struct _GtkTreeViewColumnClass
@@ -262,6 +214,7 @@ gboolean gtk_tree_view_column_cell_get_position (GtkTreeViewCol
gint *width);
void gtk_tree_view_column_queue_resize (GtkTreeViewColumn *tree_column);
GtkWidget *gtk_tree_view_column_get_tree_view (GtkTreeViewColumn *tree_column);
+GtkWidget *gtk_tree_view_column_get_button (GtkTreeViewColumn *tree_column);
G_END_DECLS
diff --git a/modules/other/gail/gailtreeview.c b/modules/other/gail/gailtreeview.c
index 60de100..f1b5063 100644
--- a/modules/other/gail/gailtreeview.c
+++ b/modules/other/gail/gailtreeview.c
@@ -4651,7 +4651,7 @@ get_header_from_column (GtkTreeViewColumn *tv_col)
/* If the user has not set a header object, grab the column */
/* header object defined by the GtkTreeView */
- header_widget = tv_col->button;
+ header_widget = gtk_tree_view_column_get_button (tv_col);
if (header_widget)
{
diff --git a/tests/testtooltips.c b/tests/testtooltips.c
index 9cb1fcc..42f02e6 100644
--- a/tests/testtooltips.c
+++ b/tests/testtooltips.c
@@ -359,7 +359,7 @@ main (int argc, char *argv[])
/* Set a tooltip on the column */
column = gtk_tree_view_get_column (GTK_TREE_VIEW (tree_view), 0);
gtk_tree_view_column_set_clickable (column, TRUE);
- g_object_set (column->button, "tooltip-text", "Header", NULL);
+ g_object_set (gtk_tree_view_column_get_button (column), "tooltip-text", "Header", NULL);
gtk_box_pack_start (GTK_BOX (box), tree_view, FALSE, FALSE, 2);
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]