Updated Danish translation
[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, write to the
16  * Free Software Foundation, Inc., 59 Temple Place - Suite 330,
17  * Boston, MA 02111-1307, USA.
18  */
19
20 #include "config.h"
21
22 #include "atk.h"
23 #include "atkplug.h"
24
25 /**
26  * SECTION:atkplug
27  * @Short_description: Toplevel for embedding into other processes
28  * @Title: AtkPlug
29  * @See_also: #AtkPlug
30  *
31  * See #AtkSocket
32  *
33  */
34
35 static void atk_component_interface_init (AtkComponentIface *iface);
36
37 static void atk_plug_class_init (AtkPlugClass *klass);
38
39 G_DEFINE_TYPE_WITH_CODE (AtkPlug, atk_plug, ATK_TYPE_OBJECT,
40                          G_IMPLEMENT_INTERFACE (ATK_TYPE_COMPONENT, atk_component_interface_init))
41
42 static void
43 atk_plug_init (AtkPlug* obj)
44 {
45 }
46
47 static void
48 atk_plug_class_init (AtkPlugClass* klass)
49 {
50   klass->get_object_id = NULL;
51 }
52
53 static void
54 atk_component_interface_init (AtkComponentIface *iface)
55 {
56 }
57
58 AtkObject*
59 atk_plug_new (void)
60 {
61   AtkObject* accessible;
62   
63   accessible = g_object_new (ATK_TYPE_PLUG, NULL);
64   g_return_val_if_fail (accessible != NULL, NULL);
65
66   accessible->role = ATK_ROLE_FILLER;
67   accessible->layer = ATK_LAYER_WIDGET;
68   
69   return accessible;
70 }
71
72 /**
73  * atk_plug_get_id:
74  * @plug: an #AtkPlug
75  *
76  * Gets the unique ID of an #AtkPlug object, which can be used to
77  * embed inside of an #AtkSocket using atk_socket_embed().
78  *
79  * Internally, this calls a class function that should be registered
80  * by the IPC layer (usually at-spi2-atk). The implementor of an
81  * #AtkPlug object should call this function (after atk-bridge is
82  * loaded) and pass the value to the process implementing the
83  * #AtkSocket, so it could embed the plug.
84  *
85  * Returns: the unique ID for the plug
86  *
87  * Since: 1.30
88  **/
89 gchar*
90 atk_plug_get_id (AtkPlug* plug)
91 {
92   AtkPlugClass *klass;
93
94   g_return_val_if_fail (ATK_IS_PLUG (plug), NULL);
95
96   klass = g_type_class_peek (ATK_TYPE_PLUG);
97
98   if (klass && klass->get_object_id)
99     return (klass->get_object_id) (plug);
100   else
101     return NULL;
102 }