Merge branch 'maint'

This commit is contained in:
John Ralls 2016-03-10 11:07:01 -08:00
commit 3a86998ea7
3 changed files with 26 additions and 27 deletions

View File

@ -1056,18 +1056,6 @@ gnc_pricedb_equal (GNCPriceDB *db1, GNCPriceDB *db2)
return equal_data.equal;
}
static gboolean
insert_or_replace_price(GNCPriceDB *db, GNCPrice *p)
{
GNCPrice *old_price = gnc_pricedb_lookup_day (db, p->commodity,
p->currency, p->tmspec);
if (old_price == NULL)
return TRUE;
if (p->source < old_price->source)
return TRUE;
return FALSE;
}
/* ==================================================================== */
/* The add_price() function is a utility that only manages the
* dual hash table instertion */
@ -1081,6 +1069,7 @@ add_price(GNCPriceDB *db, GNCPrice *p)
gnc_commodity *commodity;
gnc_commodity *currency;
GHashTable *currency_hash;
GNCPrice *old_price;
if (!db || !p) return FALSE;
ENTER ("db=%p, pr=%p dirty=%d destroying=%d",
@ -1114,12 +1103,6 @@ add_price(GNCPriceDB *db, GNCPrice *p)
return FALSE;
}
if (!insert_or_replace_price(db, p))
{
LEAVE("A better price already exists");
return FALSE;
}
currency_hash = g_hash_table_lookup(db->commodity_hash, commodity);
if (!currency_hash)
{
@ -1133,14 +1116,32 @@ add_price(GNCPriceDB *db, GNCPrice *p)
LEAVE ("gnc_price_list_insert failed");
return FALSE;
}
if (!price_list)
{
LEAVE (" no price list");
return FALSE;
}
/* Check for an existing price on the same day. If there is no existing price,
* add this one. If this price is of equal or better precedence than the old
* one, copy this one over the old one.
*/
old_price = gnc_pricedb_lookup_day (db, p->commodity, p->currency,
p->tmspec);
if (!db->bulk_update && old_price != NULL)
{
if (p->source > old_price->source)
{
gnc_price_unref(p);
LEAVE ("Better price already in DB.");
return FALSE;
}
gnc_pricedb_remove_price(db, old_price);
}
g_hash_table_insert(currency_hash, currency, price_list);
p->db = db;
qof_event_gen (&p->inst, QOF_EVENT_ADD, NULL);
LEAVE ("db=%p, pr=%p dirty=%d dextroying=%d commodity=%s/%s currency_hash=%p",

View File

@ -644,9 +644,8 @@ gnc_ui_update_namespace_picker (GtkWidget *cbwe,
{
GtkComboBox *combo_box;
GtkTreeModel *model;
GtkTreeIter iter;
GtkTreeIter iter, match;
GList *namespaces, *node;
gint current = 0, match = 0;
g_return_if_fail(GTK_IS_COMBO_BOX (cbwe));
@ -654,7 +653,8 @@ gnc_ui_update_namespace_picker (GtkWidget *cbwe,
combo_box = GTK_COMBO_BOX(cbwe);
model = gtk_combo_box_get_model(combo_box);
gtk_list_store_clear(GTK_LIST_STORE(model));
gtk_combo_box_set_active(combo_box, -1);
gtk_tree_model_get_iter_first(model, &match);
gtk_combo_box_set_active_iter(combo_box, &match);
/* fetch a list of the namespaces */
switch (mode)
@ -698,11 +698,10 @@ gnc_ui_update_namespace_picker (GtkWidget *cbwe,
}
if (init_string && (g_utf8_collate(node->data, init_string) == 0))
match = current;
current++;
match = iter;
}
gtk_combo_box_set_active(combo_box, match);
gtk_combo_box_set_active_iter(combo_box, &match);
g_list_free(namespaces);
}

View File

@ -158,9 +158,8 @@
;;./share/gnucash/scm/gnucash/report/taxinvoice.eguile.scm:<html>
;;./share/gnucash/scm/gnucash/report/balsheet-eg.eguile.scm:<html>
;; Validate against XHTML 1.0 Transitional
(push "<!DOCTYPE html PUBLIC \"-//W3C//DTD XHTML 1.0 Transitional//EN\" \n\"http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd\">")
(push "<html xmlns=\"http://www.w3.org/1999/xhtml\">\n")
;; Validate against HTML4 Transitional:
(push "<!DOCTYPE!DOCTYPE html PUBLIC -//W3C//DTD HTML 4.01 Transitional//EN\" \n\"http://www.w3.org/TR/html4/loose.dtd\">")
(push "<head>\n")
(push "<meta http-equiv=\"content-type\" content=\"text/html; charset=utf-8\" />\n")
(if css?