Commit 85267e92 authored by Havoc Pennington's avatar Havoc Pennington Committed by Havoc Pennington

don't draw if label->layout is NULL due to a pending resize

2001-01-09  Havoc Pennington  <hp@redhat.com>

	* gtk/gtklabel.c (gtk_label_expose): don't draw if label->layout
	is NULL due to a pending resize

	* gtk/gtktreeview.c (gtk_tree_view_check_dirty): don't set the
	column width to values less than 1

	* gtk/gtktreeviewcolumn.c (gtk_tree_view_column_set_width): clamp
	width to be between min/max width, and still set the width
	even if autosize is turned on, so the tree view can use this
	function in order to autosize.
	(gtk_tree_view_column_init): set initial width to 1 not 0

	* gtk/gtktreeview.c (gtk_tree_view_size_request_buttons): use
	setter function to modify column width, so we get notification
	(gtk_tree_view_insert_iter_height): ditto
	(gtk_tree_view_calc_size): ditto
	(gtk_tree_view_check_dirty): ditto

	* gtk/gtktreeviewcolumn.c (gtk_tree_view_column_class_init): Add
	properties to change all the interesting attributes of the tree
	view column.
	(gtk_tree_view_column_set_header_clickable): rename set_clickable
	(gtk_tree_view_column_get_clickable): add
	(gtk_tree_view_column_set_cell_renderer): don't unset the current
	attributes; assume a cell renderer with equivalent object
	properties has been swapped in. Do g_object_notify().
	(gtk_tree_view_column_set_visible): g_object_notify
	(gtk_tree_view_column_get_sizing): rename from get_col_type
	(gtk_tree_view_column_set_sizing): g_object_notify
	(gtk_tree_view_column_set_width): add g_object_notify
	(gtk_tree_view_column_set_min_width): ditto
	(gtk_tree_view_column_set_max_width): ditto
	(gtk_tree_view_column_set_title): ditto
	(gtk_tree_view_column_set_clickable): ditto
	(gtk_tree_view_column_set_widget): ditto
	(gtk_tree_view_column_set_justification): ditto
parent 637c61da
2001-01-09 Havoc Pennington <hp@redhat.com>
* gtk/gtklabel.c (gtk_label_expose): don't draw if label->layout
is NULL due to a pending resize
* gtk/gtktreeview.c (gtk_tree_view_check_dirty): don't set the
column width to values less than 1
* gtk/gtktreeviewcolumn.c (gtk_tree_view_column_set_width): clamp
width to be between min/max width, and still set the width
even if autosize is turned on, so the tree view can use this
function in order to autosize.
(gtk_tree_view_column_init): set initial width to 1 not 0
* gtk/gtktreeview.c (gtk_tree_view_size_request_buttons): use
setter function to modify column width, so we get notification
(gtk_tree_view_insert_iter_height): ditto
(gtk_tree_view_calc_size): ditto
(gtk_tree_view_check_dirty): ditto
* gtk/gtktreeviewcolumn.c (gtk_tree_view_column_class_init): Add
properties to change all the interesting attributes of the tree
view column.
(gtk_tree_view_column_set_header_clickable): rename set_clickable
(gtk_tree_view_column_get_clickable): add
(gtk_tree_view_column_set_cell_renderer): don't unset the current
attributes; assume a cell renderer with equivalent object
properties has been swapped in. Do g_object_notify().
(gtk_tree_view_column_set_visible): g_object_notify
(gtk_tree_view_column_get_sizing): rename from get_col_type
(gtk_tree_view_column_set_sizing): g_object_notify
(gtk_tree_view_column_set_width): add g_object_notify
(gtk_tree_view_column_set_min_width): ditto
(gtk_tree_view_column_set_max_width): ditto
(gtk_tree_view_column_set_title): ditto
(gtk_tree_view_column_set_clickable): ditto
(gtk_tree_view_column_set_widget): ditto
(gtk_tree_view_column_set_justification): ditto
2001-01-09 Havoc Pennington <hp@redhat.com>
* gtk/gtktreeview.c (gtk_tree_view_check_dirty): handle case where
......
2001-01-09 Havoc Pennington <hp@redhat.com>
* gtk/gtklabel.c (gtk_label_expose): don't draw if label->layout
is NULL due to a pending resize
* gtk/gtktreeview.c (gtk_tree_view_check_dirty): don't set the
column width to values less than 1
* gtk/gtktreeviewcolumn.c (gtk_tree_view_column_set_width): clamp
width to be between min/max width, and still set the width
even if autosize is turned on, so the tree view can use this
function in order to autosize.
(gtk_tree_view_column_init): set initial width to 1 not 0
* gtk/gtktreeview.c (gtk_tree_view_size_request_buttons): use
setter function to modify column width, so we get notification
(gtk_tree_view_insert_iter_height): ditto
(gtk_tree_view_calc_size): ditto
(gtk_tree_view_check_dirty): ditto
* gtk/gtktreeviewcolumn.c (gtk_tree_view_column_class_init): Add
properties to change all the interesting attributes of the tree
view column.
(gtk_tree_view_column_set_header_clickable): rename set_clickable
(gtk_tree_view_column_get_clickable): add
(gtk_tree_view_column_set_cell_renderer): don't unset the current
attributes; assume a cell renderer with equivalent object
properties has been swapped in. Do g_object_notify().
(gtk_tree_view_column_set_visible): g_object_notify
(gtk_tree_view_column_get_sizing): rename from get_col_type
(gtk_tree_view_column_set_sizing): g_object_notify
(gtk_tree_view_column_set_width): add g_object_notify
(gtk_tree_view_column_set_min_width): ditto
(gtk_tree_view_column_set_max_width): ditto
(gtk_tree_view_column_set_title): ditto
(gtk_tree_view_column_set_clickable): ditto
(gtk_tree_view_column_set_widget): ditto
(gtk_tree_view_column_set_justification): ditto
2001-01-09 Havoc Pennington <hp@redhat.com>
* gtk/gtktreeview.c (gtk_tree_view_check_dirty): handle case where
......
2001-01-09 Havoc Pennington <hp@redhat.com>
* gtk/gtklabel.c (gtk_label_expose): don't draw if label->layout
is NULL due to a pending resize
* gtk/gtktreeview.c (gtk_tree_view_check_dirty): don't set the
column width to values less than 1
* gtk/gtktreeviewcolumn.c (gtk_tree_view_column_set_width): clamp
width to be between min/max width, and still set the width
even if autosize is turned on, so the tree view can use this
function in order to autosize.
(gtk_tree_view_column_init): set initial width to 1 not 0
* gtk/gtktreeview.c (gtk_tree_view_size_request_buttons): use
setter function to modify column width, so we get notification
(gtk_tree_view_insert_iter_height): ditto
(gtk_tree_view_calc_size): ditto
(gtk_tree_view_check_dirty): ditto
* gtk/gtktreeviewcolumn.c (gtk_tree_view_column_class_init): Add
properties to change all the interesting attributes of the tree
view column.
(gtk_tree_view_column_set_header_clickable): rename set_clickable
(gtk_tree_view_column_get_clickable): add
(gtk_tree_view_column_set_cell_renderer): don't unset the current
attributes; assume a cell renderer with equivalent object
properties has been swapped in. Do g_object_notify().
(gtk_tree_view_column_set_visible): g_object_notify
(gtk_tree_view_column_get_sizing): rename from get_col_type
(gtk_tree_view_column_set_sizing): g_object_notify
(gtk_tree_view_column_set_width): add g_object_notify
(gtk_tree_view_column_set_min_width): ditto
(gtk_tree_view_column_set_max_width): ditto
(gtk_tree_view_column_set_title): ditto
(gtk_tree_view_column_set_clickable): ditto
(gtk_tree_view_column_set_widget): ditto
(gtk_tree_view_column_set_justification): ditto
2001-01-09 Havoc Pennington <hp@redhat.com>
* gtk/gtktreeview.c (gtk_tree_view_check_dirty): handle case where
......
2001-01-09 Havoc Pennington <hp@redhat.com>
* gtk/gtklabel.c (gtk_label_expose): don't draw if label->layout
is NULL due to a pending resize
* gtk/gtktreeview.c (gtk_tree_view_check_dirty): don't set the
column width to values less than 1
* gtk/gtktreeviewcolumn.c (gtk_tree_view_column_set_width): clamp
width to be between min/max width, and still set the width
even if autosize is turned on, so the tree view can use this
function in order to autosize.
(gtk_tree_view_column_init): set initial width to 1 not 0
* gtk/gtktreeview.c (gtk_tree_view_size_request_buttons): use
setter function to modify column width, so we get notification
(gtk_tree_view_insert_iter_height): ditto
(gtk_tree_view_calc_size): ditto
(gtk_tree_view_check_dirty): ditto
* gtk/gtktreeviewcolumn.c (gtk_tree_view_column_class_init): Add
properties to change all the interesting attributes of the tree
view column.
(gtk_tree_view_column_set_header_clickable): rename set_clickable
(gtk_tree_view_column_get_clickable): add
(gtk_tree_view_column_set_cell_renderer): don't unset the current
attributes; assume a cell renderer with equivalent object
properties has been swapped in. Do g_object_notify().
(gtk_tree_view_column_set_visible): g_object_notify
(gtk_tree_view_column_get_sizing): rename from get_col_type
(gtk_tree_view_column_set_sizing): g_object_notify
(gtk_tree_view_column_set_width): add g_object_notify
(gtk_tree_view_column_set_min_width): ditto
(gtk_tree_view_column_set_max_width): ditto
(gtk_tree_view_column_set_title): ditto
(gtk_tree_view_column_set_clickable): ditto
(gtk_tree_view_column_set_widget): ditto
(gtk_tree_view_column_set_justification): ditto
2001-01-09 Havoc Pennington <hp@redhat.com>
* gtk/gtktreeview.c (gtk_tree_view_check_dirty): handle case where
......
2001-01-09 Havoc Pennington <hp@redhat.com>
* gtk/gtklabel.c (gtk_label_expose): don't draw if label->layout
is NULL due to a pending resize
* gtk/gtktreeview.c (gtk_tree_view_check_dirty): don't set the
column width to values less than 1
* gtk/gtktreeviewcolumn.c (gtk_tree_view_column_set_width): clamp
width to be between min/max width, and still set the width
even if autosize is turned on, so the tree view can use this
function in order to autosize.
(gtk_tree_view_column_init): set initial width to 1 not 0
* gtk/gtktreeview.c (gtk_tree_view_size_request_buttons): use
setter function to modify column width, so we get notification
(gtk_tree_view_insert_iter_height): ditto
(gtk_tree_view_calc_size): ditto
(gtk_tree_view_check_dirty): ditto
* gtk/gtktreeviewcolumn.c (gtk_tree_view_column_class_init): Add
properties to change all the interesting attributes of the tree
view column.
(gtk_tree_view_column_set_header_clickable): rename set_clickable
(gtk_tree_view_column_get_clickable): add
(gtk_tree_view_column_set_cell_renderer): don't unset the current
attributes; assume a cell renderer with equivalent object
properties has been swapped in. Do g_object_notify().
(gtk_tree_view_column_set_visible): g_object_notify
(gtk_tree_view_column_get_sizing): rename from get_col_type
(gtk_tree_view_column_set_sizing): g_object_notify
(gtk_tree_view_column_set_width): add g_object_notify
(gtk_tree_view_column_set_min_width): ditto
(gtk_tree_view_column_set_max_width): ditto
(gtk_tree_view_column_set_title): ditto
(gtk_tree_view_column_set_clickable): ditto
(gtk_tree_view_column_set_widget): ditto
(gtk_tree_view_column_set_justification): ditto
2001-01-09 Havoc Pennington <hp@redhat.com>
* gtk/gtktreeview.c (gtk_tree_view_check_dirty): handle case where
......
2001-01-09 Havoc Pennington <hp@redhat.com>
* gtk/gtklabel.c (gtk_label_expose): don't draw if label->layout
is NULL due to a pending resize
* gtk/gtktreeview.c (gtk_tree_view_check_dirty): don't set the
column width to values less than 1
* gtk/gtktreeviewcolumn.c (gtk_tree_view_column_set_width): clamp
width to be between min/max width, and still set the width
even if autosize is turned on, so the tree view can use this
function in order to autosize.
(gtk_tree_view_column_init): set initial width to 1 not 0
* gtk/gtktreeview.c (gtk_tree_view_size_request_buttons): use
setter function to modify column width, so we get notification
(gtk_tree_view_insert_iter_height): ditto
(gtk_tree_view_calc_size): ditto
(gtk_tree_view_check_dirty): ditto
* gtk/gtktreeviewcolumn.c (gtk_tree_view_column_class_init): Add
properties to change all the interesting attributes of the tree
view column.
(gtk_tree_view_column_set_header_clickable): rename set_clickable
(gtk_tree_view_column_get_clickable): add
(gtk_tree_view_column_set_cell_renderer): don't unset the current
attributes; assume a cell renderer with equivalent object
properties has been swapped in. Do g_object_notify().
(gtk_tree_view_column_set_visible): g_object_notify
(gtk_tree_view_column_get_sizing): rename from get_col_type
(gtk_tree_view_column_set_sizing): g_object_notify
(gtk_tree_view_column_set_width): add g_object_notify
(gtk_tree_view_column_set_min_width): ditto
(gtk_tree_view_column_set_max_width): ditto
(gtk_tree_view_column_set_title): ditto
(gtk_tree_view_column_set_clickable): ditto
(gtk_tree_view_column_set_widget): ditto
(gtk_tree_view_column_set_justification): ditto
2001-01-09 Havoc Pennington <hp@redhat.com>
* gtk/gtktreeview.c (gtk_tree_view_check_dirty): handle case where
......
2001-01-09 Havoc Pennington <hp@redhat.com>
* gtk/gtklabel.c (gtk_label_expose): don't draw if label->layout
is NULL due to a pending resize
* gtk/gtktreeview.c (gtk_tree_view_check_dirty): don't set the
column width to values less than 1
* gtk/gtktreeviewcolumn.c (gtk_tree_view_column_set_width): clamp
width to be between min/max width, and still set the width
even if autosize is turned on, so the tree view can use this
function in order to autosize.
(gtk_tree_view_column_init): set initial width to 1 not 0
* gtk/gtktreeview.c (gtk_tree_view_size_request_buttons): use
setter function to modify column width, so we get notification
(gtk_tree_view_insert_iter_height): ditto
(gtk_tree_view_calc_size): ditto
(gtk_tree_view_check_dirty): ditto
* gtk/gtktreeviewcolumn.c (gtk_tree_view_column_class_init): Add
properties to change all the interesting attributes of the tree
view column.
(gtk_tree_view_column_set_header_clickable): rename set_clickable
(gtk_tree_view_column_get_clickable): add
(gtk_tree_view_column_set_cell_renderer): don't unset the current
attributes; assume a cell renderer with equivalent object
properties has been swapped in. Do g_object_notify().
(gtk_tree_view_column_set_visible): g_object_notify
(gtk_tree_view_column_get_sizing): rename from get_col_type
(gtk_tree_view_column_set_sizing): g_object_notify
(gtk_tree_view_column_set_width): add g_object_notify
(gtk_tree_view_column_set_min_width): ditto
(gtk_tree_view_column_set_max_width): ditto
(gtk_tree_view_column_set_title): ditto
(gtk_tree_view_column_set_clickable): ditto
(gtk_tree_view_column_set_widget): ditto
(gtk_tree_view_column_set_justification): ditto
2001-01-09 Havoc Pennington <hp@redhat.com>
* gtk/gtktreeview.c (gtk_tree_view_check_dirty): handle case where
......
......@@ -711,9 +711,13 @@ gtk_label_expose (GtkWidget *widget,
g_return_val_if_fail (event != NULL, FALSE);
label = GTK_LABEL (widget);
/* if label->layout is NULL it means we got a set_text since
* our last size request, so a resize should be queued,
* which means a full expose is in the queue anyway.
*/
if (GTK_WIDGET_VISIBLE (widget) && GTK_WIDGET_MAPPED (widget) &&
label->label && (*label->label != '\0'))
label->layout && label->label && (*label->label != '\0'))
{
misc = GTK_MISC (widget);
......
......@@ -520,7 +520,8 @@ gtk_tree_view_size_request_buttons (GtkTreeView *tree_view)
gtk_widget_size_request (column->button, &requisition);
column->width = MAX (column->width, requisition.width);
gtk_tree_view_column_set_width (column,
MAX (column->width, requisition.width));
tree_view->priv->header_height = MAX (tree_view->priv->header_height, requisition.height);
}
}
......@@ -2215,9 +2216,11 @@ gtk_tree_view_insert_iter_height (GtkTreeView *tree_view,
max_height = MAX (max_height, TREE_VIEW_VERTICAL_SEPARATOR + height);
if (first == TRUE && TREE_VIEW_DRAW_EXPANDERS (tree_view))
column->width = MAX (column->width, depth * tree_view->priv->tab_offset + width);
gtk_tree_view_column_set_width (column,
MAX (column->width, depth * tree_view->priv->tab_offset + width));
else
column->width = MAX (column->width, width);
gtk_tree_view_column_set_width (column,
MAX (column->width, width));
first = FALSE;
}
......@@ -2311,9 +2314,10 @@ gtk_tree_view_calc_size (GtkTreeView *tree_view,
continue;
if (i == 0 && TREE_VIEW_DRAW_EXPANDERS (tree_view))
column->width = MAX (column->width, depth * tree_view->priv->tab_offset + width);
gtk_tree_view_column_set_width (column,
MAX (column->width, depth * tree_view->priv->tab_offset + width));
else
column->width = MAX (column->width, width);
gtk_tree_view_column_set_width (column, MAX (column->width, width));
}
_gtk_rbtree_node_set_height (tree, temp, max_height);
if (temp->children != NULL &&
......@@ -2445,7 +2449,7 @@ gtk_tree_view_check_dirty (GtkTreeView *tree_view)
dirty = TRUE;
if (column->column_type == GTK_TREE_VIEW_COLUMN_AUTOSIZE)
{
column->width = column->button->requisition.width;
gtk_tree_view_column_set_width (column, MAX (column->button->requisition.width, 1));
}
}
}
......@@ -3279,9 +3283,6 @@ gtk_tree_view_columns_autosize (GtkTreeView *tree_view)
gtk_widget_queue_resize (GTK_WIDGET (tree_view));
}
/* FIXME let's rename this to be "interactive" or something,
* "active" is confusing since it also is a widget state
*/
/**
* gtk_tree_view_set_headers_clickable:
* @tree_view: A #GtkTreeView.
......@@ -3300,7 +3301,7 @@ gtk_tree_view_set_headers_clickable (GtkTreeView *tree_view,
g_return_if_fail (tree_view->priv->model != NULL);
for (list = tree_view->priv->columns; list; list = list->next)
gtk_tree_view_column_set_header_clickable (GTK_TREE_VIEW_COLUMN (list->data), setting);
gtk_tree_view_column_set_clickable (GTK_TREE_VIEW_COLUMN (list->data), setting);
}
/**
......
......@@ -23,8 +23,26 @@
#include "gtkbutton.h"
#include "gtkalignment.h"
#include "gtklabel.h"
#include "gtkintl.h"
enum {
enum
{
PROP_0,
PROP_CELL_RENDERER,
PROP_VISIBLE,
PROP_SIZING,
PROP_WIDTH,
PROP_MIN_WIDTH,
PROP_MAX_WIDTH,
PROP_TITLE,
PROP_CLICKABLE,
PROP_WIDGET,
PROP_JUSTIFICATION
};
enum
{
CLICKED,
LAST_SIGNAL
};
......@@ -35,6 +53,17 @@ static void gtk_tree_view_column_class_init (GtkTreeViewColumnClass *klass)
static void gtk_tree_view_column_set_attributesv (GtkTreeViewColumn *tree_column,
va_list args);
static void gtk_real_tree_column_clicked (GtkTreeViewColumn *tree_column);
static void gtk_tree_view_column_set_property (GObject *object,
guint prop_id,
const GValue *value,
GParamSpec *pspec,
const gchar *trailer);
static void gtk_tree_view_column_get_property (GObject *object,
guint prop_id,
GValue *value,
GParamSpec *pspec,
const gchar *trailer);
static GtkObjectClass *parent_class = NULL;
......@@ -70,21 +99,114 @@ gtk_tree_view_column_get_type (void)
static void
gtk_tree_view_column_class_init (GtkTreeViewColumnClass *class)
{
GtkObjectClass *object_class;
GObjectClass *object_class;
object_class = (GtkObjectClass*) class;
object_class = (GObjectClass*) class;
parent_class = g_type_class_peek_parent (class);
class->clicked = gtk_real_tree_column_clicked;
object_class->set_property = gtk_tree_view_column_set_property;
object_class->get_property = gtk_tree_view_column_get_property;
tree_column_signals[CLICKED] =
gtk_signal_new ("clicked",
GTK_RUN_FIRST,
GTK_CLASS_TYPE (object_class),
GTK_SIGNAL_OFFSET (GtkTreeViewColumnClass, clicked),
gtk_marshal_VOID__VOID,
GTK_TYPE_NONE, 0);
g_signal_newc ("clicked",
GTK_CLASS_TYPE (object_class),
G_SIGNAL_RUN_LAST,
G_STRUCT_OFFSET (GtkTreeViewColumnClass, clicked),
NULL,
gtk_marshal_VOID__VOID,
GTK_TYPE_NONE, 0);
g_object_class_install_property (object_class,
PROP_CELL_RENDERER,
g_param_spec_object ("cell_renderer",
_("Cell renderer"),
_("Cell renderer object to use for rendering the cell"),
GTK_TYPE_CELL_RENDERER,
G_PARAM_READABLE | G_PARAM_WRITABLE));
g_object_class_install_property (object_class,
PROP_VISIBLE,
g_param_spec_boolean ("visible",
_("Visible"),
_("Whether to display the colomn"),
TRUE,
G_PARAM_READABLE | G_PARAM_WRITABLE));
g_object_class_install_property (object_class,
PROP_SIZING,
g_param_spec_enum ("sizing",
_("Sizing"),
_("Resize mode of the column"),
GTK_TYPE_TREE_VIEW_COLUMN_SIZING,
GTK_TREE_VIEW_COLUMN_AUTOSIZE,
G_PARAM_READABLE | G_PARAM_WRITABLE));
g_object_class_install_property (object_class,
PROP_WIDTH,
g_param_spec_int ("width",
_("Width"),
_("Current width of the column"),
1,
G_MAXINT,
1, /* not useful */
G_PARAM_READABLE | G_PARAM_WRITABLE));
g_object_class_install_property (object_class,
PROP_MIN_WIDTH,
g_param_spec_int ("min_width",
_("Minimum Width"),
_("Minimum allowed width of the column"),
-1,
G_MAXINT,
1,
G_PARAM_READABLE | G_PARAM_WRITABLE));
g_object_class_install_property (object_class,
PROP_MAX_WIDTH,
g_param_spec_int ("max_width",
_("Maximum Width"),
_("Maximum allowed width of the column"),
-1,
G_MAXINT,
G_MAXINT,
G_PARAM_READABLE | G_PARAM_WRITABLE));
g_object_class_install_property (object_class,
PROP_TITLE,
g_param_spec_string ("title",
_("Title"),
_("Title to appear in column header"),
"",
G_PARAM_READABLE | G_PARAM_WRITABLE));
g_object_class_install_property (object_class,
PROP_CLICKABLE,
g_param_spec_boolean ("clickable",
_("Clickable"),
_("Whether the header can be clicked"),
TRUE,
G_PARAM_READABLE | G_PARAM_WRITABLE));
g_object_class_install_property (object_class,
PROP_WIDGET,
g_param_spec_object ("widget",
_("Widget"),
_("Widget to put in column header button instead of column title"),
GTK_TYPE_WIDGET,
G_PARAM_READABLE | G_PARAM_WRITABLE));
g_object_class_install_property (object_class,
PROP_JUSTIFICATION,
g_param_spec_enum ("justification",
_("Justification"),
_("Justification of the column"),
GTK_TYPE_JUSTIFICATION,
GTK_JUSTIFY_LEFT,
G_PARAM_READABLE | G_PARAM_WRITABLE));
}
static void
......@@ -92,7 +214,7 @@ gtk_tree_view_column_init (GtkTreeViewColumn *tree_column)
{
tree_column->button = NULL;
tree_column->justification = GTK_JUSTIFY_LEFT;
tree_column->width = 0;
tree_column->width = 1;
tree_column->min_width = -1;
tree_column->max_width = -1;
tree_column->cell = NULL;
......@@ -103,6 +225,136 @@ gtk_tree_view_column_init (GtkTreeViewColumn *tree_column)
tree_column->dirty = TRUE;
}
static void
gtk_tree_view_column_set_property (GObject *object,
guint prop_id,
const GValue *value,
GParamSpec *pspec,
const gchar *trailer)
{
GtkTreeViewColumn *tree_column;
tree_column = GTK_TREE_VIEW_COLUMN (object);
switch (prop_id)
{
case PROP_CELL_RENDERER:
gtk_tree_view_column_set_cell_renderer (tree_column,
(GtkCellRenderer*)
g_value_get_object (value));
break;
case PROP_VISIBLE:
gtk_tree_view_column_set_visible (tree_column,
g_value_get_boolean (value));
break;
case PROP_SIZING:
gtk_tree_view_column_set_sizing (tree_column,
g_value_get_enum (value));
break;
case PROP_WIDTH:
gtk_tree_view_column_set_width (tree_column,
g_value_get_int (value));
break;
case PROP_MIN_WIDTH:
gtk_tree_view_column_set_min_width (tree_column,
g_value_get_int (value));
break;
case PROP_MAX_WIDTH:
gtk_tree_view_column_set_max_width (tree_column,
g_value_get_int (value));
break;
case PROP_TITLE:
gtk_tree_view_column_set_title (tree_column,
g_value_get_string (value));
break;
case PROP_CLICKABLE:
gtk_tree_view_column_set_clickable (tree_column,
g_value_get_boolean (value));
break;
case PROP_WIDGET:
gtk_tree_view_column_set_widget (tree_column,
(GtkWidget*) g_value_get_object (value));
break;
case PROP_JUSTIFICATION:
gtk_tree_view_column_set_justification (tree_column,
g_value_get_enum (value));
break;
default:
G_OBJECT_WARN_INVALID_PROPERTY_ID (object, prop_id, pspec);
break;
}
}
static void
gtk_tree_view_column_get_property (GObject *object,
guint prop_id,
GValue *value,
GParamSpec *pspec,
const gchar *trailer)
{
GtkTreeViewColumn *tree_column;
tree_column = GTK_TREE_VIEW_COLUMN (object);
switch (prop_id)
{
case PROP_CELL_RENDERER:
g_value_set_object (value, (GObject*) tree_column->cell);
break;
case PROP_VISIBLE:
g_value_set_boolean (value, tree_column->visible);
break;
case PROP_SIZING:
g_value_set_enum (value, tree_column->column_type);
break;
case PROP_WIDTH:
g_value_set_int (value, tree_column->width);
break;
case PROP_MIN_WIDTH:
g_value_set_int (value, tree_column->min_width);
break;
case PROP_MAX_WIDTH:
g_value_set_int (value, tree_column->max_width);
break;
case PROP_TITLE:
g_value_set_string (value, tree_column->title);
break;
case PROP_CLICKABLE:
g_value_set_boolean (value, tree_column->button_active);
break;
case PROP_WIDGET:
g_warning ("FIXME");
break;
case PROP_JUSTIFICATION:
g_value_set_enum (value, tree_column->justification);
break;
default:
G_OBJECT_WARN_INVALID_PROPERTY_ID (object, prop_id, pspec);
break;
}
}
/* used to make the buttons 'unclickable' */
static gint
......@@ -191,9 +443,9 @@ gtk_tree_view_column_new_with_attributes (gchar *title,
* @tree_column: A #GtkTreeViewColumn.
* @cell: The #GtkCellRenderer, or NULL.
*
* Sets the cell renderer of the @tree_column, and unsets the current
* attributes. If there is a cell renderer already set, then it is removed. If
* @cell is NULL, then the cell renderer is unset.
* Sets the cell renderer of the @tree_column. If there is a cell
* renderer already set, then it is removed. If @cell is NULL, then
* the cell renderer is unset.
**/
void
gtk_tree_view_column_set_cell_renderer (GtkTreeViewColumn *tree_column,
......@@ -212,7 +464,7 @@ gtk_tree_view_column_set_cell_renderer (GtkTreeViewColumn *tree_column,
tree_column->cell = cell;
gtk_tree_view_column_set_attributes (tree_column, NULL);
g_object_notify (G_OBJECT (tree_column), "cell_renderer");
}
/**
......@@ -383,6 +635,8 @@ gtk_tree_view_column_set_visible (GtkTreeViewColumn *tree_column,
if (GTK_WIDGET_REALIZED (tree_column->tree_view))
_gtk_tree_view_set_size (GTK_TREE_VIEW (tree_column->tree_view), -1, -1);
g_object_notify (G_OBJECT (tree_column), "visible");
}
/**
......@@ -412,7 +666,7 @@ gtk_tree_view_column_get_visible (GtkTreeViewColumn *tree_column)
**/
void
gtk_tree_view_column_set_sizing (GtkTreeViewColumn *tree_column,
GtkTreeViewColumnSizing type)
GtkTreeViewColumnSizing type)
{
g_return_if_fail (tree_column != NULL);
g_return_if_fail (GTK_IS_TREE_VIEW_COLUMN (tree_column));
......@@ -439,10 +693,12 @@ gtk_tree_view_column_set_sizing (GtkTreeViewColumn *tree_column,
}
gtk_widget_queue_resize (tree_column->tree_view);
g_object_notify (G_OBJECT (tree_column), "sizing");
}
/**
* gtk_tree_view_column_get_col_type:
* gtk_tree_view_column_get_sizing:
* @tree_column: A #GtkTreeViewColumn.
*
* Returns the current type of @tree_column.
......@@ -450,7 +706,7 @@ gtk_tree_view_column_set_sizing (GtkTreeViewColumn *tree_column,
* Return value: The type of @tree_column.
**/
gint
gtk_tree_view_column_get_col_type (GtkTreeViewColumn *tree_column)
gtk_tree_view_column_get_sizing (GtkTreeViewColumn *tree_column)
{
g_return_val_if_fail (tree_column != NULL, 0);
g_return_val_if_fail (GTK_IS_TREE_VIEW_COLUMN (tree_column), 0);
......@@ -482,7 +738,8 @@ gtk_tree_view_column_get_size (GtkTreeViewColumn *tree_column)
*
* Sets the size of the column in pixels, unless the the column type is
* #GTK_TREE_VIEW_COLUMN_AUTOSIZE. In this case, the value is discarded as the
* size of the column is based on the calculated width of the column.
* size of the column is based on the calculated width of the column. The