GIMP Library Reference Manual
<<< Previous Page | Home | Up | Next Page >>>

# GimpFileSelection

## Name

GimpFileSelection -- Widget for entering a filename.

## Synopsis

    struct      GimpFileSelection;
    #define     GIMP_FILE_SELECTION             (obj)
    GtkWidget*  gimp_file_selection_new         (const gchar *title,
                                                 const gchar *filename,
                                                 gboolean dir_only,
                                                 gboolean check_valid);
    gchar*      gimp_file_selection_get_filename
                                                (GimpFileSelection *gfs);
    void        gimp_file_selection_set_filename
                                                (GimpFileSelection *gfs,
                                                 const gchar *filename);

## Object Hierarchy

      GtkObject
       +----GtkWidget
             +----GtkContainer
                   +----GtkBox
                         +----GtkHBox
                               +----GimpFileSelection

## Signal Prototypes

    "filename-changed"
                void        user_function      (GimpFileSelection *gimpfileselection,
                                                gpointer user_data);

## Description

This widget is used to enter filenames or directories.

There is a GtkEntry for entering the filename manually and a "..." button which will pop up a GtkFileSelection dialog.

You can restrict the GimpFileSelection to directories. In this case the filename listbox of the GtkFileSelection dialog will be hidden.

If you specify `check_valid` as TRUE in gimp_file_selection_new() the entered filename will be checked for validity and a pixmap will be shown which indicates if the file exists or not.

Whenever the user changes the filename, the "filename_changed" signal will be emitted.

## Details

### struct GimpFileSelection

    struct GimpFileSelection;

### GIMP_FILE_SELECTION()

    #define GIMP_FILE_SELECTION(obj)            (GTK_CHECK_CAST ((obj), GIMP_TYPE_FILE_SELECTION, GimpFileSelection))

Checks if the passed pointer is a pointer to a GimpFileSelection and performs the cast if valid.

`obj` : | The pointer to cast.

### gimp_file_selection_new ()

    GtkWidget*  gimp_file_selection_new         (const gchar *title,
                                                 const gchar *filename,
                                                 gboolean dir_only,
                                                 gboolean check_valid);

Creates a new GimpFileSelection widget.

`title` : | The title of the GtkFileSelection dialog.
`filename` : | The initial filename.
`dir_only` : | TRUE if the file selection should accept directories only.
`check_valid` : | TRUE if the widget should check if the entered file really exists.
Returns : | A pointer to the new GimpFileSelection widget.

### gimp_file_selection_get_filename ()

    gchar*      gimp_file_selection_get_filename
                                                (GimpFileSelection *gfs);

Note that you have to g_free() the returned string.

`gfs` : | The file selection you want to know the filename from.
Returns : | The file or directory the user has entered.

### gimp_file_selection_set_filename ()

    void        gimp_file_selection_set_filename
                                                (GimpFileSelection *gfs,
                                                 const gchar *filename);

If you specified `check_valid` as TRUE in gimp_file_selection_new() the GimpFileSelection will immediately check the validity of the file name.

`gfs` : | The file selection you want to set the filename for.
`filename` : | The new filename.

## Signals

### The "filename-changed" signal

    void        user_function                  (GimpFileSelection *gimpfileselection,
                                                gpointer user_data);

This signal is emitted whenever the user changes the filename.

`gimpfileselection` : | the object which received the signal.
`user_data` : | user data set when the signal handler was connected.

## See Also

GimpPathEditor

<<< Previous Page | Home | Up | Next Page >>>
GimpColorButton | GimpPathEditor