From 5af11ced47f4fd640b0fa7b9b34ee8d6f4d18c6e Mon Sep 17 00:00:00 2001
From: Robert Fewell <14uBobIT@gmail.com>
Date: Mon, 9 Apr 2018 15:10:02 +0100
Subject: [PATCH 1/4] Invalid cast for parent of transfer dialog
Trying to cast from SplitRegister to GtkWidget.
---
gnucash/register/ledger-core/split-register-control.c | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/gnucash/register/ledger-core/split-register-control.c b/gnucash/register/ledger-core/split-register-control.c
index 235befa260..fe14cd2828 100644
--- a/gnucash/register/ledger-core/split-register-control.c
+++ b/gnucash/register/ledger-core/split-register-control.c
@@ -1250,7 +1250,7 @@ gnc_split_register_xfer_dialog(SplitRegister *reg, Transaction *txn,
cur = reg->table->current_cursor;
/* Create the exchange rate dialog. */
- xfer = gnc_xfer_dialog(GTK_WIDGET (reg), NULL);
+ xfer = gnc_xfer_dialog(gnc_split_register_get_parent (reg), NULL);
g_return_val_if_fail(xfer, NULL);
/* Set the description. */
From 8975158ac64af4d0a0236ba1cea9e7fd040766f0 Mon Sep 17 00:00:00 2001
From: Robert Fewell <14uBobIT@gmail.com>
Date: Mon, 9 Apr 2018 15:13:29 +0100
Subject: [PATCH 2/4] If there are no prices in the db, critical errors are
flagged
When dialog transfer is used between two commodities and there are no
prices in the db a critical error is logged. Test for price object
being NULL before retrieving the price for the error message.
---
gnucash/gnome-utils/dialog-transfer.c | 15 +++++++++++----
1 file changed, 11 insertions(+), 4 deletions(-)
diff --git a/gnucash/gnome-utils/dialog-transfer.c b/gnucash/gnome-utils/dialog-transfer.c
index 13204f0f0f..89a4bd9d24 100644
--- a/gnucash/gnome-utils/dialog-transfer.c
+++ b/gnucash/gnome-utils/dialog-transfer.c
@@ -272,6 +272,16 @@ lookup_price(PriceReq *pr, PriceDate pd)
prc = gnc_pricedb_lookup_latest (pr->pricedb, pr->from, pr->to);
break;
}
+
+ if (!prc) //no price found
+ {
+ PINFO("No price Found for %s, %s",
+ gnc_commodity_get_mnemonic(pr->from),
+ gnc_commodity_get_mnemonic(pr->to));
+ pr->price = NULL;
+ return FALSE;
+ }
+
if (gnc_commodity_equiv(gnc_price_get_currency(prc), pr->from))
{
pr->reverse = TRUE;
@@ -279,7 +289,6 @@ lookup_price(PriceReq *pr, PriceDate pd)
gnc_commodity_get_mnemonic(pr->to),
gnc_numeric_to_double(gnc_price_get_value(prc)),
gnc_commodity_get_mnemonic(pr->from));
-
}
else
{
@@ -288,8 +297,6 @@ lookup_price(PriceReq *pr, PriceDate pd)
gnc_numeric_to_double(gnc_price_get_value(prc)),
gnc_commodity_get_mnemonic(pr->to));
}
- if (!prc)
- return FALSE;
pr->price = prc;
return TRUE;
}
@@ -1639,7 +1646,7 @@ new_price(XferDialog *xferData, Timespec ts)
PINFO("Created price: 1 %s = %f %s", gnc_commodity_get_mnemonic(from),
gnc_numeric_to_double(value), gnc_commodity_get_mnemonic(to));
gnc_price_unref (price);
-}
+}
static void
create_price(XferDialog *xferData, Timespec ts)
From facd26c0ef18ef016392d13e9f09a86d966815f4 Mon Sep 17 00:00:00 2001
From: Robert Fewell <14uBobIT@gmail.com>
Date: Mon, 9 Apr 2018 15:15:25 +0100
Subject: [PATCH 3/4] Bug 794994 - Display Alphavantage key in full
Set the entry to expand so all the space is used to display.
---
gnucash/gtkbuilder/dialog-preferences.glade | 4 ++++
1 file changed, 4 insertions(+)
diff --git a/gnucash/gtkbuilder/dialog-preferences.glade b/gnucash/gtkbuilder/dialog-preferences.glade
index abd34291be..092f822635 100644
--- a/gnucash/gtkbuilder/dialog-preferences.glade
+++ b/gnucash/gtkbuilder/dialog-preferences.glade
@@ -3280,6 +3280,7 @@ many months before the current month:
True
True
To retrieve online quotes from Alphavantage, this key needs to be set. A key can be retrieved from the Alpha Vantage website.
+ True
1
@@ -3316,5 +3317,8 @@ many months before the current month:
helpbutton2
closebutton2
+
+
+
From 8bfbc7791ee4c76537ef16afd4f336c6c914b745 Mon Sep 17 00:00:00 2001
From: Robert Fewell <14uBobIT@gmail.com>
Date: Mon, 9 Apr 2018 19:03:39 +0100
Subject: [PATCH 4/4] Bug 794953 - Ellipsize on short tab labels
Correct error on when to ellipsize tab labels. Also as this is used in
two places separate out this to new function so it is not duplicated.
---
gnucash/gnome-utils/gnc-main-window.c | 71 ++++++++++++++++-----------
1 file changed, 41 insertions(+), 30 deletions(-)
diff --git a/gnucash/gnome-utils/gnc-main-window.c b/gnucash/gnome-utils/gnc-main-window.c
index b77b56ad46..2a1558282d 100644
--- a/gnucash/gnome-utils/gnc-main-window.c
+++ b/gnucash/gnome-utils/gnc-main-window.c
@@ -2028,11 +2028,46 @@ gnc_main_window_update_tab_color (gpointer gsettings, gchar *pref, gpointer user
}
+/** Set the tab label ellipsize value. The special check for a zero
+ * value handles the case where a user hasn't set a tab width and
+ * the preference default isn't detected.
+ *
+ * @internal
+ *
+ * @param label GtkLabel for the tab.
+ *
+ * @param tab_width Tab width the user has set in preferences.
+ *
+ */
+static void
+gnc_main_window_set_tab_ellipsize (GtkWidget *label, gint tab_width)
+{
+ const gchar *lab_text = gtk_label_get_text (GTK_LABEL(label));
+
+ if (tab_width != 0)
+ {
+ if (g_utf8_strlen (lab_text, -1) < tab_width)
+ {
+ gtk_label_set_width_chars (GTK_LABEL(label), strlen (lab_text));
+ gtk_label_set_ellipsize (GTK_LABEL(label), PANGO_ELLIPSIZE_NONE);
+ }
+ else
+ {
+ gtk_label_set_width_chars (GTK_LABEL(label), tab_width);
+ gtk_label_set_ellipsize (GTK_LABEL(label), PANGO_ELLIPSIZE_MIDDLE);
+ }
+ }
+ else
+ {
+ gtk_label_set_width_chars (GTK_LABEL(label), 15);
+ gtk_label_set_ellipsize (GTK_LABEL(label), PANGO_ELLIPSIZE_NONE);
+ }
+}
+
+
/** Update the width of the label in the tab of a notebook page. This
- * function adjusts both the width and the ellipsize mode so that the tab
- * label looks correct. The special check for a zero value handles the
- * case where a user hasn't set a tab width and the preference default isn't
- * detected.
+ * function adjusts both the width and the ellipsize mode so that the
+ * tab label looks correct.
*
* @internal
*
@@ -2046,7 +2081,6 @@ gnc_main_window_update_tab_width_one_page (GncPluginPage *page,
{
gint *new_value = user_data;
GtkWidget *label;
- const gchar *lab_text;
ENTER("page %p, visible %d", page, *new_value);
label = g_object_get_data(G_OBJECT (page), PLUGIN_PAGE_TAB_LABEL);
@@ -2055,23 +2089,7 @@ gnc_main_window_update_tab_width_one_page (GncPluginPage *page,
LEAVE("no label");
return;
}
-
- lab_text = gtk_label_get_text (GTK_LABEL(label));
-
- if (*new_value != 0)
- {
- if (g_utf8_strlen (lab_text, -1) < *new_value)
- gtk_label_set_width_chars (GTK_LABEL(label), strlen (lab_text));
- else
- gtk_label_set_width_chars (GTK_LABEL(label), *new_value);
-
- gtk_label_set_ellipsize(GTK_LABEL(label), PANGO_ELLIPSIZE_MIDDLE);
- }
- else
- {
- gtk_label_set_width_chars (GTK_LABEL(label), 15);
- gtk_label_set_ellipsize(GTK_LABEL(label), PANGO_ELLIPSIZE_NONE);
- }
+ gnc_main_window_set_tab_ellipsize (label, *new_value);
LEAVE(" ");
}
@@ -2940,15 +2958,8 @@ gnc_main_window_open_page (GncMainWindow *window,
label = gtk_label_new (lab_text);
g_object_set_data (G_OBJECT (page), PLUGIN_PAGE_TAB_LABEL, label);
- if (width != 0)
- {
- if (g_utf8_strlen (lab_text, -1) < width)
- gtk_label_set_width_chars (GTK_LABEL(label), strlen (lab_text));
- else
- gtk_label_set_width_chars (GTK_LABEL(label), width);
+ gnc_main_window_set_tab_ellipsize (label, width);
- gtk_label_set_ellipsize(GTK_LABEL(label), PANGO_ELLIPSIZE_MIDDLE);
- }
gtk_widget_show (label);
tab_hbox = gtk_box_new (GTK_ORIENTATION_HORIZONTAL, 6);