## LatexilaTemplatesPersonal LatexilaTemplatesPersonal — Personal templates |

## Functions

LatexilaTemplatesPersonal * | latexila_templates_personal_get_instance ()
gchar * | latexila_templates_personal_get_contents ()
gboolean | latexila_templates_personal_create ()
gboolean | latexila_templates_personal_delete ()
gboolean | latexila_templates_personal_move_up ()
gboolean | latexila_templates_personal_move_down ()

## Types and Values

| LatexilaTemplatesPersonal

## Object Hierarchy

        GObject
        ╰── GtkListStore
            ╰── LatexilaTemplatesPersonal

## Implemented Interfaces

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

## Includes

    #include <latexila.h>

## Description

LatexilaTemplatesPersonal is a singleton class that stores information about pesonal templates.

Personal templates are stored in the ~/.local/share/latexila/ directory. There is a templatesrc file that stores the list of names, icons and files.

## Functions

### latexila_templates_personal_get_instance ()

    LatexilaTemplatesPersonal *
    latexila_templates_personal_get_instance
                                   (void);

Gets the instance of the LatexilaTemplatesPersonal singleton.

#### Returns

the instance of LatexilaTemplatesPersonal.

[transfer none]

### latexila_templates_personal_get_contents ()

    gchar *
    latexila_templates_personal_get_contents
                                   (LatexilaTemplatesPersonal *templates,
                                    GtkTreePath *path);

Gets the contents of a personal template.

TODO load contents asynchronously, with a GtkSourceFileLoader.

#### Parameters

templates | the LatexilaTemplatesPersonal instance. |
path | the GtkTreePath of a personal template. |

#### Returns

the personal template's contents. Free with `g_free()`.

### latexila_templates_personal_create ()

    gboolean
    latexila_templates_personal_create (LatexilaTemplatesPersonal *templates,
                                        const gchar *name,
                                        const gchar *config_icon_name,
                                        const gchar *contents,
                                        GError **error);

Creates a new personal template. The new template is added at the end of the list.

#### Parameters

templates | the LatexilaTemplatesPersonal instance. |
name | the template's name. |
config_icon_name | the icon name that will be stored in the config file. |
contents | the template's contents. |
error | a location to a `NULL` GError, or `NULL`. | [out][optional]

#### Returns

`TRUE` on success, `FALSE` on error.

### latexila_templates_personal_delete ()

    gboolean
    latexila_templates_personal_delete (LatexilaTemplatesPersonal *templates,
                                        GtkTreeIter *iter,
                                        GError **error);

Deletes a personal template.

#### Parameters

templates | the LatexilaTemplatesPersonal instance. |
iter | a valid GtkTreeIter. |
error | a location to a `NULL` GError, or `NULL`. | [out][optional]

#### Returns

`TRUE` on success, `FALSE` on error.

### latexila_templates_personal_move_up ()

    gboolean
    latexila_templates_personal_move_up (LatexilaTemplatesPersonal *templates,
                                         GtkTreeIter *iter,
                                         GError **error);

Moves up a personal template. There must be a previous template before `iter` .

#### Parameters

templates | the LatexilaTemplatesPersonal instance. |
iter | a valid GtkTreeIter. |
error | a location to a `NULL` GError, or `NULL`. | [out][optional]

#### Returns

`TRUE` on success, `FALSE` on error.

### latexila_templates_personal_move_down ()

    gboolean
    latexila_templates_personal_move_down (LatexilaTemplatesPersonal *templates,
                                           GtkTreeIter *iter,
                                           GError **error);

Moves down a personal template. There must be a template after `iter` .

#### Parameters

templates | the LatexilaTemplatesPersonal instance. |
iter | a valid GtkTreeIter. |
error | a location to a `NULL` GError, or `NULL`. | [out][optional]

#### Returns

`TRUE` on success, `FALSE` on error.

## Types and Values

### LatexilaTemplatesPersonal

    typedef struct _LatexilaTemplatesPersonal LatexilaTemplatesPersonal;

## See Also

LatexilaTemplatesDefault