## GFilenameCompleter

GFilenameCompleter — Filename Completer

## Synopsis

    #include <gio/gio.h>

                        GFilenameCompleter;
    GFilenameCompleter * g_filename_completer_new           (void);
    char *              g_filename_completer_get_completion_suffix
                                                            (GFilenameCompleter *completer,
                                                             const char *initial_text);
    char **             g_filename_completer_get_completions
                                                            (GFilenameCompleter *completer,
                                                             const char *initial_text);
    void                g_filename_completer_set_dirs_only  (GFilenameCompleter *completer,
                                                             gboolean dirs_only);

## Object Hierarchy

      GObject
       +----GFilenameCompleter

## Signals

      "got-completion-data"                            : Run Last

## Description

Completes partial file and directory names given a partial string by looking in the file system for clues. Can return a list of possible completion strings for widget implementations.

## Details

### GFilenameCompleter

    typedef struct _GFilenameCompleter GFilenameCompleter;

Completes filenames based on files that exist within the file system.

### g_filename_completer_new ()

    GFilenameCompleter * g_filename_completer_new           (void);

Creates a new filename completer.

Returns : | a GFilenameCompleter.

### g_filename_completer_get_completion_suffix ()

    char *              g_filename_completer_get_completion_suffix
                                                            (GFilenameCompleter *completer,
                                                             const char *initial_text);

Obtains a completion for `initial_text` from `completer`.

`completer` : | the filename completer.
`initial_text` : | text to be completed.
Returns : | a completed string, or `NULL` if no completion exists. This string is not owned by GIO, so remember to `g_free()` it when finished.

### g_filename_completer_get_completions ()

    char **             g_filename_completer_get_completions
                                                            (GFilenameCompleter *completer,
                                                             const char *initial_text);

Gets an array of completion strings for a given initial text.

`completer` : | the filename completer.
`initial_text` : | text to be completed.
Returns : | array of strings with possible completions for `initial_text`. This array must be freed by `g_strfreev()` when finished.

### g_filename_completer_set_dirs_only ()

    void                g_filename_completer_set_dirs_only  (GFilenameCompleter *completer,
                                                             gboolean dirs_only);

If `dirs_only` is `TRUE`, `completer` will only complete directory names, and not file names.

`completer` : | the filename completer.
`dirs_only` : | a gboolean.

## Signal Details

### The `"got-completion-data"` signal

    void                user_function                      (GFilenameCompleter *arg0,
                                                            gpointer            user_data)      : Run Last

Emitted when the file name completion information comes available.

`user_data` : | user data set when the signal handler was connected.