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.DBusInterface;
28 public  import gio.DBusInterfaceIF;
29 public  import gio.DBusObject;
30 public  import gio.DBusObjectIF;
31 public  import glib.ListG;
32 public  import glib.Str;
33 public  import gobject.ObjectG;
34 public  import gobject.Signals;
35 public  import gtkc.gdktypes;
36 public  import gtkc.gio;
37 public  import gtkc.giotypes;
38 
39 
40 /**
41  * The #GDBusObjectManager type is the base type for service- and
42  * client-side implementations of the standardized
43  * [org.freedesktop.DBus.ObjectManager](http://dbus.freedesktop.org/doc/dbus-specification.html#standard-interfaces-objectmanager)
44  * interface.
45  * 
46  * See #GDBusObjectManagerClient for the client-side implementation
47  * and #GDBusObjectManagerServer for the service-side implementation.
48  */
49 public template DBusObjectManagerT(TStruct)
50 {
51 	/** Get the main Gtk struct */
52 	public GDBusObjectManager* getDBusObjectManagerStruct()
53 	{
54 		return cast(GDBusObjectManager*)getStruct();
55 	}
56 
57 	/**
58 	 */
59 
60 	/**
61 	 * Gets the interface proxy for @interface_name at @object_path, if
62 	 * any.
63 	 *
64 	 * Params:
65 	 *     objectPath = Object path to lookup.
66 	 *     interfaceName = D-Bus interface name to lookup.
67 	 *
68 	 * Return: A #GDBusInterface instance or %NULL. Free
69 	 *     with g_object_unref().
70 	 *
71 	 * Since: 2.30
72 	 */
73 	public DBusInterfaceIF getInterface(string objectPath, string interfaceName)
74 	{
75 		auto p = g_dbus_object_manager_get_interface(getDBusObjectManagerStruct(), Str.toStringz(objectPath), Str.toStringz(interfaceName));
76 		
77 		if(p is null)
78 		{
79 			return null;
80 		}
81 		
82 		return ObjectG.getDObject!(DBusInterface, DBusInterfaceIF)(cast(GDBusInterface*) p);
83 	}
84 
85 	/**
86 	 * Gets the #GDBusObjectProxy at @object_path, if any.
87 	 *
88 	 * Params:
89 	 *     objectPath = Object path to lookup.
90 	 *
91 	 * Return: A #GDBusObject or %NULL. Free with
92 	 *     g_object_unref().
93 	 *
94 	 * Since: 2.30
95 	 */
96 	public DBusObjectIF getObject(string objectPath)
97 	{
98 		auto p = g_dbus_object_manager_get_object(getDBusObjectManagerStruct(), Str.toStringz(objectPath));
99 		
100 		if(p is null)
101 		{
102 			return null;
103 		}
104 		
105 		return ObjectG.getDObject!(DBusObject, DBusObjectIF)(cast(GDBusObject*) p);
106 	}
107 
108 	/**
109 	 * Gets the object path that @manager is for.
110 	 *
111 	 * Return: A string owned by @manager. Do not free.
112 	 *
113 	 * Since: 2.30
114 	 */
115 	public string getObjectPath()
116 	{
117 		return Str.toString(g_dbus_object_manager_get_object_path(getDBusObjectManagerStruct()));
118 	}
119 
120 	/**
121 	 * Gets all #GDBusObject objects known to @manager.
122 	 *
123 	 * Return: A list of
124 	 *     #GDBusObject objects. The returned list should be freed with
125 	 *     g_list_free() after each element has been freed with
126 	 *     g_object_unref().
127 	 *
128 	 * Since: 2.30
129 	 */
130 	public ListG getObjects()
131 	{
132 		auto p = g_dbus_object_manager_get_objects(getDBusObjectManagerStruct());
133 		
134 		if(p is null)
135 		{
136 			return null;
137 		}
138 		
139 		return new ListG(cast(GList*) p);
140 	}
141 
142 	int[string] connectedSignals;
143 
144 	void delegate(DBusObjectIF, DBusInterfaceIF, DBusObjectManagerIF)[] _onInterfaceAddedListeners;
145 	@property void delegate(DBusObjectIF, DBusInterfaceIF, DBusObjectManagerIF)[] onInterfaceAddedListeners()
146 	{
147 		return _onInterfaceAddedListeners;
148 	}
149 	/**
150 	 * Emitted when @interface is added to @object.
151 	 *
152 	 * This signal exists purely as a convenience to avoid having to
153 	 * connect signals to all objects managed by @manager.
154 	 *
155 	 * Params:
156 	 *     object = The #GDBusObject on which an interface was added.
157 	 *     iface = The #GDBusInterface that was added.
158 	 *
159 	 * Since: 2.30
160 	 */
161 	void addOnInterfaceAdded(void delegate(DBusObjectIF, DBusInterfaceIF, DBusObjectManagerIF) dlg, ConnectFlags connectFlags=cast(ConnectFlags)0)
162 	{
163 		if ( "interface-added" !in connectedSignals )
164 		{
165 			Signals.connectData(
166 				this,
167 				"interface-added",
168 				cast(GCallback)&callBackInterfaceAdded,
169 				cast(void*)cast(DBusObjectManagerIF)this,
170 				null,
171 				connectFlags);
172 			connectedSignals["interface-added"] = 1;
173 		}
174 		_onInterfaceAddedListeners ~= dlg;
175 	}
176 	extern(C) static void callBackInterfaceAdded(GDBusObjectManager* dbusobjectmanagerStruct, GDBusObject* object, GDBusInterface* iface, DBusObjectManagerIF _dbusobjectmanager)
177 	{
178 		foreach ( void delegate(DBusObjectIF, DBusInterfaceIF, DBusObjectManagerIF) dlg; _dbusobjectmanager.onInterfaceAddedListeners )
179 		{
180 			dlg(ObjectG.getDObject!(DBusObject, DBusObjectIF)(object), ObjectG.getDObject!(DBusInterface, DBusInterfaceIF)(iface), _dbusobjectmanager);
181 		}
182 	}
183 
184 	void delegate(DBusObjectIF, DBusInterfaceIF, DBusObjectManagerIF)[] _onInterfaceRemovedListeners;
185 	@property void delegate(DBusObjectIF, DBusInterfaceIF, DBusObjectManagerIF)[] onInterfaceRemovedListeners()
186 	{
187 		return _onInterfaceRemovedListeners;
188 	}
189 	/**
190 	 * Emitted when @interface has been removed from @object.
191 	 *
192 	 * This signal exists purely as a convenience to avoid having to
193 	 * connect signals to all objects managed by @manager.
194 	 *
195 	 * Params:
196 	 *     object = The #GDBusObject on which an interface was removed.
197 	 *     iface = The #GDBusInterface that was removed.
198 	 *
199 	 * Since: 2.30
200 	 */
201 	void addOnInterfaceRemoved(void delegate(DBusObjectIF, DBusInterfaceIF, DBusObjectManagerIF) dlg, ConnectFlags connectFlags=cast(ConnectFlags)0)
202 	{
203 		if ( "interface-removed" !in connectedSignals )
204 		{
205 			Signals.connectData(
206 				this,
207 				"interface-removed",
208 				cast(GCallback)&callBackInterfaceRemoved,
209 				cast(void*)cast(DBusObjectManagerIF)this,
210 				null,
211 				connectFlags);
212 			connectedSignals["interface-removed"] = 1;
213 		}
214 		_onInterfaceRemovedListeners ~= dlg;
215 	}
216 	extern(C) static void callBackInterfaceRemoved(GDBusObjectManager* dbusobjectmanagerStruct, GDBusObject* object, GDBusInterface* iface, DBusObjectManagerIF _dbusobjectmanager)
217 	{
218 		foreach ( void delegate(DBusObjectIF, DBusInterfaceIF, DBusObjectManagerIF) dlg; _dbusobjectmanager.onInterfaceRemovedListeners )
219 		{
220 			dlg(ObjectG.getDObject!(DBusObject, DBusObjectIF)(object), ObjectG.getDObject!(DBusInterface, DBusInterfaceIF)(iface), _dbusobjectmanager);
221 		}
222 	}
223 
224 	void delegate(DBusObjectIF, DBusObjectManagerIF)[] _onObjectAddedListeners;
225 	@property void delegate(DBusObjectIF, DBusObjectManagerIF)[] onObjectAddedListeners()
226 	{
227 		return _onObjectAddedListeners;
228 	}
229 	/**
230 	 * Emitted when @object is added to @manager.
231 	 *
232 	 * Params:
233 	 *     object = The #GDBusObject that was added.
234 	 *
235 	 * Since: 2.30
236 	 */
237 	void addOnObjectAdded(void delegate(DBusObjectIF, DBusObjectManagerIF) dlg, ConnectFlags connectFlags=cast(ConnectFlags)0)
238 	{
239 		if ( "object-added" !in connectedSignals )
240 		{
241 			Signals.connectData(
242 				this,
243 				"object-added",
244 				cast(GCallback)&callBackObjectAdded,
245 				cast(void*)cast(DBusObjectManagerIF)this,
246 				null,
247 				connectFlags);
248 			connectedSignals["object-added"] = 1;
249 		}
250 		_onObjectAddedListeners ~= dlg;
251 	}
252 	extern(C) static void callBackObjectAdded(GDBusObjectManager* dbusobjectmanagerStruct, GDBusObject* object, DBusObjectManagerIF _dbusobjectmanager)
253 	{
254 		foreach ( void delegate(DBusObjectIF, DBusObjectManagerIF) dlg; _dbusobjectmanager.onObjectAddedListeners )
255 		{
256 			dlg(ObjectG.getDObject!(DBusObject, DBusObjectIF)(object), _dbusobjectmanager);
257 		}
258 	}
259 
260 	void delegate(DBusObjectIF, DBusObjectManagerIF)[] _onObjectRemovedListeners;
261 	@property void delegate(DBusObjectIF, DBusObjectManagerIF)[] onObjectRemovedListeners()
262 	{
263 		return _onObjectRemovedListeners;
264 	}
265 	/**
266 	 * Emitted when @object is removed from @manager.
267 	 *
268 	 * Params:
269 	 *     object = The #GDBusObject that was removed.
270 	 *
271 	 * Since: 2.30
272 	 */
273 	void addOnObjectRemoved(void delegate(DBusObjectIF, DBusObjectManagerIF) dlg, ConnectFlags connectFlags=cast(ConnectFlags)0)
274 	{
275 		if ( "object-removed" !in connectedSignals )
276 		{
277 			Signals.connectData(
278 				this,
279 				"object-removed",
280 				cast(GCallback)&callBackObjectRemoved,
281 				cast(void*)cast(DBusObjectManagerIF)this,
282 				null,
283 				connectFlags);
284 			connectedSignals["object-removed"] = 1;
285 		}
286 		_onObjectRemovedListeners ~= dlg;
287 	}
288 	extern(C) static void callBackObjectRemoved(GDBusObjectManager* dbusobjectmanagerStruct, GDBusObject* object, DBusObjectManagerIF _dbusobjectmanager)
289 	{
290 		foreach ( void delegate(DBusObjectIF, DBusObjectManagerIF) dlg; _dbusobjectmanager.onObjectRemovedListeners )
291 		{
292 			dlg(ObjectG.getDObject!(DBusObject, DBusObjectIF)(object), _dbusobjectmanager);
293 		}
294 	}
295 }