From ec31e6ec847c1a9c27571467696a2396a33919f2 Mon Sep 17 00:00:00 2001 From: Seth Alves Date: Tue, 28 Mar 2000 15:06:28 +0000 Subject: added libeutil.la and libetext.a * gui/Makefile.am (LINK_FLAGS): added libeutil.la and libetext.a * gui/main.c (calendar_iterate): switch from string_to_ical_object to ical_object_find_in_string (calendar_get_events_in_range): same (session_save_state): commented out references to gcal->client->filename svn path=/trunk/; revision=2213 --- calendar/ChangeLog | 10 +++++++ calendar/gui/Makefile.am | 2 ++ calendar/gui/main.c | 72 +++++++++++++++++++++++++++++++++++++----------- 3 files changed, 68 insertions(+), 16 deletions(-) (limited to 'calendar') diff --git a/calendar/ChangeLog b/calendar/ChangeLog index ab9eace69b..951063b456 100644 --- a/calendar/ChangeLog +++ b/calendar/ChangeLog @@ -1,3 +1,13 @@ +2000-03-28 Seth Alves + + * gui/Makefile.am (LINK_FLAGS): added libeutil.la and libetext.a + + * gui/main.c (calendar_iterate): switch from string_to_ical_object to + ical_object_find_in_string + (calendar_get_events_in_range): same + (session_save_state): commented out references + to gcal->client->filename + 2000-03-27 Federico Mena Quintero * pcs/cal-backend.c (cal_backend_get_object): Use diff --git a/calendar/gui/Makefile.am b/calendar/gui/Makefile.am index d023d251b0..c506044f7d 100644 --- a/calendar/gui/Makefile.am +++ b/calendar/gui/Makefile.am @@ -81,6 +81,8 @@ LINK_FLAGS = \ $(BONOBO_VFS_GNOME_LIBS) \ $(INTLLIBS) \ $(top_builddir)/calendar/cal-util/libcalutil.la \ + $(top_builddir)/e-util/libeutil.la \ + $(top_builddir)/widgets/e-text/libetext.a \ $(top_builddir)/libversit/libversit.la \ $(ICAL_LINK_FLAGS) \ $(top_builddir)/calendar/cal-client/libcal-client.la diff --git a/calendar/gui/main.c b/calendar/gui/main.c index 6aca7aa9b8..ff5103ff5f 100644 --- a/calendar/gui/main.c +++ b/calendar/gui/main.c @@ -1,3 +1,4 @@ +/* -*- Mode: C; tab-width: 8; indent-tabs-mode: t; c-basic-offset: 8 -*- */ /* * Main file for the GNOME Calendar program * Copyright (C) 1998 the Free Software Foundation @@ -674,8 +675,10 @@ new_calendar (char *full_name, char *calendar_file, char *geometry, char *page, if (calendar_file && g_file_exists (calendar_file)) gnome_calendar_load (GNOME_CALENDAR (toplevel), calendar_file); + /* FIX ME else - GNOME_CALENDAR (toplevel)->calc->filename = g_strdup (calendar_file); + GNOME_CALENDAR (toplevel)->client->filename = g_strdup (calendar_file); + */ gtk_signal_connect (GTK_OBJECT (toplevel), "delete_event", GTK_SIGNAL_FUNC(calendar_close_event), toplevel); @@ -937,18 +940,20 @@ session_save_state (GnomeClient *client, gint phase, GnomeRestartStyle save_styl geometry = gnome_geometry_string (GTK_WIDGET (gcal)->window); - if (strcmp (gcal->calc->filename, user_calendar_file) == 0) + /* FIX ME + if (strcmp (gcal->client->filename, user_calendar_file) == 0) argv [i++] = "--userfile"; else { argv [i++] = "--file"; - argv [i++] = gcal->calc->filename; + argv [i++] = gcal->client->filename; } + */ + argv [i++] = "--geometry"; argv [i++] = geometry; argv [i++] = "--view"; argv [i++] = gnome_calendar_get_current_view_name (gcal); free_list = g_list_append (free_list, geometry); - /* calendar_save (gcal->cal, gcal->cal->filename); FIXME */ } argv [i] = NULL; gnome_client_set_clone_command (client, i, argv); @@ -1065,13 +1070,29 @@ calendar_iterate (GnomeCalendar *cal, { GList *l, *uids = 0; - uids = cal_client_get_uids (cal->calc, CALOBJ_TYPE_EVENT); + uids = cal_client_get_uids (cal->client, CALOBJ_TYPE_EVENT); 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); + CalObjFindStatus status; + iCalObject *ico; + char *uid = l->data; + char *obj_string = cal_client_get_object (cal->client, uid); + + /*iCalObject *obj = string_to_ical_object (obj_string);*/ + status = ical_object_find_in_string (uid, obj_string, &ico); + switch (status){ + case CAL_OBJ_FIND_SUCCESS: + ical_object_generate_events (ico, start, end, + cb, closure); + break; + case CAL_OBJ_FIND_SYNTAX_ERROR: + printf("calendar_iterate: syntax error uid=%s\n",uid); + break; + case CAL_OBJ_FIND_NOT_FOUND: + printf("calendar_iterate: obj not found uid=%s\n",uid); + break; + } - ical_object_generate_events (obj, start, end, cb, closure); g_free (l->data); } g_list_free (uids); @@ -1099,16 +1120,35 @@ GList *calendar_get_events_in_range (CalClient *calc, uids = cal_client_get_events_in_range (calc, start, end); for (l = uids; l; l = l->next){ + CalObjFindStatus status; char *obj_string = cal_client_get_object (calc, l->data); - iCalObject *obj = string_to_ical_object (obj_string); - - CalendarObject *co = g_new (CalendarObject, 1); - co->ev_start = start; - co->ev_end = end; - co->ico = obj; + /*iCalObject *obj = string_to_ical_object (obj_string);*/ + iCalObject *ico; + char *uid = l->data; + + status = ical_object_find_in_string (uid, obj_string, &ico); + switch (status){ + case CAL_OBJ_FIND_SUCCESS: + { + CalendarObject *co = g_new (CalendarObject, 1); + co->ev_start = start; + co->ev_end = end; + co->ico = ico; + + res = g_list_insert_sorted (res, co, + calendar_object_compare_by_start); + break; + } + case CAL_OBJ_FIND_SYNTAX_ERROR: + printf ("calendar_get_events_in_range: " + "syntax error uid=%s\n", uid); + break; + case CAL_OBJ_FIND_NOT_FOUND: + printf ("calendar_get_events_in_range: " + "obj not found uid=%s\n", uid); + break; + } - res = g_list_insert_sorted (res, co, - calendar_object_compare_by_start); } return res; -- cgit v1.2.3