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  = GDBusObjectSkeleton.html
27  * outPack = gio
28  * outFile = DBusObjectSkeleton
29  * strct   = GDBusObjectSkeleton
30  * realStrct=
31  * ctorStrct=
32  * clss    = DBusObjectSkeleton
33  * interf  = 
34  * class Code: Yes
35  * interface Code: No
36  * template for:
37  * extend  = 
38  * implements:
39  * 	- DBusObjectIF
40  * prefixes:
41  * 	- g_dbus_object_skeleton_
42  * omit structs:
43  * omit prefixes:
44  * omit code:
45  * omit signals:
46  * imports:
47  * 	- glib.Str
48  * 	- gio.DBusInterfaceSkeleton
49  * 	- gio.DBusObjectT
50  * 	- gio.DBusObjectIF
51  * structWrap:
52  * 	- GDBusInterfaceSkeleton* -> DBusInterfaceSkeleton
53  * module aliases:
54  * local aliases:
55  * overrides:
56  */
57 
58 module gio.DBusObjectSkeleton;
59 
60 public  import gtkc.giotypes;
61 
62 private import gtkc.gio;
63 private import glib.ConstructionException;
64 private import gobject.ObjectG;
65 
66 private import gobject.Signals;
67 public  import gtkc.gdktypes;
68 private import glib.Str;
69 private import gio.DBusInterfaceSkeleton;
70 private import gio.DBusObjectT;
71 private import gio.DBusObjectIF;
72 
73 
74 private import gobject.ObjectG;
75 
76 /**
77  * A GDBusObjectSkeleton instance is essentially a group of D-Bus
78  * interfaces. The set of exported interfaces on the object may be
79  * dynamic and change at runtime.
80  *
81  * This type is intended to be used with GDBusObjectManager.
82  */
83 public class DBusObjectSkeleton : ObjectG, DBusObjectIF
84 {
85 	
86 	/** the main Gtk struct */
87 	protected GDBusObjectSkeleton* gDBusObjectSkeleton;
88 	
89 	
90 	/** Get the main Gtk struct */
91 	public GDBusObjectSkeleton* getDBusObjectSkeletonStruct()
92 	{
93 		return gDBusObjectSkeleton;
94 	}
95 	
96 	
97 	/** the main Gtk struct as a void* */
98 	protected override void* getStruct()
99 	{
100 		return cast(void*)gDBusObjectSkeleton;
101 	}
102 	
103 	/**
104 	 * Sets our main struct and passes it to the parent class
105 	 */
106 	public this (GDBusObjectSkeleton* gDBusObjectSkeleton)
107 	{
108 		super(cast(GObject*)gDBusObjectSkeleton);
109 		this.gDBusObjectSkeleton = gDBusObjectSkeleton;
110 	}
111 	
112 	protected override void setStruct(GObject* obj)
113 	{
114 		super.setStruct(obj);
115 		gDBusObjectSkeleton = cast(GDBusObjectSkeleton*)obj;
116 	}
117 	
118 	// add the DBusObject capabilities
119 	mixin DBusObjectT!(GDBusObjectSkeleton);
120 	
121 	/**
122 	 */
123 	int[string] connectedSignals;
124 	
125 	bool delegate(DBusInterfaceSkeleton, GDBusMethodInvocation*, DBusObjectSkeleton)[] onAuthorizeMethodListeners;
126 	/**
127 	 * Emitted when a method is invoked by a remote caller and used to
128 	 * determine if the method call is authorized.
129 	 * This signal is like GDBusInterfaceSkeleton's
130 	 * "g-authorize-method" signal, except that it is
131 	 * for the enclosing object.
132 	 * The default class handler just returns TRUE.
133 	 * TRUE if the call is authorized, FALSE otherwise.
134 	 * Since 2.30
135 	 */
136 	void addOnAuthorizeMethod(bool delegate(DBusInterfaceSkeleton, GDBusMethodInvocation*, DBusObjectSkeleton) dlg, ConnectFlags connectFlags=cast(ConnectFlags)0)
137 	{
138 		if ( !("authorize-method" in connectedSignals) )
139 		{
140 			Signals.connectData(
141 			getStruct(),
142 			"authorize-method",
143 			cast(GCallback)&callBackAuthorizeMethod,
144 			cast(void*)this,
145 			null,
146 			connectFlags);
147 			connectedSignals["authorize-method"] = 1;
148 		}
149 		onAuthorizeMethodListeners ~= dlg;
150 	}
151 	extern(C) static gboolean callBackAuthorizeMethod(GDBusObjectSkeleton* objectStruct, GDBusInterfaceSkeleton* iface, GDBusMethodInvocation* invocation, DBusObjectSkeleton _dBusObjectSkeleton)
152 	{
153 		foreach ( bool delegate(DBusInterfaceSkeleton, GDBusMethodInvocation*, DBusObjectSkeleton) dlg ; _dBusObjectSkeleton.onAuthorizeMethodListeners )
154 		{
155 			if ( dlg(ObjectG.getDObject!(DBusInterfaceSkeleton)(iface), invocation, _dBusObjectSkeleton) )
156 			{
157 				return 1;
158 			}
159 		}
160 		
161 		return 0;
162 	}
163 	
164 	
165 	/**
166 	 * Creates a new GDBusObjectSkeleton.
167 	 * Since 2.30
168 	 * Params:
169 	 * objectPath = An object path.
170 	 * Throws: ConstructionException GTK+ fails to create the object.
171 	 */
172 	public this (string objectPath)
173 	{
174 		// GDBusObjectSkeleton * g_dbus_object_skeleton_new (const gchar *object_path);
175 		auto p = g_dbus_object_skeleton_new(Str.toStringz(objectPath));
176 		if(p is null)
177 		{
178 			throw new ConstructionException("null returned by g_dbus_object_skeleton_new(Str.toStringz(objectPath))");
179 		}
180 		this(cast(GDBusObjectSkeleton*) p);
181 	}
182 	
183 	/**
184 	 * This method simply calls g_dbus_interface_skeleton_flush() on all
185 	 * interfaces belonging to object. See that method for when flushing
186 	 * is useful.
187 	 * Since 2.30
188 	 */
189 	public void flush()
190 	{
191 		// void g_dbus_object_skeleton_flush (GDBusObjectSkeleton *object);
192 		g_dbus_object_skeleton_flush(gDBusObjectSkeleton);
193 	}
194 	
195 	/**
196 	 * Adds interface_ to object.
197 	 * If object already contains a GDBusInterfaceSkeleton with the same
198 	 * interface name, it is removed before interface_ is added.
199 	 * Note that object takes its own reference on interface_ and holds
200 	 * it until removed.
201 	 * Since 2.30
202 	 */
203 	public void addInterface(DBusInterfaceSkeleton iface)
204 	{
205 		// void g_dbus_object_skeleton_add_interface  (GDBusObjectSkeleton *object,  GDBusInterfaceSkeleton *interface_);
206 		g_dbus_object_skeleton_add_interface(gDBusObjectSkeleton, (iface is null) ? null : iface.getDBusInterfaceSkeletonStruct());
207 	}
208 	
209 	/**
210 	 * Removes interface_ from object.
211 	 * Since 2.30
212 	 */
213 	public void removeInterface(DBusInterfaceSkeleton iface)
214 	{
215 		// void g_dbus_object_skeleton_remove_interface  (GDBusObjectSkeleton *object,  GDBusInterfaceSkeleton *interface_);
216 		g_dbus_object_skeleton_remove_interface(gDBusObjectSkeleton, (iface is null) ? null : iface.getDBusInterfaceSkeletonStruct());
217 	}
218 	
219 	/**
220 	 * Removes the GDBusInterface with interface_name from object.
221 	 * If no D-Bus interface of the given interface exists, this function
222 	 * does nothing.
223 	 * Since 2.30
224 	 * Params:
225 	 * interfaceName = A D-Bus interface name.
226 	 */
227 	public void removeInterfaceByName(string interfaceName)
228 	{
229 		// void g_dbus_object_skeleton_remove_interface_by_name  (GDBusObjectSkeleton *object,  const gchar *interface_name);
230 		g_dbus_object_skeleton_remove_interface_by_name(gDBusObjectSkeleton, Str.toStringz(interfaceName));
231 	}
232 	
233 	/**
234 	 * Sets the object path for object.
235 	 * Since 2.30
236 	 * Params:
237 	 * object = A GDBusObjectSkeleton.
238 	 * objectPath = A valid D-Bus object path.
239 	 */
240 	public void setObjectPath(string objectPath)
241 	{
242 		// void g_dbus_object_skeleton_set_object_path  (GDBusObjectSkeleton *object,  const gchar *object_path);
243 		g_dbus_object_skeleton_set_object_path(gDBusObjectSkeleton, Str.toStringz(objectPath));
244 	}
245 }