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
This commit is contained in:
Seth Alves
2000-04-19 18:46:17 +00:00
parent bd4a8695da
commit feb0ee231e
6 changed files with 46 additions and 41 deletions

View File

@ -1,5 +1,16 @@
2000-04-19 Seth Alves <alves@hungry.com>
* 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

View File

@ -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);

View File

@ -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);

View File

@ -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;
}

View File

@ -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;

View File

@ -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);