gnucash maint: Multiple changes pushed

John Ralls jralls at code.gnucash.org
Tue Dec 27 17:46:32 EST 2016


Updated	 via  https://github.com/Gnucash/gnucash/commit/1cc10b5b (commit)
	 via  https://github.com/Gnucash/gnucash/commit/7432ba8c (commit)
	 via  https://github.com/Gnucash/gnucash/commit/84b7a90b (commit)
	from  https://github.com/Gnucash/gnucash/commit/d658b757 (commit)



commit 1cc10b5b4c6dcaabdf5d27e473c2d30e2ed55e76
Author: John Ralls <jralls at ceridwen.us>
Date:   Tue Dec 27 14:46:08 2016 -0800

    Bug 776494 - Wrong menu entry in Tip of the day

diff --git a/doc/tip_of_the_day.list.in b/doc/tip_of_the_day.list.in
index 964090c..3523214 100644
--- a/doc/tip_of_the_day.list.in
+++ b/doc/tip_of_the_day.list.in
@@ -45,7 +45,7 @@ the subaccount (e.g. A:C for Assets:Cash.)")
 
  N_( "Want to see all your subaccount transactions in one register? \
 From the Accounts tab in the main window, highlight the parent account \
-and select View -> Open Subaccounts from the menu.")
+and select Edit -> Open Subaccounts from the menu.")
 
  N_( "When entering dates, you can type '+' or '-' to increment or \
 decrement the selected date. You can use '+' and '-' to increment and \

commit 7432ba8c9145bbc4a11fd74437710c9ac82bdf8f
Author: John Ralls <jralls at ceridwen.us>
Date:   Thu Dec 15 13:40:45 2016 -0800

    Localize the word “CURRENCY” used in the commodity namespace selectors.

diff --git a/src/app-utils/gnc-euro.c b/src/app-utils/gnc-euro.c
index 90cb410..4771efd 100644
--- a/src/app-utils/gnc-euro.c
+++ b/src/app-utils/gnc-euro.c
@@ -23,6 +23,7 @@
 
 #include "gnc-euro.h"
 
+#include <glib/gi18n.h>
 #include <math.h>
 #include <stdlib.h>
 #include <string.h>
diff --git a/src/engine/commodity-table.scm b/src/engine/commodity-table.scm
index e3ab95e..5d81a0a 100644
--- a/src/engine/commodity-table.scm
+++ b/src/engine/commodity-table.scm
@@ -25,7 +25,7 @@
 
 
 
-(define GNC_COMMODITY_NS_CURRENCY "CURRENCY")
+(define GNC_COMMODITY_NS_CURRENCY (gettext "CURRENCY"))
 
 ;; If you change the C side, change this too.
 (define GNC_COMMODITY_NS_AMEX "AMEX")
diff --git a/src/engine/gnc-commodity.h b/src/engine/gnc-commodity.h
index 981b71b..82948fa 100644
--- a/src/engine/gnc-commodity.h
+++ b/src/engine/gnc-commodity.h
@@ -97,7 +97,7 @@ GType gnc_commodity_namespace_get_type(void);
 #define GNC_COMMODITY_NS_LEGACY "GNC_LEGACY_CURRENCIES"
 /* The ISO define is deprecated in favor of CURRENCY */
 #define GNC_COMMODITY_NS_ISO    "ISO4217"
-#define GNC_COMMODITY_NS_CURRENCY "CURRENCY"
+#define GNC_COMMODITY_NS_CURRENCY _("CURRENCY")
 #define GNC_COMMODITY_NS_NASDAQ "NASDAQ"
 #define GNC_COMMODITY_NS_NYSE   "NYSE"
 #define GNC_COMMODITY_NS_EUREX  "EUREX"
diff --git a/src/gnome-utils/gnc-currency-edit.c b/src/gnome-utils/gnc-currency-edit.c
index 6a33bc9..75402ed 100644
--- a/src/gnome-utils/gnc-currency-edit.c
+++ b/src/gnome-utils/gnc-currency-edit.c
@@ -58,6 +58,7 @@
 #include "config.h"
 
 #include <gtk/gtk.h>
+#include <glib/gi18n.h>
 #include <string.h>
 #include <ctype.h>
 #include <stdio.h>

commit 84b7a90b54a1bc264e39e994051c0f8c7f3f8f1f
Author: John Ralls <jralls at ceridwen.us>
Date:   Thu Dec 15 13:39:09 2016 -0800

    Bug 773945 - Select Security Dialog Not User Friendly
    
    Add a new namespace “ALL NON-CURRENCY” to the namespace (type) selector
    lists on the security picker and price editor which causes the commodity
    list to include all non-security commodities.

diff --git a/src/engine/commodity-table.scm b/src/engine/commodity-table.scm
index 3f0f378..e3ab95e 100644
--- a/src/engine/commodity-table.scm
+++ b/src/engine/commodity-table.scm
@@ -33,3 +33,5 @@
 (define GNC_COMMODITY_NS_NASDAQ "NASDAQ")
 (define GNC_COMMODITY_NS_EUREX "EUREX")
 (define GNC_COMMODITY_NS_MUTUAL "FUND")
+(define GNC_COMMODITY_NS_ASX "ASX")
+(define GNC_COMMODITY_NS_NONCURRENCY (gettext "ALL NON-CURRENCY"))
diff --git a/src/engine/gnc-commodity.c b/src/engine/gnc-commodity.c
index fd577ee..80438e8 100644
--- a/src/engine/gnc-commodity.c
+++ b/src/engine/gnc-commodity.c
@@ -2100,6 +2100,26 @@ gnc_commodity_is_currency(const gnc_commodity *cm)
  * list commodities in a give namespace
  ********************************************************************/
 
+static CommodityList*
+commodity_table_get_all_noncurrency_commodities(const gnc_commodity_table* table)
+{
+    GList *node = NULL, *nslist = gnc_commodity_table_get_namespaces(table);
+    CommodityList *retval = NULL;
+    for (node = nslist; node; node=g_list_next(node))
+    {
+        gnc_commodity_namespace *ns = NULL;
+        if (g_strcmp0((char*)(node->data), GNC_COMMODITY_NS_CURRENCY) == 0
+            || g_strcmp0((char*)(node->data), "template") == 0)
+            continue;
+        ns = gnc_commodity_table_find_namespace(table, (char*)(node->data));
+        if (!ns)
+            continue;
+            retval = g_list_concat(g_hash_table_values(ns->cm_table), retval);
+    }
+    g_list_free(nslist);
+    return retval;
+}
+
 CommodityList *
 gnc_commodity_table_get_commodities(const gnc_commodity_table * table,
                                     const char * name_space)
@@ -2108,7 +2128,8 @@ gnc_commodity_table_get_commodities(const gnc_commodity_table * table,
 
     if (!table)
         return NULL;
-
+    if (g_strcmp0(name_space, GNC_COMMODITY_NS_NONCURRENCY) == 0)
+        return commodity_table_get_all_noncurrency_commodities(table);
     ns = gnc_commodity_table_find_namespace(table, name_space);
     if (!ns)
         return NULL;
diff --git a/src/engine/gnc-commodity.h b/src/engine/gnc-commodity.h
index f64684c..981b71b 100644
--- a/src/engine/gnc-commodity.h
+++ b/src/engine/gnc-commodity.h
@@ -104,6 +104,7 @@ GType gnc_commodity_namespace_get_type(void);
 #define GNC_COMMODITY_NS_MUTUAL "FUND"
 #define GNC_COMMODITY_NS_AMEX   "AMEX"
 #define GNC_COMMODITY_NS_ASX    "ASX"
+#define GNC_COMMODITY_NS_NONCURRENCY _("ALL NON-CURRENCY")
 
 typedef GList CommodityList;
 
diff --git a/src/gnome-utils/dialog-account.c b/src/gnome-utils/dialog-account.c
index 2e55136..c4895b5 100644
--- a/src/gnome-utils/dialog-account.c
+++ b/src/gnome-utils/dialog-account.c
@@ -188,7 +188,7 @@ gnc_account_commodity_from_type (AccountWindow * aw, gboolean update)
     if (aw->type == ACCT_TYPE_TRADING)
         new_mode = DIAG_COMM_ALL;
     else if ((aw->type == ACCT_TYPE_STOCK) || (aw->type == ACCT_TYPE_MUTUAL))
-        new_mode = DIAG_COMM_NON_CURRENCY;
+        new_mode = DIAG_COMM_NON_CURRENCY_SELECT;
     else
         new_mode = DIAG_COMM_CURRENCY;
 
diff --git a/src/gnome-utils/dialog-commodity.c b/src/gnome-utils/dialog-commodity.c
index a30ffd6..cc67f7c 100644
--- a/src/gnome-utils/dialog-commodity.c
+++ b/src/gnome-utils/dialog-commodity.c
@@ -285,6 +285,7 @@ gnc_ui_select_commodity_create(const gnc_commodity * orig_sel,
         text = _("_Security/currency:");
         break;
     case DIAG_COMM_NON_CURRENCY:
+    case DIAG_COMM_NON_CURRENCY_SELECT:
         title = _("Select security");
         text = _("_Security:");
         break;
@@ -664,6 +665,7 @@ gnc_ui_update_namespace_picker (GtkWidget *cbwe,
         break;
 
     case DIAG_COMM_NON_CURRENCY:
+    case DIAG_COMM_NON_CURRENCY_SELECT:
         namespaces =
             gnc_commodity_table_get_namespaces (gnc_get_current_commodities());
         node = g_list_find_custom (namespaces, GNC_COMMODITY_NS_CURRENCY, collate);
@@ -682,7 +684,13 @@ gnc_ui_update_namespace_picker (GtkWidget *cbwe,
         namespaces = g_list_prepend (NULL, GNC_COMMODITY_NS_CURRENCY);
         break;
     }
-
+/* First insert "ALL" */
+    if (mode == DIAG_COMM_NON_CURRENCY_SELECT || mode == DIAG_COMM_ALL)
+    {
+        gtk_list_store_append(GTK_LIST_STORE(model), &iter);
+        gtk_list_store_set (GTK_LIST_STORE(model), &iter, 0,
+                            GNC_COMMODITY_NS_NONCURRENCY, -1);
+    }
     /* add them to the combobox */
     namespaces = g_list_sort(namespaces, collate);
     for (node = namespaces; node; node = node->next)
diff --git a/src/gnome-utils/dialog-commodity.h b/src/gnome-utils/dialog-commodity.h
index a1d4c00..cca8532 100644
--- a/src/gnome-utils/dialog-commodity.h
+++ b/src/gnome-utils/dialog-commodity.h
@@ -49,6 +49,10 @@ typedef enum
 			       of a currency. */
     DIAG_COMM_NON_CURRENCY, /**< Dialog box should allow selection of
 			       anything but a currency. */
+    DIAG_COMM_NON_CURRENCY_SELECT, /**< Dialog box should allow selection of
+                                    * anything but a currency and should include
+                                    * the "ALL" namespace to display all such
+                                    * commodities in a single list. */
     DIAG_COMM_ALL,	  /**< Dialog box should allow selection of
 			       anything. */
 } dialog_commodity_mode;



Summary of changes:
 doc/tip_of_the_day.list.in          |  2 +-
 src/app-utils/gnc-euro.c            |  1 +
 src/engine/commodity-table.scm      |  4 +++-
 src/engine/gnc-commodity.c          | 23 ++++++++++++++++++++++-
 src/engine/gnc-commodity.h          |  3 ++-
 src/gnome-utils/dialog-account.c    |  2 +-
 src/gnome-utils/dialog-commodity.c  | 10 +++++++++-
 src/gnome-utils/dialog-commodity.h  |  4 ++++
 src/gnome-utils/gnc-currency-edit.c |  1 +
 9 files changed, 44 insertions(+), 6 deletions(-)



More information about the gnucash-changes mailing list