diff options
author | nobody <nobody@localhost> | 2003-04-02 01:15:53 +0800 |
---|---|---|
committer | nobody <nobody@localhost> | 2003-04-02 01:15:53 +0800 |
commit | 2e5b2bbb530b642dda56b332cfd93810ac415098 (patch) | |
tree | e2b63c11a404a5dd99d407c989c8846fd0d5379d /calendar/cal-client | |
parent | 5cda225087bfdc66e19edb703689e8af655e171c (diff) | |
download | gsoc2013-evolution-EVOLUTION_1_2_4.tar gsoc2013-evolution-EVOLUTION_1_2_4.tar.gz gsoc2013-evolution-EVOLUTION_1_2_4.tar.bz2 gsoc2013-evolution-EVOLUTION_1_2_4.tar.lz gsoc2013-evolution-EVOLUTION_1_2_4.tar.xz gsoc2013-evolution-EVOLUTION_1_2_4.tar.zst gsoc2013-evolution-EVOLUTION_1_2_4.zip |
This commit was manufactured by cvs2svn to create tagEVOLUTION_1_2_4
'EVOLUTION_1_2_4'.
svn path=/tags/EVOLUTION_1_2_4/; revision=20614
Diffstat (limited to 'calendar/cal-client')
-rw-r--r-- | calendar/cal-client/cal-client.c | 453 | ||||
-rw-r--r-- | calendar/cal-client/cal-client.h | 29 |
2 files changed, 201 insertions, 281 deletions
diff --git a/calendar/cal-client/cal-client.c b/calendar/cal-client/cal-client.c index 9921899636..f0730b2326 100644 --- a/calendar/cal-client/cal-client.c +++ b/calendar/cal-client/cal-client.c @@ -22,14 +22,14 @@ #include <config.h> #endif -#include <string.h> -#include <bonobo-activation/bonobo-activation.h> +#include <gtk/gtksignal.h> +#include <liboaf/liboaf.h> #include <bonobo/bonobo-exception.h> +#include <bonobo/bonobo-moniker-util.h> +#include <bonobo-conf/bonobo-config-database.h> #include <libgnome/gnome-util.h> #include "e-util/e-component-listener.h" -#include "e-util/e-config-listener.h" -#include "cal-util/cal-util-marshal.h" #include "cal-client-types.h" #include "cal-client.h" #include "cal-listener.h" @@ -98,9 +98,9 @@ enum { LAST_SIGNAL }; -static void cal_client_class_init (CalClientClass *klass); -static void cal_client_init (CalClient *client, CalClientClass *klass); -static void cal_client_finalize (GObject *object); +static void cal_client_class_init (CalClientClass *class); +static void cal_client_init (CalClient *client); +static void cal_client_destroy (GtkObject *object); static char *client_get_password_cb (WombatClient *w_client, const gchar *prompt, @@ -114,7 +114,7 @@ static void cal_client_get_object_timezones_cb (icalparameter *param, static guint cal_client_signals[LAST_SIGNAL]; -static GObjectClass *parent_class; +static GtkObjectClass *parent_class; @@ -126,185 +126,121 @@ static GObjectClass *parent_class; * * Return value: The type ID of the #CalClient class. **/ -GType +GtkType cal_client_get_type (void) { - static GType cal_client_type = 0; + static GtkType cal_client_type = 0; if (!cal_client_type) { - static GTypeInfo info = { - sizeof (CalClientClass), - (GBaseInitFunc) NULL, - (GBaseFinalizeFunc) NULL, - (GClassInitFunc) cal_client_class_init, - NULL, NULL, - sizeof (CalClient), - 0, - (GInstanceInitFunc) cal_client_init - }; - cal_client_type = g_type_register_static (G_TYPE_OBJECT, "CalClient", &info, 0); - } - - return cal_client_type; -} - -GType -cal_client_open_status_enum_get_type (void) -{ - static GType cal_client_open_status_enum_type = 0; - - if (!cal_client_open_status_enum_type) { - static GEnumValue values [] = { - { CAL_CLIENT_OPEN_SUCCESS, "CalClientOpenSuccess", "success" }, - { CAL_CLIENT_OPEN_ERROR, "CalClientOpenError", "error" }, - { CAL_CLIENT_OPEN_NOT_FOUND, "CalClientOpenNotFound", "not-found" }, - { CAL_CLIENT_OPEN_PERMISSION_DENIED, "CalClientOpenPermissionDenied", "denied" }, - { CAL_CLIENT_OPEN_METHOD_NOT_SUPPORTED, "CalClientOpenMethodNotSupported", "unsupported" }, - { -1, NULL, NULL } + static const GtkTypeInfo cal_client_info = { + "CalClient", + sizeof (CalClient), + sizeof (CalClientClass), + (GtkClassInitFunc) cal_client_class_init, + (GtkObjectInitFunc) cal_client_init, + NULL, /* reserved_1 */ + NULL, /* reserved_2 */ + (GtkClassInitFunc) NULL }; - cal_client_open_status_enum_type = g_enum_register_static ("CalClientOpenStatusEnum", values); + cal_client_type = gtk_type_unique (GTK_TYPE_OBJECT, &cal_client_info); } - return cal_client_open_status_enum_type; -} - -GType -cal_client_set_mode_status_enum_get_type (void) -{ - static GType cal_client_set_mode_status_enum_type = 0; - - if (!cal_client_set_mode_status_enum_type) { - static GEnumValue values [] = { - { CAL_CLIENT_SET_MODE_SUCCESS, "CalClientSetModeSuccess", "success" }, - { CAL_CLIENT_SET_MODE_ERROR, "CalClientSetModeError", "error" }, - { CAL_CLIENT_SET_MODE_NOT_SUPPORTED, "CalClientSetModeNotSupported", "unsupported" }, - { -1, NULL, NULL } - }; - - cal_client_set_mode_status_enum_type = - g_enum_register_static ("CalClientSetModeStatusEnum", values); - } - - return cal_client_set_mode_status_enum_type; + return cal_client_type; } -GType -cal_mode_enum_get_type (void) -{ - static GType cal_mode_enum_type = 0; - - if (!cal_mode_enum_type) { - static GEnumValue values [] = { - { CAL_MODE_INVALID, "CalModeInvalid", "invalid" }, - { CAL_MODE_LOCAL, "CalModeLocal", "local" }, - { CAL_MODE_REMOTE, "CalModeRemote", "remote" }, - { CAL_MODE_ANY, "CalModeAny", "any" }, - { -1, NULL, NULL } - }; - - cal_mode_enum_type = g_enum_register_static ("CalModeEnum", values); - } - - return cal_mode_enum_type; -} +#define marshal_NONE__ENUM_ENUM gtk_marshal_NONE__INT_INT /* Class initialization function for the calendar client */ static void -cal_client_class_init (CalClientClass *klass) +cal_client_class_init (CalClientClass *class) { - GObjectClass *object_class; + GtkObjectClass *object_class; - object_class = (GObjectClass *) klass; + object_class = (GtkObjectClass *) class; - parent_class = g_type_class_peek_parent (klass); + parent_class = gtk_type_class (GTK_TYPE_OBJECT); cal_client_signals[CAL_OPENED] = - g_signal_new ("cal_opened", - G_TYPE_FROM_CLASS (klass), - G_SIGNAL_RUN_FIRST, - G_STRUCT_OFFSET (CalClientClass, cal_opened), - NULL, NULL, - g_cclosure_marshal_VOID__ENUM, - G_TYPE_NONE, 1, - CAL_CLIENT_OPEN_STATUS_ENUM_TYPE); + gtk_signal_new ("cal_opened", + GTK_RUN_FIRST, + object_class->type, + GTK_SIGNAL_OFFSET (CalClientClass, cal_opened), + gtk_marshal_NONE__ENUM, + GTK_TYPE_NONE, 1, + GTK_TYPE_ENUM); cal_client_signals[CAL_SET_MODE] = - g_signal_new ("cal_set_mode", - G_TYPE_FROM_CLASS (klass), - G_SIGNAL_RUN_FIRST, - G_STRUCT_OFFSET (CalClientClass, cal_set_mode), - NULL, NULL, - cal_util_marshal_VOID__ENUM_ENUM, - G_TYPE_NONE, 2, - CAL_CLIENT_SET_MODE_STATUS_ENUM_TYPE, - CAL_MODE_ENUM_TYPE); + gtk_signal_new ("cal_set_mode", + GTK_RUN_FIRST, + object_class->type, + GTK_SIGNAL_OFFSET (CalClientClass, cal_set_mode), + marshal_NONE__ENUM_ENUM, + GTK_TYPE_NONE, 2, + GTK_TYPE_ENUM, + GTK_TYPE_ENUM); cal_client_signals[OBJ_UPDATED] = - g_signal_new ("obj_updated", - G_TYPE_FROM_CLASS (klass), - G_SIGNAL_RUN_FIRST, - G_STRUCT_OFFSET (CalClientClass, obj_updated), - NULL, NULL, - g_cclosure_marshal_VOID__STRING, - G_TYPE_NONE, 1, - G_TYPE_STRING); + gtk_signal_new ("obj_updated", + GTK_RUN_FIRST, + object_class->type, + GTK_SIGNAL_OFFSET (CalClientClass, obj_updated), + gtk_marshal_NONE__STRING, + GTK_TYPE_NONE, 1, + GTK_TYPE_STRING); cal_client_signals[OBJ_REMOVED] = - g_signal_new ("obj_removed", - G_TYPE_FROM_CLASS (klass), - G_SIGNAL_RUN_FIRST, - G_STRUCT_OFFSET (CalClientClass, obj_removed), - NULL, NULL, - g_cclosure_marshal_VOID__STRING, - G_TYPE_NONE, 1, - G_TYPE_STRING); + gtk_signal_new ("obj_removed", + GTK_RUN_FIRST, + object_class->type, + GTK_SIGNAL_OFFSET (CalClientClass, obj_removed), + gtk_marshal_NONE__STRING, + GTK_TYPE_NONE, 1, + GTK_TYPE_STRING); cal_client_signals[BACKEND_ERROR] = - g_signal_new ("backend_error", - G_TYPE_FROM_CLASS (klass), - G_SIGNAL_RUN_FIRST, - G_STRUCT_OFFSET (CalClientClass, backend_error), - NULL, NULL, - g_cclosure_marshal_VOID__STRING, - G_TYPE_NONE, 1, - G_TYPE_STRING); + gtk_signal_new ("backend_error", + GTK_RUN_FIRST, + object_class->type, + GTK_SIGNAL_OFFSET (CalClientClass, backend_error), + gtk_marshal_NONE__STRING, + GTK_TYPE_NONE, 1, + GTK_TYPE_STRING); cal_client_signals[CATEGORIES_CHANGED] = - g_signal_new ("categories_changed", - G_TYPE_FROM_CLASS (klass), - G_SIGNAL_RUN_FIRST, - G_STRUCT_OFFSET (CalClientClass, categories_changed), - NULL, NULL, - g_cclosure_marshal_VOID__POINTER, - G_TYPE_NONE, 1, - G_TYPE_POINTER); + gtk_signal_new ("categories_changed", + GTK_RUN_FIRST, + object_class->type, + GTK_SIGNAL_OFFSET (CalClientClass, categories_changed), + gtk_marshal_NONE__POINTER, + GTK_TYPE_NONE, 1, + GTK_TYPE_POINTER); cal_client_signals[FORGET_PASSWORD] = - g_signal_new ("forget_password", - G_TYPE_FROM_CLASS (klass), - G_SIGNAL_RUN_FIRST, - G_STRUCT_OFFSET (CalClientClass, forget_password), - NULL, NULL, - g_cclosure_marshal_VOID__STRING, - G_TYPE_NONE, 1, - G_TYPE_STRING); + gtk_signal_new ("forget_password", + GTK_RUN_FIRST, + object_class->type, + GTK_SIGNAL_OFFSET (CalClientClass, forget_password), + gtk_marshal_NONE__STRING, + GTK_TYPE_NONE, 1, + GTK_TYPE_STRING); cal_client_signals[BACKEND_DIED] = - g_signal_new ("backend_died", - G_TYPE_FROM_CLASS (klass), - G_SIGNAL_RUN_FIRST, - G_STRUCT_OFFSET (CalClientClass, backend_died), - NULL, NULL, - g_cclosure_marshal_VOID__VOID, - G_TYPE_NONE, 0); + gtk_signal_new ("backend_died", + GTK_RUN_FIRST, + object_class->type, + GTK_SIGNAL_OFFSET (CalClientClass, backend_died), + gtk_marshal_NONE__NONE, + GTK_TYPE_NONE, 0); - klass->cal_opened = NULL; - klass->obj_updated = NULL; - klass->obj_removed = NULL; - klass->categories_changed = NULL; - klass->forget_password = NULL; - klass->backend_died = NULL; + gtk_object_class_add_signals (object_class, cal_client_signals, LAST_SIGNAL); - object_class->finalize = cal_client_finalize; + class->cal_opened = NULL; + class->obj_updated = NULL; + class->obj_removed = NULL; + class->categories_changed = NULL; + class->forget_password = NULL; + class->backend_died = NULL; + + object_class->destroy = cal_client_destroy; } /* Object initialization function for the calendar client */ static void -cal_client_init (CalClient *client, CalClientClass *klass) +cal_client_init (CalClient *client) { CalClientPrivate *priv; @@ -412,9 +348,9 @@ free_timezone (gpointer key, gpointer value, gpointer data) icaltimezone_free (value, TRUE); } -/* Finalize handler for the calendar client */ +/* Destroy handler for the calendar client */ static void -cal_client_finalize (GObject *object) +cal_client_destroy (GtkObject *object) { CalClient *client; CalClientPrivate *priv; @@ -432,16 +368,13 @@ cal_client_finalize (GObject *object) } if (priv->comp_listener) { - g_signal_handlers_disconnect_matched (G_OBJECT (priv->comp_listener), - G_SIGNAL_MATCH_DATA, - 0, 0, NULL, NULL, - client); - g_object_unref (G_OBJECT (priv->comp_listener)); + gtk_signal_disconnect_by_data (GTK_OBJECT (priv->comp_listener), client); + gtk_object_unref (GTK_OBJECT (priv->comp_listener)); priv->comp_listener = NULL; } priv->w_client = NULL; - /* destroy_factories (client); */ + destroy_factories (client); destroy_cal (client); priv->load_state = CAL_CLIENT_LOAD_NOT_LOADED; @@ -475,8 +408,8 @@ cal_client_finalize (GObject *object) g_free (priv); client->priv = NULL; - if (G_OBJECT_CLASS (parent_class)->finalize) - (* G_OBJECT_CLASS (parent_class)->finalize) (object); + if (GTK_OBJECT_CLASS (parent_class)->destroy) + (* GTK_OBJECT_CLASS (parent_class)->destroy) (object); } @@ -491,7 +424,7 @@ backend_died_cb (EComponentListener *cl, gpointer user_data) priv = client->priv; priv->load_state = CAL_CLIENT_LOAD_NOT_LOADED; - g_signal_emit (G_OBJECT (client), cal_client_signals[BACKEND_DIED], 0); + gtk_signal_emit (GTK_OBJECT (client), cal_client_signals[BACKEND_DIED]); } /* Signal handlers for the listener's signals */ @@ -535,8 +468,8 @@ cal_opened_cb (CalListener *listener, /* setup component listener */ priv->comp_listener = e_component_listener_new (priv->cal, 0); - g_signal_connect (G_OBJECT (priv->comp_listener), "component_died", - G_CALLBACK (backend_died_cb), client); + gtk_signal_connect (GTK_OBJECT (priv->comp_listener), "component_died", + GTK_SIGNAL_FUNC (backend_died_cb), client); goto out; case GNOME_Evolution_Calendar_Listener_ERROR: @@ -577,10 +510,10 @@ cal_opened_cb (CalListener *listener, * signal and clean up. */ - g_object_ref (G_OBJECT (client)); + gtk_object_ref (GTK_OBJECT (client)); - g_signal_emit (G_OBJECT (client), cal_client_signals[CAL_OPENED], - 0, client_status); + gtk_signal_emit (GTK_OBJECT (client), cal_client_signals[CAL_OPENED], + client_status); if (client_status != CAL_CLIENT_OPEN_SUCCESS) { priv->load_state = CAL_CLIENT_LOAD_NOT_LOADED; @@ -590,7 +523,7 @@ cal_opened_cb (CalListener *listener, g_assert (priv->load_state != CAL_CLIENT_LOAD_LOADING); - g_object_unref (G_OBJECT (client)); + gtk_object_unref (GTK_OBJECT (client)); } /* Handle the cal_set_mode notification from the listener */ @@ -629,32 +562,32 @@ cal_set_mode_cb (CalListener *listener, * signal and clean up. */ - g_object_ref (G_OBJECT (client)); + gtk_object_ref (GTK_OBJECT (client)); - g_signal_emit (G_OBJECT (client), cal_client_signals[CAL_SET_MODE], - 0, client_status, mode); + gtk_signal_emit (GTK_OBJECT (client), cal_client_signals[CAL_SET_MODE], + client_status, mode); - g_object_unref (G_OBJECT (client)); + gtk_object_unref (GTK_OBJECT (client)); } /* Handle the obj_updated signal from the listener */ static void -obj_updated_cb (CalListener *listener, const CORBA_char *uid, gpointer data) +obj_updated_cb (CalListener *listener, const GNOME_Evolution_Calendar_CalObjUID uid, gpointer data) { CalClient *client; client = CAL_CLIENT (data); - g_signal_emit (G_OBJECT (client), cal_client_signals[OBJ_UPDATED], 0, uid); + gtk_signal_emit (GTK_OBJECT (client), cal_client_signals[OBJ_UPDATED], uid); } /* Handle the obj_removed signal from the listener */ static void -obj_removed_cb (CalListener *listener, const CORBA_char *uid, gpointer data) +obj_removed_cb (CalListener *listener, const GNOME_Evolution_Calendar_CalObjUID uid, gpointer data) { CalClient *client; client = CAL_CLIENT (data); - g_signal_emit (G_OBJECT (client), cal_client_signals[OBJ_REMOVED], 0, uid); + gtk_signal_emit (GTK_OBJECT (client), cal_client_signals[OBJ_REMOVED], uid); } /* Handle the error_occurred signal from the listener */ @@ -664,7 +597,7 @@ backend_error_cb (CalListener *listener, const char *message, gpointer data) CalClient *client; client = CAL_CLIENT (data); - g_signal_emit (G_OBJECT (client), cal_client_signals[BACKEND_ERROR], 0, message); + gtk_signal_emit (GTK_OBJECT (client), cal_client_signals[BACKEND_ERROR], message); } /* Handle the categories_changed signal from the listener */ @@ -684,7 +617,7 @@ categories_changed_cb (CalListener *listener, const GNOME_Evolution_Calendar_Str for (i = 0; i < categories->_length; i++) cats->pdata[i] = categories->_buffer[i]; - g_signal_emit (G_OBJECT (client), cal_client_signals[CATEGORIES_CHANGED], 0, cats); + gtk_signal_emit (GTK_OBJECT (client), cal_client_signals[CATEGORIES_CHANGED], cats); g_ptr_array_free (cats, TRUE); } @@ -719,28 +652,40 @@ client_forget_password_cb (WombatClient *w_client, client = CAL_CLIENT (user_data); g_return_if_fail (IS_CAL_CLIENT (client)); - g_signal_emit (G_OBJECT (client), - cal_client_signals [FORGET_PASSWORD], - 0, key); + gtk_signal_emit (GTK_OBJECT (client), + cal_client_signals [FORGET_PASSWORD], + key); } -static GList * -get_factories (void) +/** + * cal_client_construct: + * @client: A calendar client. + * + * Constructs a calendar client object by contacting all available + * calendar factories. + * + * Return value: The same object as the @client argument, or NULL if the + * calendar factory could not be contacted. + **/ +CalClient * +cal_client_construct (CalClient *client) { - static GList *factories = NULL; + CalClientPrivate *priv; GNOME_Evolution_Calendar_CalFactory factory; - Bonobo_ServerInfoList *servers; + OAF_ServerInfoList *servers; CORBA_Environment ev; int i; - if (factories != NULL) - return factories; + g_return_val_if_fail (client != NULL, NULL); + g_return_val_if_fail (IS_CAL_CLIENT (client), NULL); + + priv = client->priv; CORBA_exception_init (&ev); - servers = bonobo_activation_query ("repo_ids.has ('IDL:GNOME/Evolution/Calendar/CalFactory:1.0')", NULL, &ev); + servers = oaf_query ("repo_ids.has ('IDL:GNOME/Evolution/Calendar/CalFactory:1.0')", NULL, &ev); if (ev._major != CORBA_NO_EXCEPTION) { g_message ("Cannot perform OAF query for Calendar servers."); CORBA_exception_free (&ev); @@ -751,50 +696,25 @@ get_factories (void) g_warning ("No Calendar servers installed."); for (i = 0; i < servers->_length; i++) { - const Bonobo_ServerInfo *info; + const OAF_ServerInfo *info; info = servers->_buffer + i; factory = (GNOME_Evolution_Calendar_CalFactory) - bonobo_activation_activate_from_id (info->iid, 0, NULL, &ev); + oaf_activate_from_id (info->iid, 0, NULL, &ev); if (BONOBO_EX (&ev)) { -#if 0 g_warning ("cal_client_construct: Could not activate calendar server %s", info->iid); CORBA_free (servers); CORBA_exception_free (&ev); return NULL; -#endif } - else - factories = g_list_prepend (factories, factory); + + priv->factories = g_list_prepend (priv->factories, factory); } CORBA_free (servers); - CORBA_exception_free (&ev); - return factories; -} - -/** - * cal_client_construct: - * @client: A calendar client. - * - * Constructs a calendar client object by contacting all available - * calendar factories. - * - * Return value: The same object as the @client argument, or NULL if the - * calendar factory could not be contacted. - **/ -CalClient * -cal_client_construct (CalClient *client) -{ - CalClientPrivate *priv; - - g_return_val_if_fail (client != NULL, NULL); - g_return_val_if_fail (IS_CAL_CLIENT (client), NULL); - - priv = client->priv; - priv->factories = get_factories (); + CORBA_exception_free (&ev); return client; } @@ -812,11 +732,11 @@ cal_client_new (void) { CalClient *client; - client = g_object_new (CAL_CLIENT_TYPE, NULL); + client = gtk_type_new (CAL_CLIENT_TYPE); if (!cal_client_construct (client)) { g_message ("cal_client_new(): could not construct the calendar client"); - g_object_unref (G_OBJECT (client)); + gtk_object_unref (GTK_OBJECT (client)); return NULL; } @@ -964,21 +884,31 @@ get_fall_back_uri (gboolean tasks) static char * get_default_uri (gboolean tasks) { - EConfigListener *db; + Bonobo_ConfigDatabase db; char *uri; + CORBA_Environment ev; - db = e_config_listener_new (); + CORBA_exception_init (&ev); + + db = bonobo_get_object ("wombat:", "Bonobo/ConfigDatabase", &ev); + if (BONOBO_EX (&ev) || db == CORBA_OBJECT_NIL) { + CORBA_exception_free (&ev); + return NULL; + } + if (tasks) - uri = e_config_listener_get_string (db, "/apps/evolution/shell/default_folders/tasks_uri"); + uri = bonobo_config_get_string (db, "/DefaultFolders/tasks_uri", &ev); else - uri = e_config_listener_get_string (db, "/apps/evolution/shell/default_folders/calendar_uri"); - g_object_unref (G_OBJECT (db)); + uri = bonobo_config_get_string (db, "/DefaultFolders/calendar_uri", &ev); + bonobo_object_release_unref (db, NULL); - if (!uri) + if (BONOBO_EX (&ev)) { + CORBA_exception_free (&ev); uri = get_fall_back_uri (tasks); - else + } else { uri = cal_util_expand_uri (uri, tasks); + } return uri; } @@ -1075,10 +1005,8 @@ cal_client_uri_list (CalClient *client, CalMode mode) uris = NULL; break; } - else { + else uris = g_list_concat (uris, build_uri_list (uri_seq)); - CORBA_free (uri_seq); - } CORBA_exception_free (&ev); } @@ -1101,8 +1029,8 @@ cal_client_get_load_state (CalClient *client) { CalClientPrivate *priv; - g_return_val_if_fail (client != NULL, CAL_CLIENT_LOAD_NOT_LOADED); - g_return_val_if_fail (IS_CAL_CLIENT (client), CAL_CLIENT_LOAD_NOT_LOADED); + g_return_val_if_fail (client != NULL, FALSE); + g_return_val_if_fail (IS_CAL_CLIENT (client), FALSE); priv = client->priv; return priv->load_state; @@ -1145,13 +1073,12 @@ cal_client_is_read_only (CalClient *client) CORBA_Environment ev; CORBA_boolean read_only; - g_return_val_if_fail (client != NULL, FALSE); - g_return_val_if_fail (IS_CAL_CLIENT (client), FALSE); + g_return_val_if_fail (client != NULL, TRUE); + g_return_val_if_fail (IS_CAL_CLIENT (client), TRUE); priv = client->priv; - if (priv->load_state != CAL_CLIENT_LOAD_LOADED) - return FALSE; + g_return_val_if_fail (priv->load_state == CAL_CLIENT_LOAD_LOADED, FALSE); CORBA_exception_init (&ev); read_only = GNOME_Evolution_Calendar_Cal_isReadOnly (priv->cal, &ev); @@ -1448,7 +1375,7 @@ cal_client_get_default_object (CalClient *client, CalObjType type, CalComponent *comp = cal_component_new (); if (!cal_component_set_icalcomponent (*comp, icalcomp)) { icalcomponent_free (icalcomp); - g_object_unref (*comp); + gtk_object_unref (GTK_OBJECT (*comp)); *comp = NULL; retval = CAL_CLIENT_GET_SYNTAX_ERROR; @@ -1530,7 +1457,7 @@ cal_client_get_object (CalClient *client, const char *uid, CalComponent **comp) *comp = cal_component_new (); if (!cal_component_set_icalcomponent (*comp, icalcomp)) { icalcomponent_free (icalcomp); - g_object_unref (G_OBJECT (*comp)); + gtk_object_unref (GTK_OBJECT (*comp)); *comp = NULL; retval = CAL_CLIENT_GET_SYNTAX_ERROR; @@ -1540,7 +1467,7 @@ cal_client_get_object (CalClient *client, const char *uid, CalComponent **comp) /* Now make sure we have all timezones needed for this object. We do this to try to avoid any problems caused by getting a timezone in the middle of other code. Any calls to ORBit result in a - recursive call of the GLib main loop, which can cause problems for + recursive call of the GTK+ main loop, which can cause problems for code that doesn't expect it. Currently GnomeCanvas has problems if we try to get a timezone in the middle of a redraw, and there is a resize pending, which leads to an assert failure and an abort. */ @@ -1645,7 +1572,7 @@ cal_client_get_timezone (CalClient *client, tmp_zone = icaltimezone_new (); if (!tmp_zone) { /* FIXME: Needs better error code - out of memory. Or just - abort like GLib does? */ + abort like GTK+ does? */ retval = CAL_CLIENT_GET_NOT_FOUND; goto out; } @@ -1771,7 +1698,7 @@ build_change_list (GNOME_Evolution_Calendar_CalObjChangeSeq *seq) ccc->comp = cal_component_new (); if (!cal_component_set_icalcomponent (ccc->comp, icalcomp)) { icalcomponent_free (icalcomp); - g_object_unref (G_OBJECT (ccc->comp)); + gtk_object_unref (GTK_OBJECT (ccc->comp)); continue; } ccc->type = corba_coc->type; @@ -1966,7 +1893,7 @@ cal_client_get_free_busy (CalClient *client, GList *users, comp = cal_component_new (); if (!cal_component_set_icalcomponent (comp, icalcomp)) { icalcomponent_free (icalcomp); - g_object_unref (G_OBJECT (comp)); + gtk_object_unref (GTK_OBJECT (comp)); continue; } @@ -2003,7 +1930,7 @@ generate_instances_obj_updated_cb (CalClient *client, const char *uid, gpointer return; g_hash_table_remove (uid_comp_hash, uid); - g_object_unref (G_OBJECT (comp)); + gtk_object_unref (GTK_OBJECT (comp)); status = cal_client_get_object (client, uid, &comp); @@ -2040,7 +1967,7 @@ generate_instances_obj_removed_cb (CalClient *client, const char *uid, gpointer return; g_hash_table_remove (uid_comp_hash, uid); - g_object_unref (G_OBJECT (comp)); + gtk_object_unref (GTK_OBJECT (comp)); } /* Adds a component to the list; called from g_hash_table_foreach() */ @@ -2077,13 +2004,13 @@ get_objects_atomically (CalClient *client, CalObjType type, time_t start, time_t /* While we are getting the actual object data, keep track of changes */ - obj_updated_id = g_signal_connect (G_OBJECT (client), "obj_updated", - G_CALLBACK (generate_instances_obj_updated_cb), - uid_comp_hash); + obj_updated_id = gtk_signal_connect (GTK_OBJECT (client), "obj_updated", + GTK_SIGNAL_FUNC (generate_instances_obj_updated_cb), + uid_comp_hash); - obj_removed_id = g_signal_connect (G_OBJECT (client), "obj_removed", - G_CALLBACK (generate_instances_obj_removed_cb), - uid_comp_hash); + obj_removed_id = gtk_signal_connect (GTK_OBJECT (client), "obj_removed", + GTK_SIGNAL_FUNC (generate_instances_obj_removed_cb), + uid_comp_hash); /* Get the objects */ @@ -2126,8 +2053,8 @@ get_objects_atomically (CalClient *client, CalObjType type, time_t start, time_t * notification signals and generate the final list of components. */ - g_signal_handler_disconnect (client, obj_updated_id); - g_signal_handler_disconnect (client, obj_removed_id); + gtk_signal_disconnect (GTK_OBJECT (client), obj_updated_id); + gtk_signal_disconnect (GTK_OBJECT (client), obj_removed_id); objects = NULL; g_hash_table_foreach (uid_comp_hash, add_component, &objects); @@ -2154,7 +2081,7 @@ add_instance (CalComponent *comp, time_t start, time_t end, gpointer data) ci = g_new (struct comp_instance, 1); ci->comp = comp; - g_object_ref (G_OBJECT (ci->comp)); + gtk_object_ref (GTK_OBJECT (ci->comp)); ci->start = start; ci->end = end; @@ -2192,7 +2119,7 @@ compare_comp_instance (gconstpointer a, gconstpointer b) * way so that the generated instances are actually in the server at the time * the initial cal_client_get_objects_in_range() query ends. * - * The callback function should do a g_object_ref() of the calendar component + * The callback function should do a gtk_object_ref() of the calendar component * it gets passed if it intends to keep it around. **/ void @@ -2227,7 +2154,7 @@ cal_client_generate_instances (CalClient *client, CalObjType type, cal_recur_generate_instances (comp, start, end, add_instance, &instances, cal_client_resolve_tzid_cb, client, priv->default_zone); - g_object_unref (G_OBJECT (comp)); + gtk_object_unref (GTK_OBJECT (comp)); } g_list_free (objects); @@ -2254,7 +2181,7 @@ cal_client_generate_instances (CalClient *client, CalObjType type, struct comp_instance *ci; ci = l->data; - g_object_unref (G_OBJECT (ci->comp)); + gtk_object_unref (GTK_OBJECT (ci->comp)); g_free (ci); } @@ -2325,7 +2252,7 @@ build_component_alarms_list (GNOME_Evolution_Calendar_CalComponentAlarmsSeq *seq comp = cal_component_new (); if (!cal_component_set_icalcomponent (comp, icalcomp)) { icalcomponent_free (icalcomp); - g_object_unref (G_OBJECT (comp)); + gtk_object_unref (GTK_OBJECT (comp)); continue; } @@ -2469,7 +2396,7 @@ cal_client_get_alarms_for_object (CalClient *client, const char *uid, comp = cal_component_new (); if (!cal_component_set_icalcomponent (comp, icalcomp)) { icalcomponent_free (icalcomp); - g_object_unref (G_OBJECT (comp)); + gtk_object_unref (GTK_OBJECT (comp)); goto out; } diff --git a/calendar/cal-client/cal-client.h b/calendar/cal-client/cal-client.h index e44014b9be..867557ea08 100644 --- a/calendar/cal-client/cal-client.h +++ b/calendar/cal-client/cal-client.h @@ -21,24 +21,21 @@ #ifndef CAL_CLIENT_H #define CAL_CLIENT_H -#include <glib-object.h> +#include <libgnome/gnome-defs.h> +#include <gtk/gtkobject.h> #include <cal-util/cal-recur.h> #include <cal-util/cal-util.h> #include <cal-client/cal-query.h> -G_BEGIN_DECLS +BEGIN_GNOME_DECLS #define CAL_CLIENT_TYPE (cal_client_get_type ()) -#define CAL_CLIENT(obj) (G_TYPE_CHECK_INSTANCE_CAST ((obj), CAL_CLIENT_TYPE, CalClient)) -#define CAL_CLIENT_CLASS(klass) (G_TYPE_CHECK_CLASS_CAST ((klass), CAL_CLIENT_TYPE, CalClientClass)) -#define IS_CAL_CLIENT(obj) (G_TYPE_CHECK_INSTANCE_TYPE ((obj), CAL_CLIENT_TYPE)) -#define IS_CAL_CLIENT_CLASS(klass) (G_TYPE_CHECK_CLASS_TYPE ((klass), CAL_CLIENT_TYPE)) - -#define CAL_CLIENT_OPEN_STATUS_ENUM_TYPE (cal_client_open_status_enum_get_type ()) -#define CAL_CLIENT_SET_MODE_STATUS_ENUM_TYPE (cal_client_set_mode_status_enum_get_type ()) -#define CAL_MODE_ENUM_TYPE (cal_mode_enum_get_type ()) +#define CAL_CLIENT(obj) (GTK_CHECK_CAST ((obj), CAL_CLIENT_TYPE, CalClient)) +#define CAL_CLIENT_CLASS(klass) (GTK_CHECK_CLASS_CAST ((klass), CAL_CLIENT_TYPE, CalClientClass)) +#define IS_CAL_CLIENT(obj) (GTK_CHECK_TYPE ((obj), CAL_CLIENT_TYPE)) +#define IS_CAL_CLIENT_CLASS(klass) (GTK_CHECK_CLASS_TYPE ((klass), CAL_CLIENT_TYPE)) typedef struct _CalClient CalClient; typedef struct _CalClientClass CalClientClass; @@ -93,14 +90,14 @@ typedef enum { } CalClientLoadState; struct _CalClient { - GObject object; + GtkObject object; /* Private data */ CalClientPrivate *priv; }; struct _CalClientClass { - GObjectClass parent_class; + GtkObjectClass parent_class; /* Notification signals */ @@ -124,11 +121,7 @@ typedef gchar * (* CalClientAuthFunc) (CalClient *client, const gchar *key, gpointer user_data); -GType cal_client_get_type (void); - -GType cal_client_open_status_enum_get_type (void); -GType cal_client_set_mode_status_enum_get_type (void); -GType cal_mode_enum_get_type (void); +GtkType cal_client_get_type (void); CalClient *cal_client_construct (CalClient *client); @@ -228,6 +221,6 @@ char* cal_client_get_component_as_string (CalClient *client, -G_END_DECLS +END_GNOME_DECLS #endif |