gnucash unstable: Multiple changes pushed

Geert Janssens gjanssens at code.gnucash.org
Tue Apr 10 13:14:18 EDT 2018


Updated	 via  https://github.com/Gnucash/gnucash/commit/b5ac8591 (commit)
	 via  https://github.com/Gnucash/gnucash/commit/8bfbc779 (commit)
	 via  https://github.com/Gnucash/gnucash/commit/facd26c0 (commit)
	 via  https://github.com/Gnucash/gnucash/commit/8975158a (commit)
	 via  https://github.com/Gnucash/gnucash/commit/5af11ced (commit)
	from  https://github.com/Gnucash/gnucash/commit/6810c2a6 (commit)



commit b5ac8591fcbf71c8a6a14caa707e055c49ed96a3
Merge: 6810c2a 8bfbc77
Author: Geert Janssens <geert at kobaltwit.be>
Date:   Tue Apr 10 19:11:13 2018 +0200

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


commit 8bfbc7791ee4c76537ef16afd4f336c6c914b745
Author: Robert Fewell <14uBobIT at gmail.com>
Date:   Mon Apr 9 19:03:39 2018 +0100

    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.

diff --git a/gnucash/gnome-utils/gnc-main-window.c b/gnucash/gnome-utils/gnc-main-window.c
index b77b56a..2a15582 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);

commit facd26c0ef18ef016392d13e9f09a86d966815f4
Author: Robert Fewell <14uBobIT at gmail.com>
Date:   Mon Apr 9 15:15:25 2018 +0100

    Bug 794994 - Display Alphavantage key in full
    
    Set the entry to expand so all the space is used to display.

diff --git a/gnucash/gtkbuilder/dialog-preferences.glade b/gnucash/gtkbuilder/dialog-preferences.glade
index abd3429..092f822 100644
--- a/gnucash/gtkbuilder/dialog-preferences.glade
+++ b/gnucash/gtkbuilder/dialog-preferences.glade
@@ -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>

commit 8975158ac64af4d0a0236ba1cea9e7fd040766f0
Author: Robert Fewell <14uBobIT at gmail.com>
Date:   Mon Apr 9 15:13:29 2018 +0100

    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.

diff --git a/gnucash/gnome-utils/dialog-transfer.c b/gnucash/gnome-utils/dialog-transfer.c
index 13204f0..89a4bd9 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)

commit 5af11ced47f4fd640b0fa7b9b34ee8d6f4d18c6e
Author: Robert Fewell <14uBobIT at gmail.com>
Date:   Mon Apr 9 15:10:02 2018 +0100

    Invalid cast for parent of transfer dialog
    
    Trying to cast from SplitRegister to GtkWidget.

diff --git a/gnucash/register/ledger-core/split-register-control.c b/gnucash/register/ledger-core/split-register-control.c
index 235befa..fe14cd2 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. */



Summary of changes:
 gnucash/gnome-utils/dialog-transfer.c              | 15 +++--
 gnucash/gnome-utils/gnc-main-window.c              | 71 +++++++++++++---------
 gnucash/gtkbuilder/dialog-preferences.glade        |  4 ++
 .../register/ledger-core/split-register-control.c  |  2 +-
 4 files changed, 57 insertions(+), 35 deletions(-)



More information about the gnucash-changes mailing list