]> git.sur5r.net Git - glabels/commitdiff
2007-11-18 Jim Evins <evins@snaught.com>
authorJim Evins <evins@snaught.com>
Mon, 19 Nov 2007 03:19:50 +0000 (03:19 +0000)
committerJim Evins <evins@snaught.com>
Mon, 19 Nov 2007 03:19:50 +0000 (03:19 +0000)
* data/glade/template-designer.glade:
* src/template-designer.c:
Don't advance past name page, if brand and part match an existing template.

git-svn-id: https://glabels.svn.sourceforge.net/svnroot/glabels/trunk@691 f5e0f49d-192f-0410-a22d-a8d8700d0965

glabels2/ChangeLog
glabels2/data/glade/template-designer.glade
glabels2/src/template-designer.c

index cd93db2829a02657fc1685fa5109628e5ff86c87..b4199448d5ba6562e52c9325df80c1e92ff420e4 100644 (file)
@@ -1,3 +1,9 @@
+2007-11-18  Jim Evins  <evins@snaught.com>
+
+       * data/glade/template-designer.glade:
+       * src/template-designer.c:
+               Don't advance past name page, if brand and part match an existing template.
+
 2007-11-18  Jim Evins  <evins@snaught.com>
 
        * libglabels/db.c: (lgl_db_register_template), (read_templates):
index 6b84fbab33afa7462eeece3563bcb6b8416dba28..f148a74206dadf91b08fce114cb5d6006fb487c3 100644 (file)
@@ -115,7 +115,7 @@ This dialog will assist you in the creation of a custom gLabels template.</prope
          <child>
            <widget class="GtkTable" id="table2">
              <property name="visible">True</property>
-             <property name="n_rows">4</property>
+             <property name="n_rows">6</property>
              <property name="n_columns">2</property>
              <property name="homogeneous">False</property>
              <property name="row_spacing">12</property>
@@ -318,8 +318,8 @@ This dialog will assist you in the creation of a custom gLabels template.</prope
                <packing>
                  <property name="left_attach">0</property>
                  <property name="right_attach">1</property>
-                 <property name="top_attach">2</property>
-                 <property name="bottom_attach">3</property>
+                 <property name="top_attach">4</property>
+                 <property name="bottom_attach">5</property>
                  <property name="x_options">fill</property>
                  <property name="y_options"></property>
                </packing>
@@ -340,8 +340,8 @@ This dialog will assist you in the creation of a custom gLabels template.</prope
                <packing>
                  <property name="left_attach">1</property>
                  <property name="right_attach">2</property>
-                 <property name="top_attach">2</property>
-                 <property name="bottom_attach">3</property>
+                 <property name="top_attach">4</property>
+                 <property name="bottom_attach">5</property>
                  <property name="y_options"></property>
                </packing>
              </child>
@@ -367,8 +367,36 @@ This dialog will assist you in the creation of a custom gLabels template.</prope
                <packing>
                  <property name="left_attach">1</property>
                  <property name="right_attach">2</property>
-                 <property name="top_attach">3</property>
-                 <property name="bottom_attach">4</property>
+                 <property name="top_attach">5</property>
+                 <property name="bottom_attach">6</property>
+                 <property name="x_options">fill</property>
+                 <property name="y_options"></property>
+               </packing>
+             </child>
+
+             <child>
+               <widget class="GtkLabel" id="name_warning_label">
+                 <property name="visible">True</property>
+                 <property name="label" translatable="yes"></property>
+                 <property name="use_underline">False</property>
+                 <property name="use_markup">True</property>
+                 <property name="justify">GTK_JUSTIFY_LEFT</property>
+                 <property name="wrap">False</property>
+                 <property name="selectable">False</property>
+                 <property name="xalign">0</property>
+                 <property name="yalign">0.5</property>
+                 <property name="xpad">0</property>
+                 <property name="ypad">0</property>
+                 <property name="ellipsize">PANGO_ELLIPSIZE_NONE</property>
+                 <property name="width_chars">-1</property>
+                 <property name="single_line_mode">False</property>
+                 <property name="angle">0</property>
+               </widget>
+               <packing>
+                 <property name="left_attach">1</property>
+                 <property name="right_attach">2</property>
+                 <property name="top_attach">2</property>
+                 <property name="bottom_attach">3</property>
                  <property name="x_options">fill</property>
                  <property name="y_options"></property>
                </packing>
index 097083b32df82ec3a2338cf105c35099cc0d5550..1cc8cc5c080e19c245dd3516f3dff8a7c5e76c4d 100644 (file)
@@ -92,6 +92,7 @@ struct _glTemplateDesignerPrivate
        /* Name page controls */
        GtkWidget       *brand_entry;
        GtkWidget       *part_num_entry;
+        GtkWidget       *name_warning_label;
        GtkWidget       *description_entry;
 
        /* Page size page controls */
@@ -443,10 +444,11 @@ construct_name_page (glTemplateDesigner      *dialog,
                 return;
         }
 
-       dialog->priv->name_page         = glade_xml_get_widget (gui, "name_page");
-       dialog->priv->brand_entry       = glade_xml_get_widget (gui, "brand_entry");
-       dialog->priv->part_num_entry    = glade_xml_get_widget (gui, "part_num_entry");
-       dialog->priv->description_entry = glade_xml_get_widget (gui, "description_entry");
+       dialog->priv->name_page          = glade_xml_get_widget (gui, "name_page");
+       dialog->priv->brand_entry        = glade_xml_get_widget (gui, "brand_entry");
+       dialog->priv->part_num_entry     = glade_xml_get_widget (gui, "part_num_entry");
+       dialog->priv->name_warning_label = glade_xml_get_widget (gui, "name_warning_label");
+       dialog->priv->description_entry  = glade_xml_get_widget (gui, "description_entry");
 
         g_object_unref (gui);
 
@@ -1235,11 +1237,24 @@ name_page_changed_cb (glTemplateDesigner *dialog)
 {
        gchar *brand, *part_num, *desc;
 
-       brand    = gtk_editable_get_chars (GTK_EDITABLE(dialog->priv->brand_entry), 0, -1);
-       part_num = gtk_editable_get_chars (GTK_EDITABLE(dialog->priv->part_num_entry), 0, -1);
+       brand    = g_strstrip (gtk_editable_get_chars (GTK_EDITABLE(dialog->priv->brand_entry), 0, -1));
+       part_num = g_strstrip (gtk_editable_get_chars (GTK_EDITABLE(dialog->priv->part_num_entry), 0, -1));
        desc     = gtk_editable_get_chars (GTK_EDITABLE(dialog->priv->description_entry), 0, -1);
 
-       if (brand && brand[0] && part_num && part_num[0] && desc && desc[0])
+
+       if (brand && brand[0] && part_num && part_num[0] &&
+            lgl_db_does_template_exist (brand, part_num))
+        {
+                gtk_label_set_markup (GTK_LABEL (dialog->priv->name_warning_label),
+                                    _("<span foreground='red' weight='bold'>Brand and part# match an existing template!</span>"));
+        }
+        else
+        {
+                gtk_label_set_text (GTK_LABEL (dialog->priv->name_warning_label), "");
+        }
+
+       if (brand && brand[0] && part_num && part_num[0] && desc && desc[0] &&
+            !lgl_db_does_template_exist (brand, part_num))
         {
 
                 gtk_assistant_set_page_complete (GTK_ASSISTANT (dialog),
@@ -1614,8 +1629,8 @@ build_template (glTemplateDesigner      *dialog)
 
        upp = dialog->priv->units_per_point;
 
-       brand    = gtk_editable_get_chars (GTK_EDITABLE(dialog->priv->brand_entry), 0, -1);
-       part_num = gtk_editable_get_chars (GTK_EDITABLE(dialog->priv->part_num_entry), 0, -1);
+       brand    = g_strstrip (gtk_editable_get_chars (GTK_EDITABLE(dialog->priv->brand_entry), 0, -1));
+       part_num = g_strstrip (gtk_editable_get_chars (GTK_EDITABLE(dialog->priv->part_num_entry), 0, -1));
        desc     = gtk_editable_get_chars (GTK_EDITABLE(dialog->priv->description_entry), 0, -1);
 
        page_size_name =