mirror of
https://github.com/Gnucash/gnucash.git
synced 2025-02-25 18:55:30 -06:00
* src/engine/QueryNew.h: add QUERY_PARAM_ACTIVE
* src/business/business-core/gncCustomer.c: * src/business/business-core/gncEmployee.c: * src/business/business-core/gncInvoice.c: * src/business/business-core/gncJob.c: * src/business/business-core/gncOrder.c: * src/business/business-core/gncVendor.c: add the QUERY_PARAM_ACTIVE parameter support * src/app-util/prefs.scm: add hidden preference to store the user's choice of searchin * src/gnome-search/search.glade: add a checkbox to search-for-all * src/gnome-search/dialog-search.c -- add preliminary support to limit searches to only "active" objects. Fixes bug #103506 git-svn-id: svn+ssh://svn.gnucash.org/repo/gnucash/trunk@7833 57a11ea4-9604-0410-9ed3-97b8803252fd
This commit is contained in:
parent
8e00dd0826
commit
198f41ee89
16
ChangeLog
16
ChangeLog
@ -1,3 +1,19 @@
|
||||
2003-01-14 Derek Atkins <derek@ihtfp.com>
|
||||
|
||||
* src/engine/QueryNew.h: add QUERY_PARAM_ACTIVE
|
||||
* src/business/business-core/gncCustomer.c:
|
||||
* src/business/business-core/gncEmployee.c:
|
||||
* src/business/business-core/gncInvoice.c:
|
||||
* src/business/business-core/gncJob.c:
|
||||
* src/business/business-core/gncOrder.c:
|
||||
* src/business/business-core/gncVendor.c:
|
||||
add the QUERY_PARAM_ACTIVE parameter support
|
||||
* src/app-util/prefs.scm: add hidden preference to store
|
||||
the user's choice of searchin
|
||||
* src/gnome-search/search.glade: add a checkbox to search-for-all
|
||||
* src/gnome-search/dialog-search.c -- add preliminary support to
|
||||
limit searches to only "active" objects. Fixes bug #103506
|
||||
|
||||
2003-01-13 David Hampton <hampton@employees.org>
|
||||
|
||||
* src/engine/engine-helpers.c: Make the gnc_scm_to_gint64()
|
||||
|
@ -747,3 +747,9 @@ without one.")
|
||||
(gnc:register-configuration-option
|
||||
(gnc:make-internal-option
|
||||
"__paths" "Import OFX" #f))
|
||||
|
||||
(gnc:register-configuration-option
|
||||
(gnc:make-simple-boolean-option
|
||||
"__gui" "search_for_active_only"
|
||||
"" ""
|
||||
#t))
|
||||
|
@ -536,6 +536,7 @@ gboolean gncCustomerRegister (void)
|
||||
{ CUSTOMER_SHIPADDR, GNC_ADDRESS_MODULE_NAME, (QueryAccess)gncCustomerGetShipAddr },
|
||||
{ QUERY_PARAM_BOOK, GNC_ID_BOOK, (QueryAccess)gncCustomerGetBook },
|
||||
{ QUERY_PARAM_GUID, QUERYCORE_GUID, (QueryAccess)gncCustomerGetGUID },
|
||||
{ QUERY_PARAM_ACTIVE, QUERYCORE_BOOLEAN, (QueryAccess)gncCustomerGetActive },
|
||||
{ NULL },
|
||||
};
|
||||
|
||||
|
@ -399,6 +399,7 @@ gboolean gncEmployeeRegister (void)
|
||||
{ EMPLOYEE_ADDR, GNC_ADDRESS_MODULE_NAME, (QueryAccess)gncEmployeeGetAddr },
|
||||
{ QUERY_PARAM_BOOK, GNC_ID_BOOK, (QueryAccess)gncEmployeeGetBook },
|
||||
{ QUERY_PARAM_GUID, QUERYCORE_GUID, (QueryAccess)gncEmployeeGetGUID },
|
||||
{ QUERY_PARAM_ACTIVE, QUERYCORE_BOOLEAN, (QueryAccess)gncEmployeeGetActive },
|
||||
{ NULL },
|
||||
};
|
||||
|
||||
|
@ -1262,6 +1262,7 @@ gboolean gncInvoiceRegister (void)
|
||||
{ INVOICE_BILLTO, GNC_OWNER_MODULE_NAME, (QueryAccess)gncInvoiceGetBillTo },
|
||||
{ QUERY_PARAM_BOOK, GNC_ID_BOOK, (QueryAccess)gncInvoiceGetBook },
|
||||
{ QUERY_PARAM_GUID, QUERYCORE_GUID, (QueryAccess)gncInvoiceGetGUID },
|
||||
{ QUERY_PARAM_ACTIVE, QUERYCORE_BOOLEAN, (QueryAccess)gncInvoiceGetActive },
|
||||
{ NULL },
|
||||
};
|
||||
|
||||
|
@ -387,6 +387,7 @@ gboolean gncJobRegister (void)
|
||||
{ JOB_ACTIVE, QUERYCORE_BOOLEAN, (QueryAccess)gncJobGetActive },
|
||||
{ QUERY_PARAM_BOOK, GNC_ID_BOOK, (QueryAccess)gncJobGetBook },
|
||||
{ QUERY_PARAM_GUID, QUERYCORE_GUID, (QueryAccess)gncJobGetGUID },
|
||||
{ QUERY_PARAM_ACTIVE, QUERYCORE_BOOLEAN, (QueryAccess)gncJobGetActive },
|
||||
{ NULL },
|
||||
};
|
||||
|
||||
|
@ -443,6 +443,7 @@ gboolean gncOrderRegister (void)
|
||||
{ ORDER_NOTES, QUERYCORE_STRING, (QueryAccess)gncOrderGetNotes },
|
||||
{ QUERY_PARAM_BOOK, GNC_ID_BOOK, (QueryAccess)gncOrderGetBook },
|
||||
{ QUERY_PARAM_GUID, QUERYCORE_GUID, (QueryAccess)gncOrderGetGUID },
|
||||
{ QUERY_PARAM_ACTIVE, QUERYCORE_BOOLEAN, (QueryAccess)gncOrderGetActive },
|
||||
{ NULL },
|
||||
};
|
||||
|
||||
|
@ -487,6 +487,7 @@ gboolean gncVendorRegister (void)
|
||||
{ VENDOR_ADDR, GNC_ADDRESS_MODULE_NAME, (QueryAccess)gncVendorGetAddr },
|
||||
{ QUERY_PARAM_BOOK, GNC_ID_BOOK, (QueryAccess)gncVendorGetBook },
|
||||
{ QUERY_PARAM_GUID, QUERYCORE_GUID, (QueryAccess)gncVendorGetGUID },
|
||||
{ QUERY_PARAM_ACTIVE, QUERYCORE_BOOLEAN, (QueryAccess)gncVendorGetActive },
|
||||
{ NULL },
|
||||
};
|
||||
|
||||
|
@ -28,6 +28,8 @@ typedef enum {
|
||||
/* "Known" Object Parameters -- all objects must support these */
|
||||
#define QUERY_PARAM_BOOK "book"
|
||||
#define QUERY_PARAM_GUID "guid"
|
||||
#define QUERY_PARAM_ACTIVE "active" /* it's ok if an object does
|
||||
* not support this */
|
||||
|
||||
/* Basic API Functions */
|
||||
|
||||
|
@ -727,6 +727,7 @@ gnc_numeric_lcd(gnc_numeric a, gnc_numeric b) {
|
||||
* as the output denominator.
|
||||
********************************************************************/
|
||||
|
||||
#if 1
|
||||
gnc_numeric
|
||||
gnc_numeric_reduce(gnc_numeric in) {
|
||||
gint64 t;
|
||||
@ -753,7 +754,7 @@ gnc_numeric_reduce(gnc_numeric in) {
|
||||
return out;
|
||||
}
|
||||
|
||||
#if 0
|
||||
#else
|
||||
gnc_numeric
|
||||
gnc_numeric_reduce(gnc_numeric in) {
|
||||
|
||||
|
@ -15,6 +15,7 @@
|
||||
#include "gnc-ui-util.h"
|
||||
#include "gnc-ui.h"
|
||||
#include "gnc-gui-query.h"
|
||||
#include "global-options.h"
|
||||
#include "gncObject.h"
|
||||
#include "QueryNew.h"
|
||||
#include "QueryObject.h"
|
||||
@ -48,6 +49,8 @@ struct _GNCSearchWindow {
|
||||
GtkWidget * add_rb;
|
||||
GtkWidget * del_rb;
|
||||
|
||||
GtkWidget * active_only_check;
|
||||
|
||||
/* The Select button */
|
||||
GtkWidget * select_button;
|
||||
|
||||
@ -387,30 +390,45 @@ search_type_cb (GtkToggleButton *button, GNCSearchWindow *sw)
|
||||
}
|
||||
}
|
||||
|
||||
static void
|
||||
search_active_only_cb (GtkToggleButton *button, GNCSearchWindow *sw)
|
||||
{
|
||||
gnc_set_boolean_option("__gui", "search_for_active_only",
|
||||
gtk_toggle_button_get_active (button));
|
||||
}
|
||||
|
||||
static void
|
||||
search_update_query (GNCSearchWindow *sw)
|
||||
{
|
||||
static GSList *active_params = NULL;
|
||||
QueryNew *q, *q2, *new_q;
|
||||
GList *node;
|
||||
QueryOp op;
|
||||
QueryPredData_t pdata;
|
||||
|
||||
if (sw->grouping == GNC_SEARCH_MATCH_ANY)
|
||||
op = QUERY_OR;
|
||||
else
|
||||
op = QUERY_AND;
|
||||
|
||||
if (active_params == NULL)
|
||||
active_params = g_slist_prepend (NULL, QUERY_PARAM_ACTIVE);
|
||||
|
||||
/* Make sure we supply a book! */
|
||||
if (sw->start_q == NULL) {
|
||||
sw->start_q = gncQueryCreateFor (sw->search_for);
|
||||
gncQuerySetBook (sw->start_q, gnc_get_current_book ());
|
||||
} else {
|
||||
/* We've got a query -- purge it of any "active" parameters */
|
||||
gncQueryPurgeTerms (sw->start_q, active_params);
|
||||
}
|
||||
|
||||
/* Now create a new query to work from */
|
||||
q = gncQueryCreateFor (sw->search_for);
|
||||
|
||||
/* Walk the list of criteria */
|
||||
for (node = sw->crit_list; node; node = node->next) {
|
||||
struct _crit_data *data = node->data;
|
||||
QueryPredData_t pdata;
|
||||
|
||||
pdata = gnc_search_core_type_get_predicate (data->element);
|
||||
if (pdata)
|
||||
@ -448,6 +466,11 @@ search_update_query (GNCSearchWindow *sw)
|
||||
break;
|
||||
}
|
||||
|
||||
if (gtk_toggle_button_get_active (GTK_TOGGLE_BUTTON (sw->active_only_check))) {
|
||||
gncQueryAddBooleanMatch (new_q, active_params, TRUE, QUERY_AND);
|
||||
active_params = NULL;
|
||||
}
|
||||
|
||||
/* Destroy the old query */
|
||||
if (sw->q)
|
||||
gncQueryDestroy (sw->q);
|
||||
@ -848,6 +871,12 @@ gnc_search_dialog_init_widgets (GNCSearchWindow *sw)
|
||||
sw->add_rb = glade_xml_get_widget (xml, "add_search_radiobutton");
|
||||
sw->del_rb = glade_xml_get_widget (xml, "delete_search_radiobutton");
|
||||
|
||||
sw->active_only_check = glade_xml_get_widget (xml, "active_only_check");
|
||||
gtk_toggle_button_set_active (GTK_TOGGLE_BUTTON (sw->active_only_check),
|
||||
gnc_lookup_boolean_option ("__gui",
|
||||
"search_for_active_only",
|
||||
TRUE));
|
||||
|
||||
/* Deal with the cancel button */
|
||||
sw->cancel_button = glade_xml_get_widget (xml, "cancel_button");
|
||||
sw->close_button = glade_xml_get_widget (xml, "close_button");
|
||||
@ -877,6 +906,9 @@ gnc_search_dialog_init_widgets (GNCSearchWindow *sw)
|
||||
glade_xml_signal_connect_data (xml, "gnc_ui_search_type_cb",
|
||||
GTK_SIGNAL_FUNC (search_type_cb), sw);
|
||||
|
||||
glade_xml_signal_connect_data (xml, "gnc_ui_search_active_cb",
|
||||
GTK_SIGNAL_FUNC (search_active_only_cb), sw);
|
||||
|
||||
glade_xml_signal_connect_data (xml, "gnc_ui_search_new_cb",
|
||||
GTK_SIGNAL_FUNC (search_new_item_cb), sw);
|
||||
|
||||
|
@ -443,6 +443,37 @@
|
||||
<fill>False</fill>
|
||||
</child>
|
||||
</widget>
|
||||
|
||||
<widget>
|
||||
<class>GtkHSeparator</class>
|
||||
<name>hseparator1</name>
|
||||
<child>
|
||||
<padding>0</padding>
|
||||
<expand>True</expand>
|
||||
<fill>True</fill>
|
||||
</child>
|
||||
</widget>
|
||||
|
||||
<widget>
|
||||
<class>GtkCheckButton</class>
|
||||
<name>active_only_check</name>
|
||||
<tooltip>Choose whether to search all your data or only that marked as "active"</tooltip>
|
||||
<can_focus>True</can_focus>
|
||||
<signal>
|
||||
<name>toggled</name>
|
||||
<handler>gnc_ui_search_active_cb</handler>
|
||||
<data>Search Dialog</data>
|
||||
<last_modification_time>Wed, 15 Jan 2003 03:21:35 GMT</last_modification_time>
|
||||
</signal>
|
||||
<label>Search only active data</label>
|
||||
<active>True</active>
|
||||
<draw_indicator>True</draw_indicator>
|
||||
<child>
|
||||
<padding>0</padding>
|
||||
<expand>False</expand>
|
||||
<fill>False</fill>
|
||||
</child>
|
||||
</widget>
|
||||
</widget>
|
||||
</widget>
|
||||
</widget>
|
||||
|
Loading…
Reference in New Issue
Block a user