[gnome-calendar] month-view: overflow indicator drawn centered
- From: Erick Pérez Castellanos <erickpc src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [gnome-calendar] month-view: overflow indicator drawn centered
- Date: Thu, 18 Dec 2014 14:07:17 +0000 (UTC)
commit 1f9b380238c983957bdfa7a1bea7e300086c85ee
Author: Erick Pérez Castellanos <erick red gmail com>
Date: Thu Dec 18 01:54:24 2014 -0500
month-view: overflow indicator drawn centered
src/gcal-month-view.c | 14 ++++++++++----
1 files changed, 10 insertions(+), 4 deletions(-)
---
diff --git a/src/gcal-month-view.c b/src/gcal-month-view.c
index 2cbec14..7d73640 100644
--- a/src/gcal-month-view.c
+++ b/src/gcal-month-view.c
@@ -980,18 +980,24 @@ gcal_month_view_draw (GtkWidget *widget,
if (g_hash_table_contains (priv->overflown_days, GINT_TO_POINTER (i)))
{
+ PangoLayout *overflow_layout;
gchar *overflow_str;
+ /* TODO: Warning in some languags this string can be too long and may overlap wit the number */
overflow_str = g_strdup_printf (_("Other %d events"), 2); /* FIXME: handle plurars property */
- pango_layout_set_text (layout, overflow_str, -1);
- pango_layout_get_pixel_size (layout, &font_width, &font_height);
+ overflow_layout = gtk_widget_create_pango_layout (widget, overflow_str);
+
+ pango_layout_set_width (overflow_layout, pango_units_from_double (cell_width));
+ pango_layout_set_alignment (overflow_layout, PANGO_ALIGN_CENTER);
+ pango_layout_get_pixel_size (overflow_layout, &font_width, &font_height);
gtk_render_layout (context, cr,
- cell_width * (column + k) + sw * padding.right - k * font_width,
+ cell_width * column,
cell_height * (row + 1 + first_row_gap) - font_height - padding.bottom +
start_grid_y,
- layout);
+ overflow_layout);
g_free (overflow_str);
+ g_object_unref (overflow_layout);
}
g_free (nr_day);
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]