From feb0ee231e1ba8e6b5e585a1cdb14a2da2ea9ef4 Mon Sep 17 00:00:00 2001 From: Seth Alves Date: Wed, 19 Apr 2000 18:46:17 +0000 Subject: fixed code to populate the todo clist * gui/gncal-todo.c (gncal_todo_update): fixed code to populate the todo clist * cal-client/cal-client.c (cal_client_get_uids): don't check type again CALOBJ_TYPE_ANY since it will always match. (cal_client_get_uids): same (re: CALOBJ_TYPE_ANY) * pcs/cal-backend.c (build_uids_list): same (re: CALOBJ_TYPE_ANY) * pcs/cal.c (Cal_get_uids): same (re: CALOBJ_TYPE_ANY) svn path=/trunk/; revision=2509 --- calendar/ChangeLog | 11 ++++++++ calendar/cal-client/cal-client.c | 5 +++- calendar/gui/corba-cal.c | 7 +---- calendar/gui/gncal-todo.c | 57 +++++++++++++++++----------------------- calendar/pcs/cal-backend.c | 4 ++- calendar/pcs/cal.c | 5 +++- 6 files changed, 47 insertions(+), 42 deletions(-) (limited to 'calendar') diff --git a/calendar/ChangeLog b/calendar/ChangeLog index 742daf2d22..343d456b1c 100644 --- a/calendar/ChangeLog +++ b/calendar/ChangeLog @@ -1,5 +1,16 @@ 2000-04-19 Seth Alves + * gui/gncal-todo.c (gncal_todo_update): fixed code to populate + the todo clist + + * cal-client/cal-client.c (cal_client_get_uids): don't check + type again CALOBJ_TYPE_ANY since it will always match. + (cal_client_get_uids): same (re: CALOBJ_TYPE_ANY) + + * pcs/cal-backend.c (build_uids_list): same (re: CALOBJ_TYPE_ANY) + + * pcs/cal.c (Cal_get_uids): same (re: CALOBJ_TYPE_ANY) + * pcs/cal-backend.c (remove_object): don't call save from here because in all cases the caller of remove_object calls save diff --git a/calendar/cal-client/cal-client.c b/calendar/cal-client/cal-client.c index 710212ba7c..34192387b4 100644 --- a/calendar/cal-client/cal-client.c +++ b/calendar/cal-client/cal-client.c @@ -612,7 +612,10 @@ cal_client_get_uids (CalClient *client, CalObjType type) | ((type & CALOBJ_TYPE_TODO) ? Evolution_Calendar_TYPE_TODO : 0) | ((type & CALOBJ_TYPE_JOURNAL) ? Evolution_Calendar_TYPE_JOURNAL : 0) | ((type & CALOBJ_TYPE_OTHER) ? Evolution_Calendar_TYPE_OTHER : 0) - | ((type & CALOBJ_TYPE_ANY) ? Evolution_Calendar_TYPE_ANY : 0)); + /* + | ((type & CALOBJ_TYPE_ANY) ? Evolution_Calendar_TYPE_ANY : 0) + */ + ); CORBA_exception_init (&ev); diff --git a/calendar/gui/corba-cal.c b/calendar/gui/corba-cal.c index 4b203a4478..38e17256c4 100644 --- a/calendar/gui/corba-cal.c +++ b/calendar/gui/corba-cal.c @@ -123,12 +123,7 @@ calendar_object_find_by_pilot (GnomeCalendar *cal, int pilot_id) g_return_val_if_fail (cal != NULL, NULL); - uids = cal_client_get_uids (cal->calc, - CALOBJ_TYPE_EVENT | - CALOBJ_TYPE_TODO | - CALOBJ_TYPE_JOURNAL | - CALOBJ_TYPE_OTHER | - CALOBJ_TYPE_ANY); + uids = cal_client_get_uids (cal->calc, CALOBJ_TYPE_ANY); for (l = uids; l; l = l->next){ char *obj_string = cal_client_get_object (cal->calc, l->data); iCalObject *obj = string_to_ical_object (obj_string); diff --git a/calendar/gui/gncal-todo.c b/calendar/gui/gncal-todo.c index 7c7752d127..67f682fd10 100644 --- a/calendar/gui/gncal-todo.c +++ b/calendar/gui/gncal-todo.c @@ -1,3 +1,4 @@ +/* -*- Mode: C; tab-width: 8; indent-tabs-mode: t; c-basic-offset: 8 -*- */ /* To-do widget for gncal * * Copyright (C) 1998 The Free Software Foundation @@ -518,7 +519,6 @@ gncal_todo_new (GnomeCalendar *calendar) return GTK_WIDGET (todo); } -#if 0 static char * convert_time_t_to_char (time_t t) { @@ -530,10 +530,8 @@ convert_time_t_to_char (time_t t) return g_strdup (buf); } -#endif /* 0 */ -#if 0 enum todo_styles { TODO_STYLE_OVERDUE, TODO_STYLE_DUE_TODAY, @@ -576,10 +574,8 @@ make_todo_style(GncalTodo *todo, todo_status style_type) style->base[GTK_STATE_NORMAL] = style_color; return style; } -#endif /* 0 */ -#if 0 static todo_status todo_item_due_status(time_t *todo_due_time) { struct tm due_tm_time; @@ -606,7 +602,6 @@ todo_status todo_item_due_status(time_t *todo_due_time) { return TODO_ITEM_DSTATUS_NOT_DUE_YET; } -#endif /* 0 */ enum todo_remaining_time_form { @@ -618,7 +613,7 @@ enum todo_remaining_time_form { }; typedef enum todo_remaining_time_form todo_remaining_time_form; -#if 0 + static void insert_in_clist (GncalTodo *todo, iCalObject *ico) { @@ -799,13 +794,16 @@ insert_in_clist (GncalTodo *todo, iCalObject *ico) /* keep the list in order */ gtk_clist_sort (todo->clist); } -#endif /* 0 */ + void gncal_todo_update (GncalTodo *todo, iCalObject *ico, int flags) { GSList *current_list; + CalObjFindStatus st; + GList *l, *uids; + g_return_if_fail (todo != NULL); g_return_if_fail (GNCAL_IS_TODO (todo)); @@ -861,30 +859,21 @@ gncal_todo_update (GncalTodo *todo, iCalObject *ico, int flags) gtk_clist_clear (todo->clist); -#if 0 - /* FIXME: this is broken; it should fetch TODO objects, and it should - * use ical_object_find_in_string(). - */ - { - /* DELETE - for (list = todo->calendar->cal->todo; list; list = list->next) - insert_in_clist (todo, list->data); - */ - - GList *l, *uids; - uids = cal_client_get_uids (todo->calendar->client, - CALOBJ_TYPE_EVENT); - for (l = uids; l; l = l->next){ - char *obj_string = - cal_client_get_object (todo->calendar->client, - l->data); - iCalObject *obj = string_to_ical_object (obj_string); - insert_in_clist (todo, obj); - g_free (l->data); - } - g_list_free (uids); + + uids = cal_client_get_uids (todo->calendar->client, + CALOBJ_TYPE_TODO); + for (l = uids; l; l = l->next){ + char *uid = l->data; + char *obj_string = + cal_client_get_object (todo->calendar->client, uid); + iCalObject *obj = NULL; + + st = ical_object_find_in_string (uid, obj_string, &obj); + + insert_in_clist (todo, obj); + g_free (uid); } -#endif + g_list_free (uids); /* if we are autoresizing then do it now */ if(todo_list_autoresize && todo->clist->rows != 0) @@ -892,8 +881,10 @@ gncal_todo_update (GncalTodo *todo, iCalObject *ico, int flags) gtk_clist_thaw (todo->clist); - gtk_widget_set_sensitive (todo->edit_button, (todo->clist->selection != NULL)); - gtk_widget_set_sensitive (todo->delete_button, (todo->clist->selection != NULL)); + gtk_widget_set_sensitive (todo->edit_button, + (todo->clist->selection != NULL)); + gtk_widget_set_sensitive (todo->delete_button, + (todo->clist->selection != NULL)); todo_list_redraw_in_progess = 0; } diff --git a/calendar/pcs/cal-backend.c b/calendar/pcs/cal-backend.c index 4cd7877e30..353abc9465 100644 --- a/calendar/pcs/cal-backend.c +++ b/calendar/pcs/cal-backend.c @@ -860,9 +860,11 @@ build_uids_list (gpointer key, gpointer value, gpointer data) store = FALSE; + /* if (c->type & CALOBJ_TYPE_ANY) store = TRUE; - else if (ico->type == ICAL_EVENT) + else */ + if (ico->type == ICAL_EVENT) store = (c->type & CALOBJ_TYPE_EVENT) ? TRUE : FALSE; else if (ico->type == ICAL_TODO) store = (c->type & CALOBJ_TYPE_TODO) ? TRUE : FALSE; diff --git a/calendar/pcs/cal.c b/calendar/pcs/cal.c index 0dd3e81649..e1d3623ccf 100644 --- a/calendar/pcs/cal.c +++ b/calendar/pcs/cal.c @@ -220,7 +220,10 @@ Cal_get_uids (PortableServer_Servant servant, | ((type & Evolution_Calendar_TYPE_TODO) ? CALOBJ_TYPE_TODO : 0) | ((type & Evolution_Calendar_TYPE_JOURNAL) ? CALOBJ_TYPE_JOURNAL : 0) | ((type & Evolution_Calendar_TYPE_OTHER) ? CALOBJ_TYPE_OTHER : 0) - | ((type & Evolution_Calendar_TYPE_ANY) ? CALOBJ_TYPE_ANY : 0)); + /* + | ((type & Evolution_Calendar_TYPE_ANY) ? CALOBJ_TYPE_ANY : 0) + */ + ); uids = cal_backend_get_uids (priv->backend, t); n = g_list_length (uids); -- cgit v1.2.3