aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--calendar/ChangeLog8
-rw-r--r--calendar/pcs/cal-factory.c82
-rw-r--r--calendar/pcs/cal-factory.h18
-rw-r--r--calendar/pcs/cal.c23
-rw-r--r--calendar/pcs/cal.h17
-rw-r--r--calendar/pcs/query-backend.c84
-rw-r--r--calendar/pcs/query-backend.h14
-rw-r--r--calendar/pcs/query.c78
-rw-r--r--calendar/pcs/query.h16
9 files changed, 172 insertions, 168 deletions
diff --git a/calendar/ChangeLog b/calendar/ChangeLog
index fcc4a16f09..16cf51dbf5 100644
--- a/calendar/ChangeLog
+++ b/calendar/ChangeLog
@@ -1,5 +1,13 @@
2002-11-07 Rodrigo Moya <rodrigo@ximian.com>
+ * pcs/cal.[ch]: converted to BonoboObject.
+ (impl_Cal_get_query): bonobo_object_unref the query returned by
+ cal_backend_get_query if we can't duplicate it.
+
+ * pcs/query.[ch]:
+ * pcs/cal-factory.[ch]: converted to BonoboObject.
+
+ * pcs/query-backend.[ch]:
* pcs/cal-backend-file.[ch]:
* pcs/cal-backend.[ch]: GObjectify.
diff --git a/calendar/pcs/cal-factory.c b/calendar/pcs/cal-factory.c
index 1a12a77e03..d9f0f5ad27 100644
--- a/calendar/pcs/cal-factory.c
+++ b/calendar/pcs/cal-factory.c
@@ -22,7 +22,6 @@
#include <config.h>
#include <ctype.h>
#include <stdio.h>
-#include <gtk/gtksignal.h>
#include <bonobo-activation/bonobo-activation.h>
#include "e-util/e-url.h"
#include "evolution-calendar.h"
@@ -31,14 +30,14 @@
#include "cal-factory.h"
#include "job.h"
-#define PARENT_TYPE BONOBO_X_OBJECT_TYPE
+#define PARENT_TYPE BONOBO_TYPE_OBJECT
#define DEFAULT_CAL_FACTORY_OAF_ID "OAFIID:GNOME_Evolution_Wombat_CalendarFactory"
-static BonoboXObjectClass *parent_class;
+static BonoboObjectClass *parent_class;
/* Private part of the CalFactory structure */
struct _CalFactoryPrivate {
- /* Hash table from URI method strings to GtkType * for backend class types */
+ /* Hash table from URI method strings to GType * for backend class types */
GHashTable *methods;
/* Hash table from GnomeVFSURI structures to CalBackend objects */
@@ -66,12 +65,12 @@ enum SIGNALS {
static guint signals[LAST_SIGNAL];
-/* Frees a method/GtkType * pair from the methods hash table */
+/* Frees a method/GType * pair from the methods hash table */
static void
free_method (gpointer key, gpointer value, gpointer data)
{
char *method;
- GtkType *type;
+ GType *type;
method = key;
type = value;
@@ -91,7 +90,7 @@ free_backend (gpointer key, gpointer value, gpointer data)
backend = value;
g_free (uri);
- gtk_object_unref (GTK_OBJECT (backend));
+ g_object_unref (backend);
}
/* Opening calendars */
@@ -165,12 +164,12 @@ backend_last_client_gone_cb (CalBackend *backend, gpointer data)
g_hash_table_remove (priv->backends, orig_uristr);
g_free (orig_uristr);
- gtk_object_unref (GTK_OBJECT (backend));
+ g_object_unref (backend);
/* Notify upstream if there are no more backends */
if (g_hash_table_size (priv->backends) == 0)
- gtk_signal_emit (GTK_OBJECT (factory), signals[LAST_CALENDAR_GONE]);
+ g_signal_emit (G_OBJECT (factory), signals[LAST_CALENDAR_GONE], 0);
}
/* Adds a backend to the calendar factory's hash table */
@@ -191,9 +190,9 @@ add_backend (CalFactory *factory, const char *uristr, CalBackend *backend)
g_hash_table_insert (priv->backends, tmp, backend);
e_uri_free (uri);
- gtk_signal_connect (GTK_OBJECT (backend), "last_client_gone",
- GTK_SIGNAL_FUNC (backend_last_client_gone_cb),
- factory);
+ g_signal_connect (G_OBJECT (backend), "last_client_gone",
+ G_CALLBACK (backend_last_client_gone_cb),
+ factory);
}
/* Tries to launch a backend for the method of the specified URI. If there is
@@ -207,7 +206,7 @@ launch_backend_for_uri (CalFactory *factory,
{
CalFactoryPrivate *priv;
const char *method;
- GtkType *type;
+ GType *type;
CalBackend *backend;
EUri *uri;
@@ -238,7 +237,7 @@ launch_backend_for_uri (CalFactory *factory,
return NULL;
}
- backend = gtk_type_new (*type);
+ backend = g_object_new (*type, NULL);
if (!backend)
g_message ("launch_backend_for_uri(): could not launch the backend");
@@ -269,7 +268,7 @@ open_backend (CalFactory *factory, const char *uristr, gboolean only_if_exists,
return backend;
case CAL_BACKEND_OPEN_ERROR:
- gtk_object_unref (GTK_OBJECT (backend));
+ g_object_unref (backend);
CORBA_exception_init (&ev);
GNOME_Evolution_Calendar_Listener_notifyCalOpened (
@@ -285,7 +284,7 @@ open_backend (CalFactory *factory, const char *uristr, gboolean only_if_exists,
return NULL;
case CAL_BACKEND_OPEN_NOT_FOUND:
- gtk_object_unref (GTK_OBJECT (backend));
+ g_object_unref (backend);
CORBA_exception_init (&ev);
GNOME_Evolution_Calendar_Listener_notifyCalOpened (
@@ -301,7 +300,7 @@ open_backend (CalFactory *factory, const char *uristr, gboolean only_if_exists,
return NULL;
case CAL_BACKEND_OPEN_PERMISSION_DENIED :
- gtk_object_unref (GTK_OBJECT (backend));
+ g_object_unref (backend);
CORBA_exception_init (&ev);
GNOME_Evolution_Calendar_Listener_notifyCalOpened (
@@ -482,7 +481,7 @@ impl_CalFactory_open (PortableServer_Servant servant,
gboolean result;
OpenJobData *jd;
GNOME_Evolution_Calendar_Listener listener_copy;
- GtkType *type;
+ GType *type;
EUri *uri;
factory = CAL_FACTORY (bonobo_object_from_servant (servant));
@@ -589,14 +588,14 @@ cal_factory_new (void)
{
CalFactory *factory;
- factory = gtk_type_new (CAL_FACTORY_TYPE);
+ factory = g_object_new (CAL_FACTORY_TYPE, NULL);
return factory;
}
/* Destroy handler for the calendar */
static void
-cal_factory_destroy (GtkObject *object)
+cal_factory_finalize (GObject *object)
{
CalFactory *factory;
CalFactoryPrivate *priv;
@@ -626,31 +625,30 @@ cal_factory_destroy (GtkObject *object)
g_free (priv);
factory->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);
}
/* Class initialization function for the calendar factory */
static void
cal_factory_class_init (CalFactoryClass *klass)
{
- GtkObjectClass *object_class = (GtkObjectClass *) klass;
+ GObjectClass *object_class = (GObjectClass *) klass;
POA_GNOME_Evolution_Calendar_CalFactory__epv *epv = &klass->epv;
- parent_class = gtk_type_class (bonobo_object_get_type ());
+ parent_class = g_type_class_peek_parent (klass);
signals[LAST_CALENDAR_GONE] =
- gtk_signal_new ("last_calendar_gone",
- GTK_RUN_FIRST,
- G_TYPE_FROM_CLASS (object_class),
- GTK_SIGNAL_OFFSET (CalFactoryClass, last_calendar_gone),
- gtk_marshal_NONE__NONE,
- GTK_TYPE_NONE, 0);
-
- gtk_object_class_add_signals (object_class, signals, LAST_SIGNAL);
+ g_signal_new ("last_calendar_gone",
+ G_TYPE_FROM_CLASS (klass),
+ G_SIGNAL_RUN_FIRST,
+ G_STRUCT_OFFSET (CalFactoryClass, last_calendar_gone),
+ NULL, NULL,
+ g_cclosure_marshal_VOID__VOID,
+ G_TYPE_NONE, 0);
/* Class method overrides */
- object_class->destroy = cal_factory_destroy;
+ object_class->finalize = cal_factory_finalize;
/* Epv methods */
epv->open = impl_CalFactory_open;
@@ -659,7 +657,7 @@ cal_factory_class_init (CalFactoryClass *klass)
/* Object initialization function for the calendar factory */
static void
-cal_factory_init (CalFactory *factory)
+cal_factory_init (CalFactory *factory, CalFactoryClass *klass)
{
CalFactoryPrivate *priv;
@@ -671,10 +669,10 @@ cal_factory_init (CalFactory *factory)
priv->registered = FALSE;
}
-BONOBO_X_TYPE_FUNC_FULL (CalFactory,
- GNOME_Evolution_Calendar_CalFactory,
- PARENT_TYPE,
- cal_factory);
+BONOBO_TYPE_FUNC_FULL (CalFactory,
+ GNOME_Evolution_Calendar_CalFactory,
+ PARENT_TYPE,
+ cal_factory);
/* Returns the lowercase version of a string */
static char *
@@ -763,17 +761,17 @@ cal_factory_oaf_register (CalFactory *factory, const char *iid)
* the appropriate type.
**/
void
-cal_factory_register_method (CalFactory *factory, const char *method, GtkType backend_type)
+cal_factory_register_method (CalFactory *factory, const char *method, GType backend_type)
{
CalFactoryPrivate *priv;
- GtkType *type;
+ GType *type;
char *method_str;
g_return_if_fail (factory != NULL);
g_return_if_fail (IS_CAL_FACTORY (factory));
g_return_if_fail (method != NULL);
g_return_if_fail (backend_type != 0);
- g_return_if_fail (gtk_type_is_a (backend_type, CAL_BACKEND_TYPE));
+ g_return_if_fail (g_type_is_a (backend_type, CAL_BACKEND_TYPE));
priv = factory->priv;
@@ -787,7 +785,7 @@ cal_factory_register_method (CalFactory *factory, const char *method, GtkType ba
return;
}
- type = g_new (GtkType, 1);
+ type = g_new (GType, 1);
*type = backend_type;
g_hash_table_insert (priv->methods, method_str, type);
diff --git a/calendar/pcs/cal-factory.h b/calendar/pcs/cal-factory.h
index e246056169..b7c370066b 100644
--- a/calendar/pcs/cal-factory.h
+++ b/calendar/pcs/cal-factory.h
@@ -21,7 +21,7 @@
#ifndef CAL_FACTORY_H
#define CAL_FACTORY_H
-#include <bonobo/bonobo-xobject.h>
+#include <bonobo/bonobo-object.h>
#include "pcs/evolution-calendar.h"
@@ -30,11 +30,11 @@ G_BEGIN_DECLS
#define CAL_FACTORY_TYPE (cal_factory_get_type ())
-#define CAL_FACTORY(obj) (GTK_CHECK_CAST ((obj), CAL_FACTORY_TYPE, CalFactory))
-#define CAL_FACTORY_CLASS(klass) (GTK_CHECK_CLASS_CAST ((klass), CAL_FACTORY_TYPE, \
+#define CAL_FACTORY(obj) (G_TYPE_CHECK_INSTANCE_CAST ((obj), CAL_FACTORY_TYPE, CalFactory))
+#define CAL_FACTORY_CLASS(klass) (G_TYPE_CHECK_CLASS_CAST ((klass), CAL_FACTORY_TYPE, \
CalFactoryClass))
-#define IS_CAL_FACTORY(obj) (GTK_CHECK_TYPE ((obj), CAL_FACTORY_TYPE))
-#define IS_CAL_FACTORY_CLASS(klass) (GTK_CHECK_CLASS_TYPE ((klass), CAL_FACTORY_TYPE))
+#define IS_CAL_FACTORY(obj) (G_TYPE_CHECK_INSTANCE_TYPE ((obj), CAL_FACTORY_TYPE))
+#define IS_CAL_FACTORY_CLASS(klass) (G_TYPE_CHECK_CLASS_TYPE ((klass), CAL_FACTORY_TYPE))
typedef struct _CalFactory CalFactory;
typedef struct _CalFactoryClass CalFactoryClass;
@@ -42,14 +42,14 @@ typedef struct _CalFactoryClass CalFactoryClass;
typedef struct _CalFactoryPrivate CalFactoryPrivate;
struct _CalFactory {
- BonoboXObject object;
+ BonoboObject object;
/* Private data */
CalFactoryPrivate *priv;
};
struct _CalFactoryClass {
- BonoboXObjectClass parent_class;
+ BonoboObjectClass parent_class;
POA_GNOME_Evolution_Calendar_CalFactory__epv epv;
@@ -57,13 +57,13 @@ struct _CalFactoryClass {
void (* last_calendar_gone) (CalFactory *factory);
};
-GtkType cal_factory_get_type (void);
+GType cal_factory_get_type (void);
CalFactory *cal_factory_new (void);
gboolean cal_factory_oaf_register (CalFactory *factory, const char *iid);
void cal_factory_register_method (CalFactory *factory,
const char *method,
- GtkType backend_type);
+ GType backend_type);
int cal_factory_get_n_backends (CalFactory *factory);
void cal_factory_dump_active_backends (CalFactory *factory);
diff --git a/calendar/pcs/cal.c b/calendar/pcs/cal.c
index 861cc47c89..20ec86eb28 100644
--- a/calendar/pcs/cal.c
+++ b/calendar/pcs/cal.c
@@ -28,9 +28,9 @@
#include "query.h"
#include "Evolution-Wombat.h"
-#define PARENT_TYPE BONOBO_X_OBJECT_TYPE
+#define PARENT_TYPE BONOBO_TYPE_OBJECT
-static BonoboXObjectClass *parent_class;
+static BonoboObjectClass *parent_class;
/* Private part of the Cal structure */
struct _CalPrivate {
@@ -553,6 +553,7 @@ impl_Cal_get_query (PortableServer_Servant servant,
CORBA_exception_init (&ev2);
query_copy = CORBA_Object_duplicate (BONOBO_OBJREF (query), &ev2);
if (BONOBO_EX (&ev2)) {
+ bonobo_object_unref (query);
CORBA_exception_free (&ev2);
g_message ("Cal_get_query(): Could not duplicate the query reference");
bonobo_exception_set (ev, ex_GNOME_Evolution_Calendar_Cal_CouldNotCreate);
@@ -687,7 +688,7 @@ cal_new (CalBackend *backend, GNOME_Evolution_Calendar_Listener listener)
g_return_val_if_fail (backend != NULL, NULL);
g_return_val_if_fail (IS_CAL_BACKEND (backend), NULL);
- cal = CAL (gtk_type_new (CAL_TYPE));
+ cal = CAL (g_object_new (CAL_TYPE, NULL));
retval = cal_construct (cal, backend, listener);
if (!retval) {
@@ -701,7 +702,7 @@ cal_new (CalBackend *backend, GNOME_Evolution_Calendar_Listener listener)
/* Destroy handler for the calendar */
static void
-cal_destroy (GtkObject *object)
+cal_finalize (GObject *object)
{
Cal *cal;
CalPrivate *priv;
@@ -725,8 +726,8 @@ cal_destroy (GtkObject *object)
g_free (priv);
- 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);
}
@@ -735,13 +736,13 @@ cal_destroy (GtkObject *object)
static void
cal_class_init (CalClass *klass)
{
- GtkObjectClass *object_class = (GtkObjectClass *) klass;
+ GObjectClass *object_class = (GObjectClass *) klass;
POA_GNOME_Evolution_Calendar_Cal__epv *epv = &klass->epv;
- parent_class = gtk_type_class (PARENT_TYPE);
+ parent_class = g_type_class_peek_parent (klass);
/* Class method overrides */
- object_class->destroy = cal_destroy;
+ object_class->finalize = cal_finalize;
/* Epv methods */
epv->_get_uri = impl_Cal_get_uri;
@@ -767,7 +768,7 @@ cal_class_init (CalClass *klass)
/* Object initialization function for the calendar */
static void
-cal_init (Cal *cal)
+cal_init (Cal *cal, CalClass *klass)
{
CalPrivate *priv;
@@ -777,7 +778,7 @@ cal_init (Cal *cal)
priv->listener = CORBA_OBJECT_NIL;
}
-BONOBO_X_TYPE_FUNC_FULL (Cal, GNOME_Evolution_Calendar_Cal, PARENT_TYPE, cal);
+BONOBO_TYPE_FUNC_FULL (Cal, GNOME_Evolution_Calendar_Cal, PARENT_TYPE, cal);
/**
* cal_notify_mode:
diff --git a/calendar/pcs/cal.h b/calendar/pcs/cal.h
index f8ef057c44..61db51abf6 100644
--- a/calendar/pcs/cal.h
+++ b/calendar/pcs/cal.h
@@ -23,8 +23,7 @@
#ifndef CAL_H
#define CAL_H
-#include <gtk/gtkobject.h>
-#include <bonobo/bonobo-xobject.h>
+#include <bonobo/bonobo-object.h>
#include "pcs/evolution-calendar.h"
#include "pcs/cal-common.h"
@@ -33,27 +32,27 @@ G_BEGIN_DECLS
#define CAL_TYPE (cal_get_type ())
-#define CAL(obj) (GTK_CHECK_CAST ((obj), CAL_TYPE, Cal))
-#define CAL_CLASS(klass) (GTK_CHECK_CLASS_CAST ((klass), CAL_TYPE, CalClass))
-#define IS_CAL(obj) (GTK_CHECK_TYPE ((obj), CAL_TYPE))
-#define IS_CAL_CLASS(klass) (GTK_CHECK_CLASS_TYPE ((klass), CAL_TYPE))
+#define CAL(obj) (G_TYPE_CHECK_INSTANCE_CAST ((obj), CAL_TYPE, Cal))
+#define CAL_CLASS(klass) (G_TYPE_CHECK_CLASS_CAST ((klass), CAL_TYPE, CalClass))
+#define IS_CAL(obj) (G_TYPE_CHECK_INSTANCE_TYPE ((obj), CAL_TYPE))
+#define IS_CAL_CLASS(klass) (G_TYPE_CHECK_CLASS_TYPE ((klass), CAL_TYPE))
typedef struct _CalPrivate CalPrivate;
struct _Cal {
- BonoboXObject object;
+ BonoboObject object;
/* Private data */
CalPrivate *priv;
};
struct _CalClass {
- BonoboXObjectClass parent_class;
+ BonoboObjectClass parent_class;
POA_GNOME_Evolution_Calendar_Cal__epv epv;
};
-GtkType cal_get_type (void);
+GType cal_get_type (void);
Cal *cal_construct (Cal *cal,
CalBackend *backend,
diff --git a/calendar/pcs/query-backend.c b/calendar/pcs/query-backend.c
index 31308e7fcc..8bace1023d 100644
--- a/calendar/pcs/query-backend.c
+++ b/calendar/pcs/query-backend.c
@@ -24,14 +24,13 @@
#include <glib.h>
#include <libgnome/gnome-i18n.h>
-#include <gtk/gtksignal.h>
#include <cal-util/cal-component.h>
#include "query.h"
#include "query-backend.h"
static void query_backend_class_init (QueryBackendClass *klass);
-static void query_backend_init (QueryBackend *qb);
-static void query_backend_destroy (GtkObject *object);
+static void query_backend_init (QueryBackend *qb, QueryBackendClass *klass);
+static void query_backend_finalize (GObject *object);
typedef struct {
CalComponent *comp;
@@ -46,22 +45,22 @@ struct _QueryBackendPrivate {
};
static GHashTable *loaded_backends = NULL;
-static GtkObjectClass *parent_class = NULL;
+static GObjectClass *parent_class = NULL;
/* Class initialization function for the backend cache */
static void
query_backend_class_init (QueryBackendClass *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);
- object_class->destroy = query_backend_destroy;
+ object_class->finalize = query_backend_finalize;
}
/* Object initialization function for the backend cache */
static void
-query_backend_init (QueryBackend *qb)
+query_backend_init (QueryBackend *qb, QueryBackendClass *klass)
{
QueryBackendPrivate *priv;
@@ -78,12 +77,12 @@ static void
free_hash_comp_cb (gpointer key, gpointer value, gpointer user_data)
{
g_free (key);
- gtk_object_unref (GTK_OBJECT (value));
+ g_object_unref (value);
}
-/* Destroy handler for the backend cache */
+/* Finalize handler for the backend cache */
static void
-query_backend_destroy (GtkObject *object)
+query_backend_finalize (GObject *object)
{
QueryBackend *qb = (QueryBackend *) object;
@@ -113,8 +112,8 @@ query_backend_destroy (GtkObject *object)
g_free (qb->priv);
qb->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);
}
/**
@@ -126,31 +125,30 @@ query_backend_destroy (GtkObject *object)
*
* Return value: The type ID of the #QueryBackend class.
**/
-GtkType
+GType
query_backend_get_type (void)
{
- static GtkType type = 0;
+ static GType type = 0;
if (!type) {
- static const GtkTypeInfo info = {
- "QueryBackend",
- sizeof (QueryBackend),
- sizeof (QueryBackendClass),
- (GtkClassInitFunc) query_backend_class_init,
- (GtkObjectInitFunc) query_backend_init,
- NULL, /* reserved_1 */
- NULL, /* reserved_2 */
- (GtkClassInitFunc) NULL
- };
-
- type = gtk_type_unique (GTK_TYPE_OBJECT, &info);
+ static GTypeInfo info = {
+ sizeof (QueryBackendClass),
+ (GBaseInitFunc) NULL,
+ (GBaseFinalizeFunc) NULL,
+ (GClassInitFunc) query_backend_class_init,
+ NULL, NULL,
+ sizeof (QueryBackend),
+ 0,
+ (GInstanceInitFunc) query_backend_init
+ };
+ type = g_type_register_static (G_TYPE_OBJECT, "QueryBackend", &info, 0);
}
return type;
}
static void
-backend_destroyed_cb (GtkObject *object, gpointer user_data)
+backend_destroyed_cb (GObject *object, gpointer user_data)
{
CalBackend *backend = (CalBackend *) object;
QueryBackend *qb = (QueryBackend *) user_data;
@@ -158,7 +156,7 @@ backend_destroyed_cb (GtkObject *object, gpointer user_data)
g_return_if_fail (IS_CAL_BACKEND (backend));
g_return_if_fail (IS_QUERY_BACKEND (qb));
- gtk_object_unref (GTK_OBJECT (qb));
+ g_object_unref (qb);
}
static void
@@ -176,7 +174,7 @@ object_updated_cb (CalBackend *backend, const char *uid, gpointer user_data)
if (g_hash_table_lookup_extended (qb->priv->components, uid, &orig_key, &orig_value)) {
g_hash_table_remove (qb->priv->components, uid);
g_free (orig_key);
- gtk_object_unref (GTK_OBJECT (orig_value));
+ g_object_unref (orig_value);
}
comp_str = cal_backend_get_object (qb->priv->backend, uid);
@@ -189,13 +187,13 @@ object_updated_cb (CalBackend *backend, const char *uid, gpointer user_data)
comp = cal_component_new ();
if (!cal_component_set_icalcomponent (comp, icalcomp)) {
icalcomponent_free (icalcomp);
- gtk_object_unref (GTK_OBJECT (comp));
+ g_object_unref (comp);
return;
}
cal_component_get_uid (comp, &tmp_uid);
if (!uid || !*uid) {
- gtk_object_unref (GTK_OBJECT (comp));
+ g_object_unref (comp);
} else
g_hash_table_insert (qb->priv->components, g_strdup (tmp_uid), comp);
}
@@ -212,12 +210,12 @@ object_removed_cb (CalBackend *backend, const char *uid, gpointer user_data)
if (g_hash_table_lookup_extended (qb->priv->components, uid, &orig_key, &orig_value)) {
g_hash_table_remove (qb->priv->components, uid);
g_free (orig_key);
- gtk_object_unref (GTK_OBJECT (orig_value));
+ g_object_unref (orig_value);
}
}
static void
-query_destroyed_cb (GtkObject *object, gpointer user_data)
+query_destroyed_cb (GObject *object, gpointer user_data)
{
Query *query = (Query *) object;
QueryBackend *qb = (QueryBackend *) user_data;
@@ -268,7 +266,7 @@ query_backend_new (Query *query, CalBackend *backend)
if (!qb) {
GList *uidlist;
- qb = gtk_type_new (QUERY_BACKEND_TYPE);
+ qb = g_object_new (QUERY_BACKEND_TYPE, NULL);
qb->priv->uri = g_strdup (cal_backend_get_uri (backend));
qb->priv->backend = backend;
@@ -278,19 +276,19 @@ query_backend_new (Query *query, CalBackend *backend)
g_list_foreach (uidlist, foreach_uid_cb, qb);
cal_obj_uid_list_free (uidlist);
- gtk_signal_connect (GTK_OBJECT (backend), "destroy",
- GTK_SIGNAL_FUNC (backend_destroyed_cb), qb);
- gtk_signal_connect (GTK_OBJECT (backend), "obj_updated",
- GTK_SIGNAL_FUNC (object_updated_cb), qb);
- gtk_signal_connect (GTK_OBJECT (backend), "obj_removed",
- GTK_SIGNAL_FUNC (object_removed_cb), qb);
+ g_signal_connect (G_OBJECT (backend), "destroy",
+ G_CALLBACK (backend_destroyed_cb), qb);
+ g_signal_connect (G_OBJECT (backend), "obj_updated",
+ G_CALLBACK (object_updated_cb), qb);
+ g_signal_connect (G_OBJECT (backend), "obj_removed",
+ G_CALLBACK (object_removed_cb), qb);
g_hash_table_insert (loaded_backends, qb->priv->uri, qb);
}
qb->priv->queries = g_list_append (qb->priv->queries, query);
- gtk_signal_connect (GTK_OBJECT (query), "destroy",
- GTK_SIGNAL_FUNC (query_destroyed_cb), qb);
+ g_signal_connect (G_OBJECT (query), "destroy",
+ G_CALLBACK (query_destroyed_cb), qb);
return qb;
}
diff --git a/calendar/pcs/query-backend.h b/calendar/pcs/query-backend.h
index 1e05ae597a..a6d9b5d8aa 100644
--- a/calendar/pcs/query-backend.h
+++ b/calendar/pcs/query-backend.h
@@ -27,25 +27,25 @@
G_BEGIN_DECLS
#define QUERY_BACKEND_TYPE (query_backend_get_type ())
-#define QUERY_BACKEND(obj) (GTK_CHECK_CAST ((obj), QUERY_BACKEND_TYPE, QueryBackend))
-#define QUERY_BACKEND_CLASS(klass) (GTK_CHECK_CLASS_CAST ((klass), QUERY_BACKEND_TYPE, QueryBackendClass))
-#define IS_QUERY_BACKEND(obj) (GTK_CHECK_TYPE ((obj), QUERY_BACKEND_TYPE))
-#define IS_QUERY_BACKEND_CLASS(klass) (GTK_CHECK_CLASS_TYPE ((klass), QUERY_BACKEND_TYPE))
+#define QUERY_BACKEND(obj) (G_TYPE_CHECK_INSTANCE_CAST ((obj), QUERY_BACKEND_TYPE, QueryBackend))
+#define QUERY_BACKEND_CLASS(klass) (G_TYPE_CHECK_CLASS_CAST ((klass), QUERY_BACKEND_TYPE, QueryBackendClass))
+#define IS_QUERY_BACKEND(obj) (G_TYPE_CHECK_INSTANCE_TYPE ((obj), QUERY_BACKEND_TYPE))
+#define IS_QUERY_BACKEND_CLASS(klass) (G_TYPE_CHECK_CLASS_TYPE ((klass), QUERY_BACKEND_TYPE))
typedef struct _QueryBackendPrivate QueryBackendPrivate;
typedef struct {
- GtkObject object;
+ GObject object;
/* Private data */
QueryBackendPrivate *priv;
} QueryBackend;
typedef struct {
- GtkObjectClass parent;
+ GObjectClass parent;
} QueryBackendClass;
-GtkType query_backend_get_type (void);
+GType query_backend_get_type (void);
QueryBackend *query_backend_new (Query *query, CalBackend *backend);
GList *query_backend_get_uids (QueryBackend *qb, CalObjType type);
CalComponent *query_backend_get_object_component (QueryBackend *qb, const char *uid);
diff --git a/calendar/pcs/query.c b/calendar/pcs/query.c
index 1c8785eec4..da80b7b141 100644
--- a/calendar/pcs/query.c
+++ b/calendar/pcs/query.c
@@ -24,9 +24,7 @@
#include <string.h>
#include <glib.h>
-#include <gtk/gtkmain.h>
#include <libgnome/gnome-i18n.h>
-#include <gtk/gtksignal.h>
#include <bonobo/bonobo-exception.h>
#include <gal/widgets/e-unicode.h>
#include <e-util/e-component-listener.h>
@@ -96,30 +94,30 @@ struct _QueryPrivate {
static void query_class_init (QueryClass *class);
-static void query_init (Query *query);
-static void query_destroy (GtkObject *object);
+static void query_init (Query *query, QueryClass *class);
+static void query_finalize (GObject *object);
-static BonoboXObjectClass *parent_class;
+static BonoboObjectClass *parent_class;
static GList *cached_queries = NULL;
-BONOBO_X_TYPE_FUNC_FULL (Query,
- GNOME_Evolution_Calendar_Query,
- BONOBO_X_OBJECT_TYPE,
- query);
+BONOBO_TYPE_FUNC_FULL (Query,
+ GNOME_Evolution_Calendar_Query,
+ BONOBO_TYPE_OBJECT,
+ query);
/* Class initialization function for the live search query */
static void
query_class_init (QueryClass *class)
{
- GtkObjectClass *object_class;
+ GObjectClass *object_class;
- object_class = (GtkObjectClass *) class;
+ object_class = (GObjectClass *) class;
- parent_class = gtk_type_class (BONOBO_X_OBJECT_TYPE);
+ parent_class = g_type_class_peek_parent (class);
- object_class->destroy = query_destroy;
+ object_class->finalize = query_finalize;
/* The Query interface (ha ha! query interface!) has no methods, so we
* don't need to fiddle with the epv.
@@ -128,7 +126,7 @@ query_class_init (QueryClass *class)
/* Object initialization function for the live search query */
static void
-query_init (Query *query)
+query_init (Query *query, QueryClass *class)
{
QueryPrivate *priv;
@@ -163,9 +161,9 @@ free_uid_cb (gpointer key, gpointer value, gpointer data)
g_free (uid);
}
-/* Destroy handler for the live search query */
+/* Finalize handler for the live search query */
static void
-query_destroy (GtkObject *object)
+query_finalize (GObject *object)
{
Query *query;
QueryPrivate *priv;
@@ -189,7 +187,7 @@ query_destroy (GtkObject *object)
|| priv->state == QUERY_IN_PROGRESS || priv->state == QUERY_DONE)
gtk_signal_disconnect_by_data (GTK_OBJECT (priv->backend), query);
- gtk_object_unref (GTK_OBJECT (priv->backend));
+ g_object_unref (priv->backend);
priv->backend = NULL;
}
@@ -214,7 +212,7 @@ query_destroy (GtkObject *object)
}
if (priv->component_listeners != NULL) {
- g_list_foreach (priv->component_listeners, (GFunc) gtk_object_unref, NULL);
+ g_list_foreach (priv->component_listeners, (GFunc) g_object_unref, NULL);
g_list_free (priv->component_listeners);
priv->component_listeners = NULL;
}
@@ -267,8 +265,8 @@ query_destroy (GtkObject *object)
g_free (priv);
query->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);
}
@@ -1377,12 +1375,12 @@ start_query (Query *query)
priv->pending_total = g_list_length (priv->pending_uids);
priv->n_pending = priv->pending_total;
- gtk_signal_connect (GTK_OBJECT (priv->backend), "obj_updated",
- GTK_SIGNAL_FUNC (backend_obj_updated_cb),
- query);
- gtk_signal_connect (GTK_OBJECT (priv->backend), "obj_removed",
- GTK_SIGNAL_FUNC (backend_obj_removed_cb),
- query);
+ g_signal_connect (G_OBJECT (priv->backend), "obj_updated",
+ G_CALLBACK (backend_obj_updated_cb),
+ query);
+ g_signal_connect (G_OBJECT (priv->backend), "obj_removed",
+ G_CALLBACK (backend_obj_removed_cb),
+ query);
priv->timeout_id = g_timeout_add (100, (GSourceFunc) process_components_cb, query);
}
@@ -1422,7 +1420,7 @@ listener_died_cb (EComponentListener *cl, gpointer data)
priv->listeners = g_list_remove (priv->listeners, ql);
priv->component_listeners = g_list_remove (priv->component_listeners, cl);
- gtk_object_unref (GTK_OBJECT (cl));
+ g_object_unref (cl);
CORBA_exception_init (&ev);
bonobo_object_release_unref (ql, &ev);
@@ -1464,8 +1462,8 @@ start_cached_query_cb (gpointer data)
cl = e_component_listener_new (info->ql, 0);
priv->component_listeners = g_list_append (priv->component_listeners, cl);
- gtk_signal_connect (GTK_OBJECT (cl), "component_died",
- GTK_SIGNAL_FUNC (listener_died_cb), info->query);
+ g_signal_connect (G_OBJECT (cl), "component_died",
+ G_CALLBACK (listener_died_cb), info->query);
} else if (priv->state == QUERY_IN_PROGRESS) {
/* if it's in progress, we re-add the timeout */
info->tid = g_timeout_add (100, (GSourceFunc) start_cached_query_cb, info);
@@ -1535,8 +1533,8 @@ start_cached_query_cb (gpointer data)
cl = e_component_listener_new (info->ql, 0);
priv->component_listeners = g_list_append (priv->component_listeners, cl);
- gtk_signal_connect (GTK_OBJECT (cl), "component_died",
- GTK_SIGNAL_FUNC (listener_died_cb), info->query);
+ g_signal_connect (G_OBJECT (cl), "component_died",
+ G_CALLBACK (listener_died_cb), info->query);
GNOME_Evolution_Calendar_QueryListener_notifyQueryDone (
info->ql,
@@ -1569,7 +1567,9 @@ backend_opened_cb (CalBackend *backend, CalBackendOpenStatus status, gpointer da
g_assert (priv->state == QUERY_WAIT_FOR_BACKEND);
- gtk_signal_disconnect_by_data (GTK_OBJECT (priv->backend), query);
+ g_signal_handlers_disconnect_matched (G_OBJECT (priv->backend),
+ G_SIGNAL_MATCH_DATA,
+ 0, 0, NULL, NULL, query);
priv->state = QUERY_START_PENDING;
if (status == CAL_BACKEND_OPEN_SUCCESS) {
@@ -1640,7 +1640,7 @@ query_construct (Query *query,
GTK_SIGNAL_FUNC (listener_died_cb), query);
priv->backend = backend;
- gtk_object_ref (GTK_OBJECT (priv->backend));
+ g_object_ref (priv->backend);
priv->qb = query_backend_new (query, backend);
priv->default_zone = cal_backend_get_default_timezone (backend);
@@ -1654,9 +1654,9 @@ query_construct (Query *query,
priv->timeout_id = g_timeout_add (100, (GSourceFunc) start_query_cb, query);
} else
- gtk_signal_connect (GTK_OBJECT (priv->backend), "opened",
- GTK_SIGNAL_FUNC (backend_opened_cb),
- query);
+ g_signal_connect (G_OBJECT (priv->backend), "opened",
+ G_CALLBACK (backend_opened_cb),
+ query);
return query;
}
@@ -1713,15 +1713,15 @@ query_new (CalBackend *backend,
}
/* not found, so create a new one */
- query = QUERY (gtk_type_new (QUERY_TYPE));
+ query = QUERY (g_object_new (QUERY_TYPE, NULL));
if (!query_construct (query, backend, ql, sexp)) {
bonobo_object_unref (BONOBO_OBJECT (query));
return NULL;
}
/* add the new query to our cache */
- gtk_signal_connect (GTK_OBJECT (query->priv->backend), "destroy",
- GTK_SIGNAL_FUNC (backend_destroyed_cb), query);
+ g_signal_connect (G_OBJECT (query->priv->backend), "destroy",
+ G_CALLBACK (backend_destroyed_cb), query);
bonobo_object_ref (BONOBO_OBJECT (query));
cached_queries = g_list_append (cached_queries, query);
diff --git a/calendar/pcs/query.h b/calendar/pcs/query.h
index 31388a5494..752c29eb40 100644
--- a/calendar/pcs/query.h
+++ b/calendar/pcs/query.h
@@ -21,7 +21,7 @@
#ifndef QUERY_H
#define QUERY_H
-#include <bonobo/bonobo-xobject.h>
+#include <bonobo/bonobo-object.h>
#include "pcs/cal-common.h"
#include "pcs/evolution-calendar.h"
@@ -30,27 +30,27 @@ G_BEGIN_DECLS
#define QUERY_TYPE (query_get_type ())
-#define QUERY(obj) (GTK_CHECK_CAST ((obj), QUERY_TYPE, Query))
-#define QUERY_CLASS(klass) (GTK_CHECK_CLASS_CAST ((klass), QUERY_TYPE, QueryClass))
-#define IS_QUERY(obj) (GTK_CHECK_TYPE ((obj), QUERY_TYPE))
-#define IS_QUERY_CLASS(klass) (GTK_CHECK_CLASS_TYPE ((klass), QUERY_TYPE))
+#define QUERY(obj) (G_TYPE_CHECK_INSTANCE_CAST ((obj), QUERY_TYPE, Query))
+#define QUERY_CLASS(klass) (G_TYPE_CHECK_CLASS_CAST ((klass), QUERY_TYPE, QueryClass))
+#define IS_QUERY(obj) (G_TYPE_CHECK_INSTANCE_TYPE ((obj), QUERY_TYPE))
+#define IS_QUERY_CLASS(klass) (G_TYPE_CHECK_CLASS_TYPE ((klass), QUERY_TYPE))
typedef struct _QueryPrivate QueryPrivate;
typedef struct {
- BonoboXObject xobject;
+ BonoboObject xobject;
/* Private data */
QueryPrivate *priv;
} Query;
typedef struct {
- BonoboXObjectClass parent_class;
+ BonoboObjectClass parent_class;
POA_GNOME_Evolution_Calendar_Query__epv epv;
} QueryClass;
-GtkType query_get_type (void);
+GType query_get_type (void);
Query *query_construct (Query *query,
CalBackend *backend,