diff options
author | nobody <nobody@localhost> | 1999-10-24 08:17:41 +0800 |
---|---|---|
committer | nobody <nobody@localhost> | 1999-10-24 08:17:41 +0800 |
commit | cca27358693f69168d0ee71c130013de6b6a34dc (patch) | |
tree | d2a2e7da66030c3d71101bfaaa82d90561e778ff | |
parent | 8fe1aa5f41bfec98795cc71df37d4afbbc34464f (diff) | |
download | gsoc2013-evolution-cca27358693f69168d0ee71c130013de6b6a34dc.tar gsoc2013-evolution-cca27358693f69168d0ee71c130013de6b6a34dc.tar.gz gsoc2013-evolution-cca27358693f69168d0ee71c130013de6b6a34dc.tar.bz2 gsoc2013-evolution-cca27358693f69168d0ee71c130013de6b6a34dc.tar.lz gsoc2013-evolution-cca27358693f69168d0ee71c130013de6b6a34dc.tar.xz gsoc2013-evolution-cca27358693f69168d0ee71c130013de6b6a34dc.tar.zst gsoc2013-evolution-cca27358693f69168d0ee71c130013de6b6a34dc.zip |
This commit was manufactured by cvs2svn to create tagGNOME_PIM_1_0_55
'GNOME_PIM_1_0_55'.
svn path=/tags/GNOME_PIM_1_0_55/; revision=1350
45 files changed, 1075 insertions, 1848 deletions
diff --git a/calendar/ChangeLog b/calendar/ChangeLog index de2f6fab65..d2115f9147 100644 --- a/calendar/ChangeLog +++ b/calendar/ChangeLog @@ -1,3 +1,8 @@ +1999-10-23 Russell Steinthal <rms39@columbia.edu> + + * calendar.c (calendar_new): Correctly initialize calendar_day_end + and calendar_day_begin *before* installing day-change alarm. + 1999-10-21 Russell Steinthal <rms39@columbia.edu> * alarm.c, main.c: Added alarm debugging code @@ -7,40 +12,13 @@ 1999-10-19 Russell Steinthal <rms39@columbia.edu> - * gnome-cal.c (calendar_notify): Fix typos which were causing - invalid times in audio notification dialogs; fixes Bug #2561 - -1999-10-18 Russell Steinthal <rms39@columbia.edu> - - * gncal-day-panel.c (gncal_day_panel_new): Placed the various - elements of the day view in paned windows so that the user can - adjust the relative sizes of the daily schedule, monthly calendar, - and to-do list. + * gnome-cal.c (calendar_notify): Use aalarm.trigger and + aalarm.offset for audio alarms, not dalarm values; fixes bug #2561 1999-10-18 Martin Norbäck <norpan@bigfoot.com> * gncal.desktop: Added swedish translation -1999-10-13 Eskil Olsen <deity@eskil.dk> - - * Makefile.am: Hopefully the fixes the much-hated - gnome-pilot dependency. - -1999-10-07 Eskil Olsen <deity@eskil.dk> - - * calendar.c (calendar_object_changed): moved the pilot_status = - MOD up, so even a CHANGE_SUMMARY will set the modified flag. - - * calendar-conduit.c: more _free calls, vamped the noise on output. - -1999-10-06 Eskil Olsen <deity@eskil.dk> - - * *conduit*[ch]: checks return values from gpilotd_init/connect. - - * calender.c (vcalendar_create_from_calendar): removed a set - of cleanVObject cleanStrTbl, since the freed memory that the - function returned. - 1999-09-27 Timur Bakeyev <mc@bat.ru> * timeutil.c (time_from_isodate): Use tm.gmtoff or timezone to get @@ -70,56 +48,17 @@ * calobj.c (ical_object_generate_events): Get rid of pointers to values returned from localtime, as it uses a static buffer. - -1999-09-26 Eskil Olsen <deity@eskil.dk> - - * corba-cal.c: the g_free that was commented out since glib said - was a duplicate free, was supposed to be a free. - - * GnomeCal.idl/corba-cal.c: added a get_object_id_list and a - get_objects_by_id_list. Latter is not done. - - * calendar-conduit.c: rewrote the way the conduit iterates over - records. It no longers fetches all entries (since that didn't work - with more then 285 entries. It now fetches the id list, and gets - each record. (will be using get_objects_by_id_list to get records - in amounts of 10 or so later, to reduce amount of corba calls). - - * calendar-conduit.c: now sets alarm parameters when transferring - from gnomecal to pilot. - -1999-09-23 Eskil Olsen <deity@eskil.dk> - - * calendar-conduit.c: better merge of summary/description - when doing ical_from_remote (update_record), also handles - import from gnomecal to pilot better, and on both ways, repeat - events are much better now. - -1999-09-22 Eskil Olsen <deity@eskil.dk> - - * corba-cal.c: commented out a g_free that glib reported - as being a duplicate free. - * calendar-conduit.c: got gnomecal->pilot up and runnning. - -1999-02-06 Lauris Kaplinski <lauris@ariman.ee> - - * gncal.desktop: Added Estonian translations. - + 1999-09-14 Federico Mena Quintero <federico@redhat.com> * gncal-full-day.c (child_popup_menu): Set the data pointers for all the items. -1999-09-14 Kjartan Maraas <kmaraas@online.no> +1999-09-13 Kjartan Maraas <kmaraas@online.no> - * doc/C/gnomecal.sgml: Merge from gnome-pim-1-0. Synced with newest - user-guide. + * doc/C/gnomecal.sgml: Updated and synced with the latest + version of gnome-users-guide. (1.0.6) -1999-09-01 Miguel de Icaza <miguel@gnu.org> - - * eventedit.c (ee_create_buttons): Make the OK button the default - button per Russell's suggestion. - 1999-08-30 Miguel de Icaza <miguel@nuclecu.unam.mx> * calendar.c (calendar_object_changed): Modify the @@ -127,141 +66,71 @@ (calendar_add_object): Ditto. Closes bug #676 - + * main.c (save_calendar_cmd): Fix problem in which we warned the user about the calendar being modified the first time the calendar was used. -1999-08-22 Tomas Ogren <stric@ing.umu.se> - - * gnomecal.gnorba: "GenericFactoy" is wrong... - -1999-08-15 Miguel de Icaza <miguel@gnu.org> - - * calobj.c (ical_gen_uid): Fix the hostname part. - -1999-08-07 Peter Teichman <pat4@acpub.duke.edu> - - * calendar-pilot-sync.c (sync_pilot): sync correctly for objects - created on the pilot, but not dirty (because they have been synced - with some other program in the past) - -1999-07-30 Miguel de Icaza <miguel@gnu.org> - - * month-view.c (month_view_init): Release points here. - -1999-08-02 Peter Teichman <pat4@acpub.duke.edu> - - * Makefile.am (libcalendar_conduit_la_LDFLAGS): - libcalendar_conduit now installs - - * calendar-pilot-sync.c (sync_pilot): do deletion of appointments - correctly, when they are deleted on the pilot - (conduit_free_Appointment): protect against double-freeing parts - of the Appointment structure - (update_record): all-day events from the pilot are handled a bit - more reasonably - -1999-08-01 Peter Teichman <pat4@acpub.duke.edu> - - * calendar-pilot-sync.c (sync_object_to_pilot): The multi-day - appointment corruption bug is dead. Whoo! - -1999-07-31 Peter Teichman <pat4@acpub.duke.edu> - - * Makefile.am: fixed this up slightly with respect to pilot conduits - -1999-07-30 Jonathan Blandford <jrb@redhat.com> - - * Makefile.am (libcalendar_conduit_la_LIBADD): More autoconf-stuff - -1999-07-29 Jonathan Blandford <jrb@redhat.com> +1999-04-27 Federico Mena Quintero <federico@nuclecu.unam.mx> - * gnome-cal.c (setup_widgets): Add scrolling to the yearview. + * gnome-month-item.c (gnome_month_item_set_arg): Fixed cut&paste + bug for day fontsets. -1999-07-28 Miguel de Icaza <miguel@gnu.org> - - * calendar-pilot-sync.c: (sync_object_to_pilot): If the enddate is - not set, set the repeatForever to 1. This fixes all of the - birthdays problems I had. - - Make the code not take arguments - (sync_cal_to_pilot): Nice event update information - - * calendar.c (calendar_new): Add Event UID hash table. - (calendar_add_object): Add events to the hash table here. - (calendar_remove_object): Remove events here. - (calendar_object_find_event): Use the hash table here. - - * main.c (save_calendar_cmd): The object is already destroyed by - gnome_dialog_run. - - * calendar-pilot-sync.c (sync_object_to_pilot): Do not turn - archived bit on. - - * calobj.c (ical_gen_uid): Use the hostname, not the domain name. - (ical_gen_uid): Add a serial number. Isodates can be small. +1999-05-26 Russell Steinthal <steintr@condor.penguinpowered.com> - * corba-cal.c (cal_repo_update_pilot_id): New method to update the - pilot status. - (cal_repo_get_updated_objects): New method. Returns a list of - modified and not-sycned objects + * gncal-todo.c main.c main.h prop.c: Added support for priorities + for todo items. Doesn't do much, but you can set them and sort by + them. (Use the properties box to enable them; should they be on + by default?) - * calendar-pilot-sync.c (sync_cal_to_pilot): New function to sync - from the GnomeCalendar to the pilot. - (sync_object_to_pilot): Sync a single event to the pilot. - (try_alarm): Alarm syncing code. +1999-05-25 Miguel de Icaza <miguel@nuclecu.unam.mx> -1999-07-27 Miguel de Icaza <miguel@gnu.org> + * main.c (parse_an_arg): Added missing break here. It was causing + core dumps when invoked with --userfile. - * calendar-pilot-sync.c: New file. Implements PalmPilot - syncronization with the Gnome Calendar. - - * calobj.c (ical_object_new_from_string): New function. Creates - an iCalObject from a vCalendar string that is supposed to contain - only one vEvent. + * gnome-cal.c (gnome_calendar_set_view): Add some assertions here, + to pin point the bug reported on gnome-list. - * calendar.c: - (calendar_save): Split this routine in two. + * calobj.c (load_recurrence): Make intervals always exist. a 0 + interval is wrong. - * gnome-cal.c (gnome_calendar_new): Create the corba server here. +1999-05-25 Federico Mena Quintero <federico@nuclecu.unam.mx> - * main.c: Include gnorba.h, and corba-cal-factory.h here - (close_cmd): Kill the calendar server on shutdown. + * year-view.c: Removed unused macro CALENDAR_HEIGHT. - * calobj.c (load_recur_yearly_day): Added a fixme comment. WE - need to handle intervals in the years. +1999-05-25 Federico Mena Quintero <federico@nuclecu.unam.mx> - * calendar.c (calendar_object_find_in_list, calendar_object_find, - calendar_object_find_todo, calendar_object_find_event): New - functions for looking up information. + * year-view.c (idle_handler): Set the canvas scroll region here, + not in size_allocate(). Also, use the correct width and height + based on the allocation and the precomputed minimum width/height + values. - * main.c (gnome_calendar_locate): New function. + * gnome-cal.c (setup_widgets): Set the scrollbar policy of the + scrolled window. - * corba-cal.c (calendar_create_object): New file. Implements the - corba server. + * main.c (setup_appbar): Use the correct type for the appbar. - * calendar.c (calendar_object_changed): Flag pilot-status as changed. + * gncal-day-view.c: Removed unused function switch_to_day(). - * calobj.c (ical_object_to_vobject): Save pilot information for syncing. - (ical_object_create_from_vobject): Load syncing information for - pilot. Do it in a way compatible with KOrganizer. + * gncal-day-panel.c (calendar_day_selected): Removed unused variable. -1999-07-26 Miguel de Icaza <miguel@gnu.org> +1999-05-25 Nat Friedman <nat@nat.org> - * calobj.c (ical_object_create_from_vobject): Generate unique IDs - on Vevents we load that lack it. WE need this for the old - gnome calendar generated files (ie, before now :-). + * doc/C/gnomecal.sgml: Fixed a typo. - Required to sync with the Palm + * gnome-cal.c (setup_widgets): Added a scrolled window widget into + which the year view is placed. -1999-07-26 Miguel de Icaza <miguel@gnu.org> + * year-view.c (CALENDAR_HEIGHT): The height of the total year view + inside the scrolled window. + (idle_handler): Set the height of the year view to + CALENDAR_HEIGHT. + (year_view_size_allocate): Set the scroll region of the year view + canvas to allocation->width, CALENDAR_HEIGHT. - * calobj.c (ical_object_create_from_vobject): Generate unique IDs - on Vevents we load that lack it. WE need this for the old - gnome calendar generated files (ie, before now :-). +1999-04-25 Miguel de Icaza <miguel@nuclecu.unam.mx> - Required to sync with the Palm + * main.c (dump_todo): Add --todo flag to dump the todo contents. 1999-07-19 Matt Martin <matt@abacusnet.net> diff --git a/calendar/Makefile.am b/calendar/Makefile.am index 4042368bff..b340b03a9d 100644 --- a/calendar/Makefile.am +++ b/calendar/Makefile.am @@ -1,51 +1,15 @@ SUBDIRS = doc -idldir = $(datadir)/idl -idl_DATA = GnomeCal.idl - -gnorbadir = $(sysconfdir)/CORBA/servers -gnorba_DATA = gnomecal.gnorba - help_base = $(datadir)/gnome/help/cal -if HAVE_GNOME_PILOT -bin_PROGRAMS = \ - gnomecal \ - calendar-conduit-control-applet \ - calendar-pilot-sync -else -bin_PROGRAMS = gnomecal -endif - -INCLUDES = \ +INCLUDES = \ -I$(includedir) \ $(GNOME_INCLUDEDIR) \ - $(GNOME_CONDUIT_INCLUDEDIR) \ - $(PISOCK_INCLUDEDIR) \ -DGNOMELOCALEDIR=\""$(datadir)/locale"\" -GNOMECAL_CORBA_GENERATED = \ - GnomeCal.h \ - GnomeCal.c \ - GnomeCal-common.c \ - GnomeCal-skels.c \ - GnomeCal-stubs.c - -$(GNOMECAL_CORBA_GENERATED): my_gnomecal_idl - -my_gnomecal_idl: GnomeCal.idl - orbit-idl $(srcdir)/GnomeCal.idl - touch my_gnomecal_idl - -corba-cal.c \ -corba-cal.h \ -corba-cal-factory.c \ -corba-cal-factory.h: GnomeCal.h +bin_PROGRAMS = gnomecal gnomecal_SOURCES = \ - GnomeCal-common.c \ - GnomeCal-skels.c \ - GnomeCal.h \ alarm.c \ alarm.h \ calendar.c \ @@ -55,10 +19,6 @@ gnomecal_SOURCES = \ eventedit.c \ eventedit.h \ getdate.y \ - corba-cal.c \ - corba-cal.h \ - corba-cal-factory.c \ - corba-cal-factory.h \ gncal-day-panel.c \ gncal-day-panel.h \ gncal-day-view.c \ @@ -95,117 +55,21 @@ gnomecal_SOURCES = \ year-view.c \ year-view.h -calendar_pilot_sync_SOURCES = \ - GnomeCal-common.c \ - GnomeCal-stubs.c \ - alarm.c \ - calendar-pilot-sync.c \ - calobj.c \ - calobj.h \ - calendar.c \ - calendar.h \ - timeutil.c \ - timeutil.h - LINK_FLAGS = \ $(GNOME_LIBDIR) \ $(GNOMEGNORBA_LIBS) \ - $(INTLLIBS) \ - ../libversit/libversit.la - -calendar_pilot_sync_LDADD = \ - $(PISOCK_LIBS) \ - $(LINK_FLAGS) - -if HAVE_GNOME_PILOT -#calendar_conduit -calendar_conduitsdir=$(libdir)/gnome-pilot/conduits - -calendar_conduits_LTLIBRARIES = libcalendar_conduit.la - -libcalendar_conduit_la_SOURCES = \ - GnomeCal-common.c \ - GnomeCal-stubs.c \ - calendar-conduit.c \ - calobj.c \ - alarm.c \ - calendar.c \ - timeutil.c - -calendar-conduit.c: my_gnomecal_idl - -libcalendar_conduit_la_LDFLAGS = \ - -rpath $(libdir) - -libcalendar_conduit_la_LIBADD = \ - ../libversit/libversit.la \ - $(PISOCK_LIBS) \ - $(GNOME_LIBDIR) \ - $(GNOME_LIBS) - -calendar_conduit_control_applet_SOURCES = \ - calendar-conduit-control-applet.c - -calendar_conduit_control_applet_LDADD = \ - $(CAPPLET_LIBS) \ - $(GNOME_LIBDIR) \ - $(GNOME_CAPPLET_LIBS) \ - $(PISOCK_LIBS) \ - $(GNOMEUI_LIBS) \ - $(PISOCK_LIBS) \ - $(GNOME_PILOT_LIBS) \ - $(INTLLIBS) - -#todo_conduit -#todo_conduitsdir=$(libdir)/gnome-pilot/conduits + $(INTLLIBS) ../libversit/libversit.a -#todo_conduits_LTLIBRARIES = libtodo_conduit.la -#libtodo_conduit_la_LDFLAGS = \ -# -rpath $(libdir) - -#libtodo_conduit_la_LIBADD = \ -# $(GNOME_LIBDIR) \ -# $(GNOME_LIBS) - -#libtodo_conduit_la_SOURCES = \ -# todo-conduit.c - -#todo-conduit.c: GnomeCal.h - -#todo_conduit_control_applet_SOURCES = \ -# todo-conduit-control-applet.c - -#todo_conduit_control_applet_LDADD = \ -# $(CAPPLET_LIBS) \ -# $(GNOME_LIBDIR) \ -# $(GNOME_CAPPLET_LIBS) \ -# $(PISOCK_LIBS) \ -# $(GNOMEUI_LIBS) \ -# $(PISOCK_LIBS) \ -# $(GNOME_PILOT_LIBS) \ -# $(INTLLIBS) -endif +#gncal_LDADD = $(LINK_FLAGS) gnomecal_LDADD = $(LINK_FLAGS) -if HAVE_GNOME_PILOT -ccenterdir = $(datadir)/control-center -Rootdir = $(ccenterdir) -PalmPilotdir = $(ccenterdir)/Peripherals/PalmPilot -Conduitsdir = $(PalmPilotdir)/Conduits - -Conduits_DATA = \ - calendar-conduit-control-applet.desktop \ - todo-conduit-control-applet.desktop -endif - EXTRA_DIST = \ gncal.desktop \ bell.xpm \ - recur.xpm \ - $(idl_DATA) \ - $(gnorba_DATA) + recur.xpm + Productivitydir = $(datadir)/gnome/apps/Applications @@ -213,4 +77,3 @@ Productivity_DATA = gncal.desktop install-data-local: $(mkinstalldirs) $(DESTDIR)$(help_base)/C - $(mkinstalldirs) $(Conduitsdir) diff --git a/calendar/TODO b/calendar/TODO index 2dbd29cdbb..5271b15909 100644 --- a/calendar/TODO +++ b/calendar/TODO @@ -1,12 +1,3 @@ -Pilot: - -* Better support for untimed events (we have none now). - -* Hash objects based on their UIDs. - -* Add placeholders for deleted events, so that we can kill those - when syncing to the pilot. - BUGS: - Recurrence end date is wrong. An event that repeats daily will not diff --git a/calendar/alarm.c b/calendar/alarm.c index 04e7c02e49..b7f0d12e13 100644 --- a/calendar/alarm.c +++ b/calendar/alarm.c @@ -170,7 +170,7 @@ void alarm_init (void) { struct sigaction sa; - int flags = 0; + int flags; pipe (alarm_pipes); diff --git a/calendar/cal-util/calobj.c b/calendar/cal-util/calobj.c index 806c27d8ff..0b1980e7ba 100644 --- a/calendar/cal-util/calobj.c +++ b/calendar/cal-util/calobj.c @@ -52,9 +52,6 @@ ical_object_new (void) ico->seq = -1; ico->dtstamp = time (NULL); ico->uid = ical_gen_uid (); - - ico->pilot_id = 0; - ico->pilot_status = ICAL_PILOT_SYNC_MOD; return ico; } @@ -380,8 +377,6 @@ load_recur_yearly_day (iCalObject *o, char **str) { /* Skip as we do not support multiple days and we do expect * the dtstart to agree with the value on this field - * - * FIXME: we should support every-n-years */ skip_numbers (str); } @@ -595,10 +590,8 @@ ical_object_create_from_vobject (VObject *o, const char *object_name) if (has (o, VCUniqueStringProp)){ ical->uid = g_strdup (str_val (vo)); free (the_str); - } else { - ical->uid = ical_gen_uid (); } - + /* seq */ if (has (o, VCSequenceProp)){ ical->seq = atoi (str_val (vo)); @@ -792,22 +785,6 @@ ical_object_create_from_vobject (VObject *o, const char *object_name) } free (the_str); } - - /* - * Pilot - */ - if (has (o, XPilotIdProp)){ - ical->pilot_id = atoi (str_val (vo)); - free (the_str); - } else - ical->pilot_id = 0; - - if (has (o, XPilotStatusProp)){ - ical->pilot_status = atoi (str_val (vo)); - free (the_str); - } else - ical->pilot_status = ICAL_PILOT_SYNC_MOD; - return ical; } @@ -1073,17 +1050,6 @@ ical_object_to_vobject (iCalObject *ical) addPropValue (alarm, VCProcedureNameProp, ical->palarm.data); if ((alarm = save_alarm (o, &ical->malarm, ical))) addPropValue (alarm, VCEmailAddressProp, ical->malarm.data); - - /* Pilot */ - { - char buffer [20]; - - sprintf (buffer, "%d", ical->pilot_id); - addPropValue (o, XPilotIdProp, buffer); - sprintf (buffer, "%d", ical->pilot_status); - addPropValue (o, XPilotStatusProp, buffer); - } - return o; } @@ -1463,33 +1429,3 @@ alarm_compute_offset (CalendarAlarm *a) } return a->offset; } - -iCalObject * -ical_object_new_from_string (const char *vcal_string) -{ - iCalObject *ical = NULL; - VObject *cal, *event; - VObjectIterator i; - const char *object_name; - - cal = Parse_MIME (vcal_string, strlen (vcal_string)); - - initPropIterator (&i, cal); - - while (moreIteration (&i)){ - event = nextVObject (&i); - - object_name = vObjectName (event); - - if (strcmp (object_name, VCEventProp) == 0){ - ical = ical_object_create_from_vobject (event, object_name); - break; - } - } - - cleanVObject (cal); - cleanStrTbl (); - - return ical; -} - diff --git a/calendar/calendar.c b/calendar/calendar.c index 57c9ad9230..e871bfee99 100644 --- a/calendar/calendar.c +++ b/calendar/calendar.c @@ -4,7 +4,7 @@ * This keeps track of a given calendar. Eventually this will abtract everything * related to getting calendars/saving calendars locally or to a remote Calendar Service * - * Copyright (C) 1998, 1999 the Free Software Foundation + * Copyright (C) 1998 the Free Software Foundation * * Authors: * Miguel de Icaza (miguel@gnu.org) @@ -12,8 +12,6 @@ * */ -#include <gnome.h> -#include <stdio.h> #include <config.h> #include <unistd.h> #include <sys/stat.h> @@ -30,6 +28,7 @@ extern char *tzname[2]; time_t calendar_day_begin, calendar_day_end; static void calendar_init_alarms (Calendar *cal); +static void calendar_set_day (void); Calendar * calendar_new (char *title) @@ -40,8 +39,9 @@ calendar_new (char *title) cal->title = g_strdup (title); - cal->event_hash = g_hash_table_new (g_str_hash, g_str_equal); - + if ((calendar_day_begin == 0) || (calendar_day_end == 0)) + calendar_set_day (); + calendar_init_alarms (cal); return cal; @@ -76,7 +76,7 @@ add_object_alarms (iCalObject *obj, time_t start, time_t end, void *closure) #define max(a,b) ((a > b) ? a : b) -static void +void ical_object_try_alarms (iCalObject *obj) { int ao, po, od, mo; @@ -97,14 +97,9 @@ ical_object_try_alarms (iCalObject *obj) void calendar_add_object (Calendar *cal, iCalObject *obj) { - g_return_if_fail (cal != NULL); - g_return_if_fail (obj != NULL); - g_return_if_fail (obj->uid != NULL); - obj->new = 0; switch (obj->type){ case ICAL_EVENT: - g_hash_table_insert (cal->event_hash, obj->uid, obj); cal->events = g_list_prepend (cal->events, obj); ical_object_try_alarms (obj); #ifdef DEBUGGING_MAIL_ALARM @@ -142,7 +137,6 @@ calendar_remove_object (Calendar *cal, iCalObject *obj) switch (obj->type){ case ICAL_EVENT: cal->events = g_list_remove (cal->events, obj); - g_hash_table_remove (cal->event_hash, obj->uid); break; case ICAL_TODO: @@ -171,8 +165,6 @@ calendar_destroy (Calendar *cal) g_list_foreach (cal->journal, (GFunc) ical_object_destroy, NULL); g_list_free (cal->journal); - g_hash_table_destroy (cal->event_hash); - if (cal->title) g_free (cal->title); if (cal->filename) @@ -181,6 +173,17 @@ calendar_destroy (Calendar *cal) g_free (cal); } +char * +ice (time_t t) +{ + static char buffer [100]; + struct tm tm; + + tm = *localtime (&t); + sprintf (buffer, "%d/%d/%d", tm.tm_mday, tm.tm_mon, tm.tm_year); + return buffer; +} + void calendar_iterate_on_objects (GList *objects, time_t start, time_t end, calendarfn cb, void *closure) { @@ -324,43 +327,19 @@ calendar_load (Calendar *cal, char *fname) return NULL; } -/* - * calendar_load_from_memory: - * @cal: calendar on which we load the information - * @buffer: A buffer that contains a vCalendar file - * - * Loads the information from the vCalendar information in @buffer - * into the Calendar - */ -char * -calendar_load_from_memory (Calendar *cal, const char *buffer) -{ - VObject *vcal; - - g_return_val_if_fail (buffer != NULL, NULL); - - cal->filename = g_strdup ("memory-based-calendar"); - vcal = Parse_MIME (buffer, strlen (buffer)); - if (!vcal) - return "Could not load the calendar"; - - cal->file_time = time (NULL); - calendar_load_from_vobject (cal, vcal); - cleanVObject (vcal); - cleanStrTbl (); - - return NULL; -} - -static VObject * -vcalendar_create_from_calendar (Calendar *cal) +void +calendar_save (Calendar *cal, char *fname) { VObject *vcal; GList *l; time_t now = time (NULL); + struct stat s; struct tm tm; - /* WE call localtime for the side effect of setting tzname */ + if (fname == NULL) + fname = cal->filename; + + /* We call localtime for the side effect of setting tzname */ tm = *localtime (&now); vcal = newVObject (VCCalProp); @@ -391,22 +370,6 @@ vcalendar_create_from_calendar (Calendar *cal) addVObjectProp (vcal, obj); } - return vcal; -} - -void -calendar_save (Calendar *cal, char *fname) -{ - VObject *vcal; - FILE *fp; - GtkWidget *dlg; - struct stat s; - int status; - - if (fname == NULL) - fname = cal->filename; - - vcal = vcalendar_create_from_calendar (cal); if (g_file_exists (fname)){ char *backup_name = g_strconcat (fname, "~", NULL); @@ -416,43 +379,13 @@ calendar_save (Calendar *cal, char *fname) rename (fname, backup_name); g_free (backup_name); } + writeVObjectToFile (fname, vcal); - fp = fopen(fname,"w"); - if (fp) { - writeVObject(fp, vcal); - fclose(fp); - if (strcmp(cal->filename, fname)) { - if (cal->filename) - g_free (cal->filename); - cal->filename = g_strdup (fname); - } - status = stat (fname, &s); - cal->file_time = s.st_mtime; - } else { - dlg = gnome_message_box_new(_("Failed to save calendar!"), - GNOME_MESSAGE_BOX_ERROR, "Ok", NULL); - gtk_widget_show(dlg); - } - - cleanVObject (vcal); - cleanStrTbl (); -} - -char * -calendar_get_as_vcal_string (Calendar *cal) -{ - VObject *vcal; - char *result; + stat (fname, &s); + cal->file_time = s.st_mtime; - g_return_val_if_fail (cal != NULL, NULL); - - vcal = vcalendar_create_from_calendar (cal); - result = writeMemVObject (NULL, 0, vcal); - cleanVObject (vcal); cleanStrTbl (); - - return result; } static gint @@ -505,15 +438,13 @@ void calendar_object_changed (Calendar *cal, iCalObject *obj, int flags) { obj->last_mod = time (NULL); - obj->pilot_status = ICAL_PILOT_SYNC_MOD; - + if (!(flags & CHANGE_DATES)) return; /* Remove any alarms on the alarm list for this object */ while (alarm_kill (obj)) ; - ical_object_try_alarms (obj); } @@ -541,99 +472,3 @@ calendar_init_alarms (Calendar *cal) alarm_add (&day_change_alarm, calendar_day_change, cal); } -static iCalObject * -calendar_object_find_in_list (Calendar *cal, GList *list, const char *uid) -{ - GList *l; - - for (l = list; l; l = l->next){ - iCalObject *obj = l->data; - - if (strcmp (obj->uid, uid) == 0) - return obj; - } - - return NULL; -} - -iCalObject * -calendar_object_find_event (Calendar *cal, const char *uid) -{ - g_return_val_if_fail (cal != NULL, NULL); - g_return_val_if_fail (uid != NULL, NULL); - - return g_hash_table_lookup (cal->event_hash, uid); -} - -iCalObject * -calendar_object_find_todo (Calendar *cal, const char *uid) -{ - g_return_val_if_fail (cal != NULL, NULL); - g_return_val_if_fail (uid != NULL, NULL); - - return calendar_object_find_in_list (cal, cal->todo, uid); -} - -iCalObject * -calendar_object_find (Calendar *cal, const char *uid) -{ - iCalObject *obj; - - g_return_val_if_fail (cal != NULL, NULL); - g_return_val_if_fail (uid != NULL, NULL); - - obj = calendar_object_find_in_list (cal, cal->todo, uid); - - if (obj == NULL) - obj = calendar_object_find_in_list (cal, cal->events, uid); - - return obj; -} - -iCalObject * -calendar_object_find_by_pilot (Calendar *cal, int pilot_id) -{ - GList *l; - - g_return_val_if_fail (cal != NULL, NULL); - - for (l = cal->events; l; l = l->next){ - iCalObject *obj = l->data; - - if (obj->pilot_id == pilot_id) - return obj; - } - - for (l = cal->todo; l; l = l->next){ - iCalObject *obj = l->data; - - if (obj->pilot_id == pilot_id) - return obj; - } - - return NULL; -} - -/* - * calendar_string_from_object: - * - * Returns the iCalObject @object armored around a vCalendar - * object as a string. - */ -char * -calendar_string_from_object (iCalObject *object) -{ - Calendar *cal; - char *str; - - g_return_val_if_fail (object != NULL, NULL); - - cal = calendar_new ("Temporal"); - calendar_add_object (cal, object); - str = calendar_get_as_vcal_string (cal); - calendar_remove_object (cal, object); - - calendar_destroy (cal); - - return str; -} diff --git a/calendar/calobj.c b/calendar/calobj.c index 806c27d8ff..0b1980e7ba 100644 --- a/calendar/calobj.c +++ b/calendar/calobj.c @@ -52,9 +52,6 @@ ical_object_new (void) ico->seq = -1; ico->dtstamp = time (NULL); ico->uid = ical_gen_uid (); - - ico->pilot_id = 0; - ico->pilot_status = ICAL_PILOT_SYNC_MOD; return ico; } @@ -380,8 +377,6 @@ load_recur_yearly_day (iCalObject *o, char **str) { /* Skip as we do not support multiple days and we do expect * the dtstart to agree with the value on this field - * - * FIXME: we should support every-n-years */ skip_numbers (str); } @@ -595,10 +590,8 @@ ical_object_create_from_vobject (VObject *o, const char *object_name) if (has (o, VCUniqueStringProp)){ ical->uid = g_strdup (str_val (vo)); free (the_str); - } else { - ical->uid = ical_gen_uid (); } - + /* seq */ if (has (o, VCSequenceProp)){ ical->seq = atoi (str_val (vo)); @@ -792,22 +785,6 @@ ical_object_create_from_vobject (VObject *o, const char *object_name) } free (the_str); } - - /* - * Pilot - */ - if (has (o, XPilotIdProp)){ - ical->pilot_id = atoi (str_val (vo)); - free (the_str); - } else - ical->pilot_id = 0; - - if (has (o, XPilotStatusProp)){ - ical->pilot_status = atoi (str_val (vo)); - free (the_str); - } else - ical->pilot_status = ICAL_PILOT_SYNC_MOD; - return ical; } @@ -1073,17 +1050,6 @@ ical_object_to_vobject (iCalObject *ical) addPropValue (alarm, VCProcedureNameProp, ical->palarm.data); if ((alarm = save_alarm (o, &ical->malarm, ical))) addPropValue (alarm, VCEmailAddressProp, ical->malarm.data); - - /* Pilot */ - { - char buffer [20]; - - sprintf (buffer, "%d", ical->pilot_id); - addPropValue (o, XPilotIdProp, buffer); - sprintf (buffer, "%d", ical->pilot_status); - addPropValue (o, XPilotStatusProp, buffer); - } - return o; } @@ -1463,33 +1429,3 @@ alarm_compute_offset (CalendarAlarm *a) } return a->offset; } - -iCalObject * -ical_object_new_from_string (const char *vcal_string) -{ - iCalObject *ical = NULL; - VObject *cal, *event; - VObjectIterator i; - const char *object_name; - - cal = Parse_MIME (vcal_string, strlen (vcal_string)); - - initPropIterator (&i, cal); - - while (moreIteration (&i)){ - event = nextVObject (&i); - - object_name = vObjectName (event); - - if (strcmp (object_name, VCEventProp) == 0){ - ical = ical_object_create_from_vobject (event, object_name); - break; - } - } - - cleanVObject (cal); - cleanStrTbl (); - - return ical; -} - diff --git a/calendar/doc/C/Makefile.am b/calendar/doc/C/Makefile.am index fbd3b63acf..be6533d715 100644 --- a/calendar/doc/C/Makefile.am +++ b/calendar/doc/C/Makefile.am @@ -27,13 +27,13 @@ dist-hook: -cp images/*.gif images/*.jpg $(distdir)/images install-data-local: gnomecal.html - $(mkinstalldirs) $(DESTDIR)$(gnomecal_helpdir)/images + $(mkinstalldirs) $(gnomecal_helpdir)/images -for file in $(srcdir)/gnomecal/*.html $(srcdir)/gnomecal/*.css; do \ basefile=`basename $$file`; \ - $(INSTALL_DATA) $(srcdir)/$$file $(DESTDIR)$(gnomecal_helpdir)/$$basefile; \ + $(INSTALL_DATA) $(srcdir)/$$file $(gnomecal_helpdir)/$$basefile; \ done -for file in $(srcdir)/images/*.jpg $(srcdir)/images/*.gif; do \ - $(INSTALL_DATA) $(srcdir)/$$file $(DESTDIR)$(gnomecal_helpdir)/images;\ + $(INSTALL_DATA) $(srcdir)/$$file $(gnomecal_helpdir)/images;\ done gnomecal.ps: gnomecal.sgml diff --git a/calendar/eventedit.c b/calendar/eventedit.c index 926bb6f09c..8b7baa6a75 100644 --- a/calendar/eventedit.c +++ b/calendar/eventedit.c @@ -59,6 +59,15 @@ event_editor_class_init (EventEditorClass *class) object_class->destroy = event_editor_destroy; } +GtkWidget * +adjust (GtkWidget *w, gfloat x, gfloat y, gfloat xs, gfloat ys) +{ + GtkWidget *a = gtk_alignment_new (x, y, xs, ys); + + gtk_container_add (GTK_CONTAINER (a), w); + return a; +} + static GtkWidget * make_spin_button (int val, int low, int high) { @@ -423,7 +432,7 @@ ee_classification_widgets (EventEditor *ee) * Retrieves the information from the CalendarAlarm widgets and stores them * on the CalendarAlarm generic values */ -static void +void ee_store_alarm (CalendarAlarm *alarm, enum AlarmType type) { GtkWidget *item; @@ -1469,6 +1478,7 @@ static void event_editor_init (EventEditor *ee) { ee->ical = 0; + gtk_window_set_title (GTK_WINDOW (ee), _("Create new appointment")); gnome_dialog_set_close (GNOME_DIALOG(ee), TRUE); } @@ -1501,12 +1511,6 @@ event_editor_new (GnomeCalendar *gcal, iCalObject *ical) if (ical == 0){ ical = ical_new ("", user_name, ""); ical->new = 1; - } - - if (ical->new){ - gtk_window_set_title (GTK_WINDOW (ee), _("Create new appointment")); - } else { - gtk_window_set_title (GTK_WINDOW (ee), _("Edit appointment")); } ical->user_data = ee; /* so that the world can know we are editing it */ diff --git a/calendar/gncal-day-panel.c b/calendar/gncal-day-panel.c index f407a497d3..f041e3d6dd 100644 --- a/calendar/gncal-day-panel.c +++ b/calendar/gncal-day-panel.c @@ -95,8 +95,6 @@ gncal_day_panel_new (GnomeCalendar *calendar, time_t start_of_day) { GncalDayPanel *dpanel; GtkWidget *w; - GtkWidget *hpane, *vpane; - gint start_pos = 265; struct tm tm; g_return_val_if_fail (calendar != NULL, NULL); @@ -120,15 +118,6 @@ gncal_day_panel_new (GnomeCalendar *calendar, time_t start_of_day) 0, 0); gtk_widget_show (w); - /* Create horizontal pane */ - - hpane = gtk_hpaned_new (); - gtk_table_attach (GTK_TABLE (dpanel), hpane, - 0, 1, 2, 4, - GTK_EXPAND | GTK_FILL | GTK_SHRINK, - GTK_EXPAND | GTK_FILL | GTK_SHRINK, - 0, 0); - /* Full day */ w = gtk_scrolled_window_new (NULL, NULL); @@ -136,8 +125,11 @@ gncal_day_panel_new (GnomeCalendar *calendar, time_t start_of_day) gtk_scrolled_window_set_policy (dpanel->fullday_sw, GTK_POLICY_AUTOMATIC, GTK_POLICY_AUTOMATIC); - gtk_paned_pack1 (GTK_PANED (hpane), w, FALSE, TRUE); - /*gtk_paned_add1 (GTK_PANED (hpane), w);*/ + gtk_table_attach (GTK_TABLE (dpanel), w, + 0, 1, 1, 4, + GTK_EXPAND | GTK_FILL | GTK_SHRINK, + GTK_EXPAND | GTK_FILL | GTK_SHRINK, + 0, 0); gtk_widget_show (w); w = gncal_full_day_new (calendar, time_day_begin (start_of_day), time_day_end (start_of_day)); @@ -154,12 +146,6 @@ gncal_day_panel_new (GnomeCalendar *calendar, time_t start_of_day) (GtkSignalFunc) full_day_size_allocated, dpanel); - /* Create vertical pane */ - - vpane = gtk_vpaned_new (); - gtk_paned_pack2 (GTK_PANED (hpane), GTK_WIDGET (vpane), TRUE, TRUE); - /*gtk_paned_add2 (GTK_PANED (hpane), GTK_WIDGET (vpane));*/ - /* Gtk calendar */ tm = *localtime (&start_of_day); @@ -179,22 +165,38 @@ gncal_day_panel_new (GnomeCalendar *calendar, time_t start_of_day) dpanel); gtk_signal_connect (GTK_OBJECT (dpanel->gtk_calendar), "month_changed", GTK_SIGNAL_FUNC (retag_calendar), dpanel); - gtk_paned_add1 (GTK_PANED (vpane), w); + gtk_table_attach (GTK_TABLE (dpanel), w, + 1, 2, 1, 2, + GTK_FILL | GTK_SHRINK, + GTK_FILL | GTK_SHRINK, + 0, 0); + gtk_widget_show (w); + + /* Separator */ + + w = gtk_hseparator_new (); + gtk_table_attach (GTK_TABLE (dpanel), w, + 1, 2, 2, 3, + GTK_FILL | GTK_SHRINK, + GTK_FILL | GTK_SHRINK, + 0, 0); gtk_widget_show (w); /* To-do */ w = gncal_todo_new (calendar); dpanel->todo = GNCAL_TODO (w); - gtk_paned_add2 (GTK_PANED (vpane), w); + gtk_table_attach (GTK_TABLE (dpanel), w, + 1, 2, 3, 4, + GTK_FILL | GTK_SHRINK, + GTK_EXPAND | GTK_FILL | GTK_SHRINK, + 0, 0); gtk_widget_show (w); /* Done */ gncal_day_panel_set (dpanel, start_of_day); - gtk_paned_set_position (GTK_PANED (hpane), start_pos); - return GTK_WIDGET (dpanel); } diff --git a/calendar/gncal-todo.c b/calendar/gncal-todo.c index 941eddf453..3be3ac4517 100644 --- a/calendar/gncal-todo.c +++ b/calendar/gncal-todo.c @@ -15,7 +15,13 @@ int todo_show_due_date = 0; int todo_show_priority = 0; -int todo_due_date_overdue_highlight = 0; +int todo_show_time_remaining = 0; + +int todo_item_dstatus_highlight_overdue = 0; +int todo_item_dstatus_highlight_due_today = 0; +int todo_item_dstatus_highlight_not_due_yet = 0; + + char *todo_overdue_font_text; gint todo_current_sort_column = 0; gint todo_current_sort_type = GTK_SORT_ASCENDING; @@ -177,7 +183,7 @@ simple_todo_editor (GncalTodo *todo, iCalObject *ico) gtk_widget_show (due_label); due_entry = gtk_entry_new (); - due_entry = date_edit_new (ico->dtend, FALSE); + due_entry = date_edit_new (ico->dtend, TRUE); gtk_box_pack_start (GTK_BOX (due_box), due_entry, TRUE, TRUE, 0); gtk_widget_show (due_entry); @@ -412,15 +418,17 @@ gncal_todo_init (GncalTodo *todo) GtkWidget *w; GtkWidget *sw; GtkWidget *hbox; - gchar *titles[3] = { + gchar *titles[4] = { N_("Summary"), N_("Due Date"), - N_("Priority") + N_("Priority"), + N_("Time Left") }; - char *tmp[3]; + char *tmp[4]; tmp[0] = _(titles[0]); tmp[1] = _(titles[1]); tmp[2] = _(titles[2]); + tmp[3] = _(titles[3]); gtk_box_set_spacing (GTK_BOX (todo), 4); @@ -439,7 +447,7 @@ gncal_todo_init (GncalTodo *todo) gtk_widget_show (sw); - w = gtk_clist_new_with_titles(3, tmp); + w = gtk_clist_new_with_titles(4, tmp); todo->clist = GTK_CLIST (w); gtk_clist_set_selection_mode (todo->clist, GTK_SELECTION_BROWSE); @@ -523,53 +531,224 @@ convert_time_t_to_char (time_t t) return g_strdup (buf); } +enum todo_styles { + TODO_STYLE_OVERDUE, + TODO_STYLE_DUE_TODAY, + TODO_STYLE_NOT_DUE +}; + + +enum todo_status { + TODO_ITEM_DSTATUS_NOT_DUE_YET, + TODO_ITEM_DSTATUS_DUE_TODAY, + TODO_ITEM_DSTATUS_OVERDUE, + TODO_ITEM_DSTATUS_LAST_DUE_STATUS +}; +typedef enum todo_status todo_status; + static GtkStyle * -make_overdue_todo_style(GncalTodo *todo) +make_todo_style(GncalTodo *todo, todo_status style_type) { - GtkStyle *overdue_style = NULL; - GdkColor overdue_color; + GtkStyle *style = NULL; + GdkColor style_color; + int color_prop = 0; + switch(style_type) { + case TODO_ITEM_DSTATUS_NOT_DUE_YET: + color_prop = COLOR_PROP_TODO_NOT_DUE_YET; + break; + case TODO_ITEM_DSTATUS_DUE_TODAY: + color_prop = COLOR_PROP_TODO_DUE_TODAY; + break; + case TODO_ITEM_DSTATUS_OVERDUE: + color_prop = COLOR_PROP_TODO_OVERDUE; + break; + case TODO_ITEM_DSTATUS_LAST_DUE_STATUS: + } - /*make the overdue color configurable */ - overdue_color.red = color_props[COLOR_PROP_OVERDUE_TODO].r; - overdue_color.green = color_props[COLOR_PROP_OVERDUE_TODO].g; - overdue_color.blue = color_props[COLOR_PROP_OVERDUE_TODO].b; + style_color.red = color_props[color_prop].r; + style_color.green = color_props[color_prop].g; + style_color.blue = color_props[color_prop].b; - overdue_style = gtk_style_copy (GTK_WIDGET (todo->clist)->style); - overdue_style->base[GTK_STATE_NORMAL] = overdue_color; + style = gtk_style_copy (GTK_WIDGET (todo->clist)->style); + style->base[GTK_STATE_NORMAL] = style_color; + return style; +} + + + + +static +todo_status todo_item_due_status(time_t *todo_due_time) { + struct tm due_tm_time; + struct tm current_time; + struct tm *temp_tm; + time_t current_time_val = time(NULL); + temp_tm = localtime(todo_due_time); + /* make a copy so it dosen't get over written */ + memcpy(&due_tm_time, temp_tm, sizeof(struct tm)); - return overdue_style; + + temp_tm = localtime(¤t_time_val); + memcpy(¤t_time, temp_tm, sizeof(struct tm)); + + if(due_tm_time.tm_mon == current_time.tm_mon && + due_tm_time.tm_mday == current_time.tm_mday && + due_tm_time.tm_year == current_time.tm_year) { + return TODO_ITEM_DSTATUS_DUE_TODAY; + } + + if((*todo_due_time) < current_time_val) { + return TODO_ITEM_DSTATUS_OVERDUE; + } + + return TODO_ITEM_DSTATUS_NOT_DUE_YET; } + +enum todo_remaining_time_form { + TODO_ITEM_REMAINING_WEEKS, + TODO_ITEM_REMAINING_DAYS, + TODO_ITEM_REMAINING_HOURS, + TODO_ITEM_REMAINING_MINUTES, + TODO_ITEM_REMAINING_SECONDS +}; +typedef enum todo_remaining_time_form todo_remaining_time_form; + static void insert_in_clist (GncalTodo *todo, iCalObject *ico) { int i; - char *text[3]; - static GtkStyle *overdue_style = NULL; + char *text[4]; + char time_remaining_buffer[100]; + time_t time_remain; + todo_remaining_time_form time_remaining_form; + int sec_in_week = 3600*7*24; + int sec_in_day = 3600*24; + int sec_in_hour = 3600; + int sec_in_minute = 60; + int weeks = 0; + int days = 0; + int hours = 0; + int minutes = 0; + int seconds = 0; + - - /* setup the over due style if we haven't already, or it changed.*/ - if (todo_style_changed || !overdue_style) { - /* free the old style cause its not needed anymore */ - if(!overdue_style) g_free(overdue_style); - overdue_style = make_overdue_todo_style(todo); + /* an array for the styles of items */ + static GtkStyle *dstatus_styles[TODO_ITEM_DSTATUS_LAST_DUE_STATUS]; + /* we want to remake the styles when the status is changed, + also we need to check for the null value in the pointer so we init them + at startup */ + if (todo_style_changed || !dstatus_styles[TODO_ITEM_DSTATUS_NOT_DUE_YET]) { + g_free(dstatus_styles[TODO_ITEM_DSTATUS_NOT_DUE_YET]); + g_free(dstatus_styles[TODO_ITEM_DSTATUS_OVERDUE]); + g_free(dstatus_styles[TODO_ITEM_DSTATUS_DUE_TODAY]); + + dstatus_styles[TODO_ITEM_DSTATUS_NOT_DUE_YET] = make_todo_style(todo, TODO_ITEM_DSTATUS_NOT_DUE_YET); + dstatus_styles[TODO_ITEM_DSTATUS_OVERDUE] = make_todo_style(todo, TODO_ITEM_DSTATUS_OVERDUE); + dstatus_styles[TODO_ITEM_DSTATUS_DUE_TODAY] = make_todo_style(todo, TODO_ITEM_DSTATUS_DUE_TODAY); + todo_style_changed = 0; } + + + text[0] = ico->summary; + if(todo_show_time_remaining) { + memset(time_remaining_buffer, 0, 100); + /* we need to make a string that represents the amount of time remaining + before this task is due */ + + /* for right now all I'll do is up to the hours. */ + time_remain = (ico->dtend - time(NULL)); + if(time_remain < 0) { + text[3] = "Overdue!"; + } + else { + + /* lets determine a decent denomination to display */ + if(time_remain / (sec_in_week)) + { + /* we have weeks available */ + time_remaining_form = TODO_ITEM_REMAINING_WEEKS; + weeks = time_remain / sec_in_week; + days = (time_remain % (sec_in_week))/sec_in_day; + } + else if(time_remain / (sec_in_day)) + { + /* we have days available */ + time_remaining_form = TODO_ITEM_REMAINING_DAYS; + days = time_remain / sec_in_day; + hours = (time_remain % sec_in_day)/sec_in_hour; + } + else if(time_remain / (sec_in_hour)) + { + /* we have hours available */ + time_remaining_form = TODO_ITEM_REMAINING_HOURS; + hours = time_remain /sec_in_hour; + minutes = (time_remain % sec_in_hour) / sec_in_minute; + } + else if(time_remain / sec_in_minute) + { + time_remaining_form = TODO_ITEM_REMAINING_MINUTES; + minutes = time_remain / sec_in_minute; + seconds = time_remain % sec_in_minute; + } + else + { + time_remaining_form = TODO_ITEM_REMAINING_SECONDS; + seconds = time_remain; + } + + switch(time_remaining_form) + { + case TODO_ITEM_REMAINING_WEEKS: + snprintf(time_remaining_buffer, 100, "%d %s %d %s", weeks, + (weeks > 1) ? _("Weeks") : _("Week"), + days, (days > 1) ? _("Days") : _("Day")); + break; + case TODO_ITEM_REMAINING_DAYS: + snprintf(time_remaining_buffer, 100, "%d %s %d %s", days, + (days > 1) ? _("Days") : _("Day"), + hours, (hours > 1) ? _("Hours") : _("Hour")); + break; + case TODO_ITEM_REMAINING_HOURS: + snprintf(time_remaining_buffer, 100, "%d %s %d %s", hours, + (hours > 1) ? _("Hours") : _("Hour"), + minutes, (minutes > 1) ? _("Minutes") : _("Minute")); + break; + case TODO_ITEM_REMAINING_MINUTES: + snprintf(time_remaining_buffer, 100, "%d %s %d %s", minutes, + (minutes > 1) ? _("Minutes") : _("Minute"), + seconds, (seconds > 1) ? _("Seconds") : _("Second")); + break; + case TODO_ITEM_REMAINING_SECONDS: + snprintf(time_remaining_buffer, 100, "%d %s", seconds, + (seconds > 1) ? _("Seconds") : _("Second")); + break; + } + text[3] = g_strdup(time_remaining_buffer); + todo->data_ptrs = g_slist_append(todo->data_ptrs, text[3]); + } + + } + else { + text[3] = "Loose penguini!"; + } /* * right now column 0 will be the summary * and column 1 will be the due date. * WISH: this should be able to be changed on the fly */ - if(ico->dtend && todo_show_due_date) { - text[1] = convert_time_t_to_char (ico->dtend); - /* Append the data's pointer so later it can be properly freed */ - todo->data_ptrs = g_slist_append (todo->data_ptrs, text[1]); - } + if(ico->dtend && todo_show_due_date) + { + text[1] = convert_time_t_to_char (ico->dtend); + /* Append the data's pointer so later it can be properly freed */ + todo->data_ptrs = g_slist_append (todo->data_ptrs, text[1]); + } else text[1] = NULL; @@ -589,9 +768,27 @@ insert_in_clist (GncalTodo *todo, iCalObject *ico) * determine if the task is overdue.. * if so mark with the apropriate style */ - if(todo_due_date_overdue_highlight) { - if(ico->dtend < time(NULL)) - gtk_clist_set_row_style(todo->clist, i, overdue_style); + + switch(todo_item_due_status(&ico->dtend)) { + case TODO_ITEM_DSTATUS_NOT_DUE_YET: + if(todo_item_dstatus_highlight_not_due_yet) + { + gtk_clist_set_row_style(todo->clist, i, dstatus_styles[TODO_ITEM_DSTATUS_NOT_DUE_YET]); + } + break; + case TODO_ITEM_DSTATUS_DUE_TODAY: + if(todo_item_dstatus_highlight_due_today) + { + gtk_clist_set_row_style(todo->clist, i, dstatus_styles[TODO_ITEM_DSTATUS_DUE_TODAY]); + } + break; + case TODO_ITEM_DSTATUS_OVERDUE: + if(todo_item_dstatus_highlight_overdue) + { + gtk_clist_set_row_style(todo->clist, i, dstatus_styles[TODO_ITEM_DSTATUS_OVERDUE]); + } + break; + case TODO_ITEM_DSTATUS_LAST_DUE_STATUS: } /* keep the list in order */ @@ -626,10 +823,20 @@ gncal_todo_update (GncalTodo *todo, iCalObject *ico, int flags) /* check on the columns that we should display */ /* check for due date */ - if(todo_show_due_date) - gtk_clist_set_column_visibility (todo->clist, 1, 1); - else - gtk_clist_set_column_visibility (todo->clist, 1, 0); + if(todo_show_due_date) { + gtk_clist_set_column_visibility (todo->clist, 1, 1); + } + else { + gtk_clist_set_column_visibility (todo->clist, 1, 0); + } + + if(todo_show_time_remaining) { + gtk_clist_set_column_visibility (todo->clist, 3, 1); + } + else { + gtk_clist_set_column_visibility (todo->clist, 3, 0); + } + if(todo_show_priority) gtk_clist_set_column_visibility (todo->clist, 2, 1); diff --git a/calendar/gncal.desktop b/calendar/gncal.desktop index b5b75a3ed3..2f1bc5a7c9 100644 --- a/calendar/gncal.desktop +++ b/calendar/gncal.desktop @@ -3,29 +3,21 @@ Name=Calendar Name[da]=Kalender Name[de]=Kalender Name[es]=Calendario -Name[et]=Kalender -Name[fi]=Kalenteri Name[fr]=Calendrier -Name[ja]=¥«¥ì¥ó¥À¡¼ Name[ko]=´Þ·Â Name[no]=Kalender Name[pt]=Agenda -Name[pt_BR]=Calendário -Name[ru]=ëÁÌÅÎÄÁÒØ +Name[pl]=Terminarz Name[sv]=Kalender Comment=Calendar application Comment[da]=Gnome Kalender Comment[de]=Gnome Kalender Comment[es]=Calendario de Gnome -Comment[et]=GNOME kalender -Comment[fi]=GNOME-kalenteri Comment[fr]=Calendrier GNOME -Comment[ja]=GNOME¥«¥ì¥ó¥À¡¼ Comment[ko]=±×³ð ´Þ·Â Comment[no]=Gnome Kalender Comment[pt]=Agenda Gnome -Comment[pt_BR]=Calendário GNOME -Comment[ru]=ëÁÌÅÎÄÁÒØ Gnome +Comment[pl]=Terminarz GNOME Comment[sv]=Gnome-kalender Exec=gnomecal Icon=gnome-calendar.png diff --git a/calendar/gnome-cal.c b/calendar/gnome-cal.c index 1342e6454b..261aa5ff79 100644 --- a/calendar/gnome-cal.c +++ b/calendar/gnome-cal.c @@ -18,7 +18,6 @@ #include "year-view.h" #include "timeutil.h" #include "main.h" -#include "corba-cal.h" GnomeApp *parent_class; @@ -45,10 +44,11 @@ gnome_calendar_get_type (void) static void setup_widgets (GnomeCalendar *gcal) { + GtkWidget *sw; time_t now; now = time (NULL); - + gcal->notebook = gtk_notebook_new (); gcal->day_view = gncal_day_panel_new (gcal, now); gcal->week_view = gncal_week_view_new (gcal, now); @@ -60,13 +60,11 @@ setup_widgets (GnomeCalendar *gcal) GTK_POLICY_NEVER, GTK_POLICY_AUTOMATIC); gtk_container_add (GTK_CONTAINER (gcal->year_view_sw), gcal->year_view); - GTK_LAYOUT (gcal->year_view)->vadjustment->step_increment = 10.0; - gtk_adjustment_changed (GTK_ADJUSTMENT (GTK_LAYOUT (gcal->year_view)->vadjustment)); gtk_notebook_append_page (GTK_NOTEBOOK (gcal->notebook), gcal->day_view, gtk_label_new (_("Day View"))); gtk_notebook_append_page (GTK_NOTEBOOK (gcal->notebook), gcal->week_view, gtk_label_new (_("Week View"))); gtk_notebook_append_page (GTK_NOTEBOOK (gcal->notebook), gcal->month_view, gtk_label_new (_("Month View"))); - gtk_notebook_append_page (GTK_NOTEBOOK (gcal->notebook), gcal->year_view_sw, gtk_label_new (_("Year View"))); + gtk_notebook_append_page (GTK_NOTEBOOK (gcal->notebook), gcal->year_view_sw, gtk_label_new (_("Year View"))); gtk_widget_show_all (gcal->notebook); @@ -134,7 +132,7 @@ gnome_calendar_direction (GnomeCalendar *gcal, int direction) { GtkWidget *cp = get_current_page (gcal); time_t new_time; - + if (cp == gcal->day_view) new_time = time_add_day (time_day_begin (gcal->current_display), 1 * direction); else if (cp == gcal->week_view) @@ -185,7 +183,7 @@ gnome_calendar_goto_today (GnomeCalendar *gcal) { g_return_if_fail (gcal != NULL); g_return_if_fail (GNOME_IS_CALENDAR (gcal)); - + gnome_calendar_goto (gcal, time (NULL)); } @@ -197,7 +195,7 @@ gnome_calendar_set_view (GnomeCalendar *gcal, char *page_name) g_return_if_fail (gcal != NULL); g_return_if_fail (GNOME_IS_CALENDAR (gcal)); g_return_if_fail (page_name != NULL); - + if (strcmp (page_name, "dayview") == 0) page = 0; @@ -216,21 +214,19 @@ gnome_calendar_new (char *title) GtkWidget *retval; GnomeCalendar *gcal; GnomeApp *app; - + retval = gtk_type_new (gnome_calendar_get_type ()); app = GNOME_APP (retval); gcal = GNOME_CALENDAR (retval); - + app->name = g_strdup ("calendar"); app->prefix = g_strconcat ("/", app->name, "/", NULL); - + gtk_window_set_title(GTK_WINDOW(retval), title); gcal->current_display = time_day_begin (time (NULL)); gcal->cal = calendar_new (title); setup_widgets (gcal); - gnome_calendar_create_corba_server (gcal); - return retval; } @@ -251,7 +247,7 @@ gnome_calendar_load (GnomeCalendar *gcal, char *file) g_return_val_if_fail (gcal != NULL, 0); g_return_val_if_fail (GNOME_IS_CALENDAR (gcal), 0); g_return_val_if_fail (file != NULL, 0); - + if ((r = calendar_load (gcal->cal, file)) != NULL){ printf ("Error loading calendar: %s\n", r); return 0; @@ -319,12 +315,12 @@ execute (char *command, int close_standard) struct sigaction ignore, save_intr, save_quit; int status = 0, i; pid_t pid; - + ignore.sa_handler = SIG_IGN; sigemptyset (&ignore.sa_mask); ignore.sa_flags = 0; - - sigaction (SIGINT, &ignore, &save_intr); + + sigaction (SIGINT, &ignore, &save_intr); sigaction (SIGQUIT, &ignore, &save_quit); if ((pid = fork ()) < 0){ @@ -337,16 +333,16 @@ execute (char *command, int close_standard) const int top = max_open_files (); sigaction (SIGINT, &save_intr, NULL); sigaction (SIGQUIT, &save_quit, NULL); - + for (i = (close_standard ? 0 : 3); i < top; i++) close (i); - + /* FIXME: As an excercise to the reader, copy the * code from mc to setup shell properly instead of * /bin/sh. Yes, this comment is larger than a cut and paste. */ execl ("/bin/sh", "/bin/sh", "-c", command, (char *) 0); - + _exit (127); } else { _exit (127); @@ -363,7 +359,7 @@ mail_notify (char *mail_address, char *text, time_t app_time) pid_t pid; int p [2]; char *command; - + pipe (p); pid = fork (); if (pid == 0){ @@ -398,7 +394,7 @@ static gint start_beeping (gpointer data) { gdk_beep (); - + return TRUE; } @@ -407,7 +403,7 @@ calendar_notify (time_t time, CalendarAlarm *which, void *data) { iCalObject *ico = data; guint tag; - + if (&ico->aalarm == which){ time_t app = ico->aalarm.trigger + ico->aalarm.offset; GtkWidget *w; @@ -464,11 +460,11 @@ mark_gtk_calendar_day (iCalObject *obj, time_t start, time_t end, void *c) tm_s = *localtime (&start); day_end = time_day_end (end); - + for (t = start; t <= day_end; t += 60*60*24){ time_t new = mktime (&tm_s); struct tm tm_day; - + tm_day = *localtime (&new); gtk_calendar_mark_day (gtk_cal, tm_day.tm_mday); tm_s.tm_mday++; @@ -541,14 +537,14 @@ gnome_calendar_colors_changed (GnomeCalendar *gcal) todo_list_properties_changed (GNCAL_DAY_PANEL (gcal->day_view)); } -void -gnome_calendar_todo_properties_changed (GnomeCalendar *gcal) +void +gnome_calendar_todo_properties_changed (GnomeCalendar *gcal) { g_return_if_fail (gcal != NULL); g_return_if_fail (GNOME_IS_CALENDAR (gcal)); - + /* FIXME: add day and week view when they are done */ - + todo_style_changed = 1; todo_list_properties_changed (GNCAL_DAY_PANEL (gcal->day_view)); } diff --git a/calendar/gnome-cal.h b/calendar/gnome-cal.h index da53f29882..ae4e5292da 100644 --- a/calendar/gnome-cal.h +++ b/calendar/gnome-cal.h @@ -63,8 +63,6 @@ void gnome_calendar_object_changed (GnomeCalendar *gcal, iCalObject *obj, int flags); -GnomeCalendar *gnome_calendar_locate (const char *pathname); - /* Notifies the calendar that the time format has changed and it must update all its views */ void gnome_calendar_time_format_changed (GnomeCalendar *gcal); diff --git a/calendar/gui/Makefile.am b/calendar/gui/Makefile.am index 4042368bff..b340b03a9d 100644 --- a/calendar/gui/Makefile.am +++ b/calendar/gui/Makefile.am @@ -1,51 +1,15 @@ SUBDIRS = doc -idldir = $(datadir)/idl -idl_DATA = GnomeCal.idl - -gnorbadir = $(sysconfdir)/CORBA/servers -gnorba_DATA = gnomecal.gnorba - help_base = $(datadir)/gnome/help/cal -if HAVE_GNOME_PILOT -bin_PROGRAMS = \ - gnomecal \ - calendar-conduit-control-applet \ - calendar-pilot-sync -else -bin_PROGRAMS = gnomecal -endif - -INCLUDES = \ +INCLUDES = \ -I$(includedir) \ $(GNOME_INCLUDEDIR) \ - $(GNOME_CONDUIT_INCLUDEDIR) \ - $(PISOCK_INCLUDEDIR) \ -DGNOMELOCALEDIR=\""$(datadir)/locale"\" -GNOMECAL_CORBA_GENERATED = \ - GnomeCal.h \ - GnomeCal.c \ - GnomeCal-common.c \ - GnomeCal-skels.c \ - GnomeCal-stubs.c - -$(GNOMECAL_CORBA_GENERATED): my_gnomecal_idl - -my_gnomecal_idl: GnomeCal.idl - orbit-idl $(srcdir)/GnomeCal.idl - touch my_gnomecal_idl - -corba-cal.c \ -corba-cal.h \ -corba-cal-factory.c \ -corba-cal-factory.h: GnomeCal.h +bin_PROGRAMS = gnomecal gnomecal_SOURCES = \ - GnomeCal-common.c \ - GnomeCal-skels.c \ - GnomeCal.h \ alarm.c \ alarm.h \ calendar.c \ @@ -55,10 +19,6 @@ gnomecal_SOURCES = \ eventedit.c \ eventedit.h \ getdate.y \ - corba-cal.c \ - corba-cal.h \ - corba-cal-factory.c \ - corba-cal-factory.h \ gncal-day-panel.c \ gncal-day-panel.h \ gncal-day-view.c \ @@ -95,117 +55,21 @@ gnomecal_SOURCES = \ year-view.c \ year-view.h -calendar_pilot_sync_SOURCES = \ - GnomeCal-common.c \ - GnomeCal-stubs.c \ - alarm.c \ - calendar-pilot-sync.c \ - calobj.c \ - calobj.h \ - calendar.c \ - calendar.h \ - timeutil.c \ - timeutil.h - LINK_FLAGS = \ $(GNOME_LIBDIR) \ $(GNOMEGNORBA_LIBS) \ - $(INTLLIBS) \ - ../libversit/libversit.la - -calendar_pilot_sync_LDADD = \ - $(PISOCK_LIBS) \ - $(LINK_FLAGS) - -if HAVE_GNOME_PILOT -#calendar_conduit -calendar_conduitsdir=$(libdir)/gnome-pilot/conduits - -calendar_conduits_LTLIBRARIES = libcalendar_conduit.la - -libcalendar_conduit_la_SOURCES = \ - GnomeCal-common.c \ - GnomeCal-stubs.c \ - calendar-conduit.c \ - calobj.c \ - alarm.c \ - calendar.c \ - timeutil.c - -calendar-conduit.c: my_gnomecal_idl - -libcalendar_conduit_la_LDFLAGS = \ - -rpath $(libdir) - -libcalendar_conduit_la_LIBADD = \ - ../libversit/libversit.la \ - $(PISOCK_LIBS) \ - $(GNOME_LIBDIR) \ - $(GNOME_LIBS) - -calendar_conduit_control_applet_SOURCES = \ - calendar-conduit-control-applet.c - -calendar_conduit_control_applet_LDADD = \ - $(CAPPLET_LIBS) \ - $(GNOME_LIBDIR) \ - $(GNOME_CAPPLET_LIBS) \ - $(PISOCK_LIBS) \ - $(GNOMEUI_LIBS) \ - $(PISOCK_LIBS) \ - $(GNOME_PILOT_LIBS) \ - $(INTLLIBS) - -#todo_conduit -#todo_conduitsdir=$(libdir)/gnome-pilot/conduits + $(INTLLIBS) ../libversit/libversit.a -#todo_conduits_LTLIBRARIES = libtodo_conduit.la -#libtodo_conduit_la_LDFLAGS = \ -# -rpath $(libdir) - -#libtodo_conduit_la_LIBADD = \ -# $(GNOME_LIBDIR) \ -# $(GNOME_LIBS) - -#libtodo_conduit_la_SOURCES = \ -# todo-conduit.c - -#todo-conduit.c: GnomeCal.h - -#todo_conduit_control_applet_SOURCES = \ -# todo-conduit-control-applet.c - -#todo_conduit_control_applet_LDADD = \ -# $(CAPPLET_LIBS) \ -# $(GNOME_LIBDIR) \ -# $(GNOME_CAPPLET_LIBS) \ -# $(PISOCK_LIBS) \ -# $(GNOMEUI_LIBS) \ -# $(PISOCK_LIBS) \ -# $(GNOME_PILOT_LIBS) \ -# $(INTLLIBS) -endif +#gncal_LDADD = $(LINK_FLAGS) gnomecal_LDADD = $(LINK_FLAGS) -if HAVE_GNOME_PILOT -ccenterdir = $(datadir)/control-center -Rootdir = $(ccenterdir) -PalmPilotdir = $(ccenterdir)/Peripherals/PalmPilot -Conduitsdir = $(PalmPilotdir)/Conduits - -Conduits_DATA = \ - calendar-conduit-control-applet.desktop \ - todo-conduit-control-applet.desktop -endif - EXTRA_DIST = \ gncal.desktop \ bell.xpm \ - recur.xpm \ - $(idl_DATA) \ - $(gnorba_DATA) + recur.xpm + Productivitydir = $(datadir)/gnome/apps/Applications @@ -213,4 +77,3 @@ Productivity_DATA = gncal.desktop install-data-local: $(mkinstalldirs) $(DESTDIR)$(help_base)/C - $(mkinstalldirs) $(Conduitsdir) diff --git a/calendar/gui/alarm-notify/alarm.c b/calendar/gui/alarm-notify/alarm.c index 04e7c02e49..b7f0d12e13 100644 --- a/calendar/gui/alarm-notify/alarm.c +++ b/calendar/gui/alarm-notify/alarm.c @@ -170,7 +170,7 @@ void alarm_init (void) { struct sigaction sa; - int flags = 0; + int flags; pipe (alarm_pipes); diff --git a/calendar/gui/alarm.c b/calendar/gui/alarm.c index 04e7c02e49..b7f0d12e13 100644 --- a/calendar/gui/alarm.c +++ b/calendar/gui/alarm.c @@ -170,7 +170,7 @@ void alarm_init (void) { struct sigaction sa; - int flags = 0; + int flags; pipe (alarm_pipes); diff --git a/calendar/gui/calendar.c b/calendar/gui/calendar.c index 57c9ad9230..e871bfee99 100644 --- a/calendar/gui/calendar.c +++ b/calendar/gui/calendar.c @@ -4,7 +4,7 @@ * This keeps track of a given calendar. Eventually this will abtract everything * related to getting calendars/saving calendars locally or to a remote Calendar Service * - * Copyright (C) 1998, 1999 the Free Software Foundation + * Copyright (C) 1998 the Free Software Foundation * * Authors: * Miguel de Icaza (miguel@gnu.org) @@ -12,8 +12,6 @@ * */ -#include <gnome.h> -#include <stdio.h> #include <config.h> #include <unistd.h> #include <sys/stat.h> @@ -30,6 +28,7 @@ extern char *tzname[2]; time_t calendar_day_begin, calendar_day_end; static void calendar_init_alarms (Calendar *cal); +static void calendar_set_day (void); Calendar * calendar_new (char *title) @@ -40,8 +39,9 @@ calendar_new (char *title) cal->title = g_strdup (title); - cal->event_hash = g_hash_table_new (g_str_hash, g_str_equal); - + if ((calendar_day_begin == 0) || (calendar_day_end == 0)) + calendar_set_day (); + calendar_init_alarms (cal); return cal; @@ -76,7 +76,7 @@ add_object_alarms (iCalObject *obj, time_t start, time_t end, void *closure) #define max(a,b) ((a > b) ? a : b) -static void +void ical_object_try_alarms (iCalObject *obj) { int ao, po, od, mo; @@ -97,14 +97,9 @@ ical_object_try_alarms (iCalObject *obj) void calendar_add_object (Calendar *cal, iCalObject *obj) { - g_return_if_fail (cal != NULL); - g_return_if_fail (obj != NULL); - g_return_if_fail (obj->uid != NULL); - obj->new = 0; switch (obj->type){ case ICAL_EVENT: - g_hash_table_insert (cal->event_hash, obj->uid, obj); cal->events = g_list_prepend (cal->events, obj); ical_object_try_alarms (obj); #ifdef DEBUGGING_MAIL_ALARM @@ -142,7 +137,6 @@ calendar_remove_object (Calendar *cal, iCalObject *obj) switch (obj->type){ case ICAL_EVENT: cal->events = g_list_remove (cal->events, obj); - g_hash_table_remove (cal->event_hash, obj->uid); break; case ICAL_TODO: @@ -171,8 +165,6 @@ calendar_destroy (Calendar *cal) g_list_foreach (cal->journal, (GFunc) ical_object_destroy, NULL); g_list_free (cal->journal); - g_hash_table_destroy (cal->event_hash); - if (cal->title) g_free (cal->title); if (cal->filename) @@ -181,6 +173,17 @@ calendar_destroy (Calendar *cal) g_free (cal); } +char * +ice (time_t t) +{ + static char buffer [100]; + struct tm tm; + + tm = *localtime (&t); + sprintf (buffer, "%d/%d/%d", tm.tm_mday, tm.tm_mon, tm.tm_year); + return buffer; +} + void calendar_iterate_on_objects (GList *objects, time_t start, time_t end, calendarfn cb, void *closure) { @@ -324,43 +327,19 @@ calendar_load (Calendar *cal, char *fname) return NULL; } -/* - * calendar_load_from_memory: - * @cal: calendar on which we load the information - * @buffer: A buffer that contains a vCalendar file - * - * Loads the information from the vCalendar information in @buffer - * into the Calendar - */ -char * -calendar_load_from_memory (Calendar *cal, const char *buffer) -{ - VObject *vcal; - - g_return_val_if_fail (buffer != NULL, NULL); - - cal->filename = g_strdup ("memory-based-calendar"); - vcal = Parse_MIME (buffer, strlen (buffer)); - if (!vcal) - return "Could not load the calendar"; - - cal->file_time = time (NULL); - calendar_load_from_vobject (cal, vcal); - cleanVObject (vcal); - cleanStrTbl (); - - return NULL; -} - -static VObject * -vcalendar_create_from_calendar (Calendar *cal) +void +calendar_save (Calendar *cal, char *fname) { VObject *vcal; GList *l; time_t now = time (NULL); + struct stat s; struct tm tm; - /* WE call localtime for the side effect of setting tzname */ + if (fname == NULL) + fname = cal->filename; + + /* We call localtime for the side effect of setting tzname */ tm = *localtime (&now); vcal = newVObject (VCCalProp); @@ -391,22 +370,6 @@ vcalendar_create_from_calendar (Calendar *cal) addVObjectProp (vcal, obj); } - return vcal; -} - -void -calendar_save (Calendar *cal, char *fname) -{ - VObject *vcal; - FILE *fp; - GtkWidget *dlg; - struct stat s; - int status; - - if (fname == NULL) - fname = cal->filename; - - vcal = vcalendar_create_from_calendar (cal); if (g_file_exists (fname)){ char *backup_name = g_strconcat (fname, "~", NULL); @@ -416,43 +379,13 @@ calendar_save (Calendar *cal, char *fname) rename (fname, backup_name); g_free (backup_name); } + writeVObjectToFile (fname, vcal); - fp = fopen(fname,"w"); - if (fp) { - writeVObject(fp, vcal); - fclose(fp); - if (strcmp(cal->filename, fname)) { - if (cal->filename) - g_free (cal->filename); - cal->filename = g_strdup (fname); - } - status = stat (fname, &s); - cal->file_time = s.st_mtime; - } else { - dlg = gnome_message_box_new(_("Failed to save calendar!"), - GNOME_MESSAGE_BOX_ERROR, "Ok", NULL); - gtk_widget_show(dlg); - } - - cleanVObject (vcal); - cleanStrTbl (); -} - -char * -calendar_get_as_vcal_string (Calendar *cal) -{ - VObject *vcal; - char *result; + stat (fname, &s); + cal->file_time = s.st_mtime; - g_return_val_if_fail (cal != NULL, NULL); - - vcal = vcalendar_create_from_calendar (cal); - result = writeMemVObject (NULL, 0, vcal); - cleanVObject (vcal); cleanStrTbl (); - - return result; } static gint @@ -505,15 +438,13 @@ void calendar_object_changed (Calendar *cal, iCalObject *obj, int flags) { obj->last_mod = time (NULL); - obj->pilot_status = ICAL_PILOT_SYNC_MOD; - + if (!(flags & CHANGE_DATES)) return; /* Remove any alarms on the alarm list for this object */ while (alarm_kill (obj)) ; - ical_object_try_alarms (obj); } @@ -541,99 +472,3 @@ calendar_init_alarms (Calendar *cal) alarm_add (&day_change_alarm, calendar_day_change, cal); } -static iCalObject * -calendar_object_find_in_list (Calendar *cal, GList *list, const char *uid) -{ - GList *l; - - for (l = list; l; l = l->next){ - iCalObject *obj = l->data; - - if (strcmp (obj->uid, uid) == 0) - return obj; - } - - return NULL; -} - -iCalObject * -calendar_object_find_event (Calendar *cal, const char *uid) -{ - g_return_val_if_fail (cal != NULL, NULL); - g_return_val_if_fail (uid != NULL, NULL); - - return g_hash_table_lookup (cal->event_hash, uid); -} - -iCalObject * -calendar_object_find_todo (Calendar *cal, const char *uid) -{ - g_return_val_if_fail (cal != NULL, NULL); - g_return_val_if_fail (uid != NULL, NULL); - - return calendar_object_find_in_list (cal, cal->todo, uid); -} - -iCalObject * -calendar_object_find (Calendar *cal, const char *uid) -{ - iCalObject *obj; - - g_return_val_if_fail (cal != NULL, NULL); - g_return_val_if_fail (uid != NULL, NULL); - - obj = calendar_object_find_in_list (cal, cal->todo, uid); - - if (obj == NULL) - obj = calendar_object_find_in_list (cal, cal->events, uid); - - return obj; -} - -iCalObject * -calendar_object_find_by_pilot (Calendar *cal, int pilot_id) -{ - GList *l; - - g_return_val_if_fail (cal != NULL, NULL); - - for (l = cal->events; l; l = l->next){ - iCalObject *obj = l->data; - - if (obj->pilot_id == pilot_id) - return obj; - } - - for (l = cal->todo; l; l = l->next){ - iCalObject *obj = l->data; - - if (obj->pilot_id == pilot_id) - return obj; - } - - return NULL; -} - -/* - * calendar_string_from_object: - * - * Returns the iCalObject @object armored around a vCalendar - * object as a string. - */ -char * -calendar_string_from_object (iCalObject *object) -{ - Calendar *cal; - char *str; - - g_return_val_if_fail (object != NULL, NULL); - - cal = calendar_new ("Temporal"); - calendar_add_object (cal, object); - str = calendar_get_as_vcal_string (cal); - calendar_remove_object (cal, object); - - calendar_destroy (cal); - - return str; -} diff --git a/calendar/gui/eventedit.c b/calendar/gui/eventedit.c index 926bb6f09c..8b7baa6a75 100644 --- a/calendar/gui/eventedit.c +++ b/calendar/gui/eventedit.c @@ -59,6 +59,15 @@ event_editor_class_init (EventEditorClass *class) object_class->destroy = event_editor_destroy; } +GtkWidget * +adjust (GtkWidget *w, gfloat x, gfloat y, gfloat xs, gfloat ys) +{ + GtkWidget *a = gtk_alignment_new (x, y, xs, ys); + + gtk_container_add (GTK_CONTAINER (a), w); + return a; +} + static GtkWidget * make_spin_button (int val, int low, int high) { @@ -423,7 +432,7 @@ ee_classification_widgets (EventEditor *ee) * Retrieves the information from the CalendarAlarm widgets and stores them * on the CalendarAlarm generic values */ -static void +void ee_store_alarm (CalendarAlarm *alarm, enum AlarmType type) { GtkWidget *item; @@ -1469,6 +1478,7 @@ static void event_editor_init (EventEditor *ee) { ee->ical = 0; + gtk_window_set_title (GTK_WINDOW (ee), _("Create new appointment")); gnome_dialog_set_close (GNOME_DIALOG(ee), TRUE); } @@ -1501,12 +1511,6 @@ event_editor_new (GnomeCalendar *gcal, iCalObject *ical) if (ical == 0){ ical = ical_new ("", user_name, ""); ical->new = 1; - } - - if (ical->new){ - gtk_window_set_title (GTK_WINDOW (ee), _("Create new appointment")); - } else { - gtk_window_set_title (GTK_WINDOW (ee), _("Edit appointment")); } ical->user_data = ee; /* so that the world can know we are editing it */ diff --git a/calendar/gui/gncal-day-panel.c b/calendar/gui/gncal-day-panel.c index f407a497d3..f041e3d6dd 100644 --- a/calendar/gui/gncal-day-panel.c +++ b/calendar/gui/gncal-day-panel.c @@ -95,8 +95,6 @@ gncal_day_panel_new (GnomeCalendar *calendar, time_t start_of_day) { GncalDayPanel *dpanel; GtkWidget *w; - GtkWidget *hpane, *vpane; - gint start_pos = 265; struct tm tm; g_return_val_if_fail (calendar != NULL, NULL); @@ -120,15 +118,6 @@ gncal_day_panel_new (GnomeCalendar *calendar, time_t start_of_day) 0, 0); gtk_widget_show (w); - /* Create horizontal pane */ - - hpane = gtk_hpaned_new (); - gtk_table_attach (GTK_TABLE (dpanel), hpane, - 0, 1, 2, 4, - GTK_EXPAND | GTK_FILL | GTK_SHRINK, - GTK_EXPAND | GTK_FILL | GTK_SHRINK, - 0, 0); - /* Full day */ w = gtk_scrolled_window_new (NULL, NULL); @@ -136,8 +125,11 @@ gncal_day_panel_new (GnomeCalendar *calendar, time_t start_of_day) gtk_scrolled_window_set_policy (dpanel->fullday_sw, GTK_POLICY_AUTOMATIC, GTK_POLICY_AUTOMATIC); - gtk_paned_pack1 (GTK_PANED (hpane), w, FALSE, TRUE); - /*gtk_paned_add1 (GTK_PANED (hpane), w);*/ + gtk_table_attach (GTK_TABLE (dpanel), w, + 0, 1, 1, 4, + GTK_EXPAND | GTK_FILL | GTK_SHRINK, + GTK_EXPAND | GTK_FILL | GTK_SHRINK, + 0, 0); gtk_widget_show (w); w = gncal_full_day_new (calendar, time_day_begin (start_of_day), time_day_end (start_of_day)); @@ -154,12 +146,6 @@ gncal_day_panel_new (GnomeCalendar *calendar, time_t start_of_day) (GtkSignalFunc) full_day_size_allocated, dpanel); - /* Create vertical pane */ - - vpane = gtk_vpaned_new (); - gtk_paned_pack2 (GTK_PANED (hpane), GTK_WIDGET (vpane), TRUE, TRUE); - /*gtk_paned_add2 (GTK_PANED (hpane), GTK_WIDGET (vpane));*/ - /* Gtk calendar */ tm = *localtime (&start_of_day); @@ -179,22 +165,38 @@ gncal_day_panel_new (GnomeCalendar *calendar, time_t start_of_day) dpanel); gtk_signal_connect (GTK_OBJECT (dpanel->gtk_calendar), "month_changed", GTK_SIGNAL_FUNC (retag_calendar), dpanel); - gtk_paned_add1 (GTK_PANED (vpane), w); + gtk_table_attach (GTK_TABLE (dpanel), w, + 1, 2, 1, 2, + GTK_FILL | GTK_SHRINK, + GTK_FILL | GTK_SHRINK, + 0, 0); + gtk_widget_show (w); + + /* Separator */ + + w = gtk_hseparator_new (); + gtk_table_attach (GTK_TABLE (dpanel), w, + 1, 2, 2, 3, + GTK_FILL | GTK_SHRINK, + GTK_FILL | GTK_SHRINK, + 0, 0); gtk_widget_show (w); /* To-do */ w = gncal_todo_new (calendar); dpanel->todo = GNCAL_TODO (w); - gtk_paned_add2 (GTK_PANED (vpane), w); + gtk_table_attach (GTK_TABLE (dpanel), w, + 1, 2, 3, 4, + GTK_FILL | GTK_SHRINK, + GTK_EXPAND | GTK_FILL | GTK_SHRINK, + 0, 0); gtk_widget_show (w); /* Done */ gncal_day_panel_set (dpanel, start_of_day); - gtk_paned_set_position (GTK_PANED (hpane), start_pos); - return GTK_WIDGET (dpanel); } diff --git a/calendar/gui/gncal-todo.c b/calendar/gui/gncal-todo.c index 941eddf453..3be3ac4517 100644 --- a/calendar/gui/gncal-todo.c +++ b/calendar/gui/gncal-todo.c @@ -15,7 +15,13 @@ int todo_show_due_date = 0; int todo_show_priority = 0; -int todo_due_date_overdue_highlight = 0; +int todo_show_time_remaining = 0; + +int todo_item_dstatus_highlight_overdue = 0; +int todo_item_dstatus_highlight_due_today = 0; +int todo_item_dstatus_highlight_not_due_yet = 0; + + char *todo_overdue_font_text; gint todo_current_sort_column = 0; gint todo_current_sort_type = GTK_SORT_ASCENDING; @@ -177,7 +183,7 @@ simple_todo_editor (GncalTodo *todo, iCalObject *ico) gtk_widget_show (due_label); due_entry = gtk_entry_new (); - due_entry = date_edit_new (ico->dtend, FALSE); + due_entry = date_edit_new (ico->dtend, TRUE); gtk_box_pack_start (GTK_BOX (due_box), due_entry, TRUE, TRUE, 0); gtk_widget_show (due_entry); @@ -412,15 +418,17 @@ gncal_todo_init (GncalTodo *todo) GtkWidget *w; GtkWidget *sw; GtkWidget *hbox; - gchar *titles[3] = { + gchar *titles[4] = { N_("Summary"), N_("Due Date"), - N_("Priority") + N_("Priority"), + N_("Time Left") }; - char *tmp[3]; + char *tmp[4]; tmp[0] = _(titles[0]); tmp[1] = _(titles[1]); tmp[2] = _(titles[2]); + tmp[3] = _(titles[3]); gtk_box_set_spacing (GTK_BOX (todo), 4); @@ -439,7 +447,7 @@ gncal_todo_init (GncalTodo *todo) gtk_widget_show (sw); - w = gtk_clist_new_with_titles(3, tmp); + w = gtk_clist_new_with_titles(4, tmp); todo->clist = GTK_CLIST (w); gtk_clist_set_selection_mode (todo->clist, GTK_SELECTION_BROWSE); @@ -523,53 +531,224 @@ convert_time_t_to_char (time_t t) return g_strdup (buf); } +enum todo_styles { + TODO_STYLE_OVERDUE, + TODO_STYLE_DUE_TODAY, + TODO_STYLE_NOT_DUE +}; + + +enum todo_status { + TODO_ITEM_DSTATUS_NOT_DUE_YET, + TODO_ITEM_DSTATUS_DUE_TODAY, + TODO_ITEM_DSTATUS_OVERDUE, + TODO_ITEM_DSTATUS_LAST_DUE_STATUS +}; +typedef enum todo_status todo_status; + static GtkStyle * -make_overdue_todo_style(GncalTodo *todo) +make_todo_style(GncalTodo *todo, todo_status style_type) { - GtkStyle *overdue_style = NULL; - GdkColor overdue_color; + GtkStyle *style = NULL; + GdkColor style_color; + int color_prop = 0; + switch(style_type) { + case TODO_ITEM_DSTATUS_NOT_DUE_YET: + color_prop = COLOR_PROP_TODO_NOT_DUE_YET; + break; + case TODO_ITEM_DSTATUS_DUE_TODAY: + color_prop = COLOR_PROP_TODO_DUE_TODAY; + break; + case TODO_ITEM_DSTATUS_OVERDUE: + color_prop = COLOR_PROP_TODO_OVERDUE; + break; + case TODO_ITEM_DSTATUS_LAST_DUE_STATUS: + } - /*make the overdue color configurable */ - overdue_color.red = color_props[COLOR_PROP_OVERDUE_TODO].r; - overdue_color.green = color_props[COLOR_PROP_OVERDUE_TODO].g; - overdue_color.blue = color_props[COLOR_PROP_OVERDUE_TODO].b; + style_color.red = color_props[color_prop].r; + style_color.green = color_props[color_prop].g; + style_color.blue = color_props[color_prop].b; - overdue_style = gtk_style_copy (GTK_WIDGET (todo->clist)->style); - overdue_style->base[GTK_STATE_NORMAL] = overdue_color; + style = gtk_style_copy (GTK_WIDGET (todo->clist)->style); + style->base[GTK_STATE_NORMAL] = style_color; + return style; +} + + + + +static +todo_status todo_item_due_status(time_t *todo_due_time) { + struct tm due_tm_time; + struct tm current_time; + struct tm *temp_tm; + time_t current_time_val = time(NULL); + temp_tm = localtime(todo_due_time); + /* make a copy so it dosen't get over written */ + memcpy(&due_tm_time, temp_tm, sizeof(struct tm)); - return overdue_style; + + temp_tm = localtime(¤t_time_val); + memcpy(¤t_time, temp_tm, sizeof(struct tm)); + + if(due_tm_time.tm_mon == current_time.tm_mon && + due_tm_time.tm_mday == current_time.tm_mday && + due_tm_time.tm_year == current_time.tm_year) { + return TODO_ITEM_DSTATUS_DUE_TODAY; + } + + if((*todo_due_time) < current_time_val) { + return TODO_ITEM_DSTATUS_OVERDUE; + } + + return TODO_ITEM_DSTATUS_NOT_DUE_YET; } + +enum todo_remaining_time_form { + TODO_ITEM_REMAINING_WEEKS, + TODO_ITEM_REMAINING_DAYS, + TODO_ITEM_REMAINING_HOURS, + TODO_ITEM_REMAINING_MINUTES, + TODO_ITEM_REMAINING_SECONDS +}; +typedef enum todo_remaining_time_form todo_remaining_time_form; + static void insert_in_clist (GncalTodo *todo, iCalObject *ico) { int i; - char *text[3]; - static GtkStyle *overdue_style = NULL; + char *text[4]; + char time_remaining_buffer[100]; + time_t time_remain; + todo_remaining_time_form time_remaining_form; + int sec_in_week = 3600*7*24; + int sec_in_day = 3600*24; + int sec_in_hour = 3600; + int sec_in_minute = 60; + int weeks = 0; + int days = 0; + int hours = 0; + int minutes = 0; + int seconds = 0; + - - /* setup the over due style if we haven't already, or it changed.*/ - if (todo_style_changed || !overdue_style) { - /* free the old style cause its not needed anymore */ - if(!overdue_style) g_free(overdue_style); - overdue_style = make_overdue_todo_style(todo); + /* an array for the styles of items */ + static GtkStyle *dstatus_styles[TODO_ITEM_DSTATUS_LAST_DUE_STATUS]; + /* we want to remake the styles when the status is changed, + also we need to check for the null value in the pointer so we init them + at startup */ + if (todo_style_changed || !dstatus_styles[TODO_ITEM_DSTATUS_NOT_DUE_YET]) { + g_free(dstatus_styles[TODO_ITEM_DSTATUS_NOT_DUE_YET]); + g_free(dstatus_styles[TODO_ITEM_DSTATUS_OVERDUE]); + g_free(dstatus_styles[TODO_ITEM_DSTATUS_DUE_TODAY]); + + dstatus_styles[TODO_ITEM_DSTATUS_NOT_DUE_YET] = make_todo_style(todo, TODO_ITEM_DSTATUS_NOT_DUE_YET); + dstatus_styles[TODO_ITEM_DSTATUS_OVERDUE] = make_todo_style(todo, TODO_ITEM_DSTATUS_OVERDUE); + dstatus_styles[TODO_ITEM_DSTATUS_DUE_TODAY] = make_todo_style(todo, TODO_ITEM_DSTATUS_DUE_TODAY); + todo_style_changed = 0; } + + + text[0] = ico->summary; + if(todo_show_time_remaining) { + memset(time_remaining_buffer, 0, 100); + /* we need to make a string that represents the amount of time remaining + before this task is due */ + + /* for right now all I'll do is up to the hours. */ + time_remain = (ico->dtend - time(NULL)); + if(time_remain < 0) { + text[3] = "Overdue!"; + } + else { + + /* lets determine a decent denomination to display */ + if(time_remain / (sec_in_week)) + { + /* we have weeks available */ + time_remaining_form = TODO_ITEM_REMAINING_WEEKS; + weeks = time_remain / sec_in_week; + days = (time_remain % (sec_in_week))/sec_in_day; + } + else if(time_remain / (sec_in_day)) + { + /* we have days available */ + time_remaining_form = TODO_ITEM_REMAINING_DAYS; + days = time_remain / sec_in_day; + hours = (time_remain % sec_in_day)/sec_in_hour; + } + else if(time_remain / (sec_in_hour)) + { + /* we have hours available */ + time_remaining_form = TODO_ITEM_REMAINING_HOURS; + hours = time_remain /sec_in_hour; + minutes = (time_remain % sec_in_hour) / sec_in_minute; + } + else if(time_remain / sec_in_minute) + { + time_remaining_form = TODO_ITEM_REMAINING_MINUTES; + minutes = time_remain / sec_in_minute; + seconds = time_remain % sec_in_minute; + } + else + { + time_remaining_form = TODO_ITEM_REMAINING_SECONDS; + seconds = time_remain; + } + + switch(time_remaining_form) + { + case TODO_ITEM_REMAINING_WEEKS: + snprintf(time_remaining_buffer, 100, "%d %s %d %s", weeks, + (weeks > 1) ? _("Weeks") : _("Week"), + days, (days > 1) ? _("Days") : _("Day")); + break; + case TODO_ITEM_REMAINING_DAYS: + snprintf(time_remaining_buffer, 100, "%d %s %d %s", days, + (days > 1) ? _("Days") : _("Day"), + hours, (hours > 1) ? _("Hours") : _("Hour")); + break; + case TODO_ITEM_REMAINING_HOURS: + snprintf(time_remaining_buffer, 100, "%d %s %d %s", hours, + (hours > 1) ? _("Hours") : _("Hour"), + minutes, (minutes > 1) ? _("Minutes") : _("Minute")); + break; + case TODO_ITEM_REMAINING_MINUTES: + snprintf(time_remaining_buffer, 100, "%d %s %d %s", minutes, + (minutes > 1) ? _("Minutes") : _("Minute"), + seconds, (seconds > 1) ? _("Seconds") : _("Second")); + break; + case TODO_ITEM_REMAINING_SECONDS: + snprintf(time_remaining_buffer, 100, "%d %s", seconds, + (seconds > 1) ? _("Seconds") : _("Second")); + break; + } + text[3] = g_strdup(time_remaining_buffer); + todo->data_ptrs = g_slist_append(todo->data_ptrs, text[3]); + } + + } + else { + text[3] = "Loose penguini!"; + } /* * right now column 0 will be the summary * and column 1 will be the due date. * WISH: this should be able to be changed on the fly */ - if(ico->dtend && todo_show_due_date) { - text[1] = convert_time_t_to_char (ico->dtend); - /* Append the data's pointer so later it can be properly freed */ - todo->data_ptrs = g_slist_append (todo->data_ptrs, text[1]); - } + if(ico->dtend && todo_show_due_date) + { + text[1] = convert_time_t_to_char (ico->dtend); + /* Append the data's pointer so later it can be properly freed */ + todo->data_ptrs = g_slist_append (todo->data_ptrs, text[1]); + } else text[1] = NULL; @@ -589,9 +768,27 @@ insert_in_clist (GncalTodo *todo, iCalObject *ico) * determine if the task is overdue.. * if so mark with the apropriate style */ - if(todo_due_date_overdue_highlight) { - if(ico->dtend < time(NULL)) - gtk_clist_set_row_style(todo->clist, i, overdue_style); + + switch(todo_item_due_status(&ico->dtend)) { + case TODO_ITEM_DSTATUS_NOT_DUE_YET: + if(todo_item_dstatus_highlight_not_due_yet) + { + gtk_clist_set_row_style(todo->clist, i, dstatus_styles[TODO_ITEM_DSTATUS_NOT_DUE_YET]); + } + break; + case TODO_ITEM_DSTATUS_DUE_TODAY: + if(todo_item_dstatus_highlight_due_today) + { + gtk_clist_set_row_style(todo->clist, i, dstatus_styles[TODO_ITEM_DSTATUS_DUE_TODAY]); + } + break; + case TODO_ITEM_DSTATUS_OVERDUE: + if(todo_item_dstatus_highlight_overdue) + { + gtk_clist_set_row_style(todo->clist, i, dstatus_styles[TODO_ITEM_DSTATUS_OVERDUE]); + } + break; + case TODO_ITEM_DSTATUS_LAST_DUE_STATUS: } /* keep the list in order */ @@ -626,10 +823,20 @@ gncal_todo_update (GncalTodo *todo, iCalObject *ico, int flags) /* check on the columns that we should display */ /* check for due date */ - if(todo_show_due_date) - gtk_clist_set_column_visibility (todo->clist, 1, 1); - else - gtk_clist_set_column_visibility (todo->clist, 1, 0); + if(todo_show_due_date) { + gtk_clist_set_column_visibility (todo->clist, 1, 1); + } + else { + gtk_clist_set_column_visibility (todo->clist, 1, 0); + } + + if(todo_show_time_remaining) { + gtk_clist_set_column_visibility (todo->clist, 3, 1); + } + else { + gtk_clist_set_column_visibility (todo->clist, 3, 0); + } + if(todo_show_priority) gtk_clist_set_column_visibility (todo->clist, 2, 1); diff --git a/calendar/gui/gncal.desktop b/calendar/gui/gncal.desktop index b5b75a3ed3..2f1bc5a7c9 100644 --- a/calendar/gui/gncal.desktop +++ b/calendar/gui/gncal.desktop @@ -3,29 +3,21 @@ Name=Calendar Name[da]=Kalender Name[de]=Kalender Name[es]=Calendario -Name[et]=Kalender -Name[fi]=Kalenteri Name[fr]=Calendrier -Name[ja]=¥«¥ì¥ó¥À¡¼ Name[ko]=´Þ·Â Name[no]=Kalender Name[pt]=Agenda -Name[pt_BR]=Calendário -Name[ru]=ëÁÌÅÎÄÁÒØ +Name[pl]=Terminarz Name[sv]=Kalender Comment=Calendar application Comment[da]=Gnome Kalender Comment[de]=Gnome Kalender Comment[es]=Calendario de Gnome -Comment[et]=GNOME kalender -Comment[fi]=GNOME-kalenteri Comment[fr]=Calendrier GNOME -Comment[ja]=GNOME¥«¥ì¥ó¥À¡¼ Comment[ko]=±×³ð ´Þ·Â Comment[no]=Gnome Kalender Comment[pt]=Agenda Gnome -Comment[pt_BR]=Calendário GNOME -Comment[ru]=ëÁÌÅÎÄÁÒØ Gnome +Comment[pl]=Terminarz GNOME Comment[sv]=Gnome-kalender Exec=gnomecal Icon=gnome-calendar.png diff --git a/calendar/gui/gnome-cal.c b/calendar/gui/gnome-cal.c index 1342e6454b..261aa5ff79 100644 --- a/calendar/gui/gnome-cal.c +++ b/calendar/gui/gnome-cal.c @@ -18,7 +18,6 @@ #include "year-view.h" #include "timeutil.h" #include "main.h" -#include "corba-cal.h" GnomeApp *parent_class; @@ -45,10 +44,11 @@ gnome_calendar_get_type (void) static void setup_widgets (GnomeCalendar *gcal) { + GtkWidget *sw; time_t now; now = time (NULL); - + gcal->notebook = gtk_notebook_new (); gcal->day_view = gncal_day_panel_new (gcal, now); gcal->week_view = gncal_week_view_new (gcal, now); @@ -60,13 +60,11 @@ setup_widgets (GnomeCalendar *gcal) GTK_POLICY_NEVER, GTK_POLICY_AUTOMATIC); gtk_container_add (GTK_CONTAINER (gcal->year_view_sw), gcal->year_view); - GTK_LAYOUT (gcal->year_view)->vadjustment->step_increment = 10.0; - gtk_adjustment_changed (GTK_ADJUSTMENT (GTK_LAYOUT (gcal->year_view)->vadjustment)); gtk_notebook_append_page (GTK_NOTEBOOK (gcal->notebook), gcal->day_view, gtk_label_new (_("Day View"))); gtk_notebook_append_page (GTK_NOTEBOOK (gcal->notebook), gcal->week_view, gtk_label_new (_("Week View"))); gtk_notebook_append_page (GTK_NOTEBOOK (gcal->notebook), gcal->month_view, gtk_label_new (_("Month View"))); - gtk_notebook_append_page (GTK_NOTEBOOK (gcal->notebook), gcal->year_view_sw, gtk_label_new (_("Year View"))); + gtk_notebook_append_page (GTK_NOTEBOOK (gcal->notebook), gcal->year_view_sw, gtk_label_new (_("Year View"))); gtk_widget_show_all (gcal->notebook); @@ -134,7 +132,7 @@ gnome_calendar_direction (GnomeCalendar *gcal, int direction) { GtkWidget *cp = get_current_page (gcal); time_t new_time; - + if (cp == gcal->day_view) new_time = time_add_day (time_day_begin (gcal->current_display), 1 * direction); else if (cp == gcal->week_view) @@ -185,7 +183,7 @@ gnome_calendar_goto_today (GnomeCalendar *gcal) { g_return_if_fail (gcal != NULL); g_return_if_fail (GNOME_IS_CALENDAR (gcal)); - + gnome_calendar_goto (gcal, time (NULL)); } @@ -197,7 +195,7 @@ gnome_calendar_set_view (GnomeCalendar *gcal, char *page_name) g_return_if_fail (gcal != NULL); g_return_if_fail (GNOME_IS_CALENDAR (gcal)); g_return_if_fail (page_name != NULL); - + if (strcmp (page_name, "dayview") == 0) page = 0; @@ -216,21 +214,19 @@ gnome_calendar_new (char *title) GtkWidget *retval; GnomeCalendar *gcal; GnomeApp *app; - + retval = gtk_type_new (gnome_calendar_get_type ()); app = GNOME_APP (retval); gcal = GNOME_CALENDAR (retval); - + app->name = g_strdup ("calendar"); app->prefix = g_strconcat ("/", app->name, "/", NULL); - + gtk_window_set_title(GTK_WINDOW(retval), title); gcal->current_display = time_day_begin (time (NULL)); gcal->cal = calendar_new (title); setup_widgets (gcal); - gnome_calendar_create_corba_server (gcal); - return retval; } @@ -251,7 +247,7 @@ gnome_calendar_load (GnomeCalendar *gcal, char *file) g_return_val_if_fail (gcal != NULL, 0); g_return_val_if_fail (GNOME_IS_CALENDAR (gcal), 0); g_return_val_if_fail (file != NULL, 0); - + if ((r = calendar_load (gcal->cal, file)) != NULL){ printf ("Error loading calendar: %s\n", r); return 0; @@ -319,12 +315,12 @@ execute (char *command, int close_standard) struct sigaction ignore, save_intr, save_quit; int status = 0, i; pid_t pid; - + ignore.sa_handler = SIG_IGN; sigemptyset (&ignore.sa_mask); ignore.sa_flags = 0; - - sigaction (SIGINT, &ignore, &save_intr); + + sigaction (SIGINT, &ignore, &save_intr); sigaction (SIGQUIT, &ignore, &save_quit); if ((pid = fork ()) < 0){ @@ -337,16 +333,16 @@ execute (char *command, int close_standard) const int top = max_open_files (); sigaction (SIGINT, &save_intr, NULL); sigaction (SIGQUIT, &save_quit, NULL); - + for (i = (close_standard ? 0 : 3); i < top; i++) close (i); - + /* FIXME: As an excercise to the reader, copy the * code from mc to setup shell properly instead of * /bin/sh. Yes, this comment is larger than a cut and paste. */ execl ("/bin/sh", "/bin/sh", "-c", command, (char *) 0); - + _exit (127); } else { _exit (127); @@ -363,7 +359,7 @@ mail_notify (char *mail_address, char *text, time_t app_time) pid_t pid; int p [2]; char *command; - + pipe (p); pid = fork (); if (pid == 0){ @@ -398,7 +394,7 @@ static gint start_beeping (gpointer data) { gdk_beep (); - + return TRUE; } @@ -407,7 +403,7 @@ calendar_notify (time_t time, CalendarAlarm *which, void *data) { iCalObject *ico = data; guint tag; - + if (&ico->aalarm == which){ time_t app = ico->aalarm.trigger + ico->aalarm.offset; GtkWidget *w; @@ -464,11 +460,11 @@ mark_gtk_calendar_day (iCalObject *obj, time_t start, time_t end, void *c) tm_s = *localtime (&start); day_end = time_day_end (end); - + for (t = start; t <= day_end; t += 60*60*24){ time_t new = mktime (&tm_s); struct tm tm_day; - + tm_day = *localtime (&new); gtk_calendar_mark_day (gtk_cal, tm_day.tm_mday); tm_s.tm_mday++; @@ -541,14 +537,14 @@ gnome_calendar_colors_changed (GnomeCalendar *gcal) todo_list_properties_changed (GNCAL_DAY_PANEL (gcal->day_view)); } -void -gnome_calendar_todo_properties_changed (GnomeCalendar *gcal) +void +gnome_calendar_todo_properties_changed (GnomeCalendar *gcal) { g_return_if_fail (gcal != NULL); g_return_if_fail (GNOME_IS_CALENDAR (gcal)); - + /* FIXME: add day and week view when they are done */ - + todo_style_changed = 1; todo_list_properties_changed (GNCAL_DAY_PANEL (gcal->day_view)); } diff --git a/calendar/gui/gnome-cal.h b/calendar/gui/gnome-cal.h index da53f29882..ae4e5292da 100644 --- a/calendar/gui/gnome-cal.h +++ b/calendar/gui/gnome-cal.h @@ -63,8 +63,6 @@ void gnome_calendar_object_changed (GnomeCalendar *gcal, iCalObject *obj, int flags); -GnomeCalendar *gnome_calendar_locate (const char *pathname); - /* Notifies the calendar that the time format has changed and it must update all its views */ void gnome_calendar_time_format_changed (GnomeCalendar *gcal); diff --git a/calendar/gui/main.c b/calendar/gui/main.c index 0f0cc91477..44961ed2d6 100644 --- a/calendar/gui/main.c +++ b/calendar/gui/main.c @@ -9,7 +9,6 @@ #include <config.h> #include <gnome.h> -#include <libgnorba/gnorba.h> #include <pwd.h> #include <sys/types.h> #include <sys/stat.h> @@ -22,7 +21,7 @@ #include "gnome-cal.h" #include "main.h" #include "timeutil.h" -#include "corba-cal-factory.h" + #define COOKIE_USER_HOME_DIR ((char *) -1) @@ -62,7 +61,9 @@ struct color_prop color_props[] = { { 0xd364, 0xc6b7, 0x7969, N_("Highlighted day:"), "/calendar/Colors/prelight_bg" }, { 0x01f0, 0x01f0, 0x01f0, N_("Day numbers:"), "/calendar/Colors/day_fg" }, { 0x0000, 0x0000, 0xffff, N_("Current day's number:"), "/calendar/Colors/current_fg" }, - { 0x0000, 0xaaaa, 0xaaaa, N_("Overdue To Do item"), "/calendar/Coloirs/todo_overdue" } + { 0xbbbb, 0xbbbb, 0x0000, N_("To-Do item that is not yet due:"), "/calendar/Colors/todo_not_yet" }, + { 0xdddd, 0xbbbb, 0x0000, N_("To-Do item that is due today:"), "/calendar/Colors/todo_today" }, + { 0xbbbb, 0xdddd, 0x0000, N_("To-Do item that is overdue:"), "/calendar/Colors/todo_overdue" } }; /* Number of active calendars */ @@ -71,6 +72,8 @@ int active_calendars = 0; /* A list of all of the calendars started */ GList *all_calendars = NULL; +static void new_calendar (char *full_name, char *calendar_file, char *geometry, char *view, gboolean hidden); + /* For dumping part of a calendar */ static time_t from_t, to_t; @@ -143,9 +146,14 @@ init_calendar (void) /* read todolist settings */ + todo_show_time_remaining = gnome_config_get_bool("/calendar/Todo/show_time_remain"); todo_show_due_date = gnome_config_get_bool("/calendar/Todo/show_due_date"); - todo_due_date_overdue_highlight = gnome_config_get_bool("/calendar/Todo/highlight_overdue_tasks"); + todo_item_dstatus_highlight_overdue = gnome_config_get_bool("/calendar/Todo/highlight_overdue"); + + todo_item_dstatus_highlight_due_today = gnome_config_get_bool("/calendar/Todo/highlight_due_today"); + + todo_item_dstatus_highlight_not_due_yet = gnome_config_get_bool("/calendar/Todo/highlight_not_due_yet"); todo_current_sort_column = gnome_config_get_int("/calendar/Todo/sort_column"); @@ -206,29 +214,10 @@ display_objedit_today (GtkWidget *widget, GnomeCalendar *gcal) gtk_widget_show (ee); } -GnomeCalendar * -gnome_calendar_locate (const char *pathname) -{ - GList *l; - - if (pathname == NULL || pathname [0] == 0) - pathname = user_calendar_file; - - for (l = all_calendars; l; l = l->next){ - GnomeCalendar *gcal = l->data; - - if (strcmp (gcal->cal->filename, pathname) == 0){ - return gcal; - } - } - return NULL; -} - static void close_cmd (GtkWidget *widget, GnomeCalendar *gcal) { all_calendars = g_list_remove (all_calendars, gcal); - if (gcal->cal->modified){ if (!gcal->cal->filename) save_calendar_cmd (widget, gcal); @@ -239,10 +228,8 @@ close_cmd (GtkWidget *widget, GnomeCalendar *gcal) gtk_widget_destroy (GTK_WIDGET (gcal)); active_calendars--; - if (active_calendars == 0){ - unregister_calendar_services (); + if (active_calendars == 0) gtk_main_quit (); - } } void @@ -383,14 +370,15 @@ static void save_ok (GtkWidget *widget, GtkFileSelection *fs) { GnomeCalendar *gcal; - gchar *fname; gcal = GNOME_CALENDAR (gtk_object_get_user_data (GTK_OBJECT (fs))); gtk_window_set_wmclass (GTK_WINDOW (gcal), "gnomecal", "gnomecal"); - fname = g_strdup (gtk_file_selection_get_filename (fs)); - calendar_save (gcal->cal, fname); - g_free(fname); + if (gcal->cal->filename) + g_free (gcal->cal->filename); + + gcal->cal->filename = g_strdup (gtk_file_selection_get_filename (fs)); + calendar_save (gcal->cal, gcal->cal->filename); gtk_main_quit (); } @@ -460,6 +448,7 @@ save_calendar_cmd (GtkWidget *widget, void *data) g_free (str); gnome_dialog_set_default (GNOME_DIALOG (box), 1); b = gnome_dialog_run (GNOME_DIALOG (box)); + gtk_object_destroy (GTK_OBJECT (box)); if (b != 0) return; @@ -590,7 +579,7 @@ calendar_close_event (GtkWidget *widget, GdkEvent *event, GnomeCalendar *gcal) return TRUE; } -GnomeCalendar * +static void new_calendar (char *full_name, char *calendar_file, char *geometry, char *page, gboolean hidden) { GtkWidget *toplevel; @@ -598,8 +587,7 @@ new_calendar (char *full_name, char *calendar_file, char *geometry, char *page, int xpos, ypos, width, height; /* i18n: This "%s%s" indicates possession. Languages where the order is - * the inverse should translate it to "%2$s%1$s". - */ + the inverse should translate it to "%2$s%1$s". */ g_snprintf(title, 128, _("%s%s"), full_name, _("'s calendar")); toplevel = gnome_calendar_new (title); @@ -646,8 +634,6 @@ new_calendar (char *full_name, char *calendar_file, char *geometry, char *page, } gtk_widget_show (toplevel); - - return GNOME_CALENDAR (toplevel); } static void @@ -888,23 +874,13 @@ int main(int argc, char *argv[]) { GnomeClient *client; - CORBA_Environment ev; bindtextdomain (PACKAGE, GNOMELOCALEDIR); textdomain (PACKAGE); - CORBA_exception_init (&ev); - - gnome_CORBA_init_with_popt_table ( - "calendar", VERSION, &argc, argv, - options, 0, NULL, GNORBA_INIT_SERVER_FUNC, &ev); + gnome_init_with_popt_table ("calendar", VERSION, argc, argv, + options, 0, NULL); - orb = gnome_CORBA_ORB (); - poa = (PortableServer_POA)CORBA_ORB_resolve_initial_references (orb, "RootPOA", &ev); - if (ev._major == CORBA_NO_EXCEPTION){ - init_corba_server (); - } - if (show_events) dump_events (); if (show_todo) diff --git a/calendar/gui/main.h b/calendar/gui/main.h index 584ce2e83c..ab7b5d87e1 100644 --- a/calendar/gui/main.h +++ b/calendar/gui/main.h @@ -19,7 +19,9 @@ typedef enum { COLOR_PROP_PRELIGHT_DAY_BG, /* Background color for prelighted day */ COLOR_PROP_DAY_FG, /* Color for day numbers */ COLOR_PROP_CURRENT_DAY_FG, /* Color for current day's number */ - COLOR_PROP_OVERDUE_TODO, + COLOR_PROP_TODO_NOT_DUE_YET, /* Color for Todo items not yet due */ + COLOR_PROP_TODO_DUE_TODAY, /* Color for Todo items due today */ + COLOR_PROP_TODO_OVERDUE, /* Color for Todo items that are overdue */ COLOR_PROP_LAST /* Number of color properties */ } ColorProp; @@ -36,10 +38,14 @@ extern struct color_prop color_props[]; /* todo preferences */ extern int todo_show_due_date; -extern int todo_due_date_overdue_highlight; + +extern int todo_item_dstatus_highlight_overdue; +extern int todo_item_dstatus_highlight_due_today; +extern int todo_item_dstatus_highlight_not_due_yet; + +extern int todo_show_time_remaining; extern int todo_show_priority; extern char *todo_overdue_font_text; -extern struct color_prop todo_overdue_highlight_color; extern gboolean todo_style_changed; extern gint todo_current_sort_column; extern gint todo_current_sort_type; @@ -75,7 +81,4 @@ char *color_spec_from_prop (ColorProp propnum); void save_default_calendar (GnomeCalendar *gcal); -GnomeCalendar *new_calendar (char *full_name, char *calendar_file, - char *geometry, char *page, gboolean hidden); - #endif diff --git a/calendar/gui/month-view.c b/calendar/gui/month-view.c index 5df7b7a23d..d227e6a4f3 100644 --- a/calendar/gui/month-view.c +++ b/calendar/gui/month-view.c @@ -477,8 +477,7 @@ month_view_init (MonthView *mv) "clip", TRUE, NULL); } - gnome_canvas_points_free (points); - + mv->old_current_index = -1; } diff --git a/calendar/gui/prop.c b/calendar/gui/prop.c index 129407293b..bef7a37ba6 100644 --- a/calendar/gui/prop.c +++ b/calendar/gui/prop.c @@ -44,7 +44,13 @@ static GnomeCanvasItem *month_item; /* Widgets for the todo page */ static GtkWidget *due_date_show_button; -static GtkWidget *due_date_overdue_highlight; + +static GtkWidget *todo_item_time_remaining_show_button; + +static GtkWidget *todo_item_highlight_overdue; +static GtkWidget *todo_item_highlight_not_due_yet; +static GtkWidget *todo_item_highlight_due_today; + static GtkWidget *priority_show_button; /* Callback used when the property box is closed -- just sets the prop_win variable to null. */ @@ -116,13 +122,24 @@ static void prop_apply_todo(void) { todo_show_due_date = GTK_TOGGLE_BUTTON (due_date_show_button)->active; - todo_due_date_overdue_highlight = GTK_TOGGLE_BUTTON (due_date_overdue_highlight)->active; + + todo_item_dstatus_highlight_overdue = GTK_TOGGLE_BUTTON(todo_item_highlight_overdue)->active; + todo_item_dstatus_highlight_not_due_yet = GTK_TOGGLE_BUTTON(todo_item_highlight_not_due_yet)->active; + todo_item_dstatus_highlight_due_today = GTK_TOGGLE_BUTTON(todo_item_highlight_due_today)->active; todo_show_priority = GTK_TOGGLE_BUTTON (priority_show_button)->active; + todo_show_time_remaining = GTK_TOGGLE_BUTTON (todo_item_time_remaining_show_button)->active; + /* storing the values */ + + gnome_config_set_bool("/calendar/Todo/show_time_remain", todo_show_time_remaining); + gnome_config_set_bool("/calendar/Todo/highlight_overdue", todo_item_dstatus_highlight_overdue); + + gnome_config_set_bool("/calendar/Todo/highlight_due_today", todo_item_dstatus_highlight_due_today); + + gnome_config_set_bool("/calendar/Todo/highlight_not_due_yet", todo_item_dstatus_highlight_not_due_yet); gnome_config_set_bool("/calendar/Todo/show_due_date", todo_show_due_date); - gnome_config_set_bool("/calendar/Todo/highlight_overdue_tasks", todo_due_date_overdue_highlight); gnome_config_set_bool("/calendar/Todo/show_priority", todo_show_priority); /* need to sync our config changes. */ gnome_config_sync (); @@ -475,7 +492,7 @@ create_colors_page (void) GtkWidget *w; int i; - frame = gtk_frame_new (_("Colors for months")); + frame = gtk_frame_new (_("Colors for display")); gtk_container_set_border_width (GTK_CONTAINER (frame), GNOME_PAD_SMALL); gnome_property_box_append_page (GNOME_PROPERTY_BOX (prop_win), frame, gtk_label_new (_("Colors"))); @@ -536,15 +553,8 @@ create_colors_page (void) static void set_todo_page_options(void) { - if(!GTK_TOGGLE_BUTTON (due_date_show_button)->active) { - /* disable everything */ - gtk_widget_set_sensitive(due_date_overdue_highlight,0); - } - else - { - gtk_widget_set_sensitive(due_date_overdue_highlight,1); - } - + + while (gtk_events_pending ()) gtk_main_iteration (); } @@ -562,22 +572,30 @@ build_list_options_frame(void) { GtkWidget *frame; GtkWidget *vbox; - frame = gtk_frame_new (_("Show on TODO List:")); + frame = gtk_frame_new (_("Show on To Do List:")); vbox = gtk_vbox_new (FALSE, 0); gtk_container_add (GTK_CONTAINER (frame), vbox); - due_date_show_button = gtk_check_button_new_with_label (_("Summary")); due_date_show_button = gtk_check_button_new_with_label (_("Due Date")); priority_show_button = gtk_check_button_new_with_label (_("Priority")); - + todo_item_time_remaining_show_button = gtk_check_button_new_with_label (_("Time Until Due")); + gtk_toggle_button_set_state (GTK_TOGGLE_BUTTON(due_date_show_button), todo_show_due_date); gtk_signal_connect (GTK_OBJECT(due_date_show_button), "clicked", (GtkSignalFunc) todo_option_set, NULL); gtk_box_pack_start (GTK_BOX (vbox), due_date_show_button, FALSE, FALSE, 0); - + + gtk_toggle_button_set_state (GTK_TOGGLE_BUTTON(todo_item_time_remaining_show_button), todo_show_time_remaining); + gtk_signal_connect (GTK_OBJECT(todo_item_time_remaining_show_button), + "clicked", + (GtkSignalFunc) todo_option_set, + NULL); + gtk_box_pack_start (GTK_BOX (vbox), todo_item_time_remaining_show_button, FALSE, FALSE, 0); + + gtk_toggle_button_set_state (GTK_TOGGLE_BUTTON(priority_show_button), todo_show_priority); gtk_signal_connect (GTK_OBJECT(priority_show_button), "clicked", @@ -597,14 +615,32 @@ build_style_list_options_frame(void) vbox = gtk_vbox_new (FALSE, 0); gtk_container_add (GTK_CONTAINER (frame), vbox); - due_date_overdue_highlight = gtk_check_button_new_with_label (_("Highlight overdue items")); - - gtk_toggle_button_set_state (GTK_TOGGLE_BUTTON(due_date_overdue_highlight), todo_due_date_overdue_highlight); - gtk_signal_connect (GTK_OBJECT(due_date_overdue_highlight), + todo_item_highlight_overdue = gtk_check_button_new_with_label (_("Highlight overdue items")); + gtk_toggle_button_set_state (GTK_TOGGLE_BUTTON(todo_item_highlight_overdue), + todo_item_dstatus_highlight_overdue); + todo_item_highlight_not_due_yet = gtk_check_button_new_with_label (_("Highlight not yet due items")); + gtk_toggle_button_set_state (GTK_TOGGLE_BUTTON(todo_item_highlight_not_due_yet), + todo_item_dstatus_highlight_overdue); + todo_item_highlight_due_today = gtk_check_button_new_with_label (_("Highlight items due today")); + gtk_toggle_button_set_state (GTK_TOGGLE_BUTTON(todo_item_highlight_due_today), + todo_item_dstatus_highlight_overdue); + + gtk_signal_connect (GTK_OBJECT(todo_item_highlight_overdue), "clicked", (GtkSignalFunc) todo_option_set, NULL); - gtk_box_pack_start (GTK_BOX (vbox), due_date_overdue_highlight, FALSE, FALSE, 0); + gtk_signal_connect (GTK_OBJECT(todo_item_highlight_not_due_yet), + "clicked", + (GtkSignalFunc) todo_option_set, + NULL); + gtk_signal_connect (GTK_OBJECT(todo_item_highlight_due_today), + "clicked", + (GtkSignalFunc) todo_option_set, + NULL); + + gtk_box_pack_start (GTK_BOX (vbox), todo_item_highlight_overdue, FALSE, FALSE, 0); + gtk_box_pack_start (GTK_BOX (vbox), todo_item_highlight_due_today, FALSE, FALSE, 0); + gtk_box_pack_start (GTK_BOX (vbox), todo_item_highlight_not_due_yet, FALSE, FALSE, 0); return frame; } static void diff --git a/calendar/main.c b/calendar/main.c index 0f0cc91477..44961ed2d6 100644 --- a/calendar/main.c +++ b/calendar/main.c @@ -9,7 +9,6 @@ #include <config.h> #include <gnome.h> -#include <libgnorba/gnorba.h> #include <pwd.h> #include <sys/types.h> #include <sys/stat.h> @@ -22,7 +21,7 @@ #include "gnome-cal.h" #include "main.h" #include "timeutil.h" -#include "corba-cal-factory.h" + #define COOKIE_USER_HOME_DIR ((char *) -1) @@ -62,7 +61,9 @@ struct color_prop color_props[] = { { 0xd364, 0xc6b7, 0x7969, N_("Highlighted day:"), "/calendar/Colors/prelight_bg" }, { 0x01f0, 0x01f0, 0x01f0, N_("Day numbers:"), "/calendar/Colors/day_fg" }, { 0x0000, 0x0000, 0xffff, N_("Current day's number:"), "/calendar/Colors/current_fg" }, - { 0x0000, 0xaaaa, 0xaaaa, N_("Overdue To Do item"), "/calendar/Coloirs/todo_overdue" } + { 0xbbbb, 0xbbbb, 0x0000, N_("To-Do item that is not yet due:"), "/calendar/Colors/todo_not_yet" }, + { 0xdddd, 0xbbbb, 0x0000, N_("To-Do item that is due today:"), "/calendar/Colors/todo_today" }, + { 0xbbbb, 0xdddd, 0x0000, N_("To-Do item that is overdue:"), "/calendar/Colors/todo_overdue" } }; /* Number of active calendars */ @@ -71,6 +72,8 @@ int active_calendars = 0; /* A list of all of the calendars started */ GList *all_calendars = NULL; +static void new_calendar (char *full_name, char *calendar_file, char *geometry, char *view, gboolean hidden); + /* For dumping part of a calendar */ static time_t from_t, to_t; @@ -143,9 +146,14 @@ init_calendar (void) /* read todolist settings */ + todo_show_time_remaining = gnome_config_get_bool("/calendar/Todo/show_time_remain"); todo_show_due_date = gnome_config_get_bool("/calendar/Todo/show_due_date"); - todo_due_date_overdue_highlight = gnome_config_get_bool("/calendar/Todo/highlight_overdue_tasks"); + todo_item_dstatus_highlight_overdue = gnome_config_get_bool("/calendar/Todo/highlight_overdue"); + + todo_item_dstatus_highlight_due_today = gnome_config_get_bool("/calendar/Todo/highlight_due_today"); + + todo_item_dstatus_highlight_not_due_yet = gnome_config_get_bool("/calendar/Todo/highlight_not_due_yet"); todo_current_sort_column = gnome_config_get_int("/calendar/Todo/sort_column"); @@ -206,29 +214,10 @@ display_objedit_today (GtkWidget *widget, GnomeCalendar *gcal) gtk_widget_show (ee); } -GnomeCalendar * -gnome_calendar_locate (const char *pathname) -{ - GList *l; - - if (pathname == NULL || pathname [0] == 0) - pathname = user_calendar_file; - - for (l = all_calendars; l; l = l->next){ - GnomeCalendar *gcal = l->data; - - if (strcmp (gcal->cal->filename, pathname) == 0){ - return gcal; - } - } - return NULL; -} - static void close_cmd (GtkWidget *widget, GnomeCalendar *gcal) { all_calendars = g_list_remove (all_calendars, gcal); - if (gcal->cal->modified){ if (!gcal->cal->filename) save_calendar_cmd (widget, gcal); @@ -239,10 +228,8 @@ close_cmd (GtkWidget *widget, GnomeCalendar *gcal) gtk_widget_destroy (GTK_WIDGET (gcal)); active_calendars--; - if (active_calendars == 0){ - unregister_calendar_services (); + if (active_calendars == 0) gtk_main_quit (); - } } void @@ -383,14 +370,15 @@ static void save_ok (GtkWidget *widget, GtkFileSelection *fs) { GnomeCalendar *gcal; - gchar *fname; gcal = GNOME_CALENDAR (gtk_object_get_user_data (GTK_OBJECT (fs))); gtk_window_set_wmclass (GTK_WINDOW (gcal), "gnomecal", "gnomecal"); - fname = g_strdup (gtk_file_selection_get_filename (fs)); - calendar_save (gcal->cal, fname); - g_free(fname); + if (gcal->cal->filename) + g_free (gcal->cal->filename); + + gcal->cal->filename = g_strdup (gtk_file_selection_get_filename (fs)); + calendar_save (gcal->cal, gcal->cal->filename); gtk_main_quit (); } @@ -460,6 +448,7 @@ save_calendar_cmd (GtkWidget *widget, void *data) g_free (str); gnome_dialog_set_default (GNOME_DIALOG (box), 1); b = gnome_dialog_run (GNOME_DIALOG (box)); + gtk_object_destroy (GTK_OBJECT (box)); if (b != 0) return; @@ -590,7 +579,7 @@ calendar_close_event (GtkWidget *widget, GdkEvent *event, GnomeCalendar *gcal) return TRUE; } -GnomeCalendar * +static void new_calendar (char *full_name, char *calendar_file, char *geometry, char *page, gboolean hidden) { GtkWidget *toplevel; @@ -598,8 +587,7 @@ new_calendar (char *full_name, char *calendar_file, char *geometry, char *page, int xpos, ypos, width, height; /* i18n: This "%s%s" indicates possession. Languages where the order is - * the inverse should translate it to "%2$s%1$s". - */ + the inverse should translate it to "%2$s%1$s". */ g_snprintf(title, 128, _("%s%s"), full_name, _("'s calendar")); toplevel = gnome_calendar_new (title); @@ -646,8 +634,6 @@ new_calendar (char *full_name, char *calendar_file, char *geometry, char *page, } gtk_widget_show (toplevel); - - return GNOME_CALENDAR (toplevel); } static void @@ -888,23 +874,13 @@ int main(int argc, char *argv[]) { GnomeClient *client; - CORBA_Environment ev; bindtextdomain (PACKAGE, GNOMELOCALEDIR); textdomain (PACKAGE); - CORBA_exception_init (&ev); - - gnome_CORBA_init_with_popt_table ( - "calendar", VERSION, &argc, argv, - options, 0, NULL, GNORBA_INIT_SERVER_FUNC, &ev); + gnome_init_with_popt_table ("calendar", VERSION, argc, argv, + options, 0, NULL); - orb = gnome_CORBA_ORB (); - poa = (PortableServer_POA)CORBA_ORB_resolve_initial_references (orb, "RootPOA", &ev); - if (ev._major == CORBA_NO_EXCEPTION){ - init_corba_server (); - } - if (show_events) dump_events (); if (show_todo) diff --git a/calendar/main.h b/calendar/main.h index 584ce2e83c..ab7b5d87e1 100644 --- a/calendar/main.h +++ b/calendar/main.h @@ -19,7 +19,9 @@ typedef enum { COLOR_PROP_PRELIGHT_DAY_BG, /* Background color for prelighted day */ COLOR_PROP_DAY_FG, /* Color for day numbers */ COLOR_PROP_CURRENT_DAY_FG, /* Color for current day's number */ - COLOR_PROP_OVERDUE_TODO, + COLOR_PROP_TODO_NOT_DUE_YET, /* Color for Todo items not yet due */ + COLOR_PROP_TODO_DUE_TODAY, /* Color for Todo items due today */ + COLOR_PROP_TODO_OVERDUE, /* Color for Todo items that are overdue */ COLOR_PROP_LAST /* Number of color properties */ } ColorProp; @@ -36,10 +38,14 @@ extern struct color_prop color_props[]; /* todo preferences */ extern int todo_show_due_date; -extern int todo_due_date_overdue_highlight; + +extern int todo_item_dstatus_highlight_overdue; +extern int todo_item_dstatus_highlight_due_today; +extern int todo_item_dstatus_highlight_not_due_yet; + +extern int todo_show_time_remaining; extern int todo_show_priority; extern char *todo_overdue_font_text; -extern struct color_prop todo_overdue_highlight_color; extern gboolean todo_style_changed; extern gint todo_current_sort_column; extern gint todo_current_sort_type; @@ -75,7 +81,4 @@ char *color_spec_from_prop (ColorProp propnum); void save_default_calendar (GnomeCalendar *gcal); -GnomeCalendar *new_calendar (char *full_name, char *calendar_file, - char *geometry, char *page, gboolean hidden); - #endif diff --git a/calendar/month-view.c b/calendar/month-view.c index 5df7b7a23d..d227e6a4f3 100644 --- a/calendar/month-view.c +++ b/calendar/month-view.c @@ -477,8 +477,7 @@ month_view_init (MonthView *mv) "clip", TRUE, NULL); } - gnome_canvas_points_free (points); - + mv->old_current_index = -1; } diff --git a/calendar/pcs/calobj.c b/calendar/pcs/calobj.c index 806c27d8ff..0b1980e7ba 100644 --- a/calendar/pcs/calobj.c +++ b/calendar/pcs/calobj.c @@ -52,9 +52,6 @@ ical_object_new (void) ico->seq = -1; ico->dtstamp = time (NULL); ico->uid = ical_gen_uid (); - - ico->pilot_id = 0; - ico->pilot_status = ICAL_PILOT_SYNC_MOD; return ico; } @@ -380,8 +377,6 @@ load_recur_yearly_day (iCalObject *o, char **str) { /* Skip as we do not support multiple days and we do expect * the dtstart to agree with the value on this field - * - * FIXME: we should support every-n-years */ skip_numbers (str); } @@ -595,10 +590,8 @@ ical_object_create_from_vobject (VObject *o, const char *object_name) if (has (o, VCUniqueStringProp)){ ical->uid = g_strdup (str_val (vo)); free (the_str); - } else { - ical->uid = ical_gen_uid (); } - + /* seq */ if (has (o, VCSequenceProp)){ ical->seq = atoi (str_val (vo)); @@ -792,22 +785,6 @@ ical_object_create_from_vobject (VObject *o, const char *object_name) } free (the_str); } - - /* - * Pilot - */ - if (has (o, XPilotIdProp)){ - ical->pilot_id = atoi (str_val (vo)); - free (the_str); - } else - ical->pilot_id = 0; - - if (has (o, XPilotStatusProp)){ - ical->pilot_status = atoi (str_val (vo)); - free (the_str); - } else - ical->pilot_status = ICAL_PILOT_SYNC_MOD; - return ical; } @@ -1073,17 +1050,6 @@ ical_object_to_vobject (iCalObject *ical) addPropValue (alarm, VCProcedureNameProp, ical->palarm.data); if ((alarm = save_alarm (o, &ical->malarm, ical))) addPropValue (alarm, VCEmailAddressProp, ical->malarm.data); - - /* Pilot */ - { - char buffer [20]; - - sprintf (buffer, "%d", ical->pilot_id); - addPropValue (o, XPilotIdProp, buffer); - sprintf (buffer, "%d", ical->pilot_status); - addPropValue (o, XPilotStatusProp, buffer); - } - return o; } @@ -1463,33 +1429,3 @@ alarm_compute_offset (CalendarAlarm *a) } return a->offset; } - -iCalObject * -ical_object_new_from_string (const char *vcal_string) -{ - iCalObject *ical = NULL; - VObject *cal, *event; - VObjectIterator i; - const char *object_name; - - cal = Parse_MIME (vcal_string, strlen (vcal_string)); - - initPropIterator (&i, cal); - - while (moreIteration (&i)){ - event = nextVObject (&i); - - object_name = vObjectName (event); - - if (strcmp (object_name, VCEventProp) == 0){ - ical = ical_object_create_from_vobject (event, object_name); - break; - } - } - - cleanVObject (cal); - cleanStrTbl (); - - return ical; -} - diff --git a/calendar/prop.c b/calendar/prop.c index 129407293b..bef7a37ba6 100644 --- a/calendar/prop.c +++ b/calendar/prop.c @@ -44,7 +44,13 @@ static GnomeCanvasItem *month_item; /* Widgets for the todo page */ static GtkWidget *due_date_show_button; -static GtkWidget *due_date_overdue_highlight; + +static GtkWidget *todo_item_time_remaining_show_button; + +static GtkWidget *todo_item_highlight_overdue; +static GtkWidget *todo_item_highlight_not_due_yet; +static GtkWidget *todo_item_highlight_due_today; + static GtkWidget *priority_show_button; /* Callback used when the property box is closed -- just sets the prop_win variable to null. */ @@ -116,13 +122,24 @@ static void prop_apply_todo(void) { todo_show_due_date = GTK_TOGGLE_BUTTON (due_date_show_button)->active; - todo_due_date_overdue_highlight = GTK_TOGGLE_BUTTON (due_date_overdue_highlight)->active; + + todo_item_dstatus_highlight_overdue = GTK_TOGGLE_BUTTON(todo_item_highlight_overdue)->active; + todo_item_dstatus_highlight_not_due_yet = GTK_TOGGLE_BUTTON(todo_item_highlight_not_due_yet)->active; + todo_item_dstatus_highlight_due_today = GTK_TOGGLE_BUTTON(todo_item_highlight_due_today)->active; todo_show_priority = GTK_TOGGLE_BUTTON (priority_show_button)->active; + todo_show_time_remaining = GTK_TOGGLE_BUTTON (todo_item_time_remaining_show_button)->active; + /* storing the values */ + + gnome_config_set_bool("/calendar/Todo/show_time_remain", todo_show_time_remaining); + gnome_config_set_bool("/calendar/Todo/highlight_overdue", todo_item_dstatus_highlight_overdue); + + gnome_config_set_bool("/calendar/Todo/highlight_due_today", todo_item_dstatus_highlight_due_today); + + gnome_config_set_bool("/calendar/Todo/highlight_not_due_yet", todo_item_dstatus_highlight_not_due_yet); gnome_config_set_bool("/calendar/Todo/show_due_date", todo_show_due_date); - gnome_config_set_bool("/calendar/Todo/highlight_overdue_tasks", todo_due_date_overdue_highlight); gnome_config_set_bool("/calendar/Todo/show_priority", todo_show_priority); /* need to sync our config changes. */ gnome_config_sync (); @@ -475,7 +492,7 @@ create_colors_page (void) GtkWidget *w; int i; - frame = gtk_frame_new (_("Colors for months")); + frame = gtk_frame_new (_("Colors for display")); gtk_container_set_border_width (GTK_CONTAINER (frame), GNOME_PAD_SMALL); gnome_property_box_append_page (GNOME_PROPERTY_BOX (prop_win), frame, gtk_label_new (_("Colors"))); @@ -536,15 +553,8 @@ create_colors_page (void) static void set_todo_page_options(void) { - if(!GTK_TOGGLE_BUTTON (due_date_show_button)->active) { - /* disable everything */ - gtk_widget_set_sensitive(due_date_overdue_highlight,0); - } - else - { - gtk_widget_set_sensitive(due_date_overdue_highlight,1); - } - + + while (gtk_events_pending ()) gtk_main_iteration (); } @@ -562,22 +572,30 @@ build_list_options_frame(void) { GtkWidget *frame; GtkWidget *vbox; - frame = gtk_frame_new (_("Show on TODO List:")); + frame = gtk_frame_new (_("Show on To Do List:")); vbox = gtk_vbox_new (FALSE, 0); gtk_container_add (GTK_CONTAINER (frame), vbox); - due_date_show_button = gtk_check_button_new_with_label (_("Summary")); due_date_show_button = gtk_check_button_new_with_label (_("Due Date")); priority_show_button = gtk_check_button_new_with_label (_("Priority")); - + todo_item_time_remaining_show_button = gtk_check_button_new_with_label (_("Time Until Due")); + gtk_toggle_button_set_state (GTK_TOGGLE_BUTTON(due_date_show_button), todo_show_due_date); gtk_signal_connect (GTK_OBJECT(due_date_show_button), "clicked", (GtkSignalFunc) todo_option_set, NULL); gtk_box_pack_start (GTK_BOX (vbox), due_date_show_button, FALSE, FALSE, 0); - + + gtk_toggle_button_set_state (GTK_TOGGLE_BUTTON(todo_item_time_remaining_show_button), todo_show_time_remaining); + gtk_signal_connect (GTK_OBJECT(todo_item_time_remaining_show_button), + "clicked", + (GtkSignalFunc) todo_option_set, + NULL); + gtk_box_pack_start (GTK_BOX (vbox), todo_item_time_remaining_show_button, FALSE, FALSE, 0); + + gtk_toggle_button_set_state (GTK_TOGGLE_BUTTON(priority_show_button), todo_show_priority); gtk_signal_connect (GTK_OBJECT(priority_show_button), "clicked", @@ -597,14 +615,32 @@ build_style_list_options_frame(void) vbox = gtk_vbox_new (FALSE, 0); gtk_container_add (GTK_CONTAINER (frame), vbox); - due_date_overdue_highlight = gtk_check_button_new_with_label (_("Highlight overdue items")); - - gtk_toggle_button_set_state (GTK_TOGGLE_BUTTON(due_date_overdue_highlight), todo_due_date_overdue_highlight); - gtk_signal_connect (GTK_OBJECT(due_date_overdue_highlight), + todo_item_highlight_overdue = gtk_check_button_new_with_label (_("Highlight overdue items")); + gtk_toggle_button_set_state (GTK_TOGGLE_BUTTON(todo_item_highlight_overdue), + todo_item_dstatus_highlight_overdue); + todo_item_highlight_not_due_yet = gtk_check_button_new_with_label (_("Highlight not yet due items")); + gtk_toggle_button_set_state (GTK_TOGGLE_BUTTON(todo_item_highlight_not_due_yet), + todo_item_dstatus_highlight_overdue); + todo_item_highlight_due_today = gtk_check_button_new_with_label (_("Highlight items due today")); + gtk_toggle_button_set_state (GTK_TOGGLE_BUTTON(todo_item_highlight_due_today), + todo_item_dstatus_highlight_overdue); + + gtk_signal_connect (GTK_OBJECT(todo_item_highlight_overdue), "clicked", (GtkSignalFunc) todo_option_set, NULL); - gtk_box_pack_start (GTK_BOX (vbox), due_date_overdue_highlight, FALSE, FALSE, 0); + gtk_signal_connect (GTK_OBJECT(todo_item_highlight_not_due_yet), + "clicked", + (GtkSignalFunc) todo_option_set, + NULL); + gtk_signal_connect (GTK_OBJECT(todo_item_highlight_due_today), + "clicked", + (GtkSignalFunc) todo_option_set, + NULL); + + gtk_box_pack_start (GTK_BOX (vbox), todo_item_highlight_overdue, FALSE, FALSE, 0); + gtk_box_pack_start (GTK_BOX (vbox), todo_item_highlight_due_today, FALSE, FALSE, 0); + gtk_box_pack_start (GTK_BOX (vbox), todo_item_highlight_not_due_yet, FALSE, FALSE, 0); return frame; } static void diff --git a/calendar/timeutil.c b/calendar/timeutil.c index 7ddc0e04d4..e6b54b19e1 100644 --- a/calendar/timeutil.c +++ b/calendar/timeutil.c @@ -40,7 +40,6 @@ time_from_isodate (char *str) t -= timezone #endif ; - return t; } @@ -91,11 +90,11 @@ format_simple_hour (int hour, int use_am_pm) */ if (use_am_pm) - g_snprintf (buf, sizeof(buf), "%d%s", + sprintf (buf, "%d%s", (hour == 0) ? 12 : (hour > 12) ? (hour - 12) : hour, (hour < 12) ? _("am") : _("pm")); else - g_snprintf (buf, sizeof(buf), "%02d%s", hour, _("h")); + sprintf (buf, "%02d%s", hour, _("h")); return buf; diff --git a/libversit/port.h b/libversit/port.h index 1768beebd8..63a4021334 100644 --- a/libversit/port.h +++ b/libversit/port.h @@ -43,16 +43,18 @@ DFARS 252.227-7013 or 48 CFR 52.227-19, as applicable. #if defined(__CPLUSPLUS__) || defined(__cplusplus) extern "C" { #endif - -/* some of these #defines are commented out because */ -/* Visual C++ sets them on the compiler command line instead */ -/* #define _DEBUG */ -/* #define WIN32 */ -/* #define WIN16 */ -/* #define _WINDOWS */ -/* #define __MWERKS__ */ -/* #define INCLUDEMFC */ +#if 0 + some of these #defines are commented out because + Visual C++ sets them on the compiler command line instead + +#define _DEBUG +#define WIN32 +#define WIN16 +#define _WINDOWS +#define __MWERKS__ +#define INCLUDEMFC +#endif #define vCardClipboardFormat "+//ISBN 1-887687-00-9::versit::PDI//vCard" #define vCalendarClipboardFormat "+//ISBN 1-887687-00-9::versit::PDI//vCalendar" @@ -85,4 +87,4 @@ For example: } #endif -#endif /* __PORT_H__ */ +#endif // __PORT_H__ diff --git a/libversit/vcc.c b/libversit/vcc.c index 1caadc3cb4..3c54822138 100644 --- a/libversit/vcc.c +++ b/libversit/vcc.c @@ -1,28 +1,28 @@ /* A Bison parser, made from vcc.y - by GNU Bison version 1.25 + by GNU Bison version 1.27 */ #define YYBISON 1 /* Identify Bison output. */ -#define EQ 258 -#define COLON 259 -#define DOT 260 -#define SEMICOLON 261 -#define SPACE 262 -#define HTAB 263 -#define LINESEP 264 -#define NEWLINE 265 -#define BEGIN_VCARD 266 -#define END_VCARD 267 -#define BEGIN_VCAL 268 -#define END_VCAL 269 -#define BEGIN_VEVENT 270 -#define END_VEVENT 271 -#define BEGIN_VTODO 272 -#define END_VTODO 273 -#define ID 274 -#define STRING 275 +#define EQ 257 +#define COLON 258 +#define DOT 259 +#define SEMICOLON 260 +#define SPACE 261 +#define HTAB 262 +#define LINESEP 263 +#define NEWLINE 264 +#define BEGIN_VCARD 265 +#define END_VCARD 266 +#define BEGIN_VCAL 267 +#define END_VCAL 268 +#define BEGIN_VEVENT 269 +#define END_VEVENT 270 +#define BEGIN_VTODO 271 +#define END_VTODO 272 +#define ID 273 +#define STRING 274 #line 1 "vcc.y" @@ -217,7 +217,7 @@ typedef union { #define YYFLAG -32768 #define YYNTBASE 21 -#define YYTRANSLATE(x) ((unsigned)(x) <= 275 ? yytranslate[x] : 51) +#define YYTRANSLATE(x) ((unsigned)(x) <= 274 ? yytranslate[x] : 51) static const char yytranslate[] = { 0, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, @@ -245,9 +245,9 @@ static const char yytranslate[] = { 0, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, - 2, 2, 2, 2, 2, 1, 2, 3, 4, 5, - 6, 7, 8, 9, 10, 11, 12, 13, 14, 15, - 16, 17, 18, 19, 20 + 2, 2, 2, 2, 2, 1, 3, 4, 5, 6, + 7, 8, 9, 10, 11, 12, 13, 14, 15, 16, + 17, 18, 19, 20 }; #if YYDEBUG != 0 @@ -369,7 +369,8 @@ static const short yycheck[] = { 7, 41, 11, 57, 23 }; /* -*-C-*- Note some compilers choke on comments on `#line' lines. */ -#line 3 "/usr/share/misc/bison.simple" +#line 3 "/usr/lib/bison.simple" +/* This file comes from bison-1.27. */ /* Skeleton output parser for bison, Copyright (C) 1984, 1989, 1990 Free Software Foundation, Inc. @@ -386,46 +387,66 @@ static const short yycheck[] = { 7, You should have received a copy of the GNU General Public License along with this program; if not, write to the Free Software - Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. */ + Foundation, Inc., 59 Temple Place - Suite 330, + Boston, MA 02111-1307, USA. */ /* As a special exception, when this file is copied by Bison into a Bison output file, you may use that output file without restriction. This special exception was added by the Free Software Foundation in version 1.24 of Bison. */ -#ifndef alloca +/* This is the parser code that is written into each bison parser + when the %semantic_parser declaration is not specified in the grammar. + It was written by Richard Stallman by simplifying the hairy parser + used when %semantic_parser is specified. */ + +#ifndef YYSTACK_USE_ALLOCA +#ifdef alloca +#define YYSTACK_USE_ALLOCA +#else /* alloca not defined */ #ifdef __GNUC__ +#define YYSTACK_USE_ALLOCA #define alloca __builtin_alloca #else /* not GNU C. */ -#if (!defined (__STDC__) && defined (sparc)) || defined (__sparc__) || defined (__sparc) || defined (__sgi) +#if (!defined (__STDC__) && defined (sparc)) || defined (__sparc__) || defined (__sparc) || defined (__sgi) || (defined (__sun) && defined (__i386)) +#define YYSTACK_USE_ALLOCA #include <alloca.h> #else /* not sparc */ -#if defined (MSDOS) && !defined (__TURBOC__) +/* We think this test detects Watcom and Microsoft C. */ +/* This used to test MSDOS, but that is a bad idea + since that symbol is in the user namespace. */ +#if (defined (_MSDOS) || defined (_MSDOS_)) && !defined (__TURBOC__) +#if 0 /* No need for malloc.h, which pollutes the namespace; + instead, just don't use alloca. */ #include <malloc.h> +#endif #else /* not MSDOS, or __TURBOC__ */ #if defined(_AIX) -#include <malloc.h> +/* I don't know what this was needed for, but it pollutes the namespace. + So I turned it off. rms, 2 May 1997. */ +/* #include <malloc.h> */ #pragma alloca -#else /* not MSDOS, __TURBOC__, or _AIX */ -#ifdef __hpux -#ifdef __cplusplus -extern "C" { -void *alloca (unsigned int); -}; -#else /* not __cplusplus */ -void *alloca (); -#endif /* not __cplusplus */ +#define YYSTACK_USE_ALLOCA +#else /* not MSDOS, or __TURBOC__, or _AIX */ +#if 0 +#ifdef __hpux /* haible@ilog.fr says this works for HPUX 9.05 and up, + and on HPUX 10. Eventually we can turn this on. */ +#define YYSTACK_USE_ALLOCA +#define alloca __builtin_alloca #endif /* __hpux */ +#endif #endif /* not _AIX */ #endif /* not MSDOS, or __TURBOC__ */ -#endif /* not sparc. */ -#endif /* not GNU C. */ -#endif /* alloca not defined. */ +#endif /* not sparc */ +#endif /* not GNU C */ +#endif /* alloca not defined */ +#endif /* YYSTACK_USE_ALLOCA not defined */ -/* This is the parser code that is written into each bison parser - when the %semantic_parser declaration is not specified in the grammar. - It was written by Richard Stallman by simplifying the hairy parser - used when %semantic_parser is specified. */ +#ifdef YYSTACK_USE_ALLOCA +#define YYSTACK_ALLOC alloca +#else +#define YYSTACK_ALLOC malloc +#endif /* Note: there must be only one dollar sign in this file. It is replaced by the list of actions, each action @@ -435,8 +456,8 @@ void *alloca (); #define yyclearin (yychar = YYEMPTY) #define YYEMPTY -2 #define YYEOF 0 -#define YYACCEPT return(0) -#define YYABORT return(1) +#define YYACCEPT goto yyacceptlab +#define YYABORT goto yyabortlab #define YYERROR goto yyerrlab1 /* Like YYERROR except do call yyerror. This remains here temporarily to ease the @@ -517,12 +538,12 @@ int yydebug; /* nonzero means print parse trace */ #ifndef YYMAXDEPTH #define YYMAXDEPTH 10000 #endif - -/* Prevent warning if -Wstrict-prototypes. */ -#ifdef __GNUC__ -int yyparse (void); -#endif +/* Define __yy_memcpy. Note that the size argument + should be passed with type unsigned int, because that is what the non-GCC + definitions require. With GCC, __builtin_memcpy takes an arg + of type size_t, but it can handle unsigned int. */ + #if __GNUC__ > 1 /* GNU C and GNU C++ define this. */ #define __yy_memcpy(TO,FROM,COUNT) __builtin_memcpy(TO,FROM,COUNT) #else /* not GNU C or C++ */ @@ -534,7 +555,7 @@ static void __yy_memcpy (to, from, count) char *to; char *from; - int count; + unsigned int count; { register char *f = from; register char *t = to; @@ -549,10 +570,10 @@ __yy_memcpy (to, from, count) /* This is the most reliable way to avoid incompatibilities in available built-in functions on various systems. */ static void -__yy_memcpy (char *to, char *from, int count) +__yy_memcpy (char *to, char *from, unsigned int count) { - register char *f = from; register char *t = to; + register char *f = from; register int i = count; while (i-- > 0) @@ -562,7 +583,7 @@ __yy_memcpy (char *to, char *from, int count) #endif #endif -#line 196 "/usr/share/misc/bison.simple" +#line 216 "/usr/lib/bison.simple" /* The user can define YYPARSE_PARAM as the name of an argument to be passed into yyparse. The argument should have type void *. @@ -583,6 +604,15 @@ __yy_memcpy (char *to, char *from, int count) #define YYPARSE_PARAM_DECL #endif /* not YYPARSE_PARAM */ +/* Prevent warning if -Wstrict-prototypes. */ +#ifdef __GNUC__ +#ifdef YYPARSE_PARAM +int yyparse (void *); +#else +int yyparse (void); +#endif +#endif + int yyparse(YYPARSE_PARAM_ARG) YYPARSE_PARAM_DECL @@ -611,6 +641,7 @@ yyparse(YYPARSE_PARAM_ARG) #endif int yystacksize = YYINITDEPTH; + int yyfree_stacks = 0; #ifdef YYPURE int yychar; @@ -695,18 +726,32 @@ yynewstate: if (yystacksize >= YYMAXDEPTH) { yyerror("parser stack overflow"); + if (yyfree_stacks) + { + free (yyss); + free (yyvs); +#ifdef YYLSP_NEEDED + free (yyls); +#endif + } return 2; } yystacksize *= 2; if (yystacksize > YYMAXDEPTH) yystacksize = YYMAXDEPTH; - yyss = (short *) alloca (yystacksize * sizeof (*yyssp)); - __yy_memcpy ((char *)yyss, (char *)yyss1, size * sizeof (*yyssp)); - yyvs = (YYSTYPE *) alloca (yystacksize * sizeof (*yyvsp)); - __yy_memcpy ((char *)yyvs, (char *)yyvs1, size * sizeof (*yyvsp)); +#ifndef YYSTACK_USE_ALLOCA + yyfree_stacks = 1; +#endif + yyss = (short *) YYSTACK_ALLOC (yystacksize * sizeof (*yyssp)); + __yy_memcpy ((char *)yyss, (char *)yyss1, + size * (unsigned int) sizeof (*yyssp)); + yyvs = (YYSTYPE *) YYSTACK_ALLOC (yystacksize * sizeof (*yyvsp)); + __yy_memcpy ((char *)yyvs, (char *)yyvs1, + size * (unsigned int) sizeof (*yyvsp)); #ifdef YYLSP_NEEDED - yyls = (YYLTYPE *) alloca (yystacksize * sizeof (*yylsp)); - __yy_memcpy ((char *)yyls, (char *)yyls1, size * sizeof (*yylsp)); + yyls = (YYLTYPE *) YYSTACK_ALLOC (yystacksize * sizeof (*yylsp)); + __yy_memcpy ((char *)yyls, (char *)yyls1, + size * (unsigned int) sizeof (*yylsp)); #endif #endif /* no yyoverflow */ @@ -1027,7 +1072,7 @@ case 46: break;} } /* the action file gets copied in in place of this dollarsign */ -#line 498 "/usr/share/misc/bison.simple" +#line 542 "/usr/lib/bison.simple" yyvsp -= yylen; yyssp -= yylen; @@ -1222,6 +1267,30 @@ yyerrhandle: yystate = yyn; goto yynewstate; + + yyacceptlab: + /* YYACCEPT comes here. */ + if (yyfree_stacks) + { + free (yyss); + free (yyvs); +#ifdef YYLSP_NEEDED + free (yyls); +#endif + } + return 0; + + yyabortlab: + /* YYABORT comes here. */ + if (yyfree_stacks) + { + free (yyss); + free (yyvs); +#ifdef YYLSP_NEEDED + free (yyls); +#endif + } + return 1; } #line 373 "vcc.y" @@ -1645,7 +1714,7 @@ void initLex(const char *inputstring, unsigned long inputlen, CFile *inputfile) void initLex(const char *inputstring, unsigned long inputlen, FILE *inputfile) #endif { - /* initialize lex mode stack */ + /* initialize lex mode stack */ lexBuf.lexModeStack[lexBuf.lexModeStackTop=0] = L_NORMAL; /* iniatialize lex buffer. */ diff --git a/libversit/vcc.y b/libversit/vcc.y index 9b4acda386..a187560e70 100644 --- a/libversit/vcc.y +++ b/libversit/vcc.y @@ -117,7 +117,7 @@ DFARS 252.227-7013 or 48 CFR 52.227-19, as applicable. /**** Types, Constants ****/ -#define YYDEBUG 1 /* 1 to compile in some debugging code */ +#define YYDEBUG 0 /* 1 to compile in some debugging code */ #define MAXTOKEN 256 /* maximum token (line) length */ #define YYSTACKSIZE 50 /* ~unref ? */ #define MAXLEVEL 10 /* max # of nested objects parseable */ @@ -296,7 +296,8 @@ values: value SEMICOLON { enterValues($1); } values ; value: STRING - | { $$ = 0; } + | + { $$ = 0; } ; vcal: @@ -790,7 +791,7 @@ void initLex(const char *inputstring, unsigned long inputlen, CFile *inputfile) void initLex(const char *inputstring, unsigned long inputlen, FILE *inputfile) #endif { - /* initialize lex mode stack */ + /* initialize lex mode stack */ lexBuf.lexModeStack[lexBuf.lexModeStackTop=0] = L_NORMAL; /* iniatialize lex buffer. */ @@ -1006,9 +1007,7 @@ static int yylex() { if (c == ';') { DBG_(("db: SEMICOLON\n")); lexPushLookaheadc(c); -#ifdef _SUPPORT_LINE_FOLDING handleMoreRFC822LineBreak(c); -#endif lexSkipLookahead(); return SEMICOLON; } @@ -1059,12 +1058,12 @@ static int yylex() { case ':': { /* consume all line separator(s) adjacent to each other */ /* ignoring linesep immediately after colon. */ -/* c = lexLookahead(); + c = lexLookahead(); while (strchr("\n",c)) { lexSkipLookahead(); c = lexLookahead(); ++mime_lineNum; - }*/ + } DBG_(("db: COLON\n")); return COLON; } diff --git a/macros/ChangeLog b/macros/ChangeLog index 572ba694eb..8f978ebc58 100644 --- a/macros/ChangeLog +++ b/macros/ChangeLog @@ -1,54 +1,3 @@ -1999-10-21 Jacob Berkman <jberkman@andrew.cmu.edu> - - * gnome-ghttp-check.m4: use a temp value until we know that - ghttp exists. This will hopefully fix building on Solaris - machines - -1999-09-26 Jody Goldberg <jgoldberg@home.com> - - * compiler-flags.m4 : Remove -Wpointer-arith. It generates large - numbers of warnings under glibc2.1.2 with a recent egcs release. - The glibc maintainers have suggested removing this flag because it - is useless. - -1999-09-01 Havoc Pennington <hp@pobox.com> - - * gnome-xml-check.m4: If you're going to AC_PATH_PROG then use the - prog you find :-) - -1999-08-02 Peter Teichman <pat4@acpub.duke.edu> - - * removed gnome-conduit-check.m4 - it should be distributed with - gnome-pilot - -1999-07-30 Peter Teichman <pat4@acpub.duke.edu> - - * gnome-conduit-check.m4: added new file of checks. anything that - provides a pilot conduit is going to want this - -1999-07-07 Tuomas J. Lukka <lukka@iki.fi> - * gnome-x-checks.m4: add a comment on how to get gtk-1.3 and - glib 1.3 from CVS - -1999-07-06 Tuomas J. Lukka <lukka@iki.fi> - - * gnome-x-checks.m4: forbid compiling with Gtk-1.3 for now. - gnome only works with 1.2 so far. - -1999-07-05 Raja R Harinath <harinath@cs.umn.edu> - - * gnome.m4: Make "extra library" message slightly easier to read. - -Sat Jun 26 01:47:53 1999 Tim Janik <timj@gtk.org> - - * compiler-flags.m4: give -Wunused to gcc instead of -Wno-unused. - -1999-06-11 Tuomas J. Lukka <lukka@iki.fi> - - * gnome-guile-checks.m4: Debian has qt_null in -lqthreads but - no main. Changed both checks for 'main' to qt_null. - I hope this is correct - it shouldn't break anything. - 1999-05-11 Raja R Harinath <harinath@cs.umn.edu> * Makefile.am (MACROS): Add `gnome-bonobo-check.m4'. diff --git a/widgets/misc/e-colors.c b/widgets/misc/e-colors.c deleted file mode 100644 index 3f1de73784..0000000000 --- a/widgets/misc/e-colors.c +++ /dev/null @@ -1,73 +0,0 @@ -/* - * color.c: Color allocation on the Gnumeric spreadsheet - * - * Author: - * Miguel de Icaza (miguel@kernel.org) - * - * We keep our own color context, as the color allocation might take place - * before any of our Canvases are realized. - */ -#include <config.h> -#include <gnome.h> -#include "color.h" - -static int color_inited; -static GdkColorContext *gnumeric_color_context; - -/* Public colors: shared by all of our items in Gnumeric */ -GdkColor gs_white, gs_black, gs_light_gray, gs_dark_gray, gs_red; - -int -color_alloc (gushort red, gushort green, gushort blue) -{ - int failed; - - if (!color_inited) - color_init (); - - return gdk_color_context_get_pixel (gnumeric_color_context, - red, green, blue, &failed); -} - -void -color_alloc_gdk (GdkColor *c) -{ - int failed; - - g_return_if_fail (c != NULL); - - c->pixel = gdk_color_context_get_pixel (gnumeric_color_context, c->red, c->green, c->blue, &failed); -} - -void -color_alloc_name (const char *name, GdkColor *c) -{ - int failed; - - g_return_if_fail (name != NULL); - g_return_if_fail (c != NULL); - - gdk_color_parse (name, c); - c->pixel = 0; - c->pixel = gdk_color_context_get_pixel (gnumeric_color_context, c->red, c->green, c->blue, &failed); -} - -void -color_init (void) -{ - GdkColormap *colormap = gtk_widget_get_default_colormap (); - - /* Initialize the color context */ - gnumeric_color_context = gdk_color_context_new ( - gtk_widget_get_default_visual (), colormap); - - /* Allocate the default colors */ - gdk_color_white (colormap, &gs_white); - gdk_color_black (colormap, &gs_black); - - color_alloc_name ("gray78", &gs_light_gray); - color_alloc_name ("gray20", &gs_dark_gray); - color_alloc_name ("red", &gs_red); - - color_inited = 1; -} diff --git a/widgets/misc/e-colors.h b/widgets/misc/e-colors.h deleted file mode 100644 index b2755a5c6a..0000000000 --- a/widgets/misc/e-colors.h +++ /dev/null @@ -1,14 +0,0 @@ -#ifndef GNUMERIC_COLOR_H -#define GNUMERIC_COLOR_H - -void color_init (void); - -/* Return the pixel value for the given red, green and blue */ -int color_alloc (gushort red, gushort green, gushort blue); -void color_alloc_name (const char *name, GdkColor *color); -void color_alloc_gdk (GdkColor *color); - -/* Colors used by any GnumericSheet item */ -extern GdkColor gs_white, gs_light_gray, gs_dark_gray, gs_black, gs_red; - -#endif /* GNUMERIC_COLOR_H */ diff --git a/widgets/misc/e-cursors.c b/widgets/misc/e-cursors.c deleted file mode 100644 index b94c54bc73..0000000000 --- a/widgets/misc/e-cursors.c +++ /dev/null @@ -1,41 +0,0 @@ -#ifndef GNUMERIC_CURSORS_H -#define GNUMERIC_CURSORS_H - -typedef struct { - GdkCursor *cursor; - int hot_x, hot_y; - char **xpm; -} GnumericCursorDef; - -#define GNUMERIC_CURSOR_FAT_CROSS 0 -#define GNUMERIC_CURSOR_THIN_CROSS 1 -#define GNUMERIC_CURSOR_ARROW 2 -#define GNUMERIC_CURSOR_MOVE 3 -#define GNUMERIC_CURSOR_ZOOM_IN 4 -#define GNUMERIC_CURSOR_ZOOM_OUT 5 -#define GNUMERIC_CURSOR_SIZE_X 6 -#define GNUMERIC_CURSOR_SIZE_Y 7 -#define GNUMERIC_CURSOR_SIZE_TL 8 -#define GNUMERIC_CURSOR_SIZE_TR 9 -#define GNUMERIC_CURSOR_PRESS 10 - -extern GnumericCursorDef gnumeric_cursors []; - -void cursors_init (void); -void cursors_shutdown (void); - -#define cursor_set(win,c) \ -G_STMT_START { \ - if (win) \ - gdk_window_set_cursor (win, gnumeric_cursors [c].cursor); \ -} G_STMT_END - -#define cursor_set_widget(w,c) \ -G_STMT_START { \ - if (GTK_WIDGET (w)->window) \ - gdk_window_set_cursor (GTK_WIDGET (w)->window, gnumeric_cursors [c].cursor); \ -} G_STMT_END - - -#endif /* GNUMERIC_CURSORS_H */ - diff --git a/widgets/misc/e-cursors.h b/widgets/misc/e-cursors.h deleted file mode 100644 index b94c54bc73..0000000000 --- a/widgets/misc/e-cursors.h +++ /dev/null @@ -1,41 +0,0 @@ -#ifndef GNUMERIC_CURSORS_H -#define GNUMERIC_CURSORS_H - -typedef struct { - GdkCursor *cursor; - int hot_x, hot_y; - char **xpm; -} GnumericCursorDef; - -#define GNUMERIC_CURSOR_FAT_CROSS 0 -#define GNUMERIC_CURSOR_THIN_CROSS 1 -#define GNUMERIC_CURSOR_ARROW 2 -#define GNUMERIC_CURSOR_MOVE 3 -#define GNUMERIC_CURSOR_ZOOM_IN 4 -#define GNUMERIC_CURSOR_ZOOM_OUT 5 -#define GNUMERIC_CURSOR_SIZE_X 6 -#define GNUMERIC_CURSOR_SIZE_Y 7 -#define GNUMERIC_CURSOR_SIZE_TL 8 -#define GNUMERIC_CURSOR_SIZE_TR 9 -#define GNUMERIC_CURSOR_PRESS 10 - -extern GnumericCursorDef gnumeric_cursors []; - -void cursors_init (void); -void cursors_shutdown (void); - -#define cursor_set(win,c) \ -G_STMT_START { \ - if (win) \ - gdk_window_set_cursor (win, gnumeric_cursors [c].cursor); \ -} G_STMT_END - -#define cursor_set_widget(w,c) \ -G_STMT_START { \ - if (GTK_WIDGET (w)->window) \ - gdk_window_set_cursor (GTK_WIDGET (w)->window, gnumeric_cursors [c].cursor); \ -} G_STMT_END - - -#endif /* GNUMERIC_CURSORS_H */ - diff --git a/widgets/misc/pixmaps/cursor_cross.xpm b/widgets/misc/pixmaps/cursor_cross.xpm deleted file mode 100644 index f00e57f78c..0000000000 --- a/widgets/misc/pixmaps/cursor_cross.xpm +++ /dev/null @@ -1,38 +0,0 @@ -/* XPM */ -static char * cursor_cross_xpm[] = { -"32 32 3 1", -" c None", -". c #000000", -"+ c #FFFFFF", -" ", -" ", -" ", -" ", -" ", -" ", -" ", -" ....... ", -" .+++++.. ", -" .+++++.. ", -" .+++++.. ", -" .+++++.. ", -" ......+++++...... ", -" .+++++++++++++++.. ", -" .+++++++++++++++.. ", -" .+++++++++++++++.. ", -" .+++++++++++++++.. ", -" .+++++++++++++++.. ", -" ......+++++....... ", -" .+++++....... ", -" .+++++.. ", -" .+++++.. ", -" .+++++.. ", -" ........ ", -" ....... ", -" ", -" ", -" ", -" ", -" ", -" ", -" "}; diff --git a/widgets/misc/pixmaps/cursor_zoom_in.xpm b/widgets/misc/pixmaps/cursor_zoom_in.xpm deleted file mode 100644 index 1caf9e3e2a..0000000000 --- a/widgets/misc/pixmaps/cursor_zoom_in.xpm +++ /dev/null @@ -1,37 +0,0 @@ -/* XPM */ -static char * cursor_zoom_in_xpm[] = { -"32 32 2 1", -" c None", -". c #000000", -" ", -" ", -" ", -" ", -" ", -" ", -" ...... ", -" .. .. ", -" .. .. ", -" . . ", -" . ... . ", -" . ... . ", -" . ....... . ", -" . ....... . ", -" . ... . ", -" . ... .. ", -" .. . . ", -" .. . . . ", -" ........ . . ", -" ..... . . . ", -" . . . ", -" . . . ", -" . . . ", -" . . . ", -" . . ", -" . . ", -" .. ", -" ", -" ", -" ", -" ", -" "}; diff --git a/widgets/misc/pixmaps/cursor_zoom_out.xpm b/widgets/misc/pixmaps/cursor_zoom_out.xpm deleted file mode 100644 index af1b698521..0000000000 --- a/widgets/misc/pixmaps/cursor_zoom_out.xpm +++ /dev/null @@ -1,37 +0,0 @@ -/* XPM */ -static char * cursor_zoom_out_xpm[] = { -"32 32 2 1", -" c None", -". c #000000", -" ", -" ", -" ", -" ", -" ", -" ", -" ...... ", -" .. .. ", -" .. .. ", -" . . ", -" . . ", -" . . ", -" . ....... . ", -" . ....... . ", -" . . ", -" . .. ", -" .. . . ", -" .. . . . ", -" ........ . . ", -" ..... . . . ", -" . . . ", -" . . . ", -" . . . ", -" . . . ", -" . . ", -" . . ", -" .. ", -" ", -" ", -" ", -" ", -" "}; |