{
lglTemplate *template_copy;
- template_copy = lgl_template_dup (template);
- model->templates = g_list_append (model->templates, template_copy);
- add_to_template_cache (template_copy);
+ if (!lgl_db_does_template_exist (template->brand, template->part))
+ {
+ template_copy = lgl_template_dup (template);
+ model->templates = g_list_append (model->templates, template_copy);
+ add_to_template_cache (template_copy);
+ }
+ else
+ {
+ g_message ("Duplicate template: %s %s.", template->brand, template->part);
+ }
}
}
+/**
+ * lgl_template_print:
+ * @template: template
+ *
+ * Print template details (for debugging purposes).
+ *
+ */
+void
+lgl_template_print (const lglTemplate *template)
+{
+ GList *p;
+ lglTemplateAlias *alias;
+
+ g_print ("---- %s( TEMPLATE=%p ) ----\n", __FUNCTION__, template);
+
+ g_print("brand=\"%s\", part=\"%s\", description=\"%s\"\n",
+ template->brand, template->part, template->description);
+
+ g_print("paper_id=\"%s\", page_width=%g, page_height=%g\n",
+ template->paper_id, template->page_width, template->page_height);
+
+ for (p=template->aliases; p!=NULL; p=p->next)
+ {
+ alias = (lglTemplateAlias *)p->data;
+ g_print("Alias: brand=\"%s\", part=\"%s\"\n", alias->brand, alias->part);
+
+ }
+
+ g_print ("\n");
+
+}
+
+
/*
* Local Variables: -- emacs
void lgl_template_markup_free (lglTemplateMarkup *markup);
+/*
+ * Debugging functions.
+ */
+void lgl_template_print (const lglTemplate *template);
+
+
G_END_DECLS
#endif /* __LGL_TEMPLATE_H__ */
<!-- =================================================================== -->
<!-- PEARL: Adress Labels, 48.8mm x 25.4mm, 40 per sheet -->
<!-- =================================================================== -->
- <Template brand="PEARL" part="PE 8008, PE 8018" size="A4" description="Adressetiketten">
+ <Template brand="PEARL" part="PE-8008, PE-8018" size="A4" description="Adressetiketten">
<Meta category="label"/>
<Meta category="rectangle-label"/>
<Meta product_url="http://www.pearl.de/a-PE8008-2204.shtml"/>
</Label-rectangle>
</Template>
- <!-- =================================================================== -->
- <!-- PEARL: Adress Labels, 70mm x 36mm, 24 per sheet -->
- <!-- =================================================================== -->
- <Template brand="PEARL" part="PE-8004, PE-8014" size="A4" description="Adress-Etiketten">
- <Meta category="label"/>
- <Meta category="rectangle-label"/>
- <Meta product_url="http://www.pearl.de/a-PE8004-2204.shtml"/>
- <Label-rectangle id="0" width="70mm" height="36mm" round="0mm" x_waste="0mm" y_waste="0mm">
- <Markup-margin size="3.2mm"/>
- <Layout nx="3" ny="8" x0="0mm" y0="4.8mm" dx="70mm" dy="36mm"/>
- </Label-rectangle>
- </Template>
-
<!-- =================================================================== -->
<!-- PEARL: Labels, 210mm x 297mm, 1 per sheet -->
<!-- =================================================================== -->