1. ----------------------------------------------------------------------- 
  2. --              GtkAda - Ada95 binding for Gtk+/Gnome                -- 
  3. --                                                                   -- 
  4. --                Copyright (C) 2006-2013, AdaCore                   -- 
  5. --                                                                   -- 
  6. -- This library is free software; you can redistribute it and/or     -- 
  7. -- modify it under the terms of the GNU General Public               -- 
  8. -- License as published by the Free Software Foundation; either      -- 
  9. -- version 2 of the License, or (at your option) any later version.  -- 
  10. --                                                                   -- 
  11. -- This library is distributed in the hope that it will be useful,   -- 
  12. -- but WITHOUT ANY WARRANTY; without even the implied warranty of    -- 
  13. -- MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU -- 
  14. -- General Public License for more details.                          -- 
  15. --                                                                   -- 
  16. -- You should have received a copy of the GNU General Public         -- 
  17. -- License along with this library; if not, write to the             -- 
  18. -- Free Software Foundation, Inc., 59 Temple Place - Suite 330,      -- 
  19. -- Boston, MA 02111-1307, USA.                                       -- 
  20. --                                                                   -- 
  21. -- As a special exception, if other files instantiate generics from  -- 
  22. -- this unit, or you link this unit with other files to produce an   -- 
  23. -- executable, this  unit  does not  by itself cause  the resulting  -- 
  24. -- executable to be covered by the GNU General Public License. This  -- 
  25. -- exception does not however invalidate any other reasons why the   -- 
  26. -- executable file  might be covered by the  GNU Public License.     -- 
  27. ----------------------------------------------------------------------- 
  28.  
  29. --  <description> 
  30. --  This package provides an interface implemented by Gtk.File_Chooser_Widget 
  31. --  and Gtk.File_Chooser_Button, and by your own file selection widgets if you 
  32. --  wish to expose a standard interface. 
  33. -- 
  34. --  Gtk_File_Chooser allows for shortcuts to various places in the filesystem. 
  35. --  In the default implementation these are displayed in the left pane. It may 
  36. --  be a bit confusing at first that these shortcuts come from various sources 
  37. --  and in various flavours, so lets explain the terminology here: 
  38. --    - Bookmarks 
  39. --      are created by the user, by dragging folders from the right pane to the 
  40. --      left pane, or by using the "Add". Bookmarks can be renamed and deleted 
  41. --      by the user. 
  42. --    - Shortcuts 
  43. --      can be provided by the application or by the underlying filesystem 
  44. --      abstraction (e.g. both the gnome-vfs and the Windows filesystems 
  45. --      provide "Desktop" shortcuts). Shortcuts cannot be modified by the user. 
  46. --    - Volumes 
  47. --      are provided by the underlying filesystem abstraction. They are the 
  48. --      "roots" of the filesystem. 
  49. -- 
  50. --  File Names and Encodings 
  51. -- 
  52. --  When the user is finished selecting files in a Gtk_File_Chooser, your 
  53. --  program can get the selected names either as filenames or as URIs. For 
  54. --  URIs, the normal escaping rules are applied if the URI contains non-ASCII 
  55. --  characters. However, filenames are always returned in the character set 
  56. --  specified by the G_FILENAME_ENCODING environment variable. Please see the 
  57. --  Glib documentation for more details about this variable. 
  58. -- 
  59. --  Important: This means that while you can pass the result of 
  60. --  Get_Filename to low-level file system primitives , you will need to convert 
  61. --  it to UTF-8 before using it in a Gtk_Label for instance. Conversion is done 
  62. --  through Glib.Convert.Filename_To_UTF8. 
  63. -- 
  64. --  You can add a custom preview widget to a file chooser and then get 
  65. --  notification about when the preview needs to be updated. To install a 
  66. --  preview widget, use gtk_file_chooser_set_preview_widget(). Then, connect to 
  67. --  the GtkFileChooser::update-preview signal to get notified when you need to 
  68. --  update the contents of the preview. 
  69. -- 
  70. --  Preview widgets 
  71. -- 
  72. --  You can add a custom preview widget to a file chooser and then get 
  73. --  notification about when the preview needs to be updated. To install a 
  74. --  preview widget, use Set_Preview_Widget. Then, connect to the 
  75. --  GtkFileChooser::update-preview signal to get notified when you need to 
  76. --  update the contents of the preview. 
  77. -- 
  78. --  Your callback should use Get_Preview_Filename to see what needs previewing. 
  79. --  Once you have generated the preview for the corresponding file, you must 
  80. --  call Set_Preview_Widget_Active with a boolean flag that indicates whether 
  81. --  your callback could successfully generate a preview. 
  82. -- 
  83. --  Adding Extra Widgets 
  84.  
  85. --  You can add extra widgets to a file chooser to provide options that are not 
  86. --  present in the default design. For example, you can add a toggle button to 
  87. --  give the user the option to open a file in read-only mode. You can use 
  88. --  Set_Extra_Widget to insert additional widgets in a file chooser. 
  89. -- 
  90. --  If you want to set more than one extra widget in the file chooser, you can 
  91. --  a container such as a GtkVBox or a GtkTable and include your widgets in it. 
  92. --  Then, set the container as the whole extra widget. 
  93. -- 
  94. --  Key bindings 
  95. -- 
  96. --  The following default key bindings are provided, but you can use a gtkrc 
  97. --  file to override them if you need (see gtk-rc.ads). 
  98. --     Signal name    | Key binding 
  99. --     location-popup | Control-L  (empty path) 
  100. --                    | /          (path of "/") 
  101. --                    | ~          (home directory) 
  102. --     up-folder      | Alt-Up  or backspace 
  103. --     down-folder    | Alt-Down 
  104. --     home-folder    | Alt-Home 
  105. --     desktop-folder | Alt-D 
  106. --     quick-bookmark | Alt-1 through Alt-0 
  107. -- 
  108. --  </description> 
  109. --  <c_version>2.8.17</c_version> 
  110. --  <group>Selectors</group> 
  111.  
  112. with Glib.Error; 
  113. with Glib.Properties; 
  114. with Glib.Types; 
  115. with Gtk.Enums; 
  116. with Gtk.File_Filter; 
  117. with Gtk.Widget; 
  118.  
  119. package Gtk.File_Chooser is 
  120.  
  121.    type Gtk_File_Chooser is new Glib.Types.GType_Interface; 
  122.  
  123.    function Get_Type return Gtk.Gtk_Type; 
  124.    --  Return the internal value associated with a Gtk_File_Chooser 
  125.  
  126.    type File_Chooser_Action is 
  127.      (Action_Open, 
  128.       Action_Save, 
  129.       Action_Select_Folder, 
  130.       Action_Create_Folder); 
  131.    --  Describes whether a Gtk_File_Chooser is being used to open existing 
  132.    --  files or to save to a possibly new file. 
  133.    --    Action_Open:          Will only let the user select existing file 
  134.    --    Action_Save:          Select existing file or enter new filename 
  135.    --    Action_Select_Folder: Only pick an existing folder 
  136.    --    Action_Create_Folder: Select existing folder or enter new name 
  137.  
  138.    type File_Chooser_Confirmation is 
  139.      (Confirmation_Confirm, 
  140.       Confirmation_Accept_Filename, 
  141.       Confirmation_Select_Again); 
  142.    --  Used as a return value of handlers for the confirm-overwrite signal of a 
  143.    --  Gtk_File_Chooser. This value determines whether the file chooser will 
  144.    --  present the stock confirmation dialog, accept the user's choice of a 
  145.    --  filename, or let the user choose another filename. 
  146.    --    Confirmation_Confirm: Ask confirmation about overwriting existing file 
  147.    --    Confirmation_Accept_Filename: Accept the user's choice 
  148.    --    Confirmation_Select_Again: Let the user select another file 
  149.  
  150.    type File_Chooser_Error is 
  151.      (Error_Non_Existent, 
  152.       Error_Bad_Filename); 
  153.    --  Identify the various errors that can occur while calling 
  154.    --  Gtk_File_Chooser functions 
  155.  
  156.    ------------------- 
  157.    -- Configuration -- 
  158.    ------------------- 
  159.  
  160.    procedure Set_Action 
  161.      (Chooser : Gtk_File_Chooser; Action : File_Chooser_Action); 
  162.    function Get_Action (Chooser : Gtk_File_Chooser) return File_Chooser_Action; 
  163.    --  Sets the type of operation that the chooser is performing; the 
  164.    --  user interface is adapted to suit the selected action. For example, 
  165.    --  an option to create a new folder might be shown if the action is 
  166.    --  Action_Save, but not if the action is Action_Open. 
  167.  
  168.    procedure Set_Local_Only 
  169.      (Chooser : Gtk_File_Chooser; Local_Only : Boolean := True); 
  170.    function Get_Local_Only (Chooser : Gtk_File_Chooser) return Boolean; 
  171.    --  Sets whether only local files can be selected in the file selector. If 
  172.    --  Local_Only is True (the default), then the selected file are files are 
  173.    --  guaranteed to be accessible through the operating systems native file 
  174.    --  file system and therefore the application only needs to worry about the 
  175.    --  filename functions in Gtk_File_Chooser, like Get_Filename, rather than 
  176.    --  the URI functions like Get_Uri, 
  177.  
  178.    procedure Set_Select_Multiple 
  179.      (Chooser : Gtk_File_Chooser; Select_Multiple : Boolean); 
  180.    function Get_Select_Multiple (Chooser : Gtk_File_Chooser) return Boolean; 
  181.    --  Sets whether multiple files can be selected in the file selector. This 
  182.    --  is only relevant if the action is set to be Action_Open or Action_Save. 
  183.    --  It cannot be set with either of the folder actions. 
  184.  
  185.    procedure Set_Show_Hidden 
  186.      (Chooser : Gtk_File_Chooser; Show_Hidden : Boolean); 
  187.    function Get_Show_Hidden (Chooser : Gtk_File_Chooser) return Boolean; 
  188.    --  Sets whether hidden files and folders are displayed in the file selector 
  189.  
  190.    procedure Set_Do_Overwrite_Confirmation 
  191.      (Chooser                   : Gtk_File_Chooser; 
  192.       Do_Overwrite_Confirmation : Boolean); 
  193.    function Get_Do_Overwrite_Confirmation 
  194.      (Chooser : Gtk_File_Chooser) return Boolean; 
  195.    --  Sets whether a file chooser in Action_Save mode will present a 
  196.    --  confirmation dialog if the user types a file name that already exists. 
  197.    --  This is False by default. 
  198.    --  Regardless of this setting, Chooser will emit the "confirm-overwrite" 
  199.    --  signal when appropriate. 
  200.    --  If all you need is the stock confirmation dialog, set this property to 
  201.    --  True You can override the way confirmation is done by actually handling 
  202.    --  the "confirm-overwrite" signal; please refer to its documentation for 
  203.    --  the details. 
  204.  
  205.    procedure Set_Current_Name (Chooser : Gtk_File_Chooser; Name : UTF8_String); 
  206.    --  Sets the current name in the file selector, as if entered by the user. 
  207.    --  Note that the name passed in here is a UTF-8 string rather than a 
  208.    --  filename. This function is meant for such uses as a suggested name in a 
  209.    --  "Save As..." dialog. 
  210.    --  If you want to preselect a particular existing file, you should use 
  211.    --  Set_Filename or Set_Uri instead. 
  212.  
  213.    --------------------------- 
  214.    -- Filename manipulation -- 
  215.    --------------------------- 
  216.  
  217.    function Get_Filename (Chooser : Gtk_File_Chooser) return String; 
  218.    --  Gets the filename for the currently selected file in the file selector. 
  219.    --  If multiple files are selected, one of the filenames will be returned at 
  220.    --  random. 
  221.    --  If the file chooser is in folder mode, this function returns the 
  222.    --  selected folder. 
  223.    --  Return value: The currently selected filename, or "" if no file is 
  224.    --  selected, or the selected file can't be represented with a local 
  225.    --  filename. 
  226.  
  227.    function Get_Filenames 
  228.      (Chooser : Gtk_File_Chooser) return Gtk.Enums.String_SList.GSlist; 
  229.    --  Lists all the selected files and subfolders in the current folder of 
  230.    --  Chooser. The returned names are full absolute paths. If files in the 
  231.    --  current folder cannot be represented as local filenames they will be 
  232.    --  ignored. (See Get_Uris). 
  233.    --  The returned value must be freed by the caller, through 
  234.    --  Gtk.Enums.Free_String_List. 
  235.  
  236.    function Set_Filename 
  237.      (Chooser : Gtk_File_Chooser; Filename : String) return Boolean; 
  238.    --  Sets Filename as the current filename for the file chooser, by changing 
  239.    --  to the file's parent folder and actually selecting the file in list. If 
  240.    --  the Chooser is in Action_Save mode, the file's base name will also 
  241.    --  appear in the dialog's file name entry. 
  242.    --  If the file name isn't in the current folder of Chooser, then the 
  243.    --  current folder of Chooser will be changed to the folder containing 
  244.    --  Filename. This is equivalent to a sequence of Unselect_All followed by 
  245.    --  Select_Filename. 
  246.    --  Note that the file must exist, or nothing will be done except for the 
  247.    --  directory change. 
  248.    --  If you are implementing a "File/Save As..." dialog, you should use this 
  249.    --  function if you already have a file name to which the user may save; for 
  250.    --  example, when the user opens an existing file and then does "File/Save 
  251.    --  As..." on it. If you don't have a file name already &mdash; for example, 
  252.    --  if the user just created a new file and is saving it for the first time, 
  253.    --  do not call this function. Instead, use Set_Current_Name. 
  254.    -- 
  255.    --  Returns True if both the folder could be changed and the file was 
  256.    --  selected successfully. 
  257.  
  258.    function Select_Filename 
  259.      (Chooser : Gtk_File_Chooser; Filename : String) return Boolean; 
  260.    procedure Unselect_Filename 
  261.      (Chooser  : Gtk_File_Chooser; Filename : String); 
  262.    --  Selects a filename. If the file name isn't in the current 
  263.    --  folder of Chooser, then the current folder of Chooser will 
  264.    --  be changed to the folder containing Filename. 
  265.    --  Returns True if both the folder could be changed and the file was 
  266.    --  selected successfully. 
  267.  
  268.    procedure Select_All (Chooser : Gtk_File_Chooser); 
  269.    procedure Unselect_All (Chooser : Gtk_File_Chooser); 
  270.    --  Selects all the files in the current folder of a file chooser. 
  271.  
  272.    function Set_Current_Folder 
  273.      (Chooser : Gtk_File_Chooser; Filename : String) return Boolean; 
  274.    --  Sets the current folder for Chooser from a local filename. The user will 
  275.    --  be shown the full contents of the current folder, plus user interface 
  276.    --  elements for navigating to other folders. 
  277.    --  Filename is an absolute file name. 
  278.    --  Returns True if the folder could be changed successfully. 
  279.  
  280.    function Get_Current_Folder (Chooser : Gtk_File_Chooser) return String; 
  281.    --  Gets the current folder of Chooser as a local filename. 
  282.    --  Returns "" if the file chooser was unable to load the last folder that 
  283.    --  was requested from it, for instance with a call to Set_Current_Folder 
  284.    --  with an invalid directory. 
  285.    --  Also returns "" if the selected path cannot be represented as a local 
  286.    --  filename. 
  287.  
  288.    ---------------------- 
  289.    -- URI manipulation -- 
  290.    ---------------------- 
  291.  
  292.    function Set_Uri 
  293.      (Chooser : Gtk_File_Chooser; Uri : String) return Boolean; 
  294.    --  Sets the file referred to by Uri as the current file for the file 
  295.    --  chooser, by changing to the URI's parent folder and actually selecting 
  296.    --  the URI in the list. If the Chooser is Action_Save mode, the URI's base 
  297.    --  name will also appear in the dialog's file name entry. 
  298.    --  If the URI isn't in the current folder of Chooser, then the current 
  299.    --  folder of Chooser will be changed to the folder containing Uri. This is 
  300.    --  equivalent to a sequence of Unselect_All followed by Select_Uri. 
  301.    --  Note that the URI must exist, or nothing will be done except for the 
  302.    --  directory change. 
  303.    --  See also Set_Filename 
  304.    --  Return True if both the folder could be changed and the URI was 
  305.    --  selected successfully. 
  306.  
  307.    function Get_Uri (Chooser : Gtk_File_Chooser) return String; 
  308.    --  Gets the URI for the currently selected file in the file selector. If 
  309.    --  multiple files are selected, one of the filenames will be returned at 
  310.    --  random. 
  311.    --  If the file chooser is in folder mode, this function returns the 
  312.    --  selected folder. 
  313.  
  314.    function Get_Uris 
  315.      (Chooser : Gtk_File_Chooser) return Gtk.Enums.String_SList.GSlist; 
  316.    --  Lists all the selected files and subfolders in the current folder of 
  317.    --  Chooser. The returned names are full absolute URIs. 
  318.    --  The returned value must be freed by the caller 
  319.  
  320.    function Select_Uri 
  321.      (Chooser : Gtk_File_Chooser; Uri : String) return Boolean; 
  322.    procedure Unselect_Uri (Chooser : Gtk_File_Chooser; Uri : String); 
  323.    --  Selects the file by Uri. If the URI doesn't refer to a file in the 
  324.    --  current folder of Chooser, then the current folder of Chooser will be 
  325.    --  changed to the folder containing Uri. 
  326.    --  Return True if both the folder could be changed and the URI was 
  327.    --  selected successfully. 
  328.  
  329.    function Set_Current_Folder_Uri 
  330.      (Chooser : Gtk_File_Chooser; Uri : String) return Boolean; 
  331.    --  Sets the current folder for Chooser from an URI. The user will be shown 
  332.    --  the full contents of the current folder, plus user interface elements 
  333.    --  for navigating to other folders. 
  334.    --  Return True if the folder could be changed successfully. 
  335.  
  336.    function Get_Current_Folder_Uri (Chooser : Gtk_File_Chooser) return String; 
  337.    --  Gets the current folder of Chooser as an URI, or "" if the chooser was 
  338.    --  unable to load the last folder set by Set_Current_Folder_Uri. 
  339.  
  340.    -------------------- 
  341.    -- Preview widget -- 
  342.    -------------------- 
  343.  
  344.    procedure Set_Preview_Widget 
  345.      (Chooser        : Gtk_File_Chooser; 
  346.       Preview_Widget : access Gtk.Widget.Gtk_Widget_Record'Class); 
  347.    function Get_Preview_Widget 
  348.      (Chooser : Gtk_File_Chooser) return Gtk.Widget.Gtk_Widget; 
  349.    --  Sets an application-supplied widget to use to display a custom preview 
  350.    --  of the currently selected file. To implement a preview, after setting 
  351.    --  the preview widget, you connect to the "update-preview" signal, and call 
  352.    --  Get_Preview_Filename() or Get_Preview_Uri on each change. If you can 
  353.    --  display a preview of the new file, update your widget and set the 
  354.    --  preview active using Set_Preview_Widget_Active. Otherwise, set the 
  355.    --  preview inactive. 
  356.    --  When there is no application-supplied preview widget, or the 
  357.    --  application-supplied preview widget is not active, the file chooser may 
  358.    --  display an internally generated preview of the current file or it may 
  359.    --  display no preview at all. 
  360.  
  361.    procedure Set_Preview_Widget_Active 
  362.      (Chooser : Gtk_File_Chooser; 
  363.       Active  : Boolean); 
  364.    function Get_Preview_Widget_Active 
  365.      (Chooser : Gtk_File_Chooser) return Boolean; 
  366.    --  Sets whether the preview widget set by Set_Preview_Widget should be 
  367.    --  shown for the current filename. When Active is set to false, the file 
  368.    --  chooser may display an internally generated preview of the current file 
  369.    --  or it may display no preview at all. 
  370.  
  371.    procedure Set_Use_Preview_Label 
  372.      (Chooser   : Gtk_File_Chooser; 
  373.       Use_Label : Boolean); 
  374.    function Get_Use_Preview_Label (Chooser : Gtk_File_Chooser) return Boolean; 
  375.    --  Sets whether the file chooser should display a stock label with the name 
  376.    --  of the file that is being previewed; the default is True. Applications 
  377.    --  that want to draw the whole preview area themselves should set this to 
  378.    --  False and display the name themselves in their preview widget. 
  379.  
  380.    function Get_Preview_Filename (Chooser : Gtk_File_Chooser) return String; 
  381.    --  Gets the filename that should be previewed in a custom preview 
  382.    --  widget. See Set_Preview_Widget. 
  383.    --  Return "" if no file is selected or it can't be represented as a local 
  384.    --  filename. 
  385.  
  386.    function Get_Preview_Uri (Chooser : Gtk_File_Chooser) return String; 
  387.    --  Gets the URI that should be previewed in a custom preview 
  388.    --  widget. See Set_Preview_Widget. 
  389.    --  Return "" if no file is selected. 
  390.  
  391.    ------------------ 
  392.    -- Extra widget -- 
  393.    ------------------ 
  394.  
  395.    procedure Set_Extra_Widget 
  396.      (Chooser      : Gtk_File_Chooser; 
  397.       Extra_Widget : access Gtk.Widget.Gtk_Widget_Record'Class); 
  398.    function Get_Extra_Widget 
  399.      (Chooser : Gtk_File_Chooser) return Gtk.Widget.Gtk_Widget; 
  400.    --  Sets an application-supplied widget to provide extra options to the user 
  401.  
  402.    ------------- 
  403.    -- Filters -- 
  404.    ------------- 
  405.  
  406.    procedure Add_Filter 
  407.      (Chooser : Gtk_File_Chooser; 
  408.       Filter  : access Gtk.File_Filter.Gtk_File_Filter_Record'Class); 
  409.    procedure Remove_Filter 
  410.      (Chooser : Gtk_File_Chooser; 
  411.       Filter  : access Gtk.File_Filter.Gtk_File_Filter_Record'Class); 
  412.    --  Adds or Removes Filter to the list of filters that the user can select 
  413.    --  between. 
  414.    --  When a filter is selected, only files that are passed by that 
  415.    --  filter are displayed. 
  416.    --  Note that the Chooser takes ownership of the filter, so you have to 
  417.    --  ref and sink it if you want to keep a reference. 
  418.  
  419.    procedure Set_Filter 
  420.      (Chooser : Gtk_File_Chooser; 
  421.       Filter  : access Gtk.File_Filter.Gtk_File_Filter_Record'Class); 
  422.    function Get_Filter 
  423.      (Chooser : Gtk_File_Chooser) return Gtk.File_Filter.Gtk_File_Filter; 
  424.    --  Sets the current filter; only the files that pass the filter will be 
  425.    --  displayed. If the user-selectable list of filters is non-empty, then the 
  426.    --  filter should be one of the filters in that list. Setting the current 
  427.    --  filter when the list of filters is empty is useful if you want to 
  428.    --  restrict the displayed set of files without letting the user change it. 
  429.  
  430.    function List_Filters 
  431.      (Chooser : Gtk_File_Chooser) 
  432.       return Glib.Object.Object_List.GSlist; 
  433.    --  Lists the current set of user-selectable filters. The list contains 
  434.    --  Gtk_File_Filter instances. 
  435.    --  Do not free the contents of list, still owned by gtk+, but you must free 
  436.    --  the list itself with Glib.Object.Object_List.Free. 
  437.  
  438.    --------------------- 
  439.    -- Shorcut folders -- 
  440.    --------------------- 
  441.  
  442.    function Add_Shortcut_Folder 
  443.      (Chooser : Gtk_File_Chooser; 
  444.       Folder  : String) return Glib.Error.GError; 
  445.    function Remove_Shortcut_Folder 
  446.      (Chooser : Gtk_File_Chooser; Folder : String) return Glib.Error.GError; 
  447.    --  Adds a folder to be displayed with the shortcut folders in a file 
  448.    --  chooser. Note that shortcut folders do not get saved, as they are 
  449.    --  provided by the application. For example, you can use this to add a 
  450.    --  "/usr/share/mydrawprogram/Clipart" folder to the volume list. 
  451.    --  Return null if the folder could be added successfully, or the code 
  452.    --  of the error otherwise. 
  453.  
  454.    function List_Shortcut_Folders 
  455.      (Chooser : Gtk_File_Chooser) return Gtk.Enums.String_SList.GSlist; 
  456.    --  Queries the list of shortcut folders in the file chooser, as set by 
  457.    --  Add_Shortcut_Folder. 
  458.    --  The returned value must be freed by the user. 
  459.  
  460.    function Add_Shortcut_Folder_Uri 
  461.      (Chooser : Gtk_File_Chooser; 
  462.       Uri     : String) return Glib.Error.GError; 
  463.    function Remove_Shortcut_Folder_Uri 
  464.      (Chooser : Gtk_File_Chooser; Uri : String) return Glib.Error.GError; 
  465.    --  Adds a folder URI to be displayed with the shortcut folders in a file 
  466.    --  chooser. Note that shortcut folders do not get saved, as they are 
  467.    --  provided by the application. For example, you can use this to add a 
  468.    --  "file:///usr/share/mydrawprogram/Clipart" folder to the volume list. 
  469.    --  Return null if the folder could be added successfully, or the code of 
  470.    --  the error otherwise. 
  471.  
  472.    function List_Shortcut_Folder_Uris 
  473.      (Chooser : Gtk_File_Chooser) return Gtk.Enums.String_SList.GSlist; 
  474.    --  Queries the list of shortcut folders in the file chooser, as set by 
  475.    --  Add_Shortcut_Folder_Uri. 
  476.    --  The returned value must be freed by the user. 
  477.  
  478.    ---------------- 
  479.    -- Properties -- 
  480.    ---------------- 
  481.  
  482.    --  <properties> 
  483.    --  The following properties are defined for this widget. See 
  484.    --  Glib.Properties for more information on properties. 
  485.    -- 
  486.    --  - Name:   action 
  487.    --    Type:   File_Chooser_Action 
  488.    --    See also: Set_Action / Get_Action 
  489.    -- 
  490.    --  - Name:   do-overwrite-confirmation 
  491.    --    Type:   Boolean 
  492.    --    See also: Set_Do_Overwrite_Confirmation/Get_Do_Overwrite_Confirmation 
  493.    -- 
  494.    --  - Name:   extra-widget 
  495.    --    Type:   Gtk_Widget 
  496.    --    See also: Set_Extra_Widget / Get_Extra_Widget 
  497.    -- 
  498.    --  - Name:   file-system-backend 
  499.    --    Type:   String 
  500.    -- 
  501.    --  - Name:   filter 
  502.    --    Type:   Gtk_File_Filter 
  503.    -- 
  504.    --  - Name:   local-only 
  505.    --    Type:   Boolean 
  506.    --    See also: Set_Local_Only / Get_Local_Only 
  507.    -- 
  508.    --  - Name:   preview-widget 
  509.    --    Type:   Gtk_Widget 
  510.    --    See also: Set_Preview_Widget / Get_Preview_Widget 
  511.    -- 
  512.    --  - Name:   preview-widget-active 
  513.    --    Type:   Boolean 
  514.    --    See also: Set_Preview_Widget_Active / Get_Preview_Widget_Active 
  515.    -- 
  516.    --  - Name:   select-multiple 
  517.    --    Type:   Boolean 
  518.    --    See also: Set_Select_Multiple / Get_Select_Multiple 
  519.    -- 
  520.    --  - Name:   show-hidden 
  521.    --    Type:   Boolean 
  522.    --    See also: Set_Show_Hidden / Get_Show_Hidden 
  523.    -- 
  524.    --  - Name:   use-preview-label 
  525.    --    Type:   Boolean 
  526.    ---   See also: Set_Use_Preview_Label / Get_Use_Preview_Label 
  527.    -- 
  528.    --  </properties> 
  529.  
  530.    --  Action_Property : constant Glib.Properties.Property_Enum; 
  531.    Do_Overwrite_Confirmation_Property 
  532.                                   : constant Glib.Properties.Property_Boolean; 
  533.    Extra_Widget_Property          : constant Glib.Properties.Property_Object; 
  534.    File_System_Backend_Property   : constant Glib.Properties.Property_String; 
  535.    Filter_Property                : constant Glib.Properties.Property_Object; 
  536.    Local_Only_Property            : constant Glib.Properties.Property_Boolean; 
  537.    Preview_Widget_Property        : constant Glib.Properties.Property_Object; 
  538.    Preview_Widget_Active_Property : constant Glib.Properties.Property_Boolean; 
  539.    Select_Multiple_Property       : constant Glib.Properties.Property_Boolean; 
  540.    Show_Hidden_Property           : constant Glib.Properties.Property_Boolean; 
  541.    Use_Preview_Label_Property     : constant Glib.Properties.Property_Boolean; 
  542.  
  543.    ------------- 
  544.    -- Signals -- 
  545.    ------------- 
  546.  
  547.    --  <signals> 
  548.    --  The following new signals are defined for this widget: 
  549.    -- 
  550.    --  - "confirm-overwrite" 
  551.    --    function Handler 
  552.    --        (Chooser : Gtk_File_Chooser) return File_Chooser_Confirmation; 
  553.    --    This signal gets emitted whenever it is appropriate to present a 
  554.    --    confirmation dialog when the user has selected a file name that 
  555.    --    already exists. The signal only gets emitted when the file chooser is 
  556.    --    in Action_Save mode. 
  557.    --    Most applications just need to turn on the do-overwrite-confirmation 
  558.    --    property (or call the Set_Do_Overwrite_Confirmation function), and 
  559.    --    they will automatically get a stock confirmation dialog. Applications 
  560.    --    which need to customize this behavior should do that, and also connect 
  561.    --    to the confirm-overwrite signal. 
  562.    --    A signal handler for this signal must return a value which indicates 
  563.    --    the action to take. If the handler determines that the user wants to 
  564.    --    select a different filename, it should return 
  565.    --    Confirmation_Select_Again. If it determines that the user is satisfied 
  566.    --    with his choice of file name, it should return 
  567.    --    Confirmation_Accept_Filename. On the other hand, if it determines that 
  568.    --    the stock confirmation dialog should be used, it should return 
  569.    --    Confirmation_Confir. 
  570.    -- 
  571.    --  - "current-folder-changed" 
  572.    --    procedure Handler (Chooser : Gtk_File_Chooser); 
  573.    --    This signal is emitted when the current folder in a Gtk_File_Chooser 
  574.    --    changes. This can happen due to the user performing some action that 
  575.    --    changes folders, such as selecting a bookmark or visiting a folder on 
  576.    --    the file list. It can also happen as a result of calling a function to 
  577.    --    explicitly change the current folder in a file chooser. 
  578.    --    Normally you do not need to connect to this signal, unless you need to 
  579.    --    keep track of which folder a file chooser is showing. 
  580.    -- 
  581.    --  - "file-activated" 
  582.    --    procedure Handler (Chooser : Gtk_File_Chooser); 
  583.    --    This signal is emitted when the user "activates" a file in the file 
  584.    --    chooser. This can happen by double-clicking on a file in the file 
  585.    --    list, or by pressing Enter. 
  586.    --    Normally you do not need to connect to this signal. It is used 
  587.    --    internally by Gtk_File_Chooser_Dialog to know when to activate the 
  588.    --    default button in the dialog. 
  589.    -- 
  590.    --  - "selection-changed" 
  591.    --    procedure Handler (Chooser : Gtk_File_Chooser); 
  592.    --    This signal is emitted when there is a change in the set of selected 
  593.    --    files in a Gtk_File_Chooser. This can happen when the user modifies 
  594.    --    the selection with the mouse or the keyboard, or when explicitly 
  595.    --    calling functions to change the selection. 
  596.    --    Normally you do not need to connect to this signal, as it is easier to 
  597.    --    wait for the file chooser to finish running, and then to get the list 
  598.    --    of selected files using the functions mentioned below. 
  599.    -- 
  600.    --  - "update-preview" 
  601.    --    procedure Handler (Chooser : Gtk_File_Chooser); 
  602.    --    This signal is emitted when the preview in a file chooser should be 
  603.    --    regenerated. For example, this can happen when the currently selected 
  604.    --    file changes. You should use this signal if you want your file chooser 
  605.    --    to have a preview widget. 
  606.    --    Once you have installed a preview widget with Set_Preview_Widget, you 
  607.    --    should update it when this signal is emitted. You can use the 
  608.    --    functions Get_Preview_Filename or Get_Preview_Uri to get the name of 
  609.    --    the file to preview. Your widget may not be able to preview all kinds 
  610.    --    of files; your callback must call Set_Preview_Wiget_Active to inform 
  611.    --    the file chooser about whether the preview was generated successfully 
  612.    --    or not. 
  613.    --  </signals> 
  614.  
  615.    Signal_Confirm_Overwrite      : constant Glib.Signal_Name := 
  616.                                      "confirm-overwrite"; 
  617.    Signal_Current_Folder_Changed : constant Glib.Signal_Name := 
  618.                                      "current-folder-changed"; 
  619.    Signal_File_Activated         : constant Glib.Signal_Name := 
  620.                                      "file-activated"; 
  621.    Signal_Selection_Changed      : constant Glib.Signal_Name := 
  622.                                      "selection-changed"; 
  623.    Signal_Update_Preview         : constant Glib.Signal_Name := 
  624.                                      "update-preview"; 
  625.  
  626. private 
  627.    pragma Import (C, Get_Type, "gtk_file_chooser_get_type"); 
  628.    pragma Import (C, Set_Action, "gtk_file_chooser_set_action"); 
  629.    pragma Import (C, Get_Action, "gtk_file_chooser_get_action"); 
  630.    pragma Import (C, Select_All, "gtk_file_chooser_select_all"); 
  631.    pragma Import (C, Unselect_All, "gtk_file_chooser_unselect_all"); 
  632.  
  633. --     Action_Property : constant Glib.Properties.Property_Enum := 
  634. --       Glib.Properties.Build ("action"); 
  635.    Do_Overwrite_Confirmation_Property 
  636.      : constant Glib.Properties.Property_Boolean := 
  637.      Glib.Properties.Build ("do-overwrite-confirmation"); 
  638.    Extra_Widget_Property : constant Glib.Properties.Property_Object := 
  639.      Glib.Properties.Build ("extra-widget"); 
  640.    File_System_Backend_Property : constant Glib.Properties.Property_String := 
  641.      Glib.Properties.Build ("file-system-backend"); 
  642.    Filter_Property : constant Glib.Properties.Property_Object := 
  643.      Glib.Properties.Build ("filter"); 
  644.    Local_Only_Property : constant Glib.Properties.Property_Boolean := 
  645.      Glib.Properties.Build ("local-only"); 
  646.    Preview_Widget_Property : constant Glib.Properties.Property_Object := 
  647.      Glib.Properties.Build ("preview-widget"); 
  648.    Preview_Widget_Active_Property : constant Glib.Properties.Property_Boolean 
  649.      := Glib.Properties.Build ("preview-widget-active"); 
  650.    Select_Multiple_Property : constant Glib.Properties.Property_Boolean := 
  651.      Glib.Properties.Build ("select-multiple"); 
  652.    Show_Hidden_Property : constant Glib.Properties.Property_Boolean := 
  653.      Glib.Properties.Build ("show-hidden"); 
  654.    Use_Preview_Label_Property : constant Glib.Properties.Property_Boolean := 
  655.      Glib.Properties.Build ("use-preview-label"); 
  656.  
  657. end Gtk.File_Chooser; 
  658.  
  659. --  No binding: gtk_file_chooser_error_quark