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