[gnome-calendar] month-view: highlight overflow indicator on hover
- From: Erick Pérez Castellanos <erickpc src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [gnome-calendar] month-view: highlight overflow indicator on hover
- Date: Sat, 20 Dec 2014 14:13:42 +0000 (UTC)
commit 046dac4fe9e24434607c60c4c5af0d4b38e1d5d9
Author: Erick Pérez Castellanos <erick red gmail com>
Date: Fri Dec 19 13:50:08 2014 -0500
month-view: highlight overflow indicator on hover
src/gcal-month-view.c | 18 ++++++++++++++++++
1 files changed, 18 insertions(+), 0 deletions(-)
---
diff --git a/src/gcal-month-view.c b/src/gcal-month-view.c
index c565a05..b47cde7 100644
--- a/src/gcal-month-view.c
+++ b/src/gcal-month-view.c
@@ -1146,6 +1146,8 @@ gcal_month_view_draw (GtkWidget *widget,
{
GList *l;
PangoLayout *overflow_layout;
+ PangoFontDescription *ofont_desc;
+ const gchar *format;
gchar *overflow_str;
l = g_hash_table_lookup (priv->overflow_cells, GINT_TO_POINTER (i));
@@ -1153,8 +1155,22 @@ gcal_month_view_draw (GtkWidget *widget,
/* TODO: Warning in some languages this string can be too long and may overlap wit the number */
format = g_dngettext (GETTEXT_PACKAGE, "Other event", "Other %d events", g_list_length (l));
overflow_str = g_strdup_printf (format, g_list_length (l));
+
+ gtk_style_context_save (context);
+ gtk_style_context_add_class (context, "overflow");
+ if (priv->hovered_overflow_indicator == i)
+ {
+ gtk_style_context_set_state (context, state | GTK_STATE_FLAG_PRELIGHT);
+ gtk_style_context_get (context, state | GTK_STATE_FLAG_PRELIGHT, "font", &ofont_desc, NULL);
+ }
+ else
+ {
+ gtk_style_context_get (context, state, "font", &ofont_desc, NULL);
+ }
+
overflow_layout = gtk_widget_create_pango_layout (widget, overflow_str);
+ pango_layout_set_font_description (overflow_layout, ofont_desc);
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);
@@ -1164,7 +1180,9 @@ gcal_month_view_draw (GtkWidget *widget,
cell_height * (row + 1 + first_row_gap) - font_height - padding.bottom +
start_grid_y,
overflow_layout);
+ gtk_style_context_restore (context);
g_free (overflow_str);
+ pango_font_description_free (ofont_desc);
g_object_unref (overflow_layout);
}
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]