Migrated to Gtk+-3.8
This commit is contained in:
@@ -327,7 +327,6 @@ GcalApplication*
|
||||
gcal_application_new (void)
|
||||
{
|
||||
GcalApplication *app;
|
||||
g_type_init ();
|
||||
|
||||
g_set_application_name ("Calendar");
|
||||
|
||||
|
||||
@@ -465,6 +465,7 @@ gcal_event_widget_draw (GtkWidget *widget,
|
||||
gint width, height;
|
||||
|
||||
PangoLayout *layout;
|
||||
PangoFontDescription *font_desc;
|
||||
GdkRGBA fg_color;
|
||||
|
||||
priv = GCAL_EVENT_WIDGET (widget)->priv;
|
||||
@@ -513,10 +514,9 @@ gcal_event_widget_draw (GtkWidget *widget,
|
||||
padding.left += height - (padding.top + padding.bottom) + padding.left;
|
||||
}
|
||||
|
||||
gtk_style_context_get (context, state, "font", &font_desc, NULL);
|
||||
layout = pango_cairo_create_layout (cr);
|
||||
pango_layout_set_font_description (layout,
|
||||
gtk_style_context_get_font (context,
|
||||
state));
|
||||
pango_layout_set_font_description (layout, font_desc);
|
||||
pango_layout_set_ellipsize (layout, PANGO_ELLIPSIZE_END);
|
||||
pango_layout_set_width (layout, (width - (padding.left + padding.right) ) * PANGO_SCALE);
|
||||
|
||||
@@ -534,6 +534,7 @@ gcal_event_widget_draw (GtkWidget *widget,
|
||||
|
||||
cairo_restore (cr);
|
||||
|
||||
pango_font_description_free (font_desc);
|
||||
g_object_unref (layout);
|
||||
|
||||
return FALSE;
|
||||
|
||||
+31
-19
@@ -389,6 +389,7 @@ gcal_month_view_size_allocate (GtkWidget *widget,
|
||||
|
||||
GtkBorder padding;
|
||||
PangoLayout *layout;
|
||||
PangoFontDescription *font_desc;
|
||||
|
||||
gint font_height;
|
||||
gdouble added_height;
|
||||
@@ -423,11 +424,13 @@ gcal_month_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_month_view_get_start_grid_y (widget);
|
||||
@@ -984,6 +987,7 @@ gcal_month_view_draw_header (GcalMonthView *view,
|
||||
GtkBorder header_padding;
|
||||
|
||||
PangoLayout *layout;
|
||||
PangoFontDescription *font_desc;
|
||||
gint layout_width;
|
||||
gint header_width;
|
||||
gint layout_height;
|
||||
@@ -1011,10 +1015,10 @@ gcal_month_view_draw_header (GcalMonthView *view,
|
||||
gtk_style_context_get_color (context, state, &color);
|
||||
cairo_set_source_rgb (cr, color.red, color.green, color.blue);
|
||||
|
||||
gtk_style_context_get (context, state, "font", &font_desc, NULL);
|
||||
layout = pango_cairo_create_layout (cr);
|
||||
pango_layout_set_font_description (layout,
|
||||
gtk_style_context_get_font (context,
|
||||
state));
|
||||
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
|
||||
@@ -1125,8 +1129,8 @@ gcal_month_view_draw_grid (GcalMonthView *view,
|
||||
gdouble start_grid_y;
|
||||
|
||||
PangoLayout *layout;
|
||||
const PangoFontDescription *font;
|
||||
const PangoFontDescription *selected_font;
|
||||
PangoFontDescription *font;
|
||||
PangoFontDescription *selected_font;
|
||||
PangoFontDescription *bold_font;
|
||||
|
||||
gdouble days;
|
||||
@@ -1151,7 +1155,7 @@ gcal_month_view_draw_grid (GcalMonthView *view,
|
||||
gtk_style_context_get_color (context,
|
||||
state | GTK_STATE_FLAG_SELECTED,
|
||||
&selected_color);
|
||||
selected_font = gtk_style_context_get_font (context, state);
|
||||
gtk_style_context_get (context, state, "font", &selected_font, NULL);
|
||||
|
||||
gtk_style_context_get_background_color (context,
|
||||
state | GTK_STATE_FLAG_SELECTED,
|
||||
@@ -1165,7 +1169,7 @@ gcal_month_view_draw_grid (GcalMonthView *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);
|
||||
|
||||
pango_layout_set_font_description (layout, font);
|
||||
|
||||
@@ -1370,6 +1374,8 @@ gcal_month_view_draw_grid (GcalMonthView *view,
|
||||
cairo_stroke (cr);
|
||||
|
||||
pango_font_description_free (bold_font);
|
||||
pango_font_description_free (font);
|
||||
pango_font_description_free (selected_font);
|
||||
g_object_unref (layout);
|
||||
}
|
||||
|
||||
@@ -1381,6 +1387,7 @@ gcal_month_view_get_start_grid_y (GtkWidget *widget)
|
||||
GtkBorder header_padding;
|
||||
|
||||
PangoLayout *layout;
|
||||
PangoFontDescription *font_desc;
|
||||
gint font_height;
|
||||
gdouble start_grid_y;
|
||||
|
||||
@@ -1395,21 +1402,24 @@ gcal_month_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);
|
||||
|
||||
gtk_style_context_get (context,
|
||||
gtk_widget_get_state_flags(widget),
|
||||
"font", &font_desc,
|
||||
NULL);
|
||||
|
||||
/* init grid values */
|
||||
pango_layout_set_font_description (
|
||||
layout,
|
||||
gtk_style_context_get_font (context,
|
||||
gtk_widget_get_state_flags(widget)));
|
||||
pango_layout_set_font_description (layout, font_desc);
|
||||
pango_layout_get_pixel_size (layout, NULL, &font_height);
|
||||
|
||||
gtk_style_context_get_padding (gtk_widget_get_style_context (widget),
|
||||
@@ -1417,6 +1427,8 @@ gcal_month_view_get_start_grid_y (GtkWidget *widget)
|
||||
&padding);
|
||||
|
||||
start_grid_y += padding.top + font_height;
|
||||
|
||||
pango_font_description_free (font_desc);
|
||||
g_object_unref (layout);
|
||||
return start_grid_y;
|
||||
}
|
||||
|
||||
+39
-24
@@ -450,6 +450,7 @@ gcal_week_view_size_allocate (GtkWidget *widget,
|
||||
|
||||
GtkBorder padding;
|
||||
PangoLayout *layout;
|
||||
PangoFontDescription *font_desc;
|
||||
gint font_height;
|
||||
|
||||
gint start_grid_y;
|
||||
@@ -492,11 +493,13 @@ gcal_week_view_size_allocate (GtkWidget *widget,
|
||||
|
||||
/* Estimating cell height */
|
||||
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);
|
||||
|
||||
gtk_widget_get_preferred_width (priv->vscrollbar, &min, &natural);
|
||||
|
||||
@@ -1021,6 +1024,7 @@ gcal_week_view_draw_header (GcalWeekView *view,
|
||||
|
||||
PangoLayout *layout;
|
||||
PangoFontDescription *bold_font;
|
||||
PangoFontDescription *font_desc;
|
||||
gint header_width;
|
||||
gint layout_width;
|
||||
gint layout_height;
|
||||
@@ -1071,9 +1075,8 @@ gcal_week_view_draw_header (GcalWeekView *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);
|
||||
|
||||
/* Here translators should put the widgest letter in their alphabet, this
|
||||
* taken to make it align with week-view header, which is the larger for now */
|
||||
@@ -1167,8 +1170,7 @@ gcal_week_view_draw_header (GcalWeekView *view,
|
||||
gtk_style_context_get_color (context, state, &color);
|
||||
cairo_set_source_rgb (cr, color.red, color.green, color.blue);
|
||||
|
||||
bold_font = pango_font_description_copy (
|
||||
gtk_style_context_get_font (context, state));
|
||||
gtk_style_context_get (context, state, "font", &bold_font, NULL);
|
||||
pango_font_description_set_weight (bold_font, PANGO_WEIGHT_SEMIBOLD);
|
||||
pango_layout_set_font_description (layout, bold_font);
|
||||
|
||||
@@ -1227,6 +1229,7 @@ gcal_week_view_draw_header (GcalWeekView *view,
|
||||
g_free (left_header);
|
||||
g_free (right_header);
|
||||
pango_font_description_free (bold_font);
|
||||
pango_font_description_free (font_desc);
|
||||
g_object_unref (layout);
|
||||
}
|
||||
|
||||
@@ -1248,6 +1251,7 @@ gcal_week_view_draw_grid_window (GcalWeekView *view,
|
||||
gint sidebar_width;
|
||||
|
||||
PangoLayout *layout;
|
||||
PangoFontDescription *font_desc;
|
||||
|
||||
priv = view->priv;
|
||||
widget = GTK_WIDGET (view);
|
||||
@@ -1262,9 +1266,8 @@ gcal_week_view_draw_grid_window (GcalWeekView *view,
|
||||
gtk_style_context_get_padding (context, state, &padding);
|
||||
|
||||
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);
|
||||
cairo_set_source_rgb (cr, color.red, color.green, color.blue);
|
||||
|
||||
sidebar_width = gcal_week_view_get_sidebar_width (widget);
|
||||
@@ -1322,6 +1325,7 @@ gcal_week_view_draw_grid_window (GcalWeekView *view,
|
||||
|
||||
cairo_stroke (cr);
|
||||
|
||||
pango_font_description_free (font_desc);
|
||||
g_object_unref (layout);
|
||||
}
|
||||
|
||||
@@ -1332,6 +1336,7 @@ gcal_week_view_get_sidebar_width (GtkWidget *widget)
|
||||
GtkBorder padding;
|
||||
|
||||
PangoLayout *layout;
|
||||
PangoFontDescription *font_desc;
|
||||
gint mid_width;
|
||||
gint noon_width;
|
||||
gint sidebar_width;
|
||||
@@ -1344,10 +1349,11 @@ gcal_week_view_get_sidebar_width (GtkWidget *widget)
|
||||
&padding);
|
||||
|
||||
layout = pango_layout_new (gtk_widget_get_pango_context (widget));
|
||||
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_set_text (layout, _("Midnight"), -1);
|
||||
pango_layout_get_pixel_size (layout, &mid_width, NULL);
|
||||
@@ -1356,6 +1362,10 @@ gcal_week_view_get_sidebar_width (GtkWidget *widget)
|
||||
pango_layout_get_pixel_size (layout, &noon_width, NULL);
|
||||
sidebar_width = noon_width > mid_width ? noon_width : mid_width;
|
||||
sidebar_width += padding.left + padding.right;
|
||||
|
||||
pango_font_description_free (font_desc);
|
||||
g_object_unref (layout);
|
||||
|
||||
return sidebar_width;
|
||||
}
|
||||
|
||||
@@ -1378,6 +1388,7 @@ gcal_week_view_get_start_grid_y (GtkWidget *widget)
|
||||
GtkBorder header_padding;
|
||||
|
||||
PangoLayout *layout;
|
||||
PangoFontDescription *font_desc;
|
||||
gint font_height;
|
||||
gdouble start_grid_y;
|
||||
|
||||
@@ -1392,22 +1403,26 @@ gcal_week_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);
|
||||
pango_font_description_free (font_desc);
|
||||
|
||||
/* 6: is padding around the header */
|
||||
start_grid_y = header_padding.top + font_height + header_padding.bottom;
|
||||
gtk_style_context_restore (context);
|
||||
|
||||
/* init grid values */
|
||||
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);
|
||||
pango_font_description_free (font_desc);
|
||||
|
||||
gtk_style_context_get_padding (gtk_widget_get_style_context (widget),
|
||||
gtk_widget_get_state_flags (widget),
|
||||
|
||||
+18
-12
@@ -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;
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user