aboutsummaryrefslogtreecommitdiffstats
path: root/calendar/cal-client
diff options
context:
space:
mode:
authorFederico Mena Quintero <federico@helixcode.com>2000-02-02 17:51:20 +0800
committerArturo Espinosa <unammx@src.gnome.org>2000-02-02 17:51:20 +0800
commit9d6fc52249f34b5a3985bea8ace18059be9e4bba (patch)
tree59ac26466d87061d4573e72fe228d47b77dbb318 /calendar/cal-client
parent9d4be61768f69a0aff9daa55c088724d0d5a54a6 (diff)
downloadgsoc2013-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
Diffstat (limited to 'calendar/cal-client')
-rw-r--r--calendar/cal-client/cal-client.c60
-rw-r--r--calendar/cal-client/cal-client.h2
-rw-r--r--calendar/cal-client/cal-listener.c7
3 files changed, 60 insertions, 9 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;
+}
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;
}