From 0932fd7ec9d21e763371a043283384af8bc987fb Mon Sep 17 00:00:00 2001 From: Federico Mena Quintero Date: Wed, 17 Jan 2001 10:44:33 +0000 Subject: Ximianified email addresses and copyrights. 2001-01-17 Federico Mena Quintero * */*: Ximianified email addresses and copyrights. * idl/evolution-calendar.idl (CalFactory::open): Renamed from ::load(), and added an only_if_exists argument. (CalFactory::create): Removed method. (Listener::OpenStatus): Removed the IN_USE error and replaced it with a NOT_FOUND one; renamed the enum from LoadStatus. (Listener::notifyCalOpened): Renamed from notifyCalLoaded(). * pcs/cal-backend.h (CalBackend): Removed the uri field. (CalBackendOpenStatus): Renamed from CalBackendLoadStatus and added a NOT_FOUND value. (CalBackendClass::open): Put in a slot for the open method. * pcs/cal-backend.c (cal_backend_create): Removed function. * pcs/cal-backend-file.c (cal_backend_file_open): Return the appropriate value when only_if_exists is TRUE. (create_cal): We are Ximian now, so set the PRODID property to the appropriate foo. * pcs/cal-factory.c (CalFactory_open): implemented, replacing CalFactory_load() and CalFactory_create(). (CalFactory_open): Moved the queue_load_create_job() stuff to here, since we now only need to contemplate the open case instead of load/create ones. (open_backend): Do everything here; replaces load_backend() and create_backend(). * cal-client/cal-listener.h (CalListenerClass::cal_opened): Renamed from cal_loaded. (CalListenerClass): Replaced the silly signals, which are gratuitous abstraction, by a set of function pointers in the instance structure. * cal-client/cal-listener.c (cal_listener_get_calendar): Removed unused function. (cal_listener_construct): Added the listener notification functions. (cal_listener_new): Ditto. (Listener_notifyCalOpened): Renamed to our new naming convention for servant implementations. (Listener_notifyObjUpdated): Ditto. (Listener_notifyObjRemoved): Ditto. * cal-client/cal-client.h (CalClientOpenStatus): Renamed from CalClientLoadStatus. (CalClientClass::cal_opened): Renamed from ::cal_loaded(). (CalClientLoadState): New enum; basically make LoadState public so that users of this code do not have to maintain their own states. * cal-client/cal-client.c (cal_client_create_calendar): Removed function. (cal_client_open_calendar): Moved the functionality over from load_or_create(); now we do everything here. (*): Use the CalClientLoadState enum values instead of the old LoadState values. (cal_client_get_load_state): Renamed from cal_client_is_loaded(), and return the appropriate value. (CalClientPrivate): Added an uri field. (cal_client_init): Initialize priv->uri. (cal_client_destroy): Free the priv->uri. (cal_opened_cb): Maintain the priv->uri. (cal_client_open_calendar): Fill in the priv->uri. (cal_client_get_uri): New function. * gui/calendar-model.c (calendar_model_set_new_comp_vtype): New function to configure the type of calendar components to create when doing click-to-add. This makes the model usable for something other than task lists. (calendar_model_get_new_comp_vtype): New function. * gui/e-calendar-table.c (e_calendar_table_get_model): New function. (e_calendar_table_destroy): Unref the subset_model. * gui/gnome-cal.h (GnomeCalendarOpenMode): Removed enum. * gui/gnome-cal.c (LoadState): Removed enum; we now use the CalClientLoadState from the client objects. (GnomeCalendarPrivate): Removed the loading_uri and task_pad_loading_uri fields as well as the load_state and task_pad_load_state fields, as we can now query them directly from the CalClient. (open_error): Renamed from load_error(). (create_error): Removed function. (gnome_calendar_open): Do not take in the mode parameter. (cal_opened_cb): Get rid of our beautifully-crafted state machine and replace it with simple code; all the loading smarts are in the Wombat now. (setup_widgets): Set the new component vtype of the table model to CAL_COMPONENT_TODO. * gui/Makefile.am (evolution_calendar_SOURCES): Removed gnome-month-item.[ch] from the list of sources. * gui/calendar-summary.c (CalSummary): Removed unused cal_loaded field. (create_summary_view): Do not check if the file exists; this is the job of the Wombat. (generate_html_summary): Fixed prototype. (alarm_fn): Fixed prototype. (property_dialog): Fixed prototype. Wonder if/how this ever worked. (create_summary_view): Cast the component and view as appropriate. Removed unused html variable. [Iain dude, are you compiling with -Wall?] * gui/e-itip-control.c (cal_opened_cb): Sigh, this function signature was *very* wrong. It was using CalClientGetStatus instead of CalClientOpenStatus. * gui/e-tasks.h (ETasksOpenMode): Removed enum. * gui/e-tasks.c (setup_widgets): Set the new component vtype of the table model to CAL_COMPONENT_TODO. (LoadState): Removed the state machine foo. (e_tasks_open): Removed the mode parameter. (initial_load): Removed function. (create_error): Removed function. (ETasksPrivate): Removed folder_uri field. (cal_opened_cb): Remove the state machine. * gui/component-factory.c: #include "tasks-control.h" * conduits/calendar/calendar-conduit.h (ECalConduitContext): Removed calendar_load_tried field. * conduits/calendar/calendar-conduit.c (start_calendar_server_cb): Sigh, fixed function prototype. * conduits/todo/todo-conduit.h (EToDoConduitContext): Removed calendar_load_tried field. * conduits/todo/todo-conduit.c (start_calendar_server_cb): Fixed function prototype. svn path=/trunk/; revision=7571 --- calendar/gui/Makefile.am | 4 - calendar/gui/alarm-notify/alarm-notify-dialog.c | 3 +- calendar/gui/alarm-notify/alarm-notify-dialog.h | 3 +- calendar/gui/alarm-notify/alarm-notify.c | 125 +++++++++++- calendar/gui/alarm-notify/alarm-notify.h | 3 +- calendar/gui/alarm-notify/alarm-queue.c | 3 +- calendar/gui/alarm-notify/alarm-queue.h | 3 +- calendar/gui/alarm-notify/alarm.c | 5 +- calendar/gui/alarm-notify/alarm.h | 5 +- calendar/gui/alarm-notify/notify-main.c | 3 +- calendar/gui/calendar-commands.c | 30 ++- calendar/gui/calendar-commands.h | 25 +++ calendar/gui/calendar-component.c | 5 +- calendar/gui/calendar-component.h | 3 +- calendar/gui/calendar-config.c | 3 +- calendar/gui/calendar-config.h | 3 +- calendar/gui/calendar-model.c | 78 +++++-- calendar/gui/calendar-model.h | 7 +- calendar/gui/calendar-summary.c | 60 +++--- calendar/gui/calendar-summary.h | 3 +- calendar/gui/comp-util.c | 3 +- calendar/gui/comp-util.h | 3 +- calendar/gui/component-factory.c | 5 +- calendar/gui/component-factory.h | 3 +- calendar/gui/control-factory.c | 4 +- calendar/gui/control-factory.h | 3 +- calendar/gui/dialogs/alarm-notify-dialog.c | 3 +- calendar/gui/dialogs/alarm-notify-dialog.h | 3 +- calendar/gui/dialogs/cal-prefs-dialog.c | 3 +- calendar/gui/dialogs/cal-prefs-dialog.h | 3 +- calendar/gui/dialogs/delete-comp.c | 3 +- calendar/gui/dialogs/delete-comp.h | 3 +- calendar/gui/dialogs/task-editor.c | 47 ++--- calendar/gui/dialogs/task-editor.h | 3 +- calendar/gui/e-calendar-table.c | 24 ++- calendar/gui/e-calendar-table.h | 4 +- calendar/gui/e-day-view-main-item.c | 3 +- calendar/gui/e-day-view-main-item.h | 3 +- calendar/gui/e-day-view-time-item.c | 3 +- calendar/gui/e-day-view-time-item.h | 3 +- calendar/gui/e-day-view-top-item.h | 3 +- calendar/gui/e-day-view.c | 15 +- calendar/gui/e-day-view.h | 3 +- calendar/gui/e-itip-control.c | 46 +++-- calendar/gui/e-itip-control.h | 22 ++ calendar/gui/e-meeting-edit.c | 3 +- calendar/gui/e-meeting-edit.h | 3 +- calendar/gui/e-tasks.c | 184 ++++------------- calendar/gui/e-tasks.h | 13 +- calendar/gui/e-week-view-event-item.c | 3 +- calendar/gui/e-week-view-event-item.h | 3 +- calendar/gui/e-week-view-main-item.h | 3 +- calendar/gui/e-week-view-titles-item.h | 3 +- calendar/gui/e-week-view.c | 18 +- calendar/gui/e-week-view.h | 3 +- calendar/gui/event-editor.c | 73 +++---- calendar/gui/event-editor.h | 7 +- calendar/gui/gnome-cal.c | 260 +++++++----------------- calendar/gui/gnome-cal.h | 31 ++- calendar/gui/goto.c | 7 +- calendar/gui/goto.h | 5 +- calendar/gui/main.c | 6 +- calendar/gui/tag-calendar.c | 2 +- calendar/gui/tasks-control.c | 2 +- 64 files changed, 662 insertions(+), 559 deletions(-) (limited to 'calendar/gui') diff --git a/calendar/gui/Makefile.am b/calendar/gui/Makefile.am index 46daa28965..0f000de3f5 100644 --- a/calendar/gui/Makefile.am +++ b/calendar/gui/Makefile.am @@ -55,8 +55,6 @@ evolution_calendar_SOURCES = \ $(IDL_GENERATED) \ alarm.c \ alarm.h \ - alarm-notify.c \ - alarm-notify.h \ calendar-config.c \ calendar-config.h \ calendar-commands.c \ @@ -99,8 +97,6 @@ evolution_calendar_SOURCES = \ event-editor.h \ gnome-cal.c \ gnome-cal.h \ - gnome-month-item.c \ - gnome-month-item.h \ goto.c \ goto.h \ itip-utils.c \ diff --git a/calendar/gui/alarm-notify/alarm-notify-dialog.c b/calendar/gui/alarm-notify/alarm-notify-dialog.c index 7d8357599c..fbd8c1f097 100644 --- a/calendar/gui/alarm-notify/alarm-notify-dialog.c +++ b/calendar/gui/alarm-notify/alarm-notify-dialog.c @@ -1,8 +1,9 @@ /* Evolution calendar - alarm notification dialog * * Copyright (C) 2000 Helix Code, Inc. + * Copyright (C) 2000 Ximian, Inc. * - * Author: Federico Mena-Quintero + * Author: Federico Mena-Quintero * * This program is free software; you can redistribute it and/or modify * it under the terms of the GNU General Public License as published by diff --git a/calendar/gui/alarm-notify/alarm-notify-dialog.h b/calendar/gui/alarm-notify/alarm-notify-dialog.h index 1e56f1c586..f2c938c495 100644 --- a/calendar/gui/alarm-notify/alarm-notify-dialog.h +++ b/calendar/gui/alarm-notify/alarm-notify-dialog.h @@ -1,8 +1,9 @@ /* Evolution calendar - alarm notification dialog * * Copyright (C) 2000 Helix Code, Inc. + * Copyright (C) 2000 Ximian, Inc. * - * Author: Federico Mena-Quintero + * Author: Federico Mena-Quintero * * This program is free software; you can redistribute it and/or modify * it under the terms of the GNU General Public License as published by diff --git a/calendar/gui/alarm-notify/alarm-notify.c b/calendar/gui/alarm-notify/alarm-notify.c index 348bb61bd3..fc87ad878d 100644 --- a/calendar/gui/alarm-notify/alarm-notify.c +++ b/calendar/gui/alarm-notify/alarm-notify.c @@ -1,8 +1,9 @@ /* Evolution calendar - Alarm notification service object * * Copyright (C) 2000 Helix Code, Inc. + * Copyright (C) 2000 Ximian, Inc. * - * Author: Federico Mena-Quintero + * Author: Federico Mena-Quintero * * This program is free software; you can redistribute it and/or modify * it under the terms of the GNU General Public License as published by @@ -38,7 +39,7 @@ static void alarm_notify_class_init (AlarmNotifyClass *class); static void alarm_notify_init (AlarmNotify *an); static void alarm_notify_destroy (GtkObject *object); -static POA_GNOME_Evolution_Calendar_AlarmListener__vepv alarm_listener_vepv; +static POA_GNOME_Evolution_Calendar_AlarmNotify__vepv alarm_notify_vepv; static BonoboObjectClass *parent_class; @@ -136,6 +137,32 @@ alarm_notify_destroy (GtkObject *object) /* CORBA servant implementation */ +/* AlarmNotify::addCalendar method */ +static void +AlarmNotify_addCalendar (PortableServer_Servant servant, + const CORBA_char *uri, + CORBA_Environment *ev) +{ + AlarmNotify *an; + + an = ALARM_NOTIFY (bonobo_object_from_servant (servant)); + + /* FIXME */ +} + +/* AlarmNotify::removeCalendar method */ +static void +AlarmNotify_removeCalendar (PortableServer_Servant servant, + const CORBA_char *uri, + CORBA_Environment *ev) +{ + AlarmNotify *an; + + an = ALARM_NOTIFY (bonobo_object_from_servant (servant)); + + /* FIXME */ +} + /** * alarm_notify_get_epv: * @@ -154,3 +181,97 @@ alarm_notify_get_epv (void) epv->die = AlarmNotify_die; return epv; } + + + +/** + * alarm_notify_construct: + * @an: An alarm notification service object. + * @corba_an: CORBA object for the alarm notification service. + * + * Constructs an alarm notification service object by binding the corresponding + * CORBA object to it. + * + * Return value: the same object as the @an argument. + **/ +AlarmNotify * +alarm_notify_construct (AlarmNotify *an, + GNOME_Evolution_Calendar_AlarmNotify corba_an) +{ + g_return_val_if_fail (an != NULL, NULL); + g_return_val_if_fail (IS_ALARM_NOTIFY (an), NULL); + + /* FIXME: add_interface the property bag here */ + + bonobo_object_construct (BONOBO_OBJECT (an), corba_an); + return an; +} + +/** + * alarm_notify_corba_object_create: + * @object: #BonoboObject that will wrap the CORBA object. + * + * Creates and activates the CORBA object that is wrapped by the specified alarm + * notification service @object. + * + * Return value: An activated object reference or #CORBA_OBJECT_NIL in case of + * failure. + **/ +GNOME_Evolution_Calendar_AlarmNotify +alarm_notify_corba_object_create (BonoboObject *object) +{ + POA_GNOME_Evolution_Calendar_AlarmNotify *servant; + CORBA_Environment ev; + + g_return_val_if_fail (object != NULL, CORBA_OBJECT_NIL); + g_return_val_if_fail (IS_ALARM_NOTIFY (object), CORBA_OBJECT_NIL); + + servant = (POA_GNOME_Evolution_Calendar_AlarmNotify *) g_new (BonoboObjectServant, 1); + servant->vepv = &alarm_notify_vepv; + + CORBA_exception_init (&ev); + POA_GNOME_Evolution_Calendar_AlarmNotify__init ((PortableServer_Servant) servant, &ev); + if (ev._major != CORBA_NO_EXCEPTION) { + g_free (servant); + CORBA_exception_free (&ev); + return CORBA_OBJECT_NIL; + } + + CORBA_exception_free (&ev); + return (GNOME_Evolution_Calendar_AlarmNotify) bonobo_object_activate_servant ( + object, servant); +} + +/** + * alarm_notify_new: + * + * Creates a new #AlarmNotify object. + * + * Return value: A newly-created #AlarmNotify, or NULL if its corresponding + * CORBA object could not be created. + **/ +AlarmNotify * +alarm_notify_new (void) +{ + AlarmNotify *an; + GNOME_Evolution_Calendar_AlarmNotify corba_an; + CORBA_Environment ev; + gboolean result; + + an = gtk_type_new (TYPE_ALARM_NOTIFY); + + corba_an = alarm_notify_corba_object_create (BONOBO_OBJECT (an)); + + CORBA_exception_init (&ev); + result = CORBA_Object_is_nil (corba_an, &ev); + + if (ev._major != CORBA_NO_EXCEPTION || result) { + g_message ("alarm_notify_new(): could not create the CORBA alarm notify service"); + bonobo_object_unref (BONOBO_OBJECT (an)); + CORBA_exception_free (&ev); + return NULL; + } + CORBA_exception_free (&ev); + + return alarm_notify_construct (an, corba_an); +} diff --git a/calendar/gui/alarm-notify/alarm-notify.h b/calendar/gui/alarm-notify/alarm-notify.h index 98fbfd2b70..e7a907485d 100644 --- a/calendar/gui/alarm-notify/alarm-notify.h +++ b/calendar/gui/alarm-notify/alarm-notify.h @@ -1,8 +1,9 @@ /* Evolution calendar - Alarm notification service object * * Copyright (C) 2000 Helix Code, Inc. + * Copyright (C) 2000 Ximian, Inc. * - * Author: Federico Mena-Quintero + * Author: Federico Mena-Quintero * * This program is free software; you can redistribute it and/or modify * it under the terms of the GNU General Public License as published by diff --git a/calendar/gui/alarm-notify/alarm-queue.c b/calendar/gui/alarm-notify/alarm-queue.c index fc4b2a5652..e2f2ae88db 100644 --- a/calendar/gui/alarm-notify/alarm-queue.c +++ b/calendar/gui/alarm-notify/alarm-queue.c @@ -1,8 +1,9 @@ /* Evolution calendar - Alarm queueing engine * * Copyright (C) 2000 Helix Code, Inc. + * Copyright (C) 2000 Ximian, Inc. * - * Authors: Federico Mena-Quintero + * Authors: Federico Mena-Quintero * * This program is free software; you can redistribute it and/or modify * it under the terms of the GNU General Public License as published by diff --git a/calendar/gui/alarm-notify/alarm-queue.h b/calendar/gui/alarm-notify/alarm-queue.h index ea1309a810..1f8871fb96 100644 --- a/calendar/gui/alarm-notify/alarm-queue.h +++ b/calendar/gui/alarm-notify/alarm-queue.h @@ -1,8 +1,9 @@ /* Evolution calendar - Alarm queueing engine * * Copyright (C) 2000 Helix Code, Inc. + * Copyright (C) 2000 Ximian, Inc. * - * Authors: Federico Mena-Quintero + * Authors: Federico Mena-Quintero * * This program is free software; you can redistribute it and/or modify * it under the terms of the GNU General Public License as published by diff --git a/calendar/gui/alarm-notify/alarm.c b/calendar/gui/alarm-notify/alarm.c index a0fe90f337..d32d8f1af9 100644 --- a/calendar/gui/alarm-notify/alarm.c +++ b/calendar/gui/alarm-notify/alarm.c @@ -1,9 +1,10 @@ /* Evolution calendar - Low-level alarm timer mechanism * * Copyright (C) 2000 Helix Code, Inc. + * Copyright (C) 2000 Ximian, Inc. * - * Authors: Miguel de Icaza - * Federico Mena-Quintero + * Authors: Miguel de Icaza + * Federico Mena-Quintero * * This program is free software; you can redistribute it and/or modify * it under the terms of the GNU General Public License as published by diff --git a/calendar/gui/alarm-notify/alarm.h b/calendar/gui/alarm-notify/alarm.h index afa79edfd8..fc81908ef2 100644 --- a/calendar/gui/alarm-notify/alarm.h +++ b/calendar/gui/alarm-notify/alarm.h @@ -1,9 +1,10 @@ /* Evolution calendar - Low-level alarm timer mechanism * * Copyright (C) 2000 Helix Code, Inc. + * Copyright (C) 2000 Ximian, Inc. * - * Authors: Miguel de Icaza - * Federico Mena-Quintero + * Authors: Miguel de Icaza + * Federico Mena-Quintero * * This program is free software; you can redistribute it and/or modify * it under the terms of the GNU General Public License as published by diff --git a/calendar/gui/alarm-notify/notify-main.c b/calendar/gui/alarm-notify/notify-main.c index 93123808b0..6712865725 100644 --- a/calendar/gui/alarm-notify/notify-main.c +++ b/calendar/gui/alarm-notify/notify-main.c @@ -1,8 +1,9 @@ /* Evolution calendar - Alarm notification service main file * * Copyright (C) 2000 Helix Code, Inc. + * Copyright (C) 2000 Ximian, Inc. * - * Author: Federico Mena-Quintero + * Author: Federico Mena-Quintero * * This program is free software; you can redistribute it and/or modify * it under the terms of the GNU General Public License as published by diff --git a/calendar/gui/calendar-commands.c b/calendar/gui/calendar-commands.c index 7519e0458e..db1cb1dbc4 100644 --- a/calendar/gui/calendar-commands.c +++ b/calendar/gui/calendar-commands.c @@ -1,11 +1,27 @@ /* -*- Mode: C; tab-width: 8; indent-tabs-mode: t; c-basic-offset: 8 -*- */ -/* - * Main file for the GNOME Calendar program - * Copyright (C) 1998 the Free Software Foundation +/* Evolution calendar - Commands for the calendar GUI control * - * Authors: - * Miguel de Icaza (miguel@kernel.org) - * Federico Mena (federico@helixcode.com) + * Copyright (C) 1998 The Free Software Foundation + * Copyright (C) 2000 Helix Code, Inc. + * Copyright (C) 2000 Ximian, Inc. + * + * Authors: Miguel de Icaza + * Federico Mena-Quintero + * Seth Alves + * + * This program is free software; you can redistribute it and/or modify + * it under the terms of the GNU General Public License as published by + * the Free Software Foundation; either version 2 of the License, or + * (at your option) any later version. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * 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. */ #include @@ -446,5 +462,5 @@ calendar_set_uri (GnomeCalendar *gcal, char *calendar_file) g_return_if_fail (gcal); g_return_if_fail (calendar_file); - gnome_calendar_open (gcal, calendar_file, CALENDAR_OPEN_OR_CREATE); + gnome_calendar_open (gcal, calendar_file); } diff --git a/calendar/gui/calendar-commands.h b/calendar/gui/calendar-commands.h index 81e1b33408..364051e3a3 100644 --- a/calendar/gui/calendar-commands.h +++ b/calendar/gui/calendar-commands.h @@ -1,3 +1,28 @@ +/* Evolution calendar - Commands for the calendar GUI control + * + * Copyright (C) 1998 The Free Software Foundation + * Copyright (C) 2000 Helix Code, Inc. + * Copyright (C) 2000 Ximian, Inc. + * + * Authors: Miguel de Icaza + * Federico Mena-Quintero + * Seth Alves + * + * This program is free software; you can redistribute it and/or modify + * it under the terms of the GNU General Public License as published by + * the Free Software Foundation; either version 2 of the License, or + * (at your option) any later version. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * 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. + */ + #ifndef CALENDAR_COMMANDS_H #define CALENDAR_COMMANDS_H diff --git a/calendar/gui/calendar-component.c b/calendar/gui/calendar-component.c index de1b2d5839..4f98cbab6b 100644 --- a/calendar/gui/calendar-component.c +++ b/calendar/gui/calendar-component.c @@ -2,6 +2,7 @@ /* component-factory.c * * Copyright (C) 2000 Helix Code, Inc. + * Copyright (C) 2000 Ximian, Inc. * * This program is free software; you can redistribute it and/or * modify it under the terms of the GNU General Public License as @@ -18,7 +19,7 @@ * Free Software Foundation, Inc., 59 Temple Place - Suite 330, * Boston, MA 02111-1307, USA. * - * Author: Ettore Perazzoli + * Author: Ettore Perazzoli */ #include @@ -30,6 +31,8 @@ #include "control-factory.h" #include "calendar-config.h" #include "calendar-summary.h" +#include "tasks-control.h" + #define COMPONENT_FACTORY_ID "OAFIID:GNOME_Evolution_Calendar_ShellComponentFactory" diff --git a/calendar/gui/calendar-component.h b/calendar/gui/calendar-component.h index 8e5cd6605f..d2d570e340 100644 --- a/calendar/gui/calendar-component.h +++ b/calendar/gui/calendar-component.h @@ -2,6 +2,7 @@ /* component-factory.h * * Copyright (C) 2000 Helix Code, Inc. + * Copyright (C) 2000 Ximian, Inc. * * This program is free software; you can redistribute it and/or * modify it under the terms of the GNU General Public License as @@ -18,7 +19,7 @@ * Free Software Foundation, Inc., 59 Temple Place - Suite 330, * Boston, MA 02111-1307, USA. * - * Author: Ettore Perazzoli + * Author: Ettore Perazzoli */ #ifndef _COMPONENT_FACTORY_H_ diff --git a/calendar/gui/calendar-config.c b/calendar/gui/calendar-config.c index dc12e60ab4..52f62f89df 100644 --- a/calendar/gui/calendar-config.c +++ b/calendar/gui/calendar-config.c @@ -2,9 +2,10 @@ /* * Author : - * Damon Chaplin + * Damon Chaplin * * Copyright 2000, Helix Code, Inc. + * Copyright 2000, Ximian, Inc. * * This program is free software; you can redistribute it and/or * modify it under the terms of the GNU General Public License as diff --git a/calendar/gui/calendar-config.h b/calendar/gui/calendar-config.h index d5176d624c..8b11570f12 100644 --- a/calendar/gui/calendar-config.h +++ b/calendar/gui/calendar-config.h @@ -2,9 +2,10 @@ /* * Author : - * Damon Chaplin + * Damon Chaplin * * Copyright 2000, Helix Code, Inc. + * Copyright 2000, Ximian, Inc. * * This program is free software; you can redistribute it and/or * modify it under the terms of the GNU General Public License as diff --git a/calendar/gui/calendar-model.c b/calendar/gui/calendar-model.c index 2fb4f89bf0..2ab801cdf3 100644 --- a/calendar/gui/calendar-model.c +++ b/calendar/gui/calendar-model.c @@ -3,8 +3,9 @@ /* Evolution calendar - Data model for ETable * * Copyright (C) 2000 Helix Code, Inc. + * Copyright (C) 2000 Ximian, Inc. * - * Authors: Federico Mena-Quintero + * Authors: Federico Mena-Quintero * * This program is free software; you can redistribute it and/or modify * it under the terms of the GNU General Public License as published by @@ -56,6 +57,9 @@ struct _CalendarModelPrivate { /* UID -> array index hash */ GHashTable *uid_index_hash; + /* Type of components to create when using click-to-add in the table */ + CalComponentVType new_comp_vtype; + /* Whether we display dates in 24-hour format. */ gboolean use_24_hour_format; @@ -73,7 +77,6 @@ struct _CalendarModelPrivate { enum { CATEGORIES_CHANGED, - LAST_SIGNAL }; @@ -196,6 +199,7 @@ calendar_model_init (CalendarModel *model) priv->objects = g_array_new (FALSE, TRUE, sizeof (CalComponent *)); priv->uid_index_hash = g_hash_table_new (g_str_hash, g_str_equal); + priv->new_comp_vtype = CAL_COMPONENT_EVENT; priv->use_24_hour_format = TRUE; priv->categories = g_tree_new ((GCompareFunc)strcmp); @@ -1307,7 +1311,7 @@ calendar_model_append_row (ETableModel *etm, ETableModel *source, gint row) * is only used for the task list. */ comp = cal_component_new (); - cal_component_set_new_vtype (comp, CAL_COMPONENT_TODO); + cal_component_set_new_vtype (comp, priv->new_comp_vtype); cal_component_get_uid (comp, &uid); @@ -1534,17 +1538,17 @@ calendar_model_new (void) } -/* Callback used when a calendar is loaded into the server */ +/* Callback used when a calendar is opened into the server */ static void -cal_loaded_cb (CalClient *client, - CalClientLoadStatus status, - CalendarModel *model) +cal_opened_cb (CalClient *client, CalClientOpenStatus status, gpointer data) { - g_return_if_fail (IS_CALENDAR_MODEL (model)); + CalendarModel *model; + + model = CALENDAR_MODEL (data); e_table_model_pre_change (E_TABLE_MODEL (model)); - if (status == CAL_CLIENT_LOAD_SUCCESS) { + if (status == CAL_CLIENT_OPEN_SUCCESS) { load_objects (model); calendar_model_collect_all_categories (model); } @@ -1744,8 +1748,7 @@ load_objects (CalendarModel *model) priv = model->priv; - if (!cal_client_is_loaded (priv->client)) - return; + g_assert (cal_client_get_load_state (priv->client) == CAL_CLIENT_LOAD_LOADED); uids = cal_client_get_uids (priv->client, priv->type); @@ -1861,22 +1864,65 @@ calendar_model_set_cal_client (CalendarModel *model, CalClient *client, CalObjTy priv->type = type; if (priv->client) { - if (!cal_client_is_loaded (priv->client)) - gtk_signal_connect (GTK_OBJECT (priv->client), "cal_loaded", - GTK_SIGNAL_FUNC (cal_loaded_cb), model); - gtk_signal_connect (GTK_OBJECT (priv->client), "obj_updated", GTK_SIGNAL_FUNC (obj_updated_cb), model); gtk_signal_connect (GTK_OBJECT (priv->client), "obj_removed", GTK_SIGNAL_FUNC (obj_removed_cb), model); - load_objects (model); + if (cal_client_get_load_state (priv->client) != CAL_CLIENT_LOAD_LOADED) + gtk_signal_connect (GTK_OBJECT (priv->client), "cal_opened", + GTK_SIGNAL_FUNC (cal_opened_cb), model); + else + load_objects (model); } e_table_model_changed (E_TABLE_MODEL (model)); } +/** + * calendar_model_set_new_comp_vtype: + * @model: A calendar model. + * @vtype: Type of calendar components to create. + * + * Sets the type of calendar components that will be created by a calendar table + * model when the click-to-add functionality of the table is used. + **/ +void +calendar_model_set_new_comp_vtype (CalendarModel *model, CalComponentVType vtype) +{ + CalendarModelPrivate *priv; + + g_return_if_fail (model != NULL); + g_return_if_fail (IS_CALENDAR_MODEL (model)); + g_return_if_fail (vtype != CAL_COMPONENT_NO_TYPE); + + priv = model->priv; + priv->new_comp_vtype = vtype; +} + +/** + * calendar_model_get_new_comp_vtype: + * @model: A calendar model. + * + * Queries the type of calendar components that are created by a calendar table + * model when using the click-to-add functionality in a table. + * + * Return value: Type of components that are created. + **/ +CalComponentVType +calendar_model_get_new_comp_vtype (CalendarModel *model) +{ + CalendarModelPrivate *priv; + + g_return_val_if_fail (model != NULL, CAL_COMPONENT_NO_TYPE); + g_return_val_if_fail (IS_CALENDAR_MODEL (model), CAL_COMPONENT_NO_TYPE); + + priv = model->priv; + return priv->new_comp_vtype; +} + + void calendar_model_mark_task_complete (CalendarModel *model, gint row) diff --git a/calendar/gui/calendar-model.h b/calendar/gui/calendar-model.h index e4946393b6..5ff2f41c38 100644 --- a/calendar/gui/calendar-model.h +++ b/calendar/gui/calendar-model.h @@ -1,8 +1,9 @@ /* Evolution calendar - Data model for ETable * * Copyright (C) 2000 Helix Code, Inc. + * Copyright (C) 2000 Ximian, Inc. * - * Authors: Federico Mena-Quintero + * Authors: Federico Mena-Quintero * * This program is free software; you can redistribute it and/or modify * it under the terms of the GNU General Public License as published by @@ -64,6 +65,10 @@ void calendar_model_set_cal_client (CalendarModel *model, CalClient *client, CalObjType type); +void calendar_model_set_new_comp_vtype (CalendarModel *model, + CalComponentVType vtype); +CalComponentVType calendar_model_get_new_comp_vtype (CalendarModel *model); + void calendar_model_mark_task_complete (CalendarModel *model, gint row); diff --git a/calendar/gui/calendar-summary.c b/calendar/gui/calendar-summary.c index 08ad225a43..76db68463e 100644 --- a/calendar/gui/calendar-summary.c +++ b/calendar/gui/calendar-summary.c @@ -1,9 +1,10 @@ /* -*- Mode: C; indent-tabs-mode: t; c-basic-offset: 8; tab-width: 8 -*- */ /* calendar-summary.c * - * Authors: Iain Holmes + * Authors: Iain Holmes * * Copyright (C) 2000 Helix Code, Inc. + * Copyright (C) 2000 Ximian, Inc. * * This program is free software; you can redistribute it and/or * modify it under the terms of the GNU General Public License as @@ -40,6 +41,7 @@ #include "cal-util/cal-component.h" #include "cal-util/timeutil.h" +#include "alarm.h" #include "calendar-model.h" #include "calendar-summary.h" @@ -49,7 +51,6 @@ typedef struct { ExecutiveSummaryHtmlView *view; BonoboPropertyControl *property_control; CalClient *client; - gboolean cal_loaded; GtkWidget *show_appointments; GtkWidget *show_tasks; @@ -77,12 +78,15 @@ static BonoboGenericFactory *factory; #define CALENDAR_SUMMARY_ID "OAFIID:GNOME_Evolution_Calendar_Summary_ComponentFactory" static gboolean -generate_html_summary (CalSummary *summary) +generate_html_summary (gpointer data) { + CalSummary *summary; time_t t, day_begin, day_end; struct tm *timeptr; GList *uids, *l; char *ret_html, *tmp, *datestr; + + summary = data; t = time (NULL); day_begin = time_day_begin (t); @@ -279,33 +283,33 @@ obj_removed_cb (CalClient *client, summary->idle = g_idle_add (generate_html_summary, summary); } + static void -cal_loaded_cb (CalClient *client, - CalClientLoadStatus status, +cal_opened_cb (CalClient *client, + CalClientOpenStatus status, CalSummary *summary) { switch (status) { - case CAL_CLIENT_LOAD_SUCCESS: - summary->cal_loaded = TRUE; - + case CAL_CLIENT_OPEN_SUCCESS: if (summary->idle != 0) return; summary->idle = g_idle_add (generate_html_summary, summary); break; - case CAL_CLIENT_LOAD_ERROR: + case CAL_CLIENT_OPEN_ERROR: executive_summary_html_view_set_html (summary->view, _("Error loading calendar")); break; - case CAL_CLIENT_LOAD_IN_USE: - executive_summary_html_view_set_html (summary->view, - _("Error loading calendar:
Calendar in use.")); - + case CAL_CLIENT_OPEN_NOT_FOUND: + /* We did not use only_if_exists when opening the calendar, so + * this should not happen. + */ + g_assert_not_reached (); break; - case CAL_CLIENT_LOAD_METHOD_NOT_SUPPORTED: + case CAL_CLIENT_OPEN_METHOD_NOT_SUPPORTED: executive_summary_html_view_set_html (summary->view, _("Error loading calendar:
Method not supported")); break; @@ -314,13 +318,17 @@ cal_loaded_cb (CalClient *client, break; } } + static void alarm_fn (gpointer alarm_id, time_t old_t, - CalSummary *summary) + gpointer data) { + CalSummary *summary; time_t t, day_end; + summary = data; + /* Remove the old alarm, and start a new one for the next midnight */ alarm_remove (alarm_id); @@ -464,10 +472,10 @@ property_dialog_changed (GtkWidget *widget, bonobo_property_control_changed (summary->property_control, NULL); } -static void +static BonoboControl * property_dialog (BonoboPropertyControl *property_control, int page_num, - gpointer user_data) + void *user_data) { BonoboControl *control; CalSummary *summary = (CalSummary *) user_data; @@ -530,7 +538,7 @@ create_summary_view (ExecutiveSummaryComponentFactory *_factory, BonoboPropertyControl *property_control; BonoboEventSource *event_source; CalSummary *summary; - char *html, *file; + char *file; time_t t, day_end; file = g_concat_dir_and_file (evolution_dir, "local/Calendar/calendar.ics"); @@ -539,11 +547,10 @@ create_summary_view (ExecutiveSummaryComponentFactory *_factory, component = executive_summary_component_new (); summary = g_new (CalSummary, 1); - summary->component = component; + summary->component = EXECUTIVE_SUMMARY_COMPONENT (component); summary->icon = g_strdup ("evolution-calendar.png"); summary->title = g_strdup ("Things to do"); summary->client = cal_client_new (); - summary->cal_loaded = FALSE; summary->idle = 0; summary->appointments = TRUE; summary->tasks = TRUE; @@ -552,17 +559,12 @@ create_summary_view (ExecutiveSummaryComponentFactory *_factory, day_end = time_day_end (t); summary->alarm = alarm_add (day_end, alarm_fn, summary, NULL); - /* Check for calendar files */ - if (!g_file_exists (file)) { - cal_client_create_calendar (summary->client, file); - } - /* Load calendar */ - cal_client_load_calendar (summary->client, file); + cal_client_open_calendar (summary->client, file, FALSE); g_free (file); - gtk_signal_connect (GTK_OBJECT (summary->client), "cal-loaded", - GTK_SIGNAL_FUNC (cal_loaded_cb), summary); + gtk_signal_connect (GTK_OBJECT (summary->client), "cal-opened", + GTK_SIGNAL_FUNC (cal_opened_cb), summary); gtk_signal_connect (GTK_OBJECT (summary->client), "obj-updated", GTK_SIGNAL_FUNC (obj_updated_cb), summary); gtk_signal_connect (GTK_OBJECT (summary->client), "obj-removed", @@ -575,7 +577,7 @@ create_summary_view (ExecutiveSummaryComponentFactory *_factory, /* HTML view */ view = executive_summary_html_view_new_full (event_source); - summary->view = view; + summary->view = EXECUTIVE_SUMMARY_HTML_VIEW (view); executive_summary_html_view_set_html (EXECUTIVE_SUMMARY_HTML_VIEW (view), _("Loading Calendar")); diff --git a/calendar/gui/calendar-summary.h b/calendar/gui/calendar-summary.h index 0fd3c3e7d6..cfb92c0697 100644 --- a/calendar/gui/calendar-summary.h +++ b/calendar/gui/calendar-summary.h @@ -1,9 +1,10 @@ /* -*- Mode: C; indent-tabs-mode: t; c-basic-offset: 8; tab-width: 8 -*- */ /* calendar-summary.c * - * Authors: Iain Holmes + * Authors: Iain Holmes * * Copyright (C) 2000 Helix Code, Inc. + * Copyright (C) 2000 Ximian, Inc. * * This program is free software; you can redistribute it and/or * modify it under the terms of the GNU General Public License as diff --git a/calendar/gui/comp-util.c b/calendar/gui/comp-util.c index d6c26e7751..f1898e914e 100644 --- a/calendar/gui/comp-util.c +++ b/calendar/gui/comp-util.c @@ -1,8 +1,9 @@ /* Evolution calendar - Utilities for manipulating CalComponent objects * * Copyright (C) 2000 Helix Code, Inc. + * Copyright (C) 2000 Ximian, Inc. * - * Author: Federico Mena-Quintero + * Author: Federico Mena-Quintero * * This program is free software; you can redistribute it and/or modify * it under the terms of the GNU General Public License as published by diff --git a/calendar/gui/comp-util.h b/calendar/gui/comp-util.h index d08bfe993b..9c70172aee 100644 --- a/calendar/gui/comp-util.h +++ b/calendar/gui/comp-util.h @@ -1,8 +1,9 @@ /* Evolution calendar - Utilities for manipulating CalComponent objects * * Copyright (C) 2000 Helix Code, Inc. + * Copyright (C) 2000 Ximian, Inc. * - * Author: Federico Mena-Quintero + * Author: Federico Mena-Quintero * * This program is free software; you can redistribute it and/or modify * it under the terms of the GNU General Public License as published by diff --git a/calendar/gui/component-factory.c b/calendar/gui/component-factory.c index de1b2d5839..4f98cbab6b 100644 --- a/calendar/gui/component-factory.c +++ b/calendar/gui/component-factory.c @@ -2,6 +2,7 @@ /* component-factory.c * * Copyright (C) 2000 Helix Code, Inc. + * Copyright (C) 2000 Ximian, Inc. * * This program is free software; you can redistribute it and/or * modify it under the terms of the GNU General Public License as @@ -18,7 +19,7 @@ * Free Software Foundation, Inc., 59 Temple Place - Suite 330, * Boston, MA 02111-1307, USA. * - * Author: Ettore Perazzoli + * Author: Ettore Perazzoli */ #include @@ -30,6 +31,8 @@ #include "control-factory.h" #include "calendar-config.h" #include "calendar-summary.h" +#include "tasks-control.h" + #define COMPONENT_FACTORY_ID "OAFIID:GNOME_Evolution_Calendar_ShellComponentFactory" diff --git a/calendar/gui/component-factory.h b/calendar/gui/component-factory.h index 8e5cd6605f..d2d570e340 100644 --- a/calendar/gui/component-factory.h +++ b/calendar/gui/component-factory.h @@ -2,6 +2,7 @@ /* component-factory.h * * Copyright (C) 2000 Helix Code, Inc. + * Copyright (C) 2000 Ximian, Inc. * * This program is free software; you can redistribute it and/or * modify it under the terms of the GNU General Public License as @@ -18,7 +19,7 @@ * Free Software Foundation, Inc., 59 Temple Place - Suite 330, * Boston, MA 02111-1307, USA. * - * Author: Ettore Perazzoli + * Author: Ettore Perazzoli */ #ifndef _COMPONENT_FACTORY_H_ diff --git a/calendar/gui/control-factory.c b/calendar/gui/control-factory.c index fc88738f5b..a97375de77 100644 --- a/calendar/gui/control-factory.c +++ b/calendar/gui/control-factory.c @@ -2,6 +2,7 @@ /* control-factory.c * * Copyright (C) 2000 Helix Code, Inc. + * Copyright (C) 2000 Ximian, Inc. * * This program is free software; you can redistribute it and/or * modify it under the terms of the GNU General Public License as @@ -18,7 +19,7 @@ * Free Software Foundation, Inc., 59 Temple Place - Suite 330, * Boston, MA 02111-1307, USA. * - * Author: Ettore Perazzoli + * Author: Ettore Perazzoli */ #include @@ -31,7 +32,6 @@ #include #include -#include #include #include diff --git a/calendar/gui/control-factory.h b/calendar/gui/control-factory.h index bacd2d3d90..7170404cda 100644 --- a/calendar/gui/control-factory.h +++ b/calendar/gui/control-factory.h @@ -2,6 +2,7 @@ /* control-factory.c * * Copyright (C) 2000 Helix Code, Inc. + * Copyright (C) 2000 Ximian, Inc. * * This program is free software; you can redistribute it and/or * modify it under the terms of the GNU General Public License as @@ -18,7 +19,7 @@ * Free Software Foundation, Inc., 59 Temple Place - Suite 330, * Boston, MA 02111-1307, USA. * - * Author: Federico Mena Quintero + * Author: Ettore Perazzoli */ #ifndef _CONTROL_FACTORY_H_ diff --git a/calendar/gui/dialogs/alarm-notify-dialog.c b/calendar/gui/dialogs/alarm-notify-dialog.c index 7d8357599c..fbd8c1f097 100644 --- a/calendar/gui/dialogs/alarm-notify-dialog.c +++ b/calendar/gui/dialogs/alarm-notify-dialog.c @@ -1,8 +1,9 @@ /* Evolution calendar - alarm notification dialog * * Copyright (C) 2000 Helix Code, Inc. + * Copyright (C) 2000 Ximian, Inc. * - * Author: Federico Mena-Quintero + * Author: Federico Mena-Quintero * * This program is free software; you can redistribute it and/or modify * it under the terms of the GNU General Public License as published by diff --git a/calendar/gui/dialogs/alarm-notify-dialog.h b/calendar/gui/dialogs/alarm-notify-dialog.h index 1e56f1c586..f2c938c495 100644 --- a/calendar/gui/dialogs/alarm-notify-dialog.h +++ b/calendar/gui/dialogs/alarm-notify-dialog.h @@ -1,8 +1,9 @@ /* Evolution calendar - alarm notification dialog * * Copyright (C) 2000 Helix Code, Inc. + * Copyright (C) 2000 Ximian, Inc. * - * Author: Federico Mena-Quintero + * Author: Federico Mena-Quintero * * This program is free software; you can redistribute it and/or modify * it under the terms of the GNU General Public License as published by diff --git a/calendar/gui/dialogs/cal-prefs-dialog.c b/calendar/gui/dialogs/cal-prefs-dialog.c index 98e6da9d8a..af5d15e9d9 100644 --- a/calendar/gui/dialogs/cal-prefs-dialog.c +++ b/calendar/gui/dialogs/cal-prefs-dialog.c @@ -2,9 +2,10 @@ /* * Author : - * Damon Chaplin + * Damon Chaplin * * Copyright 2000, Helix Code, Inc. + * Copyright 2000, Ximian, Inc. * * This program is free software; you can redistribute it and/or * modify it under the terms of the GNU General Public License as diff --git a/calendar/gui/dialogs/cal-prefs-dialog.h b/calendar/gui/dialogs/cal-prefs-dialog.h index 52f115e0ac..9d744f806d 100644 --- a/calendar/gui/dialogs/cal-prefs-dialog.h +++ b/calendar/gui/dialogs/cal-prefs-dialog.h @@ -2,9 +2,10 @@ /* * Author : - * Damon Chaplin + * Damon Chaplin * * Copyright 2000, Helix Code, Inc. + * Copyright 2000, Ximian, Inc. * * This program is free software; you can redistribute it and/or * modify it under the terms of the GNU General Public License as diff --git a/calendar/gui/dialogs/delete-comp.c b/calendar/gui/dialogs/delete-comp.c index 97e1b69cd6..5099c80de2 100644 --- a/calendar/gui/dialogs/delete-comp.c +++ b/calendar/gui/dialogs/delete-comp.c @@ -1,8 +1,9 @@ /* Evolution calendar - Delete calendar component dialog * * Copyright (C) 2000 Helix Code, Inc. + * Copyright (C) 2000 Ximian, Inc. * - * Author: Federico Mena-Quintero + * Author: Federico Mena-Quintero * * This program is free software; you can redistribute it and/or modify * it under the terms of the GNU General Public License as published by diff --git a/calendar/gui/dialogs/delete-comp.h b/calendar/gui/dialogs/delete-comp.h index cae8531981..b01daecfe0 100644 --- a/calendar/gui/dialogs/delete-comp.h +++ b/calendar/gui/dialogs/delete-comp.h @@ -1,8 +1,9 @@ /* Evolution calendar - Delete calendar component dialog * * Copyright (C) 2000 Helix Code, Inc. + * Copyright (C) 2000 Ximian, Inc. * - * Author: Federico Mena-Quintero + * Author: Federico Mena-Quintero * * This program is free software; you can redistribute it and/or modify * it under the terms of the GNU General Public License as published by diff --git a/calendar/gui/dialogs/task-editor.c b/calendar/gui/dialogs/task-editor.c index cca8298713..571f9917ef 100644 --- a/calendar/gui/dialogs/task-editor.c +++ b/calendar/gui/dialogs/task-editor.c @@ -2,9 +2,10 @@ /* * Author : - * Damon Chaplin + * Damon Chaplin * * Copyright 2000, Helix Code, Inc. + * Copyright 2000, Ximian, Inc. * * This program is free software; you can redistribute it and/or * modify it under the terms of the GNU General Public License as @@ -50,7 +51,7 @@ typedef struct { /* Client to use */ CalClient *client; - + /* Calendar component we are editing; this is an internal copy and is * not one of the read-only objects from the parent calendar. */ @@ -167,7 +168,7 @@ static void field_changed (GtkWidget *widget, static void task_editor_set_changed (TaskEditor *tedit, gboolean changed); static gboolean prompt_to_save_changes (TaskEditor *tedit); -static void categories_clicked (GtkWidget *button, +static void categories_clicked (GtkWidget *button, TaskEditor *editor); /* The function libglade calls to create the EDateEdit widgets in the GUI. */ @@ -227,7 +228,7 @@ static BonoboUIVerb verbs [] = { BONOBO_UI_VERB ("FileDelete", file_delete_cb), BONOBO_UI_VERB ("FileClose", file_close_cb), BONOBO_UI_VERB ("FileSaveAndClose", file_save_and_close_cb), - + BONOBO_UI_VERB ("DebugDumpXml", debug_xml_cb), BONOBO_UI_VERB_END @@ -236,9 +237,9 @@ static BonoboUIVerb verbs [] = { /** * task_editor_construct: * @tedit: A #TaskEditor. - * + * * Constructs a task editor by loading its Glade XML file. - * + * * Return value: The same object as @tedit, or NULL if the widgets could not be * created. In the latter case, the task editor will automatically be * destroyed. @@ -521,7 +522,7 @@ task_editor_destroy (GtkObject *object) } -void +void task_editor_set_cal_client (TaskEditor *tedit, CalClient *client) { @@ -539,8 +540,8 @@ task_editor_set_cal_client (TaskEditor *tedit, g_return_if_fail (IS_CAL_CLIENT (client)); if (client) - g_return_if_fail (cal_client_is_loaded (client)); - + g_return_if_fail (cal_client_get_load_state (client) == CAL_CLIENT_LOAD_LOADED); + if (client) gtk_object_ref (GTK_OBJECT (client)); @@ -576,7 +577,7 @@ obj_updated_cb (CalClient *client, const char *uid, gpointer data) g_return_if_fail (IS_TASK_EDITOR (tedit)); priv = tedit->priv; - + /* If we aren't showing the object which has been updated, return. */ if (!priv->comp) return; @@ -650,7 +651,7 @@ raise_and_focus (GtkWidget *widget) * task_editor_set_todo_object: * @tedit: A #TaskEditor. * @comp: A todo object. - * + * * Sets the todo object that a task editor dialog will manipulate. **/ void @@ -684,7 +685,7 @@ make_title_from_comp (CalComponent *comp) const char *summary; CalComponentVType type; CalComponentText text; - + if (!comp) return g_strdup (_("Edit Task")); @@ -694,7 +695,7 @@ make_title_from_comp (CalComponent *comp) else summary = _("No summary"); - + type = cal_component_get_vtype (comp); switch (type) { case CAL_COMPONENT_EVENT: @@ -761,7 +762,7 @@ fill_widgets (TaskEditor *tedit) TaskEditorPriority priority; const char *url; const char *categories; - + priv = tedit->priv; task_editor_set_changed (tedit, FALSE); @@ -786,7 +787,7 @@ fill_widgets (TaskEditor *tedit) e_dialog_editable_set (priv->description, NULL); } cal_component_free_text_list (l); - + /* Due Date. */ cal_component_get_due (priv->comp, &d); if (d.value) { @@ -905,7 +906,7 @@ dialog_to_comp_object (TaskEditor *tedit) CalComponentClassification classification; char *url, *cat; char *str; - + priv = tedit->priv; comp = priv->comp; @@ -942,7 +943,7 @@ dialog_to_comp_object (TaskEditor *tedit) cal_component_set_description_list (comp, &l); } - + if (!str) g_free (str); @@ -1020,7 +1021,7 @@ debug_xml_cb (BonoboUIComponent *uic, gpointer data, const char *path) { TaskEditor *tedit = TASK_EDITOR (data); TaskEditorPrivate *priv = tedit->priv; - + bonobo_window_dump (BONOBO_WINDOW (priv->app), "on demand"); } @@ -1052,13 +1053,13 @@ file_delete_cb (BonoboUIComponent *uic, gpointer data, const char *path) TaskEditor *tedit; TaskEditorPrivate *priv; const char *uid; - + tedit = TASK_EDITOR (data); g_return_if_fail (IS_TASK_EDITOR (tedit)); priv = tedit->priv; - + g_return_if_fail (priv->comp); cal_component_get_uid (priv->comp, &uid); @@ -1097,7 +1098,7 @@ priority_value_to_index (int priority_value) retval = PRIORITY_HIGH; else if (priority_value == 5) retval = PRIORITY_NORMAL; - else + else retval = PRIORITY_LOW; return retval; @@ -1298,7 +1299,7 @@ prompt_to_save_changes (TaskEditor *tedit) gnome_dialog_set_parent (GNOME_DIALOG (dialog), GTK_WINDOW (priv->app)); - + switch (gnome_dialog_run_and_close (GNOME_DIALOG (dialog))) { case 0: /* Save */ /* FIXME: If an error occurs here, we should popup a dialog @@ -1329,7 +1330,7 @@ categories_clicked(GtkWidget *button, TaskEditor *tedit) dialog = GNOME_DIALOG (e_categories_new (categories)); result = gnome_dialog_run (dialog); g_free (categories); - + if (result == 0) { gtk_object_get (GTK_OBJECT (dialog), "categories", &categories, diff --git a/calendar/gui/dialogs/task-editor.h b/calendar/gui/dialogs/task-editor.h index c74e979dff..69e3bd41d8 100644 --- a/calendar/gui/dialogs/task-editor.h +++ b/calendar/gui/dialogs/task-editor.h @@ -2,9 +2,10 @@ /* * Author : - * Damon Chaplin + * Damon Chaplin * * Copyright 2000, Helix Code, Inc. + * Copyright 2000, Ximian, Inc. * * This program is free software; you can redistribute it and/or * modify it under the terms of the GNU General Public License as diff --git a/calendar/gui/e-calendar-table.c b/calendar/gui/e-calendar-table.c index 536051ea1f..0fa5bc6f84 100644 --- a/calendar/gui/e-calendar-table.c +++ b/calendar/gui/e-calendar-table.c @@ -2,9 +2,10 @@ /* * Author : - * Damon Chaplin + * Damon Chaplin * * Copyright 2000, Helix Code, Inc. + * Copyright 2000, Ximian, Inc. * * This program is free software; you can redistribute it and/or * modify it under the terms of the GNU General Public License as @@ -335,6 +336,24 @@ e_calendar_table_new (void) } +/** + * e_calendar_table_get_model: + * @cal_table: A calendar table. + * + * Queries the calendar data model that a calendar table is using. + * + * Return value: A calendar model. + **/ +CalendarModel * +e_calendar_table_get_model (ECalendarTable *cal_table) +{ + g_return_val_if_fail (cal_table != NULL, NULL); + g_return_val_if_fail (E_IS_CALENDAR_TABLE (cal_table), NULL); + + return cal_table->model; +} + + static void e_calendar_table_destroy (GtkObject *object) { @@ -345,6 +364,9 @@ e_calendar_table_destroy (GtkObject *object) gtk_object_unref (GTK_OBJECT (cal_table->model)); cal_table->model = NULL; + gtk_object_unref (GTK_OBJECT (cal_table->subset_model)); + cal_table->subset_model = NULL; + GTK_OBJECT_CLASS (parent_class)->destroy (object); } diff --git a/calendar/gui/e-calendar-table.h b/calendar/gui/e-calendar-table.h index 6ca8a32515..555ea357af 100644 --- a/calendar/gui/e-calendar-table.h +++ b/calendar/gui/e-calendar-table.h @@ -2,9 +2,10 @@ /* * Author : - * Damon Chaplin + * Damon Chaplin * * Copyright 2000, Helix Code, Inc. + * Copyright 2000, Ximian, Inc. * * This program is free software; you can redistribute it and/or * modify it under the terms of the GNU General Public License as @@ -88,6 +89,7 @@ struct _ECalendarTableClass GtkType e_calendar_table_get_type (void); GtkWidget* e_calendar_table_new (void); +CalendarModel *e_calendar_table_get_model (ECalendarTable *cal_table); void e_calendar_table_set_cal_client (ECalendarTable *cal_table, CalClient *client); diff --git a/calendar/gui/e-day-view-main-item.c b/calendar/gui/e-day-view-main-item.c index edcb0b4b82..6867434d53 100644 --- a/calendar/gui/e-day-view-main-item.c +++ b/calendar/gui/e-day-view-main-item.c @@ -2,9 +2,10 @@ /* * Author : - * Damon Chaplin + * Damon Chaplin * * Copyright 1999, Helix Code, Inc. + * Copyright 1999, Ximian, Inc. * * This program is free software; you can redistribute it and/or * modify it under the terms of the GNU General Public License as diff --git a/calendar/gui/e-day-view-main-item.h b/calendar/gui/e-day-view-main-item.h index d8305e594d..cb9e2589d8 100644 --- a/calendar/gui/e-day-view-main-item.h +++ b/calendar/gui/e-day-view-main-item.h @@ -2,9 +2,10 @@ /* * Author : - * Damon Chaplin + * Damon Chaplin * * Copyright 1999, Helix Code, Inc. + * Copyright 1999, Ximian, Inc. * * This program is free software; you can redistribute it and/or * modify it under the terms of the GNU General Public License as diff --git a/calendar/gui/e-day-view-time-item.c b/calendar/gui/e-day-view-time-item.c index b0e51aa053..a6c6c66062 100644 --- a/calendar/gui/e-day-view-time-item.c +++ b/calendar/gui/e-day-view-time-item.c @@ -2,9 +2,10 @@ /* * Author : - * Damon Chaplin + * Damon Chaplin * * Copyright 1999, Helix Code, Inc. + * Copyright 1999, Ximian, Inc. * * This program is free software; you can redistribute it and/or * modify it under the terms of the GNU General Public License as diff --git a/calendar/gui/e-day-view-time-item.h b/calendar/gui/e-day-view-time-item.h index 8b20fe999e..972f01e1b5 100644 --- a/calendar/gui/e-day-view-time-item.h +++ b/calendar/gui/e-day-view-time-item.h @@ -2,9 +2,10 @@ /* * Author : - * Damon Chaplin + * Damon Chaplin * * Copyright 1999, Helix Code, Inc. + * Copyright 1999, Ximian, Inc. * * This program is free software; you can redistribute it and/or * modify it under the terms of the GNU General Public License as diff --git a/calendar/gui/e-day-view-top-item.h b/calendar/gui/e-day-view-top-item.h index 435ef12b58..53db4eda79 100644 --- a/calendar/gui/e-day-view-top-item.h +++ b/calendar/gui/e-day-view-top-item.h @@ -2,9 +2,10 @@ /* * Author : - * Damon Chaplin + * Damon Chaplin * * Copyright 1999, Helix Code, Inc. + * Copyright 1999, Ximian, Inc. * * This program is free software; you can redistribute it and/or * modify it under the terms of the GNU General Public License as diff --git a/calendar/gui/e-day-view.c b/calendar/gui/e-day-view.c index 1cb4b182ec..1960071cdd 100644 --- a/calendar/gui/e-day-view.c +++ b/calendar/gui/e-day-view.c @@ -1295,15 +1295,15 @@ e_day_view_set_calendar (EDayView *day_view, } -/* Callback used when the calendar client finishes loading */ +/* Callback used when the calendar client finishes opening */ static void -cal_loaded_cb (CalClient *client, CalClientLoadStatus status, gpointer data) +cal_opened_cb (CalClient *client, CalClientOpenStatus status, gpointer data) { EDayView *day_view; day_view = E_DAY_VIEW (data); - if (status != CAL_CLIENT_LOAD_SUCCESS) + if (status != CAL_CLIENT_OPEN_SUCCESS) return; e_day_view_queue_reload_events (day_view); @@ -1453,9 +1453,9 @@ e_day_view_set_cal_client (EDayView *day_view, day_view->client = client; if (day_view->client) { - if (!cal_client_is_loaded (day_view->client)) - gtk_signal_connect (GTK_OBJECT (day_view->client), "cal_loaded", - GTK_SIGNAL_FUNC (cal_loaded_cb), day_view); + if (cal_client_get_load_state (day_view->client) == CAL_CLIENT_LOAD_LOADED) + gtk_signal_connect (GTK_OBJECT (day_view->client), "cal_opened", + GTK_SIGNAL_FUNC (cal_opened_cb), day_view); gtk_signal_connect (GTK_OBJECT (day_view->client), "obj_updated", GTK_SIGNAL_FUNC (obj_updated_cb), day_view); @@ -3834,7 +3834,8 @@ e_day_view_reload_events (EDayView *day_view) { e_day_view_free_events (day_view); - if (!(day_view->client && cal_client_is_loaded (day_view->client))) + if (!(day_view->client + && cal_client_get_load_state (day_view->client) == CAL_CLIENT_LOAD_LOADED)) return; /* If both lower & upper are 0, then the time range hasn't been set, diff --git a/calendar/gui/e-day-view.h b/calendar/gui/e-day-view.h index 7e6ea8ac2a..b02bcd7710 100644 --- a/calendar/gui/e-day-view.h +++ b/calendar/gui/e-day-view.h @@ -2,9 +2,10 @@ /* * Author : - * Damon Chaplin + * Damon Chaplin * * Copyright 1999, Helix Code, Inc. + * Copyright 1999, Ximian, Inc. * * This program is free software; you can redistribute it and/or * modify it under the terms of the GNU General Public License as diff --git a/calendar/gui/e-itip-control.c b/calendar/gui/e-itip-control.c index e46d4a78ee..b72637137f 100644 --- a/calendar/gui/e-itip-control.c +++ b/calendar/gui/e-itip-control.c @@ -1,11 +1,24 @@ /* -*- Mode: C; tab-width: 8; indent-tabs-mode: t; c-basic-offset: 8 -*- */ -/* - * e-itip-control.c +/* Evolution calendar - Control for displaying iTIP mail messages + * + * Copyright (C) 2000 Helix Code, Inc. + * Copyright (C) 2000 Ximian, Inc. + * + * Author: Jesse Pavel + * + * This program is free software; you can redistribute it and/or modify + * it under the terms of the GNU General Public License as published by + * the Free Software Foundation; either version 2 of the License, or + * (at your option) any later version. * - * Authors: - * Jesse Pavel + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. * - * Copyright 2000, Helix Code, Inc. + * 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. */ #include @@ -126,29 +139,26 @@ itip_control_destroy_cb (GtkObject *object, static void -cal_loaded_cb (GtkObject *object, CalClientGetStatus status, gpointer data) +cal_opened_cb (CalClient *client, CalClientOpenStatus status, gpointer data) { - CalClient *client = CAL_CLIENT (object); EItipControlPrivate *priv = data; gtk_widget_hide (priv->loading_progress); - if (status == CAL_CLIENT_GET_SUCCESS) { + if (status == CAL_CLIENT_OPEN_SUCCESS) { if (cal_client_update_object (client, priv->cal_comp) == FALSE) { GtkWidget *dialog; dialog = gnome_warning_dialog("I couldn't update your calendar file!\n"); gnome_dialog_run (GNOME_DIALOG(dialog)); - } - else { + } else { /* We have success. */ GtkWidget *dialog; dialog = gnome_ok_dialog("Component successfully updated."); gnome_dialog_run (GNOME_DIALOG(dialog)); } - } - else { + } else { GtkWidget *dialog; dialog = gnome_ok_dialog("There was an error loading the calendar file."); @@ -169,10 +179,10 @@ update_calendar (EItipControlPrivate *priv) client = cal_client_new (); - gtk_signal_connect (GTK_OBJECT (client), "cal_loaded", - GTK_SIGNAL_FUNC (cal_loaded_cb), priv); + gtk_signal_connect (GTK_OBJECT (client), "cal_opened", + GTK_SIGNAL_FUNC (cal_opened_cb), priv); - if (cal_client_load_calendar (client, cal_uri) == FALSE) { + if (cal_client_open_calendar (client, cal_uri, FALSE) == FALSE) { GtkWidget *dialog; dialog = gnome_warning_dialog("I couldn't open your calendar file!\n"); @@ -407,11 +417,13 @@ load_calendar_store (char *cal_uri, CalClient **cal_client) } *cal_client = cal_client_new (); - if (cal_client_load_calendar (*cal_client, uri) == FALSE) { + if (cal_client_open_calendar (*cal_client, uri, FALSE) == FALSE) { return FALSE; } - while (!cal_client_is_loaded (*cal_client)) { + /* FIXME!!!!!! This is fucking ugly. */ + + while (!cal_client_get_load_state (*cal_client) != CAL_CLIENT_LOAD_LOADED) { gtk_main_iteration_do (FALSE); /* Do a non-blocking iteration. */ usleep (200000L); /* Pause for 1/5th of a second before checking again.*/ } diff --git a/calendar/gui/e-itip-control.h b/calendar/gui/e-itip-control.h index 467f0578ef..6c2df626ce 100644 --- a/calendar/gui/e-itip-control.h +++ b/calendar/gui/e-itip-control.h @@ -1,3 +1,25 @@ +/* Evolution calendar - Control for displaying iTIP mail messages + * + * Copyright (C) 2000 Helix Code, Inc. + * Copyright (C) 2000 Ximian, Inc. + * + * Author: Jesse Pavel + * + * This program is free software; you can redistribute it and/or modify + * it under the terms of the GNU General Public License as published by + * the Free Software Foundation; either version 2 of the License, or + * (at your option) any later version. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * 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. + */ + #ifndef __E_ITIP_CONTROL_H__ #define __E_ITIP_CONTROL_H__ diff --git a/calendar/gui/e-meeting-edit.c b/calendar/gui/e-meeting-edit.c index abff825a29..5b1b7bda7b 100644 --- a/calendar/gui/e-meeting-edit.c +++ b/calendar/gui/e-meeting-edit.c @@ -1,8 +1,9 @@ /* Evolution calendar - Meeting editor dialog * * Copyright (C) 2000 Helix Code, Inc. + * Copyright (C) 2000 Ximian, Inc. * - * Authors: Jesse Pavel + * Authors: Jesse Pavel * * This program is free software; you can redistribute it and/or modify * it under the terms of the GNU General Public License as published by diff --git a/calendar/gui/e-meeting-edit.h b/calendar/gui/e-meeting-edit.h index 953dd23428..b54909cad7 100644 --- a/calendar/gui/e-meeting-edit.h +++ b/calendar/gui/e-meeting-edit.h @@ -1,8 +1,9 @@ /* Evolution calendar - Meeting editor dialog * * Copyright (C) 2000 Helix Code, Inc. + * Copyright (C) 2000 Ximian, Inc. * - * Authors: Jesse Pavel + * Authors: Jesse Pavel * * This program is free software; you can redistribute it and/or modify * it under the terms of the GNU General Public License as published by diff --git a/calendar/gui/e-tasks.c b/calendar/gui/e-tasks.c index 29c067783a..9e88a91513 100644 --- a/calendar/gui/e-tasks.c +++ b/calendar/gui/e-tasks.c @@ -2,6 +2,7 @@ /* e-tasks.c * * Copyright (C) 2001 Helix Code, Inc. + * Copyright (C) 2001 Ximian, Inc. * * This program is free software; you can redistribute it and/or * modify it under the terms of the GNU General Public License as @@ -18,8 +19,8 @@ * Free Software Foundation, Inc., 59 Temple Place - Suite 330, * Boston, MA 02111-1307, USA. * - * Authors: Federico Mena Quintero - * Damon Chaplin + * Authors: Federico Mena Quintero + * Damon Chaplin */ #include @@ -28,32 +29,16 @@ #include #include "dialogs/task-editor.h" #include "e-calendar-table.h" -#include "alarm-notify.h" #include "component-factory.h" #include "e-tasks.h" -/* States for the calendar loading and creation state machine */ -typedef enum { - LOAD_STATE_NOT_LOADED, - LOAD_STATE_WAIT_LOAD, - LOAD_STATE_WAIT_LOAD_BEFORE_CREATE, - LOAD_STATE_WAIT_CREATE, - LOAD_STATE_LOADED -} LoadState; - /* Private part of the GnomeCalendar structure */ struct _ETasksPrivate { /* The calendar client object we monitor */ CalClient *client; - /* Loading state; we can be loading or creating a calendar */ - LoadState load_state; - - /* URI of the folder being shown. */ - char *folder_uri; - /* The ECalendarTable showing the tasks. */ GtkWidget *tasks_view; @@ -68,7 +53,7 @@ static void e_tasks_init (ETasks *tasks); static void setup_widgets (ETasks *tasks); static void e_tasks_destroy (GtkObject *object); -static void cal_loaded_cb (CalClient *client, CalClientLoadStatus status, gpointer data); +static void cal_opened_cb (CalClient *client, CalClientOpenStatus status, gpointer data); static void obj_updated_cb (CalClient *client, const char *uid, gpointer data); static void obj_removed_cb (CalClient *client, const char *uid, gpointer data); @@ -115,8 +100,6 @@ e_tasks_init (ETasks *tasks) priv = g_new0 (ETasksPrivate, 1); tasks->priv = priv; - priv->load_state = LOAD_STATE_NOT_LOADED; - setup_widgets (tasks); } @@ -138,6 +121,7 @@ setup_widgets (ETasks *tasks) ETasksPrivate *priv; ETable *etable; GtkWidget *hbox, *menuitem, *categories_label; + CalendarModel *model; priv = tasks->priv; @@ -165,13 +149,17 @@ setup_widgets (ETasks *tasks) priv->tasks_view = e_calendar_table_new (); + model = e_calendar_table_get_model (E_CALENDAR_TABLE (priv->tasks_view)); + calendar_model_set_new_comp_vtype (model, CAL_COMPONENT_TODO); etable = e_table_scrolled_get_table (E_TABLE_SCROLLED (E_CALENDAR_TABLE (priv->tasks_view)->etable)); e_table_set_state (etable, E_TASKS_TABLE_DEFAULT_STATE); gtk_table_attach (GTK_TABLE (tasks), priv->tasks_view, 0, 1, 1, 2, GTK_EXPAND | GTK_FILL, GTK_EXPAND | GTK_FILL, 0, 0); gtk_widget_show (priv->tasks_view); - gtk_signal_connect (GTK_OBJECT (E_CALENDAR_TABLE (priv->tasks_view)->model), "categories-changed", GTK_SIGNAL_FUNC (e_tasks_on_categories_changed), tasks); + gtk_signal_connect (GTK_OBJECT (E_CALENDAR_TABLE (priv->tasks_view)->model), + "categories-changed", + GTK_SIGNAL_FUNC (e_tasks_on_categories_changed), tasks); } @@ -189,14 +177,16 @@ e_tasks_construct (ETasks *tasks) if (!priv->client) return NULL; - gtk_signal_connect (GTK_OBJECT (priv->client), "cal_loaded", - GTK_SIGNAL_FUNC (cal_loaded_cb), tasks); + gtk_signal_connect (GTK_OBJECT (priv->client), "cal_opened", + GTK_SIGNAL_FUNC (cal_opened_cb), tasks); gtk_signal_connect (GTK_OBJECT (priv->client), "obj_updated", GTK_SIGNAL_FUNC (obj_updated_cb), tasks); gtk_signal_connect (GTK_OBJECT (priv->client), "obj_removed", GTK_SIGNAL_FUNC (obj_removed_cb), tasks); +#if 0 alarm_notify_add_client (priv->client); +#endif e_calendar_table_set_cal_client (E_CALENDAR_TABLE (priv->tasks_view), priv->client); @@ -241,15 +231,10 @@ e_tasks_destroy (GtkObject *object) config_filename); g_free (config_filename); - priv->load_state = LOAD_STATE_NOT_LOADED; - - if (priv->folder_uri) { - g_free (priv->folder_uri); - priv->folder_uri = NULL; - } - if (priv->client) { +#if 0 alarm_notify_remove_client (priv->client); +#endif gtk_object_unref (GTK_OBJECT (priv->client)); priv->client = NULL; } @@ -264,8 +249,7 @@ e_tasks_destroy (GtkObject *object) gboolean e_tasks_open (ETasks *tasks, - char *file, - ETasksOpenMode gcom) + char *file) { ETasksPrivate *priv; char *config_filename; @@ -275,21 +259,6 @@ e_tasks_open (ETasks *tasks, g_return_val_if_fail (file != NULL, FALSE); priv = tasks->priv; - g_return_val_if_fail (priv->load_state == LOAD_STATE_NOT_LOADED, - FALSE); - - g_assert (priv->folder_uri == NULL); - - priv->folder_uri = g_strdup (file); - - if (gcom == E_TASKS_OPEN) - priv->load_state = LOAD_STATE_WAIT_LOAD; - else if (gcom == E_TASKS_OPEN_OR_CREATE) - priv->load_state = LOAD_STATE_WAIT_LOAD_BEFORE_CREATE; - else { - g_assert_not_reached (); - return FALSE; - } config_filename = e_tasks_get_config_filename (tasks); e_calendar_table_load_state (E_CALENDAR_TABLE (priv->tasks_view), @@ -297,11 +266,7 @@ e_tasks_open (ETasks *tasks, g_free (config_filename); - if (!cal_client_load_calendar (priv->client, file)) { - priv->load_state = LOAD_STATE_NOT_LOADED; - g_free (priv->folder_uri); - priv->folder_uri = NULL; - + if (!cal_client_open_calendar (priv->client, file, FALSE)) { g_message ("e_tasks_open(): Could not issue the request"); return FALSE; } @@ -310,19 +275,6 @@ e_tasks_open (ETasks *tasks, } -/* Loads the initial data into the calendar; this should be called right after - * the cal_loaded signal from the client is invoked. - */ -static void -initial_load (ETasks *tasks) -{ - ETasksPrivate *priv; - - priv = tasks->priv; - - /* FIXME: Do we need to do anything? */ -} - /* Displays an error to indicate that loading a calendar failed */ static void load_error (ETasks *tasks, @@ -335,19 +287,6 @@ load_error (ETasks *tasks, g_free (msg); } -/* Displays an error to indicate that creating a calendar failed */ -static void -create_error (ETasks *tasks, - const char *uri) -{ - char *msg; - - msg = g_strdup_printf (_("Could not create a tasks file in `%s'"), - uri); - gnome_error_dialog_parented (msg, GTK_WINDOW (gtk_widget_get_toplevel (GTK_WIDGET (tasks)))); - g_free (msg); -} - /* Displays an error to indicate that the specified URI method is not supported */ static void method_error (ETasks *tasks, @@ -360,89 +299,34 @@ method_error (ETasks *tasks, g_free (msg); } -/* Callback from the calendar client when a calendar is loaded */ +/* Callback from the calendar client when a calendar is opened */ static void -cal_loaded_cb (CalClient *client, - CalClientLoadStatus status, +cal_opened_cb (CalClient *client, + CalClientOpenStatus status, gpointer data) { ETasks *tasks; ETasksPrivate *priv; - gboolean free_uri; tasks = E_TASKS (data); priv = tasks->priv; - g_assert (priv->load_state != LOAD_STATE_NOT_LOADED - && priv->load_state != LOAD_STATE_LOADED); - g_assert (priv->folder_uri != NULL); - - free_uri = TRUE; - - switch (priv->load_state) { - case LOAD_STATE_WAIT_LOAD: - if (status == CAL_CLIENT_LOAD_SUCCESS) { - priv->load_state = LOAD_STATE_LOADED; - initial_load (tasks); - } else if (status == CAL_CLIENT_LOAD_ERROR) { - priv->load_state = LOAD_STATE_NOT_LOADED; - load_error (tasks, priv->folder_uri); - } else if (status == CAL_CLIENT_LOAD_METHOD_NOT_SUPPORTED) { - priv->load_state = LOAD_STATE_NOT_LOADED; - method_error (tasks, priv->folder_uri); - } else - g_assert_not_reached (); + switch (status) { + case CAL_CLIENT_OPEN_SUCCESS: + /* Everything is OK */ + return; + case CAL_CLIENT_OPEN_ERROR: + load_error (tasks, cal_client_get_uri (client)); break; - case LOAD_STATE_WAIT_LOAD_BEFORE_CREATE: - if (status == CAL_CLIENT_LOAD_SUCCESS) { - priv->load_state = LOAD_STATE_LOADED; - initial_load (tasks); - } else if (status == CAL_CLIENT_LOAD_ERROR) { - priv->load_state = LOAD_STATE_WAIT_CREATE; - free_uri = FALSE; - - if (!cal_client_create_calendar (priv->client, - priv->folder_uri)) { - priv->load_state = LOAD_STATE_NOT_LOADED; - free_uri = TRUE; - g_message ("cal_loaded_cb(): Could not issue the create request"); - } - } else if (status == CAL_CLIENT_LOAD_METHOD_NOT_SUPPORTED) { - priv->load_state = LOAD_STATE_NOT_LOADED; - method_error (tasks, priv->folder_uri); - } else - g_assert_not_reached (); - - break; - - case LOAD_STATE_WAIT_CREATE: - if (status == CAL_CLIENT_LOAD_SUCCESS) { - priv->load_state = LOAD_STATE_LOADED; - initial_load (tasks); - } else if (status == CAL_CLIENT_LOAD_ERROR) { - priv->load_state = LOAD_STATE_NOT_LOADED; - create_error (tasks, priv->folder_uri); - } else if (status == CAL_CLIENT_LOAD_IN_USE) { - /* Someone created the URI while we were issuing the - * create request, so we just try to reload. - */ - priv->load_state = LOAD_STATE_WAIT_LOAD; - free_uri = FALSE; - - if (!cal_client_load_calendar (priv->client, - priv->folder_uri)) { - priv->load_state = LOAD_STATE_NOT_LOADED; - free_uri = TRUE; - g_message ("cal_loaded_cb(): Could not issue the load request"); - } - } else if (status == CAL_CLIENT_LOAD_METHOD_NOT_SUPPORTED) { - priv->load_state = LOAD_STATE_NOT_LOADED; - method_error (tasks, priv->folder_uri); - } else - g_assert_not_reached (); + case CAL_CLIENT_OPEN_NOT_FOUND: + /* bullshit; we did not specify only_if_exists */ + g_assert_not_reached (); + return; + case CAL_CLIENT_OPEN_METHOD_NOT_SUPPORTED: + method_error (tasks, cal_client_get_uri (client)); break; default: @@ -491,7 +375,7 @@ e_tasks_get_config_filename (ETasks *tasks) priv = tasks->priv; - url = g_strdup (priv->folder_uri); + url = g_strdup (cal_client_get_uri (priv->client)); /* This turns all funny characters into '_', in the string itself. */ e_filename_make_safe (url); diff --git a/calendar/gui/e-tasks.h b/calendar/gui/e-tasks.h index a777c32375..f63ac92a65 100644 --- a/calendar/gui/e-tasks.h +++ b/calendar/gui/e-tasks.h @@ -2,6 +2,7 @@ /* e-tasks.h * * Copyright (C) 2001 Helix Code, Inc. + * Copyright (C) 2001 Ximian, Inc. * * This program is free software; you can redistribute it and/or * modify it under the terms of the GNU General Public License as @@ -18,8 +19,8 @@ * Free Software Foundation, Inc., 59 Temple Place - Suite 330, * Boston, MA 02111-1307, USA. * - * Authors: Federico Mena Quintero - * Damon Chaplin + * Authors: Federico Mena Quintero + * Damon Chaplin */ #ifndef _E_TASKS_H_ @@ -51,19 +52,13 @@ struct _ETasksClass { }; -typedef enum { - E_TASKS_OPEN, - E_TASKS_OPEN_OR_CREATE -} ETasksOpenMode; - GtkType e_tasks_get_type (void); GtkWidget *e_tasks_construct (ETasks *tasks); GtkWidget *e_tasks_new (void); gboolean e_tasks_open (ETasks *tasks, - char *file, - ETasksOpenMode gcom); + char *file); CalClient *e_tasks_get_cal_client (ETasks *tasks); diff --git a/calendar/gui/e-week-view-event-item.c b/calendar/gui/e-week-view-event-item.c index ee77573f6e..5615e86bb6 100644 --- a/calendar/gui/e-week-view-event-item.c +++ b/calendar/gui/e-week-view-event-item.c @@ -2,9 +2,10 @@ /* * Author : - * Damon Chaplin + * Damon Chaplin * * Copyright 1999, Helix Code, Inc. + * Copyright 2001, Ximian, Inc. * * This program is free software; you can redistribute it and/or * modify it under the terms of the GNU General Public License as diff --git a/calendar/gui/e-week-view-event-item.h b/calendar/gui/e-week-view-event-item.h index cfe58699b0..ff2b9b2c9f 100644 --- a/calendar/gui/e-week-view-event-item.h +++ b/calendar/gui/e-week-view-event-item.h @@ -2,9 +2,10 @@ /* * Author : - * Damon Chaplin + * Damon Chaplin * * Copyright 1999, Helix Code, Inc. + * Copyright 2001, Ximian, Inc. * * This program is free software; you can redistribute it and/or * modify it under the terms of the GNU General Public License as diff --git a/calendar/gui/e-week-view-main-item.h b/calendar/gui/e-week-view-main-item.h index f75dcb0ec9..71ebe423dc 100644 --- a/calendar/gui/e-week-view-main-item.h +++ b/calendar/gui/e-week-view-main-item.h @@ -2,9 +2,10 @@ /* * Author : - * Damon Chaplin + * Damon Chaplin * * Copyright 1999, Helix Code, Inc. + * Copyright 2001, Ximian, Inc. * * This program is free software; you can redistribute it and/or * modify it under the terms of the GNU General Public License as diff --git a/calendar/gui/e-week-view-titles-item.h b/calendar/gui/e-week-view-titles-item.h index 7ce1ccd386..fc4d45107d 100644 --- a/calendar/gui/e-week-view-titles-item.h +++ b/calendar/gui/e-week-view-titles-item.h @@ -2,9 +2,10 @@ /* * Author : - * Damon Chaplin + * Damon Chaplin * * Copyright 1999, Helix Code, Inc. + * Copyright 2001, Ximian, Inc. * * This program is free software; you can redistribute it and/or * modify it under the terms of the GNU General Public License as diff --git a/calendar/gui/e-week-view.c b/calendar/gui/e-week-view.c index 0b7743e970..b205bdc34e 100644 --- a/calendar/gui/e-week-view.c +++ b/calendar/gui/e-week-view.c @@ -2,9 +2,10 @@ /* * Author : - * Damon Chaplin + * Damon Chaplin * * Copyright 1999, Helix Code, Inc. + * Copyright 2001, Ximian, Inc. * * This program is free software; you can redistribute it and/or * modify it under the terms of the GNU General Public License as @@ -831,15 +832,15 @@ e_week_view_set_calendar (EWeekView *week_view, } -/* Callback used when the calendar client finishes loading */ +/* Callback used when the calendar client finishes opening */ static void -cal_loaded_cb (CalClient *client, CalClientLoadStatus status, gpointer data) +cal_opened_cb (CalClient *client, CalClientOpenStatus status, gpointer data) { EWeekView *week_view; week_view = E_WEEK_VIEW (data); - if (status != CAL_CLIENT_LOAD_SUCCESS) + if (status != CAL_CLIENT_OPEN_SUCCESS) return; e_week_view_queue_reload_events (week_view); @@ -976,9 +977,9 @@ e_week_view_set_cal_client (EWeekView *week_view, week_view->client = client; if (week_view->client) { - if (!cal_client_is_loaded (week_view->client)) - gtk_signal_connect (GTK_OBJECT (week_view->client), "cal_loaded", - GTK_SIGNAL_FUNC (cal_loaded_cb), week_view); + if (cal_client_get_load_state (week_view->client) != CAL_CLIENT_LOAD_LOADED) + gtk_signal_connect (GTK_OBJECT (week_view->client), "cal_opened", + GTK_SIGNAL_FUNC (cal_opened_cb), week_view); gtk_signal_connect (GTK_OBJECT (week_view->client), "obj_updated", GTK_SIGNAL_FUNC (obj_updated_cb), week_view); @@ -2012,7 +2013,8 @@ e_week_view_reload_events (EWeekView *week_view) e_week_view_free_events (week_view); - if (!(week_view->client && cal_client_is_loaded (week_view->client))) + if (!(week_view->client + && cal_client_get_load_state (week_view->client) == CAL_CLIENT_LOAD_LOADED)) return; /* Only load events if the date range has been set. */ diff --git a/calendar/gui/e-week-view.h b/calendar/gui/e-week-view.h index aa9ba05fb9..be2f1057da 100644 --- a/calendar/gui/e-week-view.h +++ b/calendar/gui/e-week-view.h @@ -2,9 +2,10 @@ /* * Author : - * Damon Chaplin + * Damon Chaplin * * Copyright 1999, Helix Code, Inc. + * Copyright 2001, Ximian, Inc. * * This program is free software; you can redistribute it and/or * modify it under the terms of the GNU General Public License as diff --git a/calendar/gui/event-editor.c b/calendar/gui/event-editor.c index 16a9737b35..350de507e7 100644 --- a/calendar/gui/event-editor.c +++ b/calendar/gui/event-editor.c @@ -3,10 +3,11 @@ /* Evolution calendar - Event editor dialog * * Copyright (C) 2000 Helix Code, Inc. + * Copyright (C) 2001 Ximian, Inc. * - * Authors: Miguel de Icaza - * Federico Mena-Quintero - * Seth Alves + * Authors: Miguel de Icaza + * Federico Mena-Quintero + * Seth Alves * * This program is free software; you can redistribute it and/or modify * it under the terms of the GNU General Public License as published by @@ -75,7 +76,7 @@ struct _EventEditorPrivate { /* Client to use */ CalClient *client; - + /* Calendar object/uid we are editing; this is an internal copy */ CalComponent *comp; @@ -113,7 +114,7 @@ struct _EventEditorPrivate { GtkWidget *categories; GtkWidget *categories_btn; - + GtkWidget *recurrence_summary; GtkWidget *recurrence_starting_date; @@ -325,7 +326,7 @@ make_title_from_comp (CalComponent *comp) const char *summary; CalComponentVType type; CalComponentText text; - + if (!comp) return g_strdup (_("Edit Appointment")); @@ -335,7 +336,7 @@ make_title_from_comp (CalComponent *comp) else summary = _("No summary"); - + type = cal_component_get_vtype (comp); switch (type) { case CAL_COMPONENT_EVENT: @@ -845,7 +846,7 @@ sensitize_recur_widgets (EventEditor *ee) g_assert_not_reached (); } } - + /* Callback used when one of the recurrence type radio buttons is toggled. We * enable or the recurrence parameters. */ @@ -1869,7 +1870,7 @@ fill_widgets (EventEditor *ee) GSList *l; time_t dtstart, dtend; const char *categories; - + priv = ee->priv; clear_widgets (ee); @@ -1888,7 +1889,7 @@ fill_widgets (EventEditor *ee) e_dialog_editable_set (priv->description, text.value); } cal_component_free_text_list (l); - + /* Start and end times */ /* All-day events are inclusive, i.e. if the end date shown is 2nd Feb @@ -1984,7 +1985,7 @@ fill_widgets (EventEditor *ee) /** * event_editor_update_widgets: * @ee: An event editor. - * + * * Causes an event editor dialog to re-read the values of its calendar component * object. This function should be used if the #CalComponent is changed by * external means while it is open in the editor. @@ -2232,7 +2233,7 @@ recur_to_comp_object (EventEditor *ee, CalComponent *comp) tim = gtk_clist_get_row_data (exception_list, i); *cdt->value = icaltime_from_timet (*tim, FALSE, TRUE); - + list = g_slist_prepend (list, cdt); } @@ -2249,7 +2250,7 @@ dialog_to_comp_object (EventEditor *ee, CalComponent *comp) time_t t; gboolean all_day_event; char *cat, *str; - + priv = ee->priv; /* Summary */ @@ -2285,12 +2286,12 @@ dialog_to_comp_object (EventEditor *ee, CalComponent *comp) cal_component_set_description_list (comp, &l); } - + if (!str) g_free (str); /* Dates */ - + date.value = g_new (struct icaltimetype, 1); date.tzid = NULL; @@ -2400,7 +2401,7 @@ debug_xml_cb (BonoboUIComponent *uic, gpointer data, const char *path) { EventEditor *ee = EVENT_EDITOR (data); EventEditorPrivate *priv = ee->priv; - + bonobo_window_dump (BONOBO_WINDOW (priv->app), "on demand"); } @@ -2431,13 +2432,13 @@ file_delete_cb (BonoboUIComponent *uic, gpointer data, const char *path) { EventEditor *ee; EventEditorPrivate *priv; - + ee = EVENT_EDITOR (data); g_return_if_fail (IS_EVENT_EDITOR (ee)); priv = ee->priv; - + g_return_if_fail (priv->comp); if (delete_component_dialog (priv->comp, priv->app)) { @@ -2496,9 +2497,9 @@ static BonoboUIVerb verbs [] = { BONOBO_UI_VERB ("FileDelete", file_delete_cb), BONOBO_UI_VERB ("FileClose", file_close_cb), BONOBO_UI_VERB ("FileSaveAndClose", file_save_and_close_cb), - + BONOBO_UI_VERB ("ActionScheduleMeeting", schedule_meeting_cb), - + BONOBO_UI_VERB ("DebugDumpXml", debug_xml_cb), BONOBO_UI_VERB_END @@ -2525,9 +2526,9 @@ app_delete_event_cb (GtkWidget *widget, GdkEvent *event, gpointer data) /** * event_editor_construct: * @ee: An event editor. - * + * * Constructs an event editor by loading its Glade data. - * + * * Return value: The same object as @ee, or NULL if the widgets could not be * created. In the latter case, the event editor will automatically be * destroyed. @@ -2604,7 +2605,7 @@ event_editor_construct (EventEditor *ee) /* Add focus to the summary entry */ - + gtk_widget_grab_focus (GTK_WIDGET (priv->general_summary)); /* Show the dialog */ @@ -2621,9 +2622,9 @@ event_editor_construct (EventEditor *ee) /** * event_editor_new: - * + * * Creates a new event editor dialog. - * + * * Return value: A newly-created event editor dialog, or NULL if the event * editor could not be created. **/ @@ -2660,7 +2661,7 @@ obj_updated_cb (CalClient *client, const char *uid, gpointer data) g_return_if_fail (IS_EVENT_EDITOR (ee)); priv = ee->priv; - + /* If we aren't showing the object which has been updated, return. */ if (!priv->comp) return; @@ -2723,11 +2724,11 @@ obj_removed_cb (CalClient *client, const char *uid, gpointer data) * event_editor_set_cal_client: * @ee: An event editor. * @client: Calendar client. - * + * * Sets the calendar client than an event editor will use for updating its * calendar components. **/ -void +void event_editor_set_cal_client (EventEditor *ee, CalClient *client) { EventEditorPrivate *priv; @@ -2744,8 +2745,8 @@ event_editor_set_cal_client (EventEditor *ee, CalClient *client) g_return_if_fail (IS_CAL_CLIENT (client)); if (client) - g_return_if_fail (cal_client_is_loaded (client)); - + g_return_if_fail (cal_client_get_load_state (client) == CAL_CLIENT_LOAD_LOADED); + if (client) gtk_object_ref (GTK_OBJECT (client)); @@ -2767,10 +2768,10 @@ event_editor_set_cal_client (EventEditor *ee, CalClient *client) /** * event_editor_get_cal_client: * @ee: An event editor. - * + * * Queries the calendar client that an event editor is using to update its * calendar components. - * + * * Return value: A calendar client object. **/ CalClient * @@ -2789,7 +2790,7 @@ event_editor_get_cal_client (EventEditor *ee) * event_editor_set_event_object: * @ee: An event editor. * @comp: A calendar object. - * + * * Sets the calendar object that an event editor dialog will manipulate. **/ void @@ -2818,7 +2819,7 @@ event_editor_set_event_object (EventEditor *ee, CalComponent *comp) /** * event_editor_focus: * @ee: An event editor. - * + * * Makes sure an event editor is shown, on top of other windows, and focused. **/ void @@ -3275,7 +3276,7 @@ prompt_to_save_changes (EventEditor *ee) gnome_dialog_set_parent (GNOME_DIALOG (dialog), GTK_WINDOW (priv->app)); - + switch (gnome_dialog_run_and_close (GNOME_DIALOG (dialog))) { case 0: /* Save */ /* FIXME: If an error occurs here, we should popup a dialog @@ -3305,7 +3306,7 @@ categories_clicked (GtkWidget *button, EventEditor *ee) dialog = GNOME_DIALOG (e_categories_new (categories)); result = gnome_dialog_run (dialog); g_free (categories); - + if (result == 0) { gtk_object_get (GTK_OBJECT (dialog), "categories", &categories, diff --git a/calendar/gui/event-editor.h b/calendar/gui/event-editor.h index 1be61eb860..60be54c784 100644 --- a/calendar/gui/event-editor.h +++ b/calendar/gui/event-editor.h @@ -1,10 +1,11 @@ /* Evolution calendar - Event editor dialog * * Copyright (C) 2000 Helix Code, Inc. + * Copyright (C) 2001 Ximian, Inc. * - * Authors: Miguel de Icaza - * Federico Mena-Quintero - * Seth Alves + * Authors: Miguel de Icaza + * Federico Mena-Quintero + * Seth Alves * * This program is free software; you can redistribute it and/or modify * it under the terms of the GNU General Public License as published by diff --git a/calendar/gui/gnome-cal.c b/calendar/gui/gnome-cal.c index fafd31d583..3cd835680d 100644 --- a/calendar/gui/gnome-cal.c +++ b/calendar/gui/gnome-cal.c @@ -1,10 +1,27 @@ /* -*- Mode: C; tab-width: 8; indent-tabs-mode: t; c-basic-offset: 8 -*- */ -/* - * GnomeCalendar widget - * Copyright (C) 1998 the Free Software Foundation +/* Evolution calendar - Main calendar view widget * - * Authors: Miguel de Icaza (miguel@kernel.org) - * Federico Mena-Quintero + * Copyright (C) 1998 The Free Software Foundation + * Copyright (C) 2000 Helix Code, Inc. + * Copyright (C) 2001 Ximian, Inc. + * + * Authors: Miguel de Icaza + * Federico Mena-Quintero + * Seth Alves + * + * This program is free software; you can redistribute it and/or modify + * it under the terms of the GNU General Public License as published by + * the Free Software Foundation; either version 2 of the License, or + * (at your option) any later version. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * 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. */ #include @@ -18,7 +35,6 @@ #include #include #include "dialogs/alarm-notify-dialog.h" -#include "alarm-notify.h" #include "e-calendar-table.h" #include "e-day-view.h" #include "e-week-view.h" @@ -40,30 +56,14 @@ typedef enum { VIEW_MONTH } ViewType; -/* States for the calendar loading and creation state machine */ -typedef enum { - LOAD_STATE_NOT_LOADED, - LOAD_STATE_WAIT_LOAD, - LOAD_STATE_WAIT_LOAD_BEFORE_CREATE, - LOAD_STATE_WAIT_CREATE, - LOAD_STATE_LOADED -} LoadState; - /* Private part of the GnomeCalendar structure */ struct _GnomeCalendarPrivate { - /* * The Calendar Folder. */ /* The calendar client object we monitor */ - CalClient *client; - - /* Loading state; we can be loading or creating a calendar */ - LoadState load_state; - - /* URI being loaded, NULL if we are not being loaded */ - char *loading_uri; + CalClient *client; /* * The TaskPad Folder. @@ -72,13 +72,9 @@ struct _GnomeCalendarPrivate { /* The calendar client object we monitor */ CalClient *task_pad_client; - /* Loading state; we can be loading or creating a calendar */ - LoadState task_pad_load_state; - - /* URI being loaded, NULL if we are not being loaded */ - char *task_pad_loading_uri; - - + /* + * Fields for the calendar view + */ /* Mapping of component UIDs to event editors */ GHashTable *object_editor_hash; @@ -209,6 +205,7 @@ setup_widgets (GnomeCalendar *gcal) GnomeCalendarPrivate *priv; GtkWidget *w; gchar *filename; + CalendarModel *model; priv = gcal->priv; @@ -257,6 +254,8 @@ setup_widgets (GnomeCalendar *gcal) /* The ToDo list. */ priv->todo = e_calendar_table_new (); + model = e_calendar_table_get_model (E_CALENDAR_TABLE (priv->todo)); + calendar_model_set_new_comp_vtype (model, CAL_COMPONENT_TODO); e_paned_pack2 (E_PANED (priv->vpane), priv->todo, TRUE, TRUE); gtk_widget_show (priv->todo); @@ -308,9 +307,6 @@ gnome_calendar_init (GnomeCalendar *gcal) priv = g_new0 (GnomeCalendarPrivate, 1); gcal->priv = priv; - priv->load_state = LOAD_STATE_NOT_LOADED; - priv->task_pad_load_state = LOAD_STATE_NOT_LOADED; - priv->object_editor_hash = g_hash_table_new (g_str_hash, g_str_equal); priv->current_view_type = VIEW_NOT_SET; @@ -350,27 +346,18 @@ gnome_calendar_destroy (GtkObject *object) e_calendar_table_save_state (E_CALENDAR_TABLE (priv->todo), filename); g_free (filename); - priv->load_state = LOAD_STATE_NOT_LOADED; - priv->task_pad_load_state = LOAD_STATE_NOT_LOADED; - - if (priv->loading_uri) { - g_free (priv->loading_uri); - priv->loading_uri = NULL; - } - - if (priv->task_pad_loading_uri) { - g_free (priv->task_pad_loading_uri); - priv->task_pad_loading_uri = NULL; - } - if (priv->client) { +#if 0 alarm_notify_remove_client (priv->client); +#endif gtk_object_unref (GTK_OBJECT (priv->client)); priv->client = NULL; } if (priv->task_pad_client) { +#if 0 alarm_notify_remove_client (priv->task_pad_client); +#endif gtk_object_unref (GTK_OBJECT (priv->task_pad_client)); priv->task_pad_client = NULL; } @@ -688,7 +675,7 @@ gnome_calendar_set_pane_positions (GnomeCalendar *gcal) } /* Loads the initial data into the calendar; this should be called right after - * the cal_loaded signal from the client is invoked. + * the cal_opened signal from the client is invoked. */ static void initial_load (GnomeCalendar *gcal) @@ -700,24 +687,13 @@ initial_load (GnomeCalendar *gcal) tag_calendar_by_client (priv->date_navigator, priv->client); } -/* Displays an error to indicate that loading a calendar failed */ -static void -load_error (GnomeCalendar *gcal, const char *uri) -{ - char *msg; - - msg = g_strdup_printf (_("Could not load the folder in `%s'"), uri); - gnome_error_dialog_parented (msg, GTK_WINDOW (gtk_widget_get_toplevel (GTK_WIDGET (gcal)))); - g_free (msg); -} - -/* Displays an error to indicate that creating a calendar failed */ +/* Displays an error to indicate that opening a calendar failed */ static void -create_error (GnomeCalendar *gcal, const char *uri) +open_error (GnomeCalendar *gcal, const char *uri) { char *msg; - msg = g_strdup_printf (_("Could not create a folder in `%s'"), uri); + msg = g_strdup_printf (_("Could not open the folder in `%s'"), uri); gnome_error_dialog_parented (msg, GTK_WINDOW (gtk_widget_get_toplevel (GTK_WIDGET (gcal)))); g_free (msg); } @@ -728,118 +704,44 @@ method_error (GnomeCalendar *gcal, const char *uri) { char *msg; - msg = g_strdup_printf (_("The method required to load `%s' is not supported"), uri); + msg = g_strdup_printf (_("The method required to open `%s' is not supported"), uri); gnome_error_dialog_parented (msg, GTK_WINDOW (gtk_widget_get_toplevel (GTK_WIDGET (gcal)))); g_free (msg); } /* Callback from the calendar client when a calendar is loaded */ static void -cal_loaded_cb (CalClient *client, CalClientLoadStatus status, gpointer data) +cal_opened_cb (CalClient *client, CalClientOpenStatus status, gpointer data) { GnomeCalendar *gcal; GnomeCalendarPrivate *priv; - gboolean free_uri, is_calendar = FALSE; - LoadState *load_state; - char **loading_uri; gcal = GNOME_CALENDAR (data); priv = gcal->priv; - if (client == priv->client) { - is_calendar = TRUE; - load_state = &priv->load_state; - loading_uri = &priv->loading_uri; - } else if (client == priv->task_pad_client) { - load_state = &priv->task_pad_load_state; - loading_uri = &priv->task_pad_loading_uri; - } else { - g_assert_not_reached (); - return; - } - - g_assert (*load_state != LOAD_STATE_NOT_LOADED - && *load_state != LOAD_STATE_LOADED); - g_assert (*loading_uri != NULL); - - free_uri = TRUE; - - switch (*load_state) { - case LOAD_STATE_WAIT_LOAD: - if (status == CAL_CLIENT_LOAD_SUCCESS) { - *load_state = LOAD_STATE_LOADED; - if (is_calendar) - initial_load (gcal); - } else if (status == CAL_CLIENT_LOAD_ERROR) { - *load_state = LOAD_STATE_NOT_LOADED; - load_error (gcal, *loading_uri); - } else if (status == CAL_CLIENT_LOAD_METHOD_NOT_SUPPORTED) { - *load_state = LOAD_STATE_NOT_LOADED; - method_error (gcal, *loading_uri); - } else - g_assert_not_reached (); + switch (status) { + case CAL_CLIENT_OPEN_SUCCESS: + if (client == priv->client) + initial_load (gcal); break; - case LOAD_STATE_WAIT_LOAD_BEFORE_CREATE: - if (status == CAL_CLIENT_LOAD_SUCCESS) { - *load_state = LOAD_STATE_LOADED; - if (is_calendar) - initial_load (gcal); - } else if (status == CAL_CLIENT_LOAD_ERROR) { - *load_state = LOAD_STATE_WAIT_CREATE; - free_uri = FALSE; - - if (!cal_client_create_calendar (client, - *loading_uri)) { - *load_state = LOAD_STATE_NOT_LOADED; - free_uri = TRUE; - g_message ("cal_loaded_cb(): Could not issue the create request"); - } - } else if (status == CAL_CLIENT_LOAD_METHOD_NOT_SUPPORTED) { - *load_state = LOAD_STATE_NOT_LOADED; - method_error (gcal, *loading_uri); - } else - g_assert_not_reached (); - + case CAL_CLIENT_OPEN_ERROR: + open_error (gcal, cal_client_get_uri (client)); break; - case LOAD_STATE_WAIT_CREATE: - if (status == CAL_CLIENT_LOAD_SUCCESS) { - *load_state = LOAD_STATE_LOADED; - if (is_calendar) - initial_load (gcal); - } else if (status == CAL_CLIENT_LOAD_ERROR) { - *load_state = LOAD_STATE_NOT_LOADED; - create_error (gcal, *loading_uri); - } else if (status == CAL_CLIENT_LOAD_IN_USE) { - /* Someone created the URI while we were issuing the - * create request, so we just try to reload. - */ - *load_state = LOAD_STATE_WAIT_LOAD; - free_uri = FALSE; - - if (!cal_client_load_calendar (client, - *loading_uri)) { - *load_state = LOAD_STATE_NOT_LOADED; - free_uri = TRUE; - g_message ("cal_loaded_cb(): Could not issue the load request"); - } - } else if (status == CAL_CLIENT_LOAD_METHOD_NOT_SUPPORTED) { - *load_state = LOAD_STATE_NOT_LOADED; - method_error (gcal, *loading_uri); - } else - g_assert_not_reached (); + case CAL_CLIENT_OPEN_NOT_FOUND: + /* bullshit; we did not specify only_if_exists */ + g_assert_not_reached (); + return; + case CAL_CLIENT_OPEN_METHOD_NOT_SUPPORTED: + method_error (gcal, cal_client_get_uri (client)); break; default: g_assert_not_reached (); - } - - if (free_uri) { - g_free (*loading_uri); - *loading_uri = NULL; + return; } } @@ -888,14 +790,16 @@ gnome_calendar_construct (GnomeCalendar *gcal) if (!priv->client) return NULL; - gtk_signal_connect (GTK_OBJECT (priv->client), "cal_loaded", - GTK_SIGNAL_FUNC (cal_loaded_cb), gcal); + gtk_signal_connect (GTK_OBJECT (priv->client), "cal_opened", + GTK_SIGNAL_FUNC (cal_opened_cb), gcal); gtk_signal_connect (GTK_OBJECT (priv->client), "obj_updated", GTK_SIGNAL_FUNC (obj_updated_cb), gcal); gtk_signal_connect (GTK_OBJECT (priv->client), "obj_removed", GTK_SIGNAL_FUNC (obj_removed_cb), gcal); +#if 0 alarm_notify_add_client (priv->client); +#endif e_day_view_set_cal_client (E_DAY_VIEW (priv->day_view), priv->client); @@ -913,10 +817,12 @@ gnome_calendar_construct (GnomeCalendar *gcal) if (!priv->task_pad_client) return NULL; - gtk_signal_connect (GTK_OBJECT (priv->task_pad_client), "cal_loaded", - GTK_SIGNAL_FUNC (cal_loaded_cb), gcal); + gtk_signal_connect (GTK_OBJECT (priv->task_pad_client), "cal_opened", + GTK_SIGNAL_FUNC (cal_opened_cb), gcal); +#if 0 alarm_notify_add_client (priv->task_pad_client); +#endif e_calendar_table_set_cal_client (E_CALENDAR_TABLE (priv->todo), priv->task_pad_client); @@ -982,40 +888,27 @@ gnome_calendar_get_cal_client (GnomeCalendar *gcal) } gboolean -gnome_calendar_open (GnomeCalendar *gcal, char *file, GnomeCalendarOpenMode gcom) +gnome_calendar_open (GnomeCalendar *gcal, char *str_uri) { GnomeCalendarPrivate *priv; - LoadState initial_load_state; + char *tasks_uri; + gboolean success; g_return_val_if_fail (gcal != NULL, FALSE); g_return_val_if_fail (GNOME_IS_CALENDAR (gcal), FALSE); - g_return_val_if_fail (file != NULL, FALSE); + g_return_val_if_fail (str_uri != NULL, FALSE); priv = gcal->priv; - g_return_val_if_fail (priv->load_state == LOAD_STATE_NOT_LOADED, FALSE); - g_return_val_if_fail (priv->task_pad_load_state == LOAD_STATE_NOT_LOADED, FALSE); - - g_assert (priv->loading_uri == NULL); - g_assert (priv->task_pad_loading_uri == NULL); - - priv->loading_uri = g_strdup (file); - - if (gcom == CALENDAR_OPEN) - priv->load_state = LOAD_STATE_WAIT_LOAD; - else if (gcom == CALENDAR_OPEN_OR_CREATE) - priv->load_state = LOAD_STATE_WAIT_LOAD_BEFORE_CREATE; - else { - g_assert_not_reached (); - return FALSE; - } - initial_load_state = priv->load_state; + g_return_val_if_fail ( + cal_client_get_load_state (priv->client) == CAL_CLIENT_LOAD_NOT_LOADED, + FALSE); - if (!cal_client_load_calendar (priv->client, file)) { - priv->load_state = LOAD_STATE_NOT_LOADED; - g_free (priv->loading_uri); - priv->loading_uri = NULL; + g_return_val_if_fail ( + cal_client_get_load_state (priv->task_pad_client) == CAL_CLIENT_LOAD_NOT_LOADED, + FALSE); + if (!cal_client_open_calendar (priv->client, str_uri, FALSE)) { g_message ("gnome_calendar_open(): Could not issue the request"); return FALSE; } @@ -1023,15 +916,12 @@ gnome_calendar_open (GnomeCalendar *gcal, char *file, GnomeCalendarOpenMode gcom /* Open the appropriate Tasks folder to show in the TaskPad. Currently we just show the folder named "Tasks", but it will be a per-calendar option in future. */ - priv->task_pad_loading_uri = g_strdup_printf ("%s/local/Tasks/tasks.ics", evolution_dir); - priv->task_pad_load_state = initial_load_state; - if (!cal_client_load_calendar (priv->task_pad_client, - priv->task_pad_loading_uri)) { - priv->task_pad_load_state = LOAD_STATE_NOT_LOADED; - g_free (priv->task_pad_loading_uri); - priv->task_pad_loading_uri = NULL; + tasks_uri = g_strdup_printf ("%s/local/Tasks/tasks.ics", evolution_dir); + success = cal_client_open_calendar (priv->task_pad_client, tasks_uri, FALSE); + g_free (tasks_uri); + if (!success) { g_message ("gnome_calendar_open(): Could not issue the request"); return FALSE; } diff --git a/calendar/gui/gnome-cal.h b/calendar/gui/gnome-cal.h index 6ac320b51b..5b4f2623b6 100644 --- a/calendar/gui/gnome-cal.h +++ b/calendar/gui/gnome-cal.h @@ -1,9 +1,26 @@ -/* - * GnomeCalendar widget - * Copyright (C) 1998 the Free Software Foundation +/* Evolution calendar - Main calendar view widget + * + * Copyright (C) 1998 The Free Software Foundation + * Copyright (C) 2000 Helix Code, Inc. + * Copyright (C) 2001 Ximian, Inc. + * + * Authors: Miguel de Icaza + * Federico Mena-Quintero + * Seth Alves + * + * This program is free software; you can redistribute it and/or modify + * it under the terms of the GNU General Public License as published by + * the Free Software Foundation; either version 2 of the License, or + * (at your option) any later version. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. * - * Authors: Miguel de Icaza (miguel@kernel.org) - * Federico Mena-Quintero + * 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. */ #ifndef GNOME_CALENDAR_APP_H @@ -55,9 +72,7 @@ GtkWidget *gnome_calendar_new (void); CalClient *gnome_calendar_get_cal_client (GnomeCalendar *gcal); -gboolean gnome_calendar_open (GnomeCalendar *gcal, - char *file, - GnomeCalendarOpenMode gcom); +gboolean gnome_calendar_open (GnomeCalendar *gcal, char *str_uri); /* int gnome_calendar_create (GnomeCalendar *gcal, char *file); diff --git a/calendar/gui/goto.c b/calendar/gui/goto.c index 6da562b603..89ad47844e 100644 --- a/calendar/gui/goto.c +++ b/calendar/gui/goto.c @@ -1,10 +1,11 @@ /* Go to date dialog for Evolution * - * Copyright (C) 1998 Red Hat Software, Inc. + * Copyright (C) 1998 Red Hat, Inc. * Copyright (C) 2000 Helix Code, Inc. + * Copyright (C) 2001 Ximian, Inc. * - * Authors: Federico Mena - * JP Rosevear + * Authors: Federico Mena + * JP Rosevear */ #include diff --git a/calendar/gui/goto.h b/calendar/gui/goto.h index f0dc41feba..b40c222fc4 100644 --- a/calendar/gui/goto.h +++ b/calendar/gui/goto.h @@ -1,8 +1,11 @@ /* Evolution calendar - Go To Date dialog * + * Copyright (C) 1998 Red Hat, Inc. * Copyright (C) 2000 Helix Code, Inc. + * Copyright (C) 2001 Ximian, Inc. * - * Author: JP Rosevear + * Authors: Federico Mena + * JP Rosevear * * This program is free software; you can redistribute it and/or modify * it under the terms of the GNU General Public License as published by diff --git a/calendar/gui/main.c b/calendar/gui/main.c index b286eb060a..ebfc54d87d 100644 --- a/calendar/gui/main.c +++ b/calendar/gui/main.c @@ -33,8 +33,8 @@ #include #include + #include "alarm.h" -#include "alarm-notify.h" #include "calendar-commands.h" #include "calendar-config.h" #include "component-factory.h" @@ -65,7 +65,6 @@ main (int argc, char **argv) init_bonobo (argc, argv); glade_gnome_init (); alarm_init (); - alarm_notify_init (); e_cursors_init (); #if 0 @@ -82,9 +81,8 @@ main (int argc, char **argv) bonobo_main (); - calendar_config_write_on_exit (); - alarm_notify_done (); alarm_done (); + calendar_config_write_on_exit (); return 0; } diff --git a/calendar/gui/tag-calendar.c b/calendar/gui/tag-calendar.c index 4d8e154c4c..ce2047b3ad 100644 --- a/calendar/gui/tag-calendar.c +++ b/calendar/gui/tag-calendar.c @@ -123,7 +123,7 @@ tag_calendar_by_client (ECalendar *ecal, CalClient *client) prepare_tag (ecal, &c); - if (!cal_client_is_loaded (client)) + if (cal_client_get_load_state (client) == CAL_CLIENT_LOAD_LOADED) return; #if 0 diff --git a/calendar/gui/tasks-control.c b/calendar/gui/tasks-control.c index e45f72623b..c93836f1fa 100644 --- a/calendar/gui/tasks-control.c +++ b/calendar/gui/tasks-control.c @@ -151,7 +151,7 @@ tasks_control_set_property (BonoboPropertyBag *bag, case TASKS_CONTROL_PROPERTY_URI_IDX: filename = g_strdup_printf ("%s/tasks.ics", BONOBO_ARG_GET_STRING (arg)); - e_tasks_open (tasks, filename, E_TASKS_OPEN_OR_CREATE); + e_tasks_open (tasks, filename); g_free (filename); break; -- cgit v1.2.3