[glabels] Remove deprecated alias node support for templates.



commit f9d15efd6543ae69c821010751ef960d97877349
Author: Jim Evins <evins snaught com>
Date:   Thu Nov 25 16:23:12 2010 -0500

    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.

 docs/libglabels/libglabels-3.0-sections.txt     |    8 -
 docs/libglabels/tmpl/db.sgml                    |    8 -
 docs/libglabels/tmpl/libglabels-3.0-unused.sgml |   23 ---
 docs/libglabels/tmpl/template.sgml              |   47 ------
 help/C/mancreate.page                           |   33 +----
 libglabels/db.c                                 |  200 +++++------------------
 libglabels/template.c                           |  142 +----------------
 libglabels/template.h                           |   24 ---
 libglabels/xml-template.c                       |   64 +-------
 src/mini-preview-pixbuf-cache.c                 |   11 +-
 templates/glabels-2.3.dtd                       |    8 +-
 11 files changed, 57 insertions(+), 511 deletions(-)
---
diff --git a/docs/libglabels/libglabels-3.0-sections.txt b/docs/libglabels/libglabels-3.0-sections.txt
index bdf482d..ea100c4 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
 </SECTION>
 
 <SECTION>
 <FILE>template</FILE>
 <INCLUDE>libglabels/template.h</INCLUDE>
 lglTemplate
-<SUBSECTION Alias Structure>
-lglTemplateAlias
 <SUBSECTION Frame Structure>
 lglTemplateFrameShape
 lglTemplateFrame
@@ -91,7 +88,6 @@ lgl_template_dup
 lgl_template_free
 lgl_template_add_category
 lgl_template_add_frame
-lgl_template_add_alias
 <SUBSECTION Template Query Functions>
 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
-<SUBSECTION Alias Functions>
-lgl_template_alias_new
-lgl_template_alias_dup
-lgl_template_alias_free
 <SUBSECTION Frame Functions>
 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 2a253bc..28ced30 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: 
 
 
-<!-- ##### FUNCTION lgl_db_print_aliases ##### -->
-<para>
-
-</para>
-
- template: 
-
-
diff --git a/docs/libglabels/tmpl/libglabels-3.0-unused.sgml b/docs/libglabels/tmpl/libglabels-3.0-unused.sgml
index 628b4ae..f600156 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: 
 
 <!-- ##### UNION glTemplateFrame ##### -->
 <para>
@@ -599,14 +598,6 @@ the CSS2 Specification (Section 4.3.2).
 </para>
 
 
-<!-- ##### FUNCTION gl_template_add_alias ##### -->
-<para>
-
-</para>
-
- template: 
- alias: 
-
 <!-- ##### FUNCTION gl_template_add_category ##### -->
 <para>
 
@@ -976,13 +967,6 @@ the CSS2 Specification (Section 4.3.2).
 @page_height: 
 @Returns: 
 
-<!-- ##### FUNCTION gl_template_print_aliases ##### -->
-<para>
-
-</para>
-
- template: 
-
 <!-- ##### FUNCTION gl_template_print_known_templates ##### -->
 <para>
 
@@ -1527,13 +1511,6 @@ attributes.
 </para>
 
 
-<!-- ##### FUNCTION lgl_template_print_aliases ##### -->
-<para>
-
-</para>
-
- template: 
-
 <!-- ##### FUNCTION lgl_template_print_known_templates ##### -->
 <para>
 
diff --git a/docs/libglabels/tmpl/template.sgml b/docs/libglabels/tmpl/template.sgml
index 5108840..b3f3658 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.
-
-<!-- ##### STRUCT lglTemplateAlias ##### -->
-<para>
-This structure defines an alias for the parent template structure.  An alias is used for
-different products that can use the same template.
-</para>
-
- brand: Brand name of label or card.  E.g. "Avery."
- part: Part name or number of label or card.  E.g. "8160."
 
 <!-- ##### ENUM lglTemplateFrameShape ##### -->
 <para>
@@ -292,15 +281,6 @@ relative to the upper left corner of the page.
 @frame: 
 
 
-<!-- ##### FUNCTION lgl_template_add_alias ##### -->
-<para>
-
-</para>
-
- template: 
- alias: 
-
-
 <!-- ##### FUNCTION lgl_template_get_name ##### -->
 <para>
 
@@ -360,33 +340,6 @@ relative to the upper left corner of the page.
 @Returns: 
 
 
-<!-- ##### FUNCTION lgl_template_alias_new ##### -->
-<para>
-
-</para>
-
- brand: 
- part: 
- Returns: 
-
-
-<!-- ##### FUNCTION lgl_template_alias_dup ##### -->
-<para>
-
-</para>
-
- orig_alias: 
- Returns: 
-
-
-<!-- ##### FUNCTION lgl_template_alias_free ##### -->
-<para>
-
-</para>
-
- alias: 
-
-
 <!-- ##### FUNCTION lgl_template_frame_rect_new ##### -->
 <para>
 
diff --git a/help/C/mancreate.page b/help/C/mancreate.page
index 5fbe523..b7a9234 100644
--- a/help/C/mancreate.page
+++ b/help/C/mancreate.page
@@ -84,8 +84,6 @@
       &lt;Markup-margin size="5pt"/&gt;
       &lt;Layout nx="3" ny="10" x0="11.25pt" y0="36pt" dx="200pt" dy="72pt"/&gt;
     &lt;/Label-rectangle&gt;
-    &lt;Alias brand="Avery" part="5160"/&gt;
-    &lt;Alias brand="Avery" part="6233"/&gt;
   &lt;/Template&gt;
       </code>
     </section>
@@ -96,9 +94,7 @@
       <p>A <em>Template</em> node describes a single stationary
         product.  It must contain one instance of any type of Label node
         (<em>Label-rectangle</em>,
-        <em>Label-round</em>, or <em>Label-cd</em>).
-        This node can be followed by zero or more 
-        <em>Alias</em> nodes.</p>
+        <em>Label-round</em>, or <em>Label-cd</em>).</p>
 
 <table frame="all" rules="rows">
   <tr>
@@ -128,6 +124,9 @@
   <tr>
     <td><p>height</p></td>  <td><p>Page height.  Only valid if size="Other"</p></td>
   </tr>
+  <tr>
+    <td><p>equiv</p></td>  <td><p>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.</p></td>
+  </tr>
 </table>
 
 </section>
@@ -514,29 +513,5 @@
 	      <!-- ==== End of Figure ==== -->
     </section>
 
-    <section id="template-alias-node">
-      <title>Alias Node</title>
-
-      <p>An <em>Alias</em> node provides the name of a
-        product with the same size and layout characteristics as the
-        parent template.</p>
-
-<table frame="all" rules="rows">
-  <tr>
-    <td><p>Property</p></td>  <td><p>Description</p></td>
-  </tr>
-  <tr>
-    <td><p></p></td>  <td><p></p></td>
-  </tr>
-  <tr>
-    <td><p>brand</p></td>  <td><p>The brand or manufacturer of the equivalent product.</p></td>
-  </tr>
-  <tr>
-    <td><p>part</p></td>  <td><p>The part number of the equivalent product.</p></td>
-  </tr>
-</table>
-
-    </section>
-
 
 </page>
diff --git a/libglabels/db.c b/libglabels/db.c
index 9880eb0..eac29e6 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 d5bf037..716db60 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
         {
@@ -394,50 +375,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
  *   @frame:     Pointer to frame 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);
@@ -1222,48 +1138,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 a7f43fc..74e50cf 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,23 +69,10 @@ 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
  */
 typedef enum {
@@ -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 9a2c3c0..333ee09 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 11f2cd2..941667f 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 31a9737..5678dd1 100644
--- a/templates/glabels-2.3.dtd
+++ b/templates/glabels-2.3.dtd
@@ -180,7 +180,7 @@
 <!ENTITY % label_element  "Label-rectangle | Label-round | Label-ellipse | Label-cd">
 <!ENTITY % markup_element "Markup-margin | Markup-line | Markup-circle | Markup-rect | Markup-ellipse">
 
-<!ELEMENT Template (Meta*, (%label_element;)*, Alias*)>
+<!ELEMENT Template (Meta*, (%label_element;)*)>
 <!ATTLIST Template
                  brand           %STRING_TYPE;           #REQUIRED
                  part            %STRING_TYPE;           #REQUIRED
@@ -283,12 +283,6 @@
                  dy              %LENGTH_TYPE;           "0 pt"
 >
 
-<!ELEMENT Alias EMPTY>
-<!ATTLIST Alias
-                 brand           %STRING_TYPE;           #REQUIRED
-                 part            %STRING_TYPE;           #REQUIRED
-                 name            %STRING_TYPE;           #IMPLIED
->
 
 <!-- :::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::: -->
 <!-- Objects Section                                                      -->



[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]