Updated FSF's address
[platform/upstream/atk.git] / atk / atkplug.c
1 /* ATK -  Accessibility Toolkit
2  * Copyright (C) 2009 Novell, Inc.
3  *
4  * This library is free software; you can redistribute it and/or
5  * modify it under the terms of the GNU Lesser General Public
6  * License as published by the Free Software Foundation; either
7  * version 2 of the License, or (at your option) any later version.
8  *
9  * This library is distributed in the hope that it will be useful,
10  * but WITHOUT ANY WARRANTY; without even the implied warranty of
11  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
12  * Lesser General Public License for more details.
13  *
14  * You should have received a copy of the GNU Lesser General Public
15  * License along with this library; if not, see <http://www.gnu.org/licenses/>.
16  */
17
18 #include "atk.h"
19 #include "atkplug.h"
20
21 /**
22  * SECTION:atkplug
23  * @Short_description: Toplevel for embedding into other processes
24  * @Title: AtkPlug
25  * @See_also: #AtkPlug
26  *
27  * See #AtkSocket
28  *
29  */
30
31 static void atk_component_interface_init (AtkComponentIface *iface);
32
33 static void atk_plug_class_init (AtkPlugClass *klass);
34
35 G_DEFINE_TYPE_WITH_CODE (AtkPlug, atk_plug, ATK_TYPE_OBJECT,
36                          G_IMPLEMENT_INTERFACE (ATK_TYPE_COMPONENT, atk_component_interface_init))
37
38 static void
39 atk_plug_init (AtkPlug* obj)
40 {
41 }
42
43 static void
44 atk_plug_class_init (AtkPlugClass* klass)
45 {
46   klass->get_object_id = NULL;
47 }
48
49 static void
50 atk_component_interface_init (AtkComponentIface *iface)
51 {
52 }
53
54 AtkObject*
55 atk_plug_new (void)
56 {
57   AtkObject* accessible;
58   
59   accessible = g_object_new (ATK_TYPE_PLUG, NULL);
60   g_return_val_if_fail (accessible != NULL, NULL);
61
62   accessible->role = ATK_ROLE_FILLER;
63   accessible->layer = ATK_LAYER_WIDGET;
64   
65   return accessible;
66 }
67
68 /**
69  * atk_plug_get_id:
70  * @plug: an #AtkPlug
71  *
72  * Gets the unique ID of an #AtkPlug object, which can be used to
73  * embed inside of an #AtkSocket using atk_socket_embed().
74  *
75  * Internally, this calls a class function that should be registered
76  * by the IPC layer (usually at-spi2-atk). The implementor of an
77  * #AtkPlug object should call this function (after atk-bridge is
78  * loaded) and pass the value to the process implementing the
79  * #AtkSocket, so it could embed the plug.
80  *
81  * Returns: the unique ID for the plug
82  *
83  * Since: 1.30
84  **/
85 gchar*
86 atk_plug_get_id (AtkPlug* plug)
87 {
88   AtkPlugClass *klass;
89
90   g_return_val_if_fail (ATK_IS_PLUG (plug), NULL);
91
92   klass = g_type_class_peek (ATK_TYPE_PLUG);
93
94   if (klass && klass->get_object_id)
95     return (klass->get_object_id) (plug);
96   else
97     return NULL;
98 }