Top |
This section describes a set of functions to locate and add templates and related information in the LibGlabels template database.
void
lgl_db_init (void
);
Initialize all libglabels subsystems. It is not necessary for an application to call
lgl_db_init()
, because libglabels will initialize on demand. An application programmer may
choose to call lgl_db_init()
at startup to minimize the impact of the first libglabels call
on GUI response time.
This function initializes its paper definitions, category definitions, vendor definitions, and its template database. It will search both system and user template directories to locate this data.
void
(*lglDbNotifyFunc) (gpointer user_data
);
Defines the type of notify callback function to be called when database changes.
gulong lgl_db_notify_add (lglDbNotifyFunc func
,gpointer user_data
);
Register a notification callback function to be called when the database changes.
void
lgl_db_notify_remove (gulong id
);
Cancel a previous registration a notification callback function.
GList *
lgl_db_get_paper_id_list (void
);
Get a list of all paper ids known to libglabels.
void
lgl_db_free_paper_id_list (GList *ids
);
Free up all storage associated with an id list obtained with
lgl_db_get_paper_id_list()
.
GList *
lgl_db_get_paper_name_list (void
);
Get a list of all localized paper names known to libglabels.
void
lgl_db_free_paper_name_list (GList *names
);
Free up all storage associated with a name list obtained with
lgl_db_get_paper_name_list()
.
lglPaper *
lgl_db_lookup_paper_from_id (const gchar *id
);
Lookup paper definition from id string.
lglPaper *
lgl_db_lookup_paper_from_name (const gchar *name
);
Lookup paper definition from localized paper name string.
gchar *
lgl_db_lookup_paper_id_from_name (const gchar *name
);
Lookup paper name string from localized paper name string.
gchar *
lgl_db_lookup_paper_name_from_id (const gchar *id
);
Lookup localized paper name string from paper id string.
gboolean
lgl_db_is_paper_id_known (const gchar *id
);
Determine if given paper id is known to libglabels.
gboolean
lgl_db_is_paper_id_other (const gchar *id
);
Determine if given paper id is the special id "Other."
GList *
lgl_db_get_category_id_list (void
);
Get a list of all category ids known to libglabels.
void
lgl_db_free_category_id_list (GList *ids
);
Free up all storage associated with an id list obtained with
lgl_db_get_category_id_list()
.
GList *
lgl_db_get_category_name_list (void
);
Get a list of all localized category names known to libglabels.
void
lgl_db_free_category_name_list (GList *names
);
Free up all storage associated with a name list obtained with
lgl_db_get_category_name_list()
.
lglCategory *
lgl_db_lookup_category_from_id (const gchar *id
);
Lookup category definition from id string.
lglCategory *
lgl_db_lookup_category_from_name (const gchar *name
);
Lookup category definition from localized category name string.
gchar *
lgl_db_lookup_category_id_from_name (const gchar *name
);
Lookup category name string from localized category name string.
gchar *
lgl_db_lookup_category_name_from_id (const gchar *id
);
Lookup localized category name string from category id string.
gboolean
lgl_db_is_category_id_known (const gchar *id
);
Determine if given category id is known to libglabels.
GList * lgl_db_get_brand_list (const gchar *paper_id
,const gchar *category_id
);
Get a list of all valid brands of templates in the template database.
Results can be filtered by page size and/or template category. A list of valid page
sizes can be obtained using lgl_db_get_paper_id_list()
. A list of valid template
categories can be obtained using lgl_db_get_category_id_list()
.
void
lgl_db_free_brand_list (GList *brands
);
Free up all storage associated with a list of template names obtained with
lgl_db_get_brand_list()
.
lglDbRegStatus
lgl_db_register_template (const lglTemplate *template
);
Register a template. This function adds a template to the template database. The template will be stored in an individual XML file in the user template directory.
lglDbDeleteStatus lgl_db_delete_template_by_brand_part (const gchar *brand
,const gchar *part
);
Delete a user defined template. This function deletes a template from the template database. The individual XML file in the user template directory will also be removed.
lglDbDeleteStatus
lgl_db_delete_template_by_name (const gchar *name
);
Delete a user defined template. This function deletes a template from the template database. The individual XML file in the user template directory will also be removed.
gboolean lgl_db_does_template_exist (const gchar *brand
,const gchar *part
);
This function tests whether a template with the given brand and part name/number exists.
gboolean
lgl_db_does_template_name_exist (const gchar *name
);
This function test whether a template with the given name exists.
GList * lgl_db_get_template_name_list_all (const gchar *brand
,const gchar *paper_id
,const gchar *category_id
);
Get a list of all valid names of templates in the template database.
Results can be filtered by page size and/or template category. A list of valid page
sizes can be obtained using lgl_db_get_paper_id_list()
. A list of valid template
categories can be obtained using lgl_db_get_category_id_list()
.
GList *
lgl_db_get_similar_template_name_list (const gchar *name
);
Get a list of all valid names of templates in the template database that have the same size and layout characteristics as the given template.
void
lgl_db_free_template_name_list (GList *names
);
Free up all storage associated with a list of template names obtained with
lgl_db_get_template_name_list_all()
.
lglTemplate *
lgl_db_lookup_template_from_name (const gchar *name
);
Lookup template in template database from name string.
lglTemplate * lgl_db_lookup_template_from_brand_part (const gchar *brand
,const gchar *part
);
Lookup template in template database from brand and part strings.
GList *
lgl_db_get_vendor_name_list (void
);
Get a list of all localized vendor names known to libglabels.
void
lgl_db_free_vendor_name_list (GList *names
);
Free up all storage associated with a name list obtained with
lgl_db_get_vendor_name_list()
.
gboolean
lgl_db_is_vendor_name_known (const gchar *name
);
Determine if given vendor id is known to libglabels.
lglVendor *
lgl_db_lookup_vendor_from_name (const gchar *name
);
Lookup vendor definition from localized vendor name string.
void
lgl_db_print_known_papers (void
);
For debugging purposes: print a list of all paper definitions known to libglabels.
void
lgl_db_print_known_categories (void
);
For debugging purposes: print a list of all category definitions known to libglabels.
void
lgl_db_print_known_templates (void
);
Print all known templates (for debugging purposes).
This enumeration defines a set of possible return values for lgl_db_register_template()
.
This enumeration defines a set of possible return values for lgl_db_delete_template_by_name()
or lgl_db_delete_template_by_brand_part()
.