~ubuntu-branches/ubuntu/oneiric/gpe-expenses/oneiric

« back to all changes in this revision

Viewing changes to src/qof-expenses.c

  • Committer: Bazaar Package Importer
  • Author(s): Neil Williams
  • Date: 2007-12-07 00:08:39 UTC
  • mfrom: (1.1.3 upstream)
  • Revision ID: james.westby@ubuntu.com-20071207000839-sh6utdxr23ymhd8d
Tags: 0.1.4-1
* New upstream release
* use machine operable debian/copyright, migrate to standards 3.7.3

Show diffs side-by-side

added added

removed removed

Lines of Context:
26
26
#include <glib/gprintf.h>
27
27
#include <qof.h>
28
28
#include <locale.h>
29
 
#include "qof-main.h"
30
29
#include "qof-expenses.h"
31
30
#define _(String) dgettext (LIBRARY_GETTEXT_PACKAGE, String)
32
31
 
36
35
FROM_STRING_FUNC(ExpenseDistance, DISTANCE_LIST)
37
36
AS_STRING_FUNC  (ExpensePayment, PAYMENT_TYPE_LIST)
38
37
FROM_STRING_FUNC(ExpensePayment, PAYMENT_TYPE_LIST)
39
 
/** \todo leave the macro for types to allow translation
40
 
 map the gcc -E output as final code.
41
 
 */
 
38
/* leave the macro in place to support types.
 
39
 allow translation by mapping the gcc -E output.
 
40
*/
42
41
AS_STRING_FUNC  (ExpenseType, EXPENSE_TYPE_LIST)
43
42
FROM_STRING_FUNC(ExpenseType, EXPENSE_TYPE_LIST)
44
43
 
 
44
/** \brief Copy of qof-main function
 
45
 
 
46
Copied into qof-expenses library to prevent a spurious
 
47
dependency.
 
48
*/
 
49
static gchar *
 
50
qof_main_make_utf8 (gchar * string)
 
51
{
 
52
        gchar *value;
 
53
 
 
54
        if (!string)
 
55
                return NULL;
 
56
        if (g_utf8_validate (string, -1, NULL))
 
57
                return string;
 
58
        value = g_locale_to_utf8 (string, -1, NULL, NULL, NULL);
 
59
        if (!value)
 
60
        {
 
61
                PWARN (" unable to convert from locale %s", string);
 
62
                PINFO ("trying to convert from ISO-8859-15.");
 
63
                value = g_convert (string, -1, "UTF-8", "ISO-8859-15",
 
64
                        NULL, NULL, NULL);
 
65
                if (!value)
 
66
                {
 
67
                        PERR (" conversion failed");
 
68
                        return string;
 
69
                }
 
70
                return value;
 
71
        }
 
72
        return value;
 
73
}
 
74
 
45
75
/** \brief Currency Table data
46
76
        
47
77
Table relating the currencies[5] to the actual currency names, mnemonics
428
458
}
429
459
 
430
460
GpeCurrency*
431
 
gpe_currency_lookup_name (QofInstance G_GNUC_UNUSED * inst, gchar * mnemonic)
 
461
gpe_currency_lookup_name (QofInstance * inst, gchar * mnemonic)
432
462
{
433
463
        GpeCurrency *currency;
434
464
 
436
466
        if(!gpe_currency_table) populate_currencies();
437
467
        currency = (GpeCurrency*) g_hash_table_find 
438
468
                (gpe_currency_table, check_name, mnemonic);
 
469
        gpe_currency_lookup(inst, currency->pq_code);
439
470
        return currency;
440
471
}
441
472