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 * Conversion parameters: 26 * inFile = GtkFileChooser.html 27 * outPack = gtk 28 * outFile = FileChooserIF 29 * strct = GtkFileChooser 30 * realStrct= 31 * ctorStrct= 32 * clss = FileChooserT 33 * interf = FileChooserIF 34 * class Code: No 35 * interface Code: No 36 * template for: 37 * extend = 38 * implements: 39 * prefixes: 40 * - gtk_file_chooser_ 41 * omit structs: 42 * omit prefixes: 43 * omit code: 44 * omit signals: 45 * imports: 46 * - glib.Str 47 * - glib.ErrorG 48 * - glib.GException 49 * - gio.File 50 * - glib.ListSG 51 * - gtk.FileFilter 52 * - gtk.Widget 53 * structWrap: 54 * - GFile* -> File 55 * - GSList* -> ListSG 56 * - GtkFileFilter* -> FileFilter 57 * - GtkWidget* -> Widget 58 * module aliases: 59 * local aliases: 60 * - getAction -> getFileChooserAction 61 * - setAction -> setFileChooserAction 62 * overrides: 63 */ 64 65 module gtk.FileChooserIF; 66 67 public import gtkc.gtktypes; 68 69 private import gtkc.gtk; 70 private import glib.ConstructionException; 71 private import gobject.ObjectG; 72 73 private import gobject.Signals; 74 public import gtkc.gdktypes; 75 76 private import glib.Str; 77 private import glib.ErrorG; 78 private import glib.GException; 79 private import gio.File; 80 private import glib.ListSG; 81 private import gtk.FileFilter; 82 private import gtk.Widget; 83 84 85 86 87 /** 88 * GtkFileChooser is an interface that can be implemented by file 89 * selection widgets. In GTK+, the main objects that implement this 90 * interface are GtkFileChooserWidget, GtkFileChooserDialog, and 91 * GtkFileChooserButton. You do not need to write an object that 92 * implements the GtkFileChooser interface unless you are trying to 93 * adapt an existing file selector to expose a standard programming 94 * interface. 95 * 96 * GtkFileChooser allows for shortcuts to various places in the filesystem. 97 * In the default implementation these are displayed in the left pane. It 98 * may be a bit confusing at first that these shortcuts come from various 99 * sources and in various flavours, so lets explain the terminology here: 100 * 101 * Bookmarks 102 * 103 * are created by the user, by dragging folders from the 104 * right pane to the left pane, or by using the "Add". Bookmarks 105 * can be renamed and deleted by the user. 106 * 107 * Shortcuts 108 * 109 * can be provided by the application. For example, a Paint program may 110 * want to add a shortcut for a Clipart folder. Shortcuts cannot be modified by the 111 * user. 112 * 113 * Volumes 114 * 115 * are provided by the underlying filesystem abstraction. They are 116 * the "roots" of the filesystem. 117 * 118 * File Names and Encodings 119 * 120 * When the user is finished selecting files in a 121 * GtkFileChooser, your program can get the selected names 122 * either as filenames or as URIs. For URIs, the normal escaping 123 * rules are applied if the URI contains non-ASCII characters. 124 * However, filenames are always returned in 125 * the character set specified by the 126 * G_FILENAME_ENCODING environment variable. 127 * Please see the GLib documentation for more details about this 128 * variable. 129 * 130 * Note 131 * 132 * This means that while you can pass the result of 133 * gtk_file_chooser_get_filename() to 134 * open(2) or 135 * fopen(3), you may not be able to 136 * directly set it as the text of a GtkLabel widget unless you 137 * convert it first to UTF-8, which all GTK+ widgets expect. 138 * You should use g_filename_to_utf8() to convert filenames 139 * into strings that can be passed to GTK+ widgets. 140 * 141 * <hr> 142 * 143 * Adding a Preview Widget 144 * 145 * You can add a custom preview widget to a file chooser and then 146 * get notification about when the preview needs to be updated. 147 * To install a preview widget, use 148 * gtk_file_chooser_set_preview_widget(). Then, connect to the 149 * "update-preview" signal to get notified when 150 * you need to update the contents of the preview. 151 * 152 * Your callback should use 153 * gtk_file_chooser_get_preview_filename() to see what needs 154 * previewing. Once you have generated the preview for the 155 * corresponding file, you must call 156 * gtk_file_chooser_set_preview_widget_active() with a boolean 157 * flag that indicates whether your callback could successfully 158 * generate a preview. 159 * 160 * $(DDOC_COMMENT example) 161 * 162 * <hr> 163 * 164 * Adding Extra Widgets 165 * 166 * You can add extra widgets to a file chooser to provide options 167 * that are not present in the default design. For example, you 168 * can add a toggle button to give the user the option to open a 169 * file in read-only mode. You can use 170 * gtk_file_chooser_set_extra_widget() to insert additional 171 * widgets in a file chooser. 172 * 173 * $(DDOC_COMMENT example) 174 * 175 * Note 176 * 177 * If you want to set more than one extra widget in the file 178 * chooser, you can a container such as a GtkBox or a GtkGrid 179 * and include your widgets in it. Then, set the container as 180 * the whole extra widget. 181 * 182 * <hr> 183 * 184 * Key Bindings 185 * 186 * Internally, GTK+ implements a file chooser's graphical user 187 * interface with the private 188 * GtkFileChooserDefaultClass. This 189 * widget has several key 190 * bindings and their associated signals. This section 191 * describes the available key binding signals. 192 * 193 * $(DDOC_COMMENT example) 194 * 195 * You can change these defaults to something else. For 196 * example, to add a Shift modifier to a few 197 * of the default bindings, you can include the following 198 * fragment in your .config/gtk-3.0/gtk.css file: 199 * 200 * @binding-set MyOwnFilechooserBindings 201 * { 202 * bind "<Alt><Shift>Up" { "up-folder" () } 203 * bind "<Alt><Shift>Down" { "down-folder" () } 204 * bind "<Alt><Shift>Home" { "home-folder" () } 205 * } 206 * 207 * GtkFileChooserDefault 208 * { 209 * gtk-key-bindings: MyOwnFilechooserBindings 210 * } 211 * 212 * The "GtkFileChooserDefault::location-popup" signal 213 * 214 * void user_function (GtkFileChooserDefault *chooser, 215 * const char *path, 216 * gpointer user_data); 217 * 218 * This is used to make the file chooser show a "Location" 219 * dialog which the user can use to manually type the name of 220 * the file he wishes to select. The 221 * path argument is a string that gets 222 * put in the text entry for the file name. By default this is bound to 223 * Control+L 224 * with a path string of "" (the empty 225 * string). It is also bound to / with a 226 * path string of "/" 227 * (a slash): this lets you type / and 228 * immediately type a path name. On Unix systems, this is bound to 229 * ~ (tilde) with a path string 230 * of "~" itself for access to home directories. 231 * 232 * chooser : 233 * 234 * the object which received the signal. 235 * 236 * path : 237 * 238 * default contents for the text entry for the file name 239 * 240 * user_data : 241 * 242 * user data set when the signal handler was connected. 243 * 244 * Note 245 * 246 * You can create your own bindings for the 247 * "location-popup" signal with custom 248 * path strings, and have a crude form 249 * of easily-to-type bookmarks. For example, say you access 250 * the path /home/username/misc very 251 * frequently. You could then create an Alt+M 252 * shortcut by including the following in your 253 * .config/gtk-3.0/gtk.css: 254 * 255 * @binding-set MiscShortcut 256 * { 257 * bind "<Alt>M" { "location-popup" ("/home/username/misc") } 258 * } 259 * 260 * GtkFileChooserDefault 261 * { 262 * gtk-key-bindings: MiscShortcut 263 * } 264 * 265 * The "GtkFileChooserDefault::up-folder" signal 266 * 267 * void user_function (GtkFileChooserDefault *chooser, 268 * gpointer user_data); 269 * 270 * This is used to make the file chooser go to the parent of 271 * the current folder in the file hierarchy. By default this 272 * is bound to Backspace and 273 * Alt+Up 274 * (the Up key in the numeric keypad also works). 275 * 276 * chooser : 277 * 278 * the object which received the signal. 279 * 280 * user_data : 281 * 282 * user data set when the signal handler was connected. 283 * 284 * The "GtkFileChooserDefault::down-folder" signal 285 * 286 * void user_function (GtkFileChooserDefault *chooser, 287 * gpointer user_data); 288 * 289 * This is used to make the file chooser go to a child of the 290 * current folder in the file hierarchy. The subfolder that 291 * will be used is displayed in the path bar widget of the file 292 * chooser. For example, if the path bar is showing 293 * "/foo/bar/baz", then this will cause 294 * the file chooser to switch to the "baz" subfolder. By 295 * default this is bound to 296 * Alt+Down 297 * (the Down key in the numeric keypad also works). 298 * 299 * chooser : 300 * 301 * the object which received the signal. 302 * 303 * user_data : 304 * 305 * user data set when the signal handler was connected. 306 * 307 * The "GtkFileChooserDefault::home-folder" signal 308 * 309 * void user_function (GtkFileChooserDefault *chooser, 310 * gpointer user_data); 311 * 312 * This is used to make the file chooser show the user's home 313 * folder in the file list. By default this is bound to 314 * Alt+Home 315 * (the Home key in the numeric keypad also works). 316 * 317 * chooser : 318 * 319 * the object which received the signal. 320 * 321 * user_data : 322 * 323 * user data set when the signal handler was connected. 324 * 325 * The "GtkFileChooserDefault::desktop-folder" signal 326 * 327 * void user_function (GtkFileChooserDefault *chooser, 328 * gpointer user_data); 329 * 330 * This is used to make the file chooser show the user's Desktop 331 * folder in the file list. By default this is bound to 332 * Alt+D. 333 * 334 * chooser : 335 * 336 * the object which received the signal. 337 * 338 * user_data : 339 * 340 * user data set when the signal handler was connected. 341 * 342 * The "GtkFileChooserDefault::quick-bookmark" signal 343 * 344 * void user_function (GtkFileChooserDefault *chooser, 345 * gint bookmark_index, 346 * gpointer user_data); 347 * 348 * This is used to make the file chooser switch to the bookmark 349 * specified in the bookmark_index parameter. 350 * For example, if you have three bookmarks, you can pass 0, 1, 2 to 351 * this signal to switch to each of them, respectively. By default this is bound to 352 * Alt+1, 353 * Alt+2, 354 * etc. until 355 * Alt+0. Note 356 * that in the default binding, 357 * that Alt+1 is 358 * actually defined to switch to the bookmark at index 0, and so on 359 * successively; 360 * Alt+0 is 361 * defined to switch to the bookmark at index 10. 362 * 363 * chooser : 364 * 365 * the object which received the signal. 366 * 367 * bookmark_indes : 368 * 369 * index of the bookmark to switch to; the indices start at 0. 370 * 371 * user_data : 372 * 373 * user data set when the signal handler was connected. 374 */ 375 public interface FileChooserIF 376 { 377 378 379 public GtkFileChooser* getFileChooserTStruct(); 380 381 /** the main Gtk struct as a void* */ 382 protected void* getStruct(); 383 384 385 /** 386 */ 387 388 @property GtkFileChooserConfirmation delegate(FileChooserIF)[] onConfirmOverwriteListeners(); 389 /** 390 * This signal gets emitted whenever it is appropriate to present a 391 * confirmation dialog when the user has selected a file name that 392 * already exists. The signal only gets emitted when the file 393 * chooser is in GTK_FILE_CHOOSER_ACTION_SAVE mode. 394 * Most applications just need to turn on the 395 * "do-overwrite-confirmation" property (or call the 396 * gtk_file_chooser_set_do_overwrite_confirmation() function), and 397 * they will automatically get a stock confirmation dialog. 398 * Applications which need to customize this behavior should do 399 * that, and also connect to the "confirm-overwrite" 400 * signal. 401 * A signal handler for this signal must return a 402 * GtkFileChooserConfirmation value, which indicates the action to 403 * take. If the handler determines that the user wants to select a 404 * different filename, it should return 405 * GTK_FILE_CHOOSER_CONFIRMATION_SELECT_AGAIN. If it determines 406 * that the user is satisfied with his choice of file name, it 407 * should return GTK_FILE_CHOOSER_CONFIRMATION_ACCEPT_FILENAME. 408 * On the other hand, if it determines that the stock confirmation 409 * dialog should be used, it should return 410 * GTK_FILE_CHOOSER_CONFIRMATION_CONFIRM. The following example 411 * illustrates this. 412 * $(DDOC_COMMENT example) 413 * 414 * Since 2.8 415 */ 416 void addOnConfirmOverwrite(GtkFileChooserConfirmation delegate(FileChooserIF) dlg, ConnectFlags connectFlags=cast(ConnectFlags)0); 417 @property void delegate(FileChooserIF)[] onCurrentFolderChangedListeners(); 418 /** 419 * This signal is emitted when the current folder in a GtkFileChooser 420 * changes. This can happen due to the user performing some action that 421 * changes folders, such as selecting a bookmark or visiting a folder on the 422 * file list. It can also happen as a result of calling a function to 423 * explicitly change the current folder in a file chooser. 424 * Normally you do not need to connect to this signal, unless you need to keep 425 * track of which folder a file chooser is showing. 426 * See also: gtk_file_chooser_set_current_folder(), 427 * gtk_file_chooser_get_current_folder(), 428 * gtk_file_chooser_set_current_folder_uri(), 429 * gtk_file_chooser_get_current_folder_uri(). 430 */ 431 void addOnCurrentFolderChanged(void delegate(FileChooserIF) dlg, ConnectFlags connectFlags=cast(ConnectFlags)0); 432 @property void delegate(FileChooserIF)[] onFileActivatedListeners(); 433 /** 434 * This signal is emitted when the user "activates" a file in the file 435 * chooser. This can happen by double-clicking on a file in the file list, or 436 * by pressing Enter. 437 * Normally you do not need to connect to this signal. It is used internally 438 * by GtkFileChooserDialog to know when to activate the default button in the 439 * dialog. 440 * See also: gtk_file_chooser_get_filename(), 441 * gtk_file_chooser_get_filenames(), gtk_file_chooser_get_uri(), 442 * gtk_file_chooser_get_uris(). 443 */ 444 void addOnFileActivated(void delegate(FileChooserIF) dlg, ConnectFlags connectFlags=cast(ConnectFlags)0); 445 @property void delegate(FileChooserIF)[] onSelectionChangedListeners(); 446 /** 447 * This signal is emitted when there is a change in the set of selected files 448 * in a GtkFileChooser. This can happen when the user modifies the selection 449 * with the mouse or the keyboard, or when explicitly calling functions to 450 * change the selection. 451 * Normally you do not need to connect to this signal, as it is easier to wait 452 * for the file chooser to finish running, and then to get the list of 453 * selected files using the functions mentioned below. 454 * See also: gtk_file_chooser_select_filename(), 455 * gtk_file_chooser_unselect_filename(), gtk_file_chooser_get_filename(), 456 * gtk_file_chooser_get_filenames(), gtk_file_chooser_select_uri(), 457 * gtk_file_chooser_unselect_uri(), gtk_file_chooser_get_uri(), 458 * gtk_file_chooser_get_uris(). 459 */ 460 void addOnSelectionChanged(void delegate(FileChooserIF) dlg, ConnectFlags connectFlags=cast(ConnectFlags)0); 461 @property void delegate(FileChooserIF)[] onUpdatePreviewListeners(); 462 /** 463 * This signal is emitted when the preview in a file chooser should be 464 * regenerated. For example, this can happen when the currently selected file 465 * changes. You should use this signal if you want your file chooser to have 466 * a preview widget. 467 * Once you have installed a preview widget with 468 * gtk_file_chooser_set_preview_widget(), you should update it when this 469 * signal is emitted. You can use the functions 470 * gtk_file_chooser_get_preview_filename() or 471 * gtk_file_chooser_get_preview_uri() to get the name of the file to preview. 472 * Your widget may not be able to preview all kinds of files; your callback 473 * must call gtk_file_chooser_set_preview_widget_active() to inform the file 474 * chooser about whether the preview was generated successfully or not. 475 * Please see the example code in the section called “Adding a Preview Widget”. 476 * See also: gtk_file_chooser_set_preview_widget(), 477 * gtk_file_chooser_set_preview_widget_active(), 478 * gtk_file_chooser_set_use_preview_label(), 479 * gtk_file_chooser_get_preview_filename(), 480 * gtk_file_chooser_get_preview_uri(). 481 * See Also 482 * GtkFileChooserDialog, GtkFileChooserWidget, GtkFileChooserButton 483 */ 484 void addOnUpdatePreview(void delegate(FileChooserIF) dlg, ConnectFlags connectFlags=cast(ConnectFlags)0); 485 486 /** 487 * Sets the type of operation that the chooser is performing; the 488 * user interface is adapted to suit the selected action. For example, 489 * an option to create a new folder might be shown if the action is 490 * GTK_FILE_CHOOSER_ACTION_SAVE but not if the action is 491 * GTK_FILE_CHOOSER_ACTION_OPEN. 492 * Since 2.4 493 * Params: 494 * action = the action that the file selector is performing 495 */ 496 public void setFileChooserAction(GtkFileChooserAction action); 497 498 /** 499 * Gets the type of operation that the file chooser is performing; see 500 * gtk_file_chooser_set_action(). 501 * Since 2.4 502 * Returns: the action that the file selector is performing 503 */ 504 public GtkFileChooserAction getFileChooserAction(); 505 506 /** 507 * Sets whether only local files can be selected in the 508 * file selector. If local_only is TRUE (the default), 509 * then the selected file are files are guaranteed to be 510 * accessible through the operating systems native file 511 * file system and therefore the application only 512 * needs to worry about the filename functions in 513 * GtkFileChooser, like gtk_file_chooser_get_filename(), 514 * rather than the URI functions like 515 * gtk_file_chooser_get_uri(), 516 * On some systems non-native files may still be 517 * available using the native filesystem via a userspace 518 * filesystem (FUSE). 519 * Since 2.4 520 * Params: 521 * localOnly = TRUE if only local files can be selected 522 */ 523 public void setLocalOnly(int localOnly); 524 525 /** 526 * Gets whether only local files can be selected in the 527 * file selector. See gtk_file_chooser_set_local_only() 528 * Since 2.4 529 * Returns: TRUE if only local files can be selected. 530 */ 531 public int getLocalOnly(); 532 533 /** 534 * Sets whether multiple files can be selected in the file selector. This is 535 * only relevant if the action is set to be GTK_FILE_CHOOSER_ACTION_OPEN or 536 * GTK_FILE_CHOOSER_ACTION_SELECT_FOLDER. 537 * Since 2.4 538 * Params: 539 * selectMultiple = TRUE if multiple files can be selected. 540 */ 541 public void setSelectMultiple(int selectMultiple); 542 543 /** 544 * Gets whether multiple files can be selected in the file 545 * selector. See gtk_file_chooser_set_select_multiple(). 546 * Since 2.4 547 * Returns: TRUE if multiple files can be selected. 548 */ 549 public int getSelectMultiple(); 550 551 /** 552 * Sets whether hidden files and folders are displayed in the file selector. 553 * Since 2.6 554 * Params: 555 * showHidden = TRUE if hidden files and folders should be displayed. 556 */ 557 public void setShowHidden(int showHidden); 558 559 /** 560 * Gets whether hidden files and folders are displayed in the file selector. 561 * See gtk_file_chooser_set_show_hidden(). 562 * Since 2.6 563 * Returns: TRUE if hidden files and folders are displayed. 564 */ 565 public int getShowHidden(); 566 567 /** 568 * Sets whether a file chooser in GTK_FILE_CHOOSER_ACTION_SAVE mode will present 569 * a confirmation dialog if the user types a file name that already exists. This 570 * is FALSE by default. 571 * If set to TRUE, the chooser will emit the 572 * "confirm-overwrite" signal when appropriate. 573 * If all you need is the stock confirmation dialog, set this property to TRUE. 574 * You can override the way confirmation is done by actually handling the 575 * "confirm-overwrite" signal; please refer to its documentation 576 * for the details. 577 * Since 2.8 578 * Params: 579 * doOverwriteConfirmation = whether to confirm overwriting in save mode 580 */ 581 public void setDoOverwriteConfirmation(int doOverwriteConfirmation); 582 583 /** 584 * Queries whether a file chooser is set to confirm for overwriting when the user 585 * types a file name that already exists. 586 * Since 2.8 587 * Returns: TRUE if the file chooser will present a confirmation dialog; FALSE otherwise. 588 */ 589 public int getDoOverwriteConfirmation(); 590 591 /** 592 * Sets whether file choser will offer to create new folders. 593 * This is only relevant if the action is not set to be 594 * GTK_FILE_CHOOSER_ACTION_OPEN. 595 * Since 2.18 596 * Params: 597 * createFolders = TRUE if the New Folder button should be displayed 598 */ 599 public void setCreateFolders(int createFolders); 600 601 /** 602 * Gets whether file choser will offer to create new folders. 603 * See gtk_file_chooser_set_create_folders(). 604 * Since 2.18 605 * Returns: TRUE if the New Folder button should be displayed. 606 */ 607 public int getCreateFolders(); 608 609 /** 610 * Sets the current name in the file selector, as if entered 611 * by the user. Note that the name passed in here is a UTF-8 612 * string rather than a filename. This function is meant for 613 * such uses as a suggested name in a "Save As..." dialog. You can 614 * pass "Untitled.doc" or a similarly suitable suggestion for the name. 615 * If you want to preselect a particular existing file, you should use 616 * gtk_file_chooser_set_filename() or gtk_file_chooser_set_uri() instead. 617 * Please see the documentation for those functions for an example of using 618 * gtk_file_chooser_set_current_name() as well. 619 * Since 2.4 620 * Params: 621 * name = the filename to use, as a UTF-8 string. [type filename] 622 */ 623 public void setCurrentName(string name); 624 625 /** 626 * Gets the current name in the file selector, as entered by the user in the 627 * text entry for "Name". 628 * This is meant to be used in save dialogs, to get the currently typed filename 629 * when the file itself does not exist yet. For example, an application that 630 * adds a custom extra widget to the file chooser for "file format" may want to 631 * change the extension of the typed filename based on the chosen format, say, 632 * from ".jpg" to ".png". 633 * Returns: The raw text from the file chooser's "Name" entry. Free this with g_free(). Note that this string is not a full pathname or URI; it is whatever the contents of the entry are. Note also that this string is in UTF-8 encoding, which is not necessarily the system's encoding for filenames. Since 3.10 634 */ 635 public string getCurrentName(); 636 637 /** 638 * Gets the filename for the currently selected file in 639 * the file selector. The filename is returned as an absolute path. If 640 * multiple files are selected, one of the filenames will be returned at 641 * random. 642 * If the file chooser is in folder mode, this function returns the selected 643 * folder. 644 * Since 2.4 645 * Returns: The currently selected filename, or NULL if no file is selected, or the selected file can't be represented with a local filename. Free with g_free(). [type filename] 646 */ 647 public string getFilename(); 648 649 /** 650 * Sets filename as the current filename for the file chooser, by changing to 651 * the file's parent folder and actually selecting the file in list; all other 652 * files will be unselected. If the chooser is in 653 * GTK_FILE_CHOOSER_ACTION_SAVE mode, the file's base name will also appear in 654 * the dialog's file name entry. 655 * Note that the file must exist, or nothing will be done except 656 * for the directory change. 657 * You should use this function only when implementing a File/Save 658 * As... dialog for which you already have a file name to which 659 * the user may save. For example, when the user opens an existing file and 660 * then does File/Save As... on it to save a copy or 661 * a modified version. If you don't have a file name already — for 662 * example, if the user just created a new file and is saving it for the first 663 * Since 2.4 664 * Params: 665 * filename = the filename to set as current. [type filename] 666 * Returns: Not useful. 667 */ 668 public int setFilename(string filename); 669 670 /** 671 * Selects a filename. If the file name isn't in the current 672 * folder of chooser, then the current folder of chooser will 673 * be changed to the folder containing filename. 674 * Since 2.4 675 * Params: 676 * filename = the filename to select. [type filename] 677 * Returns: Not useful. See also: gtk_file_chooser_set_filename() 678 */ 679 public int selectFilename(string filename); 680 681 /** 682 * Unselects a currently selected filename. If the filename 683 * is not in the current directory, does not exist, or 684 * is otherwise not currently selected, does nothing. 685 * Since 2.4 686 * Params: 687 * filename = the filename to unselect. [type filename] 688 */ 689 public void unselectFilename(string filename); 690 691 /** 692 * Selects all the files in the current folder of a file chooser. 693 * Since 2.4 694 */ 695 public void selectAll(); 696 697 /** 698 * Unselects all the files in the current folder of a file chooser. 699 * Since 2.4 700 */ 701 public void unselectAll(); 702 703 /** 704 * Lists all the selected files and subfolders in the current folder of 705 * chooser. The returned names are full absolute paths. If files in the current 706 * folder cannot be represented as local filenames they will be ignored. (See 707 * gtk_file_chooser_get_uris()) 708 * Since 2.4 709 * Returns: a GSList containing the filenames of all selected files and subfolders in the current folder. Free the returned list with g_slist_free(), and the filenames with g_free(). [element-type filename][transfer full] 710 */ 711 public ListSG getFilenames(); 712 713 /** 714 * Sets the current folder for chooser from a local filename. 715 * The user will be shown the full contents of the current folder, 716 * plus user interface elements for navigating to other folders. 717 * In general, you should not use this function. See the section on setting up a file 718 * chooser dialog for the rationale behind this. 719 * Since 2.4 720 * Params: 721 * filename = the full path of the new current folder. [type filename] 722 * Returns: Not useful. 723 */ 724 public int setCurrentFolder(string filename); 725 726 /** 727 * Gets the current folder of chooser as a local filename. 728 * See gtk_file_chooser_set_current_folder(). 729 * Note that this is the folder that the file chooser is currently displaying 730 * (e.g. "/home/username/Documents"), which is not the same 731 * as the currently-selected folder if the chooser is in 732 * GTK_FILE_CHOOSER_ACTION_SELECT_FOLDER mode 733 * (e.g. "/home/username/Documents/selected-folder/". To get the 734 * currently-selected folder in that mode, use gtk_file_chooser_get_uri() as the 735 * usual way to get the selection. 736 * Since 2.4 737 * Returns: the full path of the current folder, or NULL if the current path cannot be represented as a local filename. Free with g_free(). This function will also return NULL if the file chooser was unable to load the last folder that was requested from it; for example, as would be for calling gtk_file_chooser_set_current_folder() on a nonexistent folder. [type filename] 738 */ 739 public string getCurrentFolder(); 740 741 /** 742 * Gets the URI for the currently selected file in 743 * the file selector. If multiple files are selected, 744 * one of the filenames will be returned at random. 745 * If the file chooser is in folder mode, this function returns the selected 746 * folder. 747 * Since 2.4 748 * Returns: The currently selected URI, or NULL if no file is selected. If gtk_file_chooser_set_local_only() is set to TRUE (the default) a local URI will be returned for any FUSE locations. Free with g_free() 749 */ 750 public string getUri(); 751 752 /** 753 * Sets the file referred to by uri as the current file for the file chooser, 754 * by changing to the URI's parent folder and actually selecting the URI in the 755 * list. If the chooser is GTK_FILE_CHOOSER_ACTION_SAVE mode, the URI's base 756 * name will also appear in the dialog's file name entry. 757 * Note that the URI must exist, or nothing will be done except for the 758 * directory change. 759 * You should use this function only when implementing a File/Save 760 * As... dialog for which you already have a file name to which 761 * the user may save. For example, whenthe user opens an existing file and then 762 * does File/Save As... on it to save a copy or a 763 * modified version. If you don't have a file name already — for example, 764 * if the user just created a new file and is saving it for the first time, do 765 * Since 2.4 766 * Params: 767 * uri = the URI to set as current 768 * Returns: Not useful. 769 */ 770 public int setUri(string uri); 771 772 /** 773 * Selects the file to by uri. If the URI doesn't refer to a 774 * file in the current folder of chooser, then the current folder of 775 * chooser will be changed to the folder containing filename. 776 * Since 2.4 777 * Params: 778 * uri = the URI to select 779 * Returns: Not useful. 780 */ 781 public int selectUri(string uri); 782 783 /** 784 * Unselects the file referred to by uri. If the file 785 * is not in the current directory, does not exist, or 786 * is otherwise not currently selected, does nothing. 787 * Since 2.4 788 * Params: 789 * uri = the URI to unselect 790 */ 791 public void unselectUri(string uri); 792 793 /** 794 * Lists all the selected files and subfolders in the current folder of 795 * chooser. The returned names are full absolute URIs. 796 * Since 2.4 797 * Returns: a GSList containing the URIs of all selected files and subfolders in the current folder. Free the returned list with g_slist_free(), and the filenames with g_free(). [element-type utf8][transfer full] 798 */ 799 public ListSG getUris(); 800 801 /** 802 * Sets the current folder for chooser from an URI. 803 * The user will be shown the full contents of the current folder, 804 * plus user interface elements for navigating to other folders. 805 * In general, you should not use this function. See the section on setting up a file 806 * chooser dialog for the rationale behind this. 807 * Since 2.4 808 * Params: 809 * uri = the URI for the new current folder 810 * Returns: TRUE if the folder could be changed successfully, FALSE otherwise. 811 */ 812 public int setCurrentFolderUri(string uri); 813 814 /** 815 * Gets the current folder of chooser as an URI. 816 * See gtk_file_chooser_set_current_folder_uri(). 817 * Note that this is the folder that the file chooser is currently displaying 818 * (e.g. "file:///home/username/Documents"), which is not the same 819 * as the currently-selected folder if the chooser is in 820 * GTK_FILE_CHOOSER_ACTION_SELECT_FOLDER mode 821 * (e.g. "file:///home/username/Documents/selected-folder/". To get the 822 * currently-selected folder in that mode, use gtk_file_chooser_get_uri() as the 823 * usual way to get the selection. 824 * Since 2.4 825 * Returns: the URI for the current folder. Free with g_free(). This function will also return NULL if the file chooser was unable to load the last folder that was requested from it; for example, as would be for calling gtk_file_chooser_set_current_folder_uri() on a nonexistent folder. 826 */ 827 public string getCurrentFolderUri(); 828 829 /** 830 * Sets an application-supplied widget to use to display a custom preview 831 * of the currently selected file. To implement a preview, after setting the 832 * preview widget, you connect to the "update-preview" 833 * signal, and call gtk_file_chooser_get_preview_filename() or 834 * gtk_file_chooser_get_preview_uri() on each change. If you can 835 * display a preview of the new file, update your widget and 836 * set the preview active using gtk_file_chooser_set_preview_widget_active(). 837 * Otherwise, set the preview inactive. 838 * When there is no application-supplied preview widget, or the 839 * application-supplied preview widget is not active, the file chooser 840 * will display no preview at all. 841 * Since 2.4 842 * Params: 843 * previewWidget = widget for displaying preview. 844 */ 845 public void setPreviewWidget(Widget previewWidget); 846 847 /** 848 * Gets the current preview widget; see 849 * gtk_file_chooser_set_preview_widget(). 850 * Since 2.4 851 * Returns: the current preview widget, or NULL. [transfer none] 852 */ 853 public Widget getPreviewWidget(); 854 855 /** 856 * Sets whether the preview widget set by 857 * gtk_file_chooser_set_preview_widget() should be shown for the 858 * current filename. When active is set to false, the file chooser 859 * may display an internally generated preview of the current file 860 * or it may display no preview at all. See 861 * gtk_file_chooser_set_preview_widget() for more details. 862 * Since 2.4 863 * Params: 864 * active = whether to display the user-specified preview widget 865 */ 866 public void setPreviewWidgetActive(int active); 867 868 /** 869 * Gets whether the preview widget set by gtk_file_chooser_set_preview_widget() 870 * should be shown for the current filename. See 871 * gtk_file_chooser_set_preview_widget_active(). 872 * Since 2.4 873 * Returns: TRUE if the preview widget is active for the current filename. 874 */ 875 public int getPreviewWidgetActive(); 876 877 /** 878 * Sets whether the file chooser should display a stock label with the name of 879 * the file that is being previewed; the default is TRUE. Applications that 880 * want to draw the whole preview area themselves should set this to FALSE and 881 * display the name themselves in their preview widget. 882 * See also: gtk_file_chooser_set_preview_widget() 883 * Since 2.4 884 * Params: 885 * useLabel = whether to display a stock label with the name of the previewed file 886 */ 887 public void setUsePreviewLabel(int useLabel); 888 889 /** 890 * Gets whether a stock label should be drawn with the name of the previewed 891 * file. See gtk_file_chooser_set_use_preview_label(). 892 * Returns: TRUE if the file chooser is set to display a label with the name of the previewed file, FALSE otherwise. 893 */ 894 public int getUsePreviewLabel(); 895 896 /** 897 * Gets the filename that should be previewed in a custom preview 898 * widget. See gtk_file_chooser_set_preview_widget(). 899 * Since 2.4 900 * Returns: the filename to preview, or NULL if no file is selected, or if the selected file cannot be represented as a local filename. Free with g_free(). [type filename] 901 */ 902 public string getPreviewFilename(); 903 904 /** 905 * Gets the URI that should be previewed in a custom preview 906 * widget. See gtk_file_chooser_set_preview_widget(). 907 * Since 2.4 908 * Returns: the URI for the file to preview, or NULL if no file is selected. Free with g_free(). 909 */ 910 public string getPreviewUri(); 911 912 /** 913 * Sets an application-supplied widget to provide extra options to the user. 914 * Since 2.4 915 * Params: 916 * extraWidget = widget for extra options 917 */ 918 public void setExtraWidget(Widget extraWidget); 919 920 /** 921 * Gets the current preview widget; see 922 * gtk_file_chooser_set_extra_widget(). 923 * Since 2.4 924 * Returns: the current extra widget, or NULL. [transfer none] 925 */ 926 public Widget getExtraWidget(); 927 928 /** 929 * Adds filter to the list of filters that the user can select between. 930 * When a filter is selected, only files that are passed by that 931 * filter are displayed. 932 * Note that the chooser takes ownership of the filter, so you have to 933 * ref and sink it if you want to keep a reference. 934 * Since 2.4 935 * Params: 936 * filter = a GtkFileFilter 937 */ 938 public void addFilter(FileFilter filter); 939 940 /** 941 * Removes filter from the list of filters that the user can select between. 942 * Since 2.4 943 * Params: 944 * filter = a GtkFileFilter 945 */ 946 public void removeFilter(FileFilter filter); 947 948 /** 949 * Lists the current set of user-selectable filters; see 950 * gtk_file_chooser_add_filter(), gtk_file_chooser_remove_filter(). 951 * Since 2.4 952 * Returns: a GSList containing the current set of user selectable filters. The contents of the list are owned by GTK+, but you must free the list itself with g_slist_free() when you are done with it. [element-type GtkFileFilter][transfer container] 953 */ 954 public ListSG listFilters(); 955 956 /** 957 * Sets the current filter; only the files that pass the 958 * filter will be displayed. If the user-selectable list of filters 959 * is non-empty, then the filter should be one of the filters 960 * in that list. Setting the current filter when the list of 961 * filters is empty is useful if you want to restrict the displayed 962 * set of files without letting the user change it. 963 * Since 2.4 964 * Params: 965 * filter = a GtkFileFilter 966 */ 967 public void setFilter(FileFilter filter); 968 969 /** 970 * Gets the current filter; see gtk_file_chooser_set_filter(). 971 * Since 2.4 972 * Returns: the current filter, or NULL. [transfer none] 973 */ 974 public FileFilter getFilter(); 975 976 /** 977 * Adds a folder to be displayed with the shortcut folders in a file chooser. 978 * Note that shortcut folders do not get saved, as they are provided by the 979 * application. For example, you can use this to add a 980 * "/usr/share/mydrawprogram/Clipart" folder to the volume list. 981 * Since 2.4 982 * Params: 983 * folder = filename of the folder to add. [type filename] 984 * Returns: TRUE if the folder could be added successfully, FALSE otherwise. In the latter case, the error will be set as appropriate. 985 * Throws: GException on failure. 986 */ 987 public int addShortcutFolder(string folder); 988 989 /** 990 * Removes a folder from a file chooser's list of shortcut folders. 991 * Since 2.4 992 * Params: 993 * folder = filename of the folder to remove. [type filename] 994 * Returns: TRUE if the operation succeeds, FALSE otherwise. In the latter case, the error will be set as appropriate. See also: gtk_file_chooser_add_shortcut_folder() 995 * Throws: GException on failure. 996 */ 997 public int removeShortcutFolder(string folder); 998 999 /** 1000 * Queries the list of shortcut folders in the file chooser, as set by 1001 * gtk_file_chooser_add_shortcut_folder(). 1002 * Since 2.4 1003 * Returns: A list of folder filenames, or NULL if there are no shortcut folders. Free the returned list with g_slist_free(), and the filenames with g_free(). [element-type filename][transfer full] 1004 */ 1005 public ListSG listShortcutFolders(); 1006 1007 /** 1008 * Adds a folder URI to be displayed with the shortcut folders in a file 1009 * chooser. Note that shortcut folders do not get saved, as they are provided 1010 * by the application. For example, you can use this to add a 1011 * "file:///usr/share/mydrawprogram/Clipart" folder to the volume list. 1012 * Since 2.4 1013 * Params: 1014 * uri = URI of the folder to add 1015 * Returns: TRUE if the folder could be added successfully, FALSE otherwise. In the latter case, the error will be set as appropriate. 1016 * Throws: GException on failure. 1017 */ 1018 public int addShortcutFolderUri(string uri); 1019 1020 /** 1021 * Removes a folder URI from a file chooser's list of shortcut folders. 1022 * Since 2.4 1023 * Params: 1024 * uri = URI of the folder to remove 1025 * Returns: TRUE if the operation succeeds, FALSE otherwise. In the latter case, the error will be set as appropriate. See also: gtk_file_chooser_add_shortcut_folder_uri() 1026 * Throws: GException on failure. 1027 */ 1028 public int removeShortcutFolderUri(string uri); 1029 1030 /** 1031 * Queries the list of shortcut folders in the file chooser, as set by 1032 * gtk_file_chooser_add_shortcut_folder_uri(). 1033 * Since 2.4 1034 * Returns: A list of folder URIs, or NULL if there are no shortcut folders. Free the returned list with g_slist_free(), and the URIs with g_free(). [element-type utf8][transfer full] 1035 */ 1036 public ListSG listShortcutFolderUris(); 1037 1038 /** 1039 * Gets the current folder of chooser as GFile. 1040 * See gtk_file_chooser_get_current_folder_uri(). 1041 * Since 2.14 1042 * Returns: the GFile for the current folder. [transfer full] 1043 */ 1044 public File getCurrentFolderFile(); 1045 1046 /** 1047 * Gets the GFile for the currently selected file in 1048 * the file selector. If multiple files are selected, 1049 * one of the files will be returned at random. 1050 * If the file chooser is in folder mode, this function returns the selected 1051 * folder. 1052 * Since 2.14 1053 * Returns: a selected GFile. You own the returned file; use g_object_unref() to release it. [transfer full] 1054 */ 1055 public File getFile(); 1056 1057 /** 1058 * Lists all the selected files and subfolders in the current folder of chooser 1059 * as GFile. An internal function, see gtk_file_chooser_get_uris(). 1060 * Since 2.14 1061 * Returns: a GSList containing a GFile for each selected file and subfolder in the current folder. Free the returned list with g_slist_free(), and the files with g_object_unref(). [element-type GFile][transfer full] 1062 */ 1063 public ListSG getFiles(); 1064 1065 /** 1066 * Gets the GFile that should be previewed in a custom preview 1067 * Internal function, see gtk_file_chooser_get_preview_uri(). 1068 * Since 2.14 1069 * Returns: the GFile for the file to preview, or NULL if no file is selected. Free with g_object_unref(). [transfer full] 1070 */ 1071 public File getPreviewFile(); 1072 1073 /** 1074 * Selects the file referred to by file. An internal function. See 1075 * _gtk_file_chooser_select_uri(). 1076 * Since 2.14 1077 * Params: 1078 * file = the file to select 1079 * Returns: Not useful. 1080 * Throws: GException on failure. 1081 */ 1082 public int selectFile(File file); 1083 1084 /** 1085 * Sets the current folder for chooser from a GFile. 1086 * Internal function, see gtk_file_chooser_set_current_folder_uri(). 1087 * Since 2.14 1088 * Params: 1089 * file = the GFile for the new folder 1090 * Returns: TRUE if the folder could be changed successfully, FALSE otherwise. 1091 * Throws: GException on failure. 1092 */ 1093 public int setCurrentFolderFile(File file); 1094 1095 /** 1096 * Sets file as the current filename for the file chooser, by changing 1097 * to the file's parent folder and actually selecting the file in list. If 1098 * the chooser is in GTK_FILE_CHOOSER_ACTION_SAVE mode, the file's base name 1099 * will also appear in the dialog's file name entry. 1100 * If the file name isn't in the current folder of chooser, then the current 1101 * folder of chooser will be changed to the folder containing filename. This 1102 * is equivalent to a sequence of gtk_file_chooser_unselect_all() followed by 1103 * gtk_file_chooser_select_filename(). 1104 * Note that the file must exist, or nothing will be done except 1105 * for the directory change. 1106 * If you are implementing a File/Save As... dialog, 1107 * you should use this function if you already have a file name to which the 1108 * user may save; for example, when the user opens an existing file and then 1109 * does File/Save As... on it. If you don't have 1110 * a file name already — for example, if the user just created a new 1111 * file and is saving it for the first time, do not call this function. 1112 * Since 2.14 1113 * Params: 1114 * file = the GFile to set as current 1115 * Returns: Not useful. 1116 * Throws: GException on failure. 1117 */ 1118 public int setFile(File file); 1119 1120 /** 1121 * Unselects the file referred to by file. If the file is not in the current 1122 * directory, does not exist, or is otherwise not currently selected, does nothing. 1123 * Since 2.14 1124 * Params: 1125 * file = a GFile 1126 */ 1127 public void unselectFile(File file); 1128 }