1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 131 132 133 134 135 136 137 138 139 140 141 142 143 144 145 146 147 148 149 150 151 152 153 154 155 156 157 158 159 160 161 162 163 164 165 166 167 168 169 170 171 172 173 174 175 176 177 178 179 180 181 182 183 184 185 186 187 188 189 190 191 192 193 194 195 196 197 198 199 200 201 202 203 204 205 206 207
|
/*
* AT-SPI - Assistive Technology Service Provider Interface
* (Gnome Accessibility Project; http://developer.gnome.org/projects/gap)
*
* Copyright 2008 Novell, Inc.
* Copyright 2001, 2002 Sun Microsystems Inc.,
* Copyright 2001, 2002 Ximian, Inc.
*
* This library is free software; you can redistribute it and/or
* modify it under the terms of the GNU Library General Public
* License as published by the Free Software Foundation; either
* version 2 of the License, or (at your option) any later version.
*
* This library is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
* Library General Public License for more details.
*
* You should have received a copy of the GNU Library General Public
* License along with this library; if not, write to the
* Free Software Foundation, Inc., 59 Temple Place - Suite 330,
* Boston, MA 02111-1307, USA.
*/
#include <atk/atk.h>
#include <droute/droute.h>
#include "bridge.h"
#include "introspection.h"
#include "spi-dbus.h"
static DBusMessage *
impl_SetTextContents (DBusConnection * bus, DBusMessage * message,
void *user_data)
{
AtkEditableText *editable = (AtkEditableText *) user_data;
const char *newContents;
dbus_bool_t rv;
DBusMessage *reply;
g_return_val_if_fail (ATK_IS_EDITABLE_TEXT (user_data),
droute_not_yet_handled_error (message));
if (!dbus_message_get_args
(message, NULL, DBUS_TYPE_STRING, &newContents, DBUS_TYPE_INVALID))
{
return droute_invalid_arguments_error (message);
}
atk_editable_text_set_text_contents (editable, newContents);
rv = TRUE;
// TODO decide if we really need this return value
reply = dbus_message_new_method_return (message);
if (reply)
{
dbus_message_append_args (reply, DBUS_TYPE_BOOLEAN, &rv,
DBUS_TYPE_INVALID);
}
return reply;
}
static DBusMessage *
impl_InsertText (DBusConnection * bus, DBusMessage * message, void *user_data)
{
AtkEditableText *editable = (AtkEditableText *) user_data;
dbus_int32_t position, length;
char *text;
dbus_bool_t rv;
DBusMessage *reply;
gint ip;
g_return_val_if_fail (ATK_IS_EDITABLE_TEXT (user_data),
droute_not_yet_handled_error (message));
if (!dbus_message_get_args
(message, NULL, DBUS_TYPE_INT32, &position, DBUS_TYPE_STRING, &text,
DBUS_TYPE_INT32, &length, DBUS_TYPE_INVALID))
{
return droute_invalid_arguments_error (message);
}
ip = position;
atk_editable_text_insert_text (editable, text, length, &ip);
rv = TRUE;
// TODO decide if we really need this return value
reply = dbus_message_new_method_return (message);
if (reply)
{
dbus_message_append_args (reply, DBUS_TYPE_BOOLEAN, &rv,
DBUS_TYPE_INVALID);
}
return reply;
}
static DBusMessage *
impl_CopyText (DBusConnection * bus, DBusMessage * message, void *user_data)
{
AtkEditableText *editable = (AtkEditableText *) user_data;
dbus_int32_t startPos, endPos;
g_return_val_if_fail (ATK_IS_EDITABLE_TEXT (user_data),
droute_not_yet_handled_error (message));
if (!dbus_message_get_args
(message, NULL, DBUS_TYPE_INT32, &startPos, DBUS_TYPE_INT32, &endPos,
DBUS_TYPE_INVALID))
{
return droute_invalid_arguments_error (message);
}
atk_editable_text_copy_text (editable, startPos, endPos);
return dbus_message_new_method_return (message);
}
static DBusMessage *
impl_CutText (DBusConnection * bus, DBusMessage * message, void *user_data)
{
AtkEditableText *editable = (AtkEditableText *) user_data;
dbus_int32_t startPos, endPos;
dbus_bool_t rv;
DBusMessage *reply;
g_return_val_if_fail (ATK_IS_EDITABLE_TEXT (user_data),
droute_not_yet_handled_error (message));
if (!dbus_message_get_args
(message, NULL, DBUS_TYPE_INT32, &startPos, DBUS_TYPE_INT32, &endPos,
DBUS_TYPE_INVALID))
{
return droute_invalid_arguments_error (message);
}
atk_editable_text_cut_text (editable, startPos, endPos);
rv = TRUE;
// TODO decide if we really need this return value
reply = dbus_message_new_method_return (message);
if (reply)
{
dbus_message_append_args (reply, DBUS_TYPE_BOOLEAN, &rv,
DBUS_TYPE_INVALID);
}
return reply;
}
static DBusMessage *
impl_DeleteText (DBusConnection * bus, DBusMessage * message, void *user_data)
{
AtkEditableText *editable = (AtkEditableText *) user_data;
dbus_int32_t startPos, endPos;
dbus_bool_t rv;
DBusMessage *reply;
g_return_val_if_fail (ATK_IS_EDITABLE_TEXT (user_data),
droute_not_yet_handled_error (message));
if (!dbus_message_get_args
(message, NULL, DBUS_TYPE_INT32, &startPos, DBUS_TYPE_INT32, &endPos,
DBUS_TYPE_INVALID))
{
return droute_invalid_arguments_error (message);
}
atk_editable_text_delete_text (editable, startPos, endPos);
rv = TRUE;
// TODO decide if we really need this return value
reply = dbus_message_new_method_return (message);
if (reply)
{
dbus_message_append_args (reply, DBUS_TYPE_BOOLEAN, &rv,
DBUS_TYPE_INVALID);
}
return reply;
}
static DBusMessage *
impl_PasteText (DBusConnection * bus, DBusMessage * message, void *user_data)
{
AtkEditableText *editable = (AtkEditableText *) user_data;
dbus_int32_t position;
dbus_bool_t rv;
DBusMessage *reply;
g_return_val_if_fail (ATK_IS_EDITABLE_TEXT (user_data),
droute_not_yet_handled_error (message));
if (!dbus_message_get_args
(message, NULL, DBUS_TYPE_INT32, &position, DBUS_TYPE_INVALID))
{
return droute_invalid_arguments_error (message);
}
atk_editable_text_paste_text (editable, position);
rv = TRUE;
// TODO decide if we really need this return value
reply = dbus_message_new_method_return (message);
if (reply)
{
dbus_message_append_args (reply, DBUS_TYPE_BOOLEAN, &rv,
DBUS_TYPE_INVALID);
}
return reply;
}
static DRouteMethod methods[] = {
{impl_SetTextContents, "SetTextContents"},
{impl_InsertText, "InsertText"},
{impl_CopyText, "CopyText"},
{impl_CutText, "CutText"},
{impl_DeleteText, "DeleteText"},
{impl_PasteText, "PasteText"},
{NULL, NULL}
};
void
spi_initialize_editabletext (DRoutePath * path)
{
spi_atk_add_interface (path,
ATSPI_DBUS_INTERFACE_EDITABLE_TEXT, spi_org_a11y_atspi_EditableText, methods, NULL);
};
|