|
Packit |
f2f3b5 |
/*
|
|
Packit |
f2f3b5 |
* AT-SPI - Assistive Technology Service Provider Interface
|
|
Packit |
f2f3b5 |
* (Gnome Accessibility Project; https://wiki.gnome.org/Accessibility)
|
|
Packit |
f2f3b5 |
*
|
|
Packit |
f2f3b5 |
* Copyright (c) 2015 Samsung Electronics Co., Ltd.
|
|
Packit |
f2f3b5 |
*
|
|
Packit |
f2f3b5 |
* This library is free software; you can redistribute it and/or
|
|
Packit |
f2f3b5 |
* modify it under the terms of the GNU Library General Public
|
|
Packit |
f2f3b5 |
* License as published by the Free Software Foundation; either
|
|
Packit |
f2f3b5 |
* version 2 of the License, or (at your option) any later version.
|
|
Packit |
f2f3b5 |
*
|
|
Packit |
f2f3b5 |
* This library is distributed in the hope that it will be useful,
|
|
Packit |
f2f3b5 |
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
|
Packit |
f2f3b5 |
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
|
|
Packit |
f2f3b5 |
* Library General Public License for more details.
|
|
Packit |
f2f3b5 |
*
|
|
Packit |
f2f3b5 |
* You should have received a copy of the GNU Library General Public
|
|
Packit |
f2f3b5 |
* License along with this library; if not, write to the
|
|
Packit |
f2f3b5 |
* Free Software Foundation, Inc., 59 Temple Place - Suite 330,
|
|
Packit |
f2f3b5 |
* Boston, MA 02111-1307, USA.
|
|
Packit |
f2f3b5 |
*/
|
|
Packit |
f2f3b5 |
|
|
Packit |
f2f3b5 |
#include <glib-object.h>
|
|
Packit |
f2f3b5 |
#include <atk/atk.h>
|
|
Packit |
f2f3b5 |
|
|
Packit |
f2f3b5 |
#include "my-atk-object.h"
|
|
Packit |
f2f3b5 |
#include "my-atk-document.h"
|
|
Packit |
f2f3b5 |
|
|
Packit |
f2f3b5 |
static void atk_document_interface_init (AtkDocumentIface *iface);
|
|
Packit |
f2f3b5 |
|
|
Packit |
f2f3b5 |
G_DEFINE_TYPE_WITH_CODE (MyAtkDocument,
|
|
Packit |
f2f3b5 |
my_atk_document,
|
|
Packit |
f2f3b5 |
MY_TYPE_ATK_OBJECT,
|
|
Packit |
f2f3b5 |
G_IMPLEMENT_INTERFACE (ATK_TYPE_DOCUMENT,
|
|
Packit |
f2f3b5 |
atk_document_interface_init));
|
|
Packit |
f2f3b5 |
|
|
Packit |
f2f3b5 |
void
|
|
Packit |
f2f3b5 |
my_atk_set_document (AtkDocument *obj, gint page, gint page_num)
|
|
Packit |
f2f3b5 |
{
|
|
Packit |
f2f3b5 |
g_return_if_fail (MY_IS_ATK_DOCUMENT(obj));
|
|
Packit |
f2f3b5 |
MyAtkDocument *self = MY_ATK_DOCUMENT (obj);
|
|
Packit |
f2f3b5 |
|
|
Packit |
f2f3b5 |
self->pages = page;
|
|
Packit |
f2f3b5 |
self->current_page = page_num;
|
|
Packit |
f2f3b5 |
|
|
Packit |
f2f3b5 |
AtkAttribute *attr1, *attr2;
|
|
Packit |
f2f3b5 |
attr1 = g_malloc (sizeof (AtkAttribute));
|
|
Packit |
f2f3b5 |
attr1->name = g_strdup ("atspi1");
|
|
Packit |
f2f3b5 |
attr1->value = g_strdup ("test1");
|
|
Packit |
f2f3b5 |
|
|
Packit |
f2f3b5 |
attr2 = g_malloc (sizeof (AtkAttribute));
|
|
Packit |
f2f3b5 |
attr2->name = g_strdup ("atspi2");
|
|
Packit |
f2f3b5 |
attr2->value = g_strdup ("test2");
|
|
Packit |
f2f3b5 |
|
|
Packit |
f2f3b5 |
self->attributes = g_slist_append (NULL, attr1);
|
|
Packit |
f2f3b5 |
self->attributes = g_slist_append (self->attributes, attr2);
|
|
Packit |
f2f3b5 |
}
|
|
Packit |
f2f3b5 |
|
|
Packit |
f2f3b5 |
static void
|
|
Packit |
f2f3b5 |
my_atk_document_init (MyAtkDocument *obj)
|
|
Packit |
f2f3b5 |
{
|
|
Packit |
f2f3b5 |
obj->disposed = FALSE;
|
|
Packit |
f2f3b5 |
obj->locale = NULL;
|
|
Packit |
f2f3b5 |
obj->document_type = NULL;
|
|
Packit |
f2f3b5 |
obj->pages = 0;
|
|
Packit |
f2f3b5 |
obj->current_page = 0;
|
|
Packit |
f2f3b5 |
}
|
|
Packit |
f2f3b5 |
|
|
Packit |
f2f3b5 |
AtkAttributeSet *
|
|
Packit |
f2f3b5 |
my_atk_document_get_document_attributes (AtkDocument *document)
|
|
Packit |
f2f3b5 |
{
|
|
Packit |
f2f3b5 |
MyAtkDocument *self = MY_ATK_DOCUMENT (document);
|
|
Packit |
f2f3b5 |
|
|
Packit |
f2f3b5 |
return self->attributes;
|
|
Packit |
f2f3b5 |
}
|
|
Packit |
f2f3b5 |
|
|
Packit |
f2f3b5 |
const gchar *
|
|
Packit |
f2f3b5 |
my_atk_document_get_document_attribute_value (AtkDocument *document, const gchar *value)
|
|
Packit |
f2f3b5 |
{
|
|
Packit |
f2f3b5 |
AtkAttributeSet *attr = my_atk_document_get_document_attributes (document);
|
|
Packit |
f2f3b5 |
GSList *cur_attr = (GSList *) attr;
|
|
Packit |
f2f3b5 |
AtkAttribute *at;
|
|
Packit |
f2f3b5 |
|
|
Packit |
f2f3b5 |
while (cur_attr) {
|
|
Packit |
f2f3b5 |
at = (AtkAttribute *) cur_attr->data;
|
|
Packit |
f2f3b5 |
if (!g_strcmp0 (at->name, value)) {
|
|
Packit |
f2f3b5 |
return at->value;
|
|
Packit |
f2f3b5 |
}
|
|
Packit |
f2f3b5 |
cur_attr = cur_attr->next;
|
|
Packit |
f2f3b5 |
}
|
|
Packit |
f2f3b5 |
return NULL;
|
|
Packit |
f2f3b5 |
}
|
|
Packit |
f2f3b5 |
|
|
Packit |
f2f3b5 |
gboolean
|
|
Packit |
f2f3b5 |
my_atk_document_set_document_attribute (AtkDocument *document, const gchar *attribute_name, const gchar *attribute_value)
|
|
Packit |
f2f3b5 |
{
|
|
Packit |
f2f3b5 |
return FALSE;
|
|
Packit |
f2f3b5 |
}
|
|
Packit |
f2f3b5 |
|
|
Packit |
f2f3b5 |
gint
|
|
Packit |
f2f3b5 |
my_atk_document_get_current_page_number (AtkDocument *document)
|
|
Packit |
f2f3b5 |
{
|
|
Packit |
f2f3b5 |
return 0;
|
|
Packit |
f2f3b5 |
}
|
|
Packit |
f2f3b5 |
|
|
Packit |
f2f3b5 |
gint
|
|
Packit |
f2f3b5 |
my_atk_document_get_page_count (AtkDocument *document)
|
|
Packit |
f2f3b5 |
{
|
|
Packit |
f2f3b5 |
return 0;
|
|
Packit |
f2f3b5 |
}
|
|
Packit |
f2f3b5 |
|
|
Packit |
f2f3b5 |
const gchar *
|
|
Packit |
f2f3b5 |
my_atk_document_get_document_locale (AtkDocument *document)
|
|
Packit |
f2f3b5 |
{
|
|
Packit |
f2f3b5 |
|
|
Packit |
f2f3b5 |
return g_strdup("document_locale");
|
|
Packit |
f2f3b5 |
}
|
|
Packit |
f2f3b5 |
|
|
Packit |
f2f3b5 |
static void
|
|
Packit |
f2f3b5 |
atk_document_interface_init(AtkDocumentIface *iface)
|
|
Packit |
f2f3b5 |
{
|
|
Packit |
f2f3b5 |
if(!iface) return;
|
|
Packit |
f2f3b5 |
|
|
Packit |
f2f3b5 |
iface->get_document_locale = my_atk_document_get_document_locale;
|
|
Packit |
f2f3b5 |
iface->get_document_attributes = my_atk_document_get_document_attributes;
|
|
Packit |
f2f3b5 |
iface->get_document_attribute_value = my_atk_document_get_document_attribute_value;
|
|
Packit |
f2f3b5 |
iface->set_document_attribute = my_atk_document_set_document_attribute;
|
|
Packit |
f2f3b5 |
iface->get_current_page_number = my_atk_document_get_current_page_number;
|
|
Packit |
f2f3b5 |
iface->get_page_count = my_atk_document_get_page_count;
|
|
Packit |
f2f3b5 |
}
|
|
Packit |
f2f3b5 |
|
|
Packit |
f2f3b5 |
static void
|
|
Packit |
f2f3b5 |
my_atk_document_initialize(AtkObject *obj, gpointer data)
|
|
Packit |
f2f3b5 |
{
|
|
Packit |
f2f3b5 |
}
|
|
Packit |
f2f3b5 |
|
|
Packit |
f2f3b5 |
static void
|
|
Packit |
f2f3b5 |
my_atk_document_finalize(GObject *object)
|
|
Packit |
f2f3b5 |
{
|
|
Packit |
f2f3b5 |
}
|
|
Packit |
f2f3b5 |
|
|
Packit |
f2f3b5 |
static void
|
|
Packit |
f2f3b5 |
my_atk_document_class_init(MyAtkDocumentClass *my_class)
|
|
Packit |
f2f3b5 |
{
|
|
Packit |
f2f3b5 |
AtkObjectClass *atk_class = ATK_OBJECT_CLASS(my_class);
|
|
Packit |
f2f3b5 |
GObjectClass *gobject_class = G_OBJECT_CLASS(my_class);
|
|
Packit |
f2f3b5 |
|
|
Packit |
f2f3b5 |
gobject_class->finalize = my_atk_document_finalize;
|
|
Packit |
f2f3b5 |
|
|
Packit |
f2f3b5 |
atk_class->initialize = my_atk_document_initialize;
|
|
Packit |
f2f3b5 |
}
|
|
Packit |
f2f3b5 |
|