aboutsummaryrefslogtreecommitdiffstats
path: root/calendar/gui/print.c
diff options
context:
space:
mode:
authorMatthew Barnes <mbarnes@src.gnome.org>2009-01-21 10:52:05 +0800
committerMatthew Barnes <mbarnes@src.gnome.org>2009-01-21 10:52:05 +0800
commitab00f5b08adb1d74a0c70d935a32ffd982e86f34 (patch)
tree45bfaa44682bc3eee5a2ad8a64112b248767af5b /calendar/gui/print.c
parent5a1c48696363e3f3c7ffe11bdffdcad6557f811a (diff)
downloadgsoc2013-evolution-ab00f5b08adb1d74a0c70d935a32ffd982e86f34.tar
gsoc2013-evolution-ab00f5b08adb1d74a0c70d935a32ffd982e86f34.tar.gz
gsoc2013-evolution-ab00f5b08adb1d74a0c70d935a32ffd982e86f34.tar.bz2
gsoc2013-evolution-ab00f5b08adb1d74a0c70d935a32ffd982e86f34.tar.lz
gsoc2013-evolution-ab00f5b08adb1d74a0c70d935a32ffd982e86f34.tar.xz
gsoc2013-evolution-ab00f5b08adb1d74a0c70d935a32ffd982e86f34.tar.zst
gsoc2013-evolution-ab00f5b08adb1d74a0c70d935a32ffd982e86f34.zip
Merge revisions 37075:37107 from trunk.
svn path=/branches/kill-bonobo/; revision=37112
Diffstat (limited to 'calendar/gui/print.c')
-rw-r--r--calendar/gui/print.c59
1 files changed, 33 insertions, 26 deletions
diff --git a/calendar/gui/print.c b/calendar/gui/print.c
index dcd9672ec7..f448b4704d 100644
--- a/calendar/gui/print.c
+++ b/calendar/gui/print.c
@@ -1062,13 +1062,33 @@ print_attendees (GtkPrintContext *context, PangoFontDescription *font, cairo_t *
return top;
}
+static char *
+get_summary_with_location (icalcomponent *icalcomp)
+{
+ const gchar *summary, *location;
+ char *text;
+
+ g_return_val_if_fail (icalcomp != NULL, NULL);
+
+ summary = icalcomponent_get_summary (icalcomp);
+ text = summary ? (char*) summary : "";
+
+ location = icalcomponent_get_location (icalcomp);
+ if (location && *location) {
+ text = g_strdup_printf ("%s (%s)", text, location);
+ } else {
+ text = g_strdup (text);
+ }
+
+ return text;
+}
+
static void
print_day_long_event (GtkPrintContext *context, PangoFontDescription *font,
double left, double right, double top, double bottom,
double row_height, EDayViewEvent *event,
struct pdinfo *pdi, ECalModel *model)
{
- const gchar *summary;
double x1, x2, y1, y2;
double left_triangle_width = -1.0, right_triangle_width = -1.0;
char *text;
@@ -1134,12 +1154,13 @@ print_day_long_event (GtkPrintContext *context, PangoFontDescription *font,
}
/* Print the text. */
- summary = icalcomponent_get_summary (event->comp_data->icalcomp);
- text = summary ? (char*) summary : "";
+ text = get_summary_with_location (event->comp_data->icalcomp);
x1 += 4;
x2 -= 4;
print_text (context, font, text, PANGO_ALIGN_CENTER, x1, x2, y1, y2);
+
+ g_free (text);
}
@@ -1148,11 +1169,10 @@ print_day_event (GtkPrintContext *context, PangoFontDescription *font,
double left, double right, double top, double bottom,
EDayViewEvent *event, struct pdinfo *pdi, ECalModel *model)
{
- const gchar *summary, *location;
double x1, x2, y1, y2, col_width, row_height;
int start_offset, end_offset, start_row, end_row;
char *text, start_buffer[32], end_buffer[32];
- gboolean display_times = FALSE, free_text = FALSE;
+ gboolean display_times = FALSE;
struct tm date_tm;
double red, green, blue;
@@ -1188,14 +1208,7 @@ print_day_event (GtkPrintContext *context, PangoFontDescription *font,
e_cal_model_get_rgb_color_for_component (model, event->comp_data, &red, &green, &blue);
print_border_rgb (context, x1, x2, y1, y2, 1.0, red, green, blue);
- summary = icalcomponent_get_summary (event->comp_data->icalcomp);
- text = summary ? (char*) summary : "";
-
- location = icalcomponent_get_location (event->comp_data->icalcomp);
- if (location && *location) {
- text = g_strdup_printf ("%s (%s)", text, location);
- free_text = TRUE;
- }
+ text = get_summary_with_location (event->comp_data->icalcomp);
if (display_times) {
gchar *t = NULL;
@@ -1217,22 +1230,16 @@ print_day_event (GtkPrintContext *context, PangoFontDescription *font,
e_time_format_time (&date_tm, pdi->use_24_hour_format, FALSE,
end_buffer, sizeof (end_buffer));
- if (free_text)
- t = text;
-
+ t = text;
text = g_strdup_printf ("%s - %s %s ", start_buffer,
end_buffer, text);
- free_text = TRUE;
-
- if (t)
- g_free (t);
+ g_free (t);
}
bound_text (context, font, text, -1, x1 + 2, y1, x2 - 2, y2, FALSE, NULL, NULL);
- if (free_text)
- g_free (text);
+ g_free (text);
}
@@ -1337,7 +1344,7 @@ print_day_details (GtkPrintContext *context, GnomeCalendar *gcal, time_t whence,
/* lay out the short events, within the day. */
e_day_view_layout_day_events (pdi.events[0], DAY_VIEW_ROWS,
- DAY_VIEW_MINS_PER_ROW, pdi.cols_per_row);
+ DAY_VIEW_MINS_PER_ROW, pdi.cols_per_row, -1);
/* print the short events. */
if (top > bottom )
@@ -1497,15 +1504,13 @@ print_week_event (GtkPrintContext *context, PangoFontDescription *font,
{
EWeekViewEventSpan *span;
gint span_num;
- const gchar *summary;
char *text;
int num_days, start_x, start_y, start_h, end_x, end_y, end_h;
double x1, x2, y1, y2;
double red, green, blue;
GdkPixbuf *pixbuf = NULL;
- summary = icalcomponent_get_summary (event->comp_data->icalcomp);
- text = summary ? (char*) summary : "";
+ text = get_summary_with_location (event->comp_data->icalcomp);
for (span_num = 0; span_num < event->num_spans; span_num++) {
span = &g_array_index (spans, EWeekViewEventSpan,
@@ -1610,6 +1615,8 @@ print_week_event (GtkPrintContext *context, PangoFontDescription *font,
if (pixbuf)
g_object_unref (pixbuf);
+
+ g_free (text);
}