gntfilesel.h File Reference
GNT (GLib Ncurses Toolkit)

File selector API. More...

`#include "gntwindow.h"`
`#include "gnt.h"`
`#include "gntcolors.h"`
`#include "gntkeys.h"`

Go to the source code of this file.

## Data Structures

struct | _GntFileSel
struct | _GntFileSelClass
struct | _GntFile

## Macros

#define | GNT_TYPE_FILE_SEL (gnt_file_sel_get_gtype())
#define | GNT_FILE_SEL(obj) (G_TYPE_CHECK_INSTANCE_CAST((obj), GNT_TYPE_FILE_SEL, GntFileSel))
#define | GNT_FILE_SEL_CLASS(klass) (G_TYPE_CHECK_CLASS_CAST((klass), GNT_TYPE_FILE_SEL, GntFileSelClass))
#define | GNT_IS_FILE_SEL(obj) (G_TYPE_CHECK_INSTANCE_TYPE((obj), GNT_TYPE_FILE_SEL))
#define | GNT_IS_FILE_SEL_CLASS(klass) (G_TYPE_CHECK_CLASS_TYPE((klass), GNT_TYPE_FILE_SEL))
#define | GNT_FILE_SEL_GET_CLASS(obj) (G_TYPE_INSTANCE_GET_CLASS((obj), GNT_TYPE_FILE_SEL, GntFileSelClass))
#define | GNT_FILE_SEL_FLAGS(obj) (GNT_FILE_SEL(obj)->priv.flags)
#define | GNT_FILE_SEL_SET_FLAGS(obj, flags) (GNT_FILE_SEL_FLAGS(obj) |= flags)
#define | GNT_FILE_SEL_UNSET_FLAGS(obj, flags) (GNT_FILE_SEL_FLAGS(obj) &= ~(flags))

## Typedefs

typedef struct _GntFileSel | GntFileSel
typedef struct _GntFileSelPriv | GntFileSelPriv
typedef struct _GntFileSelClass | GntFileSelClass
typedef struct _GntFile | GntFile
typedef enum _GntFileType | GntFileType

## Enumerations

enum | _GntFileType { GNT_FILE_REGULAR, GNT_FILE_DIR }

## Functions

G_BEGIN_DECLS GType | gnt_file_sel_get_gtype (void)
GntWidget * | gnt_file_sel_new (void)
| Create a new file selector. More...
gboolean | gnt_file_sel_set_current_location (GntFileSel *sel, const char *path)
| Set the current location of the file selector. More...
void | gnt_file_sel_set_dirs_only (GntFileSel *sel, gboolean dirs)
| Set wheter to only allow selecting directories. More...
gboolean | gnt_file_sel_get_dirs_only (GntFileSel *sel)
| Check whether the file selector allows only selecting directories. More...
void | gnt_file_sel_set_must_exist (GntFileSel *sel, gboolean must)
| Set whether a selected file must exist. More...
gboolean | gnt_file_sel_get_must_exist (GntFileSel *sel)
| Check whether the selector allows selecting non-existent files. More...
char * | gnt_file_sel_get_selected_file (GntFileSel *sel)
| Get the selected file in the selector. More...
GList * | gnt_file_sel_get_selected_multi_files (GntFileSel *sel)
| Get the list of selected files in the selector. More...
void | gnt_file_sel_set_multi_select (GntFileSel *sel, gboolean set)
| Allow selecting multiple files. More...
void | gnt_file_sel_set_suggested_filename (GntFileSel *sel, const char *suggest)
| Set the suggested file to have selected at startup. More...
void | gnt_file_sel_set_read_fn (GntFileSel *sel, gboolean(*read_fn)(const char *path, GList **files, GError **error))
| Set custom functions to read the names of files. More...
GntFile * | gnt_file_new (const char *name, unsigned long size)
| Create a new GntFile. More...
GntFile * | gnt_file_new_dir (const char *name)
| Create a new GntFile for a directory. More...

## Detailed Description

File selector API.

Definition in file gntfilesel.h.

## Function Documentation

## gnt_file_new()

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

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 | ) |

Create a new GntFile for a directory.

Parameters

  name | The name of the directory.

Returns
  The newly created GntFile.

## 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_get_gtype()

G_BEGIN_DECLS GType gnt_file_sel_get_gtype | ( | void |  | ) |

Returns
  GType for GntFileSel.

## 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.

## 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_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_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_set_read_fn()

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

Set custom functions to read the names of files.

Parameters

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

## 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.