1 2@c %start of fragment 3 4@deftp Class <gtk-file-chooser> 5Derives from @code{<ginterface>}. 6 7This class defines the following slots: 8 9@table @code 10@item filter 11The current filter for selecting which files are displayed 12 13@item local-only 14Whether the selected file(s) should be limited to local file: URLs 15 16@item use-preview-label 17Whether to display a stock label with the name of the previewed file. 18 19@item preview-widget-active 20Whether the application supplied widget for custom previews should be shown. 21 22@item preview-widget 23Application supplied widget for custom previews. 24 25@item show-hidden 26Whether the hidden files and folders should be displayed 27 28@item do-overwrite-confirmation 29Whether a file chooser in save mode will present an overwrite confirmation 30dialog if necessary. 31 32@item extra-widget 33Application supplied widget for extra options. 34 35@item file-system-backend 36Name of file system backend to use 37 38@item action 39The type of operation that the file selector is performing 40 41@item select-multiple 42Whether to allow multiple files to be selected 43 44@end table 45 46@end deftp 47 48@defop Signal <gtk-file-chooser> current-folder-changed 49This signal is emitted when the current folder in a @code{<gtk-file-chooser>} 50changes. This can happen due to the user performing some action that changes 51folders, such as selecting a bookmark or visiting a folder on the file list. It 52can also happen as a result of calling a function to explicitly change the 53current folder in a file chooser. 54 55Normally you do not need to connect to this signal, unless you need to keep 56track of which folder a file chooser is showing. 57 58See also: @code{gtk-file-chooser-set-current-folder}, 59@code{gtk-file-chooser-get-current-folder}, 60@code{gtk-file-chooser-set-current-folder-uri}, 61@code{gtk-file-chooser-get-current-folder-uri}. 62 63@end defop 64 65@defop Signal <gtk-file-chooser> selection-changed 66This signal is emitted when there is a change in the set of selected files in a 67@code{<gtk-file-chooser>}. This can happen when the user modifies the selection 68with the mouse or the keyboard, or when explicitly calling functions to change 69the selection. 70 71Normally you do not need to connect to this signal, as it is easier to wait for 72the file chooser to finish running, and then to get the list of selected files 73using the functions mentioned below. 74 75See also: @code{gtk-file-chooser-select-filename}, 76@code{gtk-file-chooser-unselect-filename}, @code{gtk-file-chooser-get-filename}, 77@code{gtk-file-chooser-get-filenames}, @code{gtk-file-chooser-select-uri}, 78@code{gtk-file-chooser-unselect-uri}, @code{gtk-file-chooser-get-uri}, 79@code{gtk-file-chooser-get-uris}. 80 81@end defop 82 83@defop Signal <gtk-file-chooser> update-preview 84This signal is emitted when the preview in a file chooser should be regenerated. 85For example, this can happen when the currently selected file changes. You 86should use this signal if you want your file chooser to have a preview widget. 87 88Once you have installed a preview widget with 89@code{gtk-file-chooser-set-preview-widget}, you should update it when this 90signal is emitted. You can use the functions 91@code{gtk-file-chooser-get-preview-filename} or 92@code{gtk-file-chooser-get-preview-uri} to get the name of the file to preview. 93Your widget may not be able to preview all kinds of files; your callback must 94call @code{gtk-file-chooser-set-preview-wiget-active} to inform the file chooser 95about whether the preview was generated successfully or not. 96 97Please see the example code in @emph{(the missing figure, 98gtkfilechooser-preview}. 99 100See also: @code{gtk-file-chooser-set-preview-widget}, 101@code{gtk-file-chooser-set-preview-widget-active}, 102@code{gtk-file-chooser-set-use-preview-label}, 103@code{gtk-file-chooser-get-preview-filename}, 104@code{gtk-file-chooser-get-preview-uri}. 105 106@end defop 107 108@defop Signal <gtk-file-chooser> file-activated 109This signal is emitted when the user "activates" a file in the file chooser. 110This can happen by double-clicking on a file in the file list, or by pressing @c 111(keycap "Enter") . 112 113Normally you do not need to connect to this signal. It is used internally by 114@code{<gtk-file-chooser-dialog>} to know when to activate the default button in 115the dialog. 116 117See also: @code{gtk-file-chooser-get-filename}, 118@code{gtk-file-chooser-get-filenames}, @code{gtk-file-chooser-get-uri}, 119@code{gtk-file-chooser-get-uris}. 120 121@end defop 122 123@defop Signal <gtk-file-chooser> confirm-overwrite @result{}@tie{}@code{<gtk-file-chooser-confirmation>} 124This signal gets emitted whenever it is appropriate to present a confirmation 125dialog when the user has selected a file name that already exists. The signal 126only gets emitted when the file chooser is in 127@code{<gtk-file-chooser-action-save>} mode. 128 129Most applications just need to turn on the do-overwrite-confirmation property 130(or call the @code{gtk-file-chooser-set-do-overwrite-confirmation} function), 131and they will automatically get a stock confirmation dialog. Applications which 132need to customize this behavior should do that, and also connect to the 133@code{confirm-overwrite} signal. 134 135A signal handler for this signal must return a 136@code{<gtk-file-chooser-confirmation>} value, which indicates the action to 137take. If the handler determines that the user wants to select a different 138filename, it should return @code{<gtk-file-chooser-confirmation-select-again>}. 139If it determines that the user is satisfied with his choice of file name, it 140should return @code{<gtk-file-chooser-confirmation-accept-filename>}. On the 141other hand, if it determines that the stock confirmation dialog should be used, 142it should return @code{<gtk-file-chooser-confirmation-confirm>}. The following 143example illustrates this. 144 145@end defop 146 147@deffn Function gtk-file-chooser-set-action (self@tie{}@code{<gtk-file-chooser>}) (action@tie{}@code{<gtk-file-chooser-action>}) 148@deffnx Method set-action 149Sets the type of operation that the chooser is performing; the user interface is 150adapted to suit the selected action. For example, an option to create a new 151folder might be shown if the action is @samp{GTK_FILE_CHOOSER_ACTION_SAVE} but 152not if the action is @samp{GTK_FILE_CHOOSER_ACTION_OPEN}. 153 154@table @var 155@item chooser 156a @code{<gtk-file-chooser>} 157 158@item action 159the action that the file selector is performing 160 161@end table 162 163Since 2.4 164 165@end deffn 166 167@deffn Function gtk-file-chooser-get-action (self@tie{}@code{<gtk-file-chooser>}) @result{}@tie{} (ret@tie{}@code{<gtk-file-chooser-action>}) 168@deffnx Method get-action 169Gets the type of operation that the file chooser is performing; see 170@code{gtk-file-chooser-set-action}. 171 172@table @var 173@item chooser 174a @code{<gtk-file-chooser>} 175 176@item ret 177the action that the file selector is performing 178 179@end table 180 181Since 2.4 182 183@end deffn 184 185@deffn Function gtk-file-chooser-set-local-only (self@tie{}@code{<gtk-file-chooser>}) (local_only@tie{}@code{bool}) 186@deffnx Method set-local-only 187Sets whether only local files can be selected in the file selector. If 188@var{local-only} is @samp{@code{#t}} (the default), then the selected file are 189files are guaranteed to be accessible through the operating systems native file 190file system and therefore the application only needs to worry about the filename 191functions in @code{<gtk-file-chooser>}, like 192@code{gtk-file-chooser-get-filename}, rather than the URI functions like 193@code{gtk-file-chooser-get-uri}, 194 195@table @var 196@item chooser 197a @code{<gtk-file-chooser>} 198 199@item local-only 200@samp{@code{#t}} if only local files can be selected 201 202@end table 203 204Since 2.4 205 206@end deffn 207 208@deffn Function gtk-file-chooser-get-local-only (self@tie{}@code{<gtk-file-chooser>}) @result{}@tie{} (ret@tie{}@code{bool}) 209@deffnx Method get-local-only 210Gets whether only local files can be selected in the file selector. See 211@code{gtk-file-chooser-set-local-only} 212 213@table @var 214@item chooser 215a @code{<gtk-file-choosre>} 216 217@item ret 218@samp{@code{#t}} if only local files can be selected. 219 220@end table 221 222Since 2.4 223 224@end deffn 225 226@deffn Function gtk-file-chooser-set-show-hidden (self@tie{}@code{<gtk-file-chooser>}) (show_hidden@tie{}@code{bool}) 227@deffnx Method set-show-hidden 228Sets whether hidden files and folders are displayed in the file selector. 229 230@table @var 231@item chooser 232a @code{<gtk-file-chooser>} 233 234@item show-hidden 235@samp{@code{#t}} if hidden files and folders should be displayed. 236 237@end table 238 239Since 2.6 240 241@end deffn 242 243@deffn Function gtk-file-chooser-get-show-hidden (self@tie{}@code{<gtk-file-chooser>}) @result{}@tie{} (ret@tie{}@code{bool}) 244@deffnx Method get-show-hidden 245Gets whether hidden files and folders are displayed in the file selector. See 246@code{gtk-file-chooser-set-show-hidden}. 247 248@table @var 249@item chooser 250a @code{<gtk-file-chooser>} 251 252@item ret 253@samp{@code{#t}} if hidden files and folders are displayed. 254 255@end table 256 257Since 2.6 258 259@end deffn 260 261@deffn Function gtk-file-chooser-set-current-name (self@tie{}@code{<gtk-file-chooser>}) (name@tie{}@code{mchars}) 262@deffnx Method set-current-name 263Sets the current name in the file selector, as if entered by the user. Note that 264the name passed in here is a UTF-8 string rather than a filename. This function 265is meant for such uses as a suggested name in a "Save As..." dialog. 266 267If you want to preselect a particular existing file, you should use 268@code{gtk-file-chooser-set-filename} or @code{gtk-file-chooser-set-uri} instead. 269Please see the documentation for those functions for an example of using 270@code{gtk-file-chooser-set-current-name} as well. 271 272@table @var 273@item chooser 274a @code{<gtk-file-chooser>} 275 276@item name 277the filename to use, as a UTF-8 string 278 279@end table 280 281Since 2.4 282 283@end deffn 284 285@deffn Function gtk-file-chooser-get-filename (self@tie{}@code{<gtk-file-chooser>}) @result{}@tie{} (ret@tie{}@code{mchars}) 286@deffnx Method get-filename 287Gets the filename for the currently selected file in the file selector. If 288multiple files are selected, one of the filenames will be returned at random. 289 290If the file chooser is in folder mode, this function returns the selected 291folder. 292 293@table @var 294@item chooser 295a @code{<gtk-file-chooser>} 296 297@item ret 298The currently selected filename, or @samp{@code{#f}} if no file is selected, or 299the selected file can't be represented with a local filename. Free with 300@code{g-free}. 301 302@end table 303 304Since 2.4 305 306@end deffn 307 308@deffn Function gtk-file-chooser-set-filename (self@tie{}@code{<gtk-file-chooser>}) (filename@tie{}@code{mchars}) @result{}@tie{} (ret@tie{}@code{bool}) 309@deffnx Method set-filename 310Sets @var{filename} as the current filename for the file chooser, by changing to 311the file's parent folder and actually selecting the file in list. If the 312@var{chooser} is in @code{<gtk-file-chooser-action-save>} mode, the file's base 313name will also appear in the dialog's file name entry. 314 315If the file name isn't in the current folder of @var{chooser}, then the current 316folder of @var{chooser} will be changed to the folder containing @var{filename}. 317This is equivalent to a sequence of @code{gtk-file-chooser-unselect-all} 318followed by @code{gtk-file-chooser-select-filename}. 319 320Note that the file must exist, or nothing will be done except for the directory 321change. 322 323If you are implementing a @c (guimenuitem "File/Save As...") dialog, you should 324use this function if you already have a file name to which the user may save; 325for example, when the user opens an existing file and then does @c (guimenuitem 326"File/Save As...") on it. If you don't have a file name already — for 327example, if the user just created a new file and is saving it for the first 328time, do not call this function. Instead, use something similar to this: 329 330@example 331 332if (document_is_new) 333 @{ 334 /* the user just created a new document */ 335 gtk_file_chooser_set_current_folder (chooser, default_folder_for_saving); 336 gtk_file_chooser_set_current_name (chooser, "Untitled document"); 337 @} 338else 339 @{ 340 /* the user edited an existing document */ 341 gtk_file_chooser_set_filename (chooser, existing_filename); 342 @} 343@end example 344 345@table @var 346@item chooser 347a @code{<gtk-file-chooser>} 348 349@item filename 350the filename to set as current 351 352@item ret 353@samp{@code{#t}} if both the folder could be changed and the file was selected 354successfully, @samp{@code{#f}} otherwise. 355 356@end table 357 358Since 2.4 359 360@end deffn 361 362@deffn Function gtk-file-chooser-select-filename (self@tie{}@code{<gtk-file-chooser>}) (filename@tie{}@code{mchars}) @result{}@tie{} (ret@tie{}@code{bool}) 363@deffnx Method select-filename 364Selects a filename. If the file name isn't in the current folder of 365@var{chooser}, then the current folder of @var{chooser} will be changed to the 366folder containing @var{filename}. 367 368@table @var 369@item chooser 370a @code{<gtk-file-chooser>} 371 372@item filename 373the filename to select 374 375@item ret 376@samp{@code{#t}} if both the folder could be changed and the file was selected 377successfully, @samp{@code{#f}} otherwise. 378 379@end table 380 381Since 2.4 382 383@end deffn 384 385@deffn Function gtk-file-chooser-unselect-filename (self@tie{}@code{<gtk-file-chooser>}) (filename@tie{}@code{mchars}) 386@deffnx Method unselect-filename 387Unselects a currently selected filename. If the filename is not in the current 388directory, does not exist, or is otherwise not currently selected, does nothing. 389 390@table @var 391@item chooser 392a @code{<gtk-file-chooser>} 393 394@item filename 395the filename to unselect 396 397@end table 398 399Since 2.4 400 401@end deffn 402 403@deffn Function gtk-file-chooser-select-all (self@tie{}@code{<gtk-file-chooser>}) 404@deffnx Method select-all 405Selects all the files in the current folder of a file chooser. 406 407@table @var 408@item chooser 409a @code{<gtk-file-chooser>} 410 411@end table 412 413Since 2.4 414 415@end deffn 416 417@deffn Function gtk-file-chooser-unselect-all (self@tie{}@code{<gtk-file-chooser>}) 418@deffnx Method unselect-all 419Unselects all the files in the current folder of a file chooser. 420 421@table @var 422@item chooser 423a @code{<gtk-file-chooser>} 424 425@end table 426 427Since 2.4 428 429@end deffn 430 431@deffn Function gtk-file-chooser-get-filenames (self@tie{}@code{<gtk-file-chooser>}) @result{}@tie{} (ret@tie{}@code{gslist-of}) 432@deffnx Method get-filenames 433Lists all the selected files and subfolders in the current folder of 434@var{chooser}. The returned names are full absolute paths. If files in the 435current folder cannot be represented as local filenames they will be ignored. 436(See @code{gtk-file-chooser-get-uris}) 437 438@table @var 439@item chooser 440a @code{<gtk-file-chooser>} 441 442@item ret 443a @code{<gs-list>} containing the filenames of all selected files and subfolders 444in the current folder. Free the returned list with @code{g-slist-free}, and the 445filenames with @code{g-free}. 446 447@end table 448 449Since 2.4 450 451@end deffn 452 453@deffn Function gtk-file-chooser-set-current-folder (self@tie{}@code{<gtk-file-chooser>}) (filename@tie{}@code{mchars}) @result{}@tie{} (ret@tie{}@code{bool}) 454@deffnx Method set-current-folder 455Sets the current folder for @var{chooser} from a local filename. The user will 456be shown the full contents of the current folder, plus user interface elements 457for navigating to other folders. 458 459@table @var 460@item chooser 461a @code{<gtk-file-chooser>} 462 463@item filename 464the full path of the new current folder 465 466@item ret 467@samp{@code{#t}} if the folder could be changed successfully, @samp{@code{#f}} 468otherwise. 469 470@end table 471 472Since 2.4 473 474@end deffn 475 476@deffn Function gtk-file-chooser-get-current-folder (self@tie{}@code{<gtk-file-chooser>}) @result{}@tie{} (ret@tie{}@code{mchars}) 477@deffnx Method get-current-folder 478Gets the current folder of @var{chooser} as a local filename. See 479@code{gtk-file-chooser-set-current-folder}. 480 481Note that this is the folder that the file chooser is currently displaying (e.g. 482"/home/username/Documents"), which is @emph{not the same} as the 483currently-selected folder if the chooser is in 484@code{<gtk-file-chooser-select-folder>} mode (e.g. 485"/home/username/Documents/selected-folder/". To get the currently-selected 486folder in that mode, use @code{gtk-file-chooser-get-uri} as the usual way to get 487the selection. 488 489@table @var 490@item chooser 491a @code{<gtk-file-chooser>} 492 493@item ret 494the full path of the current folder, or @samp{@code{#f}} if the current path 495cannot be represented as a local filename. Free with @code{g-free}. This 496function will also return @samp{@code{#f}} if the file chooser was unable to 497load the last folder that was requested from it; for example, as would be for 498calling @code{gtk-file-chooser-set-current-folder} on a nonexistent folder. 499 500@end table 501 502Since 2.4 503 504@end deffn 505 506@deffn Function gtk-file-chooser-get-uri (self@tie{}@code{<gtk-file-chooser>}) @result{}@tie{} (ret@tie{}@code{mchars}) 507@deffnx Method get-uri 508Gets the URI for the currently selected file in the file selector. If multiple 509files are selected, one of the filenames will be returned at random. 510 511If the file chooser is in folder mode, this function returns the selected 512folder. 513 514@table @var 515@item chooser 516a @code{<gtk-file-chooser>} 517 518@item ret 519The currently selected URI, or @samp{@code{#f}} if no file is selected. Free 520with @code{g-free} 521 522@end table 523 524Since 2.4 525 526@end deffn 527 528@deffn Function gtk-file-chooser-set-uri (self@tie{}@code{<gtk-file-chooser>}) (uri@tie{}@code{mchars}) @result{}@tie{} (ret@tie{}@code{bool}) 529@deffnx Method set-uri 530Sets the file referred to by @var{uri} as the current file for the file chooser, 531by changing to the URI's parent folder and actually selecting the URI in the 532list. If the @var{chooser} is @code{<gtk-file-chooser-action-save>} mode, the 533URI's base name will also appear in the dialog's file name entry. 534 535If the URI isn't in the current folder of @var{chooser}, then the current folder 536of @var{chooser} will be changed to the folder containing @var{uri}. This is 537equivalent to a sequence of @code{gtk-file-chooser-unselect-all} followed by 538@code{gtk-file-chooser-select-uri}. 539 540Note that the URI must exist, or nothing will be done except for the directory 541change. If you are implementing a @c (guimenuitem "File/Save As...") dialog, you 542should use this function if you already have a file name to which the user may 543save; for example, when the user opens an existing file and then does @c 544(guimenuitem "File/Save As...") on it. If you don't have a file name already 545— for example, if the user just created a new file and is saving it for 546the first time, do not call this function. Instead, use something similar to 547this: 548 549@example 550 551if (document_is_new) 552 @{ 553 /* the user just created a new document */ 554 gtk_file_chooser_set_current_folder_uri (chooser, default_folder_for_saving); 555 gtk_file_chooser_set_current_name (chooser, "Untitled document"); 556 @} 557else 558 @{ 559 /* the user edited an existing document */ 560 gtk_file_chooser_set_uri (chooser, existing_uri); 561 @} 562@end example 563 564@table @var 565@item chooser 566a @code{<gtk-file-chooser>} 567 568@item uri 569the URI to set as current 570 571@item ret 572@samp{@code{#t}} if both the folder could be changed and the URI was selected 573successfully, @samp{@code{#f}} otherwise. 574 575@end table 576 577Since 2.4 578 579@end deffn 580 581@deffn Function gtk-file-chooser-select-uri (self@tie{}@code{<gtk-file-chooser>}) (uri@tie{}@code{mchars}) @result{}@tie{} (ret@tie{}@code{bool}) 582@deffnx Method select-uri 583Selects the file to by @var{uri}. If the URI doesn't refer to a file in the 584current folder of @var{chooser}, then the current folder of @var{chooser} will 585be changed to the folder containing @var{filename}. 586 587@table @var 588@item chooser 589a @code{<gtk-file-chooser>} 590 591@item uri 592the URI to select 593 594@item ret 595@samp{@code{#t}} if both the folder could be changed and the URI was selected 596successfully, @samp{@code{#f}} otherwise. 597 598@end table 599 600Since 2.4 601 602@end deffn 603 604@deffn Function gtk-file-chooser-unselect-uri (self@tie{}@code{<gtk-file-chooser>}) (uri@tie{}@code{mchars}) 605@deffnx Method unselect-uri 606Unselects the file referred to by @var{uri}. If the file is not in the current 607directory, does not exist, or is otherwise not currently selected, does nothing. 608 609@table @var 610@item chooser 611a @code{<gtk-file-chooser>} 612 613@item uri 614the URI to unselect 615 616@end table 617 618Since 2.4 619 620@end deffn 621 622@deffn Function gtk-file-chooser-get-uris (self@tie{}@code{<gtk-file-chooser>}) @result{}@tie{} (ret@tie{}@code{gslist-of}) 623@deffnx Method get-uris 624Lists all the selected files and subfolders in the current folder of 625@var{chooser}. The returned names are full absolute URIs. 626 627@table @var 628@item chooser 629a @code{<gtk-file-chooser>} 630 631@item ret 632a @code{<gs-list>} containing the URIs of all selected files and subfolders in 633the current folder. Free the returned list with @code{g-slist-free}, and the 634filenames with @code{g-free}. 635 636@end table 637 638Since 2.4 639 640@end deffn 641 642@deffn Function gtk-file-chooser-set-preview-widget (self@tie{}@code{<gtk-file-chooser>}) (preview_widget@tie{}@code{<gtk-widget>}) 643@deffnx Method set-preview-widget 644Sets an application-supplied widget to use to display a custom preview of the 645currently selected file. To implement a preview, after setting the preview 646widget, you connect to the ::update-preview signal, and call 647@code{gtk-file-chooser-get-preview-filename} or 648@code{gtk-file-chooser-get-preview-uri} on each change. If you can display a 649preview of the new file, update your widget and set the preview active using 650@code{gtk-file-chooser-set-preview-widget-active}. Otherwise, set the preview 651inactive. 652 653When there is no application-supplied preview widget, or the 654application-supplied preview widget is not active, the file chooser may display 655an internally generated preview of the current file or it may display no preview 656at all. 657 658@table @var 659@item chooser 660a @code{<gtk-file-chooser>} 661 662@item preview-widget 663widget for displaying preview. 664 665@end table 666 667Since 2.4 668 669@end deffn 670 671@deffn Function gtk-file-chooser-get-preview-widget (self@tie{}@code{<gtk-file-chooser>}) @result{}@tie{} (ret@tie{}@code{<gtk-widget>}) 672@deffnx Method get-preview-widget 673Gets the current preview widget; see @code{gtk-file-chooser-set-preview-widget}. 674 675@table @var 676@item chooser 677a @code{<gtk-file-chooser>} 678 679@item ret 680the current preview widget, or @samp{@code{#f}} 681 682@end table 683 684Since 2.4 685 686@end deffn 687 688@deffn Function gtk-file-chooser-get-preview-uri (self@tie{}@code{<gtk-file-chooser>}) @result{}@tie{} (ret@tie{}@code{mchars}) 689@deffnx Method get-preview-uri 690Gets the URI that should be previewed in a custom preview widget. See 691@code{gtk-file-chooser-set-preview-widget}. 692 693@table @var 694@item chooser 695a @code{<gtk-file-chooser>} 696 697@item ret 698the URI for the file to preview, or @samp{@code{#f}} if no file is selected. 699Free with @code{g-free}. 700 701@end table 702 703Since 2.4 704 705@end deffn 706 707@deffn Function gtk-file-chooser-set-extra-widget (self@tie{}@code{<gtk-file-chooser>}) (extra_widget@tie{}@code{<gtk-widget>}) 708@deffnx Method set-extra-widget 709Sets an application-supplied widget to provide extra options to the user. 710 711@table @var 712@item chooser 713a @code{<gtk-file-chooser>} 714 715@item extra-widget 716widget for extra options 717 718@end table 719 720Since 2.4 721 722@end deffn 723 724@deffn Function gtk-file-chooser-get-extra-widget (self@tie{}@code{<gtk-file-chooser>}) @result{}@tie{} (ret@tie{}@code{<gtk-widget>}) 725@deffnx Method get-extra-widget 726Gets the current preview widget; see @code{gtk-file-chooser-set-extra-widget}. 727 728@table @var 729@item chooser 730a @code{<gtk-file-chooser>} 731 732@item ret 733the current extra widget, or @samp{@code{#f}} 734 735@end table 736 737Since 2.4 738 739@end deffn 740 741@deffn Function gtk-file-chooser-add-filter (self@tie{}@code{<gtk-file-chooser>}) (filter@tie{}@code{<gtk-file-filter>}) 742@deffnx Method add-filter 743Adds @var{filter} to the list of filters that the user can select between. When 744a filter is selected, only files that are passed by that filter are displayed. 745 746Note that the @var{chooser} takes ownership of the filter, so you have to ref 747and sink it if you want to keep a reference. 748 749@table @var 750@item chooser 751a @code{<gtk-file-chooser>} 752 753@item filter 754a @code{<gtk-file-filter>} 755 756@end table 757 758Since 2.4 759 760@end deffn 761 762@deffn Function gtk-file-chooser-remove-filter (self@tie{}@code{<gtk-file-chooser>}) (filter@tie{}@code{<gtk-file-filter>}) 763@deffnx Method remove-filter 764Removes @var{filter} from the list of filters that the user can select between. 765 766@table @var 767@item chooser 768a @code{<gtk-file-chooser>} 769 770@item filter 771a @code{<gtk-file-filter>} 772 773@end table 774 775Since 2.4 776 777@end deffn 778 779@deffn Function gtk-file-chooser-list-filters (self@tie{}@code{<gtk-file-chooser>}) @result{}@tie{} (ret@tie{}@code{gslist-of}) 780@deffnx Method list-filters 781Lists the current set of user-selectable filters; see 782@code{gtk-file-chooser-add-filter}, @code{gtk-file-chooser-remove-filter}. 783 784@table @var 785@item chooser 786a @code{<gtk-file-chooser>} 787 788@item ret 789a @code{<gs-list>} containing the current set of user selectable filters. The 790contents of the list are owned by GTK+, but you must free the list itself with 791@code{g-slist-free} when you are done with it. 792 793@end table 794 795Since 2.4 796 797@end deffn 798 799@deffn Function gtk-file-chooser-set-filter (self@tie{}@code{<gtk-file-chooser>}) (filter@tie{}@code{<gtk-file-filter>}) 800@deffnx Method set-filter 801Sets the current filter; only the files that pass the filter will be displayed. 802If the user-selectable list of filters is non-empty, then the filter should be 803one of the filters in that list. Setting the current filter when the list of 804filters is empty is useful if you want to restrict the displayed set of files 805without letting the user change it. 806 807@table @var 808@item chooser 809a @code{<gtk-file-chooser>} 810 811@item filter 812a @code{<gtk-file-filter>} 813 814@end table 815 816Since 2.4 817 818@end deffn 819 820@deffn Function gtk-file-chooser-get-filter (self@tie{}@code{<gtk-file-chooser>}) @result{}@tie{} (ret@tie{}@code{<gtk-file-filter>}) 821@deffnx Method get-filter 822Gets the current filter; see @code{gtk-file-chooser-set-filter}. 823 824@table @var 825@item chooser 826a @code{<gtk-file-chooser>} 827 828@item ret 829the current filter, or @samp{@code{#f}} 830 831@end table 832 833Since 2.4 834 835@end deffn 836 837 838@c %end of fragment 839