|
Packit |
8b6d7a |
/*
|
|
Packit |
8b6d7a |
* AT-SPI - Assistive Technology Service Provider Interface
|
|
Packit |
8b6d7a |
* (Gnome Accessibility Project; http://developer.gnome.org/projects/gap)
|
|
Packit |
8b6d7a |
*
|
|
Packit |
8b6d7a |
* Copyright 2001, 2002 Sun Microsystems Inc.,
|
|
Packit |
8b6d7a |
* Copyright 2001, 2002 Ximian, Inc.
|
|
Packit |
8b6d7a |
*
|
|
Packit |
8b6d7a |
* This library is free software; you can redistribute it and/or
|
|
Packit |
8b6d7a |
* modify it under the terms of the GNU Library General Public
|
|
Packit |
8b6d7a |
* License as published by the Free Software Foundation; either
|
|
Packit |
8b6d7a |
* version 2 of the License, or (at your option) any later version.
|
|
Packit |
8b6d7a |
*
|
|
Packit |
8b6d7a |
* This library is distributed in the hope that it will be useful,
|
|
Packit |
8b6d7a |
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
|
Packit |
8b6d7a |
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
|
|
Packit |
8b6d7a |
* Library General Public License for more details.
|
|
Packit |
8b6d7a |
*
|
|
Packit |
8b6d7a |
* You should have received a copy of the GNU Library General Public
|
|
Packit |
8b6d7a |
* License along with this library; if not, write to the
|
|
Packit |
8b6d7a |
* Free Software Foundation, Inc., 59 Temple Place - Suite 330,
|
|
Packit |
8b6d7a |
* Boston, MA 02111-1307, USA.
|
|
Packit |
8b6d7a |
*/
|
|
Packit |
8b6d7a |
|
|
Packit |
8b6d7a |
#include "atspi-private.h"
|
|
Packit |
8b6d7a |
|
|
Packit |
8b6d7a |
/**
|
|
Packit |
8b6d7a |
* atspi_action_get_n_actions:
|
|
Packit |
8b6d7a |
* @obj: a pointer to the #AtspiAction to query.
|
|
Packit |
8b6d7a |
*
|
|
Packit |
8b6d7a |
* Get the number of actions invokable on an #AtspiAction implementor.
|
|
Packit |
8b6d7a |
*
|
|
Packit |
8b6d7a |
* Returns: an integer indicating the number of invocable actions.
|
|
Packit |
8b6d7a |
**/
|
|
Packit |
8b6d7a |
gint
|
|
Packit |
8b6d7a |
atspi_action_get_n_actions (AtspiAction *obj, GError **error)
|
|
Packit |
8b6d7a |
{
|
|
Packit |
8b6d7a |
dbus_int32_t retval = 0;
|
|
Packit |
8b6d7a |
|
|
Packit |
8b6d7a |
g_return_val_if_fail (obj != NULL, -1);
|
|
Packit |
8b6d7a |
|
|
Packit |
8b6d7a |
_atspi_dbus_get_property (obj, atspi_interface_action, "NActions", error, "i", &retval);
|
|
Packit |
8b6d7a |
|
|
Packit |
8b6d7a |
return retval;
|
|
Packit |
8b6d7a |
}
|
|
Packit |
8b6d7a |
|
|
Packit |
8b6d7a |
/**
|
|
Packit |
8b6d7a |
* atspi_action_get_description: (rename-to atspi_action_get_action_description)
|
|
Packit |
8b6d7a |
* @obj: a pointer to the #AtspiAction implementor to query.
|
|
Packit |
8b6d7a |
* @i: an integer indicating which action to query.
|
|
Packit |
8b6d7a |
*
|
|
Packit |
8b6d7a |
* Get the description of '@i-th' action invocable on an
|
|
Packit |
8b6d7a |
* object implementing #AtspiAction.
|
|
Packit |
8b6d7a |
*
|
|
Packit |
8b6d7a |
* Returns: a UTF-8 string describing the '@i-th' invocable action.
|
|
Packit |
8b6d7a |
*
|
|
Packit |
8b6d7a |
* Deprecated: 2.10: Use atspi_action_get_action_description instead.
|
|
Packit |
8b6d7a |
**/
|
|
Packit |
8b6d7a |
gchar *
|
|
Packit |
8b6d7a |
atspi_action_get_description (AtspiAction *obj, int i, GError **error)
|
|
Packit |
8b6d7a |
{
|
|
Packit |
8b6d7a |
return atspi_action_get_action_description (obj, i, error);
|
|
Packit |
8b6d7a |
}
|
|
Packit |
8b6d7a |
|
|
Packit |
8b6d7a |
/**
|
|
Packit |
8b6d7a |
* atspi_action_get_action_description:
|
|
Packit |
8b6d7a |
* @obj: a pointer to the #AtspiAction implementor to query.
|
|
Packit |
8b6d7a |
* @i: an integer indicating which action to query.
|
|
Packit |
8b6d7a |
*
|
|
Packit |
8b6d7a |
* Get the description of '@i-th' action invocable on an
|
|
Packit |
8b6d7a |
* object implementing #AtspiAction.
|
|
Packit |
8b6d7a |
*
|
|
Packit |
8b6d7a |
* Returns: a UTF-8 string describing the '@i-th' invocable action.
|
|
Packit |
8b6d7a |
**/
|
|
Packit |
8b6d7a |
gchar *
|
|
Packit |
8b6d7a |
atspi_action_get_action_description (AtspiAction *obj, int i, GError **error)
|
|
Packit |
8b6d7a |
{
|
|
Packit |
8b6d7a |
dbus_int32_t d_i = i;
|
|
Packit |
8b6d7a |
char *retval = NULL;
|
|
Packit |
8b6d7a |
|
|
Packit |
8b6d7a |
g_return_val_if_fail (obj != NULL, NULL);
|
|
Packit |
8b6d7a |
|
|
Packit |
8b6d7a |
_atspi_dbus_call (obj, atspi_interface_action, "GetDescription", error, "i=>s", d_i, &retval);
|
|
Packit |
8b6d7a |
|
|
Packit |
8b6d7a |
return retval;
|
|
Packit |
8b6d7a |
}
|
|
Packit |
8b6d7a |
|
|
Packit |
8b6d7a |
/**
|
|
Packit |
8b6d7a |
* atspi_action_get_key_binding:
|
|
Packit |
8b6d7a |
* @obj: a pointer to the #AtspiAction implementor to query.
|
|
Packit |
8b6d7a |
* @i: an integer indicating which action to query.
|
|
Packit |
8b6d7a |
*
|
|
Packit |
8b6d7a |
* Get the keybindings for the @i-th action invocable on an
|
|
Packit |
8b6d7a |
* object implementing #AtspiAction, if any are defined.
|
|
Packit |
8b6d7a |
* The keybindings string format is as follows:
|
|
Packit |
8b6d7a |
* there are multiple parts to a keybinding string (typically 3).
|
|
Packit |
8b6d7a |
* They are delimited with ";". The first is the action's
|
|
Packit |
8b6d7a |
* keybinding which is usable if the object implementing the action
|
|
Packit |
8b6d7a |
* is currently posted to the screen, e.g. if a menu is posted
|
|
Packit |
8b6d7a |
* then these keybindings for the corresponding menu-items are
|
|
Packit |
8b6d7a |
* available. The second keybinding substring is the full key sequence
|
|
Packit |
8b6d7a |
* necessary to post the action's widget and activate it, e.g. for
|
|
Packit |
8b6d7a |
* a menu item such as "File->Open" it would both post the menu and
|
|
Packit |
8b6d7a |
* activate the item. Thus the second keybinding string is available
|
|
Packit |
8b6d7a |
* during the lifetime of the containing toplevel window as a whole,
|
|
Packit |
8b6d7a |
* whereas the first keybinding string only works while the object
|
|
Packit |
8b6d7a |
* implementing AtkAction is posted. The third (and optional)
|
|
Packit |
8b6d7a |
* keybinding string is the "keyboard shortcut" which invokes the
|
|
Packit |
8b6d7a |
* action without posting any menus.
|
|
Packit |
8b6d7a |
* Meta-keys are indicated by the conventional strings
|
|
Packit |
8b6d7a |
* "<Control>", "<Alt>", "<Shift>", "<Mod2>",
|
|
Packit |
8b6d7a |
* etc. (we use the same string as gtk_accelerator_name() in
|
|
Packit |
8b6d7a |
* gtk+-2.X.
|
|
Packit |
8b6d7a |
*
|
|
Packit |
8b6d7a |
* Returns: a UTF-8 string which can be parsed to determine the @i-th
|
|
Packit |
8b6d7a |
* invocable action's keybindings.
|
|
Packit |
8b6d7a |
**/
|
|
Packit |
8b6d7a |
gchar *
|
|
Packit |
8b6d7a |
atspi_action_get_key_binding (AtspiAction *obj, gint i, GError **error)
|
|
Packit |
8b6d7a |
{
|
|
Packit |
8b6d7a |
dbus_int32_t d_i = i;
|
|
Packit |
8b6d7a |
char *retval = NULL;
|
|
Packit |
8b6d7a |
|
|
Packit |
8b6d7a |
g_return_val_if_fail (obj != NULL, NULL);
|
|
Packit |
8b6d7a |
|
|
Packit |
8b6d7a |
_atspi_dbus_call (obj, atspi_interface_action, "GetKeyBinding", error, "i=>s", d_i, &retval);
|
|
Packit |
8b6d7a |
|
|
Packit |
8b6d7a |
return retval;
|
|
Packit |
8b6d7a |
}
|
|
Packit |
8b6d7a |
|
|
Packit |
8b6d7a |
/**
|
|
Packit |
8b6d7a |
* atspi_action_get_name: (rename-to atspi_action_get_action_name)
|
|
Packit |
8b6d7a |
* @obj: a pointer to the #AtspiAction implementor to query.
|
|
Packit |
8b6d7a |
* @i: an integer indicating which action to query.
|
|
Packit |
8b6d7a |
*
|
|
Packit |
8b6d7a |
* Get the name of the '@i-th' action invocable on an
|
|
Packit |
8b6d7a |
* object implementing #AtspiAction.
|
|
Packit |
8b6d7a |
*
|
|
Packit |
8b6d7a |
* Returns: the non-localized name of the action, as a UTF-8 string.
|
|
Packit |
8b6d7a |
*
|
|
Packit |
8b6d7a |
* Deprecated: 2.10: Use atspi_action_get_action_name instead.
|
|
Packit |
8b6d7a |
**/
|
|
Packit |
8b6d7a |
gchar *
|
|
Packit |
8b6d7a |
atspi_action_get_name (AtspiAction *obj, gint i, GError **error)
|
|
Packit |
8b6d7a |
{
|
|
Packit |
8b6d7a |
return atspi_action_get_action_name (obj, i, error);
|
|
Packit |
8b6d7a |
}
|
|
Packit |
8b6d7a |
|
|
Packit |
8b6d7a |
/**
|
|
Packit |
8b6d7a |
* atspi_action_get_action_name:
|
|
Packit |
8b6d7a |
* @obj: a pointer to the #AtspiAction implementor to query.
|
|
Packit |
8b6d7a |
* @i: an integer indicating which action to query.
|
|
Packit |
8b6d7a |
*
|
|
Packit |
8b6d7a |
* Get the name of the '@i-th' action invocable on an
|
|
Packit |
8b6d7a |
* object implementing #AtspiAction.
|
|
Packit |
8b6d7a |
*
|
|
Packit |
8b6d7a |
* Returns: the non-localized name of the action, as a UTF-8 string.
|
|
Packit |
8b6d7a |
**/
|
|
Packit |
8b6d7a |
gchar *
|
|
Packit |
8b6d7a |
atspi_action_get_action_name (AtspiAction *obj, gint i, GError **error)
|
|
Packit |
8b6d7a |
{
|
|
Packit |
8b6d7a |
dbus_int32_t d_i = i;
|
|
Packit |
8b6d7a |
char *retval = NULL;
|
|
Packit |
8b6d7a |
|
|
Packit |
8b6d7a |
g_return_val_if_fail (obj != NULL, NULL);
|
|
Packit |
8b6d7a |
|
|
Packit |
8b6d7a |
_atspi_dbus_call (obj, atspi_interface_action, "GetName", error, "i=>s", d_i, &retval);
|
|
Packit |
8b6d7a |
|
|
Packit |
8b6d7a |
return retval;
|
|
Packit |
8b6d7a |
}
|
|
Packit |
8b6d7a |
|
|
Packit |
8b6d7a |
/**
|
|
Packit |
8b6d7a |
* atspi_action_get_localized_name:
|
|
Packit |
8b6d7a |
* @obj: a pointer to the #AtspiAction implementor to query.
|
|
Packit |
8b6d7a |
* @i: an integer indicating which action to query.
|
|
Packit |
8b6d7a |
*
|
|
Packit |
8b6d7a |
* Get the name of the '@i-th' action invocable on an
|
|
Packit |
8b6d7a |
* object implementing #AtspiAction.
|
|
Packit |
8b6d7a |
*
|
|
Packit |
8b6d7a |
* Returns: the name of the action, as a UTF-8 string.
|
|
Packit |
8b6d7a |
**/
|
|
Packit |
8b6d7a |
gchar *
|
|
Packit |
8b6d7a |
atspi_action_get_localized_name (AtspiAction *obj, gint i, GError **error)
|
|
Packit |
8b6d7a |
{
|
|
Packit |
8b6d7a |
dbus_int32_t d_i = i;
|
|
Packit |
8b6d7a |
char *retval = NULL;
|
|
Packit |
8b6d7a |
|
|
Packit |
8b6d7a |
g_return_val_if_fail (obj != NULL, NULL);
|
|
Packit |
8b6d7a |
|
|
Packit |
8b6d7a |
_atspi_dbus_call (obj, atspi_interface_action, "GetLocalizedName", error,
|
|
Packit |
8b6d7a |
"i=>s", d_i, &retval);
|
|
Packit |
8b6d7a |
|
|
Packit |
8b6d7a |
return retval;
|
|
Packit |
8b6d7a |
}
|
|
Packit |
8b6d7a |
|
|
Packit |
8b6d7a |
/**
|
|
Packit |
8b6d7a |
* atspi_action_do_action:
|
|
Packit |
8b6d7a |
* @obj: a pointer to the #AtspiAction to query.
|
|
Packit |
8b6d7a |
* @i: an integer specifying which action to invoke.
|
|
Packit |
8b6d7a |
*
|
|
Packit |
8b6d7a |
* Invoke the action indicated by #index.
|
|
Packit |
8b6d7a |
*
|
|
Packit |
8b6d7a |
* Returns: #TRUE if the action is successfully invoked, otherwise #FALSE.
|
|
Packit |
8b6d7a |
**/
|
|
Packit |
8b6d7a |
gboolean
|
|
Packit |
8b6d7a |
atspi_action_do_action (AtspiAction *obj, gint i, GError **error)
|
|
Packit |
8b6d7a |
{
|
|
Packit |
8b6d7a |
dbus_int32_t d_i = i;
|
|
Packit |
8b6d7a |
dbus_bool_t retval = FALSE;
|
|
Packit |
8b6d7a |
|
|
Packit |
8b6d7a |
g_return_val_if_fail (obj != NULL, FALSE);
|
|
Packit |
8b6d7a |
|
|
Packit |
8b6d7a |
_atspi_dbus_call (obj, atspi_interface_action, "DoAction", error, "i=>b", d_i, &retval);
|
|
Packit |
8b6d7a |
|
|
Packit |
8b6d7a |
return retval;
|
|
Packit |
8b6d7a |
}
|
|
Packit |
8b6d7a |
|
|
Packit |
8b6d7a |
static void
|
|
Packit |
8b6d7a |
atspi_action_base_init (AtspiAction *klass)
|
|
Packit |
8b6d7a |
{
|
|
Packit |
8b6d7a |
}
|
|
Packit |
8b6d7a |
|
|
Packit |
8b6d7a |
GType
|
|
Packit |
8b6d7a |
atspi_action_get_type (void)
|
|
Packit |
8b6d7a |
{
|
|
Packit |
8b6d7a |
static GType type = 0;
|
|
Packit |
8b6d7a |
|
|
Packit |
8b6d7a |
if (!type) {
|
|
Packit |
8b6d7a |
static const GTypeInfo tinfo =
|
|
Packit |
8b6d7a |
{
|
|
Packit |
8b6d7a |
sizeof (AtspiAction),
|
|
Packit |
8b6d7a |
(GBaseInitFunc) atspi_action_base_init,
|
|
Packit |
8b6d7a |
(GBaseFinalizeFunc) NULL,
|
|
Packit |
8b6d7a |
};
|
|
Packit |
8b6d7a |
|
|
Packit |
8b6d7a |
type = g_type_register_static (G_TYPE_INTERFACE, "AtspiAction", &tinfo, 0);
|
|
Packit |
8b6d7a |
|
|
Packit |
8b6d7a |
}
|
|
Packit |
8b6d7a |
return type;
|
|
Packit |
8b6d7a |
}
|