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 module gtk.Application;
26 
27 private import gio.ActionGroupIF;
28 private import gio.ActionGroupT;
29 private import gio.ActionMapIF;
30 private import gio.ActionMapT;
31 private import gio.Application : GioApplication = Application;
32 private import gio.Menu;
33 private import gio.MenuModel;
34 private import glib.ConstructionException;
35 private import glib.ListG;
36 private import glib.Str;
37 private import glib.Variant;
38 private import gobject.ObjectG;
39 private import gobject.Signals;
40 private import gtk.Window;
41 public  import gtkc.gdktypes;
42 private import gtkc.gtk;
43 public  import gtkc.gtktypes;
44 
45 
46 /**
47  * #GtkApplication is a class that handles many important aspects
48  * of a GTK+ application in a convenient fashion, without enforcing
49  * a one-size-fits-all application model.
50  * 
51  * Currently, GtkApplication handles GTK+ initialization, application
52  * uniqueness, session management, provides some basic scriptability and
53  * desktop shell integration by exporting actions and menus and manages a
54  * list of toplevel windows whose life-cycle is automatically tied to the
55  * life-cycle of your application.
56  * 
57  * While GtkApplication works fine with plain #GtkWindows, it is recommended
58  * to use it together with #GtkApplicationWindow.
59  * 
60  * When GDK threads are enabled, GtkApplication will acquire the GDK
61  * lock when invoking actions that arrive from other processes.  The GDK
62  * lock is not touched for local action invocations.  In order to have
63  * actions invoked in a predictable context it is therefore recommended
64  * that the GDK lock be held while invoking actions locally with
65  * g_action_group_activate_action().  The same applies to actions
66  * associated with #GtkApplicationWindow and to the “activate” and
67  * 'open' #GApplication methods.
68  * 
69  * ## Automatic resources ## {#automatic-resources}
70  * 
71  * #GtkApplication will automatically load menus from the #GtkBuilder
72  * file located at "gtk/menus.ui", relative to the application's
73  * resource base path (see g_application_set_resource_base_path()).  The
74  * menu with the ID "app-menu" is taken as the application's app menu
75  * and the menu with the ID "menubar" is taken as the application's
76  * menubar.  Additional menus (most interesting submenus) can be named
77  * and accessed via gtk_application_get_menu_by_id() which allows for
78  * dynamic population of a part of the menu structure.
79  * 
80  * If the files "gtk/menus-appmenu.ui" or "gtk/menus-traditional.ui" are
81  * present then these files will be used in preference, depending on the
82  * value of gtk_application_prefers_app_menu().
83  * 
84  * It is also possible to provide the menus manually using
85  * gtk_application_set_app_menu() and gtk_application_set_menubar().
86  * 
87  * #GtkApplication will also automatically setup an icon search path for
88  * the default icon theme by appending "icons" to the resource base
89  * path.  This allows your application to easily store its icons as
90  * resources.  See gtk_icon_theme_add_resource_path() for more
91  * information.
92  * 
93  * ## A simple application ## {#gtkapplication}
94  * 
95  * [A simple example](https://git.gnome.org/browse/gtk+/tree/examples/bp/bloatpad.c)
96  * 
97  * GtkApplication optionally registers with a session manager
98  * of the users session (if you set the #GtkApplication:register-session
99  * property) and offers various functionality related to the session
100  * life-cycle.
101  * 
102  * An application can block various ways to end the session with
103  * the gtk_application_inhibit() function. Typical use cases for
104  * this kind of inhibiting are long-running, uninterruptible operations,
105  * such as burning a CD or performing a disk backup. The session
106  * manager may not honor the inhibitor, but it can be expected to
107  * inform the user about the negative consequences of ending the
108  * session while inhibitors are present.
109  */
110 public class Application : GioApplication
111 {
112 	/** the main Gtk struct */
113 	protected GtkApplication* gtkApplication;
114 
115 	/** Get the main Gtk struct */
116 	public GtkApplication* getGtkApplicationStruct()
117 	{
118 		return gtkApplication;
119 	}
120 
121 	/** the main Gtk struct as a void* */
122 	protected override void* getStruct()
123 	{
124 		return cast(void*)gtkApplication;
125 	}
126 
127 	protected override void setStruct(GObject* obj)
128 	{
129 		gtkApplication = cast(GtkApplication*)obj;
130 		super.setStruct(obj);
131 	}
132 
133 	/**
134 	 * Sets our main struct and passes it to the parent class.
135 	 */
136 	public this (GtkApplication* gtkApplication, bool ownedRef = false)
137 	{
138 		this.gtkApplication = gtkApplication;
139 		super(cast(GApplication*)gtkApplication, ownedRef);
140 	}
141 
142 	/**
143 	 */
144 
145 	public static GType getType()
146 	{
147 		return gtk_application_get_type();
148 	}
149 
150 	/**
151 	 * Creates a new #GtkApplication instance.
152 	 *
153 	 * When using #GtkApplication, it is not necessary to call gtk_init()
154 	 * manually. It is called as soon as the application gets registered as
155 	 * the primary instance.
156 	 *
157 	 * Concretely, gtk_init() is called in the default handler for the
158 	 * #GApplication::startup signal. Therefore, #GtkApplication subclasses should
159 	 * chain up in their #GApplication::startup handler before using any GTK+ API.
160 	 *
161 	 * Note that commandline arguments are not passed to gtk_init().
162 	 * All GTK+ functionality that is available via commandline arguments
163 	 * can also be achieved by setting suitable environment variables
164 	 * such as `G_DEBUG`, so this should not be a big
165 	 * problem. If you absolutely must support GTK+ commandline arguments,
166 	 * you can explicitly call gtk_init() before creating the application
167 	 * instance.
168 	 *
169 	 * If non-%NULL, the application ID must be valid.  See
170 	 * g_application_id_is_valid().
171 	 *
172 	 * If no application ID is given then some features (most notably application
173 	 * uniqueness) will be disabled. A null application ID is only allowed with
174 	 * GTK+ 3.6 or later.
175 	 *
176 	 * Params:
177 	 *     applicationId = The application ID.
178 	 *     flags = the application flags
179 	 *
180 	 * Return: a new #GtkApplication instance
181 	 *
182 	 * Since: 3.0
183 	 *
184 	 * Throws: ConstructionException GTK+ fails to create the object.
185 	 */
186 	public this(string applicationId, GApplicationFlags flags)
187 	{
188 		auto p = gtk_application_new(Str.toStringz(applicationId), flags);
189 		
190 		if(p is null)
191 		{
192 			throw new ConstructionException("null returned by new");
193 		}
194 		
195 		this(cast(GtkApplication*) p, true);
196 	}
197 
198 	/**
199 	 * Installs an accelerator that will cause the named action
200 	 * to be activated when the key combination specificed by @accelerator
201 	 * is pressed.
202 	 *
203 	 * @accelerator must be a string that can be parsed by gtk_accelerator_parse(),
204 	 * e.g. "<Primary>q" or “<Control><Alt>p”.
205 	 *
206 	 * @action_name must be the name of an action as it would be used
207 	 * in the app menu, i.e. actions that have been added to the application
208 	 * are referred to with an “app.” prefix, and window-specific actions
209 	 * with a “win.” prefix.
210 	 *
211 	 * GtkApplication also extracts accelerators out of “accel” attributes
212 	 * in the #GMenuModels passed to gtk_application_set_app_menu() and
213 	 * gtk_application_set_menubar(), which is usually more convenient
214 	 * than calling this function for each accelerator.
215 	 *
216 	 * Deprecated: Use gtk_application_set_accels_for_action() instead
217 	 *
218 	 * Params:
219 	 *     accelerator = accelerator string
220 	 *     actionName = the name of the action to activate
221 	 *     parameter = parameter to pass when activating the action,
222 	 *         or %NULL if the action does not accept an activation parameter
223 	 *
224 	 * Since: 3.4
225 	 */
226 	public void addAccelerator(string accelerator, string actionName, Variant parameter)
227 	{
228 		gtk_application_add_accelerator(gtkApplication, Str.toStringz(accelerator), Str.toStringz(actionName), (parameter is null) ? null : parameter.getVariantStruct());
229 	}
230 
231 	/**
232 	 * Adds a window to @application.
233 	 *
234 	 * This call is equivalent to setting the #GtkWindow:application
235 	 * property of @window to @application.
236 	 *
237 	 * Normally, the connection between the application and the window
238 	 * will remain until the window is destroyed, but you can explicitly
239 	 * remove it with gtk_application_remove_window().
240 	 *
241 	 * GTK+ will keep the application running as long as it has
242 	 * any windows.
243 	 *
244 	 * Params:
245 	 *     window = a #GtkWindow
246 	 *
247 	 * Since: 3.0
248 	 */
249 	public void addWindow(Window window)
250 	{
251 		gtk_application_add_window(gtkApplication, (window is null) ? null : window.getWindowStruct());
252 	}
253 
254 	/**
255 	 * Gets the accelerators that are currently associated with
256 	 * the given action.
257 	 *
258 	 * Params:
259 	 *     detailedActionName = a detailed action name, specifying an action
260 	 *         and target to obtain accelerators for
261 	 *
262 	 * Return: accelerators for @detailed_action_name, as
263 	 *     a %NULL-terminated array. Free with g_strfreev() when no longer needed
264 	 *
265 	 * Since: 3.12
266 	 */
267 	public string[] getAccelsForAction(string detailedActionName)
268 	{
269 		return Str.toStringArray(gtk_application_get_accels_for_action(gtkApplication, Str.toStringz(detailedActionName)));
270 	}
271 
272 	/**
273 	 * Returns the list of actions (possibly empty) that @accel maps to.
274 	 * Each item in the list is a detailed action name in the usual form.
275 	 *
276 	 * This might be useful to discover if an accel already exists in
277 	 * order to prevent installation of a conflicting accelerator (from
278 	 * an accelerator editor or a plugin system, for example). Note that
279 	 * having more than one action per accelerator may not be a bad thing
280 	 * and might make sense in cases where the actions never appear in the
281 	 * same context.
282 	 *
283 	 * In case there are no actions for a given accelerator, an empty array
284 	 * is returned.  %NULL is never returned.
285 	 *
286 	 * It is a programmer error to pass an invalid accelerator string.
287 	 * If you are unsure, check it with gtk_accelerator_parse() first.
288 	 *
289 	 * Params:
290 	 *     accel = an accelerator that can be parsed by gtk_accelerator_parse()
291 	 *
292 	 * Return: a %NULL-terminated array of actions for @accel
293 	 *
294 	 * Since: 3.14
295 	 */
296 	public string[] getActionsForAccel(string accel)
297 	{
298 		return Str.toStringArray(gtk_application_get_actions_for_accel(gtkApplication, Str.toStringz(accel)));
299 	}
300 
301 	/**
302 	 * Gets the “active” window for the application.
303 	 *
304 	 * The active window is the one that was most recently focused (within
305 	 * the application).  This window may not have the focus at the moment
306 	 * if another application has it -- this is just the most
307 	 * recently-focused window within this application.
308 	 *
309 	 * Return: the active window
310 	 *
311 	 * Since: 3.6
312 	 */
313 	public Window getActiveWindow()
314 	{
315 		auto p = gtk_application_get_active_window(gtkApplication);
316 		
317 		if(p is null)
318 		{
319 			return null;
320 		}
321 		
322 		return ObjectG.getDObject!(Window)(cast(GtkWindow*) p);
323 	}
324 
325 	/**
326 	 * Returns the menu model that has been set with
327 	 * gtk_application_set_app_menu().
328 	 *
329 	 * Return: the application menu of @application
330 	 *
331 	 * Since: 3.4
332 	 */
333 	public MenuModel getAppMenu()
334 	{
335 		auto p = gtk_application_get_app_menu(gtkApplication);
336 		
337 		if(p is null)
338 		{
339 			return null;
340 		}
341 		
342 		return ObjectG.getDObject!(MenuModel)(cast(GMenuModel*) p);
343 	}
344 
345 	/**
346 	 * Gets a menu from automatically loaded resources.
347 	 * See [Automatic resources][automatic-resources]
348 	 * for more information.
349 	 *
350 	 * Params:
351 	 *     id = the id of the menu to look up
352 	 *
353 	 * Return: Gets the menu with the
354 	 *     given id from the automatically loaded resources
355 	 *
356 	 * Since: 3.14
357 	 */
358 	public Menu getMenuById(string id)
359 	{
360 		auto p = gtk_application_get_menu_by_id(gtkApplication, Str.toStringz(id));
361 		
362 		if(p is null)
363 		{
364 			return null;
365 		}
366 		
367 		return ObjectG.getDObject!(Menu)(cast(GMenu*) p);
368 	}
369 
370 	/**
371 	 * Returns the menu model that has been set with
372 	 * gtk_application_set_menubar().
373 	 *
374 	 * Return: the menubar for windows of @application
375 	 *
376 	 * Since: 3.4
377 	 */
378 	public MenuModel getMenubar()
379 	{
380 		auto p = gtk_application_get_menubar(gtkApplication);
381 		
382 		if(p is null)
383 		{
384 			return null;
385 		}
386 		
387 		return ObjectG.getDObject!(MenuModel)(cast(GMenuModel*) p);
388 	}
389 
390 	/**
391 	 * Returns the #GtkApplicationWindow with the given ID.
392 	 *
393 	 * Params:
394 	 *     id = an identifier number
395 	 *
396 	 * Return: the window with ID @id, or
397 	 *     %NULL if there is no window with this ID
398 	 *
399 	 * Since: 3.6
400 	 */
401 	public Window getWindowById(uint id)
402 	{
403 		auto p = gtk_application_get_window_by_id(gtkApplication, id);
404 		
405 		if(p is null)
406 		{
407 			return null;
408 		}
409 		
410 		return ObjectG.getDObject!(Window)(cast(GtkWindow*) p);
411 	}
412 
413 	/**
414 	 * Gets a list of the #GtkWindows associated with @application.
415 	 *
416 	 * The list is sorted by most recently focused window, such that the first
417 	 * element is the currently focused window. (Useful for choosing a parent
418 	 * for a transient window.)
419 	 *
420 	 * The list that is returned should not be modified in any way. It will
421 	 * only remain valid until the next focus change or window creation or
422 	 * deletion.
423 	 *
424 	 * Return: a #GList of #GtkWindow
425 	 *
426 	 * Since: 3.0
427 	 */
428 	public ListG getWindows()
429 	{
430 		auto p = gtk_application_get_windows(gtkApplication);
431 		
432 		if(p is null)
433 		{
434 			return null;
435 		}
436 		
437 		return new ListG(cast(GList*) p);
438 	}
439 
440 	/**
441 	 * Inform the session manager that certain types of actions should be
442 	 * inhibited. This is not guaranteed to work on all platforms and for
443 	 * all types of actions.
444 	 *
445 	 * Applications should invoke this method when they begin an operation
446 	 * that should not be interrupted, such as creating a CD or DVD. The
447 	 * types of actions that may be blocked are specified by the @flags
448 	 * parameter. When the application completes the operation it should
449 	 * call gtk_application_uninhibit() to remove the inhibitor. Note that
450 	 * an application can have multiple inhibitors, and all of the must
451 	 * be individually removed. Inhibitors are also cleared when the
452 	 * application exits.
453 	 *
454 	 * Applications should not expect that they will always be able to block
455 	 * the action. In most cases, users will be given the option to force
456 	 * the action to take place.
457 	 *
458 	 * Reasons should be short and to the point.
459 	 *
460 	 * If @window is given, the session manager may point the user to
461 	 * this window to find out more about why the action is inhibited.
462 	 *
463 	 * Params:
464 	 *     window = a #GtkWindow, or %NULL
465 	 *     flags = what types of actions should be inhibited
466 	 *     reason = a short, human-readable string that explains
467 	 *         why these operations are inhibited
468 	 *
469 	 * Return: A non-zero cookie that is used to uniquely identify this
470 	 *     request. It should be used as an argument to gtk_application_uninhibit()
471 	 *     in order to remove the request. If the platform does not support
472 	 *     inhibiting or the request failed for some reason, 0 is returned.
473 	 *
474 	 * Since: 3.4
475 	 */
476 	public uint inhibit(Window window, GtkApplicationInhibitFlags flags, string reason)
477 	{
478 		return gtk_application_inhibit(gtkApplication, (window is null) ? null : window.getWindowStruct(), flags, Str.toStringz(reason));
479 	}
480 
481 	/**
482 	 * Determines if any of the actions specified in @flags are
483 	 * currently inhibited (possibly by another application).
484 	 *
485 	 * Params:
486 	 *     flags = what types of actions should be queried
487 	 *
488 	 * Return: %TRUE if any of the actions specified in @flags are inhibited
489 	 *
490 	 * Since: 3.4
491 	 */
492 	public bool isInhibited(GtkApplicationInhibitFlags flags)
493 	{
494 		return gtk_application_is_inhibited(gtkApplication, flags) != 0;
495 	}
496 
497 	/**
498 	 * Lists the detailed action names which have associated accelerators.
499 	 * See gtk_application_set_accels_for_action().
500 	 *
501 	 * Return: a %NULL-terminated array of strings,
502 	 *     free with g_strfreev() when done
503 	 *
504 	 * Since: 3.12
505 	 */
506 	public string[] listActionDescriptions()
507 	{
508 		return Str.toStringArray(gtk_application_list_action_descriptions(gtkApplication));
509 	}
510 
511 	/**
512 	 * Determines if the desktop environment in which the application is
513 	 * running would prefer an application menu be shown.
514 	 *
515 	 * If this function returns %TRUE then the application should call
516 	 * gtk_application_set_app_menu() with the contents of an application
517 	 * menu, which will be shown by the desktop environment.  If it returns
518 	 * %FALSE then you should consider using an alternate approach, such as
519 	 * a menubar.
520 	 *
521 	 * The value returned by this function is purely advisory and you are
522 	 * free to ignore it.  If you call gtk_application_set_app_menu() even
523 	 * if the desktop environment doesn't support app menus, then a fallback
524 	 * will be provided.
525 	 *
526 	 * Applications are similarly free not to set an app menu even if the
527 	 * desktop environment wants to show one.  In that case, a fallback will
528 	 * also be created by the desktop environment (GNOME, for example, uses
529 	 * a menu with only a "Quit" item in it).
530 	 *
531 	 * The value returned by this function never changes.  Once it returns a
532 	 * particular value, it is guaranteed to always return the same value.
533 	 *
534 	 * You may only call this function after the application has been
535 	 * registered and after the base startup handler has run.  You're most
536 	 * likely to want to use this from your own startup handler.  It may
537 	 * also make sense to consult this function while constructing UI (in
538 	 * activate, open or an action activation handler) in order to determine
539 	 * if you should show a gear menu or not.
540 	 *
541 	 * This function will return %FALSE on Mac OS and a default app menu
542 	 * will be created automatically with the "usual" contents of that menu
543 	 * typical to most Mac OS applications.  If you call
544 	 * gtk_application_set_app_menu() anyway, then this menu will be
545 	 * replaced with your own.
546 	 *
547 	 * Return: %TRUE if you should set an app menu
548 	 *
549 	 * Since: 3.14
550 	 */
551 	public bool prefersAppMenu()
552 	{
553 		return gtk_application_prefers_app_menu(gtkApplication) != 0;
554 	}
555 
556 	/**
557 	 * Removes an accelerator that has been previously added
558 	 * with gtk_application_add_accelerator().
559 	 *
560 	 * Deprecated: Use gtk_application_set_accels_for_action() instead
561 	 *
562 	 * Params:
563 	 *     actionName = the name of the action to activate
564 	 *     parameter = parameter to pass when activating the action,
565 	 *         or %NULL if the action does not accept an activation parameter
566 	 *
567 	 * Since: 3.4
568 	 */
569 	public void removeAccelerator(string actionName, Variant parameter)
570 	{
571 		gtk_application_remove_accelerator(gtkApplication, Str.toStringz(actionName), (parameter is null) ? null : parameter.getVariantStruct());
572 	}
573 
574 	/**
575 	 * Remove a window from @application.
576 	 *
577 	 * If @window belongs to @application then this call is equivalent to
578 	 * setting the #GtkWindow:application property of @window to
579 	 * %NULL.
580 	 *
581 	 * The application may stop running as a result of a call to this
582 	 * function.
583 	 *
584 	 * Params:
585 	 *     window = a #GtkWindow
586 	 *
587 	 * Since: 3.0
588 	 */
589 	public void removeWindow(Window window)
590 	{
591 		gtk_application_remove_window(gtkApplication, (window is null) ? null : window.getWindowStruct());
592 	}
593 
594 	/**
595 	 * Sets zero or more keyboard accelerators that will trigger the
596 	 * given action. The first item in @accels will be the primary
597 	 * accelerator, which may be displayed in the UI.
598 	 *
599 	 * To remove all accelerators for an action, use an empty, zero-terminated
600 	 * array for @accels.
601 	 *
602 	 * Params:
603 	 *     detailedActionName = a detailed action name, specifying an action
604 	 *         and target to associate accelerators with
605 	 *     accels = a list of accelerators in the format understood by
606 	 *         gtk_accelerator_parse()
607 	 *
608 	 * Since: 3.12
609 	 */
610 	public void setAccelsForAction(string detailedActionName, string[] accels)
611 	{
612 		gtk_application_set_accels_for_action(gtkApplication, Str.toStringz(detailedActionName), Str.toStringzArray(accels));
613 	}
614 
615 	/**
616 	 * Sets or unsets the application menu for @application.
617 	 *
618 	 * This can only be done in the primary instance of the application,
619 	 * after it has been registered.  #GApplication::startup is a good place
620 	 * to call this.
621 	 *
622 	 * The application menu is a single menu containing items that typically
623 	 * impact the application as a whole, rather than acting on a specific
624 	 * window or document.  For example, you would expect to see
625 	 * “Preferences” or “Quit” in an application menu, but not “Save” or
626 	 * “Print”.
627 	 *
628 	 * If supported, the application menu will be rendered by the desktop
629 	 * environment.
630 	 *
631 	 * Use the base #GActionMap interface to add actions, to respond to the user
632 	 * selecting these menu items.
633 	 *
634 	 * Params:
635 	 *     appMenu = a #GMenuModel, or %NULL
636 	 *
637 	 * Since: 3.4
638 	 */
639 	public void setAppMenu(MenuModel appMenu)
640 	{
641 		gtk_application_set_app_menu(gtkApplication, (appMenu is null) ? null : appMenu.getMenuModelStruct());
642 	}
643 
644 	/**
645 	 * Sets or unsets the menubar for windows of @application.
646 	 *
647 	 * This is a menubar in the traditional sense.
648 	 *
649 	 * This can only be done in the primary instance of the application,
650 	 * after it has been registered.  #GApplication::startup is a good place
651 	 * to call this.
652 	 *
653 	 * Depending on the desktop environment, this may appear at the top of
654 	 * each window, or at the top of the screen.  In some environments, if
655 	 * both the application menu and the menubar are set, the application
656 	 * menu will be presented as if it were the first item of the menubar.
657 	 * Other environments treat the two as completely separate -- for
658 	 * example, the application menu may be rendered by the desktop shell
659 	 * while the menubar (if set) remains in each individual window.
660 	 *
661 	 * Use the base #GActionMap interface to add actions, to respond to the user
662 	 * selecting these menu items.
663 	 *
664 	 * Params:
665 	 *     menubar = a #GMenuModel, or %NULL
666 	 *
667 	 * Since: 3.4
668 	 */
669 	public void setMenubar(MenuModel menubar)
670 	{
671 		gtk_application_set_menubar(gtkApplication, (menubar is null) ? null : menubar.getMenuModelStruct());
672 	}
673 
674 	/**
675 	 * Removes an inhibitor that has been established with gtk_application_inhibit().
676 	 * Inhibitors are also cleared when the application exits.
677 	 *
678 	 * Params:
679 	 *     cookie = a cookie that was returned by gtk_application_inhibit()
680 	 *
681 	 * Since: 3.4
682 	 */
683 	public void uninhibit(uint cookie)
684 	{
685 		gtk_application_uninhibit(gtkApplication, cookie);
686 	}
687 
688 	int[string] connectedSignals;
689 
690 	void delegate(Window, Application)[] onWindowAddedListeners;
691 	/**
692 	 * Emitted when a #GtkWindow is added to @application through
693 	 * gtk_application_add_window().
694 	 *
695 	 * Params:
696 	 *     window = the newly-added #GtkWindow
697 	 *
698 	 * Since: 3.2
699 	 */
700 	void addOnWindowAdded(void delegate(Window, Application) dlg, ConnectFlags connectFlags=cast(ConnectFlags)0)
701 	{
702 		if ( "window-added" !in connectedSignals )
703 		{
704 			Signals.connectData(
705 				this,
706 				"window-added",
707 				cast(GCallback)&callBackWindowAdded,
708 				cast(void*)this,
709 				null,
710 				connectFlags);
711 			connectedSignals["window-added"] = 1;
712 		}
713 		onWindowAddedListeners ~= dlg;
714 	}
715 	extern(C) static void callBackWindowAdded(GtkApplication* applicationStruct, GtkWindow* window, Application _application)
716 	{
717 		foreach ( void delegate(Window, Application) dlg; _application.onWindowAddedListeners )
718 		{
719 			dlg(ObjectG.getDObject!(Window)(window), _application);
720 		}
721 	}
722 
723 	void delegate(Window, Application)[] onWindowRemovedListeners;
724 	/**
725 	 * Emitted when a #GtkWindow is removed from @application,
726 	 * either as a side-effect of being destroyed or explicitly
727 	 * through gtk_application_remove_window().
728 	 *
729 	 * Params:
730 	 *     window = the #GtkWindow that is being removed
731 	 *
732 	 * Since: 3.2
733 	 */
734 	void addOnWindowRemoved(void delegate(Window, Application) dlg, ConnectFlags connectFlags=cast(ConnectFlags)0)
735 	{
736 		if ( "window-removed" !in connectedSignals )
737 		{
738 			Signals.connectData(
739 				this,
740 				"window-removed",
741 				cast(GCallback)&callBackWindowRemoved,
742 				cast(void*)this,
743 				null,
744 				connectFlags);
745 			connectedSignals["window-removed"] = 1;
746 		}
747 		onWindowRemovedListeners ~= dlg;
748 	}
749 	extern(C) static void callBackWindowRemoved(GtkApplication* applicationStruct, GtkWindow* window, Application _application)
750 	{
751 		foreach ( void delegate(Window, Application) dlg; _application.onWindowRemovedListeners )
752 		{
753 			dlg(ObjectG.getDObject!(Window)(window), _application);
754 		}
755 	}
756 }