From 12e3ecf07f633d0e496b4e35115b194fc39feab4 Mon Sep 17 00:00:00 2001 From: JP Rosevear Date: Tue, 18 May 2004 14:14:14 +0000 Subject: add arg 2004-05-18 JP Rosevear * idl/evolution-calendar.idl: add arg * gui/alarm-notify/alarm-queue.c (edit_component): send a mode type * gui/alarm-notify/alarm-notify.c: add fixme note * gui/comp-editor-factory.c (impl_editExisting): take a editor mode and twist it into a source type (impl_editNew): ditto (open_client): take a source type for creating the client (lookup_open_client): ditto svn path=/trunk/; revision=25959 --- calendar/ChangeLog | 17 +++++++++++++- calendar/gui/alarm-notify/alarm-notify.c | 2 ++ calendar/gui/alarm-notify/alarm-queue.c | 14 ++++++++++-- calendar/gui/comp-editor-factory.c | 39 ++++++++++++++++++++++++-------- calendar/idl/evolution-calendar.idl | 5 +++- 5 files changed, 63 insertions(+), 14 deletions(-) diff --git a/calendar/ChangeLog b/calendar/ChangeLog index 779b0b02c5..f93c31eba1 100644 --- a/calendar/ChangeLog +++ b/calendar/ChangeLog @@ -1,3 +1,18 @@ +2004-05-18 JP Rosevear + + * idl/evolution-calendar.idl: add arg + + * gui/alarm-notify/alarm-queue.c (edit_component): send a mode + type + + * gui/alarm-notify/alarm-notify.c: add fixme note + + * gui/comp-editor-factory.c (impl_editExisting): take a editor + mode and twist it into a source type + (impl_editNew): ditto + (open_client): take a source type for creating the client + (lookup_open_client): ditto + 2004-05-18 JP Rosevear * gui/alarm-notify/notify-main.c (init_alarm_service): just set up @@ -89,7 +104,7 @@ * gui/calendar-component.c (add_popup_menu_item): Use E_ICON_SIZE_MENU rather than hard-coding the pixel size. -2004-05-17 +2004-05-17 JP Rosevear Fixes #56373 diff --git a/calendar/gui/alarm-notify/alarm-notify.c b/calendar/gui/alarm-notify/alarm-notify.c index 2413e3fbb7..0c3231aaae 100644 --- a/calendar/gui/alarm-notify/alarm-notify.c +++ b/calendar/gui/alarm-notify/alarm-notify.c @@ -36,6 +36,8 @@ /* Private part of the AlarmNotify structure */ struct _AlarmNotifyPrivate { /* Mapping from EUri's to LoadedClient structures */ + /* FIXME do we need per source type uri hashes? or perhaps we + just need to hash based on source */ GHashTable *uri_client_hash; ESourceList *source_lists [E_CAL_SOURCE_TYPE_LAST]; diff --git a/calendar/gui/alarm-notify/alarm-queue.c b/calendar/gui/alarm-notify/alarm-queue.c index 1258324d0e..350ace3cd0 100644 --- a/calendar/gui/alarm-notify/alarm-queue.c +++ b/calendar/gui/alarm-notify/alarm-queue.c @@ -649,15 +649,17 @@ edit_component (ECal *client, ECalComponent *comp) { const char *uid; const char *uri; + ECalSourceType source_type; CORBA_Environment ev; GNOME_Evolution_Calendar_CompEditorFactory factory; + GNOME_Evolution_Calendar_CompEditorFactory_CompEditorMode corba_type; e_cal_component_get_uid (comp, &uid); uri = e_cal_get_uri (client); + source_type = e_cal_get_source_type (client); /* Get the factory */ - CORBA_exception_init (&ev); factory = bonobo_activation_activate_from_id ("OAFIID:GNOME_Evolution_Calendar_CompEditorFactory:" BASE_VERSION, 0, NULL, &ev); @@ -669,7 +671,15 @@ edit_component (ECal *client, ECalComponent *comp) } /* Edit the component */ - GNOME_Evolution_Calendar_CompEditorFactory_editExisting (factory, uri, (char *) uid, &ev); + switch (source_type) { + case E_CAL_SOURCE_TYPE_TODO: + corba_type = GNOME_Evolution_Calendar_CompEditorFactory_EDITOR_MODE_TODO; + break; + default: + corba_type = GNOME_Evolution_Calendar_CompEditorFactory_EDITOR_MODE_EVENT; + } + + GNOME_Evolution_Calendar_CompEditorFactory_editExisting (factory, uri, (char *) uid, corba_type, &ev); if (BONOBO_EX (&ev)) g_message (G_STRLOC ": Exception while editing the component"); diff --git a/calendar/gui/comp-editor-factory.c b/calendar/gui/comp-editor-factory.c index 79ec53c78a..de6d45968f 100644 --- a/calendar/gui/comp-editor-factory.c +++ b/calendar/gui/comp-editor-factory.c @@ -97,6 +97,7 @@ static void comp_editor_factory_finalize (GObject *object); static void impl_editExisting (PortableServer_Servant servant, const CORBA_char *str_uri, const CORBA_char *uid, + const GNOME_Evolution_Calendar_CompEditorFactory_CompEditorMode corba_type, CORBA_Environment *ev); static void impl_editNew (PortableServer_Servant servant, const CORBA_char *str_uri, @@ -442,7 +443,7 @@ cal_opened_cb (ECal *client, ECalendarStatus status, gpointer data) * open request. */ static OpenClient * -open_client (CompEditorFactory *factory, const char *uristr) +open_client (CompEditorFactory *factory, ECalSourceType source_type, const char *uristr) { CompEditorFactoryPrivate *priv; ECal *client; @@ -451,8 +452,7 @@ open_client (CompEditorFactory *factory, const char *uristr) priv = factory->priv; - /* FIXME get the type here, breaks if its a task alarm */ - client = auth_new_cal_from_uri (uristr, E_CAL_SOURCE_TYPE_EVENT); + client = auth_new_cal_from_uri (uristr, source_type); if (!client) return NULL; @@ -487,7 +487,7 @@ open_client (CompEditorFactory *factory, const char *uristr) * NULL on failure; in the latter case it sets the ev exception. */ static OpenClient * -lookup_open_client (CompEditorFactory *factory, const char *str_uri, CORBA_Environment *ev) +lookup_open_client (CompEditorFactory *factory, ECalSourceType source_type, const char *str_uri, CORBA_Environment *ev) { CompEditorFactoryPrivate *priv; OpenClient *oc; @@ -506,7 +506,7 @@ lookup_open_client (CompEditorFactory *factory, const char *str_uri, CORBA_Envir oc = g_hash_table_lookup (priv->uri_client_hash, str_uri); if (!oc) { - oc = open_client (factory, str_uri); + oc = open_client (factory, source_type, str_uri); if (!oc) { bonobo_exception_set (ev, ex_GNOME_Evolution_Calendar_CompEditorFactory_BackendContactError); return NULL; @@ -536,17 +536,27 @@ static void impl_editExisting (PortableServer_Servant servant, const CORBA_char *str_uri, const CORBA_char *uid, + const GNOME_Evolution_Calendar_CompEditorFactory_CompEditorMode corba_type, CORBA_Environment *ev) { CompEditorFactory *factory; CompEditorFactoryPrivate *priv; OpenClient *oc; CompEditor *editor; - + ECalSourceType source_type; + factory = COMP_EDITOR_FACTORY (bonobo_object_from_servant (servant)); priv = factory->priv; - oc = lookup_open_client (factory, str_uri, ev); + switch (corba_type) { + case GNOME_Evolution_Calendar_CompEditorFactory_EDITOR_MODE_TODO: + source_type = E_CAL_SOURCE_TYPE_TODO; + break; + default: + source_type = E_CAL_SOURCE_TYPE_EVENT; + } + + oc = lookup_open_client (factory, source_type, str_uri, ev); if (!oc) return; @@ -556,7 +566,7 @@ impl_editExisting (PortableServer_Servant servant, } /* Look up the component */ - editor = e_comp_editor_registry_find (comp_editor_registry, uid); + editor = e_comp_editor_registry_find (comp_editor_registry, uid); if (editor == NULL) { edit_existing (oc, uid); } else { @@ -589,11 +599,20 @@ impl_editNew (PortableServer_Servant servant, CompEditorFactory *factory; CompEditorFactoryPrivate *priv; OpenClient *oc; - + ECalSourceType source_type; + factory = COMP_EDITOR_FACTORY (bonobo_object_from_servant (servant)); priv = factory->priv; - oc = lookup_open_client (factory, str_uri, ev); + switch (corba_type) { + case GNOME_Evolution_Calendar_CompEditorFactory_EDITOR_MODE_TODO: + source_type = E_CAL_SOURCE_TYPE_TODO; + break; + default: + source_type = E_CAL_SOURCE_TYPE_EVENT; + } + + oc = lookup_open_client (factory, source_type, str_uri, ev); if (!oc) return; diff --git a/calendar/idl/evolution-calendar.idl b/calendar/idl/evolution-calendar.idl index 2ead68220b..532fa2a0e4 100644 --- a/calendar/idl/evolution-calendar.idl +++ b/calendar/idl/evolution-calendar.idl @@ -33,7 +33,10 @@ module Calendar { const CompEditorMode EDITOR_MODE_TODO = 1 << 3; /* Loads a calendar and opens an editor for the specified object */ - void editExisting (in string uri, in CalObjUID uid) + /* FIXME Its nasty to use CompEditorMode to pass event/todo source type + but it saves adding yet another corba type - only MODE_EVENT or + MODE_TODO should be passed here */ + void editExisting (in string uri, in CalObjUID uid, in CompEditorMode mode) raises (InvalidURI, BackendContactError); /* Loads a calendar and creates a new component of the specified type */ -- cgit v1.2.3