Esempio n. 1
0
static /*@ dependent @*//*@ null @*/ gpointer
get_quote_source_name( gpointer pObject )
{
    const gnc_commodity* pCommodity;

    g_return_val_if_fail( pObject != NULL, NULL );
    g_return_val_if_fail( GNC_IS_COMMODITY(pObject), NULL );

    pCommodity = GNC_COMMODITY(pObject);
    return (gpointer)gnc_quote_source_get_internal_name(
               gnc_commodity_get_quote_source(pCommodity));
}
Esempio n. 2
0
static void
set_quote_source_name( gpointer pObject, gpointer pValue )
{
    gnc_commodity* pCommodity;
    const gchar* quote_source_name = (const gchar*)pValue;
    gnc_quote_source* quote_source;

    g_return_if_fail( pObject != NULL );
    g_return_if_fail( GNC_IS_COMMODITY(pObject) );

    if ( pValue == NULL ) return;

    pCommodity = GNC_COMMODITY(pObject);
    quote_source = gnc_quote_source_lookup_by_internal( quote_source_name );
    gnc_commodity_set_quote_source( pCommodity, quote_source );
}
Esempio n. 3
0
/** Does this object refer to a specific object */
static gboolean
impl_refers_to_object(const QofInstance* inst, const QofInstance* ref)
{
    GncEmployee* emp;

    g_return_val_if_fail(inst != NULL, FALSE);
    g_return_val_if_fail(GNC_IS_EMPLOYEE(inst), FALSE);

    emp = GNC_EMPLOYEE(inst);

    if (GNC_IS_COMMODITY(ref))
    {
        return (emp->currency == GNC_COMMODITY(ref));
    }
    else if (GNC_IS_ACCOUNT(ref))
    {
        return (emp->ccard_acc == GNC_ACCOUNT(ref));
    }

    return FALSE;
}