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