Bug 781634 - Alert on missing account currency when opening account

This commit is contained in:
Geert Janssens 2017-05-03 16:38:48 +02:00
parent 582edc1b31
commit c5ef629fdc
6 changed files with 13 additions and 14 deletions

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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