Data Structures | Macros | Typedefs | Enumerations | Functions
gntfilesel.h File Reference

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)
 
GntWidgetgnt_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...
 
GntFilegnt_file_new (const char *name, unsigned long size)
 Create a new GntFile. More...
 
GntFilegnt_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

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

Create a new GntFile.

Parameters
nameThe name of the file.
sizeThe size of the file.
Returns
The newly created GntFile.
GntFile* gnt_file_new_dir ( const char *  name)

Create a new GntFile for a directory.

Parameters
nameThe name of the directory.
Returns
The newly created GntFile.
gboolean gnt_file_sel_get_dirs_only ( GntFileSel sel)

Check whether the file selector allows only selecting directories.

Parameters
selThe file selector.
Returns
TRUE if only directories can be selected.
G_BEGIN_DECLS GType gnt_file_sel_get_gtype ( void  )
Returns
GType for GntFileSel.
gboolean gnt_file_sel_get_must_exist ( GntFileSel sel)

Check whether the selector allows selecting non-existent files.

Parameters
selThe file selector.
Returns
TRUE if the selected file must exist, FALSE if a non-existent file can be selected.
char* gnt_file_sel_get_selected_file ( GntFileSel sel)

Get the selected file in the selector.

Parameters
selThe file selector.
Returns
The path of the selected file. The caller should g_free the returned string.
GList* gnt_file_sel_get_selected_multi_files ( GntFileSel sel)

Get the list of selected files in the selector.

Parameters
selThe 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.
GntWidget* gnt_file_sel_new ( void  )

Create a new file selector.

Returns
The newly created file selector.
gboolean gnt_file_sel_set_current_location ( GntFileSel sel,
const char *  path 
)

Set the current location of the file selector.

Parameters
selThe file selector.
pathThe current path of the selector.
Returns
TRUE if the current location was successfully changed, FALSE otherwise.
void gnt_file_sel_set_dirs_only ( GntFileSel sel,
gboolean  dirs 
)

Set wheter to only allow selecting directories.

Parameters
selThe file selector.
dirsTRUE if only directories can be selected, FALSE if files can also be selected.
void gnt_file_sel_set_multi_select ( GntFileSel sel,
gboolean  set 
)

Allow selecting multiple files.

Parameters
selThe file selector.
setTRUE if selecting multiple files should be allowed.
void gnt_file_sel_set_must_exist ( GntFileSel sel,
gboolean  must 
)

Set whether a selected file must exist.

Parameters
selThe file selector.
mustTRUE if the selected file must exist.
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
selThe file selector.
read_fnThe custom read function.
void gnt_file_sel_set_suggested_filename ( GntFileSel sel,
const char *  suggest 
)

Set the suggested file to have selected at startup.

Parameters
selThe file selector.
suggestThe suggested filename.