Skip to content

Commit

Permalink
Merge branch 'maint'
Browse files Browse the repository at this point in the history
  • Loading branch information
jralls committed Mar 10, 2016
2 parents 175d404 + 4a60e49 commit 3a86998
Show file tree
Hide file tree
Showing 3 changed files with 26 additions and 27 deletions.
37 changes: 19 additions & 18 deletions src/engine/gnc-pricedb.c
Original file line number Diff line number Diff line change
Expand Up @@ -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 */
Expand All @@ -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",
Expand Down Expand Up @@ -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)
{
Expand All @@ -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",
Expand Down
11 changes: 5 additions & 6 deletions src/gnome-utils/dialog-commodity.c
Original file line number Diff line number Diff line change
Expand Up @@ -644,17 +644,17 @@ 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));

/* Erase the old entries */
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)
Expand Down Expand Up @@ -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);
}

Expand Down
5 changes: 2 additions & 3 deletions src/report/report-system/html-document.scm
Original file line number Diff line number Diff line change
Expand Up @@ -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?
Expand Down

0 comments on commit 3a86998

Please sign in to comment.