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