Name
CalClient -- GTK+ object for communication with personal calendar server.
Synopsis
#include <cal-client/cal-client.h>
#define CAL_CLIENT (obj)
enum CalClientLoadStatus;
enum CalClientGetStatus;
CalClient* cal_client_new (void);
gboolean cal_client_load_calendar (CalClient *client,
const char *str_uri);
gboolean cal_client_create_calendar (CalClient *client,
const char *str_uri);
int cal_client_get_n_objects (CalClient *client,
CalObjType type);
CalClientGetStatus cal_client_get_object (CalClient *client,
const char *uid,
CalComponent **comp);
GList* cal_client_get_objects_in_range (CalClient *client,
CalObjType type,
time_t start,
time_t end);
void cal_client_generate_instances (CalClient *client,
CalObjType type,
time_t start,
time_t end,
CalRecurInstanceFn cb,
gpointer cb_data);
CalClientGetStatus cal_client_get_uid_by_pilot_id
(CalClient *client,
unsigned long pilot_id,
char **uid);
void cal_client_update_pilot_id (CalClient *client,
char *uid,
unsigned long pilot_id,
unsigned long pilot_status);
GList* cal_client_get_uids (CalClient *client,
CalObjType type);
GList* cal_client_get_alarms_in_range (CalClient *client,
time_t start,
time_t end);
gboolean cal_client_get_alarms_for_object
(CalClient *client,
const char *uid,
time_t start,
time_t end,
GList **alarms);
gboolean cal_client_update_object (CalClient *client,
CalComponent *comp);
gboolean cal_client_remove_object (CalClient *client,
const char *uid);
|
Description
The CalClient object provides a nice GTK+ wrapper for the CORBA
interfaces that are used to communicate between calendar clients
and the personal calendar server in the user's Wombat daemon. The
CORBA interfaces transfer calendar components in RFC 2445 text
format; the CalClient object automatically converts these into
CalComponent structures that are easier to handle.
After a CalClient object is created with cal_client_new(), it
should be asked to send a request to the personal calendar server
to load or create a calendar based on its URI. The server will
asynchronously notify the client about completion of the request,
and will return an appropriate result code; this should be noted
by the client with the cal_loaded signal.
When a client asks the server to update or delete a calendar
component from the storage, the server will do so and then notify
all the clients about the update or removal. This is the core of
the model/view split between calendar clients and the storage in
the personal calendar server. Clients should watch the obj_updated and obj_removed signals on the
CalClient objects they create so that they can be notified about
changes in the storage.
Details
CAL_CLIENT()
#define CAL_CLIENT(obj) (GTK_CHECK_CAST ((obj), CAL_CLIENT_TYPE, CalClient)) |
Casts a GtkObject to a CalClient.
enum CalClientLoadStatus
typedef enum {
CAL_CLIENT_LOAD_SUCCESS,
CAL_CLIENT_LOAD_ERROR,
CAL_CLIENT_LOAD_IN_USE,
CAL_CLIENT_LOAD_METHOD_NOT_SUPPORTED
} CalClientLoadStatus; |
These values describe the status of a calendar load or create
request. After asking a calendar factory to load or create a
calendar, the provided listener will get notification about the
result in asynchronous fashion. Such notification is represented
by one of these enumeration values. For values other than
CAL_CLIENT_LOAD_SUCCESS, the CalClient object will not accept
any other operations on the calendar and it should just be
destroyed.
enum CalClientGetStatus
typedef enum {
CAL_CLIENT_GET_SUCCESS,
CAL_CLIENT_GET_NOT_FOUND,
CAL_CLIENT_GET_SYNTAX_ERROR
} CalClientGetStatus; |
These values describe the result of the cal_client_get_object()
function.
cal_client_load_calendar ()
gboolean cal_client_load_calendar (CalClient *client,
const char *str_uri); |
Makes a calendar client initiate a request to load a calendar. The calendar
client will emit the "cal_loaded" signal when the response from the server is
received.
cal_client_create_calendar ()
gboolean cal_client_create_calendar (CalClient *client,
const char *str_uri); |
Makes a calendar client initiate a request to create a new calendar. The
calendar client will emit the "cal_loaded" signal when the response from the
server is received.
cal_client_get_n_objects ()
Counts the number of calendar components of the specified type. This can be
used to count how many events, to-dos, or journals there are, for example.
cal_client_get_object ()
Queries a calendar for a calendar component object based on its unique
identifier.
cal_client_get_objects_in_range ()
GList* cal_client_get_objects_in_range (CalClient *client,
CalObjType type,
time_t start,
time_t end); |
Queries a calendar for the objects that occur or recur in the specified range
of time.
cal_client_get_uid_by_pilot_id ()
cal_client_update_pilot_id ()
void cal_client_update_pilot_id (CalClient *client,
char *uid,
unsigned long pilot_id,
unsigned long pilot_status); |
cal_client_get_uids ()
Queries a calendar for a list of unique identifiers corresponding to calendar
objects whose type matches one of the types specified in the type flags.
cal_client_get_alarms_in_range ()
GList* cal_client_get_alarms_in_range (CalClient *client,
time_t start,
time_t end); |
Queries a calendar for the alarms that trigger in the specified range of
time.
cal_client_get_alarms_for_object ()
gboolean cal_client_get_alarms_for_object
(CalClient *client,
const char *uid,
time_t start,
time_t end,
GList **alarms); |
Queries a calendar for the alarms of a particular object that trigger in the
specified range of time.
cal_client_update_object ()
Asks a calendar to update a component. Any existing component with the
specified component's UID will be replaced. The client program should not
assume that the object is actually in the server's storage until it has
received the "obj_updated" notification signal.
cal_client_remove_object ()
gboolean cal_client_remove_object (CalClient *client,
const char *uid); |
Signals
The "cal-loaded" signal
void user_function (CalClient *calclient,
GtkEnum arg1,
gpointer user_data); |
This signal is emitted some time after the calendar clients sends
a load or create request to the personal calendar server. The
server will notify the client asynchronously of the completion of
the request. The status parameter indicates the status of the
request.
The "obj-updated" signal
void user_function (CalClient *calclient,
GtkString arg1,
gpointer user_data); |
This signal is emitted when the calendar clients receives
notification of a calendar component's data being changed in the
personal calendar server. Graphical clients may want to get the
new version of the object and update their display, for example.
The "obj-removed" signal
void user_function (CalClient *calclient,
GtkString arg1,
gpointer user_data); |
This signal is emitted when the calendar client receives
notification for a calendar component being removed from the
storage in the personal calendar server. Graphical clients may
want to delete the corresponding object from their display, for
example.