GIO Reference Manual: GFilenameCompleter

## GFilenameCompleter GFilenameCompleter — Filename Completer |

## Functions

GFilenameCompleter * | g_filename_completer_new ()
char * | g_filename_completer_get_completion_suffix ()
char ** | g_filename_completer_get_completions ()
void | g_filename_completer_set_dirs_only ()

## Signals

void | got-completion-data | Run Last

## Types and Values

| GFilenameCompleter

## Object Hierarchy

        GObject
        ╰── GFilenameCompleter

## Includes

    #include <gio/gio.h>

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

## Functions

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

#### Parameters

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.

#### Parameters

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.

[array zero-terminated=1][transfer full]

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

#### Parameters

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

## Types and Values

### GFilenameCompleter

    typedef struct _GFilenameCompleter GFilenameCompleter;

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

## Signal Details

### The `“got-completion-data”` signal

    void
    user_function (GFilenameCompleter *arg0,
                   gpointer            user_data)

Emitted when the file name completion information comes available.

#### Parameters

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

Flags: Run Last