Commit db584abe authored by Javier Jardón's avatar Javier Jardón

Use accessor functions to access GtkCellRenderer

parent 932568d1
......@@ -682,6 +682,7 @@ gtk_cell_renderer_pixbuf_get_size (GtkCellRenderer *cell,
gint pixbuf_height = 0;
gint calc_width;
gint calc_height;
gint xpad, ypad;
priv = GTK_CELL_RENDERER_PIXBUF_GET_PRIVATE (cell);
......@@ -708,22 +709,26 @@ gtk_cell_renderer_pixbuf_get_size (GtkCellRenderer *cell,
pixbuf_width = MAX (pixbuf_width, gdk_pixbuf_get_width (cellpixbuf->pixbuf_expander_closed));
pixbuf_height = MAX (pixbuf_height, gdk_pixbuf_get_height (cellpixbuf->pixbuf_expander_closed));
}
calc_width = (gint) cell->xpad * 2 + pixbuf_width;
calc_height = (gint) cell->ypad * 2 + pixbuf_height;
gtk_cell_renderer_get_padding (cell, &xpad, &ypad);
calc_width = (gint) xpad * 2 + pixbuf_width;
calc_height = (gint) ypad * 2 + pixbuf_height;
if (cell_area && pixbuf_width > 0 && pixbuf_height > 0)
{
gfloat xalign, yalign;
gtk_cell_renderer_get_alignment (cell, &xalign, &yalign);
if (x_offset)
{
*x_offset = (((gtk_widget_get_direction (widget) == GTK_TEXT_DIR_RTL) ?
(1.0 - cell->xalign) : cell->xalign) *
(1.0 - xalign) : xalign) *
(cell_area->width - calc_width));
*x_offset = MAX (*x_offset, 0);
}
if (y_offset)
{
*y_offset = (cell->yalign *
*y_offset = (yalign *
(cell_area->height - calc_height));
*y_offset = MAX (*y_offset, 0);
}
......@@ -760,6 +765,8 @@ gtk_cell_renderer_pixbuf_render (GtkCellRenderer *cell,
GdkRectangle pix_rect;
GdkRectangle draw_rect;
cairo_t *cr;
gboolean is_expander;
gint xpad, ypad;
priv = GTK_CELL_RENDERER_PIXBUF_GET_PRIVATE (cell);
......@@ -769,10 +776,11 @@ gtk_cell_renderer_pixbuf_render (GtkCellRenderer *cell,
&pix_rect.width,
&pix_rect.height);
pix_rect.x += cell_area->x + cell->xpad;
pix_rect.y += cell_area->y + cell->ypad;
pix_rect.width -= cell->xpad * 2;
pix_rect.height -= cell->ypad * 2;
gtk_cell_renderer_get_padding (cell, &xpad, &ypad);
pix_rect.x += cell_area->x + xpad;
pix_rect.y += cell_area->y + ypad;
pix_rect.width -= xpad * 2;
pix_rect.height -= ypad * 2;
if (!gdk_rectangle_intersect (cell_area, &pix_rect, &draw_rect) ||
!gdk_rectangle_intersect (expose_area, &draw_rect, &draw_rect))
......@@ -780,12 +788,17 @@ gtk_cell_renderer_pixbuf_render (GtkCellRenderer *cell,
pixbuf = cellpixbuf->pixbuf;
if (cell->is_expander)
g_object_get (cell, "is-expander", &is_expander, NULL);
if (is_expander)
{
if (cell->is_expanded &&
gboolean is_expanded;
g_object_get (cell, "is-expanded", &is_expanded, NULL);
if (is_expanded &&
cellpixbuf->pixbuf_expander_open != NULL)
pixbuf = cellpixbuf->pixbuf_expander_open;
else if (!cell->is_expanded &&
else if (!is_expanded &&
cellpixbuf->pixbuf_expander_closed != NULL)
pixbuf = cellpixbuf->pixbuf_expander_closed;
}
......@@ -793,7 +806,8 @@ gtk_cell_renderer_pixbuf_render (GtkCellRenderer *cell,
if (!pixbuf)
return;
if (gtk_widget_get_state (widget) == GTK_STATE_INSENSITIVE || !cell->sensitive)
if (gtk_widget_get_state (widget) == GTK_STATE_INSENSITIVE ||
!gtk_cell_renderer_get_sensitive (cell))
{
GtkIconSource *source;
......
......@@ -415,15 +415,18 @@ compute_dimensions (GtkCellRenderer *cell,
{
PangoRectangle logical_rect;
PangoLayout *layout;
gint xpad, ypad;
layout = gtk_widget_create_pango_layout (widget, text);
pango_layout_get_pixel_extents (layout, NULL, &logical_rect);
gtk_cell_renderer_get_padding (cell, &xpad, &ypad);
if (width)
*width = logical_rect.width + cell->xpad * 2;
*width = logical_rect.width + xpad * 2;
if (height)
*height = logical_rect.height + cell->ypad * 2;
*height = logical_rect.height + ypad * 2;
g_object_unref (layout);
}
......@@ -534,15 +537,17 @@ gtk_cell_renderer_progress_render (GtkCellRenderer *cell,
PangoLayout *layout;
PangoRectangle logical_rect;
gint x, y, w, h, x_pos, y_pos, bar_position, bar_size, start, full_size;
gint xpad, ypad;
GdkRectangle clip;
gboolean is_rtl;
is_rtl = gtk_widget_get_direction (widget) == GTK_TEXT_DIR_RTL;
x = cell_area->x + cell->xpad;
y = cell_area->y + cell->ypad;
w = cell_area->width - cell->xpad * 2;
h = cell_area->height - cell->ypad * 2;
gtk_cell_renderer_get_padding (cell, &xpad, &ypad);
x = cell_area->x + xpad;
y = cell_area->y + ypad;
w = cell_area->width - xpad * 2;
h = cell_area->height - ypad * 2;
/* FIXME: GtkProgressBar draws the box with "trough" detail,
* but some engines don't paint anything with that detail for
......
......@@ -359,7 +359,8 @@ gtk_cell_renderer_spinner_render (GtkCellRenderer *cellr,
}
state = GTK_STATE_NORMAL;
if (gtk_widget_get_state (widget) == GTK_STATE_INSENSITIVE || !cellr->sensitive)
if (gtk_widget_get_state (widget) == GTK_STATE_INSENSITIVE ||
!gtk_cell_renderer_get_sensitive (cellr))
{
state = GTK_STATE_INSENSITIVE;
}
......
......@@ -156,13 +156,12 @@ static void
gtk_cell_renderer_text_init (GtkCellRendererText *celltext)
{
GtkCellRendererTextPrivate *priv;
GtkCellRenderer *cell = GTK_CELL_RENDERER (celltext);
priv = GTK_CELL_RENDERER_TEXT_GET_PRIVATE (celltext);
GTK_CELL_RENDERER (celltext)->xalign = 0.0;
GTK_CELL_RENDERER (celltext)->yalign = 0.5;
GTK_CELL_RENDERER (celltext)->xpad = 2;
GTK_CELL_RENDERER (celltext)->ypad = 2;
gtk_cell_renderer_set_alignment (cell, 0.0, 0.5);
gtk_cell_renderer_set_padding (cell, 2, 2);
celltext->font_scale = 1.0;
celltext->fixed_height_rows = -1;
celltext->font = pango_font_description_new ();
......@@ -1204,9 +1203,9 @@ gtk_cell_renderer_text_set_property (GObject *object,
celltext->editable = g_value_get_boolean (value);
celltext->editable_set = TRUE;
if (celltext->editable)
GTK_CELL_RENDERER (celltext)->mode = GTK_CELL_RENDERER_MODE_EDITABLE;
g_object_set (celltext, "mode", GTK_CELL_RENDERER_MODE_EDITABLE, NULL);
else
GTK_CELL_RENDERER (celltext)->mode = GTK_CELL_RENDERER_MODE_INERT;
g_object_set (celltext, "mode", GTK_CELL_RENDERER_MODE_INERT, NULL);
g_object_notify (object, "editable-set");
break;
......@@ -1492,9 +1491,13 @@ get_size (GtkCellRenderer *cell,
GtkCellRendererText *celltext = (GtkCellRendererText *) cell;
PangoRectangle rect;
GtkCellRendererTextPrivate *priv;
gint xpad, ypad;
gint cell_width, cell_height;
priv = GTK_CELL_RENDERER_TEXT_GET_PRIVATE (cell);
gtk_cell_renderer_get_padding (cell, &xpad, &ypad);
if (celltext->calc_fixed_height)
{
PangoContext *context;
......@@ -1520,13 +1523,15 @@ get_size (GtkCellRenderer *cell,
pango_font_description_free (font_desc);
gtk_cell_renderer_get_fixed_size (cell, &cell_width, &cell_height);
gtk_cell_renderer_set_fixed_size (cell,
cell->width, 2*cell->ypad +
cell_width, 2 * ypad +
celltext->fixed_height_rows * PANGO_PIXELS (row_height));
if (height)
{
*height = cell->height;
*height = cell_height;
height = NULL;
}
celltext->calc_fixed_height = FALSE;
......@@ -1542,7 +1547,7 @@ get_size (GtkCellRenderer *cell,
pango_layout_get_pixel_extents (layout, NULL, &rect);
if (height)
*height = cell->ypad * 2 + rect.height;
*height = ypad * 2 + rect.height;
/* The minimum size for ellipsized labels is ~ 3 chars */
if (width)
......@@ -1559,29 +1564,33 @@ get_size (GtkCellRenderer *cell,
char_width = pango_font_metrics_get_approximate_char_width (metrics);
pango_font_metrics_unref (metrics);
*width = cell->xpad * 2 + (PANGO_PIXELS (char_width) * MAX (priv->width_chars, 3));
*width = xpad * 2 + (PANGO_PIXELS (char_width) * MAX (priv->width_chars, 3));
}
else
{
*width = cell->xpad * 2 + rect.x + rect.width;
*width = xpad * 2 + rect.x + rect.width;
}
}
if (cell_area)
{
gfloat xalign, yalign;
gtk_cell_renderer_get_alignment (cell, &xalign, &yalign);
if (x_offset)
{
if (gtk_widget_get_direction (widget) == GTK_TEXT_DIR_RTL)
*x_offset = (1.0 - cell->xalign) * (cell_area->width - (rect.x + rect.width + (2 * cell->xpad)));
*x_offset = (1.0 - xalign) * (cell_area->width - (rect.x + rect.width + (2 * xpad)));
else
*x_offset = cell->xalign * (cell_area->width - (rect.x + rect.width + (2 * cell->xpad)));
*x_offset = xalign * (cell_area->width - (rect.x + rect.width + (2 * xpad)));
if ((priv->ellipsize_set && priv->ellipsize != PANGO_ELLIPSIZE_NONE) || priv->wrap_width != -1)
*x_offset = MAX(*x_offset, 0);
}
if (y_offset)
{
*y_offset = cell->yalign * (cell_area->height - (rect.height + (2 * cell->ypad)));
*y_offset = yalign * (cell_area->height - (rect.height + (2 * ypad)));
*y_offset = MAX (*y_offset, 0);
}
}
......@@ -1623,6 +1632,7 @@ gtk_cell_renderer_text_render (GtkCellRenderer *cell,
GtkStateType state;
gint x_offset;
gint y_offset;
gint xpad, ypad;
GtkCellRendererTextPrivate *priv;
priv = GTK_CELL_RENDERER_TEXT_GET_PRIVATE (cell);
......@@ -1630,7 +1640,7 @@ gtk_cell_renderer_text_render (GtkCellRenderer *cell,
layout = get_layout (celltext, widget, TRUE, flags);
get_size (cell, widget, cell_area, layout, &x_offset, &y_offset, NULL, NULL);
if (!cell->sensitive)
if (!gtk_cell_renderer_get_sensitive (cell))
{
state = GTK_STATE_INSENSITIVE;
}
......@@ -1675,9 +1685,11 @@ gtk_cell_renderer_text_render (GtkCellRenderer *cell,
cairo_destroy (cr);
}
gtk_cell_renderer_get_padding (cell, &xpad, &ypad);
if (priv->ellipsize_set && priv->ellipsize != PANGO_ELLIPSIZE_NONE)
pango_layout_set_width (layout,
(cell_area->width - x_offset - 2 * cell->xpad) * PANGO_SCALE);
(cell_area->width - x_offset - 2 * xpad) * PANGO_SCALE);
else if (priv->wrap_width == -1)
pango_layout_set_width (layout, -1);
......@@ -1688,8 +1700,8 @@ gtk_cell_renderer_text_render (GtkCellRenderer *cell,
expose_area,
widget,
"cellrenderertext",
cell_area->x + x_offset + cell->xpad,
cell_area->y + y_offset + cell->ypad,
cell_area->x + x_offset + xpad,
cell_area->y + y_offset + ypad,
layout);
g_object_unref (layout);
......@@ -1827,6 +1839,7 @@ gtk_cell_renderer_text_start_editing (GtkCellRenderer *cell,
GtkRequisition requisition;
GtkCellRendererText *celltext;
GtkCellRendererTextPrivate *priv;
gfloat xalign, yalign;
celltext = GTK_CELL_RENDERER_TEXT (cell);
priv = GTK_CELL_RENDERER_TEXT_GET_PRIVATE (cell);
......@@ -1835,10 +1848,11 @@ gtk_cell_renderer_text_start_editing (GtkCellRenderer *cell,
if (celltext->editable == FALSE)
return NULL;
priv->entry = g_object_new (GTK_TYPE_ENTRY,
"has-frame", FALSE,
"xalign", cell->xalign,
NULL);
gtk_cell_renderer_get_alignment (cell, &xalign, &yalign);
priv->entry = gtk_entry_new ();
gtk_entry_set_has_frame (GTK_ENTRY (priv->entry), FALSE);
gtk_entry_set_alignment (GTK_ENTRY (priv->entry), xalign);
if (celltext->text)
gtk_entry_set_text (GTK_ENTRY (priv->entry), celltext->text);
......@@ -1914,14 +1928,19 @@ void
gtk_cell_renderer_text_set_fixed_height_from_font (GtkCellRendererText *renderer,
gint number_of_rows)
{
GtkCellRenderer *cell;
g_return_if_fail (GTK_IS_CELL_RENDERER_TEXT (renderer));
g_return_if_fail (number_of_rows == -1 || number_of_rows > 0);
cell = GTK_CELL_RENDERER (renderer);
if (number_of_rows == -1)
{
gtk_cell_renderer_set_fixed_size (GTK_CELL_RENDERER (renderer),
GTK_CELL_RENDERER (renderer)->width,
-1);
gint width, height;
gtk_cell_renderer_get_fixed_size (cell, &width, &height);
gtk_cell_renderer_set_fixed_size (cell, width, -1);
}
else
{
......
......@@ -99,9 +99,8 @@ gtk_cell_renderer_toggle_init (GtkCellRendererToggle *celltoggle)
celltoggle->active = FALSE;
celltoggle->radio = FALSE;
GTK_CELL_RENDERER (celltoggle)->mode = GTK_CELL_RENDERER_MODE_ACTIVATABLE;
GTK_CELL_RENDERER (celltoggle)->xpad = 2;
GTK_CELL_RENDERER (celltoggle)->ypad = 2;
g_object_set (celltoggle, "mode", GTK_CELL_RENDERER_MODE_ACTIVATABLE, NULL);
gtk_cell_renderer_set_padding (GTK_CELL_RENDERER (celltoggle), 2, 2);
priv->indicator_size = TOGGLE_WIDTH;
priv->inconsistent = FALSE;
......@@ -283,12 +282,14 @@ gtk_cell_renderer_toggle_get_size (GtkCellRenderer *cell,
{
gint calc_width;
gint calc_height;
gint xpad, ypad;
GtkCellRendererTogglePrivate *priv;
priv = GTK_CELL_RENDERER_TOGGLE_GET_PRIVATE (cell);
calc_width = (gint) cell->xpad * 2 + priv->indicator_size;
calc_height = (gint) cell->ypad * 2 + priv->indicator_size;
gtk_cell_renderer_get_padding (cell, &xpad, &ypad);
calc_width = xpad * 2 + priv->indicator_size;
calc_height = ypad * 2 + priv->indicator_size;
if (width)
*width = calc_width;
......@@ -298,15 +299,19 @@ gtk_cell_renderer_toggle_get_size (GtkCellRenderer *cell,
if (cell_area)
{
gfloat xalign, yalign;
gtk_cell_renderer_get_alignment (cell, &xalign, &yalign);
if (x_offset)
{
*x_offset = ((gtk_widget_get_direction (widget) == GTK_TEXT_DIR_RTL) ?
(1.0 - cell->xalign) : cell->xalign) * (cell_area->width - calc_width);
(1.0 - xalign) : xalign) * (cell_area->width - calc_width);
*x_offset = MAX (*x_offset, 0);
}
if (y_offset)
{
*y_offset = cell->yalign * (cell_area->height - calc_height);
*y_offset = yalign * (cell_area->height - calc_height);
*y_offset = MAX (*y_offset, 0);
}
}
......@@ -330,6 +335,7 @@ gtk_cell_renderer_toggle_render (GtkCellRenderer *cell,
GtkCellRendererTogglePrivate *priv;
gint width, height;
gint x_offset, y_offset;
gint xpad, ypad;
GtkShadowType shadow;
GtkStateType state = 0;
......@@ -338,8 +344,9 @@ gtk_cell_renderer_toggle_render (GtkCellRenderer *cell,
gtk_cell_renderer_toggle_get_size (cell, widget, cell_area,
&x_offset, &y_offset,
&width, &height);
width -= cell->xpad*2;
height -= cell->ypad*2;
gtk_cell_renderer_get_padding (cell, &xpad, &ypad);
width -= xpad * 2;
height -= ypad * 2;
if (width <= 0 || height <= 0)
return;
......@@ -349,7 +356,8 @@ gtk_cell_renderer_toggle_render (GtkCellRenderer *cell,
else
shadow = celltoggle->active ? GTK_SHADOW_IN : GTK_SHADOW_OUT;
if (gtk_widget_get_state (widget) == GTK_STATE_INSENSITIVE || !cell->sensitive)
if (gtk_widget_get_state (widget) == GTK_STATE_INSENSITIVE ||
!gtk_cell_renderer_get_sensitive (cell))
{
state = GTK_STATE_INSENSITIVE;
}
......@@ -374,8 +382,8 @@ gtk_cell_renderer_toggle_render (GtkCellRenderer *cell,
window,
state, shadow,
expose_area, widget, "cellradio",
cell_area->x + x_offset + cell->xpad,
cell_area->y + y_offset + cell->ypad,
cell_area->x + x_offset + xpad,
cell_area->y + y_offset + ypad,
width, height);
}
else
......@@ -384,8 +392,8 @@ gtk_cell_renderer_toggle_render (GtkCellRenderer *cell,
window,
state, shadow,
expose_area, widget, "cellcheck",
cell_area->x + x_offset + cell->xpad,
cell_area->y + y_offset + cell->ypad,
cell_area->x + x_offset + xpad,
cell_area->y + y_offset + ypad,
width, height);
}
}
......
......@@ -330,7 +330,7 @@ gtk_cell_view_size_request (GtkWidget *widget,
gint width, height;
GtkCellViewCellInfo *info = (GtkCellViewCellInfo *)i->data;
if (!info->cell->visible)
if (!gtk_cell_renderer_get_visible (info->cell))
continue;
if (!first_cell)
......@@ -366,7 +366,7 @@ gtk_cell_view_size_allocate (GtkWidget *widget,
{
GtkCellViewCellInfo *info = (GtkCellViewCellInfo *)i->data;
if (!info->cell->visible)
if (!gtk_cell_renderer_get_visible (info->cell))
continue;
if (info->expand)
......@@ -385,7 +385,7 @@ gtk_cell_view_size_allocate (GtkWidget *widget,
{
GtkCellViewCellInfo *info = (GtkCellViewCellInfo *)i->data;
if (!info->cell->visible)
if (!gtk_cell_renderer_get_visible (info->cell))
continue;
info->real_width = info->requested_width +
......@@ -451,7 +451,7 @@ gtk_cell_view_expose (GtkWidget *widget,
if (info->pack == GTK_PACK_END)
continue;
if (!info->cell->visible)
if (!gtk_cell_renderer_get_visible (info->cell))
continue;
area.width = info->real_width;
......@@ -478,7 +478,7 @@ gtk_cell_view_expose (GtkWidget *widget,
if (info->pack == GTK_PACK_START)
continue;
if (!info->cell->visible)
if (!gtk_cell_renderer_get_visible (info->cell))
continue;
area.width = info->real_width;
......
......@@ -4408,9 +4408,12 @@ file_list_query_tooltip_cb (GtkWidget *widget,
static void
set_icon_cell_renderer_fixed_size (GtkFileChooserDefault *impl, GtkCellRenderer *renderer)
{
gint xpad, ypad;
gtk_cell_renderer_get_padding (renderer, &xpad, &ypad);
gtk_cell_renderer_set_fixed_size (renderer,
renderer->xpad * 2 + impl->icon_size,
renderer->ypad * 2 + impl->icon_size);
xpad * 2 + impl->icon_size,
ypad * 2 + impl->icon_size);
}
/* Creates the widgets for the file list */
......
......@@ -2475,7 +2475,7 @@ gtk_icon_view_item_hit_test (GtkIconView *icon_view,
{
GtkIconViewCellInfo *info = (GtkIconViewCellInfo *)l->data;
if (!info->cell->visible)
if (!gtk_cell_renderer_get_visible (info->cell))
continue;
gtk_icon_view_get_cell_box (icon_view, item, info, &box);
......@@ -3009,7 +3009,7 @@ gtk_icon_view_calculate_item_size (GtkIconView *icon_view,
{
GtkIconViewCellInfo *info = (GtkIconViewCellInfo *)l->data;
if (!info->cell->visible)
if (!gtk_cell_renderer_get_visible (info->cell))
continue;
gtk_cell_renderer_get_size (info->cell, GTK_WIDGET (icon_view),
......@@ -3071,7 +3071,7 @@ gtk_icon_view_calculate_item_size2 (GtkIconView *icon_view,
if (info->pack == (k ? GTK_PACK_START : GTK_PACK_END))
continue;
if (!info->cell->visible)
if (!gtk_cell_renderer_get_visible (info->cell))
continue;
if (icon_view->priv->orientation == GTK_ORIENTATION_HORIZONTAL)
......@@ -3212,7 +3212,7 @@ gtk_icon_view_paint_item (GtkIconView *icon_view,
{
GtkIconViewCellInfo *info = (GtkIconViewCellInfo *)l->data;
if (!info->cell->visible)
if (!gtk_cell_renderer_get_visible (info->cell))
continue;
gtk_icon_view_get_cell_area (icon_view, item, info, &cell_area);
......@@ -3250,14 +3250,16 @@ gtk_icon_view_paint_item (GtkIconView *icon_view,
{
for (l = icon_view->priv->cell_list, i = 0; l; l = l->next, i++)
{
GtkCellRendererMode mode;
GtkIconViewCellInfo *info = (GtkIconViewCellInfo *)l->data;
if (!info->cell->visible)
if (!gtk_cell_renderer_get_visible (info->cell))
continue;
/* If found a editable/activatable cell, draw focus on it. */
g_object_get (info->cell, "mode", &mode, NULL);
if (icon_view->priv->cursor_cell < 0 &&
info->cell->mode != GTK_CELL_RENDERER_MODE_INERT)
mode != GTK_CELL_RENDERER_MODE_INERT)
icon_view->priv->cursor_cell = i;
gtk_icon_view_get_cell_box (icon_view, item, info, &box);
......@@ -3506,7 +3508,7 @@ gtk_icon_view_get_item_at_coords (GtkIconView *icon_view,
{
GtkIconViewCellInfo *info = (GtkIconViewCellInfo *)l->data;
if (!info->cell->visible)
if (!gtk_cell_renderer_get_visible (info->cell))
continue;
gtk_icon_view_get_cell_box (icon_view, item, info, &box);
......@@ -3933,15 +3935,17 @@ find_cell (GtkIconView *icon_view,
for (k = 0; k < 2; k++)
for (l = icon_view->priv->cell_list, i = 0; l; l = l->next, i++)
{
GtkCellRendererMode mode;
GtkIconViewCellInfo *info = (GtkIconViewCellInfo *)l->data;
if (info->pack == (k ? GTK_PACK_START : GTK_PACK_END))
continue;
if (!info->cell->visible)
if (!gtk_cell_renderer_get_visible (info->cell))
continue;
if (info->cell->mode != GTK_CELL_RENDERER_MODE_INERT)
g_object_get (info->cell, "mode", &mode, NULL);
if (mode != GTK_CELL_RENDERER_MODE_INERT)
{
if (cell == i)
current = n_focusable;
......
......@@ -1379,12 +1379,17 @@ _gtk_tree_view_column_unset_tree_view (GtkTreeViewColumn *column)
gboolean
_gtk_tree_view_column_has_editable_cell (GtkTreeViewColumn *column)
{
GtkCellRenderer *cell;
GtkCellRendererMode mode;
GList *list;
for (list = column->cell_list; list; list = list->next)
if (((GtkTreeViewColumnCellInfo *)list->data)->cell->mode ==
GTK_CELL_RENDERER_MODE_EDITABLE)
return TRUE;
{
cell = ((GtkTreeViewColumnCellInfo *)list->data)->cell;
g_object_get (cell, "mode", &mode, NULL);
if (mode == GTK_CELL_RENDERER_MODE_EDITABLE)
return TRUE;
}
return FALSE;
}
......@@ -1410,11 +1415,13 @@ _gtk_tree_view_column_count_special_cells (GtkTreeViewColumn *column)
for (list = column->cell_list; list; list = list->next)
{
GtkCellRendererMode mode;
GtkTreeViewColumnCellInfo *cellinfo = list->data;
if ((cellinfo->cell->mode == GTK_CELL_RENDERER_MODE_EDITABLE ||
cellinfo->cell->mode == GTK_CELL_RENDERER_MODE_ACTIVATABLE) &&
cellinfo->cell->visible)
g_object_get (cellinfo->cell, "mode", &mode, NULL);
if ((mode == GTK_CELL_RENDERER_MODE_EDITABLE ||
mode == GTK_CELL_RENDERER_MODE_ACTIVATABLE) &&
gtk_cell_renderer_get_visible (cellinfo->cell))
i++;
}
......@@ -2541,6 +2548,7 @@ gtk_tree_view_column_cell_set_cell_data (GtkTreeViewColumn *tree_column,
GSList *list;
GValue value = { 0, };
GList *cell_list;
gboolean cell_is_expander, cell_is_expanded;
g_return_if_fail (GTK_IS_TREE_VIEW_COLUMN (tree_column));
......@@ -2556,10 +2564,12 @@ gtk_tree_view_column_cell_set_cell_data (GtkTreeViewColumn *tree_column,
g_object_freeze_notify (cell);
if (info->cell->is_expander != is_expander)
g_object_get (cell, "is-expander", &cell_is_expander, NULL);
if (cell_is_expander != is_expander)
g_object_set (cell, "is-expander", is_expander, NULL);
if (info->cell->is_expanded != is_expanded)
g_object_get (cell, "is-expanded", &cell_is_expanded, NULL);
if (cell_is_expanded != is_expanded)
g_object_set (cell, "is-expanded", is_expanded, NULL);
while (list && list->next)
......@@ -2745,7 +2755,7 @@ gtk_tree_view_column_cell_process_action (GtkTreeViewColumn *tree_column,
{
GtkTreeViewColumnCellInfo *info = (GtkTreeViewColumnCellInfo *)list->data;
if (! info->cell->visible)
if (!gtk_cell_renderer_get_visible (info->cell))
continue;
if (info->expand == TRUE)
......@@ -2772,7 +2782,7 @@ gtk_tree_view_column_cell_process_action (GtkTreeViewColumn *tree_column,
if (info->pack == GTK_PACK_END)
continue;
if (! info->cell->visible)
if (!gtk_cell_renderer_get_visible (info->cell))
continue;
if ((info->has_focus || special_cells == 1) && cursor_row)
......@@ -2947,7 +2957,7 @@ gtk_tree_view_column_cell_process_action (GtkTreeViewColumn *tree_column,
if (info->pack == GTK_PACK_START)
continue;
if (! info->cell->visible)
if (!gtk_cell_renderer_get_visible(info->cell))
continue;
if ((info->has_focus || special_cells == 1) && cursor_row)
......@@ -3529,7 +3539,7 @@ gtk_tree_view_column_cell_is_visible (GtkTreeViewColumn *tree_column)
{
GtkTreeViewColumnCellInfo *info = (GtkTreeViewColumnCellInfo *) list->data;
if (info->cell->visible)
if (gtk_cell_renderer_get_visible (info->cell))
return TRUE;
}
......@@ -3657,7 +3667,7 @@ _gtk_tree_view_column_get_neighbor_sizes (GtkTreeViewColumn *column,
if (info->cell == cell)
break;
if (info->cell->visible)
if (gtk_cell_renderer_get_visible (info->cell))
l += info->real_width + column->spacing;
}
......@@ -3667,7 +3677,7 @@ _gtk_tree_view_column_get_neighbor_sizes (GtkTreeViewColumn *column,
list = gtk_tree_view_column_cell_next (column, list);
if (info->cell->visible)
if (gtk_cell_renderer_get_visible (info->cell))
r += info->real_width + column->spacing;
}
......@@ -3714,7 +3724,7 @@ gtk_tree_view_column_cell_get_position (GtkTreeViewColumn *tree_column,
break;
}
if (cellinfo->cell->visible)
if (gtk_cell_renderer_get_visible (cellinfo->cell))
current_x += cellinfo->real_width;
}
......
......@@ -542,6 +542,7 @@ gail_text_cell_get_character_extents (AtkText *text,
PangoRectangle char_rect;
PangoLayout *layout;
gint x_offset, y_offset, index, cell_height, cell_width;
gint xpad, ypad;
if (!GAIL_TEXT_CELL (text)->cell_text)
{
......@@ -576,10 +577,11 @@ gail_text_cell_get_character_extents (AtkText *text,
offset) - gtk_renderer->text;
pango_layout_index_to_pos (layout, index, &char_rect);
gtk_cell_renderer_get_padding (gail_renderer->renderer, &xpad, &ypad);
gail_misc_get_extents_from_pango_rectangle (widget,
&char_rect,
x_offset + rendered_rect.x + gail_renderer->renderer->xpad,
y_offset + rendered_rect.y + gail_renderer->renderer->ypad,
x_offset + rendered_rect.x + xpad,
y_offset + rendered_rect.y + ypad,