Ejemplo n.º 1
0
const char *
gnc_table_get_entry (Table *table, VirtualLocation virt_loc)
{
    TableGetEntryHandler entry_handler;
    const char *entry;
    BasicCell *cell;

    cell = gnc_table_get_cell (table, virt_loc);
    if (!cell || !cell->cell_name)
        return "";

    if (virt_cell_loc_equal (table->current_cursor_loc.vcell_loc,
                             virt_loc.vcell_loc))
    {
        CellIOFlags io_flags;

        io_flags = gnc_table_get_io_flags (table, virt_loc);

        if (io_flags & XACC_CELL_ALLOW_INPUT)
            return cell->value;
    }

    entry_handler = gnc_table_model_get_entry_handler (table->model,
                    cell->cell_name);
    if (!entry_handler) return "";

    entry = entry_handler (virt_loc, TRUE, NULL,
                           table->model->handler_user_data);
    if (!entry)
        entry = "";

    return entry;
}
Ejemplo n.º 2
0
const gchar *
gnc_table_get_cell_type_name (Table *table, VirtualLocation virt_loc)
{
    BasicCell *cell;

    cell = gnc_table_get_cell (table, virt_loc);
    if (cell == NULL)
        return NULL;

    return cell->cell_type_name;
}
Ejemplo n.º 3
0
gboolean
gnc_table_is_popup (Table *table, VirtualLocation virt_loc)
{
    BasicCell *cell;

    cell = gnc_table_get_cell (table, virt_loc);
    if (!cell)
        return FALSE;

    return cell->is_popup;
}
Ejemplo n.º 4
0
CellAlignment
gnc_table_get_align (Table *table, VirtualLocation virt_loc)
{
    BasicCell *cell;

    cell = gnc_table_get_cell (table, virt_loc);
    if (!cell)
        return CELL_ALIGN_RIGHT;

    return cell->alignment;
}
Ejemplo n.º 5
0
char *
gnc_table_get_tooltip (Table *table, VirtualLocation virt_loc)
{
    TableGetTooltipHandler tooltip_handler;
    BasicCell *cell;

    cell = gnc_table_get_cell (table, virt_loc);
    if (!cell || !cell->cell_name)
        return NULL;

    tooltip_handler = gnc_table_model_get_tooltip_handler (table->model,
                         cell->cell_name);

    if (!tooltip_handler)
        return NULL;

    return  tooltip_handler (virt_loc, table->model->handler_user_data);
}
Ejemplo n.º 6
0
static char * get_date_help (VirtualLocation virt_loc, gpointer user_data)
{
    GncEntryLedger *ledger = user_data;
    BasicCell *cell;
    char string[1024];
    struct tm tm;
    Timespec ts;
    time64 tt;

    cell = gnc_table_get_cell (ledger->table, virt_loc);
    if (!cell)
        return NULL;

    if (!cell->value || *cell->value == '\0')
        return NULL;

    gnc_date_cell_get_date ((DateCell *) cell, &ts);
    tt = ts.tv_sec;
    gnc_localtime_r (&tt, &tm);
    qof_strftime (string, sizeof(string), "%A %d %B %Y", &tm);

    return g_strdup (string);
}