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 public  import gtkc.giotypes;
33 
34 
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  * Since: 2.30
41  */
42 public template DBusInterfaceT(TStruct)
43 {
44 	/** Get the main Gtk struct */
45 	public GDBusInterface* getDBusInterfaceStruct(bool transferOwnership = false)
46 	{
47 		if (transferOwnership)
48 			ownedRef = false;
49 		return cast(GDBusInterface*)getStruct();
50 	}
51 
52 
53 	/**
54 	 * Gets the #GDBusObject that @interface_ belongs to, if any.
55 	 *
56 	 * Returns: A #GDBusObject or %NULL. The returned
57 	 *     reference should be freed with g_object_unref().
58 	 *
59 	 * Since: 2.32
60 	 */
61 	public DBusObjectIF dupObject()
62 	{
63 		auto p = g_dbus_interface_dup_object(getDBusInterfaceStruct());
64 
65 		if(p is null)
66 		{
67 			return null;
68 		}
69 
70 		return ObjectG.getDObject!(DBusObjectIF)(cast(GDBusObject*) p, true);
71 	}
72 
73 	/**
74 	 * Gets D-Bus introspection information for the D-Bus interface
75 	 * implemented by @interface_.
76 	 *
77 	 * Returns: A #GDBusInterfaceInfo. Do not free.
78 	 *
79 	 * Since: 2.30
80 	 */
81 	public DBusInterfaceInfo getInfo()
82 	{
83 		auto p = g_dbus_interface_get_info(getDBusInterfaceStruct());
84 
85 		if(p is null)
86 		{
87 			return null;
88 		}
89 
90 		return ObjectG.getDObject!(DBusInterfaceInfo)(cast(GDBusInterfaceInfo*) p);
91 	}
92 
93 	/**
94 	 * Gets the #GDBusObject that @interface_ belongs to, if any.
95 	 *
96 	 * It is not safe to use the returned object if @interface_ or
97 	 * the returned object is being used from other threads. See
98 	 * g_dbus_interface_dup_object() for a thread-safe alternative.
99 	 *
100 	 * Returns: A #GDBusObject or %NULL. The returned
101 	 *     reference belongs to @interface_ and should not be freed.
102 	 *
103 	 * Since: 2.30
104 	 */
105 	public DBusObjectIF getObject()
106 	{
107 		auto p = g_dbus_interface_get_object(getDBusInterfaceStruct());
108 
109 		if(p is null)
110 		{
111 			return null;
112 		}
113 
114 		return ObjectG.getDObject!(DBusObjectIF)(cast(GDBusObject*) p);
115 	}
116 
117 	/**
118 	 * Sets the #GDBusObject for @interface_ to @object.
119 	 *
120 	 * Note that @interface_ will hold a weak reference to @object.
121 	 *
122 	 * Params:
123 	 *     object = A #GDBusObject or %NULL.
124 	 *
125 	 * Since: 2.30
126 	 */
127 	public void setObject(DBusObjectIF object)
128 	{
129 		g_dbus_interface_set_object(getDBusInterfaceStruct(), (object is null) ? null : object.getDBusObjectStruct());
130 	}
131 }