FmPlacesModel: Libfm Reference Manual

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

## Functions

FmBookmarkItem * | fm_places_item_get_bookmark_item ()
FmIcon * | fm_places_item_get_icon ()
FmFileInfo * | fm_places_item_get_info ()
GMount * | fm_places_item_get_mount ()
FmPath * | fm_places_item_get_path ()
GVolume * | fm_places_item_get_volume ()
gboolean | fm_places_item_is_mounted ()
FmBookmarks * | fm_places_model_get_bookmarks ()
gboolean | fm_places_model_get_iter_by_fm_path ()
GtkTreePath * | fm_places_model_get_separator_path ()
gboolean | fm_places_model_iter_is_separator ()
void | fm_places_model_mount_indicator_cell_data_func ()
FmPlacesModel * | fm_places_model_new ()
gboolean | fm_places_model_path_is_bookmark ()
gboolean | fm_places_model_path_is_places ()
gboolean | fm_places_model_path_is_separator ()

## Types and Values

enum | FmPlacesCol
| FmPlacesItem
| FmPlacesModel
| FmPlacesModelClass
enum | FmPlacesType

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

## Functions

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

#### Parameters

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.

#### Parameters

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.

#### Parameters

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.

#### Parameters

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.

#### Parameters

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.

#### Parameters

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.

#### Parameters

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.

#### Parameters

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.

#### Parameters

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.

#### Parameters

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.

#### Parameters

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);

#### Parameters

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.

#### Parameters

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

#### Parameters

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.

#### Parameters

model | a places model instance |
tp | the row path to inspect |

#### Returns

`TRUE` if the row is a separator.

Since: 0.1.14

## Types and Values

### enum FmPlacesCol

Data of the row in the FmPlacesModel.

#### Members

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

#### Members

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 |