GntFileSel: GNT Reference Manual

## GntFileSel GntFileSel — A widget for selecting a file or directory |

## Functions

#define | GNT_FILE_SEL_FLAGS()
#define | GNT_FILE_SEL_SET_FLAGS()
#define | GNT_FILE_SEL_UNSET_FLAGS()
GType | gnt_file_sel_get_gtype ()
GntWidget * | gnt_file_sel_new ()
gboolean | gnt_file_sel_set_current_location ()
void | gnt_file_sel_set_dirs_only ()
gboolean | gnt_file_sel_get_dirs_only ()
void | gnt_file_sel_set_must_exist ()
gboolean | gnt_file_sel_get_must_exist ()
char * | gnt_file_sel_get_selected_file ()
GList * | gnt_file_sel_get_selected_multi_files ()
void | gnt_file_sel_set_multi_select ()
void | gnt_file_sel_set_suggested_filename ()
void | gnt_file_sel_set_read_fn ()
GntFile * | gnt_file_new ()
GntFile * | gnt_file_new_dir ()

## Types and Values

struct | GntFileSel
enum | GntFileType
struct | GntFile
| GntFileSelPriv

## Description

## Functions

### GNT_FILE_SEL_FLAGS()

    #define GNT_FILE_SEL_FLAGS(obj)				(GNT_FILE_SEL(obj)->priv.flags)

`GNT_FILE_SEL_FLAGS` has been deprecated since version 2.14.0 and should not be used in newly-written code.

This is an internal implementation detail.

### GNT_FILE_SEL_SET_FLAGS()

    #define GNT_FILE_SEL_SET_FLAGS(obj, flags)		(GNT_FILE_SEL_FLAGS(obj) |= flags)

`GNT_FILE_SEL_SET_FLAGS` has been deprecated since version 2.14.0 and should not be used in newly-written code.

This is an internal implementation detail.

### GNT_FILE_SEL_UNSET_FLAGS()

    #define GNT_FILE_SEL_UNSET_FLAGS(obj, flags) (GNT_FILE_SEL_FLAGS(obj) &= ~(flags))

`GNT_FILE_SEL_UNSET_FLAGS` has been deprecated since version 2.14.0 and should not be used in newly-written code.

This is an internal implementation detail.

### gnt_file_sel_get_gtype ()

    GType
    gnt_file_sel_get_gtype (void);

#### Returns

GType for GntFileSel.

### gnt_file_sel_new ()

    GntWidget *
    gnt_file_sel_new (void);

Create a new file selector.

#### Returns

The newly created file selector.

### gnt_file_sel_set_current_location ()

    gboolean
    gnt_file_sel_set_current_location (GntFileSel *sel,
                                       const char *path);

Set the current location of the file selector.

#### Parameters

sel | The file selector. |
path | The current path of the selector. |

#### Returns

`TRUE` if the current location was successfully changed, `FALSE` otherwise.

### gnt_file_sel_set_dirs_only ()

    void
    gnt_file_sel_set_dirs_only (GntFileSel *sel,
                                gboolean dirs);

Set wheter to only allow selecting directories.

#### Parameters

sel | The file selector. |
dirs | `TRUE` if only directories can be selected, `FALSE` if files can also be selected. |

### gnt_file_sel_get_dirs_only ()

    gboolean
    gnt_file_sel_get_dirs_only (GntFileSel *sel);

Check whether the file selector allows only selecting directories.

#### Parameters

sel | The file selector. |

#### Returns

`TRUE` if only directories can be selected.

### gnt_file_sel_set_must_exist ()

    void
    gnt_file_sel_set_must_exist (GntFileSel *sel,
                                 gboolean must);

Set whether a selected file must exist.

#### Parameters

sel | The file selector. |
must | `TRUE` if the selected file must exist. |

### gnt_file_sel_get_must_exist ()

    gboolean
    gnt_file_sel_get_must_exist (GntFileSel *sel);

Check whether the selector allows selecting non-existent files.

#### Parameters

sel | The file selector. |

#### Returns

`TRUE` if the selected file must exist, `FALSE` if a non-existent file can be selected.

### gnt_file_sel_get_selected_file ()

    char *
    gnt_file_sel_get_selected_file (GntFileSel *sel);

Get the selected file in the selector.

#### Parameters

sel | The file selector. |

#### Returns

The path of the selected file. The caller should g_free the returned string.

### gnt_file_sel_get_selected_multi_files ()

    GList *
    gnt_file_sel_get_selected_multi_files (GntFileSel *sel);

Get the list of selected files in the selector.

#### Parameters

sel | The file selector. |

#### Returns

A list of paths for the selected files. The caller must `g_free()` the contents of the list, and `g_list_free()` the list.

[transfer full][element-type filename]

### gnt_file_sel_set_multi_select ()

    void
    gnt_file_sel_set_multi_select (GntFileSel *sel,
                                   gboolean set);

Allow selecting multiple files.

#### Parameters

sel | The file selector. |
set | `TRUE` if selecting multiple files should be allowed. |

### gnt_file_sel_set_suggested_filename ()

    void
    gnt_file_sel_set_suggested_filename (GntFileSel *sel,
                                         const char *suggest);

Set the suggested file to have selected at startup.

#### Parameters

sel | The file selector. |
suggest | The suggested filename. |

### gnt_file_sel_set_read_fn ()

    void
    gnt_file_sel_set_read_fn (GntFileSel *sel,
                              gboolean (*read_fn) (const char *path, GList **files, GError **error));

`gnt_file_sel_set_read_fn` has been deprecated since version 2.14.0 and should not be used in newly-written code.

This is an internal implementation detail.

Set custom functions to read the names of files.

#### Parameters

sel | The file selector. |
read_fn | The custom read function. |

### gnt_file_new ()

    GntFile *
    gnt_file_new (const char *name,
                  unsigned long  size);

`gnt_file_new` has been deprecated since version 2.14.0 and should not be used in newly-written code.

This is an internal implementation detail.

Create a new GntFile.

#### Parameters

name | The name of the file. |
size | The size of the file. |

#### Returns

The newly created GntFile.

### gnt_file_new_dir ()

    GntFile *
    gnt_file_new_dir (const char *name);

`gnt_file_new_dir` has been deprecated since version 2.14.0 and should not be used in newly-written code.

This is an internal implementation detail.

Create a new GntFile for a directory.

#### Parameters

name | The name of the directory. |

#### Returns

The newly created GntFile.

## Types and Values

### struct GntFileSel

    struct GntFileSel {
    	GntWindow parent;

    	GntWidget *GNTSEAL(dirs);     /* list of files */
    	GntWidget *GNTSEAL(files);    /* list of directories */
    	GntWidget *GNTSEAL(location); /* location entry */

    	GntWidget *GNTSEAL(select);   /* select button */
    	GntWidget *GNTSEAL(cancel);   /* cancel button */

    	char *GNTSEAL(current); /* Full path of the current location */
    	char *GNTSEAL(suggest); /* Suggested filename */
    	/* XXX: someone should make these useful */
    	gboolean GNTSEAL(must_exist); /* Make sure the selected file (the name entered in 'location') exists */
    	gboolean GNTSEAL(dirsonly);   /* Show only directories */
    	gboolean GNTSEAL(multiselect);
    	GList *GNTSEAL(tags);         /* List of tagged files when multiselect is set */

    	gboolean (*GNTSEAL(read_fn))(const char *path, GList **files, GError **error);
    };

Access to any fields is deprecated. See inline comments for replacements.

### enum GntFileType

`GntFileType` has been deprecated since version 2.14.0 and should not be used in newly-written code.

This is an internal implementation detail. Use GFile from GIO for a similar abstraction.

#### Members

GNT_FILE_REGULAR |  |
GNT_FILE_DIR |  |

### struct GntFile

    struct GntFile {
    	char *GNTSEAL(fullpath);
    	char *GNTSEAL(basename);
    	GntFileType GNTSEAL(type);
    	unsigned long GNTSEAL(size);
    };

`GntFile` has been deprecated since version 2.14.0 and should not be used in newly-written code.

This is an internal implementation detail. Use GFile from GIO for a similar abstraction.

### GntFileSelPriv

    typedef struct _GntFileSelPriv GntFileSelPriv;

`GntFileSelPriv` has been deprecated since version 2.14.0 and should not be used in newly-written code.

This is an internal implementation detail.