+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):
<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>
<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>
<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>
<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>
/* Name page controls */
GtkWidget *brand_entry;
GtkWidget *part_num_entry;
+ GtkWidget *name_warning_label;
GtkWidget *description_entry;
/* Page size page controls */
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);
{
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),
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 =