Data Structures | Defines | Functions | Variables

filetypes.h File Reference

Filetype detection, file extensions and filetype menu items. More...

Data Structures

struct  GeanyFiletype
 Represents a filetype. More...

Defines

#define filetypes   ((GeanyFiletype **)GEANY(filetypes_array)->pdata)
 Wraps filetypes_array so it can be used with C array syntax.

Functions

GeanyFiletypefiletypes_detect_from_file (const gchar *utf8_filename)
 Detects filetype based on a shebang line in the file or the filename extension.
const gchar * filetypes_get_display_name (GeanyFiletype *ft)
 Gets ft->name or a translation for filetype None.
const GSList * filetypes_get_sorted_by_name (void)
 Gets a list of filetype pointers sorted by name.
GeanyFiletypefiletypes_index (gint idx)
 Accessor function for GeanyData::filetypes_array items.
GeanyFiletypefiletypes_lookup_by_name (const gchar *name)
 Finds a filetype pointer from its name field.

Variables

GSList * filetypes_by_title
 List of filetype pointers sorted by name, but with filetypes_index(GEANY_FILETYPES_NONE) first, as this is usually treated specially.

Detailed Description

Filetype detection, file extensions and filetype menu items.


Define Documentation

#define filetypes   ((GeanyFiletype **)GEANY(filetypes_array)->pdata)

Wraps filetypes_array so it can be used with C array syntax.

Example: filetypes[GEANY_FILETYPES_C]->name = ...;

See also:
filetypes_index().

Function Documentation

GeanyFiletype* filetypes_detect_from_file ( const gchar *  utf8_filename  ) 

Detects filetype based on a shebang line in the file or the filename extension.

Parameters:
utf8_filename The filename in UTF-8 encoding.
Returns:
The detected filetype for utf8_filename or filetypes[GEANY_FILETYPES_NONE] if it could not be detected.
const gchar* filetypes_get_display_name ( GeanyFiletype ft  ) 

Gets ft->name or a translation for filetype None.

Parameters:
ft .
Returns:
.
Since:
Geany 0.20
const GSList* filetypes_get_sorted_by_name ( void   ) 

Gets a list of filetype pointers sorted by name.

The list does not change on subsequent calls.

Returns:
The list - do not free.
See also:
filetypes_by_title.
GeanyFiletype* filetypes_index ( gint  idx  ) 

Accessor function for GeanyData::filetypes_array items.

Example:

 ft = filetypes_index(GEANY_FILETYPES_C); 
Parameters:
idx filetypes_array index.
Returns:
The filetype, or NULL if idx is out of range.
Since:
0.16
GeanyFiletype* filetypes_lookup_by_name ( const gchar *  name  ) 

Finds a filetype pointer from its name field.

Parameters:
name Filetype name.
Returns:
The filetype found, or NULL.
Since:
0.15

Variable Documentation

List of filetype pointers sorted by name, but with filetypes_index(GEANY_FILETYPES_NONE) first, as this is usually treated specially.

The list does not change (after filetypes have been initialized), so you can use

 g_slist_nth_data(filetypes_by_title, n) 

and expect the same result at different times.

See also:
filetypes_get_sorted_by_name().