diff options
author | Rodrigo Moya <rodrigo@ximian.com> | 2002-11-05 19:47:40 +0800 |
---|---|---|
committer | Rodrigo Moya <rodrigo@src.gnome.org> | 2002-11-05 19:47:40 +0800 |
commit | bca61092c2a89aa993abd6302b5c372df099e361 (patch) | |
tree | 5d096db04e2a43bf4bd31ab5abdf501ff944f548 /calendar/cal-client | |
parent | f8bad518674ae650fdbbc65a38786afa5f16dc42 (diff) | |
download | gsoc2013-evolution-bca61092c2a89aa993abd6302b5c372df099e361.tar gsoc2013-evolution-bca61092c2a89aa993abd6302b5c372df099e361.tar.gz gsoc2013-evolution-bca61092c2a89aa993abd6302b5c372df099e361.tar.bz2 gsoc2013-evolution-bca61092c2a89aa993abd6302b5c372df099e361.tar.lz gsoc2013-evolution-bca61092c2a89aa993abd6302b5c372df099e361.tar.xz gsoc2013-evolution-bca61092c2a89aa993abd6302b5c372df099e361.tar.zst gsoc2013-evolution-bca61092c2a89aa993abd6302b5c372df099e361.zip |
added new marshallers.
2002-11-04 Rodrigo Moya <rodrigo@ximian.com>
* cal-util/cal-util-marshal.list: added new marshallers.
* cal-client/cal-client.c (get_objects_atomically): fixed calls to
g_signal_handler_disconnect_by_func.
(cal_client_class_init): fixed typos.
* cal-client/cal-client-multi.[ch]:
* cal-client/cal-client-types.c:
* cal-client/cal-query.[ch]: ported to GObject.
* cal-client/cal-listener.[ch]: converted to BonoboObject.
* cal-client/Makefile.am:
* pcs/Makefile.am: fixed flags for orbit-idl
svn path=/trunk/; revision=18547
Diffstat (limited to 'calendar/cal-client')
-rw-r--r-- | calendar/cal-client/Makefile.am | 2 | ||||
-rw-r--r-- | calendar/cal-client/cal-client-multi.c | 212 | ||||
-rw-r--r-- | calendar/cal-client/cal-client-multi.h | 14 | ||||
-rw-r--r-- | calendar/cal-client/cal-client-types.c | 2 | ||||
-rw-r--r-- | calendar/cal-client/cal-client.c | 17 | ||||
-rw-r--r-- | calendar/cal-client/cal-listener.c | 50 | ||||
-rw-r--r-- | calendar/cal-client/cal-listener.h | 17 | ||||
-rw-r--r-- | calendar/cal-client/cal-query.c | 202 | ||||
-rw-r--r-- | calendar/cal-client/cal-query.h | 16 | ||||
-rw-r--r-- | calendar/cal-client/client-test.c | 2 |
10 files changed, 250 insertions, 284 deletions
diff --git a/calendar/cal-client/Makefile.am b/calendar/cal-client/Makefile.am index c1ede1e84f..1d8d9203ab 100644 --- a/calendar/cal-client/Makefile.am +++ b/calendar/cal-client/Makefile.am @@ -13,7 +13,7 @@ CORBA_HEADERS_GENERATED = \ idls = \ $(srcdir)/../idl/evolution-calendar.idl -idl_flags = `$(GNOME_CONFIG) --cflags idl` -I $(datadir)/idl +idl_flags = $(IDL_INCLUDES) $(CORBA_GENERATED): $(idls) $(ORBIT_IDL) $(idl_flags) $(srcdir)/../idl/evolution-calendar.idl diff --git a/calendar/cal-client/cal-client-multi.c b/calendar/cal-client/cal-client-multi.c index 7ccaae8472..18b03c46ff 100644 --- a/calendar/cal-client/cal-client-multi.c +++ b/calendar/cal-client/cal-client-multi.c @@ -21,7 +21,7 @@ #ifdef HAVE_CONFIG_H #include <config.h> #endif -#include <gtk/gtksignal.h> +#include "cal-util/cal-util-marshal.h" #include "cal-client-multi.h" /* Private part of the CalClientMulti structure */ @@ -31,8 +31,8 @@ struct _CalClientMultiPrivate { }; static void cal_client_multi_class_init (CalClientMultiClass *klass); -static void cal_client_multi_init (CalClientMulti *multi); -static void cal_client_multi_destroy (GtkObject *object); +static void cal_client_multi_init (CalClientMulti *multi, CalClientMultiClass *klass); +static void cal_client_multi_finalize (GObject *object); /* signal IDs */ enum { @@ -45,7 +45,7 @@ enum { }; static guint cal_multi_signals[LAST_SIGNAL]; -static GtkObjectClass *parent_class = NULL; +static GObjectClass *parent_class = NULL; /* * Private functions @@ -59,24 +59,23 @@ static GtkObjectClass *parent_class = NULL; * * Returns: The type ID of the #CalClientMulti class */ -GtkType +GType cal_client_multi_get_type (void) { - static GtkType type = 0; + static GType type = 0; if (!type) { - static const GtkTypeInfo info = { - "CalClientMulti", - sizeof (CalClientMulti), - sizeof (CalClientMultiClass), - (GtkClassInitFunc) cal_client_multi_class_init, - (GtkObjectInitFunc) cal_client_multi_init, - NULL, - NULL, - (GtkClassInitFunc) NULL - }; - - type = gtk_type_unique (GTK_TYPE_OBJECT, &info); + static GTypeInfo info = { + sizeof (CalClientMultiClass), + (GBaseInitFunc) NULL, + (GBaseFinalizeFunc) NULL, + (GClassInitFunc) cal_client_multi_class_init, + NULL, NULL, + sizeof (CalClientMulti), + 0, + (GInstanceInitFunc) cal_client_multi_init + }; + type = g_type_register_static (G_TYPE_OBJECT, "CalClientMulti", &info, 0); } return type; @@ -86,57 +85,62 @@ cal_client_multi_get_type (void) static void cal_client_multi_class_init (CalClientMultiClass *klass) { - GtkObjectClass *object_class = GTK_OBJECT_CLASS (klass); + GObjectClass *object_class = G_OBJECT_CLASS (klass); - parent_class = gtk_type_class (GTK_TYPE_OBJECT); + parent_class = g_type_class_peek_parent (klass); cal_multi_signals[CAL_OPENED] = - gtk_signal_new ("cal_opened", - GTK_RUN_FIRST, - G_TYPE_FROM_CLASS (object_class), - GTK_SIGNAL_OFFSET (CalClientMultiClass, cal_opened), - gtk_marshal_NONE__POINTER_INT, - GTK_TYPE_NONE, 2, - GTK_TYPE_POINTER, GTK_TYPE_ENUM); + g_signal_new ("cal_opened", + G_TYPE_FROM_CLASS (klass), + G_SIGNAL_RUN_FIRST, + G_STRUCT_OFFSET (CalClientMultiClass, cal_opened), + NULL, NULL, + cal_util_marshal_VOID__POINTER_ENUM, + G_TYPE_NONE, 2, + G_TYPE_POINTER, G_TYPE_ENUM); cal_multi_signals[OBJ_UPDATED] = - gtk_signal_new ("obj_updated", - GTK_RUN_FIRST, - G_TYPE_FROM_CLASS (object_class), - GTK_SIGNAL_OFFSET (CalClientMultiClass, obj_updated), - gtk_marshal_NONE__POINTER_POINTER, - GTK_TYPE_NONE, 2, - GTK_TYPE_POINTER, GTK_TYPE_STRING); + g_signal_new ("obj_updated", + G_TYPE_FROM_CLASS (klass), + G_SIGNAL_RUN_FIRST, + G_STRUCT_OFFSET (CalClientMultiClass, obj_updated), + NULL, NULL, + cal_util_marshal_VOID__POINTER_STRING, + G_TYPE_NONE, 2, + G_TYPE_POINTER, G_TYPE_STRING); cal_multi_signals[OBJ_REMOVED] = - gtk_signal_new ("obj_removed", - GTK_RUN_FIRST, - G_TYPE_FROM_CLASS (object_class), - GTK_SIGNAL_OFFSET (CalClientMultiClass, obj_removed), - gtk_marshal_NONE__POINTER_POINTER, - GTK_TYPE_NONE, 2, - GTK_TYPE_POINTER, GTK_TYPE_STRING); + g_signal_new ("obj_removed", + G_TYPE_FROM_CLASS (klass), + G_SIGNAL_RUN_FIRST, + G_STRUCT_OFFSET (CalClientMultiClass, obj_removed), + NULL, NULL, + cal_util_marshal_VOID__POINTER_STRING, + G_TYPE_NONE, 2, + G_TYPE_POINTER, G_TYPE_STRING); cal_multi_signals[CATEGORIES_CHANGED] = - gtk_signal_new ("categories_changed", - GTK_RUN_FIRST, - G_TYPE_FROM_CLASS (object_class), - GTK_SIGNAL_OFFSET (CalClientMultiClass, categories_changed), - gtk_marshal_NONE__POINTER_POINTER, - GTK_TYPE_NONE, 2, - GTK_TYPE_POINTER, GTK_TYPE_POINTER); + g_signal_new ("categories_changed", + G_TYPE_FROM_CLASS (klass), + G_SIGNAL_RUN_FIRST, + G_STRUCT_OFFSET (CalClientMultiClass, categories_changed), + NULL, NULL, + cal_util_marshal_VOID__POINTER_POINTER, + G_TYPE_NONE, 2, + G_TYPE_POINTER, G_TYPE_POINTER); cal_multi_signals[FORGET_PASSWORD] = - gtk_signal_new ("forget_password", - GTK_RUN_FIRST, - G_TYPE_FROM_CLASS (object_class), - GTK_SIGNAL_OFFSET (CalClientMultiClass, forget_password), - gtk_marshal_NONE__POINTER_POINTER, - GTK_TYPE_NONE, 2, - GTK_TYPE_STRING, GTK_TYPE_STRING); - - object_class->destroy = cal_client_multi_destroy; + g_signal_new ("forget_password", + G_TYPE_FROM_CLASS (klass), + G_SIGNAL_RUN_FIRST, + G_STRUCT_OFFSET (CalClientMultiClass, forget_password), + NULL, NULL, + cal_util_marshal_VOID__STRING_STRING, + G_TYPE_NONE, 2, + G_TYPE_STRING, G_TYPE_STRING); + + object_class->finalize = cal_client_multi_finalize; } /* object initialization function for the multi calendar client */ static void -cal_client_multi_init (CalClientMulti *multi) +cal_client_multi_init (CalClientMulti *multi, CalClientMultiClass *klass) { multi->priv = g_new0 (CalClientMultiPrivate, 1); multi->priv->calendars = g_hash_table_new (g_str_hash, g_str_equal); @@ -153,12 +157,12 @@ free_calendar (gpointer key, gpointer value, gpointer data) multi->priv->uris = g_list_remove (multi->priv->uris, key); g_free (key); - gtk_object_unref (GTK_OBJECT (value)); + g_object_unref (G_OBJECT (value)); } -/* destroy handler for the multi calendar client */ +/* finalize handler for the multi calendar client */ static void -cal_client_multi_destroy (GtkObject *object) +cal_client_multi_finalize (GObject *object) { CalClientMulti *multi = (CalClientMulti *) object; @@ -173,8 +177,8 @@ cal_client_multi_destroy (GtkObject *object) multi->priv = NULL; /* chain to parent class' destroy handler */ - if (GTK_OBJECT_CLASS (parent_class)->destroy) - (* GTK_OBJECT_CLASS (parent_class)->destroy) (object); + if (G_OBJECT_CLASS (parent_class)->finalize) + (* G_OBJECT_CLASS (parent_class)->finalize) (object); } /** @@ -191,7 +195,7 @@ cal_client_multi_new (void) { CalClientMulti *multi; - multi = gtk_type_new (CAL_CLIENT_MULTI_TYPE); + multi = g_object_new (CAL_CLIENT_MULTI_TYPE, NULL); return multi; } @@ -204,9 +208,9 @@ client_cal_opened_cb (CalClient *client, CalClientOpenStatus status, gpointer us g_return_if_fail (IS_CAL_CLIENT (client)); g_return_if_fail (IS_CAL_CLIENT_MULTI (multi)); - gtk_signal_emit (GTK_OBJECT (multi), - cal_multi_signals[CAL_OPENED], - client, status); + g_signal_emit (G_OBJECT (multi), + cal_multi_signals[CAL_OPENED], 0, + client, status); } static void @@ -217,9 +221,9 @@ client_obj_updated_cb (CalClient *client, const char *uid, gpointer user_data) g_return_if_fail (IS_CAL_CLIENT (client)); g_return_if_fail (IS_CAL_CLIENT_MULTI (multi)); - gtk_signal_emit (GTK_OBJECT (multi), - cal_multi_signals[OBJ_UPDATED], - client, uid); + g_signal_emit (G_OBJECT (multi), + cal_multi_signals[OBJ_UPDATED], 0, + client, uid); } static void @@ -230,9 +234,9 @@ client_obj_removed_cb (CalClient *client, const char *uid, gpointer user_data) g_return_if_fail (IS_CAL_CLIENT (client)); g_return_if_fail (IS_CAL_CLIENT_MULTI (multi)); - gtk_signal_emit (GTK_OBJECT (multi), - cal_multi_signals[OBJ_REMOVED], - client, uid); + g_signal_emit (G_OBJECT (multi), + cal_multi_signals[OBJ_REMOVED], 0, + client, uid); } static void @@ -243,9 +247,9 @@ client_categories_changed_cb (CalClient *client, GPtrArray *categories, gpointer g_return_if_fail (IS_CAL_CLIENT (client)); g_return_if_fail (IS_CAL_CLIENT_MULTI (multi)); - gtk_signal_emit (GTK_OBJECT (multi), - cal_multi_signals[CATEGORIES_CHANGED], - client, categories); + g_signal_emit (G_OBJECT (multi), + cal_multi_signals[CATEGORIES_CHANGED], 0, + client, categories); } static void @@ -256,9 +260,9 @@ client_forget_password_cb (CalClient *client, const char *key, gpointer user_dat g_return_if_fail (IS_CAL_CLIENT (client)); g_return_if_fail (IS_CAL_CLIENT_MULTI (multi)); - gtk_signal_emit (GTK_OBJECT (multi), - cal_multi_signals[FORGET_PASSWORD], - client, key); + g_signal_emit (G_OBJECT (multi), + cal_multi_signals[FORGET_PASSWORD], 0, + client, key); } /** * cal_client_multi_add_client @@ -284,32 +288,34 @@ cal_client_multi_add_client (CalClientMulti *multi, CalClient *client) return; } - gtk_object_ref (GTK_OBJECT (client)); + g_object_ref (G_OBJECT (client)); multi->priv->uris = g_list_append (multi->priv->uris, uri); g_hash_table_insert (multi->priv->calendars, uri, client); /* set up CalClient's signal handlers */ - gtk_signal_disconnect_by_data (GTK_OBJECT (client), multi); - gtk_signal_connect (GTK_OBJECT (client), - "cal_opened", - GTK_SIGNAL_FUNC (client_cal_opened_cb), - multi); - gtk_signal_connect (GTK_OBJECT (client), - "obj_updated", - GTK_SIGNAL_FUNC (client_obj_updated_cb), - multi); - gtk_signal_connect (GTK_OBJECT (client), - "obj_removed", - GTK_SIGNAL_FUNC (client_obj_removed_cb), - multi); - gtk_signal_connect (GTK_OBJECT (client), - "categories_changed", - GTK_SIGNAL_FUNC (client_categories_changed_cb), - multi); - gtk_signal_connect (GTK_OBJECT (client), - "forget_password", - GTK_SIGNAL_FUNC (client_forget_password_cb), - multi); + g_signal_handlers_disconnect_matched (G_OBJECT (client), + G_SIGNAL_MATCH_DATA, + 0, 0, NULL, NULL, multi); + g_signal_connect (G_OBJECT (client), + "cal_opened", + G_CALLBACK (client_cal_opened_cb), + multi); + g_signal_connect (G_OBJECT (client), + "obj_updated", + G_CALLBACK (client_obj_updated_cb), + multi); + g_signal_connect (G_OBJECT (client), + "obj_removed", + G_CALLBACK (client_obj_removed_cb), + multi); + g_signal_connect (G_OBJECT (client), + "categories_changed", + G_CALLBACK (client_categories_changed_cb), + multi); + g_signal_connect (G_OBJECT (client), + "forget_password", + G_CALLBACK (client_forget_password_cb), + multi); } typedef struct { @@ -380,11 +386,11 @@ cal_client_multi_open_calendar (CalClientMulti *multi, result = cal_client_open_calendar (client, str_uri, only_if_exists); if (result) { cal_client_multi_add_client (multi, client); - gtk_object_unref (GTK_OBJECT (client)); + g_object_unref (G_OBJECT (client)); return client; } - gtk_object_unref (GTK_OBJECT (client)); + g_object_unref (G_OBJECT (client)); return NULL; } diff --git a/calendar/cal-client/cal-client-multi.h b/calendar/cal-client/cal-client-multi.h index f16b2d60f4..dd4248bd80 100644 --- a/calendar/cal-client/cal-client-multi.h +++ b/calendar/cal-client/cal-client-multi.h @@ -26,24 +26,24 @@ G_BEGIN_DECLS #define CAL_CLIENT_MULTI_TYPE (cal_client_multi_get_type ()) -#define CAL_CLIENT_MULTI(obj) (GTK_CHECK_CAST ((obj), CAL_CLIENT_MULTI_TYPE, CalClientMulti)) -#define CAL_CLIENT_MULTI_CLASS(klass) (GTK_CHECK_CLASS_CAST ((klass), CAL_CLIENT_MULTI_TYPE, CalClientMultiClass)) -#define IS_CAL_CLIENT_MULTI(obj) (GTK_CHECK_TYPE ((obj), CAL_CLIENT_MULTI_TYPE)) -#define IS_CAL_CLIENT_MULTI_CLASS(klass) (GTK_CHECK_CLASS_TYPE ((klass), CAL_CLIENT_MULTI_TYPE)) +#define CAL_CLIENT_MULTI(obj) (G_TYPE_CHECK_INSTANCE_CAST ((obj), CAL_CLIENT_MULTI_TYPE, CalClientMulti)) +#define CAL_CLIENT_MULTI_CLASS(klass) (G_TYPE_CHECK_CLASS_CAST ((klass), CAL_CLIENT_MULTI_TYPE, CalClientMultiClass)) +#define IS_CAL_CLIENT_MULTI(obj) (G_TYPE_CHECK_INSTANCE_TYPE ((obj), CAL_CLIENT_MULTI_TYPE)) +#define IS_CAL_CLIENT_MULTI_CLASS(klass) (G_TYPE_CHECK_CLASS_TYPE ((klass), CAL_CLIENT_MULTI_TYPE)) typedef struct _CalClientMulti CalClientMulti; typedef struct _CalClientMultiClass CalClientMultiClass; typedef struct _CalClientMultiPrivate CalClientMultiPrivate; struct _CalClientMulti { - GtkObject object; + GObject object; /* Private data */ CalClientMultiPrivate *priv; }; struct _CalClientMultiClass { - GtkObjectClass parent_class; + GObjectClass parent_class; /* notification signals */ void (* cal_opened) (CalClientMulti *multi, CalClient *client, CalClientOpenStatus status); @@ -56,7 +56,7 @@ struct _CalClientMultiClass { void (* forget_password) (CalClientMulti *multi, CalClient *client, const char *key); }; -GtkType cal_client_multi_get_type (void); +GType cal_client_multi_get_type (void); CalClientMulti *cal_client_multi_new (void); diff --git a/calendar/cal-client/cal-client-types.c b/calendar/cal-client/cal-client-types.c index 6ce98c02c2..36a524ec99 100644 --- a/calendar/cal-client/cal-client-types.c +++ b/calendar/cal-client/cal-client-types.c @@ -44,7 +44,7 @@ cal_client_change_list_free (GList *list) g_assert (c != NULL); g_assert (c->comp != NULL); - gtk_object_unref (GTK_OBJECT (c->comp)); + g_object_unref (G_OBJECT (c->comp)); g_free (c); } diff --git a/calendar/cal-client/cal-client.c b/calendar/cal-client/cal-client.c index 42bbf49656..b1c36653fe 100644 --- a/calendar/cal-client/cal-client.c +++ b/calendar/cal-client/cal-client.c @@ -28,6 +28,7 @@ #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" @@ -135,7 +136,7 @@ cal_client_get_type (void) 0, (GInstanceInitFunc) cal_client_init }; - cal_component_type = g_type_register_static (G_TYPE_OBJECT, "CalClient", &info, 0); + cal_client_type = g_type_register_static (G_TYPE_OBJECT, "CalClient", &info, 0); } return cal_client_type; @@ -147,7 +148,7 @@ cal_client_class_init (CalClientClass *klass) { GObjectClass *object_class; - object_class = (GObjectClass *) class; + object_class = (GObjectClass *) klass; parent_class = g_type_class_peek_parent (klass); @@ -173,7 +174,7 @@ cal_client_class_init (CalClientClass *klass) cal_client_signals[OBJ_UPDATED] = g_signal_new ("obj_updated", G_TYPE_FROM_CLASS (klass), - G_SIGNAL_RUN_FIRST + G_SIGNAL_RUN_FIRST, G_STRUCT_OFFSET (CalClientClass, obj_updated), NULL, NULL, g_cclosure_marshal_VOID__STRING, @@ -192,7 +193,7 @@ cal_client_class_init (CalClientClass *klass) g_signal_new ("backend_error", G_TYPE_FROM_CLASS (klass), G_SIGNAL_RUN_FIRST, - G_STRUCT__OFFSET (CalClientClass, backend_error), + G_STRUCT_OFFSET (CalClientClass, backend_error), NULL, NULL, g_cclosure_marshal_VOID__STRING, G_TYPE_NONE, 1, @@ -219,7 +220,7 @@ cal_client_class_init (CalClientClass *klass) g_signal_new ("backend_died", G_TYPE_FROM_CLASS (klass), G_SIGNAL_RUN_FIRST, - G_STRUCT_SIGNAL_OFFSET (CalClientClass, backend_died), + G_STRUCT_OFFSET (CalClientClass, backend_died), NULL, NULL, g_cclosure_marshal_VOID__VOID, G_TYPE_NONE, 0); @@ -362,7 +363,7 @@ cal_client_finalize (GObject *object) if (priv->comp_listener) { g_signal_handlers_disconnect_matched (G_OBJECT (priv->comp_listener), - G_SIGNAL_MATCH_DATA, + G_SIGNAL_MATCH_DATA, 0, 0, NULL, NULL, client); g_object_unref (G_OBJECT (priv->comp_listener)); @@ -1837,8 +1838,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_by_func (G_OBJECT (client), obj_updated_id, client); - g_signal_handler_disconnect (G_OBJECT (client), obj_removed_id, client); + g_signal_handlers_disconnect_by_func (G_OBJECT (client), obj_updated_id, client); + g_signal_handlers_disconnect_by_func (G_OBJECT (client), obj_removed_id, client); objects = NULL; g_hash_table_foreach (uid_comp_hash, add_component, &objects); diff --git a/calendar/cal-client/cal-listener.c b/calendar/cal-client/cal-listener.c index 71cbb9ae3f..c7beef8c97 100644 --- a/calendar/cal-client/cal-listener.c +++ b/calendar/cal-client/cal-listener.c @@ -40,9 +40,9 @@ struct CalListenerPrivate { -static void cal_listener_class_init (CalListenerClass *class); -static void cal_listener_init (CalListener *listener); -static void cal_listener_destroy (GtkObject *object); +static void cal_listener_class_init (CalListenerClass *klass); +static void cal_listener_init (CalListener *listener, CalListenerClass *klass); +static void cal_listener_finalize (GObject *object); static void impl_notifyCalOpened (PortableServer_Servant servant, GNOME_Evolution_Calendar_Listener_OpenStatus status, @@ -65,38 +65,38 @@ static void impl_notifyCategoriesChanged (PortableServer_Servant servant, const GNOME_Evolution_Calendar_StringSeq *categories, CORBA_Environment *ev); -static BonoboXObjectClass *parent_class; +static BonoboObjectClass *parent_class; -BONOBO_X_TYPE_FUNC_FULL (CalListener, - GNOME_Evolution_Calendar_Listener, - BONOBO_X_OBJECT_TYPE, - cal_listener); +BONOBO_TYPE_FUNC_FULL (CalListener, + GNOME_Evolution_Calendar_Listener, + BONOBO_TYPE_OBJECT, + cal_listener); /* Class initialization function for the calendar listener */ static void -cal_listener_class_init (CalListenerClass *class) +cal_listener_class_init (CalListenerClass *klass) { - GtkObjectClass *object_class; + GObjectClass *object_class; - object_class = (GtkObjectClass *) class; + object_class = (GObjectClass *) klass; - parent_class = gtk_type_class (BONOBO_X_OBJECT_TYPE); + parent_class = g_type_class_peek_parent (klass); - class->epv.notifyCalOpened = impl_notifyCalOpened; - class->epv.notifyCalSetMode = impl_notifyCalSetMode; - class->epv.notifyObjUpdated = impl_notifyObjUpdated; - class->epv.notifyObjRemoved = impl_notifyObjRemoved; - class->epv.notifyErrorOccurred = impl_notifyErrorOccurred; - class->epv.notifyCategoriesChanged = impl_notifyCategoriesChanged; + klass->epv.notifyCalOpened = impl_notifyCalOpened; + klass->epv.notifyCalSetMode = impl_notifyCalSetMode; + klass->epv.notifyObjUpdated = impl_notifyObjUpdated; + klass->epv.notifyObjRemoved = impl_notifyObjRemoved; + klass->epv.notifyErrorOccurred = impl_notifyErrorOccurred; + klass->epv.notifyCategoriesChanged = impl_notifyCategoriesChanged; - object_class->destroy = cal_listener_destroy; + object_class->finalize = cal_listener_finalize; } /* Object initialization function for the calendar listener */ static void -cal_listener_init (CalListener *listener) +cal_listener_init (CalListener *listener, CalListenerClass *klass) { CalListenerPrivate *priv; @@ -112,9 +112,9 @@ cal_listener_init (CalListener *listener) priv->notify = TRUE; } -/* Destroy handler for the calendar listener */ +/* Finalize handler for the calendar listener */ static void -cal_listener_destroy (GtkObject *object) +cal_listener_finalize (GObject *object) { CalListener *listener; CalListenerPrivate *priv; @@ -137,8 +137,8 @@ cal_listener_destroy (GtkObject *object) g_free (priv); listener->priv = NULL; - if (GTK_OBJECT_CLASS (parent_class)->destroy) - (* GTK_OBJECT_CLASS (parent_class)->destroy) (object); + if (G_OBJECT_CLASS (parent_class)->finalize) + (* G_OBJECT_CLASS (parent_class)->finalize) (object); } @@ -364,7 +364,7 @@ cal_listener_new (CalListenerCalOpenedFn cal_opened_fn, g_return_val_if_fail (error_occurred_fn != NULL, NULL); g_return_val_if_fail (categories_changed_fn != NULL, NULL); - listener = gtk_type_new (CAL_LISTENER_TYPE); + listener = g_object_new (CAL_LISTENER_TYPE, NULL); return cal_listener_construct (listener, cal_opened_fn, cal_set_mode_fn, diff --git a/calendar/cal-client/cal-listener.h b/calendar/cal-client/cal-listener.h index 08db22a54b..d0f9a718a4 100644 --- a/calendar/cal-client/cal-listener.h +++ b/calendar/cal-client/cal-listener.h @@ -21,8 +21,7 @@ #ifndef CAL_LISTENER_H #define CAL_LISTENER_H -#include <gtk/gtkobject.h> -#include <bonobo/bonobo-xobject.h> +#include <bonobo/bonobo-object.h> #include "evolution-calendar.h" G_BEGIN_DECLS @@ -30,23 +29,23 @@ G_BEGIN_DECLS #define CAL_LISTENER_TYPE (cal_listener_get_type ()) -#define CAL_LISTENER(obj) (GTK_CHECK_CAST ((obj), CAL_LISTENER_TYPE, CalListener)) -#define CAL_LISTENER_CLASS(klass) (GTK_CHECK_CLASS_CAST ((klass), CAL_LISTENER_TYPE, \ +#define CAL_LISTENER(obj) (G_TYPE_CHECK_INSTANCE_CAST ((obj), CAL_LISTENER_TYPE, CalListener)) +#define CAL_LISTENER_CLASS(klass) (G_TYPE_CHECK_CLASS_CAST ((klass), CAL_LISTENER_TYPE, \ CalListenerClass)) -#define IS_CAL_LISTENER(obj) (GTK_CHECK_TYPE ((obj), CAL_LISTENER_TYPE)) -#define IS_CAL_LISTENER_CLASS(klass) (GTK_CHECK_CLASS_TYPE ((klass), CAL_LISTENER_TYPE)) +#define IS_CAL_LISTENER(obj) (G_TYPE_CHECK_INSTANCE_TYPE ((obj), CAL_LISTENER_TYPE)) +#define IS_CAL_LISTENER_CLASS(klass) (G_TYPE_CHECK_CLASS_TYPE ((klass), CAL_LISTENER_TYPE)) typedef struct CalListenerPrivate CalListenerPrivate; typedef struct { - BonoboXObject xobject; + BonoboObject xobject; /* Private data */ CalListenerPrivate *priv; } CalListener; typedef struct { - BonoboXObjectClass parent_class; + BonoboObjectClass parent_class; POA_GNOME_Evolution_Calendar_Listener__epv epv; } CalListenerClass; @@ -78,7 +77,7 @@ typedef void (* CalListenerCategoriesChangedFn) (CalListener *listener, gpointer data); -GtkType cal_listener_get_type (void); +GType cal_listener_get_type (void); CalListener *cal_listener_construct (CalListener *listener, CalListenerCalOpenedFn cal_opened_fn, diff --git a/calendar/cal-client/cal-query.c b/calendar/cal-client/cal-query.c index 8d87bb30a9..7f29952f04 100644 --- a/calendar/cal-client/cal-query.c +++ b/calendar/cal-client/cal-query.c @@ -22,8 +22,8 @@ #include <config.h> #endif -#include <gtk/gtksignal.h> #include <bonobo/bonobo-exception.h> +#include "cal-util/cal-util-marshal.h" #include "cal-query.h" #include "query-listener.h" @@ -40,9 +40,9 @@ struct _CalQueryPrivate { -static void cal_query_class_init (CalQueryClass *class); -static void cal_query_init (CalQuery *query); -static void cal_query_destroy (GtkObject *object); +static void cal_query_class_init (CalQueryClass *klass); +static void cal_query_init (CalQuery *query, CalQueryClass *klass); +static void cal_query_finalize (GObject *object); /* Signal IDs */ enum { @@ -53,16 +53,9 @@ enum { LAST_SIGNAL }; -static void marshal_obj_updated (GtkObject *object, - GtkSignalFunc func, gpointer func_data, - GtkArg *args); -static void marshal_query_done (GtkObject *object, - GtkSignalFunc func, gpointer func_data, - GtkArg *args); - static guint query_signals[LAST_SIGNAL]; -static GtkObjectClass *parent_class; +static GObjectClass *parent_class; @@ -74,24 +67,23 @@ static GtkObjectClass *parent_class; * * Return value: The type ID of the #CalQuery class. **/ -GtkType +GType cal_query_get_type (void) { - static GtkType cal_query_type = 0; + static GType cal_query_type = 0; if (!cal_query_type) { - static const GtkTypeInfo cal_query_info = { - "CalQuery", - sizeof (CalQuery), - sizeof (CalQueryClass), - (GtkClassInitFunc) cal_query_class_init, - (GtkObjectInitFunc) cal_query_init, - NULL, /* reserved_1 */ - NULL, /* reserved_2 */ - (GtkClassInitFunc) NULL - }; - - cal_query_type = gtk_type_unique (GTK_TYPE_OBJECT, &cal_query_info); + static GTypeInfo info = { + sizeof (CalQueryClass), + (GBaseInitFunc) NULL, + (GBaseFinalizeFunc) NULL, + (GClassInitFunc) cal_query_class_init, + NULL, NULL, + sizeof (CalQuery), + 0, + (GInstanceInitFunc) cal_query_init + }; + cal_query_type = g_type_register_static (G_TYPE_OBJECT, "CalQuery", &info, 0); } return cal_query_type; @@ -99,64 +91,66 @@ cal_query_get_type (void) /* Class initialization function for the calendar query */ static void -cal_query_class_init (CalQueryClass *class) +cal_query_class_init (CalQueryClass *klass) { - GtkObjectClass *object_class; + GObjectClass *object_class; - object_class = (GtkObjectClass *) class; + object_class = (GObjectClass *) klass; - parent_class = gtk_type_class (GTK_TYPE_OBJECT); + parent_class = g_type_class_peek_parent (klass); query_signals[OBJ_UPDATED] = - gtk_signal_new ("obj_updated", - GTK_RUN_FIRST, - G_TYPE_FROM_CLASS (object_class), - GTK_SIGNAL_OFFSET (CalQueryClass, obj_updated), - marshal_obj_updated, - GTK_TYPE_NONE, 4, - GTK_TYPE_STRING, - GTK_TYPE_BOOL, - GTK_TYPE_INT, - GTK_TYPE_INT); + g_signal_new ("obj_updated", + G_TYPE_FROM_CLASS (klass), + G_SIGNAL_RUN_FIRST, + G_STRUCT_OFFSET (CalQueryClass, obj_updated), + NULL, NULL, + cal_util_marshal_VOID__STRING_BOOLEAN_INT_INT, + G_TYPE_NONE, 4, + G_TYPE_STRING, + G_TYPE_BOOLEAN, + G_TYPE_INT, + G_TYPE_INT); query_signals[OBJ_REMOVED] = - gtk_signal_new ("obj_removed", - GTK_RUN_FIRST, - G_TYPE_FROM_CLASS (object_class), - GTK_SIGNAL_OFFSET (CalQueryClass, obj_removed), - gtk_marshal_NONE__STRING, - GTK_TYPE_NONE, 1, - GTK_TYPE_STRING); + g_signal_new ("obj_removed", + G_TYPE_FROM_CLASS (klass), + G_SIGNAL_RUN_FIRST, + G_STRUCT_OFFSET (CalQueryClass, obj_removed), + NULL, NULL, + g_cclosure_marshal_VOID__STRING, + G_TYPE_NONE, 1, + G_TYPE_STRING); query_signals[QUERY_DONE] = - gtk_signal_new ("query_done", - GTK_RUN_FIRST, - G_TYPE_FROM_CLASS (object_class), - GTK_SIGNAL_OFFSET (CalQueryClass, query_done), - marshal_query_done, - GTK_TYPE_NONE, 2, - GTK_TYPE_ENUM, - GTK_TYPE_STRING); + g_signal_new ("query_done", + G_TYPE_FROM_CLASS (klass), + G_SIGNAL_RUN_FIRST, + G_STRUCT_OFFSET (CalQueryClass, query_done), + NULL, NULL, + cal_util_marshal_VOID__ENUM_STRING, + G_TYPE_NONE, 2, + G_TYPE_ENUM, + G_TYPE_STRING); query_signals[EVAL_ERROR] = - gtk_signal_new ("eval_error", - GTK_RUN_FIRST, - G_TYPE_FROM_CLASS (object_class), - GTK_SIGNAL_OFFSET (CalQueryClass, eval_error), - gtk_marshal_NONE__STRING, - GTK_TYPE_NONE, 1, - GTK_TYPE_STRING); - - gtk_object_class_add_signals (object_class, query_signals, LAST_SIGNAL); - - class->obj_updated = NULL; - class->obj_removed = NULL; - class->query_done = NULL; - class->eval_error = NULL; - - object_class->destroy = cal_query_destroy; + g_signal_new ("eval_error", + G_TYPE_FROM_CLASS (klass), + G_SIGNAL_RUN_FIRST, + G_STRUCT_OFFSET (CalQueryClass, eval_error), + NULL, NULL, + g_cclosure_marshal_VOID__STRING, + G_TYPE_NONE, 1, + G_TYPE_STRING); + + klass->obj_updated = NULL; + klass->obj_removed = NULL; + klass->query_done = NULL; + klass->eval_error = NULL; + + object_class->finalize = cal_query_finalize; } /* Object initialization function for the calendar query */ static void -cal_query_init (CalQuery *query) +cal_query_init (CalQuery *query, CalQueryClass *klass) { CalQueryPrivate *priv; @@ -167,9 +161,9 @@ cal_query_init (CalQuery *query) priv->corba_query = CORBA_OBJECT_NIL; } -/* Destroy handler for the calendar query */ +/* Finalize handler for the calendar query */ static void -cal_query_destroy (GtkObject *object) +cal_query_finalize (GObject *object) { CalQuery *query; CalQueryPrivate *priv; @@ -201,42 +195,8 @@ cal_query_destroy (GtkObject *object) g_free (priv); query->priv = NULL; - if (GTK_OBJECT_CLASS (parent_class)->destroy) - (* GTK_OBJECT_CLASS (parent_class)->destroy) (object); -} - - - -/* Marshalers */ - -typedef void (* ObjUpdatedFunc) (CalQuery *query, const char *uid, - gboolean query_in_progress, int n_scanned, int total, - gpointer data); - -static void -marshal_obj_updated (GtkObject *object, GtkSignalFunc func, gpointer func_data, GtkArg *args) -{ - ObjUpdatedFunc f; - - f = (ObjUpdatedFunc) func; - - (* f) (CAL_QUERY (object), GTK_VALUE_STRING (args[0]), - GTK_VALUE_BOOL (args[1]), GTK_VALUE_INT (args[2]), GTK_VALUE_INT (args[3]), - func_data); -} - -typedef void (* QueryDoneFunc) (CalQuery *query, CalQueryDoneStatus status, const char *error_str, - gpointer data); - -static void -marshal_query_done (GtkObject *object, GtkSignalFunc func, gpointer func_data, GtkArg *args) -{ - QueryDoneFunc f; - - f = (QueryDoneFunc) func; - - (* f) (CAL_QUERY (object), GTK_VALUE_ENUM (args[0]), GTK_VALUE_STRING (args[1]), - func_data); + if (G_OBJECT_CLASS (parent_class)->finalize) + (* G_OBJECT_CLASS (parent_class)->finalize) (object); } @@ -256,9 +216,9 @@ obj_updated_cb (QueryListener *ql, query = CAL_QUERY (data); for (n = 0; n < uids->_length; n++) { - gtk_signal_emit (GTK_OBJECT (query), query_signals[OBJ_UPDATED], - uids->_buffer[n], query_in_progress, - (int) n_scanned, (int) total); + g_signal_emit (G_OBJECT (query), query_signals[OBJ_UPDATED], 0, + uids->_buffer[n], query_in_progress, + (int) n_scanned, (int) total); } } @@ -272,8 +232,8 @@ obj_removed_cb (QueryListener *ql, query = CAL_QUERY (data); - gtk_signal_emit (GTK_OBJECT (query), query_signals[OBJ_REMOVED], - uid); + g_signal_emit (G_OBJECT (query), query_signals[OBJ_REMOVED], + 0, uid); } /* Callback used when the query terminates */ @@ -302,8 +262,8 @@ query_done_cb (QueryListener *ql, return; } - gtk_signal_emit (GTK_OBJECT (query), query_signals[QUERY_DONE], - status, error_str); + g_signal_emit (G_OBJECT (query), query_signals[QUERY_DONE], 0, + status, error_str); } /* Callback used when an error occurs when evaluating the query */ @@ -316,8 +276,8 @@ eval_error_cb (QueryListener *ql, query = CAL_QUERY (data); - gtk_signal_emit (GTK_OBJECT (query), query_signals[EVAL_ERROR], - error_str); + g_signal_emit (G_OBJECT (query), query_signals[EVAL_ERROR], 0, + error_str); } /** @@ -400,10 +360,10 @@ cal_query_new (GNOME_Evolution_Calendar_Cal cal, { CalQuery *query; - query = gtk_type_new (CAL_QUERY_TYPE); + query = g_object_new (CAL_QUERY_TYPE, NULL); if (!cal_query_construct (query, cal, sexp)) { - gtk_object_unref (GTK_OBJECT (query)); + g_object_unref (G_OBJECT (query)); return NULL; } diff --git a/calendar/cal-client/cal-query.h b/calendar/cal-client/cal-query.h index a8d7d2a514..b75836cd96 100644 --- a/calendar/cal-client/cal-query.h +++ b/calendar/cal-client/cal-query.h @@ -21,7 +21,7 @@ #ifndef CAL_QUERY_H #define CAL_QUERY_H -#include <gtk/gtkobject.h> +#include <glib-object.h> #include "evolution-calendar.h" @@ -30,10 +30,10 @@ G_BEGIN_DECLS #define CAL_QUERY_TYPE (cal_query_get_type ()) -#define CAL_QUERY(obj) (GTK_CHECK_CAST ((obj), CAL_QUERY_TYPE, CalQuery)) -#define CAL_QUERY_CLASS(klass) (GTK_CHECK_CLASS_CAST ((klass), CAL_QUERY_TYPE, CalQueryClass)) -#define IS_CAL_QUERY(obj) (GTK_CHECK_TYPE ((obj), CAL_QUERY_TYPE)) -#define IS_CAL_QUERY_CLASS(klass) (GTK_CHECK_CLASS_TYPE ((klass), CAL_QUERY_TYPE)) +#define CAL_QUERY(obj) (G_TYPE_CHECK_INSTANCE_CAST ((obj), CAL_QUERY_TYPE, CalQuery)) +#define CAL_QUERY_CLASS(klass) (G_TYPE_CHECK_CLASS_CAST ((klass), CAL_QUERY_TYPE, CalQueryClass)) +#define IS_CAL_QUERY(obj) (G_TYPE_CHECK_INSTANCE_TYPE ((obj), CAL_QUERY_TYPE)) +#define IS_CAL_QUERY_CLASS(klass) (G_TYPE_CHECK_CLASS_TYPE ((klass), CAL_QUERY_TYPE)) /* Status values when a query terminates */ typedef enum { @@ -44,14 +44,14 @@ typedef enum { typedef struct _CalQueryPrivate CalQueryPrivate; typedef struct { - GtkObject object; + GObject object; /* Private data */ CalQueryPrivate *priv; } CalQuery; typedef struct { - GtkObjectClass parent_class; + GObjectClass parent_class; /* Notification signals */ @@ -64,7 +64,7 @@ typedef struct { void (* eval_error) (CalQuery *query, const char *error_str); } CalQueryClass; -GtkType cal_query_get_type (void); +GType cal_query_get_type (void); CalQuery *cal_query_construct (CalQuery *query, GNOME_Evolution_Calendar_Cal cal, diff --git a/calendar/cal-client/client-test.c b/calendar/cal-client/client-test.c index cbd6335acc..4a649e0428 100644 --- a/calendar/cal-client/client-test.c +++ b/calendar/cal-client/client-test.c @@ -221,7 +221,7 @@ main (int argc, char **argv) textdomain (PACKAGE); gnome_program_init ("tl-test", VERSION, LIBGNOME_MODULE, argc, argv, NULL); - oaf_init (argc, argv); + bonobo_activation_init (argc, argv); if (!bonobo_init (&argc, argv)) { g_message ("main(): could not initialize Bonobo"); |