* Boston, MA 02111-1307, USA.
*/
-/*
- * desktop.c: implements SpiDesktop.idl
- *
- */
-
-/* #include <config.h> */
-#include <libbonobo.h>
+/* desktop.c: implements SpiDesktop.idl */
+#include <config.h>
#include <stdio.h>
+#include <libbonobo.h>
+#include <libspi/desktop.h>
-/*
- * This pulls the CORBA definitions for the "Accessibility::SpiAccessible" server
- */
-#include <libspi/Accessibility.h>
-
-/*
- * This pulls the definition for the BonoboObject (Gtk Type)
- */
-#include "desktop.h"
-
-/*
- * Our parent Gtk object type
- */
+/* Our parent Gtk object type */
#define PARENT_TYPE SPI_ACCESSIBLE_TYPE
-/*
- * A pointer to our parent object class
- */
+/* A pointer to our parent object class */
static SpiAccessibleClass *parent_class;
static void
spi_desktop_init (SpiDesktop *desktop)
{
- SPI_ACCESSIBLE (desktop)->atko = g_object_new (atk_object_get_type(), NULL);
+ SPI_ACCESSIBLE (desktop)->atko = g_object_new (ATK_TYPE_OBJECT, NULL);
desktop->applications = NULL;
atk_object_set_name (ATK_OBJECT (SPI_ACCESSIBLE (desktop)->atko), "main");
}
+static void
+spi_desktop_finalize (GObject *object)
+{
+ (G_OBJECT_CLASS (parent_class))->finalize (object);
+}
+
static CORBA_long
-impl_spi_desktop_get_child_count (PortableServer_Servant servant,
+impl_desktop_get_child_count (PortableServer_Servant servant,
CORBA_Environment * ev)
{
SpiDesktop *desktop = SPI_DESKTOP (bonobo_object_from_servant (servant));
}
}
-static Accessibility_SpiAccessible
-impl_spi_desktop_get_child_at_index (PortableServer_Servant servant,
+static Accessibility_Accessible
+impl_desktop_get_child_at_index (PortableServer_Servant servant,
const CORBA_long index,
CORBA_Environment * ev)
{
/* */
fprintf (stderr, "object address %p\n",
g_list_nth_data (desktop->applications, index));
- retval = CORBA_Object_duplicate (
+ retval = bonobo_object_dup_ref (
(CORBA_Object) g_list_nth_data (desktop->applications, index), ev);
}
else
fprintf (stderr, "no %ldth child\n", (long) index);
retval = CORBA_OBJECT_NIL;
}
- return (Accessibility_SpiAccessible) retval;
+ return (Accessibility_Accessible) retval;
}
static void
spi_desktop_class_init (SpiDesktopClass *klass)
{
+ GObjectClass * object_class = (GObjectClass *) klass;
SpiAccessibleClass * spi_accessible_class = (SpiAccessibleClass *) klass;
- POA_Accessibility_SpiAccessible__epv *epv = &spi_accessible_class->epv;
+ POA_Accessibility_Accessible__epv *epv = &spi_accessible_class->epv;
+
+ object_class->finalize = spi_desktop_finalize;
parent_class = g_type_class_ref (SPI_ACCESSIBLE_TYPE);
- epv->_get_childCount = impl_spi_desktop_get_child_count;
- epv->getChildAtIndex = impl_spi_desktop_get_child_at_index;
+ epv->_get_childCount = impl_desktop_get_child_count;
+ epv->getChildAtIndex = impl_desktop_get_child_at_index;
}
-GType
-spi_desktop_get_type (void)
-{
- static GType type = 0;
-
- if (!type) {
- static const GTypeInfo tinfo = {
- sizeof (SpiDesktopClass),
- (GBaseInitFunc) NULL,
- (GBaseFinalizeFunc) NULL,
- (GClassInitFunc) spi_desktop_class_init,
- (GClassFinalizeFunc) NULL,
- NULL, /* class data */
- sizeof (SpiDesktop),
- 0, /* n preallocs */
- (GInstanceInitFunc) spi_desktop_init,
- NULL /* value table */
- };
- /*
- * Here we use bonobo_type_unique instead of
- * gtk_type_unique, this auto-generates a load of
- * CORBA structures for us. All derived types must
- * use bonobo_type_unique.
- */
- type = bonobo_type_unique (
- PARENT_TYPE,
- POA_Accessibility_SpiDesktop__init,
- NULL,
- G_STRUCT_OFFSET (SpiDesktopClass, epv),
- &tinfo,
- "SpiDesktop");
- }
-
- return type;
-}
+BONOBO_TYPE_FUNC_FULL (SpiDesktop,
+ Accessibility_Desktop,
+ PARENT_TYPE,
+ spi_desktop);
SpiDesktop *
spi_desktop_new (void)
{
- SpiDesktop *retval =
- SPI_DESKTOP (g_object_new (spi_desktop_get_type (), NULL));
+ SpiDesktop *retval = g_object_new (SPI_DESKTOP_TYPE, NULL);
+
return retval;
}