[evolution/gnome-3-20] Vertically center table header text
- From: Milan Crha <mcrha src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [evolution/gnome-3-20] Vertically center table header text
- Date: Fri, 1 Apr 2016 17:10:38 +0000 (UTC)
commit 0f126425b44ba37a3f39563d1b928fc945b847e1
Author: Milan Crha <mcrha redhat com>
Date: Fri Apr 1 19:08:34 2016 +0200
Vertically center table header text
e-util/e-table-header-utils.c | 10 +++++++---
1 files changed, 7 insertions(+), 3 deletions(-)
---
diff --git a/e-util/e-table-header-utils.c b/e-util/e-table-header-utils.c
index 0bd747b..582791b 100644
--- a/e-util/e-table-header-utils.c
+++ b/e-util/e-table-header-utils.c
@@ -130,7 +130,7 @@ e_table_header_draw_button (cairo_t *cr,
{
gint inner_x, inner_y;
gint inner_width, inner_height;
- gint arrow_width = 0, arrow_height = 0;
+ gint arrow_width = 0, arrow_height = 0, text_height = 0;
PangoContext *pango_context;
PangoLayout *layout;
GtkStyleContext *context;
@@ -207,6 +207,10 @@ e_table_header_draw_button (cairo_t *cr,
return; /* nothing else fits */
}
+ layout = gtk_widget_create_pango_layout (widget, ecol->text);
+ pango_layout_get_pixel_size (layout, NULL, &text_height);
+ g_object_unref (layout);
+
pango_context = gtk_widget_create_pango_context (widget);
layout = pango_layout_new (pango_context);
g_object_unref (pango_context);
@@ -238,7 +242,7 @@ e_table_header_draw_button (cairo_t *cr,
xpos = inner_x + (inner_width - width - (pwidth + 1)) / 2;
}
- ypos = inner_y;
+ ypos = inner_y + MAX (0, (inner_height - text_height) / 2);
pango_layout_set_width (
layout, (inner_width - (xpos - inner_x)) *
@@ -256,7 +260,7 @@ e_table_header_draw_button (cairo_t *cr,
} else {
pango_layout_set_width (layout, inner_width * PANGO_SCALE);
- gtk_render_layout (context, cr, inner_x, inner_y, layout);
+ gtk_render_layout (context, cr, inner_x, inner_y + MAX (0, (inner_height - text_height) / 2),
layout);
}
switch (arrow) {
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]