aboutsummaryrefslogtreecommitdiffstats
path: root/calendar/gui/print.c
diff options
context:
space:
mode:
authorDamon Chaplin <damon@ximian.com>2001-10-29 06:13:13 +0800
committerDamon Chaplin <damon@src.gnome.org>2001-10-29 06:13:13 +0800
commitd16418158d22a039e2a9a9665a5b337aed5f510a (patch)
treea266037935761cecd56a01901524dd0bfc91a560 /calendar/gui/print.c
parentdf39199fb04368c2bd25e7922edb7a83be382690 (diff)
downloadgsoc2013-evolution-d16418158d22a039e2a9a9665a5b337aed5f510a.tar.gz
gsoc2013-evolution-d16418158d22a039e2a9a9665a5b337aed5f510a.tar.zst
gsoc2013-evolution-d16418158d22a039e2a9a9665a5b337aed5f510a.zip
get the tasks directly from the CalendarModel, so we get the filtering &
2001-10-28 Damon Chaplin <damon@ximian.com> * gui/print.c (print_todo_details): get the tasks directly from the CalendarModel, so we get the filtering & sorting for free. Fixes bug #10280. Hmm. This seems too easy. It isn't going to work is it... * gui/gnome-cal.c (gnome_calendar_get_task_pad): new function to get the TaskPad ECalendarTable, for printing. * gui/calendar-model.c: * gui/calendar-config.c (calendar_config_get_hide_completed_tasks_sexp): split this out from calendar-model.c so we could use it for printing, but ended up doing that a different way. * gui/dialogs/task-page.c (init_widgets): removed a duplicated signal connected to field_changed_cb(). svn path=/trunk/; revision=14302
Diffstat (limited to 'calendar/gui/print.c')
-rw-r--r--calendar/gui/print.c46
1 files changed, 16 insertions, 30 deletions
diff --git a/calendar/gui/print.c b/calendar/gui/print.c
index ba96781ccf..253c23c0c0 100644
--- a/calendar/gui/print.c
+++ b/calendar/gui/print.c
@@ -1702,18 +1702,26 @@ print_month_summary (GnomePrintContext *pc, GnomeCalendar *gcal, time_t whence,
left, right, top, bottom);
}
+
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;
- GList *uids;
- GList *l;
GnomeFont *font_summary;
double y, yend, x, xend;
struct icaltimetype *tt;
-
+ ECalendarTable *task_pad;
+ ETable *table;
+ CalendarModel *model;
+ gint rows, row;
+
+ /* We get the tasks directly from the TaskPad ETable. This means we
+ get them filtered & sorted for free. */
+ task_pad = gnome_calendar_get_task_pad (gcal);
+ table = e_calendar_table_get_table (task_pad);
+ model = e_calendar_table_get_model (task_pad);
client = gnome_calendar_get_task_pad_cal_client (gcal);
font_summary = gnome_font_new_closest ("Times", GNOME_FONT_BOOK,
@@ -1728,34 +1736,14 @@ print_todo_details (GnomePrintContext *pc, GnomeCalendar *gcal,
y = top - 3;
yend = bottom - 2;
- uids = cal_client_get_uids (client, CALOBJ_TYPE_TODO);
-
- for (l = uids; l; l = l->next) {
- char *uid;
+ rows = e_table_model_row_count (E_TABLE_MODEL (model));
+ for (row = 0; row < rows; row++) {
CalComponent *comp;
- CalClientGetStatus status;
CalComponentText summary;
+ int model_row;
- 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 ();
- }
+ model_row = e_table_view_to_model_row (table, row);
+ comp = calendar_model_get_component (model, model_row);
cal_component_get_summary (comp, &summary);
@@ -1793,8 +1781,6 @@ print_todo_details (GnomePrintContext *pc, GnomeCalendar *gcal,
y -= 3;
}
- cal_obj_uid_list_free (uids);
-
gtk_object_unref (GTK_OBJECT (font_summary));
}