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.FileChooserWidget; 26 27 private import glib.ConstructionException; 28 private import glib.Str; 29 private import gobject.ObjectG; 30 private import gobject.Signals; 31 private import gtk.Box; 32 private import gtk.FileChooserIF; 33 private import gtk.FileChooserT; 34 private import gtk.Widget; 35 private import gtk.c.functions; 36 public import gtk.c.types; 37 public import gtkc.gtktypes; 38 private import std.algorithm; 39 40 41 /** 42 * #GtkFileChooserWidget is a widget for choosing files. 43 * It exposes the #GtkFileChooser interface, and you should 44 * use the methods of this interface to interact with the 45 * widget. 46 * 47 * # CSS nodes 48 * 49 * GtkFileChooserWidget has a single CSS node with name filechooser. 50 */ 51 public class FileChooserWidget : Box, FileChooserIF 52 { 53 /** the main Gtk struct */ 54 protected GtkFileChooserWidget* gtkFileChooserWidget; 55 56 /** Get the main Gtk struct */ 57 public GtkFileChooserWidget* getFileChooserWidgetStruct(bool transferOwnership = false) 58 { 59 if (transferOwnership) 60 ownedRef = false; 61 return gtkFileChooserWidget; 62 } 63 64 /** the main Gtk struct as a void* */ 65 protected override void* getStruct() 66 { 67 return cast(void*)gtkFileChooserWidget; 68 } 69 70 protected override void setStruct(GObject* obj) 71 { 72 gtkFileChooserWidget = cast(GtkFileChooserWidget*)obj; 73 super.setStruct(obj); 74 } 75 76 /** 77 * Sets our main struct and passes it to the parent class. 78 */ 79 public this (GtkFileChooserWidget* gtkFileChooserWidget, bool ownedRef = false) 80 { 81 this.gtkFileChooserWidget = gtkFileChooserWidget; 82 super(cast(GtkBox*)gtkFileChooserWidget, ownedRef); 83 } 84 85 // add the FileChooser capabilities 86 mixin FileChooserT!(GtkFileChooserWidget); 87 88 89 /** */ 90 public static GType getType() 91 { 92 return gtk_file_chooser_widget_get_type(); 93 } 94 95 /** 96 * Creates a new #GtkFileChooserWidget. This is a file chooser widget that can 97 * be embedded in custom windows, and it is the same widget that is used by 98 * #GtkFileChooserDialog. 99 * 100 * Params: 101 * action = Open or save mode for the widget 102 * 103 * Returns: a new #GtkFileChooserWidget 104 * 105 * Since: 2.4 106 * 107 * Throws: ConstructionException GTK+ fails to create the object. 108 */ 109 public this(GtkFileChooserAction action) 110 { 111 auto p = gtk_file_chooser_widget_new(action); 112 113 if(p is null) 114 { 115 throw new ConstructionException("null returned by new"); 116 } 117 118 this(cast(GtkFileChooserWidget*) p); 119 } 120 121 protected class OnDesktopFolderDelegateWrapper 122 { 123 void delegate(FileChooserWidget) dlg; 124 gulong handlerId; 125 126 this(void delegate(FileChooserWidget) dlg) 127 { 128 this.dlg = dlg; 129 onDesktopFolderListeners ~= this; 130 } 131 132 void remove(OnDesktopFolderDelegateWrapper source) 133 { 134 foreach(index, wrapper; onDesktopFolderListeners) 135 { 136 if (wrapper.handlerId == source.handlerId) 137 { 138 onDesktopFolderListeners[index] = null; 139 onDesktopFolderListeners = std.algorithm.remove(onDesktopFolderListeners, index); 140 break; 141 } 142 } 143 } 144 } 145 OnDesktopFolderDelegateWrapper[] onDesktopFolderListeners; 146 147 /** 148 * The ::desktop-folder signal is a [keybinding signal][GtkBindingSignal] 149 * which gets emitted when the user asks for it. 150 * 151 * This is used to make the file chooser show the user's Desktop 152 * folder in the file list. 153 * 154 * The default binding for this signal is `Alt + D`. 155 */ 156 gulong addOnDesktopFolder(void delegate(FileChooserWidget) dlg, ConnectFlags connectFlags=cast(ConnectFlags)0) 157 { 158 auto wrapper = new OnDesktopFolderDelegateWrapper(dlg); 159 wrapper.handlerId = Signals.connectData( 160 this, 161 "desktop-folder", 162 cast(GCallback)&callBackDesktopFolder, 163 cast(void*)wrapper, 164 cast(GClosureNotify)&callBackDesktopFolderDestroy, 165 connectFlags); 166 return wrapper.handlerId; 167 } 168 169 extern(C) static void callBackDesktopFolder(GtkFileChooserWidget* filechooserwidgetStruct, OnDesktopFolderDelegateWrapper wrapper) 170 { 171 wrapper.dlg(wrapper.outer); 172 } 173 174 extern(C) static void callBackDesktopFolderDestroy(OnDesktopFolderDelegateWrapper wrapper, GClosure* closure) 175 { 176 wrapper.remove(wrapper); 177 } 178 179 protected class OnDownFolderDelegateWrapper 180 { 181 void delegate(FileChooserWidget) dlg; 182 gulong handlerId; 183 184 this(void delegate(FileChooserWidget) dlg) 185 { 186 this.dlg = dlg; 187 onDownFolderListeners ~= this; 188 } 189 190 void remove(OnDownFolderDelegateWrapper source) 191 { 192 foreach(index, wrapper; onDownFolderListeners) 193 { 194 if (wrapper.handlerId == source.handlerId) 195 { 196 onDownFolderListeners[index] = null; 197 onDownFolderListeners = std.algorithm.remove(onDownFolderListeners, index); 198 break; 199 } 200 } 201 } 202 } 203 OnDownFolderDelegateWrapper[] onDownFolderListeners; 204 205 /** 206 * The ::down-folder signal is a [keybinding signal][GtkBindingSignal] 207 * which gets emitted when the user asks for it. 208 * 209 * This is used to make the file chooser go to a child of the current folder 210 * in the file hierarchy. The subfolder that will be used is displayed in the 211 * path bar widget of the file chooser. For example, if the path bar is showing 212 * "/foo/bar/baz", with bar currently displayed, then this will cause the file 213 * chooser to switch to the "baz" subfolder. 214 * 215 * The default binding for this signal is `Alt + Down`. 216 */ 217 gulong addOnDownFolder(void delegate(FileChooserWidget) dlg, ConnectFlags connectFlags=cast(ConnectFlags)0) 218 { 219 auto wrapper = new OnDownFolderDelegateWrapper(dlg); 220 wrapper.handlerId = Signals.connectData( 221 this, 222 "down-folder", 223 cast(GCallback)&callBackDownFolder, 224 cast(void*)wrapper, 225 cast(GClosureNotify)&callBackDownFolderDestroy, 226 connectFlags); 227 return wrapper.handlerId; 228 } 229 230 extern(C) static void callBackDownFolder(GtkFileChooserWidget* filechooserwidgetStruct, OnDownFolderDelegateWrapper wrapper) 231 { 232 wrapper.dlg(wrapper.outer); 233 } 234 235 extern(C) static void callBackDownFolderDestroy(OnDownFolderDelegateWrapper wrapper, GClosure* closure) 236 { 237 wrapper.remove(wrapper); 238 } 239 240 protected class OnHomeFolderDelegateWrapper 241 { 242 void delegate(FileChooserWidget) dlg; 243 gulong handlerId; 244 245 this(void delegate(FileChooserWidget) dlg) 246 { 247 this.dlg = dlg; 248 onHomeFolderListeners ~= this; 249 } 250 251 void remove(OnHomeFolderDelegateWrapper source) 252 { 253 foreach(index, wrapper; onHomeFolderListeners) 254 { 255 if (wrapper.handlerId == source.handlerId) 256 { 257 onHomeFolderListeners[index] = null; 258 onHomeFolderListeners = std.algorithm.remove(onHomeFolderListeners, index); 259 break; 260 } 261 } 262 } 263 } 264 OnHomeFolderDelegateWrapper[] onHomeFolderListeners; 265 266 /** 267 * The ::home-folder signal is a [keybinding signal][GtkBindingSignal] 268 * which gets emitted when the user asks for it. 269 * 270 * This is used to make the file chooser show the user's home 271 * folder in the file list. 272 * 273 * The default binding for this signal is `Alt + Home`. 274 */ 275 gulong addOnHomeFolder(void delegate(FileChooserWidget) dlg, ConnectFlags connectFlags=cast(ConnectFlags)0) 276 { 277 auto wrapper = new OnHomeFolderDelegateWrapper(dlg); 278 wrapper.handlerId = Signals.connectData( 279 this, 280 "home-folder", 281 cast(GCallback)&callBackHomeFolder, 282 cast(void*)wrapper, 283 cast(GClosureNotify)&callBackHomeFolderDestroy, 284 connectFlags); 285 return wrapper.handlerId; 286 } 287 288 extern(C) static void callBackHomeFolder(GtkFileChooserWidget* filechooserwidgetStruct, OnHomeFolderDelegateWrapper wrapper) 289 { 290 wrapper.dlg(wrapper.outer); 291 } 292 293 extern(C) static void callBackHomeFolderDestroy(OnHomeFolderDelegateWrapper wrapper, GClosure* closure) 294 { 295 wrapper.remove(wrapper); 296 } 297 298 protected class OnLocationPopupDelegateWrapper 299 { 300 void delegate(string, FileChooserWidget) dlg; 301 gulong handlerId; 302 303 this(void delegate(string, FileChooserWidget) dlg) 304 { 305 this.dlg = dlg; 306 onLocationPopupListeners ~= this; 307 } 308 309 void remove(OnLocationPopupDelegateWrapper source) 310 { 311 foreach(index, wrapper; onLocationPopupListeners) 312 { 313 if (wrapper.handlerId == source.handlerId) 314 { 315 onLocationPopupListeners[index] = null; 316 onLocationPopupListeners = std.algorithm.remove(onLocationPopupListeners, index); 317 break; 318 } 319 } 320 } 321 } 322 OnLocationPopupDelegateWrapper[] onLocationPopupListeners; 323 324 /** 325 * The ::location-popup signal is a [keybinding signal][GtkBindingSignal] 326 * which gets emitted when the user asks for it. 327 * 328 * This is used to make the file chooser show a "Location" prompt which 329 * the user can use to manually type the name of the file he wishes to select. 330 * 331 * The default bindings for this signal are `Control + L` with a @path string 332 * of "" (the empty string). It is also bound to `/` with a @path string of 333 * "`/`" (a slash): this lets you type `/` and immediately type a path name. 334 * On Unix systems, this is bound to `~` (tilde) with a @path string of "~" 335 * itself for access to home directories. 336 * 337 * Params: 338 * path = a string that gets put in the text entry for the file name 339 */ 340 gulong addOnLocationPopup(void delegate(string, FileChooserWidget) dlg, ConnectFlags connectFlags=cast(ConnectFlags)0) 341 { 342 auto wrapper = new OnLocationPopupDelegateWrapper(dlg); 343 wrapper.handlerId = Signals.connectData( 344 this, 345 "location-popup", 346 cast(GCallback)&callBackLocationPopup, 347 cast(void*)wrapper, 348 cast(GClosureNotify)&callBackLocationPopupDestroy, 349 connectFlags); 350 return wrapper.handlerId; 351 } 352 353 extern(C) static void callBackLocationPopup(GtkFileChooserWidget* filechooserwidgetStruct, char* path, OnLocationPopupDelegateWrapper wrapper) 354 { 355 wrapper.dlg(Str.toString(path), wrapper.outer); 356 } 357 358 extern(C) static void callBackLocationPopupDestroy(OnLocationPopupDelegateWrapper wrapper, GClosure* closure) 359 { 360 wrapper.remove(wrapper); 361 } 362 363 protected class OnLocationPopupOnPasteDelegateWrapper 364 { 365 void delegate(FileChooserWidget) dlg; 366 gulong handlerId; 367 368 this(void delegate(FileChooserWidget) dlg) 369 { 370 this.dlg = dlg; 371 onLocationPopupOnPasteListeners ~= this; 372 } 373 374 void remove(OnLocationPopupOnPasteDelegateWrapper source) 375 { 376 foreach(index, wrapper; onLocationPopupOnPasteListeners) 377 { 378 if (wrapper.handlerId == source.handlerId) 379 { 380 onLocationPopupOnPasteListeners[index] = null; 381 onLocationPopupOnPasteListeners = std.algorithm.remove(onLocationPopupOnPasteListeners, index); 382 break; 383 } 384 } 385 } 386 } 387 OnLocationPopupOnPasteDelegateWrapper[] onLocationPopupOnPasteListeners; 388 389 /** 390 * The ::location-popup-on-paste signal is a [keybinding signal][GtkBindingSignal] 391 * which gets emitted when the user asks for it. 392 * 393 * This is used to make the file chooser show a "Location" prompt when the user 394 * pastes into a #GtkFileChooserWidget. 395 * 396 * The default binding for this signal is `Control + V`. 397 */ 398 gulong addOnLocationPopupOnPaste(void delegate(FileChooserWidget) dlg, ConnectFlags connectFlags=cast(ConnectFlags)0) 399 { 400 auto wrapper = new OnLocationPopupOnPasteDelegateWrapper(dlg); 401 wrapper.handlerId = Signals.connectData( 402 this, 403 "location-popup-on-paste", 404 cast(GCallback)&callBackLocationPopupOnPaste, 405 cast(void*)wrapper, 406 cast(GClosureNotify)&callBackLocationPopupOnPasteDestroy, 407 connectFlags); 408 return wrapper.handlerId; 409 } 410 411 extern(C) static void callBackLocationPopupOnPaste(GtkFileChooserWidget* filechooserwidgetStruct, OnLocationPopupOnPasteDelegateWrapper wrapper) 412 { 413 wrapper.dlg(wrapper.outer); 414 } 415 416 extern(C) static void callBackLocationPopupOnPasteDestroy(OnLocationPopupOnPasteDelegateWrapper wrapper, GClosure* closure) 417 { 418 wrapper.remove(wrapper); 419 } 420 421 protected class OnLocationTogglePopupDelegateWrapper 422 { 423 void delegate(FileChooserWidget) dlg; 424 gulong handlerId; 425 426 this(void delegate(FileChooserWidget) dlg) 427 { 428 this.dlg = dlg; 429 onLocationTogglePopupListeners ~= this; 430 } 431 432 void remove(OnLocationTogglePopupDelegateWrapper source) 433 { 434 foreach(index, wrapper; onLocationTogglePopupListeners) 435 { 436 if (wrapper.handlerId == source.handlerId) 437 { 438 onLocationTogglePopupListeners[index] = null; 439 onLocationTogglePopupListeners = std.algorithm.remove(onLocationTogglePopupListeners, index); 440 break; 441 } 442 } 443 } 444 } 445 OnLocationTogglePopupDelegateWrapper[] onLocationTogglePopupListeners; 446 447 /** 448 * The ::location-toggle-popup signal is a [keybinding signal][GtkBindingSignal] 449 * which gets emitted when the user asks for it. 450 * 451 * This is used to toggle the visibility of a "Location" prompt which the user 452 * can use to manually type the name of the file he wishes to select. 453 * 454 * The default binding for this signal is `Control + L`. 455 */ 456 gulong addOnLocationTogglePopup(void delegate(FileChooserWidget) dlg, ConnectFlags connectFlags=cast(ConnectFlags)0) 457 { 458 auto wrapper = new OnLocationTogglePopupDelegateWrapper(dlg); 459 wrapper.handlerId = Signals.connectData( 460 this, 461 "location-toggle-popup", 462 cast(GCallback)&callBackLocationTogglePopup, 463 cast(void*)wrapper, 464 cast(GClosureNotify)&callBackLocationTogglePopupDestroy, 465 connectFlags); 466 return wrapper.handlerId; 467 } 468 469 extern(C) static void callBackLocationTogglePopup(GtkFileChooserWidget* filechooserwidgetStruct, OnLocationTogglePopupDelegateWrapper wrapper) 470 { 471 wrapper.dlg(wrapper.outer); 472 } 473 474 extern(C) static void callBackLocationTogglePopupDestroy(OnLocationTogglePopupDelegateWrapper wrapper, GClosure* closure) 475 { 476 wrapper.remove(wrapper); 477 } 478 479 protected class OnPlacesShortcutDelegateWrapper 480 { 481 void delegate(FileChooserWidget) dlg; 482 gulong handlerId; 483 484 this(void delegate(FileChooserWidget) dlg) 485 { 486 this.dlg = dlg; 487 onPlacesShortcutListeners ~= this; 488 } 489 490 void remove(OnPlacesShortcutDelegateWrapper source) 491 { 492 foreach(index, wrapper; onPlacesShortcutListeners) 493 { 494 if (wrapper.handlerId == source.handlerId) 495 { 496 onPlacesShortcutListeners[index] = null; 497 onPlacesShortcutListeners = std.algorithm.remove(onPlacesShortcutListeners, index); 498 break; 499 } 500 } 501 } 502 } 503 OnPlacesShortcutDelegateWrapper[] onPlacesShortcutListeners; 504 505 /** 506 * The ::places-shortcut signal is a [keybinding signal][GtkBindingSignal] 507 * which gets emitted when the user asks for it. 508 * 509 * This is used to move the focus to the places sidebar. 510 * 511 * The default binding for this signal is `Alt + P`. 512 */ 513 gulong addOnPlacesShortcut(void delegate(FileChooserWidget) dlg, ConnectFlags connectFlags=cast(ConnectFlags)0) 514 { 515 auto wrapper = new OnPlacesShortcutDelegateWrapper(dlg); 516 wrapper.handlerId = Signals.connectData( 517 this, 518 "places-shortcut", 519 cast(GCallback)&callBackPlacesShortcut, 520 cast(void*)wrapper, 521 cast(GClosureNotify)&callBackPlacesShortcutDestroy, 522 connectFlags); 523 return wrapper.handlerId; 524 } 525 526 extern(C) static void callBackPlacesShortcut(GtkFileChooserWidget* filechooserwidgetStruct, OnPlacesShortcutDelegateWrapper wrapper) 527 { 528 wrapper.dlg(wrapper.outer); 529 } 530 531 extern(C) static void callBackPlacesShortcutDestroy(OnPlacesShortcutDelegateWrapper wrapper, GClosure* closure) 532 { 533 wrapper.remove(wrapper); 534 } 535 536 protected class OnQuickBookmarkDelegateWrapper 537 { 538 void delegate(int, FileChooserWidget) dlg; 539 gulong handlerId; 540 541 this(void delegate(int, FileChooserWidget) dlg) 542 { 543 this.dlg = dlg; 544 onQuickBookmarkListeners ~= this; 545 } 546 547 void remove(OnQuickBookmarkDelegateWrapper source) 548 { 549 foreach(index, wrapper; onQuickBookmarkListeners) 550 { 551 if (wrapper.handlerId == source.handlerId) 552 { 553 onQuickBookmarkListeners[index] = null; 554 onQuickBookmarkListeners = std.algorithm.remove(onQuickBookmarkListeners, index); 555 break; 556 } 557 } 558 } 559 } 560 OnQuickBookmarkDelegateWrapper[] onQuickBookmarkListeners; 561 562 /** 563 * The ::quick-bookmark signal is a [keybinding signal][GtkBindingSignal] 564 * which gets emitted when the user asks for it. 565 * 566 * This is used to make the file chooser switch to the bookmark specified 567 * in the @bookmark_index parameter. For example, if you have three bookmarks, 568 * you can pass 0, 1, 2 to this signal to switch to each of them, respectively. 569 * 570 * The default binding for this signal is `Alt + 1`, `Alt + 2`, 571 * etc. until `Alt + 0`. Note that in the default binding, that 572 * `Alt + 1` is actually defined to switch to the bookmark at index 573 * 0, and so on successively; `Alt + 0` is defined to switch to the 574 * bookmark at index 10. 575 * 576 * Params: 577 * bookmarkIndex = the number of the bookmark to switch to 578 */ 579 gulong addOnQuickBookmark(void delegate(int, FileChooserWidget) dlg, ConnectFlags connectFlags=cast(ConnectFlags)0) 580 { 581 auto wrapper = new OnQuickBookmarkDelegateWrapper(dlg); 582 wrapper.handlerId = Signals.connectData( 583 this, 584 "quick-bookmark", 585 cast(GCallback)&callBackQuickBookmark, 586 cast(void*)wrapper, 587 cast(GClosureNotify)&callBackQuickBookmarkDestroy, 588 connectFlags); 589 return wrapper.handlerId; 590 } 591 592 extern(C) static void callBackQuickBookmark(GtkFileChooserWidget* filechooserwidgetStruct, int bookmarkIndex, OnQuickBookmarkDelegateWrapper wrapper) 593 { 594 wrapper.dlg(bookmarkIndex, wrapper.outer); 595 } 596 597 extern(C) static void callBackQuickBookmarkDestroy(OnQuickBookmarkDelegateWrapper wrapper, GClosure* closure) 598 { 599 wrapper.remove(wrapper); 600 } 601 602 protected class OnRecentShortcutDelegateWrapper 603 { 604 void delegate(FileChooserWidget) dlg; 605 gulong handlerId; 606 607 this(void delegate(FileChooserWidget) dlg) 608 { 609 this.dlg = dlg; 610 onRecentShortcutListeners ~= this; 611 } 612 613 void remove(OnRecentShortcutDelegateWrapper source) 614 { 615 foreach(index, wrapper; onRecentShortcutListeners) 616 { 617 if (wrapper.handlerId == source.handlerId) 618 { 619 onRecentShortcutListeners[index] = null; 620 onRecentShortcutListeners = std.algorithm.remove(onRecentShortcutListeners, index); 621 break; 622 } 623 } 624 } 625 } 626 OnRecentShortcutDelegateWrapper[] onRecentShortcutListeners; 627 628 /** 629 * The ::recent-shortcut signal is a [keybinding signal][GtkBindingSignal] 630 * which gets emitted when the user asks for it. 631 * 632 * This is used to make the file chooser show the Recent location. 633 * 634 * The default binding for this signal is `Alt + R`. 635 */ 636 gulong addOnRecentShortcut(void delegate(FileChooserWidget) dlg, ConnectFlags connectFlags=cast(ConnectFlags)0) 637 { 638 auto wrapper = new OnRecentShortcutDelegateWrapper(dlg); 639 wrapper.handlerId = Signals.connectData( 640 this, 641 "recent-shortcut", 642 cast(GCallback)&callBackRecentShortcut, 643 cast(void*)wrapper, 644 cast(GClosureNotify)&callBackRecentShortcutDestroy, 645 connectFlags); 646 return wrapper.handlerId; 647 } 648 649 extern(C) static void callBackRecentShortcut(GtkFileChooserWidget* filechooserwidgetStruct, OnRecentShortcutDelegateWrapper wrapper) 650 { 651 wrapper.dlg(wrapper.outer); 652 } 653 654 extern(C) static void callBackRecentShortcutDestroy(OnRecentShortcutDelegateWrapper wrapper, GClosure* closure) 655 { 656 wrapper.remove(wrapper); 657 } 658 659 protected class OnSearchShortcutDelegateWrapper 660 { 661 void delegate(FileChooserWidget) dlg; 662 gulong handlerId; 663 664 this(void delegate(FileChooserWidget) dlg) 665 { 666 this.dlg = dlg; 667 onSearchShortcutListeners ~= this; 668 } 669 670 void remove(OnSearchShortcutDelegateWrapper source) 671 { 672 foreach(index, wrapper; onSearchShortcutListeners) 673 { 674 if (wrapper.handlerId == source.handlerId) 675 { 676 onSearchShortcutListeners[index] = null; 677 onSearchShortcutListeners = std.algorithm.remove(onSearchShortcutListeners, index); 678 break; 679 } 680 } 681 } 682 } 683 OnSearchShortcutDelegateWrapper[] onSearchShortcutListeners; 684 685 /** 686 * The ::search-shortcut signal is a [keybinding signal][GtkBindingSignal] 687 * which gets emitted when the user asks for it. 688 * 689 * This is used to make the file chooser show the search entry. 690 * 691 * The default binding for this signal is `Alt + S`. 692 */ 693 gulong addOnSearchShortcut(void delegate(FileChooserWidget) dlg, ConnectFlags connectFlags=cast(ConnectFlags)0) 694 { 695 auto wrapper = new OnSearchShortcutDelegateWrapper(dlg); 696 wrapper.handlerId = Signals.connectData( 697 this, 698 "search-shortcut", 699 cast(GCallback)&callBackSearchShortcut, 700 cast(void*)wrapper, 701 cast(GClosureNotify)&callBackSearchShortcutDestroy, 702 connectFlags); 703 return wrapper.handlerId; 704 } 705 706 extern(C) static void callBackSearchShortcut(GtkFileChooserWidget* filechooserwidgetStruct, OnSearchShortcutDelegateWrapper wrapper) 707 { 708 wrapper.dlg(wrapper.outer); 709 } 710 711 extern(C) static void callBackSearchShortcutDestroy(OnSearchShortcutDelegateWrapper wrapper, GClosure* closure) 712 { 713 wrapper.remove(wrapper); 714 } 715 716 protected class OnShowHiddenDelegateWrapper 717 { 718 void delegate(FileChooserWidget) dlg; 719 gulong handlerId; 720 721 this(void delegate(FileChooserWidget) dlg) 722 { 723 this.dlg = dlg; 724 onShowHiddenListeners ~= this; 725 } 726 727 void remove(OnShowHiddenDelegateWrapper source) 728 { 729 foreach(index, wrapper; onShowHiddenListeners) 730 { 731 if (wrapper.handlerId == source.handlerId) 732 { 733 onShowHiddenListeners[index] = null; 734 onShowHiddenListeners = std.algorithm.remove(onShowHiddenListeners, index); 735 break; 736 } 737 } 738 } 739 } 740 OnShowHiddenDelegateWrapper[] onShowHiddenListeners; 741 742 /** 743 * The ::show-hidden signal is a [keybinding signal][GtkBindingSignal] 744 * which gets emitted when the user asks for it. 745 * 746 * This is used to make the file chooser display hidden files. 747 * 748 * The default binding for this signal is `Control + H`. 749 */ 750 gulong addOnShowHidden(void delegate(FileChooserWidget) dlg, ConnectFlags connectFlags=cast(ConnectFlags)0) 751 { 752 auto wrapper = new OnShowHiddenDelegateWrapper(dlg); 753 wrapper.handlerId = Signals.connectData( 754 this, 755 "show-hidden", 756 cast(GCallback)&callBackShowHidden, 757 cast(void*)wrapper, 758 cast(GClosureNotify)&callBackShowHiddenDestroy, 759 connectFlags); 760 return wrapper.handlerId; 761 } 762 763 extern(C) static void callBackShowHidden(GtkFileChooserWidget* filechooserwidgetStruct, OnShowHiddenDelegateWrapper wrapper) 764 { 765 wrapper.dlg(wrapper.outer); 766 } 767 768 extern(C) static void callBackShowHiddenDestroy(OnShowHiddenDelegateWrapper wrapper, GClosure* closure) 769 { 770 wrapper.remove(wrapper); 771 } 772 773 protected class OnUpFolderDelegateWrapper 774 { 775 void delegate(FileChooserWidget) dlg; 776 gulong handlerId; 777 778 this(void delegate(FileChooserWidget) dlg) 779 { 780 this.dlg = dlg; 781 onUpFolderListeners ~= this; 782 } 783 784 void remove(OnUpFolderDelegateWrapper source) 785 { 786 foreach(index, wrapper; onUpFolderListeners) 787 { 788 if (wrapper.handlerId == source.handlerId) 789 { 790 onUpFolderListeners[index] = null; 791 onUpFolderListeners = std.algorithm.remove(onUpFolderListeners, index); 792 break; 793 } 794 } 795 } 796 } 797 OnUpFolderDelegateWrapper[] onUpFolderListeners; 798 799 /** 800 * The ::up-folder signal is a [keybinding signal][GtkBindingSignal] 801 * which gets emitted when the user asks for it. 802 * 803 * This is used to make the file chooser go to the parent of the current folder 804 * in the file hierarchy. 805 * 806 * The default binding for this signal is `Alt + Up`. 807 */ 808 gulong addOnUpFolder(void delegate(FileChooserWidget) dlg, ConnectFlags connectFlags=cast(ConnectFlags)0) 809 { 810 auto wrapper = new OnUpFolderDelegateWrapper(dlg); 811 wrapper.handlerId = Signals.connectData( 812 this, 813 "up-folder", 814 cast(GCallback)&callBackUpFolder, 815 cast(void*)wrapper, 816 cast(GClosureNotify)&callBackUpFolderDestroy, 817 connectFlags); 818 return wrapper.handlerId; 819 } 820 821 extern(C) static void callBackUpFolder(GtkFileChooserWidget* filechooserwidgetStruct, OnUpFolderDelegateWrapper wrapper) 822 { 823 wrapper.dlg(wrapper.outer); 824 } 825 826 extern(C) static void callBackUpFolderDestroy(OnUpFolderDelegateWrapper wrapper, GClosure* closure) 827 { 828 wrapper.remove(wrapper); 829 } 830 }