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