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