type Gtk_File_Filter_Record is new Glib.Object.GObject_Record with private;
type Gtk_File_Filter is access all Gtk_File_Filter_Record'Class;
type File_Filter_Info is new Glib.C_Proxy;
type File_Filter_Func is access function (Info : File_Filter_Info) return Gboolean;
Filter_Filename : constant File_Filter_Flags := 2 ** 0;
Filter_Uri : constant File_Filter_Flags := 2 ** 1;
Filter_Display_Name : constant File_Filter_Flags := 2 ** 2;
Filter_Mime_Type : constant File_Filter_Flags := 2 ** 3;
function Get_Filename
| ( | Info | : File_Filter_Info) return String; |
function Get_Uri
| ( | Info | : File_Filter_Info) return String; |
function Get_Display_Name
| ( | Info | : File_Filter_Info) return String; |
function Get_Mime_Type
| ( | Info | : File_Filter_Info) return String; |
function Get_Type return GType;
procedure Gtk_New
| ( | Filter | : out Gtk_File_Filter); |
procedure Initialize
| ( | Filter | : access Gtk_File_Filter_Record'Class); |
procedure Set_Name
| ( | Filter | : access Gtk_File_Filter_Record; |
| Name | : String); |
function Get_Name
| ( | Filter | : access Gtk_File_Filter_Record) return String; |
procedure Add_Mime_Type
| ( | Filter | : access Gtk_File_Filter_Record; |
| Mime_Type | : String); |
procedure Add_Pattern
| ( | Filter | : access Gtk_File_Filter_Record; |
| Pattern | : String); |
procedure Add_Pixbuf_Formats
| ( | Filter | : access Gtk_File_Filter_Record); |
procedure Add_Custom
| ( | Filter | : access Gtk_File_Filter_Record; |
| Needed | : File_Filter_Flags; | |
| Func | : File_Filter_Func; | |
| Data | : System.Address := System.Null_Address; | |
| Notify | : G_Destroy_Notify_Address := null); |
A Gtk_File_Filter can be used to restrict the files being shown in a Gtk_File_Chooser. Files can be filtered based on their name (with Add_Pattern), on their mime type (with Add_Mime_Type), or by a custom filter function (with Add_Custom).
Filtering by mime types handles aliasing and subclassing of mime types; e.g. a filter for text/plain also matches a file with mime type application/rtf, since application/rtf is a subclass of text/plain. Note that Gtk_File_Filter allows wildcards for the subtype of a mime type, so you can e.g. filter for image/*.
Normally, filters are used by adding them to a Gtk_File_Chooser, see Add_Filter, but it is also possible to manually use a filter on a file with Filter.
Binding from C File version 2.8.17