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 public import glib.Str;
70 public import glib.ListG;
71 public import gio.DBusInterface;
72 public import gio.DBusInterfaceIF;
73 
74 
75 
76 /**
77  * The GDBusObject type is the base type for D-Bus objects on both
78  * the service side (see GDBusObjectSkeleton) and the client side
79  * (see GDBusObjectProxy). It is essentially just a container of
80  * interfaces.
81  */
82 public template DBusObjectT(TStruct)
83 {
84 	
85 	/** the main Gtk struct */
86 	protected GDBusObject* gDBusObject;
87 	
88 	
89 	/** Get the main Gtk struct */
90 	public GDBusObject* getDBusObjectTStruct()
91 	{
92 		return cast(GDBusObject*)getStruct();
93 	}
94 	
95 	
96 	/**
97 	 */
98 	int[string] connectedSignals;
99 	
100 	void delegate(DBusInterfaceIF, DBusObjectIF)[] _onInterfaceAddedListeners;
101 	@property void delegate(DBusInterfaceIF, DBusObjectIF)[] onInterfaceAddedListeners()
102 	{
103 		return  _onInterfaceAddedListeners;
104 	}
105 	/**
106 	 * Emitted when interface is added to object.
107 	 * Since 2.30
108 	 */
109 	void addOnInterfaceAdded(void delegate(DBusInterfaceIF, DBusObjectIF) dlg, ConnectFlags connectFlags=cast(ConnectFlags)0)
110 	{
111 		if ( !("interface-added" in connectedSignals) )
112 		{
113 			Signals.connectData(
114 			getStruct(),
115 			"interface-added",
116 			cast(GCallback)&callBackInterfaceAdded,
117 			cast(void*)cast(DBusObjectIF)this,
118 			null,
119 			connectFlags);
120 			connectedSignals["interface-added"] = 1;
121 		}
122 		_onInterfaceAddedListeners ~= dlg;
123 	}
124 	extern(C) static void callBackInterfaceAdded(GDBusObject* objectStruct, GDBusInterface* iface, DBusObjectIF _dBusObjectIF)
125 	{
126 		foreach ( void delegate(DBusInterfaceIF, DBusObjectIF) dlg ; _dBusObjectIF.onInterfaceAddedListeners )
127 		{
128 			dlg(ObjectG.getDObject!(DBusInterface, DBusInterfaceIF)(iface), _dBusObjectIF);
129 		}
130 	}
131 	
132 	void delegate(DBusInterfaceIF, DBusObjectIF)[] _onInterfaceRemovedListeners;
133 	@property void delegate(DBusInterfaceIF, DBusObjectIF)[] onInterfaceRemovedListeners()
134 	{
135 		return  _onInterfaceRemovedListeners;
136 	}
137 	/**
138 	 * Emitted when interface is removed from object.
139 	 * Since 2.30
140 	 */
141 	void addOnInterfaceRemoved(void delegate(DBusInterfaceIF, DBusObjectIF) dlg, ConnectFlags connectFlags=cast(ConnectFlags)0)
142 	{
143 		if ( !("interface-removed" in connectedSignals) )
144 		{
145 			Signals.connectData(
146 			getStruct(),
147 			"interface-removed",
148 			cast(GCallback)&callBackInterfaceRemoved,
149 			cast(void*)cast(DBusObjectIF)this,
150 			null,
151 			connectFlags);
152 			connectedSignals["interface-removed"] = 1;
153 		}
154 		_onInterfaceRemovedListeners ~= dlg;
155 	}
156 	extern(C) static void callBackInterfaceRemoved(GDBusObject* objectStruct, GDBusInterface* iface, DBusObjectIF _dBusObjectIF)
157 	{
158 		foreach ( void delegate(DBusInterfaceIF, DBusObjectIF) dlg ; _dBusObjectIF.onInterfaceRemovedListeners )
159 		{
160 			dlg(ObjectG.getDObject!(DBusInterface, DBusInterfaceIF)(iface), _dBusObjectIF);
161 		}
162 	}
163 	
164 	
165 	/**
166 	 * Gets the object path for object.
167 	 * Since 2.30
168 	 * Returns: A string owned by object. Do not free.
169 	 */
170 	public string gDbusObjectGetObjectPath()
171 	{
172 		// const gchar * g_dbus_object_get_object_path (GDBusObject *object);
173 		return Str.toString(g_dbus_object_get_object_path(getDBusObjectTStruct()));
174 	}
175 	
176 	/**
177 	 * Gets the D-Bus interfaces associated with object.
178 	 * Since 2.30
179 	 * 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().
180 	 */
181 	public ListG gDbusObjectGetInterfaces()
182 	{
183 		// GList * g_dbus_object_get_interfaces (GDBusObject *object);
184 		auto p = g_dbus_object_get_interfaces(getDBusObjectTStruct());
185 		
186 		if(p is null)
187 		{
188 			return null;
189 		}
190 		
191 		return ObjectG.getDObject!(ListG)(cast(GList*) p);
192 	}
193 	
194 	/**
195 	 * Gets the D-Bus interface with name interface_name associated with
196 	 * object, if any.
197 	 * Since 2.30
198 	 * Signal Details
199 	 * The "interface-added" signal
200 	 * void user_function (GDBusObject *object,
201 	 *  GDBusInterface *interface,
202 	 *  gpointer user_data) : Run Last
203 	 * Emitted when interface is added to object.
204 	 * Since 2.30
205 	 * Params:
206 	 * interfaceName = A D-Bus interface name.
207 	 * interface = The GDBusInterface that was added.
208 	 * Returns: NULL if not found, otherwise a GDBusInterface that must be freed with g_object_unref(). [transfer full]
209 	 */
210 	public DBusInterfaceIF gDbusObjectGetInterface(string interfaceName)
211 	{
212 		// GDBusInterface * g_dbus_object_get_interface (GDBusObject *object,  const gchar *interface_name);
213 		auto p = g_dbus_object_get_interface(getDBusObjectTStruct(), Str.toStringz(interfaceName));
214 		
215 		if(p is null)
216 		{
217 			return null;
218 		}
219 		
220 		return ObjectG.getDObject!(DBusInterface, DBusInterfaceIF)(cast(GDBusInterface*) p);
221 	}
222 }