11.62Class GtkFileFilter

A filter for selecting a file subset

Class GtkFileFilter

A GtkFileFilter can be used to restrict the files being shown in a GtkFileChooser. Files can be filtered based on their name (with gtk_file_filter_add_pattern()), on their mime type (with gtk_file_filter_add_mime_type()), or by a custom filter function (with gtk_file_filter_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 GtkFileFilter 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 GtkFileChooser, see gtk_file_chooser_add_filter(), but it is also possible to manually use a filter on a file with gtk_file_filter_filter().

Creates a new GtkFileFilter with no rules added to it. Such a filter doesn't accept any files, so is not particularly useful until you add rules with gtk_file_filter_add_mime_type(), gtk_file_filter_add_pattern(), or gtk_file_filter_add_custom().

[...]

Methods
add_customAdds rule to a filter that allows files based on a custom callback function.
add_mime_typeAdds a rule allowing a given mime type to filter.
add_patternAdds a rule allowing a shell style glob to a filter.
add_pixbuf_formatsAdds a rule allowing image files in the formats supported by GdkPixbuf.
filterTests whether a file should be displayed according to filter.
get_nameGets the human-readable name for the filter.
get_neededGets the fields that need to be filled in for the structure passed to gtk_file_filter_filter()
set_nameSets the human-readable name of the filter.

Methods

add_custom

Adds rule to a filter that allows files based on a custom callback function.

GtkFileFilter.add_custom( bitfield, func, data )
bitfield bitfield of flags (GtkFileFilterFlags) indicating the information that the custom filter function needs.
func callback function; if the function returns TRUE, then the file will be displayed.
data data to pass to func, or nil

The bitfield needed which is passed in provides information about what sorts of information that the filter function needs; this allows GTK+ to avoid retrieving expensive information when it isn't needed by the filter.

add_mime_type

Adds a rule allowing a given mime type to filter.

GtkFileFilter.add_mime_type( mime_type )
mime_type name of a MIME type

add_pattern

Adds a rule allowing a shell style glob to a filter.

GtkFileFilter.add_pattern( pattern )
pattern a shell style glob

add_pixbuf_formats

Adds a rule allowing image files in the formats supported by GdkPixbuf.

GtkFileFilter.add_pixbuf_formats()

filter

Tests whether a file should be displayed according to filter.

GtkFileFilter.filter( filter_info )
filter_info a GtkFileFilterInfo structure containing information about a file.
ReturnTRUE if the file should be displayed

The GtkFileFilterInfo structure filter_info should include the fields returned from gtk_file_filter_get_needed().

This function will not typically be used by applications; it is intended principally for use in the implementation of GtkFileChooser.

get_name

Gets the human-readable name for the filter.

GtkFileFilter.get_name()
ReturnThe human-readable name of the filter, or NULL.

get_needed

Gets the fields that need to be filled in for the structure passed to gtk_file_filter_filter()

GtkFileFilter.get_needed()
Returnbitfield of flags (GtkFileFilterFlags) indicating needed fields when calling gtk_file_filter_filter()

This function will not typically be used by applications; it is intended principally for use in the implementation of GtkFileChooser.

set_name

Sets the human-readable name of the filter.

GtkFileFilter.set_name( name )
name the human-readable-name for the filter, or NULL to remove any existing name.

This is the string that will be displayed in the file selector user interface if there is a selectable list of filters.

Made with http://www.falconpl.org