mirror of
https://github.com/Gnucash/gnucash.git
synced 2025-02-25 18:55:30 -06:00
Change the Search Dialog to use a CList and allow each object to
provide its own column list for displaying search results. Change the interface to require the list of columns. Modify all the business dialogs to use the new search interface. Add a new interface to the QueryCore to convert any Core object into a string (or have it return NULL) git-svn-id: svn+ssh://svn.gnucash.org/repo/gnucash/trunk@6862 57a11ea4-9604-0410-9ed3-97b8803252fd
This commit is contained in:
parent
3359c6ff22
commit
8b34e2bc96
10
ChangeLog
10
ChangeLog
@ -1,3 +1,13 @@
|
||||
2002-05-13 Derek Atkins <derek@ihtfp.com>
|
||||
|
||||
Change the Search Dialog to use a CList and allow each object to
|
||||
provide its own column list for displaying search results. Change
|
||||
the interface to require the list of columns. Modify all the
|
||||
business dialogs to use the new search interface.
|
||||
|
||||
Add a new interface to the QueryCore to convert any Core object
|
||||
into a string (or have it return NULL)
|
||||
|
||||
2002-05-09 Derek Atkins <derek@ihtfp.com>
|
||||
|
||||
Change the Date-Close dialog to use gnc-date-edit instead of the
|
||||
|
@ -395,6 +395,7 @@ gboolean gncOrderRegister (void)
|
||||
{
|
||||
static QueryObjectDef params[] = {
|
||||
{ ORDER_ID, QUERYCORE_STRING, (QueryAccess)gncOrderGetID },
|
||||
{ ORDER_REFERENCE, QUERYCORE_STRING, (QueryAccess)gncOrderGetReference },
|
||||
{ ORDER_OWNER, GNC_OWNER_MODULE_NAME, (QueryAccess)gncOrderGetOwner },
|
||||
{ ORDER_OPENED, QUERYCORE_DATE, (QueryAccess)gncOrderGetDateOpened },
|
||||
{ ORDER_IS_CLOSED, QUERYCORE_BOOLEAN, (QueryAccess)gncOrderIsClosed },
|
||||
|
@ -58,6 +58,7 @@ int gncOrderCompare (GncOrder *a, GncOrder *b);
|
||||
gboolean gncOrderIsClosed (GncOrder *order);
|
||||
|
||||
#define ORDER_ID "id"
|
||||
#define ORDER_REFERENCE "reference"
|
||||
#define ORDER_OWNER "owner"
|
||||
#define ORDER_OPENED "date_opened"
|
||||
#define ORDER_CLOSED "date_closed"
|
||||
|
@ -99,16 +99,16 @@
|
||||
(gnc:get-current-book)))))
|
||||
|
||||
(define new-invoice-item
|
||||
(gnc:make-menu-item (N_ "New Invoice")
|
||||
(N_ "New Invoice")
|
||||
(gnc:make-menu-item (N_ "New Bill")
|
||||
(N_ "New Bill")
|
||||
(list "Extensions" "Vendors" "")
|
||||
(lambda ()
|
||||
(gnc:invoice-new last-vendor
|
||||
(gnc:get-current-book)))))
|
||||
|
||||
(define find-invoice-item
|
||||
(gnc:make-menu-item (N_ "Find Invoice")
|
||||
(N_ "Find Invoice")
|
||||
(gnc:make-menu-item (N_ "Find Bill")
|
||||
(N_ "Find Bill")
|
||||
(list "Extensions" "Vendors" "")
|
||||
(lambda ()
|
||||
(gnc:invoice-search #f last-vendor
|
||||
|
@ -716,6 +716,7 @@ gnc_customer_search (GncCustomer *start, GNCBook *book)
|
||||
GNCIdType type = GNC_CUSTOMER_MODULE_NAME;
|
||||
struct _customer_select_window *sw;
|
||||
static GList *params = NULL;
|
||||
static GList *columns = NULL;
|
||||
static GNCSearchCallbackButton buttons[] = {
|
||||
{ N_("View/Edit Customer"), edit_customer_cb},
|
||||
{ N_("Customer Jobs"), jobs_customer_cb},
|
||||
@ -738,6 +739,16 @@ gnc_customer_search (GncCustomer *start, GNCBook *book)
|
||||
CUSTOMER_NAME, NULL);
|
||||
}
|
||||
|
||||
/* Build the column list in reverse order */
|
||||
if (columns == NULL) {
|
||||
columns = gnc_search_param_prepend (columns, _("Contact"), NULL, type,
|
||||
CUSTOMER_ADDR, ADDRESS_NAME, NULL);
|
||||
columns = gnc_search_param_prepend (columns, _("Company"), NULL, type,
|
||||
CUSTOMER_NAME, NULL);
|
||||
columns = gnc_search_param_prepend (columns, _("ID #"), NULL, type,
|
||||
CUSTOMER_ID, NULL);
|
||||
}
|
||||
|
||||
/* Build the queries */
|
||||
q = gncQueryCreate ();
|
||||
gncQuerySetBook (q, book);
|
||||
@ -754,7 +765,7 @@ gnc_customer_search (GncCustomer *start, GNCBook *book)
|
||||
sw->book = book;
|
||||
sw->q = q;
|
||||
|
||||
return gnc_search_dialog_create (type, params,
|
||||
return gnc_search_dialog_create (type, params, columns,
|
||||
q, q2, buttons, NULL,
|
||||
new_customer_cb, sw, free_userdata_cb);
|
||||
}
|
||||
|
@ -574,6 +574,7 @@ gnc_employee_search (GncEmployee *start, GNCBook *book)
|
||||
struct _employee_select_window *sw;
|
||||
QueryNew *q, *q2 = NULL;
|
||||
static GList *params = NULL;
|
||||
static GList *columns = NULL;
|
||||
static GNCSearchCallbackButton buttons[] = {
|
||||
{ N_("View/Edit Employee"), edit_employee_cb},
|
||||
{ NULL },
|
||||
@ -591,6 +592,16 @@ gnc_employee_search (GncEmployee *start, GNCBook *book)
|
||||
type, EMPLOYEE_USERNAME, NULL);
|
||||
}
|
||||
|
||||
/* Build the column list in reverse order */
|
||||
if (columns == NULL) {
|
||||
columns = gnc_search_param_prepend (columns, _("Name"), NULL, type,
|
||||
EMPLOYEE_ADDR, ADDRESS_NAME, NULL);
|
||||
columns = gnc_search_param_prepend (columns, _("Username"), NULL, type,
|
||||
EMPLOYEE_USERNAME, NULL);
|
||||
columns = gnc_search_param_prepend (columns, _("ID #"), NULL, type,
|
||||
EMPLOYEE_ID, NULL);
|
||||
}
|
||||
|
||||
/* Build the queries */
|
||||
q = gncQueryCreate ();
|
||||
gncQuerySetBook (q, book);
|
||||
@ -606,7 +617,7 @@ gnc_employee_search (GncEmployee *start, GNCBook *book)
|
||||
sw->book = book;
|
||||
sw->q = q;
|
||||
|
||||
return gnc_search_dialog_create (type, params, q, q2,
|
||||
return gnc_search_dialog_create (type, params, columns, q, q2,
|
||||
buttons, NULL, new_employee_cb,
|
||||
sw, free_employee_cb);
|
||||
}
|
||||
|
@ -1245,6 +1245,7 @@ gnc_invoice_search (GncInvoice *start, GncOwner *owner, GNCBook *book)
|
||||
struct _invoice_select_window *sw;
|
||||
QueryNew *q, *q2 = NULL;
|
||||
static GList *params = NULL;
|
||||
static GList *columns = NULL;
|
||||
static GNCSearchCallbackButton buttons[] = {
|
||||
{ N_("View/Edit Invoice"), edit_invoice_cb},
|
||||
{ NULL },
|
||||
@ -1252,7 +1253,7 @@ gnc_invoice_search (GncInvoice *start, GncOwner *owner, GNCBook *book)
|
||||
|
||||
g_return_val_if_fail (book, NULL);
|
||||
|
||||
/* Build parameter list in reverse invoice*/
|
||||
/* Build parameter list in reverse order */
|
||||
if (params == NULL) {
|
||||
params = gnc_search_param_prepend (params, _("Invoice Notes"), NULL, type,
|
||||
INVOICE_NOTES, NULL);
|
||||
@ -1264,12 +1265,28 @@ gnc_invoice_search (GncInvoice *start, GncOwner *owner, GNCBook *book)
|
||||
INVOICE_IS_POSTED, NULL);
|
||||
params = gnc_search_param_prepend (params, _("Date Opened"), NULL, type,
|
||||
INVOICE_OPENED, NULL);
|
||||
params = gnc_search_param_prepend (params, _("Owner Name "), NULL, type,
|
||||
INVOICE_OWNER, OWNER_NAME, NULL);
|
||||
params = gnc_search_param_prepend (params, _("Company Name "), NULL, type,
|
||||
INVOICE_OWNER, OWNER_PARENT,
|
||||
OWNER_NAME, NULL);
|
||||
params = gnc_search_param_prepend (params, _("Invoice ID"), NULL, type,
|
||||
INVOICE_ID, NULL);
|
||||
}
|
||||
|
||||
/* Build the column list in reverse order */
|
||||
if (columns == NULL) {
|
||||
columns = gnc_search_param_prepend (columns, _("Billing ID"), NULL, type,
|
||||
INVOICE_BILLINGID, NULL);
|
||||
columns = gnc_search_param_prepend (columns, _("Company"), NULL, type,
|
||||
INVOICE_OWNER, OWNER_PARENT,
|
||||
OWNER_NAME, NULL);
|
||||
columns = gnc_search_param_prepend (columns, _("Posted"), NULL, type,
|
||||
INVOICE_POSTED, NULL);
|
||||
columns = gnc_search_param_prepend (columns, _("Opened"), NULL, type,
|
||||
INVOICE_OPENED, NULL);
|
||||
columns = gnc_search_param_prepend (columns, _("Num"), NULL, type,
|
||||
INVOICE_ID, NULL);
|
||||
}
|
||||
|
||||
/* Build the queries */
|
||||
q = gncQueryCreate ();
|
||||
gncQuerySetBook (q, book);
|
||||
@ -1304,7 +1321,7 @@ gnc_invoice_search (GncInvoice *start, GncOwner *owner, GNCBook *book)
|
||||
sw->book = book;
|
||||
sw->q = q;
|
||||
|
||||
return gnc_search_dialog_create (type, params, q, q2,
|
||||
return gnc_search_dialog_create (type, params, columns, q, q2,
|
||||
buttons, NULL, new_invoice_cb,
|
||||
sw, free_invoice_cb);
|
||||
|
||||
|
@ -492,6 +492,7 @@ gnc_job_search (GncJob *start, GncOwner *owner, GNCBook *book)
|
||||
GNCIdType type = GNC_JOB_MODULE_NAME;
|
||||
struct _job_select_window *sw;
|
||||
static GList *params = NULL;
|
||||
static GList *columns = NULL;
|
||||
static GNCSearchCallbackButton buttons[] = {
|
||||
{ N_("View/Edit Job"), edit_job_cb},
|
||||
{ N_("View Invoices"), invoice_job_cb},
|
||||
@ -507,13 +508,25 @@ gnc_job_search (GncJob *start, GncOwner *owner, GNCBook *book)
|
||||
params = gnc_search_param_prepend (params, _("Only Active?"), NULL, type,
|
||||
JOB_ACTIVE, NULL);
|
||||
params = gnc_search_param_prepend (params, _("Billing ID"), NULL, type,
|
||||
JOB_ID, NULL);
|
||||
JOB_REFERENCE, NULL);
|
||||
params = gnc_search_param_prepend (params, _("Job Number"), NULL, type,
|
||||
JOB_ID, NULL);
|
||||
params = gnc_search_param_prepend (params, _("Job Name"), NULL, type,
|
||||
JOB_NAME, NULL);
|
||||
}
|
||||
|
||||
/* Build the column list in reverse order */
|
||||
if (columns == NULL) {
|
||||
columns = gnc_search_param_prepend (columns, _("Billing ID"), NULL, type,
|
||||
JOB_REFERENCE, NULL);
|
||||
columns = gnc_search_param_prepend (columns, _("Company"), NULL, type,
|
||||
JOB_OWNER, OWNER_NAME, NULL);
|
||||
columns = gnc_search_param_prepend (columns, _("Job Name"), NULL, type,
|
||||
JOB_NAME, NULL);
|
||||
columns = gnc_search_param_prepend (columns, _("ID #"), NULL, type,
|
||||
JOB_ID, NULL);
|
||||
}
|
||||
|
||||
/* Build the queries */
|
||||
q = gncQueryCreate ();
|
||||
gncQuerySetBook (q, book);
|
||||
@ -548,7 +561,7 @@ gnc_job_search (GncJob *start, GncOwner *owner, GNCBook *book)
|
||||
sw->book = book;
|
||||
sw->q = q;
|
||||
|
||||
return gnc_search_dialog_create (type, params,
|
||||
return gnc_search_dialog_create (type, params, columns,
|
||||
q, q2, buttons, NULL,
|
||||
new_job_cb, sw, free_userdata_cb);
|
||||
}
|
||||
|
@ -826,6 +826,7 @@ gnc_order_search (GncOrder *start, GncOwner *owner, GNCBook *book)
|
||||
struct _order_select_window *sw;
|
||||
QueryNew *q, *q2 = NULL;
|
||||
static GList *params = NULL;
|
||||
static GList *columns = NULL;
|
||||
static GNCSearchCallbackButton buttons[] = {
|
||||
{ N_("View/Edit Order"), edit_order_cb},
|
||||
{ NULL },
|
||||
@ -849,6 +850,21 @@ gnc_order_search (GncOrder *start, GncOwner *owner, GNCBook *book)
|
||||
ORDER_ID, NULL);
|
||||
}
|
||||
|
||||
/* Build the column list in reverse order */
|
||||
if (columns == NULL) {
|
||||
columns = gnc_search_param_prepend (columns, _("Billing ID"), NULL, type,
|
||||
ORDER_REFERENCE, NULL);
|
||||
columns = gnc_search_param_prepend (columns, _("Company"), NULL, type,
|
||||
ORDER_OWNER, OWNER_PARENT,
|
||||
OWNER_NAME, NULL);
|
||||
columns = gnc_search_param_prepend (columns, _("Closed"), NULL, type,
|
||||
ORDER_CLOSED, NULL);
|
||||
columns = gnc_search_param_prepend (columns, _("Opened"), NULL, type,
|
||||
ORDER_OPENED, NULL);
|
||||
columns = gnc_search_param_prepend (columns, _("Num"), NULL, type,
|
||||
ORDER_ID, NULL);
|
||||
}
|
||||
|
||||
/* Build the queries */
|
||||
q = gncQueryCreate ();
|
||||
gncQuerySetBook (q, book);
|
||||
@ -894,7 +910,7 @@ gnc_order_search (GncOrder *start, GncOwner *owner, GNCBook *book)
|
||||
sw->book = book;
|
||||
sw->q = q;
|
||||
|
||||
return gnc_search_dialog_create (type, params, q, q2,
|
||||
return gnc_search_dialog_create (type, params, columns, q, q2,
|
||||
buttons, NULL, new_order_cb,
|
||||
sw, free_order_cb);
|
||||
}
|
||||
|
@ -576,11 +576,12 @@ gnc_vendor_search (GncVendor *start, GNCBook *book)
|
||||
struct _vendor_select_window *sw;
|
||||
QueryNew *q, *q2 = NULL;
|
||||
static GList *params = NULL;
|
||||
static GList *columns = NULL;
|
||||
static GNCSearchCallbackButton buttons[] = {
|
||||
{ N_("View/Edit Vendor"), edit_vendor_cb},
|
||||
{ N_("Vendor Jobs"), jobs_vendor_cb},
|
||||
// { N_("Vendor Orders"), order_vendor_cb},
|
||||
{ N_("Vendor Invoices"), invoice_vendor_cb},
|
||||
{ N_("Vendor Bills"), invoice_vendor_cb},
|
||||
{ NULL },
|
||||
};
|
||||
|
||||
@ -596,6 +597,16 @@ gnc_vendor_search (GncVendor *start, GNCBook *book)
|
||||
VENDOR_NAME, NULL);
|
||||
}
|
||||
|
||||
/* Build the column list in reverse order */
|
||||
if (columns == NULL) {
|
||||
columns = gnc_search_param_prepend (columns, _("Contact"), NULL, type,
|
||||
VENDOR_ADDR, ADDRESS_NAME, NULL);
|
||||
columns = gnc_search_param_prepend (columns, _("Company"), NULL, type,
|
||||
VENDOR_NAME, NULL);
|
||||
columns = gnc_search_param_prepend (columns, _("ID #"), NULL, type,
|
||||
VENDOR_ID, NULL);
|
||||
}
|
||||
|
||||
/* Build the queries */
|
||||
q = gncQueryCreate ();
|
||||
gncQuerySetBook (q, book);
|
||||
@ -611,7 +622,7 @@ gnc_vendor_search (GncVendor *start, GNCBook *book)
|
||||
sw->book = book;
|
||||
sw->q = q;
|
||||
|
||||
return gnc_search_dialog_create (type, params, q, q2,
|
||||
return gnc_search_dialog_create (type, params, columns, q, q2,
|
||||
buttons, NULL,
|
||||
new_vendor_cb, sw, free_vendor_cb);
|
||||
}
|
||||
|
@ -95,6 +95,7 @@ static GHashTable *predTable = NULL;
|
||||
static GHashTable *cmpTable = NULL;
|
||||
static GHashTable *copyTable = NULL;
|
||||
static GHashTable *freeTable = NULL;
|
||||
static GHashTable *toStringTable = NULL;
|
||||
|
||||
#define COMPARE_ERROR -3
|
||||
#define PREDICATE_ERROR -2
|
||||
@ -232,6 +233,14 @@ QueryPredData_t gncQueryStringPredicate (query_compare_t how,
|
||||
return ((QueryPredData_t)pdata);
|
||||
}
|
||||
|
||||
static char * string_to_string (gpointer object, QueryAccess get)
|
||||
{
|
||||
const char *res = ((query_string_getter)get)(object);
|
||||
if (res)
|
||||
return g_strdup (res);
|
||||
return NULL;
|
||||
}
|
||||
|
||||
/* QUERYCORE_DATE */
|
||||
|
||||
static int date_compare (Timespec ta, Timespec tb, date_match_t options)
|
||||
@ -329,6 +338,16 @@ QueryPredData_t gncQueryDatePredicate (query_compare_t how,
|
||||
return ((QueryPredData_t)pdata);
|
||||
}
|
||||
|
||||
static char * date_to_string (gpointer object, QueryAccess get)
|
||||
{
|
||||
Timespec ts = ((query_date_getter)get)(object);
|
||||
|
||||
if (ts.tv_sec || ts.tv_nsec)
|
||||
return g_strdup (gnc_print_date (ts));
|
||||
|
||||
return NULL;
|
||||
}
|
||||
|
||||
/* QUERYCORE_NUMERIC */
|
||||
|
||||
static int numeric_match_predicate (gpointer object, QueryAccess get_fcn,
|
||||
@ -422,6 +441,20 @@ QueryPredData_t gncQueryNumericPredicate (query_compare_t how,
|
||||
return ((QueryPredData_t)pdata);
|
||||
}
|
||||
|
||||
static char * numeric_to_string (gpointer object, QueryAccess get)
|
||||
{
|
||||
gnc_numeric num = ((query_numeric_getter)get)(object);
|
||||
|
||||
return g_strdup (gnc_numeric_to_string (num));
|
||||
}
|
||||
|
||||
static char * debcred_to_string (gpointer object, QueryAccess get)
|
||||
{
|
||||
gnc_numeric num = ((query_numeric_getter)get)(object);
|
||||
|
||||
return g_strdup (gnc_numeric_to_string (num));
|
||||
}
|
||||
|
||||
/* QUERYCORE_GUID */
|
||||
|
||||
static int guid_match_predicate (gpointer object, QueryAccess get_fcn,
|
||||
@ -585,6 +618,13 @@ QueryPredData_t gncQueryInt64Predicate (query_compare_t how, gint64 val)
|
||||
return ((QueryPredData_t)pdata);
|
||||
}
|
||||
|
||||
static char * int64_to_string (gpointer object, QueryAccess get)
|
||||
{
|
||||
gint64 num = ((query_int64_getter)get)(object);
|
||||
|
||||
return g_strdup_printf ("%lld", num);
|
||||
}
|
||||
|
||||
/* QUERYCORE_DOUBLE */
|
||||
|
||||
static int double_match_predicate (gpointer object, QueryAccess get_fcn,
|
||||
@ -653,6 +693,12 @@ QueryPredData_t gncQueryDoublePredicate (query_compare_t how, double val)
|
||||
return ((QueryPredData_t)pdata);
|
||||
}
|
||||
|
||||
static char * double_to_string (gpointer object, QueryAccess get)
|
||||
{
|
||||
double num = ((query_double_getter)get)(object);
|
||||
|
||||
return g_strdup_printf ("%f", num);
|
||||
}
|
||||
|
||||
/* QUERYCORE_BOOLEAN */
|
||||
|
||||
@ -715,6 +761,13 @@ QueryPredData_t gncQueryBooleanPredicate (query_compare_t how, gboolean val)
|
||||
return ((QueryPredData_t)pdata);
|
||||
}
|
||||
|
||||
static char * boolean_to_string (gpointer object, QueryAccess get)
|
||||
{
|
||||
gboolean num = ((query_boolean_getter)get)(object);
|
||||
|
||||
return g_strdup_printf ("%s", (num ? "X" : ""));
|
||||
}
|
||||
|
||||
/* QUERYCORE_CHAR */
|
||||
|
||||
static int char_match_predicate (gpointer object, QueryAccess get_fcn,
|
||||
@ -776,6 +829,12 @@ QueryPredData_t gncQueryCharPredicate (char_match_t options, const char *chars)
|
||||
return ((QueryPredData_t)pdata);
|
||||
}
|
||||
|
||||
static char * char_to_string (gpointer object, QueryAccess get)
|
||||
{
|
||||
char num = ((query_char_getter)get)(object);
|
||||
|
||||
return g_strdup_printf ("%c", num);
|
||||
}
|
||||
|
||||
/* QUERYCORE_KVP */
|
||||
|
||||
@ -874,27 +933,28 @@ static void init_tables (void)
|
||||
QueryCompare comp;
|
||||
QueryPredicateCopy copy;
|
||||
QueryPredDataFree pd_free;
|
||||
QueryToString toString;
|
||||
} knownTypes[] = {
|
||||
{ QUERYCORE_STRING, string_match_predicate, string_compare_func,
|
||||
string_copy_predicate, string_free_pdata },
|
||||
string_copy_predicate, string_free_pdata, string_to_string },
|
||||
{ QUERYCORE_DATE, date_match_predicate, date_compare_func,
|
||||
date_copy_predicate, date_free_pdata },
|
||||
date_copy_predicate, date_free_pdata, date_to_string },
|
||||
{ QUERYCORE_DEBCRED, numeric_match_predicate, numeric_compare_func,
|
||||
numeric_copy_predicate, numeric_free_pdata },
|
||||
numeric_copy_predicate, numeric_free_pdata, debcred_to_string },
|
||||
{ QUERYCORE_NUMERIC, numeric_match_predicate, numeric_compare_func,
|
||||
numeric_copy_predicate, numeric_free_pdata },
|
||||
numeric_copy_predicate, numeric_free_pdata, numeric_to_string },
|
||||
{ QUERYCORE_GUID, guid_match_predicate, NULL,
|
||||
guid_copy_predicate, guid_free_pdata },
|
||||
guid_copy_predicate, guid_free_pdata, NULL },
|
||||
{ QUERYCORE_INT64, int64_match_predicate, int64_compare_func,
|
||||
int64_copy_predicate, int64_free_pdata },
|
||||
int64_copy_predicate, int64_free_pdata, int64_to_string },
|
||||
{ QUERYCORE_DOUBLE, double_match_predicate, double_compare_func,
|
||||
double_copy_predicate, double_free_pdata },
|
||||
double_copy_predicate, double_free_pdata, double_to_string },
|
||||
{ QUERYCORE_BOOLEAN, boolean_match_predicate, boolean_compare_func,
|
||||
boolean_copy_predicate, boolean_free_pdata },
|
||||
boolean_copy_predicate, boolean_free_pdata, boolean_to_string },
|
||||
{ QUERYCORE_CHAR, char_match_predicate, char_compare_func,
|
||||
char_copy_predicate, char_free_pdata },
|
||||
char_copy_predicate, char_free_pdata, char_to_string },
|
||||
{ QUERYCORE_KVP, kvp_match_predicate, NULL, kvp_copy_predicate,
|
||||
kvp_free_pdata },
|
||||
kvp_free_pdata, NULL },
|
||||
};
|
||||
|
||||
/* Register the known data types */
|
||||
@ -903,7 +963,8 @@ static void init_tables (void)
|
||||
knownTypes[i].pred,
|
||||
knownTypes[i].comp,
|
||||
knownTypes[i].copy,
|
||||
knownTypes[i].pd_free);
|
||||
knownTypes[i].pd_free,
|
||||
knownTypes[i].toString);
|
||||
}
|
||||
}
|
||||
|
||||
@ -914,7 +975,8 @@ void gncQueryRegisterCoreObject (char const *core_name,
|
||||
QueryPredicate pred,
|
||||
QueryCompare comp,
|
||||
QueryPredicateCopy copy,
|
||||
QueryPredDataFree pd_free)
|
||||
QueryPredDataFree pd_free,
|
||||
QueryToString toString)
|
||||
{
|
||||
g_return_if_fail (core_name);
|
||||
g_return_if_fail (*core_name != '\0');
|
||||
@ -930,6 +992,9 @@ void gncQueryRegisterCoreObject (char const *core_name,
|
||||
|
||||
if (pd_free)
|
||||
g_hash_table_insert (freeTable, (char *)core_name, pd_free);
|
||||
|
||||
if (toString)
|
||||
g_hash_table_insert (toStringTable, (char *)core_name, toString);
|
||||
}
|
||||
|
||||
void gncQueryCoreInit (void)
|
||||
@ -943,6 +1008,7 @@ void gncQueryCoreInit (void)
|
||||
cmpTable = g_hash_table_new (g_str_hash, g_str_equal);
|
||||
copyTable = g_hash_table_new (g_str_hash, g_str_equal);
|
||||
freeTable = g_hash_table_new (g_str_hash, g_str_equal);
|
||||
toStringTable = g_hash_table_new (g_str_hash, g_str_equal);
|
||||
|
||||
init_tables ();
|
||||
}
|
||||
@ -956,6 +1022,7 @@ void gncQueryCoreShutdown (void)
|
||||
g_hash_table_destroy (cmpTable);
|
||||
g_hash_table_destroy (copyTable);
|
||||
g_hash_table_destroy (freeTable);
|
||||
g_hash_table_destroy (toStringTable);
|
||||
}
|
||||
|
||||
QueryPredicate gncQueryCoreGetPredicate (char const *type)
|
||||
@ -1003,3 +1070,18 @@ QueryPredData_t gncQueryCorePredicateCopy (QueryPredData_t pdata)
|
||||
copy = gncQueryCoreGetCopy (pdata->type_name);
|
||||
return (copy (pdata));
|
||||
}
|
||||
|
||||
char * gncQueryCoreToString (char const *type, gpointer object,
|
||||
QueryAccess get)
|
||||
{
|
||||
QueryToString toString;
|
||||
|
||||
g_return_val_if_fail (type, NULL);
|
||||
g_return_val_if_fail (object, NULL);
|
||||
g_return_val_if_fail (get, NULL);
|
||||
|
||||
toString = g_hash_table_lookup (toStringTable, type);
|
||||
g_return_val_if_fail (toString, NULL);
|
||||
|
||||
return toString (object, get);
|
||||
}
|
||||
|
@ -45,22 +45,32 @@ typedef int (*QueryCompare) (gpointer a, gpointer b,
|
||||
gint compare_options,
|
||||
QueryAccess get_fcn);
|
||||
|
||||
/* A function to take the object, apply the get_fcn, and return
|
||||
* a printable string. Note that this QueryAccess function should
|
||||
* be returning a type equal to this core object type.
|
||||
*
|
||||
* Note that this string MUST be freed by the caller.
|
||||
*/
|
||||
typedef char * (*QueryToString) (gpointer object, QueryAccess get_fcn);
|
||||
|
||||
|
||||
/* This function registers a new Core Object with the QueryNew
|
||||
* subsystem. It maps the "core_name" object to the given
|
||||
* query_predicate and predicate_data_free functions.
|
||||
* query_predicate, predicate_copy, and predicate_data_free functions.
|
||||
*/
|
||||
void gncQueryRegisterCoreObject (char const *type_name,
|
||||
QueryPredicate pred,
|
||||
QueryCompare comp,
|
||||
QueryPredicateCopy copy,
|
||||
QueryPredDataFree pd_free);
|
||||
QueryPredDataFree pd_free,
|
||||
QueryToString to_string);
|
||||
|
||||
|
||||
/* An example:
|
||||
*
|
||||
* gncQueryRegisterCoreObject (QUERYCORE_STRING, string_match_predicate,
|
||||
* string_compare_fcn, string_free_pdata);
|
||||
* string_compare_fcn, string_free_pdata,
|
||||
* string_print_fcn);
|
||||
*/
|
||||
|
||||
|
||||
@ -72,6 +82,10 @@ QueryPredData_t gncQueryCorePredicateCopy (QueryPredData_t pdata);
|
||||
/* Destroy a type */
|
||||
void gncQueryCorePredicateFree (QueryPredData_t pdata);
|
||||
|
||||
/* Return a string for a core data object */
|
||||
char * gncQueryCoreToString (char const *type, gpointer object,
|
||||
QueryAccess fcn);
|
||||
|
||||
/* Core Data Type Predicates */
|
||||
QueryPredData_t gncQueryStringPredicate (query_compare_t how, char *str,
|
||||
string_match_t options,
|
||||
|
@ -17,6 +17,7 @@
|
||||
#include "gncObject.h"
|
||||
#include "QueryNew.h"
|
||||
#include "QueryObject.h"
|
||||
#include "QueryCore.h"
|
||||
|
||||
#include "dialog-search.h"
|
||||
#include "search-core-type.h"
|
||||
@ -71,6 +72,8 @@ struct _GNCSearchWindow {
|
||||
/* The list of criteria */
|
||||
GNCSearchParam * last_param;
|
||||
GList * params_list; /* List of GNCSearchParams */
|
||||
GList * display_list; /* List of GNCSearchParams for Display */
|
||||
gint num_cols; /* Number of Display Columns */
|
||||
GList * crit_list; /* list of crit_data */
|
||||
|
||||
gint component_id;
|
||||
@ -134,6 +137,96 @@ gnc_search_dialog_unselect_row_cb (GtkCList *clist, gint row, gint column,
|
||||
sw->selected_item = NULL;
|
||||
}
|
||||
|
||||
static void
|
||||
gnc_search_dialog_init_result_list (GNCSearchWindow *sw)
|
||||
{
|
||||
GList *col;
|
||||
gint i;
|
||||
char **titles;
|
||||
|
||||
/* How many columns? */
|
||||
sw->num_cols = g_list_length (sw->display_list);
|
||||
titles = g_new0 (char*, sw->num_cols);
|
||||
|
||||
for (i = 0, col = sw->display_list; col; col = col->next) {
|
||||
GNCSearchParam *param = col->data;
|
||||
titles[i] = (char *)param->title;
|
||||
i++;
|
||||
}
|
||||
|
||||
sw->result_list = gtk_clist_new_with_titles (sw->num_cols, titles);
|
||||
g_free (titles);
|
||||
gtk_clist_set_selection_mode (GTK_CLIST (sw->result_list),
|
||||
GTK_SELECTION_SINGLE);
|
||||
|
||||
/* Setup list properties */
|
||||
gtk_clist_set_shadow_type(GTK_CLIST(sw->result_list), GTK_SHADOW_IN);
|
||||
gtk_clist_column_titles_passive(GTK_CLIST(sw->result_list));
|
||||
|
||||
/* Setup column parameters */
|
||||
for (i = 0, col = sw->display_list; col; col = col->next) {
|
||||
GNCSearchParam *param = col->data;
|
||||
gtk_clist_set_column_justification (GTK_CLIST (sw->result_list), i,
|
||||
param->justify);
|
||||
gtk_clist_set_column_auto_resize (GTK_CLIST (sw->result_list), i, TRUE);
|
||||
i++;
|
||||
}
|
||||
|
||||
/* Setup the list callbacks */
|
||||
gtk_signal_connect (GTK_OBJECT (sw->result_list), "select-row",
|
||||
gnc_search_dialog_select_row_cb, sw);
|
||||
gtk_signal_connect (GTK_OBJECT (sw->result_list), "unselect-row",
|
||||
gnc_search_dialog_unselect_row_cb, sw);
|
||||
}
|
||||
|
||||
static void
|
||||
gnc_search_dialog_prepend_item (GNCSearchWindow *sw, gpointer object)
|
||||
{
|
||||
const GUID *guid = (const GUID *) ((sw->get_guid)(object));
|
||||
GList *col;
|
||||
char ** row_text;
|
||||
gint row, i;
|
||||
|
||||
row_text = g_new0 (char *, sw->num_cols);
|
||||
|
||||
/* Iterate over each column, and compute the particular text
|
||||
* to display for that column.
|
||||
*/
|
||||
for (i = 0, col = sw->display_list; col; col = col->next) {
|
||||
GNCSearchParam *param = col->data;
|
||||
GSList *converters = gnc_search_param_get_converters (param);
|
||||
const char *type = gnc_search_param_get_param_type (param);
|
||||
gpointer res = object;
|
||||
QueryAccess fcn = NULL;
|
||||
|
||||
/* Do all the object conversions */
|
||||
for (; converters; converters = converters->next) {
|
||||
fcn = converters->data;
|
||||
|
||||
if (converters->next)
|
||||
res = fcn (res);
|
||||
}
|
||||
|
||||
/* Now convert this to a text value for the row */
|
||||
row_text[i++] = gncQueryCoreToString (type, res, fcn);
|
||||
}
|
||||
|
||||
row = gtk_clist_prepend (GTK_CLIST (sw->result_list), row_text);
|
||||
gtk_clist_set_row_data (GTK_CLIST (sw->result_list), row, object);
|
||||
gtk_clist_set_selectable (GTK_CLIST (sw->result_list), row, TRUE);
|
||||
|
||||
/* Free up our strings */
|
||||
for (i = 0; i < sw->num_cols; i++) {
|
||||
if (row_text[i])
|
||||
g_free (row_text[i]);
|
||||
}
|
||||
g_free (row_text);
|
||||
|
||||
/* Watch this item in case it changes */
|
||||
gnc_gui_component_watch_entity (sw->component_id, guid,
|
||||
GNC_EVENT_MODIFY | GNC_EVENT_DESTROY);
|
||||
}
|
||||
|
||||
static void
|
||||
gnc_search_dialog_display_results (GNCSearchWindow *sw)
|
||||
{
|
||||
@ -148,24 +241,11 @@ gnc_search_dialog_display_results (GNCSearchWindow *sw)
|
||||
*/
|
||||
if (sw->result_list == NULL) {
|
||||
GtkWidget *scroller, *button_box, *button;
|
||||
char * titles [] = { "Result" }; /* XXX */
|
||||
|
||||
have_list = FALSE;
|
||||
|
||||
/* Create the list : XXX : move to function, provide multiple columns */
|
||||
sw->result_list = gtk_clist_new_with_titles (1, titles);
|
||||
gtk_clist_set_selection_mode (GTK_CLIST (sw->result_list),
|
||||
GTK_SELECTION_SINGLE);
|
||||
|
||||
/* Setup list properties */
|
||||
gtk_clist_set_shadow_type(GTK_CLIST(sw->result_list), GTK_SHADOW_IN);
|
||||
gtk_clist_column_titles_passive(GTK_CLIST(sw->result_list));
|
||||
|
||||
/* Setup the list callbacks */
|
||||
gtk_signal_connect (GTK_OBJECT (sw->result_list), "select-row",
|
||||
gnc_search_dialog_select_row_cb, sw);
|
||||
gtk_signal_connect (GTK_OBJECT (sw->result_list), "unselect-row",
|
||||
gnc_search_dialog_unselect_row_cb, sw);
|
||||
/* Create the list */
|
||||
gnc_search_dialog_init_result_list (sw);
|
||||
|
||||
/* Create the scroller and add the list to the scroller */
|
||||
scroller = gtk_scrolled_window_new (NULL, NULL);
|
||||
@ -226,18 +306,7 @@ gnc_search_dialog_display_results (GNCSearchWindow *sw)
|
||||
|
||||
/* Add the list of items to the clist */
|
||||
for (; list; list = list->next) {
|
||||
const GUID *guid = (const GUID *) ((sw->get_guid)(list->data));
|
||||
char * row_text[2] = { NULL, NULL };
|
||||
gint row;
|
||||
|
||||
/* XXX: Move into a function and provide multiple columns */
|
||||
row_text[0] = (char *) gncObjectPrintable (sw->search_for, list->data);
|
||||
row = gtk_clist_prepend (GTK_CLIST (sw->result_list), row_text);
|
||||
gtk_clist_set_row_data (GTK_CLIST (sw->result_list), row, list->data);
|
||||
gtk_clist_set_selectable (GTK_CLIST (sw->result_list), row, TRUE);
|
||||
|
||||
/* Watch this item in case it changes */
|
||||
gnc_gui_component_watch_entity (sw->component_id, guid, GNC_EVENT_MODIFY);
|
||||
gnc_search_dialog_prepend_item (sw, list->data);
|
||||
}
|
||||
|
||||
/* Need to reverse again for internal consistency */
|
||||
@ -796,6 +865,7 @@ gnc_search_dialog_raise (GNCSearchWindow *sw)
|
||||
|
||||
GNCSearchWindow *
|
||||
gnc_search_dialog_create (GNCIdTypeConst obj_type, GList *param_list,
|
||||
GList *display_list,
|
||||
QueryNew *start_query, QueryNew *show_start_query,
|
||||
GNCSearchCallbackButton *callbacks,
|
||||
GNCSearchResultCB result_callback,
|
||||
@ -807,6 +877,7 @@ gnc_search_dialog_create (GNCIdTypeConst obj_type, GList *param_list,
|
||||
g_return_val_if_fail (obj_type, NULL);
|
||||
g_return_val_if_fail (*obj_type != '\0', NULL);
|
||||
g_return_val_if_fail (param_list, NULL);
|
||||
g_return_val_if_fail (display_list, NULL);
|
||||
|
||||
/* Make sure the caller supplies callbacks xor result_callback */
|
||||
g_return_val_if_fail ((callbacks && !result_callback) ||
|
||||
@ -814,6 +885,7 @@ gnc_search_dialog_create (GNCIdTypeConst obj_type, GList *param_list,
|
||||
|
||||
sw->search_for = obj_type;
|
||||
sw->params_list = param_list;
|
||||
sw->display_list = display_list;
|
||||
sw->buttons = callbacks;
|
||||
sw->result_cb = result_callback;
|
||||
sw->new_item_cb = new_item_cb;
|
||||
@ -914,6 +986,20 @@ get_params_list (GNCIdTypeConst type)
|
||||
return list;
|
||||
}
|
||||
|
||||
static GList *
|
||||
get_display_list (GNCIdTypeConst type)
|
||||
{
|
||||
GList *list = NULL;
|
||||
|
||||
list = gnc_search_param_prepend (list, "Amount", NULL, type, SPLIT_AMOUNT,
|
||||
NULL);
|
||||
list = gnc_search_param_prepend (list, "Memo", NULL, type, SPLIT_MEMO, NULL);
|
||||
list = gnc_search_param_prepend (list, "Date", NULL, type, SPLIT_TRANS,
|
||||
TRANS_DATE_POSTED, NULL);
|
||||
|
||||
return list;
|
||||
}
|
||||
|
||||
static void
|
||||
do_nothing (gpointer *a, gpointer b)
|
||||
{
|
||||
@ -924,6 +1010,8 @@ void
|
||||
gnc_search_dialog_test (void)
|
||||
{
|
||||
GNCSearchWindow *sw;
|
||||
static GList *params = NULL;
|
||||
static GList *display = NULL;
|
||||
static GNCSearchCallbackButton buttons[] = {
|
||||
{ N_("View Split"), do_nothing },
|
||||
{ N_("New Split"), do_nothing },
|
||||
@ -933,6 +1021,12 @@ gnc_search_dialog_test (void)
|
||||
{ NULL }
|
||||
};
|
||||
|
||||
sw = gnc_search_dialog_create (GNC_ID_SPLIT, get_params_list (GNC_ID_SPLIT),
|
||||
if (params == NULL)
|
||||
params = get_params_list (GNC_ID_SPLIT);
|
||||
|
||||
if (display == NULL)
|
||||
display = get_display_list (GNC_ID_SPLIT);
|
||||
|
||||
sw = gnc_search_dialog_create (GNC_ID_SPLIT, params, display,
|
||||
NULL, NULL, buttons, NULL, NULL, NULL, NULL);
|
||||
}
|
||||
|
@ -54,16 +54,21 @@ typedef struct {
|
||||
/* Caller MUST supply _EITHER_ a result_callback or a list of callback
|
||||
* buttons. The caller MUST NOT supply both.
|
||||
*
|
||||
* The param_list is the property of the dialog but will NOT be destroyed.
|
||||
* Both the param_list and display_list are the property of the dialog
|
||||
* but will NOT be destroyed.. They should be a GList of
|
||||
* GNCSearchParam objects. The display_list defines which paramters
|
||||
* of the found transactions are printed, and how.
|
||||
*
|
||||
* The start_query is the property of the caller and will only be copied.
|
||||
* The show_start_query, if it exists, will become the property of the
|
||||
* dialog and will be automatically destroyed.
|
||||
*
|
||||
* The user_data becomes the property of the search dialog and will
|
||||
* be freed via the callback when the dialog is closed.
|
||||
*/
|
||||
*/
|
||||
GNCSearchWindow *
|
||||
gnc_search_dialog_create (GNCIdTypeConst obj_type, GList *param_list,
|
||||
GList *display_list,
|
||||
QueryNew *start_query, QueryNew *show_start_query,
|
||||
GNCSearchCallbackButton *callbacks,
|
||||
GNCSearchResultCB result_callback,
|
||||
|
@ -23,6 +23,7 @@ static void gnc_search_param_finalise (GtkObject *obj);
|
||||
|
||||
#define _PRIVATE(x) (((GNCSearchParam *)(x))->priv)
|
||||
struct _GNCSearchParamPrivate {
|
||||
GSList * converters;
|
||||
GSList * param_path;
|
||||
GNCIdTypeConst type;
|
||||
};
|
||||
@ -86,6 +87,8 @@ gnc_search_param_finalise (GtkObject *obj)
|
||||
GNCSearchParam *o = (GNCSearchParam *)obj;
|
||||
g_slist_free (o->priv->param_path);
|
||||
o->priv->param_path = NULL;
|
||||
g_slist_free (o->priv->converters);
|
||||
o->priv->converters = NULL;
|
||||
g_free(o->priv);
|
||||
((GtkObjectClass *)(parent_class))->finalize(obj);
|
||||
}
|
||||
@ -125,6 +128,7 @@ gnc_search_param_set_param_path (GNCSearchParam *param,
|
||||
GSList *param_path)
|
||||
{
|
||||
GNCIdTypeConst type = NULL;
|
||||
GSList *converters = NULL;
|
||||
|
||||
g_assert (IS_GNCSEARCH_PARAM (param));
|
||||
|
||||
@ -142,11 +146,20 @@ gnc_search_param_set_param_path (GNCSearchParam *param,
|
||||
if (!objDef)
|
||||
break;
|
||||
|
||||
/* Save the converter */
|
||||
converters = g_slist_prepend (converters, objDef->param_getfcn);
|
||||
|
||||
/* And reset for the next parameter */
|
||||
type = search_type = objDef->param_type;
|
||||
}
|
||||
|
||||
/* Save the type */
|
||||
param->priv->type = type;
|
||||
|
||||
/* Save the converters */
|
||||
if (param->priv->converters)
|
||||
g_slist_free (param->priv->converters);
|
||||
param->priv->converters = g_slist_reverse (converters);
|
||||
}
|
||||
|
||||
void
|
||||
@ -156,6 +169,7 @@ gnc_search_param_override_param_type (GNCSearchParam *param,
|
||||
g_assert (IS_GNCSEARCH_PARAM (param));
|
||||
g_assert (param_type != NULL && *param_type != '\0');
|
||||
param->priv->type = param_type;
|
||||
/* XXX: What about the converters? */
|
||||
}
|
||||
|
||||
GSList *
|
||||
@ -166,6 +180,14 @@ gnc_search_param_get_param_path (GNCSearchParam *param)
|
||||
return g_slist_copy (param->priv->param_path);
|
||||
}
|
||||
|
||||
GSList *
|
||||
gnc_search_param_get_converters (GNCSearchParam *param)
|
||||
{
|
||||
g_assert (IS_GNCSEARCH_PARAM (param));
|
||||
|
||||
return param->priv->converters;
|
||||
}
|
||||
|
||||
GNCIdTypeConst
|
||||
gnc_search_param_get_param_type (GNCSearchParam *param)
|
||||
{
|
||||
@ -182,6 +204,14 @@ gnc_search_param_set_title (GNCSearchParam *param, const char *title)
|
||||
param->title = title;
|
||||
}
|
||||
|
||||
void
|
||||
gnc_search_param_set_justify (GNCSearchParam *param, GtkJustification justify)
|
||||
{
|
||||
g_assert (IS_GNCSEARCH_PARAM (param));
|
||||
|
||||
param->justify = justify;
|
||||
}
|
||||
|
||||
gboolean
|
||||
gnc_search_param_type_match (GNCSearchParam *a, GNCSearchParam *b)
|
||||
{
|
||||
@ -195,34 +225,25 @@ gnc_search_param_type_match (GNCSearchParam *a, GNCSearchParam *b)
|
||||
return FALSE;
|
||||
}
|
||||
|
||||
GList *
|
||||
gnc_search_param_prepend (GList *list, char const *title,
|
||||
GNCIdTypeConst type_override,
|
||||
GNCIdTypeConst search_type,
|
||||
const char *param, ...)
|
||||
static GList *
|
||||
gnc_search_param_prepend_internal (GList *list, char const *title,
|
||||
GtkJustification justify,
|
||||
GNCIdTypeConst type_override,
|
||||
GNCIdTypeConst search_type,
|
||||
const char *param, va_list args)
|
||||
{
|
||||
GNCSearchParam *p;
|
||||
GSList *path = NULL;
|
||||
va_list ap;
|
||||
const char *this_param;
|
||||
|
||||
g_return_val_if_fail (title, list);
|
||||
g_return_val_if_fail (search_type, list);
|
||||
g_return_val_if_fail (param, list);
|
||||
|
||||
p = gnc_search_param_new ();
|
||||
gnc_search_param_set_title (p, title);
|
||||
|
||||
/* Build the parameter path */
|
||||
va_start (ap, param);
|
||||
|
||||
for (this_param = param; this_param;
|
||||
this_param = va_arg (ap, const char *)) {
|
||||
this_param = va_arg (args, const char *)) {
|
||||
path = g_slist_prepend (path, (gpointer)this_param);
|
||||
}
|
||||
|
||||
va_end (ap);
|
||||
|
||||
/* put the path into the right order, and set it */
|
||||
path = g_slist_reverse (path);
|
||||
gnc_search_param_set_param_path (p, search_type, path);
|
||||
@ -234,4 +255,49 @@ gnc_search_param_prepend (GList *list, char const *title,
|
||||
/* And return it */
|
||||
return g_list_prepend (list, p);
|
||||
}
|
||||
|
||||
|
||||
GList *
|
||||
gnc_search_param_prepend_with_justify (GList *list, char const *title,
|
||||
GtkJustification justify,
|
||||
GNCIdTypeConst type_override,
|
||||
GNCIdTypeConst search_type,
|
||||
const char *param, ...)
|
||||
{
|
||||
GList *result;
|
||||
va_list ap;
|
||||
|
||||
g_return_val_if_fail (title, list);
|
||||
g_return_val_if_fail (search_type, list);
|
||||
g_return_val_if_fail (param, list);
|
||||
|
||||
/* Build the parameter path */
|
||||
va_start (ap, param);
|
||||
result = gnc_search_param_prepend_internal (list, title, justify,
|
||||
type_override, search_type,
|
||||
param, ap);
|
||||
va_end (ap);
|
||||
return result;
|
||||
}
|
||||
|
||||
GList *
|
||||
gnc_search_param_prepend (GList *list, char const *title,
|
||||
GNCIdTypeConst type_override,
|
||||
GNCIdTypeConst search_type,
|
||||
const char *param, ...)
|
||||
{
|
||||
GList *result;
|
||||
va_list ap;
|
||||
|
||||
g_return_val_if_fail (title, list);
|
||||
g_return_val_if_fail (search_type, list);
|
||||
g_return_val_if_fail (param, list);
|
||||
|
||||
/* Build the parameter path */
|
||||
va_start (ap, param);
|
||||
result = gnc_search_param_prepend_internal (list, title, GTK_JUSTIFY_LEFT,
|
||||
type_override, search_type,
|
||||
param, ap);
|
||||
va_end (ap);
|
||||
return result;
|
||||
}
|
||||
|
@ -19,7 +19,8 @@ struct _GNCSearchParam {
|
||||
GtkObject parent;
|
||||
struct _GNCSearchParamPrivate *priv;
|
||||
|
||||
const char * title;
|
||||
const char * title;
|
||||
GtkJustification justify;
|
||||
};
|
||||
|
||||
struct _GNCSearchParamClass {
|
||||
@ -45,9 +46,14 @@ GSList * gnc_search_param_get_param_path (GNCSearchParam *param);
|
||||
GNCIdTypeConst gnc_search_param_get_param_type (GNCSearchParam *param);
|
||||
void gnc_search_param_set_title (GNCSearchParam *param,
|
||||
const char *title);
|
||||
void gnc_search_param_set_justify (GNCSearchParam *param,
|
||||
GtkJustification justify);
|
||||
gboolean gnc_search_param_type_match (GNCSearchParam *a,
|
||||
GNCSearchParam *b);
|
||||
|
||||
/* Return the list of QueryAccess functions for this parameter. This list
|
||||
* is owned by the param object -- users should not change it */
|
||||
GSList * gnc_search_param_get_converters (GNCSearchParam *param);
|
||||
|
||||
/* This will override the automatic param_type logic from "set_param_path()"
|
||||
* so that the programmer can force a particular UI to appear for a given
|
||||
@ -59,7 +65,7 @@ void gnc_search_param_override_param_type (GNCSearchParam *param,
|
||||
GNCIdTypeConst param_type);
|
||||
|
||||
/*************************************************************
|
||||
* Helper function ..
|
||||
* Helper functions ..
|
||||
*/
|
||||
|
||||
/* Create a paramter and prepend it to a GSList */
|
||||
@ -69,4 +75,11 @@ GList * gnc_search_param_prepend (GList *list, char const *title,
|
||||
const char *param, ...);
|
||||
|
||||
|
||||
GList * gnc_search_param_prepend_with_justify (GList *list, char const *title,
|
||||
GtkJustification justify,
|
||||
GNCIdTypeConst type_override,
|
||||
GNCIdTypeConst search_type,
|
||||
const char *param, ...);
|
||||
|
||||
|
||||
#endif /* _GNCSEARCH_PARAM_H */
|
||||
|
Loading…
Reference in New Issue
Block a user