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 /calendar/cal-client/cal-client.c | |
parent | 9d4be61768f69a0aff9daa55c088724d0d5a54a6 (diff) | |
download | gsoc2013-evolution-9d6fc52249f34b5a3985bea8ace18059be9e4bba.tar.gz 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
Diffstat (limited to 'calendar/cal-client/cal-client.c')
-rw-r--r-- | calendar/cal-client/cal-client.c | 60 |
1 files changed, 54 insertions, 6 deletions
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; +} |