diff options
author | Federico Mena Quintero <federico@helixcode.com> | 2000-10-05 05:43:24 +0800 |
---|---|---|
committer | Federico Mena Quintero <federico@src.gnome.org> | 2000-10-05 05:43:24 +0800 |
commit | ee09fc6d052a92c0d62a6f42b5a639f2a3af590c (patch) | |
tree | 1c0329711221a363c7dd7656b98efa10f8f8960a /calendar/gui | |
parent | 9eb9d37c84cb0b57bd4789806c343ff2b4f6be7e (diff) | |
download | gsoc2013-evolution-ee09fc6d052a92c0d62a6f42b5a639f2a3af590c.tar.gz gsoc2013-evolution-ee09fc6d052a92c0d62a6f42b5a639f2a3af590c.tar.zst gsoc2013-evolution-ee09fc6d052a92c0d62a6f42b5a639f2a3af590c.zip |
As a temporary solution to the to-do printing, just print the summaries.
2000-10-04 Federico Mena Quintero <federico@helixcode.com>
* gui/print.c (print_todo_details): As a temporary solution to the
to-do printing, just print the summaries. We'll use the ETable
printing stuff later.
svn path=/trunk/; revision=5721
Diffstat (limited to 'calendar/gui')
-rw-r--r-- | calendar/gui/print.c | 74 |
1 files changed, 40 insertions, 34 deletions
diff --git a/calendar/gui/print.c b/calendar/gui/print.c index 10842bebd0..90d6161886 100644 --- a/calendar/gui/print.c +++ b/calendar/gui/print.c @@ -427,11 +427,12 @@ print_month_small (GnomePrintContext *pc, GnomeCalendar *gcal, /* wraps text into the print context, not taking up more than its allowed space */ static double -bound_text(GnomePrintContext *pc, GnomeFont *font, char *text, double left, double right, double top, double bottom, double indent) +bound_text(GnomePrintContext *pc, GnomeFont *font, const char *text, + double left, double right, double top, double bottom, double indent) { double maxwidth = right-left; double width; - char *p; + const char *p; char *wordstart; int c; char *outbuffer, *o, *outbuffendmarker; @@ -915,32 +916,12 @@ print_month_summary (GnomePrintContext *pc, GnomeCalendar *gcal, time_t whence, } } -/* - * Print to do details - */ -static gboolean -print_todo_details_cb (CalComponent *comp, time_t istart, time_t iend, gpointer data) -{ - CalComponentText text; - struct ptinfo *pti = (struct ptinfo *)data; - struct einfo *ei; - - ei = g_new0 (struct einfo, 1); - - cal_component_get_summary (comp, &text); - ei->text = g_strdup (text.value); - - pti->todos = g_list_append (pti->todos, ei); - - return TRUE; -} - static void print_todo_details (GnomePrintContext *pc, GnomeCalendar *gcal, time_t start, time_t end, double left, double right, double top, double bottom) { CalClient *client; - struct ptinfo pti; + GList *uids; GList *l; GnomeFont *font_summary; double y, yend, x, xend; @@ -952,36 +933,61 @@ print_todo_details (GnomePrintContext *pc, GnomeCalendar *gcal, time_t start, ti gnome_print_setrgbcolor (pc, 0, 0, 0); gnome_print_setlinewidth (pc, 0.0); - titled_box (pc, _("TODO Items"), font_summary, + titled_box (pc, _("Tasks"), font_summary, ALIGN_CENTRE | ALIGN_BORDER, &left, &right, &top, &bottom, 1.0); y = top - 3; yend = bottom - 2; - pti.todos = NULL; + uids = cal_client_get_uids (client, CALOBJ_TYPE_TODO); - cal_client_generate_instances (client, CALOBJ_TYPE_TODO, start, end, - print_todo_details_cb, &pti); + for (l = uids; l; l = l->next) { + char *uid; + CalComponent *comp; + CalClientGetStatus status; + CalComponentText summary; - for (l = pti.todos; l; l = l->next) { - struct einfo *ei = (struct einfo *)l->data; + uid = l->data; + + status = cal_client_get_object (client, uid, &comp); + + switch (status) { + case CAL_CLIENT_GET_SUCCESS: + break; + + case CAL_CLIENT_GET_NOT_FOUND: + /* Nothing: the object may have been removed from the server */ + continue; + + case CAL_CLIENT_GET_SYNTAX_ERROR: + g_message ("print_todo_details(): Syntax error while getting object `%s'", + uid); + continue; + + default: + g_assert_not_reached (); + } + + cal_component_get_summary (comp, &summary); + + if (!summary.value) + continue; x = left; - xend = right-2; + xend = right - 2; if (y < bottom) break; - y = bound_text (pc, font_summary, ei->text, x + 2, xend, y, yend, 0); + y = bound_text (pc, font_summary, summary.value, x + 2, xend, y, yend, 0); y += gnome_font_get_size (font_summary); gnome_print_moveto (pc, x, y - 3); gnome_print_lineto (pc, xend, y - 3); gnome_print_stroke (pc); y -= 3; - - g_free (ei); } - g_list_free (pti.todos); + + cal_obj_uid_list_free (uids); gtk_object_unref (GTK_OBJECT (font_summary)); } |