2 * desktop.c: implements Desktop.idl
6 /* #include <config.h> */
12 * This pulls the CORBA definitions for the "Accessibility::Accessible" server
17 * This pulls the definition for the BonoboObject (Gtk Type)
22 * Our parent Gtk object type
24 #define PARENT_TYPE ACCESSIBLE_TYPE
27 * A pointer to our parent object class
29 static AccessibleClass *parent_class;
32 desktop_init (Desktop *desktop)
34 ACCESSIBLE (desktop)->atko = atk_simple_object_new();
35 atk_object_set_name (ATK_OBJECT (ACCESSIBLE (desktop)->atko), "main");
39 impl_desktop_get_child_count (PortableServer_Servant servant,
40 CORBA_Environment * ev)
42 Desktop *desktop = DESKTOP (bonobo_object_from_servant (servant));
43 if (desktop->applications)
45 return g_list_length (desktop->applications);
53 static Accessibility_Accessible
54 impl_desktop_get_child_at_index (PortableServer_Servant servant,
55 const CORBA_long index,
56 CORBA_Environment * ev)
58 Desktop *desktop = DESKTOP (bonobo_object_from_servant (servant));
60 if ((desktop->applications) && (index < g_list_length (desktop->applications)))
62 fprintf (stderr, "getting application %ld\n", (long) index);
64 fprintf (stderr, "object address %p\n",
65 g_list_nth_data (desktop->applications, index));
66 retval = CORBA_Object_duplicate (
67 (CORBA_Object) g_list_nth_data (desktop->applications, index), ev);
71 fprintf (stderr, "no %ldth child\n", (long) index);
72 retval = CORBA_OBJECT_NIL;
74 return (Accessibility_Accessible) retval;
78 desktop_class_init (DesktopClass *klass)
80 AccessibleClass * accessible_class = (AccessibleClass *) klass;
81 POA_Accessibility_Accessible__epv *epv = &accessible_class->epv;
83 parent_class = g_type_class_ref (ACCESSIBLE_TYPE);
85 epv->_get_childCount = impl_desktop_get_child_count;
86 epv->getChildAtIndex = impl_desktop_get_child_at_index;
90 desktop_get_type (void)
92 static GType type = 0;
95 static const GTypeInfo tinfo = {
96 sizeof (DesktopClass),
98 (GBaseFinalizeFunc) NULL,
99 (GClassInitFunc) desktop_class_init,
100 (GClassFinalizeFunc) NULL,
101 NULL, /* class data */
104 (GInstanceInitFunc) desktop_init,
105 NULL /* value table */
108 * Here we use bonobo_x_type_unique instead of
109 * gtk_type_unique, this auto-generates a load of
110 * CORBA structures for us. All derived types must
111 * use bonobo_x_type_unique.
113 type = bonobo_x_type_unique (
115 POA_Accessibility_Desktop__init,
117 G_STRUCT_OFFSET (DesktopClass, epv),
129 DESKTOP (g_object_new (desktop_get_type (), NULL));