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  * Conversion parameters:
26  * inFile  = GDBusObject.html
27  * outPack = gio
28  * outFile = DBusObjectT
29  * strct   = GDBusObject
30  * realStrct=
31  * ctorStrct=
32  * clss    = DBusObjectT
33  * interf  = DBusObjectIF
34  * class Code: No
35  * interface Code: No
36  * template for:
37  * 	- TStruct
38  * extend  = 
39  * implements:
40  * prefixes:
41  * 	- g_dbus_interface_
42  * omit structs:
43  * omit prefixes:
44  * omit code:
45  * omit signals:
46  * imports:
47  * 	- glib.Str
48  * 	- glib.ListG
49  * 	- gio.DBusInterface
50  * 	- gio.DBusInterfaceIF
51  * structWrap:
52  * 	- GDBusInterface* -> DBusInterfaceIF
53  * 	- GList* -> ListG
54  * module aliases:
55  * local aliases:
56  * overrides:
57  */
58 
59 module gio.DBusObjectT;
60 
61 public  import gtkc.giotypes;
62 
63 public import gtkc.gio;
64 public import glib.ConstructionException;
65 public import gobject.ObjectG;
66 
67 public import gobject.Signals;
68 public  import gtkc.gdktypes;
69 
70 public import glib.Str;
71 public import glib.ListG;
72 public import gio.DBusInterface;
73 public import gio.DBusInterfaceIF;
74 
75 
76 
77 
78 /**
79  * The GDBusObject type is the base type for D-Bus objects on both
80  * the service side (see GDBusObjectSkeleton) and the client side
81  * (see GDBusObjectProxy). It is essentially just a container of
82  * interfaces.
83  */
84 public template DBusObjectT(TStruct)
85 {
86 	
87 	/** the main Gtk struct */
88 	protected GDBusObject* gDBusObject;
89 	
90 	
91 	public GDBusObject* getDBusObjectTStruct()
92 	{
93 		return cast(GDBusObject*)getStruct();
94 	}
95 	
96 	
97 	/**
98 	 */
99 	int[string] connectedSignals;
100 	
101 	void delegate(DBusInterfaceIF, DBusObjectIF)[] _onInterfaceAddedListeners;
102 	@property void delegate(DBusInterfaceIF, DBusObjectIF)[] onInterfaceAddedListeners()
103 	{
104 		return  _onInterfaceAddedListeners;
105 	}
106 	/**
107 	 * Emitted when interface is added to object.
108 	 * Since 2.30
109 	 */
110 	void addOnInterfaceAdded(void delegate(DBusInterfaceIF, DBusObjectIF) dlg, ConnectFlags connectFlags=cast(ConnectFlags)0)
111 	{
112 		if ( !("interface-added" in connectedSignals) )
113 		{
114 			Signals.connectData(
115 			getStruct(),
116 			"interface-added",
117 			cast(GCallback)&callBackInterfaceAdded,
118 			cast(void*)cast(DBusObjectIF)this,
119 			null,
120 			connectFlags);
121 			connectedSignals["interface-added"] = 1;
122 		}
123 		_onInterfaceAddedListeners ~= dlg;
124 	}
125 	extern(C) static void callBackInterfaceAdded(GDBusObject* objectStruct, GDBusInterface* iface, DBusObjectIF _dBusObjectIF)
126 	{
127 		foreach ( void delegate(DBusInterfaceIF, DBusObjectIF) dlg ; _dBusObjectIF.onInterfaceAddedListeners )
128 		{
129 			dlg(ObjectG.getDObject!(DBusInterface, DBusInterfaceIF)(iface), _dBusObjectIF);
130 		}
131 	}
132 	
133 	void delegate(DBusInterfaceIF, DBusObjectIF)[] _onInterfaceRemovedListeners;
134 	@property void delegate(DBusInterfaceIF, DBusObjectIF)[] onInterfaceRemovedListeners()
135 	{
136 		return  _onInterfaceRemovedListeners;
137 	}
138 	/**
139 	 * Emitted when interface is removed from object.
140 	 * Since 2.30
141 	 */
142 	void addOnInterfaceRemoved(void delegate(DBusInterfaceIF, DBusObjectIF) dlg, ConnectFlags connectFlags=cast(ConnectFlags)0)
143 	{
144 		if ( !("interface-removed" in connectedSignals) )
145 		{
146 			Signals.connectData(
147 			getStruct(),
148 			"interface-removed",
149 			cast(GCallback)&callBackInterfaceRemoved,
150 			cast(void*)cast(DBusObjectIF)this,
151 			null,
152 			connectFlags);
153 			connectedSignals["interface-removed"] = 1;
154 		}
155 		_onInterfaceRemovedListeners ~= dlg;
156 	}
157 	extern(C) static void callBackInterfaceRemoved(GDBusObject* objectStruct, GDBusInterface* iface, DBusObjectIF _dBusObjectIF)
158 	{
159 		foreach ( void delegate(DBusInterfaceIF, DBusObjectIF) dlg ; _dBusObjectIF.onInterfaceRemovedListeners )
160 		{
161 			dlg(ObjectG.getDObject!(DBusInterface, DBusInterfaceIF)(iface), _dBusObjectIF);
162 		}
163 	}
164 	
165 	
166 	/**
167 	 * Gets the object path for object.
168 	 * Since 2.30
169 	 * Returns: A string owned by object. Do not free.
170 	 */
171 	public string gDbusObjectGetObjectPath()
172 	{
173 		// const gchar * g_dbus_object_get_object_path (GDBusObject *object);
174 		return Str.toString(g_dbus_object_get_object_path(getDBusObjectTStruct()));
175 	}
176 	
177 	/**
178 	 * Gets the D-Bus interfaces associated with object.
179 	 * Since 2.30
180 	 * Returns: (element-type GDBusInterface) (transfer full) : A list of GDBusInterface instances. The returned list must be freed by g_list_free() after each element has been freed with g_object_unref().
181 	 */
182 	public ListG gDbusObjectGetInterfaces()
183 	{
184 		// GList * g_dbus_object_get_interfaces (GDBusObject *object);
185 		auto p = g_dbus_object_get_interfaces(getDBusObjectTStruct());
186 		
187 		if(p is null)
188 		{
189 			return null;
190 		}
191 		
192 		return ObjectG.getDObject!(ListG)(cast(GList*) p);
193 	}
194 	
195 	/**
196 	 * Gets the D-Bus interface with name interface_name associated with
197 	 * object, if any.
198 	 * Since 2.30
199 	 * Signal Details
200 	 * The "interface-added" signal
201 	 * void user_function (GDBusObject *object,
202 	 *  GDBusInterface *interface,
203 	 *  gpointer user_data) : Run Last
204 	 * Emitted when interface is added to object.
205 	 * Since 2.30
206 	 * Params:
207 	 * interfaceName = A D-Bus interface name.
208 	 * interface = The GDBusInterface that was added.
209 	 * Returns: NULL if not found, otherwise a GDBusInterface that must be freed with g_object_unref(). [transfer full]
210 	 */
211 	public DBusInterfaceIF gDbusObjectGetInterface(string interfaceName)
212 	{
213 		// GDBusInterface * g_dbus_object_get_interface (GDBusObject *object,  const gchar *interface_name);
214 		auto p = g_dbus_object_get_interface(getDBusObjectTStruct(), Str.toStringz(interfaceName));
215 		
216 		if(p is null)
217 		{
218 			return null;
219 		}
220 		
221 		return ObjectG.getDObject!(DBusInterface, DBusInterfaceIF)(cast(GDBusInterface*) p);
222 	}
223 }