Esempio n. 1
0
void gnc_dialog_query_list_refresh (DialogQueryList *dql)
{
    if (!dql) return;

    gnc_query_list_refresh (GNC_QUERY_LIST(dql->qlist));
    gtk_widget_show_all (dql->dialog);
}
Esempio n. 2
0
static void
gnc_query_list_refresh_handler (GHashTable *changes, gpointer user_data)
{
    GNCQueryList *list = (GNCQueryList *)user_data;
    g_return_if_fail (list);
    g_return_if_fail (IS_GNC_QUERY_LIST(list));

    gnc_query_list_refresh (list);
}
Esempio n. 3
0
/********************************************************************\
 * gnc_query_list_set_query_sort                                    *
 *   sets the sorting order of entries in the list                  *
 *                                                                  *
 * Args: list       - list to change the sort order for             *
 *	 new_column - is this a new column (so should we set the    *
 *                    query sort order or just set the 'increasing' *
 * Returns: nothing                                                 *
\********************************************************************/
static void
gnc_query_list_set_query_sort (GNCQueryList *list, gboolean new_column)
{
    gboolean sort_order = list->increasing;
    GList *node;
    GNCSearchParam *param;

    /* Find the column parameter definition */
    node = g_list_nth(list->column_params, list->sort_column);
    param = node->data;

    /* If we're asked to invert numerics, and if this is a numeric or
     * debred column, then invert the sort order.
     */
    if (list->numeric_inv_sort)
    {
        const char *type = gnc_search_param_get_param_type (param);
        if (!safe_strcmp(type, QOF_TYPE_NUMERIC) ||
                !safe_strcmp(type, QOF_TYPE_DEBCRED))
            sort_order = !sort_order;
    }

    /* Set the sort order for the engine, if the key changed */
    if (new_column)
    {
        GSList *p1, *p2;

        p1 = gnc_search_param_get_param_path(param);
        p2 = g_slist_prepend(NULL, QUERY_DEFAULT_SORT);
        qof_query_set_sort_order (list->query, p1, p2, NULL);
    }

    qof_query_set_sort_increasing (list->query,
                                   sort_order,
                                   sort_order,
                                   sort_order);

    /*
     * Recompute the list. Is this really necessary? Why not just sort
     * the rows already in the clist?  Answer: it would be an n-squared
     * algorithm to get the clist to match the resulting list.
     */
    gnc_query_list_refresh(list);
}