[nautilus] cell-renderer-text-ellipsized: use new GtkSizeRequest vfunctions
- From: Cosimo Cecchi <cosimoc src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [nautilus] cell-renderer-text-ellipsized: use new GtkSizeRequest vfunctions
- Date: Tue, 5 Oct 2010 12:49:59 +0000 (UTC)
commit 33c9b6d24a60079fe6c4c1be281c76f43def6fee
Author: Cosimo Cecchi <cosimoc gnome org>
Date: Tue Oct 5 14:50:58 2010 +0200
cell-renderer-text-ellipsized: use new GtkSizeRequest vfunctions
This fixes the 'Name' column being too thin in list view.
.../nautilus-cell-renderer-text-ellipsized.c | 58 +++++++++-----------
1 files changed, 26 insertions(+), 32 deletions(-)
---
diff --git a/libnautilus-private/nautilus-cell-renderer-text-ellipsized.c b/libnautilus-private/nautilus-cell-renderer-text-ellipsized.c
index 75c2c6b..b8cd385 100644
--- a/libnautilus-private/nautilus-cell-renderer-text-ellipsized.c
+++ b/libnautilus-private/nautilus-cell-renderer-text-ellipsized.c
@@ -26,23 +26,37 @@
#include "nautilus-cell-renderer-text-ellipsized.h"
-#define ELLIPSIZE_PROP "ellipsize"
-
-static void nautilus_cell_renderer_text_ellipsized_get_size (GtkCellRenderer *cell,
- GtkWidget *widget,
- GdkRectangle *rectangle,
- gint *x_offset,
- gint *y_offset,
- gint *width,
- gint *height);
-
G_DEFINE_TYPE (NautilusCellRendererTextEllipsized, nautilus_cell_renderer_text_ellipsized,
GTK_TYPE_CELL_RENDERER_TEXT);
static void
nautilus_cell_renderer_text_ellipsized_init (NautilusCellRendererTextEllipsized *cell)
{
- g_object_set (cell, ELLIPSIZE_PROP, PANGO_ELLIPSIZE_END, NULL);
+ g_object_set (cell,
+ "ellipsize", PANGO_ELLIPSIZE_END,
+ "ellipsize-set", TRUE,
+ NULL);
+}
+
+static void
+nautilus_cell_renderer_text_ellipsized_get_preferred_width (GtkCellRenderer *cell,
+ GtkWidget *widget,
+ gint *minimum_size,
+ gint *natural_size)
+{
+ g_object_set (cell,
+ "ellipsize", PANGO_ELLIPSIZE_NONE,
+ "ellipsize-set", FALSE,
+ NULL);
+
+ GTK_CELL_RENDERER_CLASS
+ (nautilus_cell_renderer_text_ellipsized_parent_class)->get_preferred_width (cell, widget,
+ minimum_size, natural_size);
+
+ g_object_set (cell,
+ "ellipsize", PANGO_ELLIPSIZE_END,
+ "ellipsize-set", TRUE,
+ NULL);
}
static void
@@ -50,7 +64,7 @@ nautilus_cell_renderer_text_ellipsized_class_init (NautilusCellRendererTextEllip
{
GtkCellRendererClass *cell_class = GTK_CELL_RENDERER_CLASS (klass);
- cell_class->get_size = nautilus_cell_renderer_text_ellipsized_get_size;
+ cell_class->get_preferred_width = nautilus_cell_renderer_text_ellipsized_get_preferred_width;
}
GtkCellRenderer *
@@ -58,23 +72,3 @@ nautilus_cell_renderer_text_ellipsized_new (void)
{
return g_object_new (NAUTILUS_TYPE_CELL_RENDERER_TEXT_ELLIPSIZED, NULL);
}
-
-static void
-nautilus_cell_renderer_text_ellipsized_get_size (GtkCellRenderer *cell,
- GtkWidget *widget,
- GdkRectangle *cell_area,
- gint *x_offset,
- gint *y_offset,
- gint *width,
- gint *height)
-{
- g_object_set (cell, ELLIPSIZE_PROP, PANGO_ELLIPSIZE_NONE, NULL);
-
- (* GTK_CELL_RENDERER_CLASS (nautilus_cell_renderer_text_ellipsized_parent_class)->get_size)
- (cell, widget, cell_area,
- x_offset, y_offset,
- width, height);
-
- g_object_set (cell, ELLIPSIZE_PROP, PANGO_ELLIPSIZE_END, NULL);
-}
-
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]