aboutsummaryrefslogtreecommitdiffstats
path: root/libempathy-gtk
diff options
context:
space:
mode:
authorGuillaume Desmottes <guillaume.desmottes@collabora.co.uk>2010-11-12 18:10:19 +0800
committerGuillaume Desmottes <guillaume.desmottes@collabora.co.uk>2010-11-12 18:10:19 +0800
commiteb67ffa2d04e73f078f969f751c45678dc35a430 (patch)
treef398c1c48385c19b8ddc228d248ab4f72e11ef32 /libempathy-gtk
parent618c05bffb618c1ce5321c354e605afbdcec5553 (diff)
downloadgsoc2013-empathy-eb67ffa2d04e73f078f969f751c45678dc35a430.tar
gsoc2013-empathy-eb67ffa2d04e73f078f969f751c45678dc35a430.tar.gz
gsoc2013-empathy-eb67ffa2d04e73f078f969f751c45678dc35a430.tar.bz2
gsoc2013-empathy-eb67ffa2d04e73f078f969f751c45678dc35a430.tar.lz
gsoc2013-empathy-eb67ffa2d04e73f078f969f751c45678dc35a430.tar.xz
gsoc2013-empathy-eb67ffa2d04e73f078f969f751c45678dc35a430.tar.zst
gsoc2013-empathy-eb67ffa2d04e73f078f969f751c45678dc35a430.zip
cell-renderer-text: implement get_preferred_height_for_width instead of get_size (#628043)
Diffstat (limited to 'libempathy-gtk')
-rw-r--r--libempathy-gtk/empathy-cell-renderer-text.c52
1 files changed, 20 insertions, 32 deletions
diff --git a/libempathy-gtk/empathy-cell-renderer-text.c b/libempathy-gtk/empathy-cell-renderer-text.c
index d64af0d6d..f64ee6b0c 100644
--- a/libempathy-gtk/empathy-cell-renderer-text.c
+++ b/libempathy-gtk/empathy-cell-renderer-text.c
@@ -50,13 +50,6 @@ static void cell_renderer_text_set_property (GObject *o
guint param_id,
const GValue *value,
GParamSpec *pspec);
-static void cell_renderer_text_get_size (GtkCellRenderer *cell,
- GtkWidget *widget,
- const GdkRectangle *cell_area,
- gint *x_offset,
- gint *y_offset,
- gint *width,
- gint *height);
static void cell_renderer_text_render (GtkCellRenderer *cell,
cairo_t *cr,
GtkWidget *widget,
@@ -80,6 +73,25 @@ enum {
G_DEFINE_TYPE (EmpathyCellRendererText, empathy_cell_renderer_text, GTK_TYPE_CELL_RENDERER_TEXT);
static void
+cell_renderer_text_get_preferred_height_for_width (GtkCellRenderer *renderer,
+ GtkWidget *widget,
+ gint width,
+ gint *minimum_size,
+ gint *natural_size)
+{
+ EmpathyCellRendererText *self = EMPATHY_CELL_RENDERER_TEXT (renderer);
+ EmpathyCellRendererTextPriv *priv = GET_PRIV (self);
+
+ /* Only update if not already valid so we get the right size. */
+ cell_renderer_text_update_text (self, widget, priv->is_selected);
+
+ GTK_CELL_RENDERER_CLASS (empathy_cell_renderer_text_parent_class)->
+ get_preferred_height_for_width (renderer, widget, width,
+ minimum_size, natural_size);
+}
+
+
+static void
empathy_cell_renderer_text_class_init (EmpathyCellRendererTextClass *klass)
{
GObjectClass *object_class;
@@ -94,7 +106,7 @@ empathy_cell_renderer_text_class_init (EmpathyCellRendererTextClass *klass)
object_class->get_property = cell_renderer_text_get_property;
object_class->set_property = cell_renderer_text_set_property;
- cell_class->get_size = cell_renderer_text_get_size;
+ cell_class->get_preferred_height_for_width = cell_renderer_text_get_preferred_height_for_width;
cell_class->render = cell_renderer_text_render;
spec = g_param_spec_string ("name", "Name", "Contact name", NULL,
@@ -240,30 +252,6 @@ cell_renderer_text_set_property (GObject *object,
}
static void
-cell_renderer_text_get_size (GtkCellRenderer *cell,
- GtkWidget *widget,
- const GdkRectangle *cell_area,
- gint *x_offset,
- gint *y_offset,
- gint *width,
- gint *height)
-{
- EmpathyCellRendererText *celltext;
- EmpathyCellRendererTextPriv *priv;
-
- celltext = EMPATHY_CELL_RENDERER_TEXT (cell);
- priv = GET_PRIV (cell);
-
- /* Only update if not already valid so we get the right size. */
- cell_renderer_text_update_text (celltext, widget, priv->is_selected);
-
- (GTK_CELL_RENDERER_CLASS (empathy_cell_renderer_text_parent_class)->get_size) (cell, widget,
- cell_area,
- x_offset, y_offset,
- width, height);
-}
-
-static void
cell_renderer_text_render (GtkCellRenderer *cell,
cairo_t *cr,
GtkWidget *widget,