1 /*
2  * This file is part of gtkD.
3  *
4  * gtkD is free software; you can redistribute it and/or modify
5  * it under the terms of the GNU Lesser General Public License
6  * as published by the Free Software Foundation; either version 3
7  * of the License, or (at your option) any later version, with
8  * some exceptions, please read the COPYING file.
9  *
10  * gtkD 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
13  * GNU Lesser General Public License for more details.
14  *
15  * You should have received a copy of the GNU Lesser General Public License
16  * along with gtkD; if not, write to the Free Software
17  * Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110, USA
18  */
19 
20 // generated automatically - do not change
21 // find conversion definition on APILookup.txt
22 // implement new conversion functionalities on the wrap.utils pakage
23 
24 
25 module gio.DBusInterfaceT;
26 
27 public  import gio.DBusInterfaceInfo;
28 public  import gio.DBusObjectIF;
29 public  import gio.c.functions;
30 public  import gio.c.types;
31 public  import gobject.ObjectG;
32 
33 
34 /**
35  * The #GDBusInterface type is the base type for D-Bus interfaces both
36  * on the service side (see #GDBusInterfaceSkeleton) and client side
37  * (see #GDBusProxy).
38  *
39  * Since: 2.30
40  */
41 public template DBusInterfaceT(TStruct)
42 {
43 	/** Get the main Gtk struct */
44 	public GDBusInterface* getDBusInterfaceStruct(bool transferOwnership = false)
45 	{
46 		if (transferOwnership)
47 			ownedRef = false;
48 		return cast(GDBusInterface*)getStruct();
49 	}
50 
51 
52 	/**
53 	 * Gets the #GDBusObject that @interface_ belongs to, if any.
54 	 *
55 	 * Returns: A #GDBusObject or %NULL. The returned
56 	 *     reference should be freed with g_object_unref().
57 	 *
58 	 * Since: 2.32
59 	 */
60 	public DBusObjectIF dupObject()
61 	{
62 		auto __p = g_dbus_interface_dup_object(getDBusInterfaceStruct());
63 
64 		if(__p is null)
65 		{
66 			return null;
67 		}
68 
69 		return ObjectG.getDObject!(DBusObjectIF)(cast(GDBusObject*) __p, true);
70 	}
71 
72 	/**
73 	 * Gets D-Bus introspection information for the D-Bus interface
74 	 * implemented by @interface_.
75 	 *
76 	 * Returns: A #GDBusInterfaceInfo. Do not free.
77 	 *
78 	 * Since: 2.30
79 	 */
80 	public DBusInterfaceInfo getInfo()
81 	{
82 		auto __p = g_dbus_interface_get_info(getDBusInterfaceStruct());
83 
84 		if(__p is null)
85 		{
86 			return null;
87 		}
88 
89 		return ObjectG.getDObject!(DBusInterfaceInfo)(cast(GDBusInterfaceInfo*) __p);
90 	}
91 
92 	/**
93 	 * Gets the #GDBusObject that @interface_ belongs to, if any.
94 	 *
95 	 * It is not safe to use the returned object if @interface_ or
96 	 * the returned object is being used from other threads. See
97 	 * g_dbus_interface_dup_object() for a thread-safe alternative.
98 	 *
99 	 * Returns: A #GDBusObject or %NULL. The returned
100 	 *     reference belongs to @interface_ and should not be freed.
101 	 *
102 	 * Since: 2.30
103 	 */
104 	public DBusObjectIF getObject()
105 	{
106 		auto __p = g_dbus_interface_get_object(getDBusInterfaceStruct());
107 
108 		if(__p is null)
109 		{
110 			return null;
111 		}
112 
113 		return ObjectG.getDObject!(DBusObjectIF)(cast(GDBusObject*) __p);
114 	}
115 
116 	/**
117 	 * Sets the #GDBusObject for @interface_ to @object.
118 	 *
119 	 * Note that @interface_ will hold a weak reference to @object.
120 	 *
121 	 * Params:
122 	 *     object = A #GDBusObject or %NULL.
123 	 *
124 	 * Since: 2.30
125 	 */
126 	public void setObject(DBusObjectIF object)
127 	{
128 		g_dbus_interface_set_object(getDBusInterfaceStruct(), (object is null) ? null : object.getDBusObjectStruct());
129 	}
130 }