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.DBusObjectManagerT;
26 
27 public  import gio.DBusInterfaceIF;
28 public  import gio.DBusObjectIF;
29 public  import gio.c.functions;
30 public  import gio.c.types;
31 public  import glib.ListG;
32 public  import glib.Str;
33 public  import gobject.ObjectG;
34 public  import gobject.Signals;
35 public  import gtkc.giotypes;
36 public  import std.algorithm;
37 
38 
39 /**
40  * The #GDBusObjectManager type is the base type for service- and
41  * client-side implementations of the standardized
42  * [org.freedesktop.DBus.ObjectManager](http://dbus.freedesktop.org/doc/dbus-specification.html#standard-interfaces-objectmanager)
43  * interface.
44  * 
45  * See #GDBusObjectManagerClient for the client-side implementation
46  * and #GDBusObjectManagerServer for the service-side implementation.
47  */
48 public template DBusObjectManagerT(TStruct)
49 {
50 	/** Get the main Gtk struct */
51 	public GDBusObjectManager* getDBusObjectManagerStruct(bool transferOwnership = false)
52 	{
53 		if (transferOwnership)
54 			ownedRef = false;
55 		return cast(GDBusObjectManager*)getStruct();
56 	}
57 
58 
59 	/**
60 	 * Gets the interface proxy for @interface_name at @object_path, if
61 	 * any.
62 	 *
63 	 * Params:
64 	 *     objectPath = Object path to lookup.
65 	 *     interfaceName = D-Bus interface name to lookup.
66 	 *
67 	 * Returns: A #GDBusInterface instance or %NULL. Free
68 	 *     with g_object_unref().
69 	 *
70 	 * Since: 2.30
71 	 */
72 	public DBusInterfaceIF getInterface(string objectPath, string interfaceName)
73 	{
74 		auto p = g_dbus_object_manager_get_interface(getDBusObjectManagerStruct(), Str.toStringz(objectPath), Str.toStringz(interfaceName));
75 
76 		if(p is null)
77 		{
78 			return null;
79 		}
80 
81 		return ObjectG.getDObject!(DBusInterfaceIF)(cast(GDBusInterface*) p, true);
82 	}
83 
84 	/**
85 	 * Gets the #GDBusObjectProxy at @object_path, if any.
86 	 *
87 	 * Params:
88 	 *     objectPath = Object path to lookup.
89 	 *
90 	 * Returns: A #GDBusObject or %NULL. Free with
91 	 *     g_object_unref().
92 	 *
93 	 * Since: 2.30
94 	 */
95 	public DBusObjectIF getObject(string objectPath)
96 	{
97 		auto p = g_dbus_object_manager_get_object(getDBusObjectManagerStruct(), Str.toStringz(objectPath));
98 
99 		if(p is null)
100 		{
101 			return null;
102 		}
103 
104 		return ObjectG.getDObject!(DBusObjectIF)(cast(GDBusObject*) p, true);
105 	}
106 
107 	/**
108 	 * Gets the object path that @manager is for.
109 	 *
110 	 * Returns: A string owned by @manager. Do not free.
111 	 *
112 	 * Since: 2.30
113 	 */
114 	public string getObjectPath()
115 	{
116 		return Str.toString(g_dbus_object_manager_get_object_path(getDBusObjectManagerStruct()));
117 	}
118 
119 	/**
120 	 * Gets all #GDBusObject objects known to @manager.
121 	 *
122 	 * Returns: A list of
123 	 *     #GDBusObject objects. The returned list should be freed with
124 	 *     g_list_free() after each element has been freed with
125 	 *     g_object_unref().
126 	 *
127 	 * Since: 2.30
128 	 */
129 	public ListG getObjects()
130 	{
131 		auto p = g_dbus_object_manager_get_objects(getDBusObjectManagerStruct());
132 
133 		if(p is null)
134 		{
135 			return null;
136 		}
137 
138 		return new ListG(cast(GList*) p, true);
139 	}
140 
141 	/**
142 	 * Emitted when @interface is added to @object.
143 	 *
144 	 * This signal exists purely as a convenience to avoid having to
145 	 * connect signals to all objects managed by @manager.
146 	 *
147 	 * Params:
148 	 *     object = The #GDBusObject on which an interface was added.
149 	 *     iface = The #GDBusInterface that was added.
150 	 *
151 	 * Since: 2.30
152 	 */
153 	gulong addOnInterfaceAdded(void delegate(DBusObjectIF, DBusInterfaceIF, DBusObjectManagerIF) dlg, ConnectFlags connectFlags=cast(ConnectFlags)0)
154 	{
155 		return Signals.connect(this, "interface-added", dlg, connectFlags ^ ConnectFlags.SWAPPED);
156 	}
157 
158 	/**
159 	 * Emitted when @interface has been removed from @object.
160 	 *
161 	 * This signal exists purely as a convenience to avoid having to
162 	 * connect signals to all objects managed by @manager.
163 	 *
164 	 * Params:
165 	 *     object = The #GDBusObject on which an interface was removed.
166 	 *     iface = The #GDBusInterface that was removed.
167 	 *
168 	 * Since: 2.30
169 	 */
170 	gulong addOnInterfaceRemoved(void delegate(DBusObjectIF, DBusInterfaceIF, DBusObjectManagerIF) dlg, ConnectFlags connectFlags=cast(ConnectFlags)0)
171 	{
172 		return Signals.connect(this, "interface-removed", dlg, connectFlags ^ ConnectFlags.SWAPPED);
173 	}
174 
175 	/**
176 	 * Emitted when @object is added to @manager.
177 	 *
178 	 * Params:
179 	 *     object = The #GDBusObject that was added.
180 	 *
181 	 * Since: 2.30
182 	 */
183 	gulong addOnObjectAdded(void delegate(DBusObjectIF, DBusObjectManagerIF) dlg, ConnectFlags connectFlags=cast(ConnectFlags)0)
184 	{
185 		return Signals.connect(this, "object-added", dlg, connectFlags ^ ConnectFlags.SWAPPED);
186 	}
187 
188 	/**
189 	 * Emitted when @object is removed from @manager.
190 	 *
191 	 * Params:
192 	 *     object = The #GDBusObject that was removed.
193 	 *
194 	 * Since: 2.30
195 	 */
196 	gulong addOnObjectRemoved(void delegate(DBusObjectIF, DBusObjectManagerIF) dlg, ConnectFlags connectFlags=cast(ConnectFlags)0)
197 	{
198 		return Signals.connect(this, "object-removed", dlg, connectFlags ^ ConnectFlags.SWAPPED);
199 	}
200 }