FmPlacesModel

## FmPlacesModel FmPlacesModel — A model for side panel with places list. |

## Synopsis

    enum                FmPlacesCol;
                        FmPlacesItem;
                        FmPlacesModel;
                        FmPlacesModelClass;
    enum                FmPlacesType;
    FmBookmarkItem *    fm_places_item_get_bookmark_item    (FmPlacesItem *item);
    FmIcon *            fm_places_item_get_icon             (FmPlacesItem *item);
    FmFileInfo *        fm_places_item_get_info             (FmPlacesItem *item);
    GMount *            fm_places_item_get_mount            (FmPlacesItem *item);
    FmPath *            fm_places_item_get_path             (FmPlacesItem *item);
    GVolume *           fm_places_item_get_volume           (FmPlacesItem *item);
    gboolean            fm_places_item_is_mounted           (FmPlacesItem *item);
    FmBookmarks *       fm_places_model_get_bookmarks       (FmPlacesModel *model);
    gboolean            fm_places_model_get_iter_by_fm_path (FmPlacesModel *model,
                                                             GtkTreeIter *iter,
                                                             FmPath *path);
    GtkTreePath *       fm_places_model_get_separator_path  (FmPlacesModel *model);
    gboolean            fm_places_model_iter_is_separator   (FmPlacesModel *model,
                                                             GtkTreeIter *it);
    void                fm_places_model_mount_indicator_cell_data_func
                                                            (GtkCellLayout *cell_layout,
                                                             GtkCellRenderer *render,
                                                             GtkTreeModel *tree_model,
                                                             GtkTreeIter *it,
                                                             gpointer user_data);
    FmPlacesModel *     fm_places_model_new                 (void);
    gboolean            fm_places_model_path_is_bookmark    (FmPlacesModel *model,
                                                             GtkTreePath *tp);
    gboolean            fm_places_model_path_is_places      (FmPlacesModel *model,
                                                             GtkTreePath *tp);
    gboolean            fm_places_model_path_is_separator   (FmPlacesModel *model,
                                                             GtkTreePath *tp);

## Object Hierarchy

      GObject
       +----GtkListStore
             +----FmPlacesModel

## Implemented Interfaces

FmPlacesModel implements GtkTreeModel, GtkTreeDragSource, GtkTreeDragDest, GtkTreeSortable and GtkBuildable.

## Description

`include`: libfm/fm-gtk.h

The FmPlacesModel represents list of pseudo-folders which contains such items as Home directory, Trash bin, mounted removable drives, bookmarks, etc. It is used by FmPlacesView to display them in the side panel.

## Details

### enum FmPlacesCol

    typedef enum {
        FM_PLACES_MODEL_COL_ICON,
        FM_PLACES_MODEL_COL_LABEL,
        FM_PLACES_MODEL_COL_INFO,
    } FmPlacesCol;

Data of the row in the FmPlacesModel.

`FM_PLACES_MODEL_COL_ICON` | (GdkPixbuf *) icon if the row
`FM_PLACES_MODEL_COL_LABEL` | (char *) name of the row
`FM_PLACES_MODEL_COL_INFO` | (FmPlacesItem *) internal representation

### FmPlacesItem

    typedef struct _FmPlacesItem FmPlacesItem;

### FmPlacesModel

    typedef struct _FmPlacesModel FmPlacesModel;

### FmPlacesModelClass

    typedef struct _FmPlacesModelClass FmPlacesModelClass;

### enum FmPlacesType

    typedef enum {
        FM_PLACES_ITEM_NONE,
        FM_PLACES_ITEM_PATH,
        FM_PLACES_ITEM_VOLUME,
        FM_PLACES_ITEM_MOUNT
    } FmPlacesType;

`FM_PLACES_ITEM_NONE` | separator
`FM_PLACES_ITEM_PATH` | some path - standard one or bookmark
`FM_PLACES_ITEM_VOLUME` | a mountable device
`FM_PLACES_ITEM_MOUNT` | some mounted media or virtual drive

### fm_places_item_get_bookmark_item ()

    FmBookmarkItem *    fm_places_item_get_bookmark_item    (FmPlacesItem *item);

Retrieves bookmark descriptor for the row. Returned data are owned by places model and should not be freed by caller.

`item` : | a places model item
Returns : | bookmark descriptor or `NULL` if `item` isn't a bookmark. [transfer none]

Since 1.0.0

### fm_places_item_get_icon ()

    FmIcon *            fm_places_item_get_icon             (FmPlacesItem *item);

Retrieves icom image for the row. Returned data are owned by places model and should not be freed by caller.

`item` : | a places model item
Returns : | icon descriptor. [transfer none]

Since 1.0.0

### fm_places_item_get_info ()

    FmFileInfo *        fm_places_item_get_info             (FmPlacesItem *item);

Retrieves file info for the row. Returned data are owned by places model and should not be freed by caller.

`item` : | a places model item
Returns : | file info descriptor. [transfer none]

Since 1.0.0

### fm_places_item_get_mount ()

    GMount *            fm_places_item_get_mount            (FmPlacesItem *item);

Rertieves mount descriptor for the row. Returned data are owned by places model and should not be freed by caller.

`item` : | a places model item
Returns : | mount descriptor or `NULL` if `item` isn't a mounted path. [transfer none]

Since 1.0.0

### fm_places_item_get_path ()

    FmPath *            fm_places_item_get_path             (FmPlacesItem *item);

Retrieves path for the row. Returned data are owned by places model and should not be freed by caller.

`item` : | a places model item
Returns : | item path. [transfer none]

Since 1.0.0

### fm_places_item_get_volume ()

    GVolume *           fm_places_item_get_volume           (FmPlacesItem *item);

Retrieves volume descriptor for the row. Returned data are owned by places model and should not be freed by caller.

`item` : | a places model item
Returns : | volume descriptor or `NULL` if `item` isn't a mountable volume. [transfer none]

Since 1.0.0

### fm_places_item_is_mounted ()

    gboolean            fm_places_item_is_mounted           (FmPlacesItem *item);

Checks if the row is a mounted volume.

`item` : | a places model item
Returns : | `TRUE` if the row is a mounted volume.

Since 1.0.0

### fm_places_model_get_bookmarks ()

    FmBookmarks *       fm_places_model_get_bookmarks       (FmPlacesModel *model);

Retrieves list of bookmarks that is used by the `model`. Returned data are owned by places model and should not be freed by caller.

`model` : | a places model instance
Returns : | list of bookmarks. [transfer none]

Since 1.0.0

### fm_places_model_get_iter_by_fm_path ()

    gboolean            fm_places_model_get_iter_by_fm_path (FmPlacesModel *model,
                                                             GtkTreeIter *iter,
                                                             FmPath *path);

Tries to find an item in the `model` by the `path`. If item was found within `model` then sets `iter` to match the found item.

`model` : | a places model instance
`iter` : | the row iterator pointer
`path` : | a file path to search
Returns : | `TRUE` if item was found.

Since 1.0.0

### fm_places_model_get_separator_path ()

    GtkTreePath *       fm_places_model_get_separator_path  (FmPlacesModel *model);

Retrieves path to separator between places and bookmark items. Returned path should be freed with `gtk_tree_path_free()` after usage.

`model` : | a places model instance
Returns : | the path to separator. [transfer full]

Since 0.1.14

### fm_places_model_iter_is_separator ()

    gboolean            fm_places_model_iter_is_separator   (FmPlacesModel *model,
                                                             GtkTreeIter *it);

Checks if the row described in `it` is a separator.

`model` : | a places model instance
`it` : | model iterator to inspect
Returns : | `TRUE` if the row is a separator.

Since 0.1.14

### fm_places_model_mount_indicator_cell_data_func ()

    void                fm_places_model_mount_indicator_cell_data_func
                                                            (GtkCellLayout *cell_layout,
                                                             GtkCellRenderer *render,
                                                             GtkTreeModel *tree_model,
                                                             GtkTreeIter *it,
                                                             gpointer user_data);

`cell_layout` : | the cell layout
`render` : | the cell renderer
`tree_model` : | a places model instance
`it` : | the row iterator
`user_data` : | unused

Since 0.1.15

### fm_places_model_new ()

    FmPlacesModel *     fm_places_model_new                 (void);

Creates new places model.

Returns : | a new FmPlacesModel object. [transfer full]

Since 0.1.14

### fm_places_model_path_is_bookmark ()

    gboolean            fm_places_model_path_is_bookmark    (FmPlacesModel *model,
                                                             GtkTreePath *tp);

Checks if the row by `tp` lies within bookmark items.

`model` : | a places model instance
`tp` : | the row path to inspect
Returns : | `TRUE` if the row is a bookmark item.

Since 0.1.14

### fm_places_model_path_is_places ()

    gboolean            fm_places_model_path_is_places      (FmPlacesModel *model,
                                                             GtkTreePath *tp);

Checks if the row by `tp` lies above separator, i.e. within "places".

`model` : | a places model instance
`tp` : | the row path to inspect
Returns : | `TRUE` if the row is a places item.

Since 0.1.14

### fm_places_model_path_is_separator ()

    gboolean            fm_places_model_path_is_separator   (FmPlacesModel *model,
                                                             GtkTreePath *tp);

Checks if the row by `tp` is a separator between places and bookmarks.

`model` : | a places model instance
`tp` : | the row path to inspect
Returns : | `TRUE` if the row is a separator.

Since 0.1.14