diff options
author | Federico Mena Quintero <federico@helixcode.com> | 2000-02-12 10:03:58 +0800 |
---|---|---|
committer | Arturo Espinosa <unammx@src.gnome.org> | 2000-02-12 10:03:58 +0800 |
commit | d2fe58c56857e9e4b2e37f87174da6956b0d985c (patch) | |
tree | e71df413e8a7862616755f64700b1dbbc513f9be /calendar/pcs/cal.c | |
parent | 123f506198c535dcb073c1998fed37c25ad131f9 (diff) | |
download | gsoc2013-evolution-d2fe58c56857e9e4b2e37f87174da6956b0d985c.tar gsoc2013-evolution-d2fe58c56857e9e4b2e37f87174da6956b0d985c.tar.gz gsoc2013-evolution-d2fe58c56857e9e4b2e37f87174da6956b0d985c.tar.bz2 gsoc2013-evolution-d2fe58c56857e9e4b2e37f87174da6956b0d985c.tar.lz gsoc2013-evolution-d2fe58c56857e9e4b2e37f87174da6956b0d985c.tar.xz gsoc2013-evolution-d2fe58c56857e9e4b2e37f87174da6956b0d985c.tar.zst gsoc2013-evolution-d2fe58c56857e9e4b2e37f87174da6956b0d985c.zip |
Implemented.
2000-02-11 Federico Mena Quintero <federico@helixcode.com>
* cal-client.c (cal_client_update_object): Implemented.
* cal.c (cal_notify_update): New function to notify the listener
about an updated object.
(Cal_update_object): Implemented.
(Cal_get_uids): set_release() the sequence to TRUE.
(Cal_get_events_in_range): Likewise.
* cal-backend.c (remove_object): New function to remove objects
from a calendar backend.
(cal_backend_update_object): New public function to update an
object and notify clients about it.
* evolution-calendar.idl (Cal): Added update_object() and
delete_object() methods.
(Listener): Removed the obj_changed method and renamed obj_added
to obj_updated. We now only have updated and removed notifiers.
* cal-listener.[ch]: Removed the "changed" notification code.
Changed the "added" notification code to the "updated"
notification.
* cal-client.c: Likewise.
* tlacuache.c (create_cal_factory): Connect to "destroy" on the
factory and exit the main loop when the factory is destroyed.
* cal-factory.c (backend_destroy_cb): New callback used when a
backend is destroyed. Removes the backend from the factory's hash
table and unrefs the factory if all backends go away.
(add_calendar_client): Free the environment.
* cal.c (cal_new): Use bonobo_object_unref() if we fail to
initialize.
* cal-listener.c (cal_listener_new): Likewise.
* layout.c (layout_events): Plug li.partition memory leak.
svn path=/trunk/; revision=1742
Diffstat (limited to 'calendar/pcs/cal.c')
-rw-r--r-- | calendar/pcs/cal.c | 57 |
1 files changed, 55 insertions, 2 deletions
diff --git a/calendar/pcs/cal.c b/calendar/pcs/cal.c index 358f08167d..158e4c493c 100644 --- a/calendar/pcs/cal.c +++ b/calendar/pcs/cal.c @@ -226,6 +226,7 @@ Cal_get_uids (PortableServer_Servant servant, n = g_list_length (uids); seq = Evolution_Calendar_CalObjUIDSeq__alloc (); + CORBA_sequence_set_release (seq, TRUE); seq->_length = n; seq->_buffer = CORBA_sequence_Evolution_Calendar_CalObjUID_allocbuf (n); @@ -279,6 +280,7 @@ Cal_get_events_in_range (PortableServer_Servant servant, n = g_list_length (elist); seq = Evolution_Calendar_CalObjInstanceSeq__alloc (); + CORBA_sequence_set_release (seq, TRUE); seq->_length = n; seq->_buffer = CORBA_sequence_Evolution_Calendar_CalObjInstance_allocbuf (n); @@ -304,6 +306,25 @@ Cal_get_events_in_range (PortableServer_Servant servant, return seq; } +/* Cal::update_object method */ +static void +Cal_update_object (PortableServer_Servant servant, + const Evolution_Calendar_CalObjUID uid, + const Evolution_Calendar_CalObj calobj, + CORBA_Environment *ev) +{ + Cal *cal; + CalPrivate *priv; + + cal = CAL (bonobo_object_from_servant (servant)); + priv = cal->priv; + + if (!cal_backend_update_object (priv->backend, uid, calobj)) + CORBA_exception_set (ev, CORBA_USER_EXCEPTION, + ex_Evolution_Calendar_Cal_InvalidObject, + NULL); +} + /** * cal_get_epv: * @void: @@ -322,6 +343,7 @@ cal_get_epv (void) epv->get_object = Cal_get_object; epv->get_uids = Cal_get_uids; epv->get_events_in_range = Cal_get_events_in_range; + epv->update_object = Cal_update_object; return epv; } @@ -438,7 +460,7 @@ cal_new (CalBackend *backend, Evolution_Calendar_Listener listener) ret = CORBA_Object_is_nil ((CORBA_Object) corba_cal, &ev); if (ev._major != CORBA_NO_EXCEPTION || ret) { g_message ("cal_new(): could not create the CORBA object"); - gtk_object_unref (GTK_OBJECT (cal)); + bonobo_object_unref (BONOBO_OBJECT (cal)); CORBA_exception_free (&ev); return NULL; } @@ -448,9 +470,40 @@ cal_new (CalBackend *backend, Evolution_Calendar_Listener listener) retval = cal_construct (cal, corba_cal, backend, listener); if (!retval) { g_message ("cal_new(): could not construct the calendar client interface"); - gtk_object_unref (GTK_OBJECT (cal)); + bonobo_object_unref (BONOBO_OBJECT (cal)); return NULL; } return retval; } + +/** + * cal_notify_update: + * @cal: A calendar client interface. + * @uid: UID of object that was updated. + * + * Notifies a listener attached to a calendar client interface object about an + * update to a calendar object. + **/ +void +cal_notify_update (Cal *cal, const char *uid) +{ + CalPrivate *priv; + CORBA_Environment ev; + + g_return_if_fail (cal != NULL); + g_return_if_fail (IS_CAL (cal)); + g_return_if_fail (uid != NULL); + + priv = cal->priv; + g_return_if_fail (priv->listener != CORBA_OBJECT_NIL); + + CORBA_exception_init (&ev); + Evolution_Calendar_Listener_obj_updated (priv->listener, uid, &ev); + + if (ev._major != CORBA_NO_EXCEPTION) + g_message ("cal_notify_update(): could not notify the listener " + "about an updated object"); + + CORBA_exception_free (&ev); +} |