atkhyperlink: Ensure we get even deprecated prototypes
[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 "atk.h"
21 #include "atkplug.h"
22
23 static void atk_component_interface_init (AtkComponentIface *iface);
24
25 static void atk_plug_class_init (AtkPlugClass *klass);
26
27 G_DEFINE_TYPE_WITH_CODE (AtkPlug, atk_plug, ATK_TYPE_OBJECT,
28                          G_IMPLEMENT_INTERFACE (ATK_TYPE_COMPONENT, atk_component_interface_init))
29
30 static void
31 atk_plug_init (AtkPlug* obj)
32 {
33 }
34
35 static void
36 atk_plug_class_init (AtkPlugClass* klass)
37 {
38   klass->get_object_id = NULL;
39 }
40
41 static void
42 atk_component_interface_init (AtkComponentIface *iface)
43 {
44 }
45
46 AtkObject*
47 atk_plug_new (void)
48 {
49   AtkObject* accessible;
50   
51   accessible = g_object_new (ATK_TYPE_PLUG, NULL);
52   g_return_val_if_fail (accessible != NULL, NULL);
53
54   accessible->role = ATK_ROLE_FILLER;
55   accessible->layer = ATK_LAYER_WIDGET;
56   
57   return accessible;
58 }
59
60 /**
61  * atk_plug_get_plug_id:
62  * @obj: an #AtkPlug
63  *
64  * Gets the unique ID of an #AtkPlug object, which can be used to embed inside
65  * of an #AtkSocket using atk_socket_embed().
66  * Internally, this calls a class function that should be registered by the
67  * IPC layer (eg, at-spi2-atk).  The implementor of an AtkSocket object
68  * should call this function (after atk-bridge is loaded) and pass the value
69  * to the process implementing the AtkPlug into which the AtkSocket is
70  * embedded.
71  *
72  * Returns: the unique ID for the plug
73  *
74  * Since: 1.30
75  **/
76 gchar*
77 atk_plug_get_id (AtkPlug* obj)
78 {
79   AtkPlugClass *klass;
80
81   g_return_val_if_fail (ATK_IS_PLUG (obj), NULL);
82
83   klass = g_type_class_peek (ATK_TYPE_PLUG);
84
85   if (klass && klass->get_object_id)
86     return (klass->get_object_id) (obj);
87   else
88     return NULL;
89 }