1 /* 2 * AT-SPI - Assistive Technology Service Provider Interface 3 * (Gnome Accessibility Project; http://developer.gnome.org/projects/gap) 4 * 5 * Copyright 2002 Ximian, Inc. 6 * 2002 Sun Microsystems Inc. 7 * Copyright 2010, 2011 Novell, Inc. 8 * 9 * 10 * This library is free software; you can redistribute it and/or 11 * modify it under the terms of the GNU Lesser General Public 12 * License as published by the Free Software Foundation; either 13 * version 2.1 of the License, or (at your option) any later version. 14 * 15 * This library is distributed in the hope that it will be useful, 16 * but WITHOUT ANY WARRANTY; without even the implied warranty of 17 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU 18 * Lesser General Public License for more details. 19 * 20 * You should have received a copy of the GNU Lesser General Public 21 * License along with this library; if not, write to the 22 * Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor, 23 * Boston, MA 02110-1301, USA. 24 */ 25 26 #ifndef _ATSPI_MISC_PRIVATE_H_ 27 #define _ATSPI_MISC_PRIVATE_H_ 28 29 /* Private internal implementation details of at-spi. */ 30 31 #include <string.h> 32 33 #include "atspi.h" 34 35 #include "dbus/dbus.h" 36 37 #include "dbind/dbind.h" 38 39 G_BEGIN_DECLS 40 41 typedef struct _AtspiReference AtspiReference; 42 struct _AtspiReference 43 { 44 char *name; 45 char *path; 46 }; 47 48 /* externs */ 49 extern const char *atspi_path_dec; 50 extern const char *atspi_path_registry; 51 extern const char *atspi_path_root; 52 extern const char *atspi_bus_registry; 53 extern const char *atspi_interface_accessible; 54 extern const char *atspi_interface_action; 55 extern const char *atspi_interface_application; 56 extern const char *atspi_interface_collection; 57 extern const char *atspi_interface_component; 58 extern const char *atspi_interface_dec; 59 extern const char *atspi_interface_device_event_listener; 60 extern const char *atspi_interface_document; 61 extern const char *atspi_interface_editable_text; 62 extern const char *atspi_interface_hyperlink; 63 extern const char *atspi_interface_hypertext; 64 extern const char *atspi_interface_image; 65 extern const char *atspi_interface_registry; 66 extern const char *atspi_interface_selection; 67 extern const char *atspi_interface_table; 68 extern const char *atspi_interface_table_cell; 69 extern const char *atspi_interface_text; 70 extern const char *atspi_interface_cache; 71 extern const char *atspi_interface_value; 72 73 /* function prototypes */ 74 gint _atspi_get_iface_num (const char *iface); 75 76 DBusConnection * _atspi_bus (); 77 78 AtspiAccessible * _atspi_ref_accessible (const char *app, const char *path); 79 80 AtspiAccessible * 81 _atspi_dbus_return_accessible_from_message (DBusMessage *message); 82 83 AtspiAccessible * 84 _atspi_dbus_return_accessible_from_iter (DBusMessageIter *iter); 85 86 AtspiHyperlink * 87 _atspi_dbus_return_hyperlink_from_message (DBusMessage *message); 88 89 AtspiHyperlink * 90 _atspi_dbus_return_hyperlink_from_iter (DBusMessageIter *iter); 91 92 dbus_bool_t _atspi_dbus_call (gpointer obj, const char *interface, const char *method, GError **error, const char *type, ...); 93 94 DBusMessage *_atspi_dbus_call_partial (gpointer obj, const char *interface, const char *method, GError **error, const char *type, ...); 95 96 DBusMessage *_atspi_dbus_call_partial_va (gpointer obj, const char *interface, const char *method, GError **error, const char *type, va_list args); 97 98 dbus_bool_t _atspi_dbus_get_property (gpointer obj, const char *interface, const char *name, GError **error, const char *type, void *data); 99 100 DBusMessage * _atspi_dbus_send_with_reply_and_block (DBusMessage *message, GError **error); 101 102 GHashTable *_atspi_dbus_return_hash_from_message (DBusMessage *message); 103 104 GHashTable *_atspi_dbus_hash_from_iter (DBusMessageIter *iter); 105 106 GArray *_atspi_dbus_return_attribute_array_from_message (DBusMessage *message); 107 108 GArray *_atspi_dbus_attribute_array_from_iter (DBusMessageIter *iter); 109 110 void _atspi_dbus_set_interfaces (AtspiAccessible *accessible, DBusMessageIter *iter); 111 112 void _atspi_dbus_set_state (AtspiAccessible *accessible, DBusMessageIter *iter); 113 114 #define _ATSPI_DBUS_CHECK_SIG(message, type, error, ret) \ 115 if (!message) \ 116 return (ret); \ 117 if (dbus_message_get_type (message) == DBUS_MESSAGE_TYPE_ERROR) \ 118 { \ 119 const char *err; \ 120 dbus_message_get_args (message, NULL, DBUS_TYPE_STRING, &err, DBUS_TYPE_INVALID); \ 121 if (err) \ 122 g_set_error_literal (error, ATSPI_ERROR, ATSPI_ERROR_IPC, err); \ 123 dbus_message_unref (message); \ 124 return ret; \ 125 } \ 126 if (strcmp (dbus_message_get_signature (message), type) != 0) \ 127 { \ 128 g_warning ("AT-SPI: Expected message signature %s but got %s at %s line %d", type, dbus_message_get_signature (message), __FILE__, __LINE__); \ 129 dbus_message_unref (message); \ 130 return (ret); \ 131 } 132 133 134 /** 135 * ATSPI_ERROR: 136 * 137 * Error domain for AT-SPI IPC failures. Errors in this domain will 138 * be from the #ATSPIAtspiError enumeration. See #GError for information on 139 * error domains. 140 */ 141 #define ATSPI_ERROR _atspi_error_quark() 142 GQuark _atspi_error_quark (void); 143 144 /** 145 * AtspiError: 146 * @ATSPI_APPLICATION_NO_LONGER_EXISTS: The application has quit. 147 */ 148 typedef enum 149 { 150 ATSPI_ERROR_APPLICATION_GONE, 151 ATSPI_ERROR_IPC, 152 ATSPI_ERROR_SYNC_NOT_ALLOWED, 153 } AtspiError; 154 155 extern GMainLoop *atspi_main_loop; 156 extern gboolean atspi_no_cache; 157 158 GHashTable *_atspi_get_live_refs (); 159 160 gchar *_atspi_name_compat (gchar *in); 161 162 GHashTable *_atspi_dbus_update_cache_from_dict (AtspiAccessible *accessible, DBusMessageIter *iter); 163 164 gboolean _atspi_get_allow_sync (); 165 166 gboolean _atspi_set_allow_sync (gboolean val); 167 168 void _atspi_set_error_no_sync (GError **error); 169 170 gboolean _atspi_prepare_screen_reader_interface (); 171 G_END_DECLS 172 173 #endif /* _ATSPI_MISC_PRIVATE_H_ */ 174