Esempio n. 1
0
/**
 * atk_plug_get_plug_id:
 * @obj: an #AtkPlug
 *
 * Gets the unique ID of an #AtkPlug object, which can be used to embed inside
 * of an #AtkSocket using atk_socket_embed().
 * Internally, this calls a class function that should be registered by the
 * IPC layer (eg, at-spi2-atk).  The implementor of an AtkSocket object
 * should call this function (after atk-bridge is loaded) and pass the value
 * to the process implementing the AtkPlug into which the AtkSocket is
 * embedded.
 *
 * Returns: the unique ID for the plug
 *
 * Since: 1.30
 **/
gchar*
atk_plug_get_id (AtkPlug* obj)
{
  AtkPlugClass *klass;

  g_return_val_if_fail (ATK_IS_PLUG (obj), NULL);

  klass = g_type_class_peek (ATK_TYPE_PLUG);

  if (klass && klass->get_object_id)
    return (klass->get_object_id) (obj);
  else
    return NULL;
}
Esempio n. 2
0
static dbus_bool_t
impl_get_Parent (DBusMessageIter * iter, void *user_data)
{
  AtkObject *obj = (AtkObject *) user_data;
  AtkObject *parent;
  DBusMessageIter iter_variant;
  dbus_uint32_t role;

  g_return_val_if_fail (ATK_IS_OBJECT (user_data), FALSE);

  role = spi_accessible_role_from_atk_role (atk_object_get_role (obj));

  dbus_message_iter_open_container (iter, DBUS_TYPE_VARIANT, "(so)",
                                    &iter_variant);

  parent = atk_object_get_parent (obj);
  if (parent == NULL)
    {
      /* TODO, move in to a 'Plug' wrapper. */
      if (ATK_IS_PLUG (obj))
        {
          char *id = g_object_get_data (G_OBJECT (obj), "dbus-plug-parent");
          char *bus_parent;
          char *path_parent;

          if (id)
            {
              bus_parent = g_strdup (id);
              if (bus_parent && (path_parent = g_utf8_strchr (bus_parent + 1, -1, ':')))
                {
                  DBusMessageIter iter_parent;
                  *(path_parent++) = '\0';
                  dbus_message_iter_open_container (&iter_variant, DBUS_TYPE_STRUCT, NULL,
                                                    &iter_parent);
                  dbus_message_iter_append_basic (&iter_parent, DBUS_TYPE_STRING, &bus_parent);
                  dbus_message_iter_append_basic (&iter_parent, DBUS_TYPE_OBJECT_PATH, &path_parent);
                  dbus_message_iter_close_container (&iter_variant, &iter_parent);
                }
              else
                {
                  spi_object_append_null_reference (&iter_variant);
                }
            }
          else
            {
              spi_object_append_null_reference (&iter_variant);
            }
        }
      else if (role != ATSPI_ROLE_APPLICATION)
         spi_object_append_null_reference (&iter_variant);
      else
         spi_object_append_desktop_reference (&iter_variant);
      }
  else
    {
      spi_object_append_reference (&iter_variant, parent);
    }


  dbus_message_iter_close_container (iter, &iter_variant);
  return TRUE;
}