summaryrefslogtreecommitdiffstats
path: root/meta/packages/gtk+/gtk+-2.6.10
diff options
context:
space:
mode:
authorRoss Burton <ross@openedhand.com>2007-07-26 10:35:02 +0000
committerRoss Burton <ross@openedhand.com>2007-07-26 10:35:02 +0000
commit828cb20d18fc67aabe22d13c4e3c519e6611f908 (patch)
treef2ecc02e94d16896e906ea2afc95d94173783846 /meta/packages/gtk+/gtk+-2.6.10
parentf7bf74a05ae7b857dbf935738ee20b0fad9de496 (diff)
downloadpoky-828cb20d18fc67aabe22d13c4e3c519e6611f908.tar.gz
Add patch so that the size of the toggle cell renderer is based on font size
git-svn-id: https://svn.o-hand.com/repos/poky/trunk@2228 311d38ba-8fff-0310-9ca6-ca027cbcb966
Diffstat (limited to 'meta/packages/gtk+/gtk+-2.6.10')
-rw-r--r--meta/packages/gtk+/gtk+-2.6.10/toggle-font.diff69
1 files changed, 69 insertions, 0 deletions
diff --git a/meta/packages/gtk+/gtk+-2.6.10/toggle-font.diff b/meta/packages/gtk+/gtk+-2.6.10/toggle-font.diff
new file mode 100644
index 0000000000..ad3bc6e38c
--- /dev/null
+++ b/meta/packages/gtk+/gtk+-2.6.10/toggle-font.diff
@@ -0,0 +1,69 @@
1Index: gtk/gtkcellrenderertoggle.c
2===================================================================
3--- gtk/gtkcellrenderertoggle.c (revision 18542)
4+++ gtk/gtkcellrenderertoggle.c (working copy)
5@@ -80,6 +80,8 @@
6 typedef struct _GtkCellRendererTogglePrivate GtkCellRendererTogglePrivate;
7 struct _GtkCellRendererTogglePrivate
8 {
9+ gint indicator_size;
10+ GtkWidget *cached_widget;
11 guint inconsistent : 1;
12 };
13
14@@ -281,6 +283,27 @@
15 }
16
17 static void
18+on_widget_style_set (GtkWidget *widget, GtkStyle *previous, gpointer user_data)
19+{
20+ GtkCellRendererTogglePrivate *priv = user_data;
21+ PangoContext *context;
22+ PangoFontMetrics *metrics;
23+ int height;
24+
25+ context = gtk_widget_get_pango_context (widget);
26+ metrics = pango_context_get_metrics (context,
27+ widget->style->font_desc,
28+ pango_context_get_language (context));
29+
30+ height = pango_font_metrics_get_ascent (metrics) +
31+ pango_font_metrics_get_descent (metrics);
32+
33+ pango_font_metrics_unref (metrics);
34+
35+ priv->indicator_size = PANGO_PIXELS (height * 0.85);
36+}
37+
38+static void
39 gtk_cell_renderer_toggle_get_size (GtkCellRenderer *cell,
40 GtkWidget *widget,
41 GdkRectangle *cell_area,
42@@ -291,10 +314,25 @@
43 {
44 gint calc_width;
45 gint calc_height;
46+ GtkCellRendererTogglePrivate *priv;
47
48- calc_width = (gint) cell->xpad * 2 + TOGGLE_WIDTH;
49- calc_height = (gint) cell->ypad * 2 + TOGGLE_WIDTH;
50+ priv = GTK_CELL_RENDERER_TOGGLE_GET_PRIVATE (cell);
51
52+ if (priv->cached_widget != widget) {
53+ if (priv->cached_widget) {
54+ g_object_remove_weak_pointer (widget, &priv->cached_widget);
55+ g_signal_handlers_disconnect_by_func (priv->cached_widget, on_widget_style_set, priv);
56+ }
57+ priv->cached_widget = widget;
58+ g_object_add_weak_pointer (widget, &priv->cached_widget);
59+ g_signal_connect (widget, "style-set", on_widget_style_set, priv);
60+
61+ on_widget_style_set (widget, NULL, priv);
62+ }
63+
64+ calc_width = (gint) cell->xpad * 2 + priv->indicator_size;
65+ calc_height = (gint) cell->ypad * 2 + priv->indicator_size;
66+
67 if (width)
68 *width = calc_width;
69