From: Jim Evins Date: Thu, 25 Nov 2010 21:23:12 +0000 (-0500) Subject: Remove deprecated alias node support for templates. X-Git-Tag: glabels-2_3_1~119 X-Git-Url: https://git.sur5r.net/?a=commitdiff_plain;h=f9d15efd6543ae69c821010751ef960d97877349;p=glabels Remove deprecated alias node support for templates. Removed support for the "Alias" node in templates. For backwards compatibility alias nodes will be skipped over. This greatly simplifies the iteration through the template database, since all templates are fully realized. --- diff --git a/docs/libglabels/libglabels-3.0-sections.txt b/docs/libglabels/libglabels-3.0-sections.txt index bdf482db..ea100c4d 100644 --- a/docs/libglabels/libglabels-3.0-sections.txt +++ b/docs/libglabels/libglabels-3.0-sections.txt @@ -55,15 +55,12 @@ lgl_db_print_known_papers lgl_db_print_known_categories lgl_db_print_known_templates lgl_db_print_known_vendors -lgl_db_print_aliases
template libglabels/template.h lglTemplate - -lglTemplateAlias lglTemplateFrameShape lglTemplateFrame @@ -91,7 +88,6 @@ lgl_template_dup lgl_template_free lgl_template_add_category lgl_template_add_frame -lgl_template_add_alias lgl_template_get_name lgl_template_do_templates_match @@ -99,10 +95,6 @@ lgl_template_does_brand_match lgl_template_does_page_size_match lgl_template_does_category_match lgl_template_are_templates_identical - -lgl_template_alias_new -lgl_template_alias_dup -lgl_template_alias_free lgl_template_frame_rect_new lgl_template_frame_ellipse_new diff --git a/docs/libglabels/tmpl/db.sgml b/docs/libglabels/tmpl/db.sgml index 2a253bc5..28ced304 100644 --- a/docs/libglabels/tmpl/db.sgml +++ b/docs/libglabels/tmpl/db.sgml @@ -432,11 +432,3 @@ Defines the type of notify callback function to be called when database changes. @void: - - - - - -@template: - - diff --git a/docs/libglabels/tmpl/libglabels-3.0-unused.sgml b/docs/libglabels/tmpl/libglabels-3.0-unused.sgml index 628b4aee..f6001560 100644 --- a/docs/libglabels/tmpl/libglabels-3.0-unused.sgml +++ b/docs/libglabels/tmpl/libglabels-3.0-unused.sgml @@ -227,7 +227,6 @@ template3 @page_height: @categories: @frames: -@aliases: @@ -599,14 +598,6 @@ the CSS2 Specification (Section 4.3.2). - - - - - -@template: -@alias: - @@ -976,13 +967,6 @@ the CSS2 Specification (Section 4.3.2). @page_height: @Returns: - - - - - -@template: - @@ -1527,13 +1511,6 @@ attributes. - - - - - -@template: - diff --git a/docs/libglabels/tmpl/template.sgml b/docs/libglabels/tmpl/template.sgml index 5108840e..b3f3658d 100644 --- a/docs/libglabels/tmpl/template.sgml +++ b/docs/libglabels/tmpl/template.sgml @@ -38,17 +38,6 @@ of peel-off labels or cards. @category_ids: A list of category IDs that this template belongs to. @frames: A list of (#lglTemplateFrame *) structures. GLabels currently only supports one frame per template -- future versions may support multiple frames per template. -@aliases: A list of alternate names for this template. Often a single template can be used for -multiple products. - - - -This structure defines an alias for the parent template structure. An alias is used for -different products that can use the same template. - - -@brand: Brand name of label or card. E.g. "Avery." -@part: Part name or number of label or card. E.g. "8160." @@ -292,15 +281,6 @@ relative to the upper left corner of the page. @frame: - - - - - -@template: -@alias: - - @@ -360,33 +340,6 @@ relative to the upper left corner of the page. @Returns: - - - - - -@brand: -@part: -@Returns: - - - - - - - -@orig_alias: -@Returns: - - - - - - - -@alias: - - diff --git a/help/C/mancreate.page b/help/C/mancreate.page index 5fbe5238..b7a92341 100644 --- a/help/C/mancreate.page +++ b/help/C/mancreate.page @@ -84,8 +84,6 @@ <Markup-margin size="5pt"/> <Layout nx="3" ny="10" x0="11.25pt" y0="36pt" dx="200pt" dy="72pt"/> </Label-rectangle> - <Alias brand="Avery" part="5160"/> - <Alias brand="Avery" part="6233"/> </Template>
@@ -96,9 +94,7 @@

A Template node describes a single stationary product. It must contain one instance of any type of Label node (Label-rectangle, - Label-round, or Label-cd). - This node can be followed by zero or more - Alias nodes.

+ Label-round, or Label-cd).

@@ -128,6 +124,9 @@ + + +

height

Page height. Only valid if size="Other"

equiv

Equivalent part number. If this property is present, the template is a clone of another template of the same brand. The template will inheret all properties, except brand and name from the other template. This equiv property must refer to a previously defined template -- libglabels does not currently support forward references.

@@ -514,29 +513,5 @@ -
- Alias Node - -

An Alias node provides the name of a - product with the same size and layout characteristics as the - parent template.

- - - - - - - - - - - - - - -

Property

Description

brand

The brand or manufacturer of the equivalent product.

part

The part number of the equivalent product.

- -
- diff --git a/libglabels/db.c b/libglabels/db.c index 9880eb02..eac29e65 100644 --- a/libglabels/db.c +++ b/libglabels/db.c @@ -1400,9 +1400,8 @@ GList * lgl_db_get_brand_list (const gchar *paper_id, const gchar *category_id) { - GList *p_tmplt, *p_alias; + GList *p_tmplt; lglTemplate *template; - lglTemplateAlias *alias; GList *brands = NULL; if (!model) @@ -1416,19 +1415,14 @@ lgl_db_get_brand_list (const gchar *paper_id, if (lgl_template_does_page_size_match (template, paper_id) && lgl_template_does_category_match (template, category_id)) { - for (p_alias = template->aliases; p_alias != NULL; - p_alias = p_alias->next) - { - alias = (lglTemplateAlias *)p_alias->data; - if ( !g_list_find_custom (brands, alias->brand, - (GCompareFunc)lgl_str_utf8_casecmp) ) - { - brands = g_list_insert_sorted (brands, - g_strdup (alias->brand), - (GCompareFunc)lgl_str_utf8_casecmp); - } - } + if ( !g_list_find_custom (brands, template->brand, + (GCompareFunc)lgl_str_utf8_casecmp) ) + { + brands = g_list_insert_sorted (brands, + g_strdup (template->brand), + (GCompareFunc)lgl_str_utf8_casecmp); + } } } @@ -1647,9 +1641,8 @@ gboolean lgl_db_does_template_exist (const gchar *brand, const gchar *part) { - GList *p_tmplt, *p_alias; + GList *p_tmplt; lglTemplate *template; - lglTemplateAlias *alias; if (!model) { @@ -1664,16 +1657,12 @@ lgl_db_does_template_exist (const gchar *brand, for (p_tmplt = model->templates; p_tmplt != NULL; p_tmplt = p_tmplt->next) { template = (lglTemplate *) p_tmplt->data; - for (p_alias = template->aliases; p_alias != NULL; p_alias = p_alias->next) - { - alias = (lglTemplateAlias *)p_alias->data; - if ( UTF8_EQUAL (brand, alias->brand) && - UTF8_EQUAL (part, alias->part) ) - { - return TRUE; - } - } + if ( UTF8_EQUAL (brand, template->brand) && + UTF8_EQUAL (part, template->part) ) + { + return TRUE; + } } return FALSE; @@ -1692,9 +1681,8 @@ lgl_db_does_template_exist (const gchar *brand, gboolean lgl_db_does_template_name_exist (const gchar *name) { - GList *p_tmplt, *p_alias; + GList *p_tmplt; lglTemplate *template; - lglTemplateAlias *alias; gchar *candidate_name; if (!model) @@ -1710,17 +1698,14 @@ lgl_db_does_template_name_exist (const gchar *name) for (p_tmplt = model->templates; p_tmplt != NULL; p_tmplt = p_tmplt->next) { template = (lglTemplate *) p_tmplt->data; - for (p_alias = template->aliases; p_alias != NULL; p_alias = p_alias->next) - { - alias = (lglTemplateAlias *)p_alias->data; - candidate_name = g_strdup_printf ("%s %s", alias->brand, alias->part); + candidate_name = g_strdup_printf ("%s %s", template->brand, template->part); - if ( UTF8_EQUAL (candidate_name, name) ) { - g_free (candidate_name); - return TRUE; - } + if ( UTF8_EQUAL (candidate_name, name) ) + { g_free (candidate_name); - } + return TRUE; + } + g_free (candidate_name); } return FALSE; @@ -1782,7 +1767,7 @@ lgl_db_get_template_name_list_unique (const gchar *brand, * @paper_id: If non NULL, limit results to given page size. * @category_id: If non NULL, limit results to given template category. * - * Get a list of all valid names and aliases of templates in the template database. + * 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(). @@ -1790,16 +1775,15 @@ lgl_db_get_template_name_list_unique (const gchar *brand, * This function differs from lgl_db_get_template_name_list_unique(), because it will * return multiple names for the same template. * - * Returns: a list of template names and aliases. + * Returns: a list of template names. */ GList * lgl_db_get_template_name_list_all (const gchar *brand, const gchar *paper_id, const gchar *category_id) { - GList *p_tmplt, *p_alias; + GList *p_tmplt; lglTemplate *template; - lglTemplateAlias *alias; gchar *name; GList *names = NULL; @@ -1814,17 +1798,12 @@ lgl_db_get_template_name_list_all (const gchar *brand, if (lgl_template_does_page_size_match (template, paper_id) && lgl_template_does_category_match (template, category_id)) { - for (p_alias = template->aliases; p_alias != NULL; - p_alias = p_alias->next) - { - alias = (lglTemplateAlias *)p_alias->data; - if ( !brand || UTF8_EQUAL( alias->brand, brand) ) - { - name = g_strdup_printf ("%s %s", alias->brand, alias->part); - names = g_list_insert_sorted (names, name, - (GCompareFunc)lgl_str_part_name_cmp); - } + if ( !brand || UTF8_EQUAL( template->brand, brand) ) + { + name = g_strdup_printf ("%s %s", template->brand, template->part); + names = g_list_insert_sorted (names, name, + (GCompareFunc)lgl_str_part_name_cmp); } } } @@ -1837,18 +1816,17 @@ lgl_db_get_template_name_list_all (const gchar *brand, * lgl_db_get_similar_template_name_list: * @name: Name of template under test. * - * Get a list of all valid names and aliases of templates in the template database that + * 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. * - * Returns: a list of template names and aliases. + * Returns: a list of template names. */ GList * lgl_db_get_similar_template_name_list (const gchar *name) { - GList *p_tmplt, *p_alias; + GList *p_tmplt; lglTemplate *template1; lglTemplate *template2; - lglTemplateAlias *alias; gchar *name2; GList *names = NULL; @@ -1868,35 +1846,20 @@ lgl_db_get_similar_template_name_list (const gchar *name) return NULL; } - for (p_alias = template1->aliases; p_alias != NULL; p_alias = p_alias->next) - { - alias = (lglTemplateAlias *)p_alias->data; - - name2 = g_strdup_printf ("%s %s", alias->brand, alias->part); - if ( !UTF8_EQUAL (name2, name) ) - { - names = g_list_insert_sorted (names, name2, - (GCompareFunc)lgl_str_part_name_cmp); - } - } - for (p_tmplt = model->templates; p_tmplt != NULL; p_tmplt = p_tmplt->next) { template2 = (lglTemplate *) p_tmplt->data; if ( lgl_template_are_templates_identical (template1, template2) ) { - for (p_alias = template2->aliases; p_alias != NULL; p_alias = p_alias->next) + + name2 = g_strdup_printf ("%s %s", template2->brand, template2->part); + if ( !UTF8_EQUAL (name2, name) ) { - alias = (lglTemplateAlias *)p_alias->data; + names = g_list_insert_sorted (names, name2, + (GCompareFunc)lgl_str_part_name_cmp); + } - name2 = g_strdup_printf ("%s %s", alias->brand, alias->part); - if ( !UTF8_EQUAL (name2, name) ) - { - names = g_list_insert_sorted (names, name2, - (GCompareFunc)lgl_str_part_name_cmp); - } - } } } @@ -1939,10 +1902,7 @@ lgl_db_free_template_name_list (GList *names) lglTemplate * lgl_db_lookup_template_from_name (const gchar *name) { - GList *p_alias; lglTemplate *template; - lglTemplateAlias *alias; - gchar *candidate_name; lglTemplate *new_template; if (!model) @@ -1960,24 +1920,8 @@ lgl_db_lookup_template_from_name (const gchar *name) if (template) { - for (p_alias = template->aliases; p_alias != NULL; p_alias = p_alias->next) - { - alias = (lglTemplateAlias *)p_alias->data; - candidate_name = g_strdup_printf ("%s %s", alias->brand, alias->part); - - if ( UTF8_EQUAL (candidate_name, name) ) - { - g_free (candidate_name); - new_template = lgl_template_dup (template); - g_free (new_template->brand); - new_template->brand = g_strdup (alias->brand); - g_free (new_template->part); - new_template->part = g_strdup (alias->part); - return new_template; - } - - g_free (candidate_name); - } + new_template = lgl_template_dup (template); + return new_template; } /* No matching template has been found so return the first template */ @@ -2000,10 +1944,7 @@ lgl_db_lookup_template_from_brand_part(const gchar *brand, const gchar *part) { gchar *name; - GList *p_alias; lglTemplate *template; - lglTemplateAlias *alias; - gchar *candidate_name; lglTemplate *new_template; if (!model) @@ -2022,25 +1963,8 @@ lgl_db_lookup_template_from_brand_part(const gchar *brand, if (template) { - for (p_alias = template->aliases; p_alias != NULL; p_alias = p_alias->next) - { - alias = (lglTemplateAlias *)p_alias->data; - candidate_name = g_strdup_printf ("%s %s", alias->brand, alias->part); - - if ( UTF8_EQUAL (candidate_name, name) ) - { - g_free (candidate_name); - new_template = lgl_template_dup (template); - g_free (new_template->brand); - new_template->brand = g_strdup (alias->brand); - g_free (new_template->part); - new_template->part = g_strdup (alias->part); - g_free (name); - return new_template; - } - - g_free (candidate_name); - } + new_template = lgl_template_dup (template); + return new_template; } /* No matching template has been found so return the first template */ @@ -2052,17 +1976,11 @@ lgl_db_lookup_template_from_brand_part(const gchar *brand, static void add_to_template_cache (lglTemplate *template) { - GList *p_alias; - lglTemplateAlias *alias; gchar *name; - for ( p_alias=template->aliases; p_alias != NULL; p_alias=p_alias->next ) - { - alias = (lglTemplateAlias *)p_alias->data; - name = g_strdup_printf ("%s %s", alias->brand, alias->part); + name = g_strdup_printf ("%s %s", template->brand, template->part); - g_hash_table_insert (model->template_cache, name, template); - } + g_hash_table_insert (model->template_cache, name, template); } @@ -2278,36 +2196,6 @@ lgl_db_print_known_templates (void) } -/** - * lgl_db_print_aliases: - * @template: template - * - * Print all aliases of a template (for debugging purposes). - * - */ -void -lgl_db_print_aliases (const lglTemplate *template) -{ - GList *p; - lglTemplateAlias *alias; - - if (!model) - { - lgl_db_init (); - } - - g_print ("%s():\n", __FUNCTION__); - 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"); - -} - /* diff --git a/libglabels/template.c b/libglabels/template.c index d5bf0373..716db60e 100644 --- a/libglabels/template.c +++ b/libglabels/template.c @@ -73,9 +73,9 @@ static gint compare_origins (gconstpointer a, * @page_height: Page height in points, set to zero unless paper_id="Other" * * Create a new template structure, with the given top-level attributes. The - * created template will have no initial aliases, categories, or frames - * associated with it. See lgl_template_add_alias(), lgl_template_add_category(), - * and lgl_template_add_frame() to add these. + * created template will have no initial categories, or frames associated with + * it. See lgl_template_add_category() and lgl_template_add_frame() to add + * these. * * Returns: pointer to a newly allocated #lglTemplate structure. * @@ -89,7 +89,6 @@ lgl_template_new (const gchar *brand, gdouble page_height) { lglTemplate *template; - lglTemplateAlias *alias; template = g_new0 (lglTemplate,1); @@ -100,11 +99,6 @@ lgl_template_new (const gchar *brand, template->page_width = page_width; template->page_height = page_height; - /* Always include primary name in alias list. */ - template->aliases = NULL; - alias = lgl_template_alias_new (brand, part); - lgl_template_add_alias (template, alias); - return template; } @@ -128,8 +122,6 @@ lgl_template_new_from_equiv (const gchar *brand, const gchar *equiv_part) { lglTemplate *template; - GList *p_alias; - lglTemplateAlias *alias; template = lgl_db_lookup_template_from_brand_part (brand, equiv_part); if (template) @@ -139,17 +131,6 @@ lgl_template_new_from_equiv (const gchar *brand, template->part = g_strdup (part); template->equiv_part = g_strdup (equiv_part); - - for ( p_alias = template->aliases; p_alias != NULL; p_alias = p_alias->next ) - { - alias = (lglTemplateAlias *)p_alias->data; - lgl_template_alias_free (alias); - } - g_list_free (template->aliases); - template->aliases = NULL; - - alias = lgl_template_alias_new (brand, part); - lgl_template_add_alias (template, alias); } else { @@ -393,50 +374,6 @@ lgl_template_are_templates_identical (const lglTemplate *template1, } -/** - * lgl_template_alias_new: - * @brand: Alias brand - * @part: Alias part name/number - * - * Create a new template alias structure, with the given brand and part number. - * - * Returns: pointer to a newly allocated #lglTemplateAlias structure. - * - */ -lglTemplateAlias * -lgl_template_alias_new (const gchar *brand, - const gchar *part) -{ - lglTemplateAlias *alias; - - alias = g_new0 (lglTemplateAlias,1); - - alias->brand = g_strdup (brand); - alias->part = g_strdup (part); - - return alias; -} - - -/** - * lgl_template_add_alias: - * @template: Pointer to template structure - * @alias: Alias string - * - * This function adds the given alias to a templates list of aliases. - * - */ -void -lgl_template_add_alias (lglTemplate *template, - lglTemplateAlias *alias) -{ - g_return_if_fail (template); - g_return_if_fail (alias); - - template->aliases = g_list_append (template->aliases, alias); -} - - /** * lgl_template_add_frame: * @template: Pointer to template structure @@ -1115,7 +1052,6 @@ lglTemplate * lgl_template_dup (const lglTemplate *orig_template) { lglTemplate *template; - lglTemplateAlias *alias; GList *p; lglTemplateFrame *frame; @@ -1131,17 +1067,6 @@ lgl_template_dup (const lglTemplate *orig_template) template->equiv_part = g_strdup (orig_template->equiv_part); template->product_url = g_strdup (orig_template->product_url); - for ( p=orig_template->aliases; p != NULL; p=p->next ) - { - alias = (lglTemplateAlias *)p->data; - - if ( !(UTF8_EQUAL (template->brand, alias->brand) && - UTF8_EQUAL (template->part, alias->part)) ) - { - lgl_template_add_alias (template, lgl_template_alias_dup (alias)); - } - - } for ( p=orig_template->category_ids; p != NULL; p=p->next ) { @@ -1186,15 +1111,6 @@ lgl_template_free (lglTemplate *template) g_free (template->paper_id); template->paper_id = NULL; - for ( p=template->aliases; p != NULL; p=p->next ) { - - lgl_template_alias_free (p->data); - p->data = NULL; - - } - g_list_free (template->aliases); - template->aliases = NULL; - for ( p=template->category_ids; p != NULL; p=p->next ) { g_free (p->data); @@ -1221,48 +1137,6 @@ lgl_template_free (lglTemplate *template) } -/** - * lgl_template_alias_dup: - * @orig_alias: Alias to duplicate. - * - * This function duplicates a template alias structure. - * - * Returns: a newly allocated #lglTemplateAlias structure. - * - */ -lglTemplateAlias * -lgl_template_alias_dup (const lglTemplateAlias *orig_alias) -{ - g_return_val_if_fail (orig_alias, NULL); - - return lgl_template_alias_new (orig_alias->brand, orig_alias->part); -} - - -/** - * lgl_template_alias_free: - * @alias: Alias to free. - * - * This function frees all memory associated with given template alias structure. - * - */ -void -lgl_template_alias_free (lglTemplateAlias *alias) -{ - - if ( alias != NULL ) - { - g_free (alias->brand); - alias->brand = NULL; - - g_free (alias->part); - alias->part = NULL; - - g_free (alias); - } -} - - /** * lgl_template_frame_dup: * @orig_frame: Frame to duplicate. @@ -1498,9 +1372,6 @@ compare_origins (gconstpointer a, 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", @@ -1509,13 +1380,6 @@ lgl_template_print (const lglTemplate *template) 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"); } diff --git a/libglabels/template.h b/libglabels/template.h index a7f43fc0..74e50cf8 100644 --- a/libglabels/template.h +++ b/libglabels/template.h @@ -28,8 +28,6 @@ G_BEGIN_DECLS typedef struct _lglTemplate lglTemplate; -typedef struct _lglTemplateAlias lglTemplateAlias; - typedef union _lglTemplateFrame lglTemplateFrame; typedef struct _lglTemplateFrameAll lglTemplateFrameAll; typedef struct _lglTemplateFrameRect lglTemplateFrameRect; @@ -71,22 +69,9 @@ struct _lglTemplate { * template. */ GList *frames; - /* Deprecated: List of (lglTemplateAlias *) alias structures. */ - GList *aliases; - }; -/* - * Top-level Template Structure - */ -struct _lglTemplateAlias { - - gchar *brand; - gchar *part; - -}; - /* * Possible Frame Shapes */ @@ -339,18 +324,12 @@ lglTemplate *lgl_template_new_from_equiv (const gchar *br const gchar *part, const gchar *equiv_part); -void lgl_template_add_alias (lglTemplate *template, - lglTemplateAlias *alias); - void lgl_template_add_category (lglTemplate *template, const gchar *category_id); void lgl_template_add_frame (lglTemplate *template, lglTemplateFrame *frame); -lglTemplateAlias *lgl_template_alias_new (const gchar *brand, - const gchar *part); - lglTemplateFrame *lgl_template_frame_rect_new (const gchar *id, gdouble w, gdouble h, @@ -413,9 +392,6 @@ lglTemplate *lgl_template_dup (const lglTemplate *or void lgl_template_free (lglTemplate *template); -lglTemplateAlias *lgl_template_alias_dup (const lglTemplateAlias *orig_alias); -void lgl_template_alias_free (lglTemplateAlias *alias); - lglTemplateFrame *lgl_template_frame_dup (const lglTemplateFrame *orig_frame); void lgl_template_frame_free (lglTemplateFrame *frame); diff --git a/libglabels/xml-template.c b/libglabels/xml-template.c index 9a2c3c0d..333ee092 100644 --- a/libglabels/xml-template.c +++ b/libglabels/xml-template.c @@ -93,9 +93,6 @@ static void xml_create_markup_rect_node (const lglTemplateMarkup *circl static void xml_create_markup_ellipse_node (const lglTemplateMarkup *circle, xmlNodePtr root, const xmlNsPtr ns); -static void xml_create_alias_node (const lglTemplateAlias *alias, - xmlNodePtr root, - const xmlNsPtr ns); /** @@ -726,44 +723,16 @@ xml_parse_markup_ellipse_node (xmlNodePtr markup_node, /*--------------------------------------------------------------------------*/ -/* PRIVATE. Parse XML Template->Alias Node. */ +/* PRIVATE. Parse deprecated XML Template->Alias Node. */ /*--------------------------------------------------------------------------*/ static void xml_parse_alias_node (xmlNodePtr alias_node, lglTemplate *template) { - gchar *brand; - gchar *part; - gchar *name; - gchar **v; - - brand = lgl_xml_get_prop_string (alias_node, "brand", NULL); - part = lgl_xml_get_prop_string (alias_node, "part", NULL); - if (!brand || !part) - { - name = lgl_xml_get_prop_string (alias_node, "name", NULL); - if (name) - { - g_message (_("Missing required \"brand\" or \"part\" attribute, trying deprecated name.")); - v = g_strsplit (name, " ", 2); - brand = g_strdup (v[0]); - part = g_strdup (v[1]); - g_free (name); - g_strfreev (v); - - } - else - { - g_message (_("Name attribute also missing.")); - } - } - - lgl_template_add_alias (template, lgl_template_alias_new (brand, part)); - - g_free (brand); - g_free (part); + g_message (_("Skipping deprecated \"Alias\" node.")); } + /** * lgl_xml_template_write_templates_to_file: * @templates: List of #lglTemplate structures @@ -857,7 +826,6 @@ lgl_xml_template_create_template_node (const lglTemplate *template, { xmlNodePtr node; GList *p; - lglTemplateAlias *alias; lglTemplateFrame *frame; node = xmlNewChild (root, ns, (xmlChar *)"Template", NULL); @@ -876,14 +844,6 @@ lgl_xml_template_create_template_node (const lglTemplate *template, lgl_xml_set_prop_string (node, "description", template->description); - for ( p=template->aliases; p != NULL; p=p->next ) { - alias = (lglTemplateAlias *)p->data; - if ( !(xmlStrEqual ((xmlChar *)template->brand, (xmlChar *)alias->brand) && - xmlStrEqual ((xmlChar *)template->part, (xmlChar *)alias->part)) ) - { - xml_create_alias_node ( alias, node, ns ); - } - } xml_create_meta_node ("product_url", template->product_url, node, ns ); for ( p=template->category_ids; p != NULL; p=p->next ) { @@ -1123,24 +1083,6 @@ xml_create_markup_ellipse_node (const lglTemplateMarkup *markup, } -/*--------------------------------------------------------------------------*/ -/* PRIVATE. Add XML Template->Alias Node. */ -/*--------------------------------------------------------------------------*/ -static void -xml_create_alias_node (const lglTemplateAlias *alias, - xmlNodePtr root, - const xmlNsPtr ns) -{ - xmlNodePtr node; - - node = xmlNewChild (root, ns, (xmlChar *)"Alias", NULL); - - lgl_xml_set_prop_string (node, "brand", alias->brand); - lgl_xml_set_prop_string (node, "part", alias->part); - -} - - /* * Local Variables: -- emacs diff --git a/src/mini-preview-pixbuf-cache.c b/src/mini-preview-pixbuf-cache.c index 11f2cd2b..941667f4 100644 --- a/src/mini-preview-pixbuf-cache.c +++ b/src/mini-preview-pixbuf-cache.c @@ -80,21 +80,14 @@ void gl_mini_preview_pixbuf_cache_add_by_template (lglTemplate *template) { GdkPixbuf *pixbuf; - GList *p; - lglTemplateAlias *alias; gchar *name; gl_debug (DEBUG_PIXBUF_CACHE, "START"); pixbuf = gl_mini_preview_pixbuf_new (template, 72, 72); - for ( p=template->aliases; p != NULL; p=p->next ) - { - alias = (lglTemplateAlias *)p->data; - - name = g_strdup_printf ("%s %s", alias->brand, alias->part); - g_hash_table_insert (mini_preview_pixbuf_cache, name, g_object_ref (pixbuf)); - } + name = g_strdup_printf ("%s %s", template->brand, template->part); + g_hash_table_insert (mini_preview_pixbuf_cache, name, g_object_ref (pixbuf)); g_object_unref (pixbuf); diff --git a/templates/glabels-2.3.dtd b/templates/glabels-2.3.dtd index 31a97375..5678dd1d 100644 --- a/templates/glabels-2.3.dtd +++ b/templates/glabels-2.3.dtd @@ -180,7 +180,7 @@ - + - -