From 6c2653809b63f95e24ffb86cc8efa7ff96521353 Mon Sep 17 00:00:00 2001 From: Georges Basile Stavracas Neto Date: Thu, 26 Jan 2017 19:53:27 -0200 Subject: [PATCH] week-grid: simplify drawing function This patch simplifies the drawing function by removing the unused layout and font descriptions. https://bugzilla.gnome.org/show_bug.cgi?id=777420 --- src/views/gcal-week-grid.c | 10 ++-------- 1 file changed, 2 insertions(+), 8 deletions(-) diff --git a/src/views/gcal-week-grid.c b/src/views/gcal-week-grid.c index 54fb6afc..98769510 100644 --- a/src/views/gcal-week-grid.c +++ b/src/views/gcal-week-grid.c @@ -454,21 +454,16 @@ gcal_week_grid_draw (GtkWidget *widget, gdouble x, column_width; gint i, width, height, today_column; - PangoLayout *layout; - PangoFontDescription *font_desc; - self = GCAL_WEEK_GRID (widget); context = gtk_widget_get_style_context (widget); state = gtk_widget_get_state_flags (widget); ltr = gtk_widget_get_direction (widget) != GTK_TEXT_DIR_RTL; + gtk_style_context_save (context); gtk_style_context_add_class (context, "hours"); gtk_style_context_get_color (context, state, &color); gtk_style_context_get_padding (context, state, &padding); - gtk_style_context_get (context, state, "font", &font_desc, NULL); - layout = pango_cairo_create_layout (cr); - pango_layout_set_font_description (layout, font_desc); gdk_cairo_set_source_rgba (cr, &color); width = gtk_widget_get_allocated_width (widget); @@ -602,8 +597,7 @@ gcal_week_grid_draw (GtkWidget *widget, cairo_stroke (cr); - pango_font_description_free (font_desc); - g_object_unref (layout); + gtk_style_context_restore (context); GTK_WIDGET_CLASS (gcal_week_grid_parent_class)->draw (widget, cr);