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

Defines

#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.
gboolean gnt_file_sel_set_current_location (GntFileSel *sel, const char *path)
 Set the current location of the file selector.
void gnt_file_sel_set_dirs_only (GntFileSel *sel, gboolean dirs)
 Set wheter to only allow selecting directories.
gboolean gnt_file_sel_get_dirs_only (GntFileSel *sel)
 Check whether the file selector allows only selecting directories.
void gnt_file_sel_set_must_exist (GntFileSel *sel, gboolean must)
 Set whether a selected file must exist.
gboolean gnt_file_sel_get_must_exist (GntFileSel *sel)
 Check whether the selector allows selecting non-existent files.
char * gnt_file_sel_get_selected_file (GntFileSel *sel)
 Get the selected file in the selector.
GList * gnt_file_sel_get_selected_multi_files (GntFileSel *sel)
 Get the list of selected files in the selector.
void gnt_file_sel_set_multi_select (GntFileSel *sel, gboolean set)
 Allow selecting multiple files.
void gnt_file_sel_set_suggested_filename (GntFileSel *sel, const char *suggest)
 Set the suggested file to have selected at startup.
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.
GntFile * gnt_file_new (const char *name, unsigned long size)
 Create a new GntFile.
GntFile * gnt_file_new_dir (const char *name)
 Create a new GntFile for a directory.


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:
name The name of the file.
size The 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:
name The 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:
sel The 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:
sel The 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:
sel The 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:
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.

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:
sel The file selector.
path The 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:
sel The file selector.
dirs TRUE 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:
sel The file selector.
set TRUE 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:
sel The file selector.
must TRUE 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:
sel The file selector.
read_fn The 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:
sel The file selector.
suggest The suggested filename.