1
/* -*- Mode: C; indent-tabs-mode: t; c-basic-offset: 8; tab-width: 8 -*-
3
nautilus-cell-renderer-text-ellipsized.c: Cell renderer for text which
4
will use pango ellipsization but deactivate it temporarily for the size
5
calculation to get the size based on the actual text length.
7
Copyright (C) 2007 Martin Wehner
9
This program is free software; you can redistribute it and/or
10
modify it under the terms of the GNU General Public License as
11
published by the Free Software Foundation; either version 2 of the
12
License, or (at your option) any later version.
14
This program is distributed in the hope that it will be useful,
15
but WITHOUT ANY WARRANTY; without even the implied warranty of
16
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
17
General Public License for more details.
19
You should have received a copy of the GNU General Public
20
License along with this program; if not, write to the
21
Free Software Foundation, Inc., 59 Temple Place - Suite 330,
22
Boston, MA 02111-1307, USA.
24
Author: Martin Wehner <martin.wehner@gmail.com>
27
#include "nautilus-cell-renderer-text-ellipsized.h"
29
G_DEFINE_TYPE (NautilusCellRendererTextEllipsized, nautilus_cell_renderer_text_ellipsized,
30
GTK_TYPE_CELL_RENDERER_TEXT);
33
nautilus_cell_renderer_text_ellipsized_init (NautilusCellRendererTextEllipsized *cell)
36
"ellipsize", PANGO_ELLIPSIZE_END,
37
"ellipsize-set", TRUE,
42
nautilus_cell_renderer_text_ellipsized_get_preferred_width (GtkCellRenderer *cell,
48
"ellipsize", PANGO_ELLIPSIZE_NONE,
49
"ellipsize-set", FALSE,
52
GTK_CELL_RENDERER_CLASS
53
(nautilus_cell_renderer_text_ellipsized_parent_class)->get_preferred_width (cell, widget,
54
minimum_size, natural_size);
57
"ellipsize", PANGO_ELLIPSIZE_END,
58
"ellipsize-set", TRUE,
63
nautilus_cell_renderer_text_ellipsized_class_init (NautilusCellRendererTextEllipsizedClass *klass)
65
GtkCellRendererClass *cell_class = GTK_CELL_RENDERER_CLASS (klass);
67
cell_class->get_preferred_width = nautilus_cell_renderer_text_ellipsized_get_preferred_width;
71
nautilus_cell_renderer_text_ellipsized_new (void)
73
return g_object_new (NAUTILUS_TYPE_CELL_RENDERER_TEXT_ELLIPSIZED, NULL);