gnucash maint: Multiple changes pushed

Geert Janssens gjanssens at code.gnucash.org
Wed May 3 12:08:43 EDT 2017


Updated	 via  https://github.com/Gnucash/gnucash/commit/9087418f (commit)
	 via  https://github.com/Gnucash/gnucash/commit/c5ef629f (commit)
	from  https://github.com/Gnucash/gnucash/commit/582edc1b (commit)



commit 9087418f817fc2e5066e3523315e65a2fe172429
Author: Geert Janssens <geert at kobaltwit.be>
Date:   Wed May 3 16:39:26 2017 +0200

    Drop ifdeffed out code block

diff --git a/src/gnome-utils/dialog-commodity.c b/src/gnome-utils/dialog-commodity.c
index 56a4513..6e041e9 100644
--- a/src/gnome-utils/dialog-commodity.c
+++ b/src/gnome-utils/dialog-commodity.c
@@ -502,85 +502,6 @@ gnc_ui_update_commodity_picker (GtkWidget *cbwe,
 
 
 /********************************************************************
- * gnc_ui_select_commodity_destroy
- ********************************************************************/
-#if 0
-void
-gnc_ui_select_commodity_destroy(SelectCommodityWindow * w)
-{
-    g_return_if_fail (w != NULL);
-
-    gtk_widget_destroy (GTK_WIDGET (w->dialog));
-}
-
-
-/********************************************************************
- * gnc_ui_select_commodity_response_cb
- ********************************************************************/
-static void
-gnc_ui_select_commodity_response_cb (GtkDialog * dialog, gint response, gpointer data)
-{
-    SelectCommodityWindow * w = data;
-    gchar *namespace;
-    const gchar *fullname;
-    gnc_commodity *commodity = NULL;
-
-    switch (response)
-    {
-    case GTK_RESPONSE_OK:
-        namespace = gnc_ui_namespace_picker_ns (w->namespace_combo);
-        fullname = gtk_entry_get_text (GTK_ENTRY (w->commodity_entry));
-
-        commodity = gnc_commodity_table_find_full (gnc_get_current_commodities (),
-                    namespace, fullname);
-        g_free(namespace);
-
-        if (commodity != NULL)
-        {
-            if (w->callback != NULL)
-                (w->callback) (commodity, w->callback_data);
-            gnc_ui_select_commodity_destroy (w);
-        }
-        else
-        {
-            gnc_warning_dialog (dialog,
-                                _("You must select a commodity. "
-                                  "To create a new one, click \"New\""));
-        }
-        break;
-    case GNC_RESPONSE_NEW:
-        namespace = gnc_ui_namespace_picker_ns (w->namespace_combo);
-
-        commodity = gnc_ui_new_commodity_modal_full (namespace,
-                    w->dialog,
-                    w->default_cusip,
-                    w->default_fullname,
-                    w->default_mnemonic,
-                    w->default_fraction);
-        if (commodity != NULL)
-        {
-            namespace =
-                        gnc_ui_update_namespace_picker (w->namespace_combo,
-                                                        gnc_commodity_get_namespace
-                                                        (commodity), TRUE, FALSE);
-            gnc_ui_update_commodity_picker (w->commodity_combo,
-                                            gnc_commodity_get_namespace (commodity),
-                                            gnc_commodity_get_printname (commodity));
-        }
-        g_free(namespace);
-        break;
-    default:
-        if (w->callback != NULL)
-            (w->callback) (NULL, w->callback_data);
-
-        gnc_ui_select_commodity_destroy (w);
-        break;
-    }
-}
-#endif
-
-
-/********************************************************************
  *
  * Commodity Selector dialog routines are above this line.
  *

commit c5ef629fdcf09861182084a466cd2c7d44e4d8dd
Author: Geert Janssens <geert at kobaltwit.be>
Date:   Wed May 3 16:38:48 2017 +0200

    Bug 781634 - Alert on missing account currency when opening account

diff --git a/src/backend/dbi/test/test-backend-dbi-basic.c b/src/backend/dbi/test/test-backend-dbi-basic.c
index 97ced78..386a2c3 100644
--- a/src/backend/dbi/test/test-backend-dbi-basic.c
+++ b/src/backend/dbi/test/test-backend-dbi-basic.c
@@ -24,12 +24,12 @@
  *                                                                  *
 \********************************************************************/
 
-#define _(X) X
 #include "config.h"
 
 #include <sys/types.h>
 #include <unistd.h>
 #include <glib/gstdio.h>
+#include <glib/gi18n.h>
 
 #include <qof.h>
 #include <unittest-support.h>
diff --git a/src/engine/commodity-table.scm b/src/engine/commodity-table.scm
index b5d0c0d..6a63d63 100644
--- a/src/engine/commodity-table.scm
+++ b/src/engine/commodity-table.scm
@@ -24,9 +24,7 @@
 ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
 
 
-(define GNC_COMMODITY_NS_CURRENCY
-;; Translators: Namespaces of commodities
-   (gettext "CURRENCY"))
+(define GNC_COMMODITY_NS_CURRENCY "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 faa335b..d2624b6 100644
--- a/src/engine/gnc-commodity.h
+++ b/src/engine/gnc-commodity.h
@@ -50,6 +50,7 @@ typedef struct _GncCommodityClass gnc_commodityClass;
 typedef struct _GncCommodityNamespaceClass gnc_commodity_namespaceClass;
 
 #include <glib.h>
+#include <glib/gi18n.h>
 #include "gnc-engine.h"
 
 /* --- type macros --- */
@@ -97,7 +98,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 N_("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/dialog-commodity.c b/src/gnome-utils/dialog-commodity.c
index cc67f7c..56a4513 100644
--- a/src/gnome-utils/dialog-commodity.c
+++ b/src/gnome-utils/dialog-commodity.c
@@ -701,7 +701,7 @@ gnc_ui_update_namespace_picker (GtkWidget *cbwe,
         if (g_utf8_collate(node->data, "template" ) != 0)
         {
             gtk_list_store_append(GTK_LIST_STORE(model), &iter);
-            gtk_list_store_set (GTK_LIST_STORE(model), &iter, 0, node->data, -1);
+            gtk_list_store_set (GTK_LIST_STORE(model), &iter, 0, _(node->data), -1);
         }
 
         if (init_string && (g_utf8_collate(node->data, init_string) == 0))
@@ -732,6 +732,11 @@ gnc_ui_namespace_picker_ns (GtkWidget *cbwe)
         /* In case the user types in ISO4217, map it to CURRENCY. */
         return g_strdup(GNC_COMMODITY_NS_CURRENCY);
     }
+    else if (g_strcmp0 (name_space, _(GNC_COMMODITY_NS_CURRENCY)) == 0)
+    {
+        /* In case the user entered a translation of CURRENCY, return it untranslated. */
+        return g_strdup(GNC_COMMODITY_NS_CURRENCY);
+    }
     else
         return g_strdup(name_space);
 }
diff --git a/src/gnome-utils/dialog-commodity.h b/src/gnome-utils/dialog-commodity.h
index cca8532..b200834 100644
--- a/src/gnome-utils/dialog-commodity.h
+++ b/src/gnome-utils/dialog-commodity.h
@@ -225,12 +225,8 @@ gnc_ui_edit_commodity_modal(gnc_commodity *commodity,
  *  @param sel The namespace that should be initially selected when
  *  the combo box appears.
  *
- *  @param mode Determines which namespaces the user may select a
+ *  @param mode Determines in which namespaces the user may select a
  *  commodity
- *
- *  @return The currently selected namespace.
- *
- *  @note The returned string must be freed by the caller.
  */
 void gnc_ui_update_namespace_picker(GtkWidget *cbwe,
                                     const gchar *sel,
@@ -242,8 +238,7 @@ void gnc_ui_update_namespace_picker(GtkWidget *cbwe,
  *
  *  @return The currently selected namespace.
  *
- *  @note This string is owned by the engine and must not be freed by
- *  the caller.
+ *  @note This string must be freed by with g_free.
  */
 gchar *gnc_ui_namespace_picker_ns (GtkWidget *cbwe);
 
diff --git a/src/import-export/qif-imp/assistant-qif-import.c b/src/import-export/qif-imp/assistant-qif-import.c
index 941d746..b4d66b9 100644
--- a/src/import-export/qif-imp/assistant-qif-import.c
+++ b/src/import-export/qif-imp/assistant-qif-import.c
@@ -2637,7 +2637,7 @@ gnc_ui_qif_import_commodity_new_prepare (GtkAssistant *assistant,
     g_return_if_fail (qpage != NULL);
 
     /* Get any entered namespace. */
-    ns = gtk_entry_get_text( GTK_ENTRY( gtk_bin_get_child( GTK_BIN( GTK_COMBO_BOX(qpage->namespace_combo)))));
+    ns = gnc_ui_namespace_picker_ns (qpage->namespace_combo);
 
     /* Update the namespaces available to select. */
     if (!ns || !ns[0])



Summary of changes:
 src/backend/dbi/test/test-backend-dbi-basic.c    |  2 +-
 src/engine/commodity-table.scm                   |  4 +-
 src/engine/gnc-commodity.h                       |  3 +-
 src/gnome-utils/dialog-commodity.c               | 86 ++----------------------
 src/gnome-utils/dialog-commodity.h               |  9 +--
 src/import-export/qif-imp/assistant-qif-import.c |  2 +-
 6 files changed, 13 insertions(+), 93 deletions(-)



More information about the gnucash-changes mailing list