~walkerlee/totem/pre-interview

« back to all changes in this revision

Viewing changes to src/totem-cell-renderer-video.c

  • Committer: Package Import Robot
  • Author(s): Jeremy Bicha
  • Date: 2013-05-26 00:07:51 UTC
  • mfrom: (1.6.1) (24.1.4 experimental)
  • Revision ID: package-import@ubuntu.com-20130526000751-kv8ap3x1di4qq8j2
Tags: 3.8.2-0ubuntu1
* Sync with Debian. Remaining changes: 
* debian/control.in:
  - Drop build-depends on libepc-ui-dev and libgrilo-0.2-dev (in universe)
  - Drop libxtst-dev build-depends so that the (redundant) fake key presses
    for inhibiting the screensaver are disabled (LP: #1007438)
  - Build-depend on libzeitgeist-dev
  - Suggest rather than recommend gstreamer components in universe
  - Add totem-plugins-extra
  - Add XB-Npp-Description and XB-Npp-Filename header to the 
    totem-mozilla package to improve ubufox/ubuntu plugin db integration 
  - Refer to Firefox in totem-mozilla description instead of Iceweasel
  - Don't have totem-mozilla recommend any particular browser
  - Drop obsolete python library dependencies since iplayer is no longer
    included
* debian/totem-common.install, debian/source_totem.py:
  - Install Ubuntu apport debugging hook
* debian/totem-plugins-extra.install:
  - Universe plugins split out of totem-plugins (currently only gromit)
* debian/totem-plugins.install:    
  - Skip the plugins split to -extra and add the zeitgeist plugin
* debian/rules:
  - Build with --fail-missing, to ensure we install everything. 
    + Ignore libtotem.{,l}a since we delibrately don't install these.
  - Re-enable hardening, make sure both PIE and BINDNOW are used
    by setting hardening=+all. (LP: #1039604)
* debian/patches/91_quicklist_entries.patch:
  - Add static quicklist
* debian/patches/92_gst-plugins-good.patch:
  - Build without unnecessary gstreamer1.0-bad dependency
* debian/patches/93_grilo_optional.patch:
  - Allow building without grilo while grilo MIR is still pending
* debian/patches/correct_desktop_mimetypes.patch:
  - Don't list the mimetypes after the unity lists
* debian/patches/revert_shell_menu.patch: 
  - revert the use of a shell menu until indicator-appmenu can handle
    the mixed shell/traditional menus itself
* New upstream release

Show diffs side-by-side

added added

removed removed

Lines of Context:
1
 
/* -*- Mode: C; tab-width: 8; indent-tabs-mode: t; c-basic-offset: 8 -*- */
2
 
/* 
3
 
 * Copyright (C) 2001-2007 Philip Withnall <philip@tecnocode.co.uk>
4
 
 *
5
 
 * This program is free software; you can redistribute it and/or modify
6
 
 * it under the terms of the GNU General Public License as published by
7
 
 * the Free Software Foundation; either version 2 of the License, or
8
 
 * (at your option) any later version.
9
 
 *
10
 
 * This program is distributed in the hope that it will be useful,
11
 
 * but WITHOUT ANY WARRANTY; without even the implied warranty of
12
 
 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
13
 
 * GNU General Public License for more details.
14
 
 *
15
 
 * You should have received a copy of the GNU General Public License
16
 
 * along with this program; if not, write to the Free Software
17
 
 * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301  USA.
18
 
 *
19
 
 * The Totem project hereby grant permission for non-gpl compatible GStreamer
20
 
 * plugins to be used and distributed together with GStreamer and Totem. This
21
 
 * permission are above and beyond the permissions granted by the GPL license
22
 
 * Totem is covered by.
23
 
 *
24
 
 * Monday 7th February 2005: Christian Schaller: Add exception clause.
25
 
 * See license_change file for details.
26
 
 *
27
 
 */
28
 
 
29
 
/**
30
 
 * SECTION:totem-cell-renderer-video
31
 
 * @short_description: a #GtkCellRenderer widget for listing videos
32
 
 * @stability: Unstable
33
 
 * @include: totem-cell-renderer-video.h
34
 
 * @see_also: #TotemVideoList
35
 
 *
36
 
 * #TotemCellRendererVideo is a #GtkCellRenderer for rendering video thumbnails, typically in a #TotemVideoList.
37
 
 * It supports drawing a video thumbnail, and the video's title underneath.
38
 
 **/
39
 
 
40
 
#include "config.h"
41
 
 
42
 
#include <glib.h>
43
 
#include <glib/gi18n.h>
44
 
#include <string.h>
45
 
 
46
 
#include "totem.h"
47
 
#include "totem-cell-renderer-video.h"
48
 
#include "totem-private.h"
49
 
 
50
 
struct _TotemCellRendererVideoPrivate {
51
 
        gchar *title;
52
 
        GdkPixbuf *thumbnail;
53
 
        PangoAlignment alignment;
54
 
        gboolean use_placeholder;
55
 
};
56
 
 
57
 
#define TOTEM_CELL_RENDERER_VIDEO_GET_PRIVATE(obj) (G_TYPE_INSTANCE_GET_PRIVATE ((obj), TOTEM_TYPE_CELL_RENDERER_VIDEO, TotemCellRendererVideoPrivate))
58
 
 
59
 
enum {
60
 
        PROP_THUMBNAIL = 1,
61
 
        PROP_TITLE,
62
 
        PROP_ALIGNMENT,
63
 
        PROP_USE_PLACEHOLDER
64
 
};
65
 
 
66
 
static void totem_cell_renderer_video_set_property (GObject *object, guint property_id, const GValue *value, GParamSpec *pspec);
67
 
static void totem_cell_renderer_video_get_property (GObject *object, guint property_id, GValue *value, GParamSpec *pspec);
68
 
static void totem_cell_renderer_video_dispose (GObject *object);
69
 
static void totem_cell_renderer_video_finalize (GObject *object);
70
 
static void totem_cell_renderer_video_get_size (GtkCellRenderer *cell, GtkWidget *widget, const GdkRectangle *cell_area, gint *x_offset, gint *y_offset, gint *width, gint *height);
71
 
static void totem_cell_renderer_video_render (GtkCellRenderer *cell, cairo_t *cr, GtkWidget *widget, const GdkRectangle *background_area, const GdkRectangle *cell_area, GtkCellRendererState flags);
72
 
 
73
 
G_DEFINE_TYPE (TotemCellRendererVideo, totem_cell_renderer_video, GTK_TYPE_CELL_RENDERER)
74
 
 
75
 
/**
76
 
 * totem_cell_renderer_video_new:
77
 
 * @use_placeholder: if %TRUE, use a placeholder thumbnail
78
 
 *
79
 
 * Creates a new #TotemCellRendererVideo with its #TotemCellRendererVideo:use-placeholder
80
 
 * property set to @use_placeholder. If @use_placeholder is %TRUE,
81
 
 * the renderer will display a generic placeholder thumbnail if a
82
 
 * proper one is not available.
83
 
 *
84
 
 * Return value: a new #TotemCellRendererVideo
85
 
 **/
86
 
TotemCellRendererVideo *
87
 
totem_cell_renderer_video_new (gboolean use_placeholder)
88
 
{
89
 
        return g_object_new (TOTEM_TYPE_CELL_RENDERER_VIDEO,
90
 
                                "use-placeholder", use_placeholder,
91
 
                                NULL);
92
 
}
93
 
 
94
 
static void
95
 
totem_cell_renderer_video_class_init (TotemCellRendererVideoClass *klass)
96
 
{
97
 
        GObjectClass *object_class = G_OBJECT_CLASS (klass);
98
 
        GtkCellRendererClass *renderer_class = GTK_CELL_RENDERER_CLASS (klass);
99
 
 
100
 
        g_type_class_add_private (klass, sizeof (TotemCellRendererVideoPrivate));
101
 
 
102
 
        object_class->set_property = totem_cell_renderer_video_set_property;
103
 
        object_class->get_property = totem_cell_renderer_video_get_property;
104
 
        object_class->dispose = totem_cell_renderer_video_dispose;
105
 
        object_class->finalize = totem_cell_renderer_video_finalize;
106
 
        renderer_class->get_size = totem_cell_renderer_video_get_size;
107
 
        renderer_class->render = totem_cell_renderer_video_render;
108
 
 
109
 
        /**
110
 
         * TotemCellRendererVideo:thumbnail:
111
 
         *
112
 
         * A #GdkPixbuf of a thumbnail of the video to display. When rendered, it will scale to the width of the parent #GtkTreeView,
113
 
         * so can be as large as reasonable.
114
 
         **/
115
 
        g_object_class_install_property (object_class, PROP_THUMBNAIL,
116
 
                                g_param_spec_object ("thumbnail", "Thumbnail", "A GdkPixbuf of a thumbnail of the video to display.",
117
 
                                        GDK_TYPE_PIXBUF, G_PARAM_READWRITE));
118
 
 
119
 
        /**
120
 
         * TotemCellRendererVideo:title:
121
 
         *
122
 
         * The title of the video, as it should be displayed.
123
 
         **/
124
 
        g_object_class_install_property (object_class, PROP_TITLE,
125
 
                                g_param_spec_string ("title", "Title", "The title of the video, as it should be displayed.",
126
 
                                        _("Unknown video"), G_PARAM_READWRITE));
127
 
 
128
 
        /**
129
 
         * TotemCellRendererVideo:alignment:
130
 
         *
131
 
         * A #PangoAlignment giving the text alignment for the video title.
132
 
         **/
133
 
        g_object_class_install_property (object_class, PROP_ALIGNMENT,
134
 
                                g_param_spec_enum ("alignment", "Alignment", "A PangoAlignment giving the text alignment for the video title.",
135
 
                                        PANGO_TYPE_ALIGNMENT,
136
 
                                        PANGO_ALIGN_CENTER,
137
 
                                        G_PARAM_READWRITE));
138
 
 
139
 
        /**
140
 
         * TotemCellRendererVideo:use-placeholder:
141
 
         *
142
 
         * If %TRUE, a placeholder image should be used for the video thumbnail if a #TotemCellRendererVideo:thumbnail isn't provided.
143
 
         **/
144
 
        g_object_class_install_property (object_class, PROP_USE_PLACEHOLDER,
145
 
                                g_param_spec_boolean ("use-placeholder", "Use placeholder?",
146
 
                                                      "Whether a placeholder image should be used for the video thumbnail.",
147
 
                                        FALSE, G_PARAM_READWRITE));
148
 
}
149
 
 
150
 
static void
151
 
totem_cell_renderer_video_init (TotemCellRendererVideo *self)
152
 
{
153
 
        self->priv = G_TYPE_INSTANCE_GET_PRIVATE (self, TOTEM_TYPE_CELL_RENDERER_VIDEO, TotemCellRendererVideoPrivate);
154
 
        self->priv->title = NULL;
155
 
        self->priv->thumbnail = NULL;
156
 
        self->priv->alignment = PANGO_ALIGN_CENTER;
157
 
        self->priv->use_placeholder = FALSE;
158
 
 
159
 
        /* Make sure we're in the right mode */
160
 
        g_object_set ((gpointer) self, "mode", GTK_CELL_RENDERER_MODE_ACTIVATABLE, NULL);
161
 
}
162
 
 
163
 
static void
164
 
totem_cell_renderer_video_dispose (GObject *object)
165
 
{
166
 
        TotemCellRendererVideo *self = TOTEM_CELL_RENDERER_VIDEO (object);
167
 
 
168
 
        if (self->priv->thumbnail != NULL)
169
 
                g_object_unref (self->priv->thumbnail);
170
 
        self->priv->thumbnail = NULL;
171
 
 
172
 
        /* Chain up to the parent class */
173
 
        G_OBJECT_CLASS (totem_cell_renderer_video_parent_class)->dispose (object);
174
 
}
175
 
 
176
 
static void
177
 
totem_cell_renderer_video_finalize (GObject *object)
178
 
{
179
 
        TotemCellRendererVideo *self = TOTEM_CELL_RENDERER_VIDEO (object);
180
 
 
181
 
        g_free (self->priv->title);
182
 
 
183
 
        /* Chain up to the parent class */
184
 
        G_OBJECT_CLASS (totem_cell_renderer_video_parent_class)->finalize (object);
185
 
}
186
 
 
187
 
static void
188
 
totem_cell_renderer_video_set_property (GObject *object, guint property_id, const GValue *value, GParamSpec *pspec)
189
 
{
190
 
        TotemCellRendererVideoPrivate *priv = TOTEM_CELL_RENDERER_VIDEO_GET_PRIVATE (object);
191
 
 
192
 
        switch (property_id)
193
 
        {
194
 
                case PROP_THUMBNAIL:
195
 
                        if (priv->thumbnail != NULL)
196
 
                                g_object_unref (priv->thumbnail);
197
 
                        priv->thumbnail = GDK_PIXBUF (g_value_dup_object (value));
198
 
                        break;
199
 
                case PROP_TITLE:
200
 
                        g_free (priv->title);
201
 
                        priv->title = g_value_dup_string (value);
202
 
                        break;
203
 
                case PROP_ALIGNMENT:
204
 
                        priv->alignment = g_value_get_enum (value);
205
 
                        break;
206
 
                case PROP_USE_PLACEHOLDER:
207
 
                        priv->use_placeholder = g_value_get_boolean (value);
208
 
                        break;
209
 
                default:
210
 
                        G_OBJECT_WARN_INVALID_PROPERTY_ID (object, property_id, pspec);
211
 
        }
212
 
}
213
 
 
214
 
static void
215
 
totem_cell_renderer_video_get_property (GObject *object, guint property_id, GValue *value, GParamSpec *pspec)
216
 
{
217
 
        TotemCellRendererVideoPrivate *priv = TOTEM_CELL_RENDERER_VIDEO_GET_PRIVATE (object);
218
 
 
219
 
        switch (property_id)
220
 
        {
221
 
                case PROP_THUMBNAIL:
222
 
                        g_value_set_object (value, G_OBJECT (priv->thumbnail));
223
 
                        break;
224
 
                case PROP_TITLE:
225
 
                        g_value_set_string (value, priv->title);
226
 
                        break;
227
 
                case PROP_ALIGNMENT:
228
 
                        g_value_set_enum (value, priv->alignment);
229
 
                        break;
230
 
                case PROP_USE_PLACEHOLDER:
231
 
                        g_value_set_boolean (value, priv->use_placeholder);
232
 
                        break;
233
 
                default:
234
 
                        G_OBJECT_WARN_INVALID_PROPERTY_ID (object, property_id, pspec);
235
 
        }
236
 
}
237
 
 
238
 
static void
239
 
get_size (GtkCellRenderer *cell,
240
 
          GtkWidget *widget,
241
 
          const GdkRectangle *cell_area,
242
 
          GdkRectangle *draw_area,
243
 
          GdkRectangle *title_area,
244
 
          GdkRectangle *thumbnail_area)
245
 
{
246
 
        TotemCellRendererVideoPrivate *priv = TOTEM_CELL_RENDERER_VIDEO (cell)->priv;
247
 
        GtkStyleContext *style_context;
248
 
        guint pixbuf_width = 0;
249
 
        guint pixbuf_height = 0;
250
 
        guint title_width, title_height;
251
 
        guint calc_width, calc_height;
252
 
        gint cell_width;
253
 
        guint cell_xpad, cell_ypad;
254
 
        gfloat cell_xalign, cell_yalign;
255
 
        PangoContext *context;
256
 
        PangoFontMetrics *metrics;
257
 
        PangoFontDescription *font_desc;
258
 
 
259
 
        g_object_get (cell,
260
 
                      "width", &cell_width,
261
 
                      "xpad", &cell_xpad,
262
 
                      "ypad", &cell_ypad,
263
 
                      "xalign", &cell_xalign,
264
 
                      "yalign", &cell_yalign,
265
 
                      NULL);
266
 
 
267
 
        /* Calculate thumbnail dimensions */
268
 
        if (priv->thumbnail != NULL) {
269
 
                pixbuf_width = gdk_pixbuf_get_width (priv->thumbnail);
270
 
                pixbuf_height = gdk_pixbuf_get_height (priv->thumbnail);
271
 
        } else if (priv->use_placeholder == TRUE) {
272
 
                gint width, height; /* Sort out signedness weirdness (damn GTK+) */
273
 
 
274
 
                if (gtk_icon_size_lookup (GTK_ICON_SIZE_DIALOG, &width, &height) == TRUE) {
275
 
                        pixbuf_width = width;
276
 
                        pixbuf_height = height;
277
 
                } else {
278
 
                        pixbuf_width = cell_width;
279
 
                        pixbuf_height = cell_width;
280
 
                }
281
 
        }
282
 
 
283
 
        /* Calculate title dimensions */
284
 
        style_context = gtk_widget_get_style_context (widget);
285
 
        gtk_style_context_get (style_context, GTK_STATE_FLAG_ACTIVE, "font", &font_desc, NULL);
286
 
        if (priv->thumbnail != NULL)
287
 
                pango_font_description_set_weight (font_desc, PANGO_WEIGHT_BOLD);
288
 
        context = gtk_widget_get_pango_context (widget);
289
 
        metrics = pango_context_get_metrics (context, font_desc, pango_context_get_language (context));
290
 
 
291
 
        if (cell_area)
292
 
                title_width = cell_area->width;
293
 
        else if (cell_width != -1)
294
 
                title_width = cell_width;
295
 
        else
296
 
                title_width = pixbuf_width;
297
 
 
298
 
        title_height = PANGO_PIXELS (pango_font_metrics_get_ascent (metrics) + pango_font_metrics_get_descent (metrics));
299
 
 
300
 
        pango_font_metrics_unref (metrics);
301
 
        pango_font_description_free (font_desc);
302
 
 
303
 
        /* Calculate the total final size */
304
 
        calc_width = cell_xpad * 2 + MAX (pixbuf_width, title_width);
305
 
        calc_height = cell_ypad * 3 + pixbuf_height + title_height;
306
 
 
307
 
        if (draw_area) {
308
 
                if (cell_area && calc_width > 0 && calc_height > 0) {
309
 
                        draw_area->x = (((gtk_widget_get_direction (widget) == GTK_TEXT_DIR_RTL) ?
310
 
                                (1.0 - cell_xalign) : cell_xalign) * (cell_area->width - calc_width));
311
 
                        draw_area->x = MAX (draw_area->x, 0);
312
 
                        draw_area->y = (cell_yalign * (cell_area->height - calc_height));
313
 
                        draw_area->y = MAX (draw_area->y, 0);
314
 
                } else {
315
 
                        draw_area->x = 0;
316
 
                        draw_area->y = 0;
317
 
                }
318
 
 
319
 
                draw_area->x += cell_xpad;
320
 
                draw_area->y += cell_ypad;
321
 
                draw_area->width = calc_width;
322
 
                draw_area->height = calc_height;
323
 
 
324
 
                if (title_area) {
325
 
                        if (cell_area) {
326
 
                                title_area->width = cell_area->width;
327
 
                                title_area->x = (gtk_widget_get_direction (widget) == GTK_TEXT_DIR_RTL) ? 1.0 : 0.0;
328
 
                        } else {
329
 
                                title_area->width = calc_width;
330
 
                                title_area->x = draw_area->x;
331
 
                        }
332
 
 
333
 
                        title_area->height = title_height;
334
 
                        if (pixbuf_height > 0)
335
 
                                title_area->y = draw_area->y + pixbuf_height + cell_ypad;
336
 
                        else
337
 
                                title_area->y = draw_area->y;
338
 
                }
339
 
 
340
 
                if (pixbuf_height > 0 && thumbnail_area) {
341
 
                        thumbnail_area->x = (((gtk_widget_get_direction (widget) == GTK_TEXT_DIR_RTL) ?
342
 
                                (1.0 - cell_xalign) : cell_xalign) *
343
 
                                (cell_area->width - pixbuf_width));
344
 
                        thumbnail_area->x = MAX (thumbnail_area->x, 0);
345
 
                        thumbnail_area->y = draw_area->y;
346
 
                        thumbnail_area->width = cell_xpad * 2 + pixbuf_width;
347
 
                        thumbnail_area->height = pixbuf_height;
348
 
                }
349
 
        }
350
 
}
351
 
 
352
 
static void
353
 
totem_cell_renderer_video_get_size (GtkCellRenderer *cell,
354
 
                                    GtkWidget *widget,
355
 
                                    const GdkRectangle *cell_area,
356
 
                                    gint *x_offset,
357
 
                                    gint *y_offset,
358
 
                                    gint *width,
359
 
                                    gint *height)
360
 
{
361
 
        GdkRectangle draw_area;
362
 
 
363
 
        get_size (cell, widget, cell_area, &draw_area, NULL, NULL);
364
 
 
365
 
        if (x_offset)
366
 
                *x_offset = draw_area.x;
367
 
        if (y_offset)
368
 
                *y_offset = draw_area.y;
369
 
        if (width)
370
 
                *width = draw_area.width;
371
 
        if (height)
372
 
                *height = draw_area.height;
373
 
}
374
 
 
375
 
static void
376
 
totem_cell_renderer_video_render (GtkCellRenderer *cell,
377
 
                                  cairo_t *cr,
378
 
                                  GtkWidget *widget,
379
 
                                  const GdkRectangle *background_area,
380
 
                                  const GdkRectangle *cell_area,
381
 
                                  GtkCellRendererState flags)
382
 
{
383
 
        TotemCellRendererVideoPrivate *priv = TOTEM_CELL_RENDERER_VIDEO (cell)->priv;
384
 
        GdkPixbuf *pixbuf;
385
 
        GdkRectangle draw_rect;
386
 
        GdkRectangle draw_area;
387
 
        GdkRectangle title_area;
388
 
        GdkRectangle thumbnail_area;
389
 
        PangoLayout *layout;
390
 
        GtkStateType state;
391
 
        guint cell_xpad, cell_ypad;
392
 
        gboolean cell_is_expander;
393
 
        GtkStyleContext *context;
394
 
 
395
 
        g_object_get (cell,
396
 
                      "xpad", &cell_xpad,
397
 
                      "ypad", &cell_ypad,
398
 
                      "is_expander", &cell_is_expander,
399
 
                      NULL);
400
 
 
401
 
        get_size (cell, widget, cell_area, &draw_area, &title_area, &thumbnail_area);
402
 
 
403
 
        draw_area.x += cell_area->x;
404
 
        draw_area.y += cell_area->y;
405
 
        draw_area.width -= cell_xpad * 2;
406
 
        draw_area.height -= cell_ypad * 2;
407
 
 
408
 
        if (!gdk_rectangle_intersect (cell_area, &draw_area, &draw_rect))
409
 
                return;
410
 
 
411
 
        /* Sort out the thumbnail */
412
 
        if (priv->thumbnail != NULL)
413
 
                pixbuf = priv->thumbnail;
414
 
        else if (priv->use_placeholder == TRUE)
415
 
                pixbuf = gtk_widget_render_icon_pixbuf (widget, GTK_STOCK_MISSING_IMAGE, GTK_ICON_SIZE_DIALOG);
416
 
        else
417
 
                pixbuf = NULL;
418
 
 
419
 
        if (cell_is_expander)
420
 
                return;
421
 
 
422
 
        /* Sort out the title */
423
 
        if (!gtk_cell_renderer_get_sensitive (cell)) {
424
 
                state = GTK_STATE_INSENSITIVE;
425
 
        } else if ((flags & GTK_CELL_RENDERER_SELECTED) == GTK_CELL_RENDERER_SELECTED) {
426
 
                if (gtk_widget_has_focus (widget))
427
 
                        state = GTK_STATE_SELECTED;
428
 
                else
429
 
                        state = GTK_STATE_ACTIVE;
430
 
        } else if ((flags & GTK_CELL_RENDERER_PRELIT) == GTK_CELL_RENDERER_PRELIT &&
431
 
                                gtk_widget_get_state (widget) == GTK_STATE_PRELIGHT) {
432
 
                state = GTK_STATE_PRELIGHT;
433
 
        } else {
434
 
                if (gtk_widget_get_state (widget) == GTK_STATE_INSENSITIVE)
435
 
                        state = GTK_STATE_INSENSITIVE;
436
 
                else
437
 
                        state = GTK_STATE_NORMAL;
438
 
        }
439
 
 
440
 
        /* Draw the title */
441
 
        context = gtk_widget_get_style_context (widget);
442
 
        layout = gtk_widget_create_pango_layout (widget, priv->title);
443
 
        if (pixbuf != NULL) {
444
 
                PangoFontDescription *desc;
445
 
                gtk_style_context_get (context, state, "font", &desc, NULL);
446
 
                pango_font_description_set_weight (desc, PANGO_WEIGHT_BOLD);
447
 
                pango_layout_set_font_description (layout, desc);
448
 
                pango_font_description_free (desc);
449
 
        }
450
 
 
451
 
        pango_layout_set_ellipsize (layout, PANGO_ELLIPSIZE_END);
452
 
        pango_layout_set_width (layout, title_area.width * PANGO_SCALE);
453
 
        pango_layout_set_alignment (layout, priv->alignment);
454
 
 
455
 
        gtk_style_context_set_state (context, state);
456
 
        gtk_render_layout (context, cr,
457
 
                           cell_area->x + title_area.x,
458
 
                           cell_area->y + title_area.y,
459
 
                           layout);
460
 
 
461
 
        g_object_unref (layout);
462
 
 
463
 
        /* Draw the thumbnail */
464
 
        if (pixbuf != NULL) {
465
 
                gdk_cairo_set_source_pixbuf (cr, pixbuf, cell_area->x + thumbnail_area.x, cell_area->y + thumbnail_area.y);
466
 
                gdk_cairo_rectangle (cr, &draw_rect);
467
 
                cairo_fill (cr);
468
 
        }
469
 
}