Changes to support generation of C bindings docs.
[platform/core/uifw/at-spi2-atk.git] / cspi / spi_main.c
1
2 /*
3  *
4  * Basic SPI initialization and event loop function prototypes
5  *
6  */
7
8 /**
9  * SPI_init:
10  *
11  * Connects to the accessibility registry and initializes the SPI.
12  *
13  * Returns: 0 on success, otherwise an integer error code.
14  **/
15 int
16 SPI_init (void)
17 {
18   int argc = 0;
19   CORBA_Object oclient;
20   char *obj_id;
21
22   CORBA_exception_init(&ev);
23
24   if (!bonobo_init (&argc, NULL))
25     {
26       g_error ("Could not initialize Bonobo");
27     }
28
29   obj_id = "OAFIID:Accessibility_Registry:proto0.1";
30
31   oclient = bonobo_activation_activate_from_id (obj_id, 0, NULL, &ev);
32   if (ev._major != CORBA_NO_EXCEPTION) {
33     fprintf (stderr,
34             ("AT-SPI error: during registry activation: %s\n"),
35             CORBA_exception_id(&ev));
36     CORBA_exception_free(&ev);
37     exit(-1);
38   }
39
40   if (CORBA_Object_is_nil (oclient, &ev))
41     {
42       g_error ("Could not locate registry");
43       exit(-1);
44     }
45
46   registry = (Accessibility_Registry) oclient;
47
48   bonobo_activate ();
49
50   return 0;
51 }
52
53 /**
54  * SPI_event_main:
55  * @isGNOMEApp: a #boolean indicating whether the client of the SPI
56  *              will use the Gnome event loop or not.
57  *
58  * Starts/enters the main event loop for the SPI services.
59  *
60  * (NOTE: This method does not return control, it is exited via a call to exit()
61  * from within an event handler).
62  *
63  **/
64 void
65 SPI_event_main (boolean isGNOMEApp)
66 {
67   if (isGNOMEApp) bonobo_main();
68   else CORBA_ORB_run (bonobo_orb(), &ev);
69 }
70
71 /**
72  * SPI_event_is_ready:
73  *
74  * Checks to see if an SPI event is waiting in the event queue.
75  * Used by clients that don't wish to use SPI_event_main().
76  * Not Yet Implemented.
77  *
78  * Returns: #TRUE if an event is waiting, otherwise #FALSE.
79  *
80  **/
81 boolean
82 SPI_eventIsReady ()
83 {
84   return FALSE;
85 }
86
87 /**
88  * SPI_nextEvent:
89  *
90  * Gets the next event in the SPI event queue; blocks if no event
91  * is pending.
92  * Used by clients that don't wish to use SPI_event_main().
93  * Not Yet Implemented.
94  *
95  * Returns: the next #AccessibleEvent in the SPI event queue.
96  *
97  **/
98 AccessibleEvent *
99 SPI_nextEvent (boolean waitForEvent)
100 {
101   return NULL;
102 }
103
104 /**
105  * SPI_exit:
106  *
107  * Disconnects from the Accessibility Registry and releases resources.
108  * Not Yet Implemented.
109  *
110  **/
111 void
112 SPI_exit (void)
113 {
114   exit(0);
115 }
116