Merge branch 'fixes' of https://github.com/Bob-IT/gnucash into unstable

This commit is contained in:
Geert Janssens 2018-04-10 19:11:13 +02:00
commit b5ac8591fc
4 changed files with 57 additions and 35 deletions

View File

@ -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)

View File

@ -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);

View File

@ -3280,6 +3280,7 @@ many months before the current month:</property>
<property name="visible">True</property>
<property name="can_focus">True</property>
<property name="tooltip_text" translatable="yes">To retrieve online quotes from Alphavantage, this key needs to be set. A key can be retrieved from the Alpha Vantage website.</property>
<property name="hexpand">True</property>
</object>
<packing>
<property name="left_attach">1</property>
@ -3316,5 +3317,8 @@ many months before the current month:</property>
<action-widget response="-11">helpbutton2</action-widget>
<action-widget response="-7">closebutton2</action-widget>
</action-widgets>
<child>
<placeholder/>
</child>
</object>
</interface>

View File

@ -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. */