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  = GDBusObjectManagerServer.html
27  * outPack = gio
28  * outFile = DBusObjectManagerServer
29  * strct   = GDBusObjectManagerServer
30  * realStrct=
31  * ctorStrct=
32  * clss    = DBusObjectManagerServer
33  * interf  = 
34  * class Code: Yes
35  * interface Code: No
36  * template for:
37  * extend  = 
38  * implements:
39  * 	- DBusObjectManagerIF
40  * prefixes:
41  * 	- g_dbus_object_manager_server_
42  * omit structs:
43  * omit prefixes:
44  * omit code:
45  * omit signals:
46  * imports:
47  * 	- glib.Str
48  * 	- gio.DBusConnection
49  * 	- gio.DBusObjectSkeleton
50  * 	- gio.DBusObjectManagerT
51  * 	- gio.DBusObjectManagerIF
52  * structWrap:
53  * 	- GDBusConnection* -> DBusConnection
54  * 	- GDBusObjectSkeleton* -> DBusObjectSkeleton
55  * module aliases:
56  * local aliases:
57  * overrides:
58  */
59 
60 module gio.DBusObjectManagerServer;
61 
62 public  import gtkc.giotypes;
63 
64 private import gtkc.gio;
65 private import glib.ConstructionException;
66 private import gobject.ObjectG;
67 
68 private import glib.Str;
69 private import gio.DBusConnection;
70 private import gio.DBusObjectSkeleton;
71 private import gio.DBusObjectManagerT;
72 private import gio.DBusObjectManagerIF;
73 
74 
75 private import gobject.ObjectG;
76 
77 /**
78  * GDBusObjectManagerServer is used to export GDBusObject instances using
79  * the standardized org.freedesktop.DBus.ObjectManager
80  * interface. For example, remote D-Bus clients can get all objects
81  * and properties in a single call. Additionally, any change in the
82  * object hierarchy is broadcast using signals. This means that D-Bus
83  * clients can keep caches up to date by only listening to D-Bus
84  * signals.
85  *
86  * See GDBusObjectManagerClient for the client-side code that is
87  * intended to be used with GDBusObjectManagerServer or any D-Bus
88  * object implementing the org.freedesktop.DBus.ObjectManager
89  * interface.
90  */
91 public class DBusObjectManagerServer : ObjectG, DBusObjectManagerIF
92 {
93 	
94 	/** the main Gtk struct */
95 	protected GDBusObjectManagerServer* gDBusObjectManagerServer;
96 	
97 	
98 	/** Get the main Gtk struct */
99 	public GDBusObjectManagerServer* getDBusObjectManagerServerStruct()
100 	{
101 		return gDBusObjectManagerServer;
102 	}
103 	
104 	
105 	/** the main Gtk struct as a void* */
106 	protected override void* getStruct()
107 	{
108 		return cast(void*)gDBusObjectManagerServer;
109 	}
110 	
111 	/**
112 	 * Sets our main struct and passes it to the parent class
113 	 */
114 	public this (GDBusObjectManagerServer* gDBusObjectManagerServer)
115 	{
116 		super(cast(GObject*)gDBusObjectManagerServer);
117 		this.gDBusObjectManagerServer = gDBusObjectManagerServer;
118 	}
119 	
120 	protected override void setStruct(GObject* obj)
121 	{
122 		super.setStruct(obj);
123 		gDBusObjectManagerServer = cast(GDBusObjectManagerServer*)obj;
124 	}
125 	
126 	// add the DBusObjectManager capabilities
127 	mixin DBusObjectManagerT!(GDBusObjectManagerServer);
128 	
129 	/**
130 	 */
131 	
132 	/**
133 	 * Creates a new GDBusObjectManagerServer object.
134 	 * The returned server isn't yet exported on any connection. To do so,
135 	 * use g_dbus_object_manager_server_set_connection(). Normally you
136 	 * want to export all of your objects before doing so to avoid InterfacesAdded
137 	 * signals being emitted.
138 	 * Since 2.30
139 	 * Params:
140 	 * objectPath = The object path to export the manager object at.
141 	 * Throws: ConstructionException GTK+ fails to create the object.
142 	 */
143 	public this (string objectPath)
144 	{
145 		// GDBusObjectManagerServer * g_dbus_object_manager_server_new  (const gchar *object_path);
146 		auto p = g_dbus_object_manager_server_new(Str.toStringz(objectPath));
147 		if(p is null)
148 		{
149 			throw new ConstructionException("null returned by g_dbus_object_manager_server_new(Str.toStringz(objectPath))");
150 		}
151 		this(cast(GDBusObjectManagerServer*) p);
152 	}
153 	
154 	/**
155 	 * Gets the GDBusConnection used by manager.
156 	 * Since 2.30
157 	 * Returns: A GDBusConnection object or NULL if manager isn't exported on a connection. The returned object should be freed with g_object_unref(). [transfer full]
158 	 */
159 	public DBusConnection getConnection()
160 	{
161 		// GDBusConnection * g_dbus_object_manager_server_get_connection  (GDBusObjectManagerServer *manager);
162 		auto p = g_dbus_object_manager_server_get_connection(gDBusObjectManagerServer);
163 		
164 		if(p is null)
165 		{
166 			return null;
167 		}
168 		
169 		return ObjectG.getDObject!(DBusConnection)(cast(GDBusConnection*) p);
170 	}
171 	
172 	/**
173 	 * Exports all objects managed by manager on connection. If
174 	 * connection is NULL, stops exporting objects.
175 	 * Params:
176 	 * connection = A GDBusConnection or NULL. [allow-none]
177 	 */
178 	public void setConnection(DBusConnection connection)
179 	{
180 		// void g_dbus_object_manager_server_set_connection  (GDBusObjectManagerServer *manager,  GDBusConnection *connection);
181 		g_dbus_object_manager_server_set_connection(gDBusObjectManagerServer, (connection is null) ? null : connection.getDBusConnectionStruct());
182 	}
183 	
184 	/**
185 	 * Exports object on manager.
186 	 * If there is already a GDBusObject exported at the object path,
187 	 * then the old object is removed.
188 	 * The object path for object must be in the hierarchy rooted by the
189 	 * object path for manager.
190 	 * Note that manager will take a reference on object for as long as
191 	 * it is exported.
192 	 * Since 2.30
193 	 * Params:
194 	 * object = A GDBusObjectSkeleton.
195 	 */
196 	public void expor(DBusObjectSkeleton object)
197 	{
198 		// void g_dbus_object_manager_server_export (GDBusObjectManagerServer *manager,  GDBusObjectSkeleton *object);
199 		g_dbus_object_manager_server_export(gDBusObjectManagerServer, (object is null) ? null : object.getDBusObjectSkeletonStruct());
200 	}
201 	
202 	/**
203 	 * Like g_dbus_object_manager_server_export() but appends a string of
204 	 * the form _N (with N being a natural number) to
205 	 * object's object path if an object with the given path
206 	 * already exists. As such, the "g-object-path" property
207 	 * of object may be modified.
208 	 * Since 2.30
209 	 * Params:
210 	 * object = An object.
211 	 */
212 	public void exportUniquely(DBusObjectSkeleton object)
213 	{
214 		// void g_dbus_object_manager_server_export_uniquely  (GDBusObjectManagerServer *manager,  GDBusObjectSkeleton *object);
215 		g_dbus_object_manager_server_export_uniquely(gDBusObjectManagerServer, (object is null) ? null : object.getDBusObjectSkeletonStruct());
216 	}
217 	
218 	/**
219 	 * Returns whether object is currently exported on manager.
220 	 * Since 2.34
221 	 * Params:
222 	 * object = An object.
223 	 * Returns: TRUE if object is exported
224 	 */
225 	public int isExported(DBusObjectSkeleton object)
226 	{
227 		// gboolean g_dbus_object_manager_server_is_exported  (GDBusObjectManagerServer *manager,  GDBusObjectSkeleton *object);
228 		return g_dbus_object_manager_server_is_exported(gDBusObjectManagerServer, (object is null) ? null : object.getDBusObjectSkeletonStruct());
229 	}
230 	
231 	/**
232 	 * If manager has an object at path, removes the object. Otherwise
233 	 * does nothing.
234 	 * Note that object_path must be in the hierarchy rooted by the
235 	 * object path for manager.
236 	 * Since 2.30
237 	 * Params:
238 	 * objectPath = An object path.
239 	 * Returns: TRUE if object at object_path was removed, FALSE otherwise.
240 	 */
241 	public int unexport(string objectPath)
242 	{
243 		// gboolean g_dbus_object_manager_server_unexport  (GDBusObjectManagerServer *manager,  const gchar *object_path);
244 		return g_dbus_object_manager_server_unexport(gDBusObjectManagerServer, Str.toStringz(objectPath));
245 	}
246 }