Migrated to Gtk+-3.8

This commit is contained in:
Erick Pérez Castellanos
2013-05-17 14:41:12 -04:00
parent 674c6a6cd8
commit 01145b8916
5 changed files with 92 additions and 59 deletions
+18 -12
View File
@@ -385,6 +385,7 @@ gcal_year_view_size_allocate (GtkWidget *widget,
GtkBorder padding;
PangoLayout *layout;
PangoFontDescription *font_desc;
gint font_height;
gdouble start_grid_y;
@@ -411,11 +412,12 @@ gcal_year_view_size_allocate (GtkWidget *widget,
&padding);
layout = pango_layout_new (gtk_widget_get_pango_context (widget));
pango_layout_set_font_description (
layout,
gtk_style_context_get_font (gtk_widget_get_style_context (widget),
gtk_widget_get_state_flags (widget)));
gtk_style_context_get (gtk_widget_get_style_context (widget),
gtk_widget_get_state_flags (widget),
"font", &font_desc, NULL);
pango_layout_set_font_description (layout, font_desc);
pango_layout_get_pixel_size (layout, NULL, &font_height);
pango_font_description_free (font_desc);
g_object_unref (layout);
start_grid_y = gcal_year_view_get_start_grid_y (widget);
@@ -888,6 +890,7 @@ gcal_year_view_draw_header (GcalYearView *view,
GtkBorder header_padding;
PangoLayout *layout;
PangoFontDescription *font_desc;
gint layout_width;
gint header_width;
gint layout_height;
@@ -912,9 +915,9 @@ gcal_year_view_draw_header (GcalYearView *view,
cairo_set_source_rgb (cr, color.red, color.green, color.blue);
layout = pango_cairo_create_layout (cr);
pango_layout_set_font_description (layout,
gtk_style_context_get_font (context,
state));
gtk_style_context_get (context, state, "font", &font_desc, NULL);
pango_layout_set_font_description (layout, font_desc);
pango_font_description_free (font_desc);
gtk_style_context_restore (context);
/* Here translators should put the widgest letter in their alphabet, this
@@ -1027,7 +1030,7 @@ gcal_year_view_draw_grid (GcalYearView *view,
state | GTK_STATE_FLAG_INSENSITIVE,
&ligther_color);
gtk_style_context_get_color (context, state, &color);
font = gtk_style_context_get_font (context, state);
gtk_style_context_get (context, state, "font", &font, NULL);
cairo_set_source_rgb (cr, color.red, color.green, color.blue);
pango_layout_set_font_description (layout, font);
@@ -1177,6 +1180,7 @@ gcal_year_view_get_start_grid_y (GtkWidget *widget)
GtkBorder header_padding;
PangoLayout *layout;
PangoFontDescription *font_desc;
gint font_height;
gdouble start_grid_y;
@@ -1191,16 +1195,18 @@ gcal_year_view_get_start_grid_y (GtkWidget *widget)
gtk_widget_get_state_flags (widget),
&header_padding);
pango_layout_set_font_description (
layout,
gtk_style_context_get_font (context,
gtk_widget_get_state_flags(widget)));
gtk_style_context_get (context,
gtk_widget_get_state_flags (widget),
"font", &font_desc,
NULL);
pango_layout_set_font_description (layout, font_desc);
pango_layout_get_pixel_size (layout, NULL, &font_height);
/* 6: is padding around the header */
start_grid_y = header_padding.top + font_height + header_padding.bottom;
gtk_style_context_restore (context);
pango_font_description_free (font_desc);
g_object_unref (layout);
return start_grid_y;
}