GtexTemplatesPersonal

GtexTemplatesPersonal — Personal templates

Functions

Types and Values

Object Hierarchy

    GObject
    ╰── GtkListStore
        ╰── GtexTemplatesPersonal

Implemented Interfaces

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

Includes

#include <gtex.h>

Description

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

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

Functions

gtex_templates_personal_get_instance ()

GtexTemplatesPersonal *
gtex_templates_personal_get_instance (void);

Gets the instance of the GtexTemplatesPersonal singleton.

Returns

the instance of GtexTemplatesPersonal.

[transfer none]


gtex_templates_personal_get_contents ()

gchar *
gtex_templates_personal_get_contents (GtexTemplatesPersonal *templates,
                                      GtkTreePath *path);

Gets the contents of a personal template.

TODO load contents asynchronously.

Parameters

templates

the GtexTemplatesPersonal instance.

 

path

the GtkTreePath of a personal template.

 

Returns

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


gtex_templates_personal_create ()

gboolean
gtex_templates_personal_create (GtexTemplatesPersonal *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 GtexTemplatesPersonal 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.


gtex_templates_personal_delete ()

gboolean
gtex_templates_personal_delete (GtexTemplatesPersonal *templates,
                                GtkTreeIter *iter,
                                GError **error);

Deletes a personal template.

Parameters

templates

the GtexTemplatesPersonal instance.

 

iter

a valid GtkTreeIter.

 

error

a location to a NULL GError, or NULL.

[out][optional]

Returns

TRUE on success, FALSE on error.


gtex_templates_personal_move_up ()

gboolean
gtex_templates_personal_move_up (GtexTemplatesPersonal *templates,
                                 GtkTreeIter *iter,
                                 GError **error);

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

Parameters

templates

the GtexTemplatesPersonal instance.

 

iter

a valid GtkTreeIter.

 

error

a location to a NULL GError, or NULL.

[out][optional]

Returns

TRUE on success, FALSE on error.


gtex_templates_personal_move_down ()

gboolean
gtex_templates_personal_move_down (GtexTemplatesPersonal *templates,
                                   GtkTreeIter *iter,
                                   GError **error);

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

Parameters

templates

the GtexTemplatesPersonal 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

GtexTemplatesPersonal

typedef struct _GtexTemplatesPersonal GtexTemplatesPersonal;

See Also

GtexTemplatesDefault