GDBus: Use Skeleton instead of Stub
[platform/upstream/glib.git] / gio / gdbusinterface.c
1 /* GDBus - GLib D-Bus Library
2  *
3  * Copyright (C) 2008-2010 Red Hat, Inc.
4  *
5  * This library is free software; you can redistribute it and/or
6  * modify it under the terms of the GNU Lesser General Public
7  * License as published by the Free Software Foundation; either
8  * version 2 of the License, or (at your option) any later version.
9  *
10  * This library is distributed in the hope that it will be useful,
11  * but WITHOUT ANY WARRANTY; without even the implied warranty of
12  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
13  * Lesser General Public License for more details.
14  *
15  * You should have received a copy of the GNU Lesser General
16  * Public License along with this library; if not, write to the
17  * Free Software Foundation, Inc., 59 Temple Place, Suite 330,
18  * Boston, MA 02111-1307, USA.
19  *
20  * Author: David Zeuthen <davidz@redhat.com>
21  */
22
23 #include "config.h"
24
25 #include "gdbusobject.h"
26 #include "gdbusinterface.h"
27 #include "gio-marshal.h"
28
29 #include "glibintl.h"
30
31 /**
32  * SECTION:gdbusinterface
33  * @short_description: Base type for D-Bus interfaces
34  * @include: gio/gio.h
35  *
36  * The #GDBusInterface type is the base type for D-Bus interfaces both
37  * on the service side (see #GDBusInterfaceSkeleton) and client side
38  * (see #GDBusProxy).
39  */
40
41 typedef GDBusInterfaceIface GDBusInterfaceInterface;
42 G_DEFINE_INTERFACE (GDBusInterface, g_dbus_interface, G_TYPE_OBJECT)
43
44 static void
45 g_dbus_interface_default_init (GDBusInterfaceIface *iface)
46 {
47 }
48
49 /* ---------------------------------------------------------------------------------------------------- */
50
51 /**
52  * g_dbus_interface_get_info:
53  * @interface_: An exported D-Bus interface.
54  *
55  * Gets D-Bus introspection information for the D-Bus interface
56  * implemented by @interface_.
57  *
58  * Returns: (transfer none): A #GDBusInterfaceInfo. Do not free.
59  *
60  * Since: 2.30
61  */
62 GDBusInterfaceInfo *
63 g_dbus_interface_get_info (GDBusInterface *interface_)
64 {
65   g_return_val_if_fail (G_IS_DBUS_INTERFACE (interface_), NULL);
66   return G_DBUS_INTERFACE_GET_IFACE (interface_)->get_info (interface_);
67 }
68
69 /**
70  * g_dbus_interface_get_object:
71  * @interface_: An exported D-Bus interface.
72  *
73  * Gets the #GDBusObject that @interface_ belongs to, if any.
74  *
75  * Returns: (transfer none): A #GDBusObject or %NULL. The returned
76  * reference belongs to @interface_ and should not be freed.
77  *
78  * Since: 2.30
79  */
80 GDBusObject *
81 g_dbus_interface_get_object (GDBusInterface *interface_)
82 {
83   g_return_val_if_fail (G_IS_DBUS_INTERFACE (interface_), NULL);
84   return G_DBUS_INTERFACE_GET_IFACE (interface_)->get_object (interface_);
85 }
86
87 /**
88  * g_dbus_interface_set_object:
89  * @interface_: An exported D-Bus interface.
90  * @object: A #GDBusObject or %NULL.
91  *
92  * Sets the #GDBusObject for @interface_ to @object.
93  *
94  * Note that @interface_ will hold a weak reference to @object.
95  *
96  * Since: 2.30
97  */
98 void
99 g_dbus_interface_set_object (GDBusInterface    *interface_,
100                              GDBusObject       *object)
101 {
102   g_return_if_fail (G_IS_DBUS_INTERFACE (interface_));
103   g_return_if_fail (object == NULL || G_IS_DBUS_OBJECT (object));
104   G_DBUS_INTERFACE_GET_IFACE (interface_)->set_object (interface_, object);
105 }