Пример #1
0
static void
do_find_cb (QofQuery *query, gpointer user_data, gpointer *result)
{
    struct _ftd_data *ftd = user_data;
    GNCLedgerDisplay *ledger;
    gboolean new_ledger = FALSE;
    GncPluginPage *page;

    ledger = gnc_ledger_display_find_by_query (ftd->ledger_q);
    if (!ledger)
    {
        new_ledger = TRUE;
        ledger = gnc_ledger_display_query (query, SEARCH_LEDGER,
                                           REG_STYLE_JOURNAL);
    }
    else
        gnc_ledger_display_set_query (ledger, query);

    gnc_ledger_display_refresh (ledger);

    if (new_ledger)
    {
        page = gnc_plugin_page_register_new_ledger (ledger);
        gnc_main_window_open_page (NULL, page);
    }

    qof_query_destroy (ftd->q);

    gnc_search_dialog_destroy (ftd->sw);
}
static void
_show_created_transactions(GncSxSinceLastRunDialog *app_dialog, GList *created_txn_guids)
{
    GNCLedgerDisplay *ledger;
    GncPluginPage *page;
    Query *book_query, *guid_query, *query;
    GList *guid_iter;

    book_query = qof_query_create_for(GNC_ID_SPLIT);
    guid_query = qof_query_create_for(GNC_ID_SPLIT);
    qof_query_set_book(book_query, gnc_get_current_book());
    for (guid_iter = created_txn_guids; guid_iter != NULL; guid_iter = guid_iter->next)
    {
        xaccQueryAddGUIDMatch(guid_query, (GncGUID*)guid_iter->data, GNC_ID_TRANS, QOF_QUERY_OR);
    }
    query = qof_query_merge(book_query, guid_query, QOF_QUERY_AND);

    // inspired by dialog-find-transactions:do_find_cb:
    ledger = gnc_ledger_display_query(query, SEARCH_LEDGER, REG_STYLE_JOURNAL);
    gnc_ledger_display_refresh(ledger);
    page = gnc_plugin_page_register_new_ledger(ledger);
    g_object_set(G_OBJECT(page), "page-name", _("Created Transactions"), NULL);
    gnc_main_window_open_page(NULL, page);

    qof_query_destroy(query);
    qof_query_destroy(book_query);
    qof_query_destroy(guid_query);
}
Пример #3
0
void
gnc_ledger_display_refresh_by_split_register (SplitRegister *reg)
{
    GNCLedgerDisplay *ld;

    if (!reg)
        return;

    ld = gnc_find_first_gui_component (REGISTER_SINGLE_CM_CLASS,
                                       find_by_reg, reg);
    if (ld)
    {
        gnc_ledger_display_refresh (ld);
        return;
    }

    ld = gnc_find_first_gui_component (REGISTER_SUBACCOUNT_CM_CLASS,
                                       find_by_reg, reg);
    if (ld)
    {
        gnc_ledger_display_refresh (ld);
        return;
    }

    ld = gnc_find_first_gui_component (REGISTER_GL_CM_CLASS,
                                       find_by_reg, reg);
    if (ld)
    {
        gnc_ledger_display_refresh (ld);
        return;
    }

    ld = gnc_find_first_gui_component (REGISTER_TEMPLATE_CM_CLASS,
                                       find_by_reg, reg );
    if (ld)
    {
        gnc_ledger_display_refresh (ld);
    }
}