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