## filelist

filelist — Document history

## Synopsis

    #include <app/gwyapp.h>

    GtkWidget*          gwy_app_recent_file_list_new        (void);
    void                gwy_app_recent_file_list_update     (GwyContainer *data,
                                                             const gchar *filename_utf8,
                                                             const gchar *filename_sys,
                                                             gint hint);
    gboolean            gwy_app_recent_file_list_load       (const gchar *filename);
    gboolean            gwy_app_recent_file_list_save       (const gchar *filename);
    void                gwy_app_recent_file_list_free       (void);
    GdkPixbuf*          gwy_app_recent_file_get_thumbnail   (const gchar *filename_utf8);

## Description

## Details

### gwy_app_recent_file_list_new ()

    GtkWidget*          gwy_app_recent_file_list_new        (void);

Creates document history browser.

There should be at most one document history browser, so this function fails if it already exists.

Returns : | The newly created document history browser window.

### gwy_app_recent_file_list_update ()

    void                gwy_app_recent_file_list_update     (GwyContainer *data,
                                                             const gchar *filename_utf8,
                                                             const gchar *filename_sys,
                                                             gint hint);

Moves `filename_utf8` to the first position in document history, possibly adding it if not present yet.

At least one of `filename_utf8`, `filename_sys` should be set.

`data` : | A data container corresponding to the file.
`filename_utf8` : | A recent file to insert or move to the first position in document history, in UTF-8.
`filename_sys` : | A recent file to insert or move to the first position in document history, in GLib encoding.
`hint` : | Preferred channel id to use for thumbnail, pass 0 if no channel is specificaly preferred.

### gwy_app_recent_file_list_load ()

    gboolean            gwy_app_recent_file_list_load       (const gchar *filename);

Loads list of recently open files from `filename`.

Cannot be called more than once (at least not without doing `gwy_app_recent_file_list_free()` first). Must be called before any other document history function can be used, even if on a nonexistent file: use `NULL` as `filename` in that case.

`filename` : | Name of file containing list of recently open files.
Returns : | `TRUE` if the file was read successfully, `FALSE` otherwise.

### gwy_app_recent_file_list_save ()

    gboolean            gwy_app_recent_file_list_save       (const gchar *filename);

Saves list of recently open files to `filename`.

`filename` : | Name of file to save the list of recently open files to.
Returns : | `TRUE` if the file was written successfully, `FALSE` otherwise.

### gwy_app_recent_file_list_free ()

    void                gwy_app_recent_file_list_free       (void);

Frees all memory taken by recent file list.

Should not be called while the recent file menu still exists.

### gwy_app_recent_file_get_thumbnail ()

    GdkPixbuf*          gwy_app_recent_file_get_thumbnail   (const gchar *filename_utf8);

Gets thumbnail of a recently open file.

`filename_utf8` : | Name of a recent file, in UTF-8 encoding.
Returns : | The thumbnail as a new pixbuf or a pixbuf with a new reference. The caller must unreference it but not modify it. If not thumbnail can not be obtained, a fully transparent pixbuf is returned.