## FmNavHistory FmNavHistory — Simple navigation history management. |

## Synopsis

    #define             FM_NAV_HISTORY_TYPE
    #define             FM_NAV_HISTORY_DEFAULT_SIZE
                        FmNavHistory;
                        FmNavHistoryClass;
    struct              FmNavHistoryItem;
    void                fm_nav_history_back                 (FmNavHistory *nh,
                                                             int old_scroll_pos);
    gboolean            fm_nav_history_can_back             (FmNavHistory *nh);
    gboolean            fm_nav_history_can_forward          (FmNavHistory *nh);
    void                fm_nav_history_chdir                (FmNavHistory *nh,
                                                             FmPath *path,
                                                             gint old_scroll_pos);
    void                fm_nav_history_clear                (FmNavHistory *nh);
    void                fm_nav_history_forward              (FmNavHistory *nh,
                                                             int old_scroll_pos);
    const FmNavHistoryItem * fm_nav_history_get_cur         (FmNavHistory *nh);
    guint               fm_nav_history_get_cur_index        (FmNavHistory *nh);
    const GList *       fm_nav_history_get_cur_link         (FmNavHistory *nh);
    FmPath *            fm_nav_history_get_nth_path         (FmNavHistory *nh,
                                                             guint n);
    gint                fm_nav_history_get_scroll_pos       (FmNavHistory *nh);
    FmPath *            fm_nav_history_go_to                (FmNavHistory *nh,
                                                             guint n,
                                                             gint old_scroll_pos);
    void                fm_nav_history_jump                 (FmNavHistory *nh,
                                                             GList *l,
                                                             int old_scroll_pos);
    const GList *       fm_nav_history_list                 (FmNavHistory *nh);
    FmNavHistory *      fm_nav_history_new                  (void);
    void                fm_nav_history_set_max              (FmNavHistory *nh,
                                                             guint num);

## Object Hierarchy

      GObject
       +----FmNavHistory

## Description

`include`: libfm/fm.h

The FmNavHistory object implements history for paths that were entered in some input bar and allows to add, remove or move items in it.

## Details

### FM_NAV_HISTORY_TYPE

    #define FM_NAV_HISTORY_TYPE				(fm_nav_history_get_type())

### FM_NAV_HISTORY_DEFAULT_SIZE

    #define FM_NAV_HISTORY_DEFAULT_SIZE     10

### FmNavHistory

    typedef struct _FmNavHistory FmNavHistory;

### FmNavHistoryClass

    typedef struct _FmNavHistoryClass FmNavHistoryClass;

### struct FmNavHistoryItem

    struct FmNavHistoryItem {
        FmPath* path;
        int scroll_pos;
    };

FmPath *`path`; | active path to folder
int `scroll_pos`; | how much folder was scrolled in view

### fm_nav_history_back ()

    void                fm_nav_history_back                 (FmNavHistory *nh,
                                                             int old_scroll_pos);

### Warning

`fm_nav_history_back` has been deprecated since version 1.0.2 and should not be used in newly-written code. Use `fm_nav_history_go_to()` instead.

If there is a next item in the history then sets `old_scroll_pos` into current item data and marks next item current.

`nh` : | the history
`old_scroll_pos` : | the scroll position to associate with current item

Since 0.1.0

### fm_nav_history_can_back ()

    gboolean            fm_nav_history_can_back             (FmNavHistory *nh);

Checks if current selected item is the first item in the history.

Before 1.0.0 this call had name fm_nav_history_get_can_back.

`nh` : | the history
Returns : | `TRUE` if cursor can go backward in history.

Since 0.1.0

### fm_nav_history_can_forward ()

    gboolean            fm_nav_history_can_forward          (FmNavHistory *nh);

### Warning

`fm_nav_history_can_forward` has been deprecated since version 1.0.2 and should not be used in newly-written code. Use `fm_nav_history_get_cur_index()` instead.

Checks if current selected item is the last item in the history.

Before 1.0.0 this call had name fm_nav_history_get_can_forward.

`nh` : | the history
Returns : | `TRUE` if cursor can go forward in history.

Since 0.1.0

### fm_nav_history_chdir ()

    void                fm_nav_history_chdir                (FmNavHistory *nh,
                                                             FmPath *path,
                                                             gint old_scroll_pos);

Sets `old_scroll_pos` into current item data and then adds new `path` to the beginning of the `nh`.

`nh` : | the history
`path` : | new path to add
`old_scroll_pos` : | the scroll position to associate with current item

Since 0.1.0

### fm_nav_history_clear ()

    void                fm_nav_history_clear                (FmNavHistory *nh);

Removes all items from the history `nh`.

`nh` : | the history

Since 0.1.0

### fm_nav_history_forward ()

    void                fm_nav_history_forward              (FmNavHistory *nh,
                                                             int old_scroll_pos);

### Warning

`fm_nav_history_forward` has been deprecated since version 1.0.2 and should not be used in newly-written code. Use `fm_nav_history_go_to()` instead.

If there is a previous item in the history then sets `old_scroll_pos` into current item data and marks previous item current.

`nh` : | the history
`old_scroll_pos` : | the scroll position to associate with current item

Since 0.1.0

### fm_nav_history_get_cur ()

    const FmNavHistoryItem * fm_nav_history_get_cur         (FmNavHistory *nh);

### Warning

`fm_nav_history_get_cur` has been deprecated since version 1.0.2 and should not be used in newly-written code. Use `fm_nav_history_get_nth_path()` instead.

Retrieves current selected item of the history. The returned item belongs to FmNavHistory and shouldn't be freed by caller.

`nh` : | the history
Returns : | current item. [transfer none]

Since 0.1.0

### fm_nav_history_get_cur_index ()

    guint               fm_nav_history_get_cur_index        (FmNavHistory *nh);

Retrieves index of current item in the history `nh`. 0 means current item is at top.

`nh` : | the history
Returns : | index of current item.

Since 1.0.2

### fm_nav_history_get_cur_link ()

    const GList *       fm_nav_history_get_cur_link         (FmNavHistory *nh);

### Warning

`fm_nav_history_get_cur_link` has been deprecated since version 1.0.2 and should not be used in newly-written code.

Retrieves current selected item as GList element containing FmNavHistoryItem. The returned item belongs to FmNavHistory and shouldn't be freed by caller.

`nh` : | the history
Returns : | current item. [transfer none][element-type FmNavHistoryItem]

Since 0.1.0

### fm_nav_history_get_nth_path ()

    FmPath *            fm_nav_history_get_nth_path         (FmNavHistory *nh,
                                                             guint n);

Retrieves path of the item `n` in the history `nh`.

`nh` : | the history
`n` : | index of item
Returns : | path of the item or `NULL` if no such item was found.

Since 1.0.2

### fm_nav_history_get_scroll_pos ()

    gint                fm_nav_history_get_scroll_pos       (FmNavHistory *nh);

Retrieves saved scroll position for current item.

`nh` : | the history
Returns : | saved scroll position.

Since 1.0.2

### fm_nav_history_go_to ()

    FmPath *            fm_nav_history_go_to                (FmNavHistory *nh,
                                                             guint n,
                                                             gint old_scroll_pos);

Saves the current scroll position into the history. If item with index `n` exists in the history then sets it as current item.

`nh` : | the history
`n` : | new index
`old_scroll_pos` : | scroll position of current folder view
Returns : | path of selected item or `NULL` if no such item was found.

Since 1.0.2

### fm_nav_history_jump ()

    void                fm_nav_history_jump                 (FmNavHistory *nh,
                                                             GList *l,
                                                             int old_scroll_pos);

### Warning

`fm_nav_history_jump` has been deprecated since version 1.0.2 and should not be used in newly-written code. Use `fm_nav_history_go_to()` instead.

Sets `old_scroll_pos` into current item data and then sets current item of `nh` to one from `l`.

`nh` : | the history
`l` : | new current item. [element-type FmNavHistoryItem]
`old_scroll_pos` : | the scroll position to associate with current item

Since 0.1.0

### fm_nav_history_list ()

    const GList *       fm_nav_history_list                 (FmNavHistory *nh);

### Warning

`fm_nav_history_list` has been deprecated since version 1.0.2 and should not be used in newly-written code.

Retrieves full list of the history as GList of FmNavHistoryItem. The returned GList belongs to FmNavHistory and shouldn't be freed.

`nh` : | the history
Returns : | full history. [transfer none][element-type FmNavHistoryItem]

Since 0.1.0

### fm_nav_history_new ()

    FmNavHistory *      fm_nav_history_new                  (void);

Creates a new FmNavHistory object with empty history.

Returns : | a new FmNavHistory object.

Since 0.1.0

### fm_nav_history_set_max ()

    void                fm_nav_history_set_max              (FmNavHistory *nh,
                                                             guint num);

Sets maximum length of the history `nh` to be `num`.

`nh` : | the history
`num` : | new size of history

Since 0.1.0