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  = gio-Owning-Bus-Names.html
27  * outPack = gio
28  * outFile = DBusNames
29  * strct   = 
30  * realStrct=
31  * ctorStrct=
32  * clss    = DBusNames
33  * interf  = 
34  * class Code: No
35  * interface Code: No
36  * template for:
37  * extend  = 
38  * implements:
39  * prefixes:
40  * 	- g_bus_
41  * omit structs:
42  * omit prefixes:
43  * omit code:
44  * omit signals:
45  * imports:
46  * 	- glib.Str
47  * 	- gobject.Closure
48  * 	- gio.DBusConnection
49  * structWrap:
50  * 	- GClosure* -> Closure
51  * 	- GDBusConnection* -> DBusConnection
52  * module aliases:
53  * local aliases:
54  * overrides:
55  */
56 
57 module gio.DBusNames;
58 
59 public  import gtkc.giotypes;
60 
61 private import gtkc.gio;
62 private import glib.ConstructionException;
63 private import gobject.ObjectG;
64 
65 
66 private import glib.Str;
67 private import gobject.Closure;
68 private import gio.DBusConnection;
69 
70 
71 
72 
73 /**
74  * Description
75  * Convenience API for owning bus names.
76  * $(DDOC_COMMENT example)
77  */
78 public class DBusNames
79 {
80 	
81 	/**
82 	 * Description
83 	 * Convenience API for watching bus names.
84 	 * $(DDOC_COMMENT example)
85 	 */
86 	
87 	/**
88 	 * Starts acquiring name on the bus specified by bus_type and calls
89 	 * name_acquired_handler and name_lost_handler when the name is
90 	 * acquired respectively lost. Callbacks will be invoked in the thread-default main
91 	 * loop of the thread you are calling this function from.
92 	 * You are guaranteed that one of the name_acquired_handler and name_lost_handler
93 	 * callbacks will be invoked after calling this function - there are three
94 	 * Since 2.26
95 	 * Params:
96 	 * busType = The type of bus to own a name on.
97 	 * name = The well-known name to own.
98 	 * flags = A set of flags from the GBusNameOwnerFlags enumeration.
99 	 * busAcquiredHandler = Handler to invoke when connected to the bus of type bus_type or NULL.
100 	 * nameAcquiredHandler = Handler to invoke when name is acquired or NULL.
101 	 * nameLostHandler = Handler to invoke when name is lost or NULL.
102 	 * userData = User data to pass to handlers.
103 	 * userDataFreeFunc = Function for freeing user_data or NULL.
104 	 * Returns: An identifier (never 0) that an be used with g_bus_unown_name() to stop owning the name.
105 	 */
106 	public static uint ownName(GBusType busType, string name, GBusNameOwnerFlags flags, GBusAcquiredCallback busAcquiredHandler, GBusNameAcquiredCallback nameAcquiredHandler, GBusNameLostCallback nameLostHandler, void* userData, GDestroyNotify userDataFreeFunc)
107 	{
108 		// guint g_bus_own_name (GBusType bus_type,  const gchar *name,  GBusNameOwnerFlags flags,  GBusAcquiredCallback bus_acquired_handler,  GBusNameAcquiredCallback name_acquired_handler,  GBusNameLostCallback name_lost_handler,  gpointer user_data,  GDestroyNotify user_data_free_func);
109 		return g_bus_own_name(busType, Str.toStringz(name), flags, busAcquiredHandler, nameAcquiredHandler, nameLostHandler, userData, userDataFreeFunc);
110 	}
111 	
112 	/**
113 	 * Like g_bus_own_name() but takes a GDBusConnection instead of a
114 	 * GBusType.
115 	 * Since 2.26
116 	 * Params:
117 	 * connection = A GDBusConnection.
118 	 * name = The well-known name to own.
119 	 * flags = A set of flags from the GBusNameOwnerFlags enumeration.
120 	 * nameAcquiredHandler = Handler to invoke when name is acquired or NULL.
121 	 * nameLostHandler = Handler to invoke when name is lost or NULL.
122 	 * userData = User data to pass to handlers.
123 	 * userDataFreeFunc = Function for freeing user_data or NULL.
124 	 * Returns: An identifier (never 0) that an be used with g_bus_unown_name() to stop owning the name.
125 	 */
126 	public static uint ownNameOnConnection(DBusConnection connection, string name, GBusNameOwnerFlags flags, GBusNameAcquiredCallback nameAcquiredHandler, GBusNameLostCallback nameLostHandler, void* userData, GDestroyNotify userDataFreeFunc)
127 	{
128 		// guint g_bus_own_name_on_connection (GDBusConnection *connection,  const gchar *name,  GBusNameOwnerFlags flags,  GBusNameAcquiredCallback name_acquired_handler,  GBusNameLostCallback name_lost_handler,  gpointer user_data,  GDestroyNotify user_data_free_func);
129 		return g_bus_own_name_on_connection((connection is null) ? null : connection.getDBusConnectionStruct(), Str.toStringz(name), flags, nameAcquiredHandler, nameLostHandler, userData, userDataFreeFunc);
130 	}
131 	
132 	/**
133 	 * Stops owning a name.
134 	 * Since 2.26
135 	 * Params:
136 	 * ownerId = An identifier obtained from g_bus_own_name()
137 	 */
138 	public static void unownName(uint ownerId)
139 	{
140 		// void g_bus_unown_name (guint owner_id);
141 		g_bus_unown_name(ownerId);
142 	}
143 	
144 	/**
145 	 * Version of g_bus_own_name() using closures instead of callbacks for
146 	 * easier binding in other languages.
147 	 * Since 2.26
148 	 * Params:
149 	 * busType = The type of bus to own a name on.
150 	 * name = The well-known name to own.
151 	 * flags = A set of flags from the GBusNameOwnerFlags enumeration.
152 	 * busAcquiredClosure = GClosure to invoke when connected to
153 	 * the bus of type bus_type or NULL. [allow-none]
154 	 * nameAcquiredClosure = GClosure to invoke when name is
155 	 * acquired or NULL. [allow-none]
156 	 * nameLostClosure = GClosure to invoke when name is lost or
157 	 * NULL. [allow-none]
158 	 * Returns: An identifier (never 0) that an be used with g_bus_unown_name() to stop owning the name. Rename to: g_bus_own_name
159 	 */
160 	public static uint ownNameWithClosures(GBusType busType, string name, GBusNameOwnerFlags flags, Closure busAcquiredClosure, Closure nameAcquiredClosure, Closure nameLostClosure)
161 	{
162 		// guint g_bus_own_name_with_closures (GBusType bus_type,  const gchar *name,  GBusNameOwnerFlags flags,  GClosure *bus_acquired_closure,  GClosure *name_acquired_closure,  GClosure *name_lost_closure);
163 		return g_bus_own_name_with_closures(busType, Str.toStringz(name), flags, (busAcquiredClosure is null) ? null : busAcquiredClosure.getClosureStruct(), (nameAcquiredClosure is null) ? null : nameAcquiredClosure.getClosureStruct(), (nameLostClosure is null) ? null : nameLostClosure.getClosureStruct());
164 	}
165 	
166 	/**
167 	 * Version of g_bus_own_name_on_connection() using closures instead of callbacks for
168 	 * easier binding in other languages.
169 	 * Since 2.26
170 	 * Params:
171 	 * connection = A GDBusConnection.
172 	 * name = The well-known name to own.
173 	 * flags = A set of flags from the GBusNameOwnerFlags enumeration.
174 	 * nameAcquiredClosure = GClosure to invoke when name is
175 	 * acquired or NULL. [allow-none]
176 	 * nameLostClosure = GClosure to invoke when name is lost or
177 	 * NULL. [allow-none]
178 	 * Returns: An identifier (never 0) that an be used with g_bus_unown_name() to stop owning the name. Rename to: g_bus_own_name_on_connection
179 	 */
180 	public static uint ownNameOnConnectionWithClosures(DBusConnection connection, string name, GBusNameOwnerFlags flags, Closure nameAcquiredClosure, Closure nameLostClosure)
181 	{
182 		// guint g_bus_own_name_on_connection_with_closures  (GDBusConnection *connection,  const gchar *name,  GBusNameOwnerFlags flags,  GClosure *name_acquired_closure,  GClosure *name_lost_closure);
183 		return g_bus_own_name_on_connection_with_closures((connection is null) ? null : connection.getDBusConnectionStruct(), Str.toStringz(name), flags, (nameAcquiredClosure is null) ? null : nameAcquiredClosure.getClosureStruct(), (nameLostClosure is null) ? null : nameLostClosure.getClosureStruct());
184 	}
185 	
186 	/**
187 	 * Starts watching name on the bus specified by bus_type and calls
188 	 * name_appeared_handler and name_vanished_handler when the name is
189 	 * known to have a owner respectively known to lose its
190 	 * owner. Callbacks will be invoked in the thread-default main
191 	 * loop of the thread you are calling this function from.
192 	 * You are guaranteed that one of the handlers will be invoked after
193 	 * calling this function. When you are done watching the name, just
194 	 * call g_bus_unwatch_name() with the watcher id this function
195 	 * returns.
196 	 * If the name vanishes or appears (for example the application owning
197 	 * the name could restart), the handlers are also invoked. If the
198 	 * GDBusConnection that is used for watching the name disconnects, then
199 	 * name_vanished_handler is invoked since it is no longer
200 	 * possible to access the name.
201 	 * Another guarantee is that invocations of name_appeared_handler
202 	 * and name_vanished_handler are guaranteed to alternate; that
203 	 * is, if name_appeared_handler is invoked then you are
204 	 * guaranteed that the next time one of the handlers is invoked, it
205 	 * will be name_vanished_handler. The reverse is also true.
206 	 * This behavior makes it very simple to write applications that wants
207 	 * to take action when a certain name exists, see Example 9, “Simple application watching a name”. Basically, the application
208 	 * should create object proxies in name_appeared_handler and destroy
209 	 * them again (if any) in name_vanished_handler.
210 	 * Since 2.26
211 	 * Params:
212 	 * busType = The type of bus to watch a name on.
213 	 * name = The name (well-known or unique) to watch.
214 	 * flags = Flags from the GBusNameWatcherFlags enumeration.
215 	 * nameAppearedHandler = Handler to invoke when name is known to exist or NULL.
216 	 * nameVanishedHandler = Handler to invoke when name is known to not exist or NULL.
217 	 * userData = User data to pass to handlers.
218 	 * userDataFreeFunc = Function for freeing user_data or NULL.
219 	 * Returns: An identifier (never 0) that an be used with g_bus_unwatch_name() to stop watching the name.
220 	 */
221 	public static uint watchName(GBusType busType, string name, GBusNameWatcherFlags flags, GBusNameAppearedCallback nameAppearedHandler, GBusNameVanishedCallback nameVanishedHandler, void* userData, GDestroyNotify userDataFreeFunc)
222 	{
223 		// guint g_bus_watch_name (GBusType bus_type,  const gchar *name,  GBusNameWatcherFlags flags,  GBusNameAppearedCallback name_appeared_handler,  GBusNameVanishedCallback name_vanished_handler,  gpointer user_data,  GDestroyNotify user_data_free_func);
224 		return g_bus_watch_name(busType, Str.toStringz(name), flags, nameAppearedHandler, nameVanishedHandler, userData, userDataFreeFunc);
225 	}
226 	
227 	/**
228 	 * Like g_bus_watch_name() but takes a GDBusConnection instead of a
229 	 * GBusType.
230 	 * Since 2.26
231 	 * Params:
232 	 * connection = A GDBusConnection.
233 	 * name = The name (well-known or unique) to watch.
234 	 * flags = Flags from the GBusNameWatcherFlags enumeration.
235 	 * nameAppearedHandler = Handler to invoke when name is known to exist or NULL.
236 	 * nameVanishedHandler = Handler to invoke when name is known to not exist or NULL.
237 	 * userData = User data to pass to handlers.
238 	 * userDataFreeFunc = Function for freeing user_data or NULL.
239 	 * Returns: An identifier (never 0) that an be used with g_bus_unwatch_name() to stop watching the name.
240 	 */
241 	public static uint watchNameOnConnection(DBusConnection connection, string name, GBusNameWatcherFlags flags, GBusNameAppearedCallback nameAppearedHandler, GBusNameVanishedCallback nameVanishedHandler, void* userData, GDestroyNotify userDataFreeFunc)
242 	{
243 		// guint g_bus_watch_name_on_connection (GDBusConnection *connection,  const gchar *name,  GBusNameWatcherFlags flags,  GBusNameAppearedCallback name_appeared_handler,  GBusNameVanishedCallback name_vanished_handler,  gpointer user_data,  GDestroyNotify user_data_free_func);
244 		return g_bus_watch_name_on_connection((connection is null) ? null : connection.getDBusConnectionStruct(), Str.toStringz(name), flags, nameAppearedHandler, nameVanishedHandler, userData, userDataFreeFunc);
245 	}
246 	
247 	/**
248 	 * Stops watching a name.
249 	 * Since 2.26
250 	 * Params:
251 	 * watcherId = An identifier obtained from g_bus_watch_name()
252 	 */
253 	public static void unwatchName(uint watcherId)
254 	{
255 		// void g_bus_unwatch_name (guint watcher_id);
256 		g_bus_unwatch_name(watcherId);
257 	}
258 	
259 	/**
260 	 * Version of g_bus_watch_name() using closures instead of callbacks for
261 	 * easier binding in other languages.
262 	 * Since 2.26
263 	 * Params:
264 	 * busType = The type of bus to watch a name on.
265 	 * name = The name (well-known or unique) to watch.
266 	 * flags = Flags from the GBusNameWatcherFlags enumeration.
267 	 * nameAppearedClosure = GClosure to invoke when name is known
268 	 * to exist or NULL. [allow-none]
269 	 * nameVanishedClosure = GClosure to invoke when name is known
270 	 * to not exist or NULL. [allow-none]
271 	 * Returns: An identifier (never 0) that an be used with g_bus_unwatch_name() to stop watching the name. Rename to: g_bus_watch_name
272 	 */
273 	public static uint watchNameWithClosures(GBusType busType, string name, GBusNameWatcherFlags flags, Closure nameAppearedClosure, Closure nameVanishedClosure)
274 	{
275 		// guint g_bus_watch_name_with_closures (GBusType bus_type,  const gchar *name,  GBusNameWatcherFlags flags,  GClosure *name_appeared_closure,  GClosure *name_vanished_closure);
276 		return g_bus_watch_name_with_closures(busType, Str.toStringz(name), flags, (nameAppearedClosure is null) ? null : nameAppearedClosure.getClosureStruct(), (nameVanishedClosure is null) ? null : nameVanishedClosure.getClosureStruct());
277 	}
278 	
279 	/**
280 	 * Version of g_bus_watch_name_on_connection() using closures instead of callbacks for
281 	 * easier binding in other languages.
282 	 * Since 2.26
283 	 * Params:
284 	 * connection = A GDBusConnection.
285 	 * name = The name (well-known or unique) to watch.
286 	 * flags = Flags from the GBusNameWatcherFlags enumeration.
287 	 * nameAppearedClosure = GClosure to invoke when name is known
288 	 * to exist or NULL. [allow-none]
289 	 * nameVanishedClosure = GClosure to invoke when name is known
290 	 * to not exist or NULL. [allow-none]
291 	 * Returns: An identifier (never 0) that an be used with g_bus_unwatch_name() to stop watching the name. Rename to: g_bus_watch_name_on_connection
292 	 */
293 	public static uint watchNameOnConnectionWithClosures(DBusConnection connection, string name, GBusNameWatcherFlags flags, Closure nameAppearedClosure, Closure nameVanishedClosure)
294 	{
295 		// guint g_bus_watch_name_on_connection_with_closures  (GDBusConnection *connection,  const gchar *name,  GBusNameWatcherFlags flags,  GClosure *name_appeared_closure,  GClosure *name_vanished_closure);
296 		return g_bus_watch_name_on_connection_with_closures((connection is null) ? null : connection.getDBusConnectionStruct(), Str.toStringz(name), flags, (nameAppearedClosure is null) ? null : nameAppearedClosure.getClosureStruct(), (nameVanishedClosure is null) ? null : nameVanishedClosure.getClosureStruct());
297 	}
298 }