diff options
author | Federico Mena Quintero <federico@helixcode.com> | 2000-02-02 17:51:20 +0800 |
---|---|---|
committer | Arturo Espinosa <unammx@src.gnome.org> | 2000-02-02 17:51:20 +0800 |
commit | 9d6fc52249f34b5a3985bea8ace18059be9e4bba (patch) | |
tree | 59ac26466d87061d4573e72fe228d47b77dbb318 | |
parent | 9d4be61768f69a0aff9daa55c088724d0d5a54a6 (diff) | |
download | gsoc2013-evolution-9d6fc52249f34b5a3985bea8ace18059be9e4bba.tar gsoc2013-evolution-9d6fc52249f34b5a3985bea8ace18059be9e4bba.tar.gz gsoc2013-evolution-9d6fc52249f34b5a3985bea8ace18059be9e4bba.tar.bz2 gsoc2013-evolution-9d6fc52249f34b5a3985bea8ace18059be9e4bba.tar.lz gsoc2013-evolution-9d6fc52249f34b5a3985bea8ace18059be9e4bba.tar.xz gsoc2013-evolution-9d6fc52249f34b5a3985bea8ace18059be9e4bba.tar.zst gsoc2013-evolution-9d6fc52249f34b5a3985bea8ace18059be9e4bba.zip |
Added the get_object() method.
2000-02-03 Federico Mena Quintero <federico@helixcode.com>
* evolution-calendar.idl (Cal): Added the get_object() method.
* cal-client.c (cal_client_get_object): New function to get a
calendar object by its UID.
* cal.c (Cal_get_object): Implemented.
* cal-backend.c (cal_backend_get_object): New unfinished backend
function. We need some reorganizing of how the calendar objects
are stored.
svn path=/trunk/; revision=1663
-rw-r--r-- | calendar/ChangeLog | 18 | ||||
-rw-r--r-- | calendar/Makefile.am | 137 | ||||
-rw-r--r-- | calendar/cal-backend.c | 27 | ||||
-rw-r--r-- | calendar/cal-backend.h | 2 | ||||
-rw-r--r-- | calendar/cal-client.c | 60 | ||||
-rw-r--r-- | calendar/cal-client.h | 2 | ||||
-rw-r--r-- | calendar/cal-client/cal-client.c | 60 | ||||
-rw-r--r-- | calendar/cal-client/cal-client.h | 2 | ||||
-rw-r--r-- | calendar/cal-client/cal-listener.c | 7 | ||||
-rw-r--r-- | calendar/cal-factory.c | 4 | ||||
-rw-r--r-- | calendar/cal-listener.c | 7 | ||||
-rw-r--r-- | calendar/cal.c | 30 | ||||
-rw-r--r-- | calendar/evolution-calendar.idl | 6 | ||||
-rw-r--r-- | calendar/gui/Makefile.am | 137 | ||||
-rw-r--r-- | calendar/idl/evolution-calendar.idl | 6 | ||||
-rw-r--r-- | calendar/pcs/cal-backend.c | 27 | ||||
-rw-r--r-- | calendar/pcs/cal-backend.h | 2 | ||||
-rw-r--r-- | calendar/pcs/cal-factory.c | 4 | ||||
-rw-r--r-- | calendar/pcs/cal.c | 30 |
19 files changed, 410 insertions, 158 deletions
diff --git a/calendar/ChangeLog b/calendar/ChangeLog index e6cead0722..e49b508a1a 100644 --- a/calendar/ChangeLog +++ b/calendar/ChangeLog @@ -1,3 +1,21 @@ +2000-02-03 Federico Mena Quintero <federico@helixcode.com> + + * evolution-calendar.idl (Cal): Added the get_object() method. + + * cal-client.c (cal_client_get_object): New function to get a + calendar object by its UID. + + * cal.c (Cal_get_object): Implemented. + + * cal-backend.c (cal_backend_get_object): New unfinished backend + function. We need some reorganizing of how the calendar objects + are stored. + +2000-02-02 Federico Mena Quintero <federico@helixcode.com> + + * Makefile.am (gnomecal_SOURCES): Added the CORBA generated + sources. + 2000-02-01 Federico Mena Quintero <federico@helixcode.com> * cal-client.c (cal_loaded): Handle the cal_loaded signal from the diff --git a/calendar/Makefile.am b/calendar/Makefile.am index 9f239454ee..408f80dd76 100644 --- a/calendar/Makefile.am +++ b/calendar/Makefile.am @@ -42,63 +42,73 @@ corba-cal.h \ corba-cal-factory.c \ corba-cal-factory.h: GnomeCal.h -gnomecal_SOURCES = \ - GnomeCal-common.c \ - GnomeCal-skels.c \ - GnomeCal.h \ - alarm.c \ - alarm.h \ - cal-client.c \ - cal-client.h \ - cal-listener.c \ - cal-listener.h \ - calendar.c \ - calendar.h \ - calendar-conduit.h \ - calobj.c \ - calobj.h \ - eventedit.c \ - eventedit.h \ - corba-cal.c \ - corba-cal.h \ - corba-cal-factory.c \ - corba-cal-factory.h \ - getdate.y \ - gncal-day-panel.c \ - gncal-day-panel.h \ - gncal-day-view.c \ - gncal-day-view.h \ - gncal-full-day.c \ - gncal-full-day.h \ - gncal-week-view.c \ - gncal-week-view.h \ - gncal-todo.c \ - gncal-todo.h \ - gnome-month-item.c \ - gnome-month-item.h \ - gnome-cal.c \ - gnome-cal.h \ - html-month.c \ - goto.c \ - layout.c \ - layout.h \ - main.c \ - main.h \ - mark.c \ - mark.h \ - month-view.c \ - month-view.h \ - popup-menu.c \ - popup-menu.h \ - prop.c \ - quick-view.c \ - quick-view.h \ - timeutil.c \ - timeutil.h \ - todo-conduit.h \ - view-utils.h \ - view-utils.c \ - year-view.c \ +GNOME_CALENDAR_CORBA_GENERATED = \ + evolution-calendar.h \ + evolution-calendar-common.c \ + evolution-calendar-skels.c \ + evolution-calendar-stubs.c + +$(GNOME_CALENDAR_CORBA_GENERATED): evolution-calendar.idl + orbit-idl -I`$(GNOME_CONFIG) --datadir`/idl $(srcdir)/evolution-calendar.idl + +gnomecal_SOURCES = \ + $(GNOME_CALENDAR_CORBA_GENERATED) \ + GnomeCal-common.c \ + GnomeCal-skels.c \ + GnomeCal.h \ + alarm.c \ + alarm.h \ + cal-client.c \ + cal-client.h \ + cal-listener.c \ + cal-listener.h \ + calendar.c \ + calendar.h \ + calendar-conduit.h \ + calobj.c \ + calobj.h \ + eventedit.c \ + eventedit.h \ + corba-cal.c \ + corba-cal.h \ + corba-cal-factory.c \ + corba-cal-factory.h \ + getdate.y \ + gncal-day-panel.c \ + gncal-day-panel.h \ + gncal-day-view.c \ + gncal-day-view.h \ + gncal-full-day.c \ + gncal-full-day.h \ + gncal-week-view.c \ + gncal-week-view.h \ + gncal-todo.c \ + gncal-todo.h \ + gnome-month-item.c \ + gnome-month-item.h \ + gnome-cal.c \ + gnome-cal.h \ + html-month.c \ + goto.c \ + layout.c \ + layout.h \ + main.c \ + main.h \ + mark.c \ + mark.h \ + month-view.c \ + month-view.h \ + popup-menu.c \ + popup-menu.h \ + prop.c \ + quick-view.c \ + quick-view.h \ + timeutil.c \ + timeutil.h \ + todo-conduit.h \ + view-utils.h \ + view-utils.c \ + year-view.c \ year-view.h calendar_pilot_sync_SOURCES = \ @@ -113,19 +123,10 @@ calendar_pilot_sync_SOURCES = \ timeutil.c \ timeutil.h -GNOME_CALENDAR_CORBA_GENERATED = \ - evolution-calendar.h \ - evolution-calendar-common.c \ - evolution-calendar-skels.c \ - evolution-calendar-stubs.c - -$(GNOME_CALENDAR_CORBA_GENERATED): evolution-calendar.idl - orbit-idl -I`$(GNOME_CONFIG) --datadir`/idl $(srcdir)/evolution-calendar.idl - tlacuache_SOURCES = \ $(GNOME_CALENDAR_CORBA_GENERATED) \ - alarm.c \ - alarm.h \ + alarm.c \ + alarm.h \ cal.c \ cal.h \ cal-backend.c \ diff --git a/calendar/cal-backend.c b/calendar/cal-backend.c index 983edbb3cc..91ffd8dc1d 100644 --- a/calendar/cal-backend.c +++ b/calendar/cal-backend.c @@ -385,3 +385,30 @@ cal_backend_load (CalBackend *backend, GnomeVFSURI *uri) priv->loaded = TRUE; return CAL_BACKEND_LOAD_SUCCESS; } + +/** + * cal_backend_get_object: + * @backend: A calendar backend. + * @uid: Unique identifier for a calendar object. + * + * Queries a calendar backend for a calendar object based on its unique + * identifier. + * + * Return value: The string representation of the sought object, or NULL if no + * object had the specified UID. + **/ +char * +cal_backend_get_object (CalBackend *backend, const char *uid) +{ + CalBackendPrivate *priv; + + g_return_val_if_fail (backend != NULL, NULL); + g_return_val_if_fail (IS_CAL_BACKEND (backend), NULL); + + priv = backend->priv; + g_return_val_if_fail (priv->loaded, NULL); + + g_return_val_if_fail (uid != NULL, NULL); + + /* FIXME */ +} diff --git a/calendar/cal-backend.h b/calendar/cal-backend.h index 31f726a68f..e972cbd59e 100644 --- a/calendar/cal-backend.h +++ b/calendar/cal-backend.h @@ -66,6 +66,8 @@ void cal_backend_remove_cal (CalBackend *backend, Cal *cal); CalBackendLoadStatus cal_backend_load (CalBackend *backend, GnomeVFSURI *uri); +char *cal_backend_get_object (CalBackend *backend, const char *uid); + END_GNOME_DECLS diff --git a/calendar/cal-client.c b/calendar/cal-client.c index 05025a07e7..2125760eb0 100644 --- a/calendar/cal-client.c +++ b/calendar/cal-client.c @@ -203,7 +203,7 @@ cal_loaded_cb (CalListener *listener, client = CAL_CLIENT (data); priv = client->priv; - g_assert (priv->state == LOAD_STATE_LOADING); + g_assert (priv->load_state == LOAD_STATE_LOADING); switch (status) { case CAL_LISTENER_LOAD_SUCCESS: @@ -217,9 +217,10 @@ cal_loaded_cb (CalListener *listener, CORBA_exception_free (&ev); priv->cal = cal_copy; - priv->load_status = LOAD_STATE_LOADED; + priv->load_state = LOAD_STATE_LOADED; - gtk_signal_emit (client, cal_client_signals[CAL_LOADED], CAL_CLIENT_LOAD_SUCCESS); + gtk_signal_emit (GTK_OBJECT (client), cal_client_signals[CAL_LOADED], + CAL_CLIENT_LOAD_SUCCESS); goto out; case CAL_LISTENER_LOAD_ERROR: @@ -231,14 +232,15 @@ cal_loaded_cb (CalListener *listener, error: - gtk_object_unref (priv->listener); + gtk_object_unref (GTK_OBJECT (priv->listener)); priv->listener = NULL; priv->load_state = LOAD_STATE_NOT_LOADED; - gtk_signal_emit (client, cal_client_signals[CAL_LOADED], CAL_CLIENT_LOAD_ERROR); + gtk_signal_emit (GTK_OBJECT (client), cal_client_signals[CAL_LOADED], + CAL_CLIENT_LOAD_ERROR); out: - g_assert (priv->load_state != CAL_STATE_LOADING); + g_assert (priv->load_state != LOAD_STATE_LOADING); } /* Handle the obj_added signal from the listener */ @@ -422,3 +424,49 @@ cal_client_load_calendar (CalClient *client, const char *str_uri) return TRUE; } + +/** + * cal_client_get_object: + * @client: A calendar client. + * @uid: Unique identifier for a calendar object. + * + * Queries a calendar for a calendar object based on its unique identifier. + * + * Return value: The string representation of the calendar object corresponding + * to the specified @uid, or NULL if no such object was found. + **/ +char * +cal_client_get_object (CalClient *client, const char *uid) +{ + CalClientPrivate *priv; + CORBA_Environment ev; + Evolution_Calendar_CalObj calobj; + char *retval; + + g_return_val_if_fail (client != NULL, NULL); + g_return_val_if_fail (IS_CAL_CLIENT (client), NULL); + + priv = client->priv; + g_return_val_if_fail (priv->load_state == LOAD_STATE_LOADED, NULL); + + g_return_val_if_fail (uid != NULL, NULL); + + retval = NULL; + + CORBA_exception_init (&ev); + calobj = Evolution_Calendar_Cal_get_object (priv->cal, uid, &ev); + + if (ev._major == CORBA_USER_EXCEPTION + && strcmp (CORBA_exception_id (&ev), ex_Evolution_Calendar_Cal_NotFound) == 0) + goto out; + else if (ev._major != CORBA_NO_EXCEPTION) { + g_message ("cal_client_get_object(): could not get the object"); + goto out; + } + + retval = g_strdup (calobj); + + out: + CORBA_exception_free (&ev); + return retval; +} diff --git a/calendar/cal-client.h b/calendar/cal-client.h index fea3e37605..b20a3c378c 100644 --- a/calendar/cal-client.h +++ b/calendar/cal-client.h @@ -71,6 +71,8 @@ CalClient *cal_client_new (void); gboolean cal_client_load_calendar (CalClient *client, const char *str_uri); +char *cal_client_get_object (CalClient *client, const char *uid); + END_GNOME_DECLS diff --git a/calendar/cal-client/cal-client.c b/calendar/cal-client/cal-client.c index 05025a07e7..2125760eb0 100644 --- a/calendar/cal-client/cal-client.c +++ b/calendar/cal-client/cal-client.c @@ -203,7 +203,7 @@ cal_loaded_cb (CalListener *listener, client = CAL_CLIENT (data); priv = client->priv; - g_assert (priv->state == LOAD_STATE_LOADING); + g_assert (priv->load_state == LOAD_STATE_LOADING); switch (status) { case CAL_LISTENER_LOAD_SUCCESS: @@ -217,9 +217,10 @@ cal_loaded_cb (CalListener *listener, CORBA_exception_free (&ev); priv->cal = cal_copy; - priv->load_status = LOAD_STATE_LOADED; + priv->load_state = LOAD_STATE_LOADED; - gtk_signal_emit (client, cal_client_signals[CAL_LOADED], CAL_CLIENT_LOAD_SUCCESS); + gtk_signal_emit (GTK_OBJECT (client), cal_client_signals[CAL_LOADED], + CAL_CLIENT_LOAD_SUCCESS); goto out; case CAL_LISTENER_LOAD_ERROR: @@ -231,14 +232,15 @@ cal_loaded_cb (CalListener *listener, error: - gtk_object_unref (priv->listener); + gtk_object_unref (GTK_OBJECT (priv->listener)); priv->listener = NULL; priv->load_state = LOAD_STATE_NOT_LOADED; - gtk_signal_emit (client, cal_client_signals[CAL_LOADED], CAL_CLIENT_LOAD_ERROR); + gtk_signal_emit (GTK_OBJECT (client), cal_client_signals[CAL_LOADED], + CAL_CLIENT_LOAD_ERROR); out: - g_assert (priv->load_state != CAL_STATE_LOADING); + g_assert (priv->load_state != LOAD_STATE_LOADING); } /* Handle the obj_added signal from the listener */ @@ -422,3 +424,49 @@ cal_client_load_calendar (CalClient *client, const char *str_uri) return TRUE; } + +/** + * cal_client_get_object: + * @client: A calendar client. + * @uid: Unique identifier for a calendar object. + * + * Queries a calendar for a calendar object based on its unique identifier. + * + * Return value: The string representation of the calendar object corresponding + * to the specified @uid, or NULL if no such object was found. + **/ +char * +cal_client_get_object (CalClient *client, const char *uid) +{ + CalClientPrivate *priv; + CORBA_Environment ev; + Evolution_Calendar_CalObj calobj; + char *retval; + + g_return_val_if_fail (client != NULL, NULL); + g_return_val_if_fail (IS_CAL_CLIENT (client), NULL); + + priv = client->priv; + g_return_val_if_fail (priv->load_state == LOAD_STATE_LOADED, NULL); + + g_return_val_if_fail (uid != NULL, NULL); + + retval = NULL; + + CORBA_exception_init (&ev); + calobj = Evolution_Calendar_Cal_get_object (priv->cal, uid, &ev); + + if (ev._major == CORBA_USER_EXCEPTION + && strcmp (CORBA_exception_id (&ev), ex_Evolution_Calendar_Cal_NotFound) == 0) + goto out; + else if (ev._major != CORBA_NO_EXCEPTION) { + g_message ("cal_client_get_object(): could not get the object"); + goto out; + } + + retval = g_strdup (calobj); + + out: + CORBA_exception_free (&ev); + return retval; +} diff --git a/calendar/cal-client/cal-client.h b/calendar/cal-client/cal-client.h index fea3e37605..b20a3c378c 100644 --- a/calendar/cal-client/cal-client.h +++ b/calendar/cal-client/cal-client.h @@ -71,6 +71,8 @@ CalClient *cal_client_new (void); gboolean cal_client_load_calendar (CalClient *client, const char *str_uri); +char *cal_client_get_object (CalClient *client, const char *uid); + END_GNOME_DECLS diff --git a/calendar/cal-client/cal-listener.c b/calendar/cal-client/cal-listener.c index b1f91e8d8f..62db9c287d 100644 --- a/calendar/cal-client/cal-listener.c +++ b/calendar/cal-client/cal-listener.c @@ -20,6 +20,7 @@ */ #include <config.h> +#include <gtk/gtksignal.h> #include "cal-listener.h" @@ -248,11 +249,11 @@ Listener_cal_loaded (PortableServer_Servant servant, priv->cal = cal_copy; switch (status) { - Evolution_Calendar_Listener_SUCESSS: + case Evolution_Calendar_Listener_SUCCESS: load_status = CAL_LISTENER_LOAD_SUCCESS; break; - Evolution_Calendar_Listener_ERROR: + case Evolution_Calendar_Listener_ERROR: load_status = CAL_LISTENER_LOAD_ERROR; break; @@ -408,7 +409,7 @@ cal_listener_new (void) if (ev._major != CORBA_NO_EXCEPTION || result) { g_message ("cal_listener_new(): could not create the CORBA listener"); - gtk_object_destroy (listener); + gtk_object_unref (GTK_OBJECT (listener)); CORBA_exception_free (&ev); return NULL; } diff --git a/calendar/cal-factory.c b/calendar/cal-factory.c index f544964612..d5b79ef423 100644 --- a/calendar/cal-factory.c +++ b/calendar/cal-factory.c @@ -156,7 +156,7 @@ cal_factory_destroy (GtkObject *object) /* CalFactory::load method */ static void CalFactory_load (PortableServer_Servant servant, - CORBA_char *uri, + const CORBA_char *uri, Evolution_Calendar_Listener listener, CORBA_Environment *ev) { @@ -187,7 +187,7 @@ CalFactory_load (PortableServer_Servant servant, /* CalFactory::create method */ static void CalFactory_create (PortableServer_Servant servant, - CORBA_char *uri, + const CORBA_char *uri, Evolution_Calendar_Listener listener, CORBA_Environment *ev) { diff --git a/calendar/cal-listener.c b/calendar/cal-listener.c index b1f91e8d8f..62db9c287d 100644 --- a/calendar/cal-listener.c +++ b/calendar/cal-listener.c @@ -20,6 +20,7 @@ */ #include <config.h> +#include <gtk/gtksignal.h> #include "cal-listener.h" @@ -248,11 +249,11 @@ Listener_cal_loaded (PortableServer_Servant servant, priv->cal = cal_copy; switch (status) { - Evolution_Calendar_Listener_SUCESSS: + case Evolution_Calendar_Listener_SUCCESS: load_status = CAL_LISTENER_LOAD_SUCCESS; break; - Evolution_Calendar_Listener_ERROR: + case Evolution_Calendar_Listener_ERROR: load_status = CAL_LISTENER_LOAD_ERROR; break; @@ -408,7 +409,7 @@ cal_listener_new (void) if (ev._major != CORBA_NO_EXCEPTION || result) { g_message ("cal_listener_new(): could not create the CORBA listener"); - gtk_object_destroy (listener); + gtk_object_unref (GTK_OBJECT (listener)); CORBA_exception_free (&ev); return NULL; } diff --git a/calendar/cal.c b/calendar/cal.c index eac02bb6d4..1403c2c028 100644 --- a/calendar/cal.c +++ b/calendar/cal.c @@ -167,6 +167,35 @@ Cal_get_uri (PortableServer_Servant servant, } +/* Cal::get_object method */ +static Evolution_Calendar_CalObj +Cal_get_object (PortableServer_Servant servant, + const Evolution_Calendar_CalObjUID uid, + CORBA_Environment *ev) +{ + Cal *cal; + CalPrivate *priv; + char *calobj; + + cal = CAL (bonobo_object_from_servant (servant)); + priv = cal->priv; + + calobj = cal_backend_get_object (priv->backend, uid); + + if (uid) { + CORBA_char *calobj_copy; + + calobj_copy = CORBA_string_dup (calobj); + g_free (calobj); + return calobj_copy; + } else { + CORBA_exception_set (ev, CORBA_USER_EXCEPTION, + ex_Evolution_Calendar_Cal_NotFound, + NULL); + return NULL; + } +} + /** * cal_get_epv: * @void: @@ -182,6 +211,7 @@ cal_get_epv (void) epv = g_new0 (POA_Evolution_Calendar_Cal__epv, 1); epv->_get_uri = Cal_get_uri; + epv->get_object = Cal_get_object; return epv; } diff --git a/calendar/evolution-calendar.idl b/calendar/evolution-calendar.idl index 2be11abe1f..2ccfc0ec80 100644 --- a/calendar/evolution-calendar.idl +++ b/calendar/evolution-calendar.idl @@ -27,8 +27,14 @@ module Calendar { /* Calendar client interface */ interface Cal : Bonobo::Unknown { + exception NotFound {}; + /* A calendar is identified by its URI */ readonly attribute string uri; + + /* Gets an object based on its URI */ + CalObj get_object (in CalObjUID uid) + raises (NotFound); }; /* Listener for changes in a calendar */ diff --git a/calendar/gui/Makefile.am b/calendar/gui/Makefile.am index 9f239454ee..408f80dd76 100644 --- a/calendar/gui/Makefile.am +++ b/calendar/gui/Makefile.am @@ -42,63 +42,73 @@ corba-cal.h \ corba-cal-factory.c \ corba-cal-factory.h: GnomeCal.h -gnomecal_SOURCES = \ - GnomeCal-common.c \ - GnomeCal-skels.c \ - GnomeCal.h \ - alarm.c \ - alarm.h \ - cal-client.c \ - cal-client.h \ - cal-listener.c \ - cal-listener.h \ - calendar.c \ - calendar.h \ - calendar-conduit.h \ - calobj.c \ - calobj.h \ - eventedit.c \ - eventedit.h \ - corba-cal.c \ - corba-cal.h \ - corba-cal-factory.c \ - corba-cal-factory.h \ - getdate.y \ - gncal-day-panel.c \ - gncal-day-panel.h \ - gncal-day-view.c \ - gncal-day-view.h \ - gncal-full-day.c \ - gncal-full-day.h \ - gncal-week-view.c \ - gncal-week-view.h \ - gncal-todo.c \ - gncal-todo.h \ - gnome-month-item.c \ - gnome-month-item.h \ - gnome-cal.c \ - gnome-cal.h \ - html-month.c \ - goto.c \ - layout.c \ - layout.h \ - main.c \ - main.h \ - mark.c \ - mark.h \ - month-view.c \ - month-view.h \ - popup-menu.c \ - popup-menu.h \ - prop.c \ - quick-view.c \ - quick-view.h \ - timeutil.c \ - timeutil.h \ - todo-conduit.h \ - view-utils.h \ - view-utils.c \ - year-view.c \ +GNOME_CALENDAR_CORBA_GENERATED = \ + evolution-calendar.h \ + evolution-calendar-common.c \ + evolution-calendar-skels.c \ + evolution-calendar-stubs.c + +$(GNOME_CALENDAR_CORBA_GENERATED): evolution-calendar.idl + orbit-idl -I`$(GNOME_CONFIG) --datadir`/idl $(srcdir)/evolution-calendar.idl + +gnomecal_SOURCES = \ + $(GNOME_CALENDAR_CORBA_GENERATED) \ + GnomeCal-common.c \ + GnomeCal-skels.c \ + GnomeCal.h \ + alarm.c \ + alarm.h \ + cal-client.c \ + cal-client.h \ + cal-listener.c \ + cal-listener.h \ + calendar.c \ + calendar.h \ + calendar-conduit.h \ + calobj.c \ + calobj.h \ + eventedit.c \ + eventedit.h \ + corba-cal.c \ + corba-cal.h \ + corba-cal-factory.c \ + corba-cal-factory.h \ + getdate.y \ + gncal-day-panel.c \ + gncal-day-panel.h \ + gncal-day-view.c \ + gncal-day-view.h \ + gncal-full-day.c \ + gncal-full-day.h \ + gncal-week-view.c \ + gncal-week-view.h \ + gncal-todo.c \ + gncal-todo.h \ + gnome-month-item.c \ + gnome-month-item.h \ + gnome-cal.c \ + gnome-cal.h \ + html-month.c \ + goto.c \ + layout.c \ + layout.h \ + main.c \ + main.h \ + mark.c \ + mark.h \ + month-view.c \ + month-view.h \ + popup-menu.c \ + popup-menu.h \ + prop.c \ + quick-view.c \ + quick-view.h \ + timeutil.c \ + timeutil.h \ + todo-conduit.h \ + view-utils.h \ + view-utils.c \ + year-view.c \ year-view.h calendar_pilot_sync_SOURCES = \ @@ -113,19 +123,10 @@ calendar_pilot_sync_SOURCES = \ timeutil.c \ timeutil.h -GNOME_CALENDAR_CORBA_GENERATED = \ - evolution-calendar.h \ - evolution-calendar-common.c \ - evolution-calendar-skels.c \ - evolution-calendar-stubs.c - -$(GNOME_CALENDAR_CORBA_GENERATED): evolution-calendar.idl - orbit-idl -I`$(GNOME_CONFIG) --datadir`/idl $(srcdir)/evolution-calendar.idl - tlacuache_SOURCES = \ $(GNOME_CALENDAR_CORBA_GENERATED) \ - alarm.c \ - alarm.h \ + alarm.c \ + alarm.h \ cal.c \ cal.h \ cal-backend.c \ diff --git a/calendar/idl/evolution-calendar.idl b/calendar/idl/evolution-calendar.idl index 2be11abe1f..2ccfc0ec80 100644 --- a/calendar/idl/evolution-calendar.idl +++ b/calendar/idl/evolution-calendar.idl @@ -27,8 +27,14 @@ module Calendar { /* Calendar client interface */ interface Cal : Bonobo::Unknown { + exception NotFound {}; + /* A calendar is identified by its URI */ readonly attribute string uri; + + /* Gets an object based on its URI */ + CalObj get_object (in CalObjUID uid) + raises (NotFound); }; /* Listener for changes in a calendar */ diff --git a/calendar/pcs/cal-backend.c b/calendar/pcs/cal-backend.c index 983edbb3cc..91ffd8dc1d 100644 --- a/calendar/pcs/cal-backend.c +++ b/calendar/pcs/cal-backend.c @@ -385,3 +385,30 @@ cal_backend_load (CalBackend *backend, GnomeVFSURI *uri) priv->loaded = TRUE; return CAL_BACKEND_LOAD_SUCCESS; } + +/** + * cal_backend_get_object: + * @backend: A calendar backend. + * @uid: Unique identifier for a calendar object. + * + * Queries a calendar backend for a calendar object based on its unique + * identifier. + * + * Return value: The string representation of the sought object, or NULL if no + * object had the specified UID. + **/ +char * +cal_backend_get_object (CalBackend *backend, const char *uid) +{ + CalBackendPrivate *priv; + + g_return_val_if_fail (backend != NULL, NULL); + g_return_val_if_fail (IS_CAL_BACKEND (backend), NULL); + + priv = backend->priv; + g_return_val_if_fail (priv->loaded, NULL); + + g_return_val_if_fail (uid != NULL, NULL); + + /* FIXME */ +} diff --git a/calendar/pcs/cal-backend.h b/calendar/pcs/cal-backend.h index 31f726a68f..e972cbd59e 100644 --- a/calendar/pcs/cal-backend.h +++ b/calendar/pcs/cal-backend.h @@ -66,6 +66,8 @@ void cal_backend_remove_cal (CalBackend *backend, Cal *cal); CalBackendLoadStatus cal_backend_load (CalBackend *backend, GnomeVFSURI *uri); +char *cal_backend_get_object (CalBackend *backend, const char *uid); + END_GNOME_DECLS diff --git a/calendar/pcs/cal-factory.c b/calendar/pcs/cal-factory.c index f544964612..d5b79ef423 100644 --- a/calendar/pcs/cal-factory.c +++ b/calendar/pcs/cal-factory.c @@ -156,7 +156,7 @@ cal_factory_destroy (GtkObject *object) /* CalFactory::load method */ static void CalFactory_load (PortableServer_Servant servant, - CORBA_char *uri, + const CORBA_char *uri, Evolution_Calendar_Listener listener, CORBA_Environment *ev) { @@ -187,7 +187,7 @@ CalFactory_load (PortableServer_Servant servant, /* CalFactory::create method */ static void CalFactory_create (PortableServer_Servant servant, - CORBA_char *uri, + const CORBA_char *uri, Evolution_Calendar_Listener listener, CORBA_Environment *ev) { diff --git a/calendar/pcs/cal.c b/calendar/pcs/cal.c index eac02bb6d4..1403c2c028 100644 --- a/calendar/pcs/cal.c +++ b/calendar/pcs/cal.c @@ -167,6 +167,35 @@ Cal_get_uri (PortableServer_Servant servant, } +/* Cal::get_object method */ +static Evolution_Calendar_CalObj +Cal_get_object (PortableServer_Servant servant, + const Evolution_Calendar_CalObjUID uid, + CORBA_Environment *ev) +{ + Cal *cal; + CalPrivate *priv; + char *calobj; + + cal = CAL (bonobo_object_from_servant (servant)); + priv = cal->priv; + + calobj = cal_backend_get_object (priv->backend, uid); + + if (uid) { + CORBA_char *calobj_copy; + + calobj_copy = CORBA_string_dup (calobj); + g_free (calobj); + return calobj_copy; + } else { + CORBA_exception_set (ev, CORBA_USER_EXCEPTION, + ex_Evolution_Calendar_Cal_NotFound, + NULL); + return NULL; + } +} + /** * cal_get_epv: * @void: @@ -182,6 +211,7 @@ cal_get_epv (void) epv = g_new0 (POA_Evolution_Calendar_Cal__epv, 1); epv->_get_uri = Cal_get_uri; + epv->get_object = Cal_get_object; return epv; } |