diff options
Diffstat (limited to 'e-util/e-component-listener.c')
-rw-r--r-- | e-util/e-component-listener.c | 83 |
1 files changed, 44 insertions, 39 deletions
diff --git a/e-util/e-component-listener.c b/e-util/e-component-listener.c index e3cb3c6e1f..6db67dc270 100644 --- a/e-util/e-component-listener.c +++ b/e-util/e-component-listener.c @@ -8,8 +8,14 @@ * Copyright 2002, Ximian, Inc. */ +#ifdef HAVE_CONFIG_H +#include <config.h> +#endif + +#include <gtk/gtksignal.h> #include <bonobo/bonobo-exception.h> #include <bonobo/bonobo-object.h> +#include <gal/util/e-util.h> #include "e-component-listener.h" #include <libgnome/gnome-i18n.h> @@ -23,10 +29,10 @@ struct _EComponentListenerPrivate { }; static void e_component_listener_class_init (EComponentListenerClass *klass); -static void e_component_listener_init (EComponentListener *cl, EComponentListenerClass *klass); -static void e_component_listener_finalize (GObject *object); +static void e_component_listener_init (EComponentListener *cl); +static void e_component_listener_destroy (GtkObject *object); -static GObjectClass *parent_class = NULL; +static GtkObjectClass *parent_class = NULL; enum { COMPONENT_DIED, @@ -38,25 +44,25 @@ static guint comp_listener_signals[LAST_SIGNAL]; static void e_component_listener_class_init (EComponentListenerClass *klass) { - GObjectClass *object_class = G_OBJECT_CLASS (klass); + GtkObjectClass *object_class = GTK_OBJECT_CLASS (klass); - parent_class = g_type_class_peek_parent (klass); + parent_class = gtk_type_class (PARENT_TYPE); - object_class->finalize = e_component_listener_finalize; + object_class->destroy = e_component_listener_destroy; klass->component_died = NULL; comp_listener_signals[COMPONENT_DIED] = - g_signal_new ("component_died", - G_TYPE_FROM_CLASS (klass), - G_SIGNAL_RUN_FIRST, - G_STRUCT_OFFSET (EComponentListenerClass, component_died), - NULL, NULL, - g_cclosure_marshal_VOID__VOID, - G_TYPE_NONE, 0); + gtk_signal_new ("component_died", + GTK_RUN_FIRST, + object_class->type, + GTK_SIGNAL_OFFSET (EComponentListenerClass, component_died), + gtk_marshal_NONE__NONE, + GTK_TYPE_NONE, 0); + gtk_object_class_add_signals (object_class, comp_listener_signals, LAST_SIGNAL); } static void -e_component_listener_init (EComponentListener *cl, EComponentListenerClass *klass) +e_component_listener_init (EComponentListener *cl) { /* allocate internal structure */ cl->priv = g_new (EComponentListenerPrivate, 1); @@ -66,7 +72,7 @@ e_component_listener_init (EComponentListener *cl, EComponentListenerClass *klas } static void -e_component_listener_finalize (GObject *object) +e_component_listener_destroy (GtkObject *object) { EComponentListener *cl = (EComponentListener *) object; @@ -83,27 +89,28 @@ e_component_listener_finalize (GObject *object) g_free (cl->priv); cl->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); } -GType +GtkType e_component_listener_get_type (void) { - static GType type = 0; + static GtkType type = 0; if (!type) { - static GTypeInfo info = { - sizeof (EComponentListenerClass), - (GBaseInitFunc) NULL, - (GBaseFinalizeFunc) NULL, - (GClassInitFunc) e_component_listener_class_init, - NULL, NULL, - sizeof (EComponentListener), - 0, - (GInstanceInitFunc) e_component_listener_init - }; - type = g_type_register_static (G_TYPE_OBJECT, "EComponentListener", &info, 0); + static const GtkTypeInfo info = { + "EComponentListener", + sizeof (EComponentListener), + sizeof (EComponentListenerClass), + (GtkClassInitFunc) e_component_listener_class_init, + (GtkObjectInitFunc) e_component_listener_init, + NULL, /* reserved_1 */ + NULL, /* reserved_2 */ + (GtkClassInitFunc) NULL + }; + + type = gtk_type_unique (PARENT_TYPE, &info); } return type; @@ -129,28 +136,26 @@ ping_component_callback (gpointer user_data) "CORBA object is nil or not")); goto out; } + CORBA_exception_free (&ev); if (is_nil) goto out; - alive = bonobo_unknown_ping (cl->priv->component, &ev); - if (alive) { - CORBA_exception_free (&ev); + alive = bonobo_unknown_ping (cl->priv->component); + if (alive) return TRUE; - } out: /* the component has died, so we notify and close the timeout */ - CORBA_exception_free (&ev); /* we ref the object just in case it gets destroyed in the callbacks */ - g_object_ref (G_OBJECT (cl)); - g_signal_emit (G_OBJECT (cl), comp_listener_signals[COMPONENT_DIED], 0); + gtk_object_ref (GTK_OBJECT (cl)); + gtk_signal_emit (GTK_OBJECT (cl), comp_listener_signals[COMPONENT_DIED]); cl->priv->component = CORBA_OBJECT_NIL; cl->priv->ping_timeout_id = -1; - g_object_unref (G_OBJECT (cl)); + gtk_object_unref (GTK_OBJECT (cl)); return FALSE; } @@ -181,7 +186,7 @@ e_component_listener_new (Bonobo_Unknown comp, int ping_delay) { EComponentListener *cl; - cl = g_object_new (E_COMPONENT_LISTENER_TYPE, NULL); + cl = gtk_type_new (E_COMPONENT_LISTENER_TYPE); cl->priv->component = comp; /* set up the timeout function */ |