Use macros for interface names
[platform/core/uifw/at-spi2-atk.git] / atk-adaptor / application.c
1 /*
2  * AT-SPI - Assistive Technology Service Provider Interface
3  * (Gnome Accessibility Project; http://developer.gnome.org/projects/gap)
4  *
5  * Copyright 2008 Novell, Inc.
6  * Copyright 2001, 2002 Sun Microsystems Inc.,
7  * Copyright 2001, 2002 Ximian, Inc.
8  *
9  * This library is free software; you can redistribute it and/or
10  * modify it under the terms of the GNU Library General Public
11  * License as published by the Free Software Foundation; either
12  * version 2 of the License, or (at your option) any later version.
13  *
14  * This library is distributed in the hope that it will be useful,
15  * but WITHOUT ANY WARRANTY; without even the implied warranty of
16  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
17  * Library General Public License for more details.
18  *
19  * You should have received a copy of the GNU Library General Public
20  * License along with this library; if not, write to the
21  * Free Software Foundation, Inc., 59 Temple Place - Suite 330,
22  * Boston, MA 02111-1307, USA.
23  */
24 #include "accessible.h"
25
26
27 static dbus_bool_t
28 impl_get_toolkitName (const char *path, DBusMessageIter * iter,
29                       void *user_data)
30 {
31   return droute_return_v_string (iter, atk_get_toolkit_name ());
32 }
33
34 static dbus_bool_t
35 impl_get_version (const char *path, DBusMessageIter * iter, void *user_data)
36 {
37   return droute_return_v_string (iter, atk_get_toolkit_version ());
38 }
39
40 static dbus_int32_t id;
41
42 static dbus_bool_t
43 impl_get_id (const char *path, DBusMessageIter * iter, void *user_data)
44 {
45   return droute_return_v_int32 (iter, id);
46 }
47
48 static dbus_bool_t
49 impl_set_id (const char *path, DBusMessageIter * iter, void *user_data)
50 {
51   id = droute_get_v_int32 (iter);
52   return TRUE;
53 }
54
55 static DBusMessage *
56 impl_registerToolkitEventListener (DBusConnection * bus,
57                                    DBusMessage * message, void *user_data)
58 {
59   return NULL;
60 }
61
62 static DBusMessage *
63 impl_registerObjectEventListener (DBusConnection * bus, DBusMessage * message,
64                                   void *user_data)
65 {
66   return NULL;
67 }
68
69 static DBusMessage *
70 impl_pause (DBusConnection * bus, DBusMessage * message, void *user_data)
71 {
72   return NULL;
73 }
74
75 static DBusMessage *
76 impl_resume (DBusConnection * bus, DBusMessage * message, void *user_data)
77 {
78   return NULL;
79 }
80
81 static DBusMessage *
82 impl_getLocale (DBusConnection * bus, DBusMessage * message, void *user_data)
83 {
84   return NULL;
85 }
86
87 static DRouteMethod methods[] = {
88   {impl_registerToolkitEventListener, "registerToolkitEventListener"},
89   {impl_registerObjectEventListener, "registerObjectEventListener"},
90   {impl_pause, "pause"},
91   {impl_resume, "resume"},
92   {impl_getLocale, "getLocale"},
93   {NULL, NULL}
94 };
95
96 static DRouteProperty properties[] = {
97   {impl_get_toolkitName, NULL, "toolkitName"},
98   {impl_get_version, NULL, "version"},
99   {impl_get_id, impl_set_id, "id"},
100   {NULL, NULL, NULL}
101 };
102
103 static long
104 obj_is_root (const char *path, void *user_data)
105 {
106   AtkObject *obj = spi_dbus_get_object (path);
107   return (obj == atk_get_root ());
108 }
109
110 void
111 spi_initialize_application (DRouteData * data)
112 {
113   droute_add_interface (data, SPI_DBUS_INTERFACE_APPLICATION,
114                         methods, properties,
115                         (DRouteGetDatumFunction) obj_is_root, NULL);
116 };