src/gnome-search/ changes:

Change search-dialog API to provide a start_query and a
		show_start_query for the base limiting query and
		the query to show at dialog start-time.
	add new_item button callback
	change the button-list callback API
	Don't ignore the last criterion while building the query
	create gnc_search_param_prepend() API to build arbitrary paramters

src/business/business-core/ changes:
	Extend some of the available parameters for business objects.
	Add APIs (and paramters) for Orders and Invoices to return
		'closed', 'posted', and 'paid' status.

src/business/business-gnome/ changes:
	Rebuild the Job-Search dialog (more changes to come)
	integrate the gnome-dialog into everything.
	remove the (old) business-chooser dialog; use the search instead

	improve the Extensions menu to show off the business objects


git-svn-id: svn+ssh://svn.gnucash.org/repo/gnucash/trunk@6720 57a11ea4-9604-0410-9ed3-97b8803252fd
This commit is contained in:
Derek Atkins 2002-02-19 18:23:53 +00:00
parent 26e28423ab
commit 76e2727955
35 changed files with 1245 additions and 1231 deletions

View File

@ -332,6 +332,7 @@ gboolean gncEmployeeRegister (void)
{ EMPLOYEE_GUID, QUERYCORE_GUID, (QueryAccess)gncEmployeeGetGUID },
{ EMPLOYEE_ID, QUERYCORE_STRING, (QueryAccess)gncEmployeeGetID },
{ EMPLOYEE_USERNAME, QUERYCORE_STRING, (QueryAccess)gncEmployeeGetUsername },
{ EMPLOYEE_ADDR, GNC_ADDRESS_MODULE_NAME, (QueryAccess)gncEmployeeGetAddr },
{ QUERY_PARAM_BOOK, GNC_ID_BOOK, (QueryAccess)gncEmployeeGetBook },
{ NULL },
};

View File

@ -51,5 +51,6 @@ int gncEmployeeCompare (GncEmployee *a, GncEmployee *b);
#define EMPLOYEE_GUID "guid"
#define EMPLOYEE_ID "id"
#define EMPLOYEE_USERNAME "username"
#define EMPLOYEE_ADDR "addr"
#endif /* GNC_EMPLOYEE_H_ */

View File

@ -600,6 +600,25 @@ GncInvoice * gncInvoiceGetInvoiceFromTxn (Transaction *txn)
guid, _GNC_MOD_NAME);
}
static gboolean gncInvoiceDateExists (Timespec *date)
{
g_return_val_if_fail (date, FALSE);
if (date->tv_sec || date->tv_nsec) return TRUE;
return FALSE;
}
gboolean gncInvoiceIsPosted (GncInvoice *invoice)
{
if (!invoice) return FALSE;
return gncInvoiceDateExists (&(invoice->date_posted));
}
gboolean gncInvoiceIsPaid (GncInvoice *invoice)
{
if (!invoice) return FALSE;
return gncInvoiceDateExists (&(invoice->date_paid));
}
GncInvoice * gncInvoiceLookup (GNCBook *book, const GUID *guid)
{
if (!book || !guid) return NULL;
@ -693,7 +712,7 @@ static void _gncInvoiceForeach (GNCBook *book, foreachObjectCB cb,
static GncObject_t gncInvoiceDesc = {
GNC_OBJECT_VERSION,
_GNC_MOD_NAME,
"Purchase/Sales Invoice",
"Invoice",
_gncInvoiceCreate,
_gncInvoiceDestroy,
_gncInvoiceForeach,
@ -710,6 +729,8 @@ gboolean gncInvoiceRegister (void)
{ INVOICE_POSTED, QUERYCORE_DATE, (QueryAccess)gncInvoiceGetDatePosted },
{ INVOICE_DUE, QUERYCORE_DATE, (QueryAccess)gncInvoiceGetDateDue },
{ INVOICE_PAID, QUERYCORE_DATE, (QueryAccess)gncInvoiceGetDatePaid },
{ INVOICE_IS_POSTED, QUERYCORE_BOOLEAN, (QueryAccess)gncInvoiceIsPosted },
{ INVOICE_IS_PAID, QUERYCORE_BOOLEAN, (QueryAccess)gncInvoiceIsPaid },
{ INVOICE_NOTES, QUERYCORE_STRING, (QueryAccess)gncInvoiceGetNotes },
{ INVOICE_ACC, GNC_ID_ACCOUNT, (QueryAccess)gncInvoiceGetPostedAcc },
{ INVOICE_POST_TXN, GNC_ID_TRANS, (QueryAccess)gncInvoiceGetPostedTxn },

View File

@ -81,6 +81,8 @@ gboolean gncInvoiceIsDirty (GncInvoice *invoice);
void gncInvoiceBeginEdit (GncInvoice *invoice);
void gncInvoiceCommitEdit (GncInvoice *invoice);
int gncInvoiceCompare (GncInvoice *a, GncInvoice *b);
gboolean gncInvoiceIsPosted (GncInvoice *invoice);
gboolean gncInvoiceIsPaid (GncInvoice *invoice);
#define INVOICE_GUID "guid"
#define INVOICE_ID "id"
@ -89,6 +91,8 @@ int gncInvoiceCompare (GncInvoice *a, GncInvoice *b);
#define INVOICE_POSTED "date_posted"
#define INVOICE_DUE "date_due"
#define INVOICE_PAID "date_paid"
#define INVOICE_IS_POSTED "is_posted?"
#define INVOICE_IS_PAID "is_paid?"
#define INVOICE_NOTES "notes"
#define INVOICE_ACC "account"
#define INVOICE_POST_TXN "posted_txn"

View File

@ -247,6 +247,13 @@ gboolean gncOrderIsDirty (GncOrder *order)
return order->dirty;
}
gboolean gncOrderIsClosed (GncOrder *order)
{
if (!order) return FALSE;
if (order->closed.tv_sec || order->closed.tv_nsec) return TRUE;
return FALSE;
}
void gncOrderBeginEdit (GncOrder *order)
{
if (!order) return;
@ -331,7 +338,7 @@ static void _gncOrderForeach (GNCBook *book, foreachObjectCB cb,
static GncObject_t gncOrderDesc = {
GNC_OBJECT_VERSION,
_GNC_MOD_NAME,
"Purchase/Sales Order",
"Order",
_gncOrderCreate,
_gncOrderDestroy,
_gncOrderForeach,
@ -345,6 +352,7 @@ gboolean gncOrderRegister (void)
{ ORDER_ID, QUERYCORE_STRING, (QueryAccess)gncOrderGetID },
{ ORDER_OWNER, GNC_OWNER_MODULE_NAME, (QueryAccess)gncOrderGetOwner },
{ ORDER_OPENED, QUERYCORE_DATE, (QueryAccess)gncOrderGetDateOpened },
{ ORDER_IS_CLOSED, QUERYCORE_BOOLEAN, (QueryAccess)gncOrderIsClosed },
{ ORDER_CLOSED, QUERYCORE_DATE, (QueryAccess)gncOrderGetDateClosed },
{ ORDER_NOTES, QUERYCORE_STRING, (QueryAccess)gncOrderGetNotes },
{ QUERY_PARAM_BOOK, GNC_ID_BOOK, (QueryAccess)gncOrderGetBook },

View File

@ -53,11 +53,14 @@ void gncOrderBeginEdit (GncOrder *order);
void gncOrderCommitEdit (GncOrder *order);
int gncOrderCompare (GncOrder *a, GncOrder *b);
gboolean gncOrderIsClosed (GncOrder *order);
#define ORDER_GUID "guid"
#define ORDER_ID "id"
#define ORDER_OWNER "owner"
#define ORDER_OPENED "date_opened"
#define ORDER_CLOSED "date_closed"
#define ORDER_IS_CLOSED "is_closed?"
#define ORDER_NOTES "notes"
#endif /* GNC_ORDER_H_ */

View File

@ -7,6 +7,7 @@ AM_CFLAGS = \
-I${top_srcdir}/src/gnome-utils \
-I${top_srcdir}/src/gnome \
-I${top_srcdir}/src/app-utils \
-I${top_srcdir}/src/gnome-search \
-I${top_srcdir}/src/business/business-core \
-I${top_srcdir}/src/business/business-ledger \
${GNOME_PRINT_CFLAGS} \
@ -23,7 +24,6 @@ AM_CFLAGS = \
libgncmod_business_gnome_la_SOURCES = \
businessmod-gnome.c \
business-chooser.c \
business-utils.c \
dialog-customer.c \
dialog-date-close.c \
@ -36,7 +36,6 @@ libgncmod_business_gnome_la_SOURCES = \
gnc-business-utils.c
noinst_HEADERS = \
business-chooser.h \
business-utils.h \
dialog-customer.h \
dialog-date-close.h \
@ -68,7 +67,6 @@ gncmod_DATA = business-gnome.scm
gladedir = $(GNC_GLADE_DIR)
glade_DATA = \
business-chooser.glade \
customer.glade \
date-close.glade \
employee.glade \

View File

@ -1,252 +0,0 @@
/*
* business-chooser.c -- General Selection Dialog for GNC Business Objects
*
* Written By: Derek Atkins <warlord@MIT.EDU>
* Copyright (C) 2001
*/
#include "config.h"
#include <gnome.h>
#include "dialog-utils.h"
#include "gnc-ui.h"
#include "gnc-gui-query.h"
#include "gncObject.h"
#include "QueryNew.h"
#include "business-chooser.h"
struct business_chooser_window {
GtkWidget * dialog;
GtkWidget * choice_combo;
GtkWidget * choice_entry;
GtkWidget * showall_check;
GNCIdTypeConst obj_type;
QueryNew * query;
gnc_business_chooser_new_cb new_cb;
gnc_business_chooser_edit_cb edit_cb;
gpointer cb_arg;
gpointer selected;
};
static void
chooser_choice_changed_cb(GtkList *list, GtkWidget *li, gpointer user_data)
{
struct business_chooser_window * w = user_data;
w->selected = gtk_object_get_data (GTK_OBJECT (li), "list-item-pointer");
}
static void
update_selection_picker (struct business_chooser_window *w)
{
GList *iterator;
GtkWidget *li;
GList *obj_list;
gpointer selected;
gboolean show_all = gtk_toggle_button_get_active (GTK_TOGGLE_BUTTON
(w->showall_check));
/* Clear out the existing choices */
gtk_list_clear_items (GTK_LIST (GTK_COMBO (w->choice_combo)->list), 0, -1);
/* Save the existing selection */
selected = w->selected;
/* Get the list of objects */
/* XXX: use show_all in the query */
obj_list = gncQueryRun (w->query, w->obj_type);
/* Build a list of strings (objs is pre-sorted, so keep the order!) */
for (iterator = obj_list; iterator; iterator = iterator->next) {
const gchar *label = gncObjectPrintable (w->obj_type, iterator->data);
li = gtk_list_item_new_with_label (label);
gtk_object_set_data (GTK_OBJECT (li), "list-item-pointer", iterator->data);
gtk_widget_show (li);
gtk_container_add (GTK_CONTAINER (GTK_COMBO (w->choice_combo)->list), li);
}
/* revert the existing selection */
w->selected = selected;
/* If no selection, choose the first one in the list */
if (!w->selected && obj_list)
w->selected = obj_list->data;
/* XXX: Should we verify that w->selected is a memeber of obj_list? */
/* And set the current-selected item */
gtk_entry_set_text (GTK_ENTRY (w->choice_entry),
((w->selected) ?
gncObjectPrintable (w->obj_type, w->selected) : ""));
}
static void
gnc_ui_business_chooser_ok_cb(GtkButton * button, gpointer user_data)
{
struct business_chooser_window * w = user_data;
if(w->selected) {
gnome_dialog_close(GNOME_DIALOG (w->dialog));
} else {
gnc_warning_dialog(_("You must make a selection.\n"
"To create a new one, click \"New\""));
}
}
static void
gnc_ui_business_chooser_new_cb(GtkButton * button, gpointer user_data)
{
struct business_chooser_window * w = user_data;
if (w->new_cb) {
gpointer new_selection;
GtkWidget *toplevel;
toplevel = gtk_widget_get_toplevel (GTK_WIDGET (button));
new_selection = (*(w->new_cb))(w->cb_arg, toplevel);
if (new_selection) {
w->selected = new_selection;
update_selection_picker (w);
}
}
}
static void
gnc_ui_business_chooser_edit_cb(GtkButton * button, gpointer user_data)
{
struct business_chooser_window * w = user_data;
if (! w->selected) {
gnc_warning_dialog(_("You must choose a selection to edit.\n"));
return;
}
if (w->edit_cb) {
GtkWidget *toplevel = gtk_widget_get_toplevel (GTK_WIDGET (button));
(*(w->edit_cb))(w->cb_arg, w->selected, toplevel);
}
update_selection_picker (w);
}
static void
gnc_ui_business_chooser_cancel_cb(GtkButton * button, gpointer user_data)
{
struct business_chooser_window * w = user_data;
if (w)
gnome_dialog_close(GNOME_DIALOG (w->dialog));
}
static void
gnc_ui_business_chooser_showall_toggled_cb(GtkCheckButton * entry,
gpointer user_data)
{
struct business_chooser_window * w = user_data;
update_selection_picker (w);
}
static gint
business_chooser_close (GnomeDialog *dialog, gpointer data)
{
gtk_main_quit ();
return FALSE;
}
gpointer
gnc_ui_business_chooser_new (GtkWidget * parent,
gpointer orig_sel,
GNCBook *book, const char *type_name,
gnc_business_chooser_new_cb new_cb,
gnc_business_chooser_edit_cb edit_cb,
gpointer cbarg)
{
struct business_chooser_window * win =
g_new0(struct business_chooser_window, 1);
GladeXML *xml;
GtkWidget *choice_name_label;
gpointer retval;
if (!book || !type_name) return NULL;
xml = gnc_glade_xml_new ("business-chooser.glade",
"Business Chooser Dialog");
/* Grab the widgets */
win->dialog = glade_xml_get_widget (xml, "Business Chooser Dialog");
win->choice_combo = glade_xml_get_widget (xml, "choice_combo");
win->choice_entry = glade_xml_get_widget (xml, "choice_entry");
win->showall_check = glade_xml_get_widget (xml, "showall_check");
/* Set the label */
choice_name_label = glade_xml_get_widget (xml, "choice_name_label");
gtk_label_set_text (GTK_LABEL (choice_name_label),
gncObjectGetTypeLabel (type_name));
if(parent) {
gnome_dialog_set_parent(GNOME_DIALOG(win->dialog), GTK_WINDOW(parent));
}
/* Setup the signals */
glade_xml_signal_connect_data
(xml, "gnc_ui_business_chooser_ok_cb",
GTK_SIGNAL_FUNC (gnc_ui_business_chooser_ok_cb), win);
glade_xml_signal_connect_data
(xml, "gnc_ui_business_chooser_new_cb",
GTK_SIGNAL_FUNC (gnc_ui_business_chooser_new_cb), win);
glade_xml_signal_connect_data
(xml, "gnc_ui_business_chooser_edit_cb",
GTK_SIGNAL_FUNC (gnc_ui_business_chooser_edit_cb), win);
glade_xml_signal_connect_data
(xml, "gnc_ui_business_chooser_cancel_cb",
GTK_SIGNAL_FUNC (gnc_ui_business_chooser_cancel_cb), win);
glade_xml_signal_connect_data
(xml, "gnc_ui_business_chooser_showall_toggled_cb",
GTK_SIGNAL_FUNC (gnc_ui_business_chooser_showall_toggled_cb), win);
gtk_signal_connect (GTK_OBJECT (GTK_COMBO (win->choice_combo)->list),
"select-child",
GTK_SIGNAL_FUNC(chooser_choice_changed_cb), win);
gtk_signal_connect (GTK_OBJECT(win->dialog), "close",
GTK_SIGNAL_FUNC(business_chooser_close), win);
/* Save the callbacks */
win->obj_type = type_name;
win->new_cb = new_cb;
win->edit_cb = edit_cb;
win->cb_arg = cbarg;
win->query = gncQueryCreate ();
gncQuerySetBook (win->query, book);
/* Setup the menu */
win->selected = orig_sel;
update_selection_picker (win);
/* Run the widget */
gtk_window_set_modal(GTK_WINDOW(win->dialog), TRUE);
gtk_widget_show (win->dialog);
gtk_main();
/* And exit */
retval = win->selected;
gncQueryDestroy (win->query);
g_free(win);
return retval;
}

View File

@ -1,209 +0,0 @@
<?xml version="1.0"?>
<GTK-Interface>
<project>
<name>Business-chooser</name>
<program_name>business-chooser</program_name>
<directory></directory>
<source_directory>src</source_directory>
<pixmaps_directory>pixmaps</pixmaps_directory>
<language>C</language>
<gnome_support>True</gnome_support>
<gettext_support>True</gettext_support>
<output_main_file>False</output_main_file>
<output_support_files>False</output_support_files>
<output_build_files>False</output_build_files>
<backup_source_files>False</backup_source_files>
</project>
<widget>
<class>GnomeDialog</class>
<name>Business Chooser Dialog</name>
<title>Chooser</title>
<type>GTK_WINDOW_TOPLEVEL</type>
<position>GTK_WIN_POS_NONE</position>
<modal>False</modal>
<allow_shrink>True</allow_shrink>
<allow_grow>True</allow_grow>
<auto_shrink>False</auto_shrink>
<auto_close>False</auto_close>
<hide_on_close>False</hide_on_close>
<widget>
<class>GtkVBox</class>
<child_name>GnomeDialog:vbox</child_name>
<name>vbox1</name>
<homogeneous>False</homogeneous>
<spacing>8</spacing>
<child>
<padding>4</padding>
<expand>True</expand>
<fill>True</fill>
</child>
<widget>
<class>GtkHButtonBox</class>
<child_name>GnomeDialog:action_area</child_name>
<name>hbuttonbox1</name>
<layout_style>GTK_BUTTONBOX_SPREAD</layout_style>
<spacing>8</spacing>
<child_min_width>85</child_min_width>
<child_min_height>27</child_min_height>
<child_ipad_x>7</child_ipad_x>
<child_ipad_y>0</child_ipad_y>
<child>
<padding>0</padding>
<expand>False</expand>
<fill>True</fill>
<pack>GTK_PACK_END</pack>
</child>
<widget>
<class>GtkButton</class>
<name>button1</name>
<can_default>True</can_default>
<can_focus>True</can_focus>
<signal>
<name>clicked</name>
<handler>gnc_ui_business_chooser_ok_cb</handler>
<data>Business_Chooser_Dialog</data>
<last_modification_time>Sat, 10 Nov 2001 23:06:48 GMT</last_modification_time>
</signal>
<stock_button>GNOME_STOCK_BUTTON_OK</stock_button>
</widget>
<widget>
<class>GtkButton</class>
<name>button2</name>
<can_default>True</can_default>
<can_focus>True</can_focus>
<signal>
<name>clicked</name>
<handler>gnc_ui_business_chooser_new_cb</handler>
<data>Business_Chooser_Dialog</data>
<last_modification_time>Sat, 10 Nov 2001 23:07:01 GMT</last_modification_time>
</signal>
<label>New...</label>
</widget>
<widget>
<class>GtkButton</class>
<name>button3</name>
<can_default>True</can_default>
<can_focus>True</can_focus>
<signal>
<name>clicked</name>
<handler>gnc_ui_business_chooser_edit_cb</handler>
<data>Business_Chooser_Dialog</data>
<last_modification_time>Sun, 11 Nov 2001 02:16:31 GMT</last_modification_time>
</signal>
<label>Edit...</label>
</widget>
<widget>
<class>GtkButton</class>
<name>button4</name>
<can_default>True</can_default>
<can_focus>True</can_focus>
<signal>
<name>clicked</name>
<handler>gnc_ui_business_chooser_cancel_cb</handler>
<data>Business_Chooser_Dialog</data>
<last_modification_time>Sat, 10 Nov 2001 23:07:12 GMT</last_modification_time>
</signal>
<stock_button>GNOME_STOCK_BUTTON_CANCEL</stock_button>
</widget>
</widget>
<widget>
<class>GtkVBox</class>
<name>vbox3</name>
<homogeneous>False</homogeneous>
<spacing>0</spacing>
<child>
<padding>0</padding>
<expand>False</expand>
<fill>False</fill>
</child>
<widget>
<class>GtkCheckButton</class>
<name>showall_check</name>
<can_focus>True</can_focus>
<signal>
<name>toggled</name>
<handler>gnc_ui_business_chooser_showall_toggled_cb</handler>
<data>Business_Chooser_Dialog</data>
<last_modification_time>Thu, 15 Nov 2001 15:49:23 GMT</last_modification_time>
</signal>
<label>Show All</label>
<active>False</active>
<draw_indicator>True</draw_indicator>
<child>
<padding>0</padding>
<expand>False</expand>
<fill>False</fill>
</child>
</widget>
<widget>
<class>GtkHBox</class>
<name>hbox2</name>
<homogeneous>False</homogeneous>
<spacing>0</spacing>
<child>
<padding>0</padding>
<expand>True</expand>
<fill>True</fill>
</child>
<widget>
<class>GtkLabel</class>
<name>choice_name_label</name>
<label>Current Choice:</label>
<justify>GTK_JUSTIFY_RIGHT</justify>
<wrap>False</wrap>
<xalign>1</xalign>
<yalign>0.5</yalign>
<xpad>0</xpad>
<ypad>0</ypad>
<child>
<padding>3</padding>
<expand>False</expand>
<fill>False</fill>
</child>
</widget>
<widget>
<class>GtkCombo</class>
<name>choice_combo</name>
<width>250</width>
<value_in_list>True</value_in_list>
<ok_if_empty>True</ok_if_empty>
<case_sensitive>False</case_sensitive>
<use_arrows>True</use_arrows>
<use_arrows_always>False</use_arrows_always>
<items></items>
<child>
<padding>3</padding>
<expand>True</expand>
<fill>True</fill>
</child>
<widget>
<class>GtkEntry</class>
<child_name>GtkCombo:entry</child_name>
<name>choice_entry</name>
<can_focus>True</can_focus>
<editable>False</editable>
<text_visible>True</text_visible>
<text_max_length>0</text_max_length>
<text></text>
</widget>
</widget>
</widget>
</widget>
</widget>
</widget>
</GTK-Interface>

View File

@ -1,35 +0,0 @@
/*
* business-chooser.h -- General Selection Dialog for GNC Business Objects
*
* Written By: Derek Atkins <warlord@MIT.EDU>
* Copyright (C) 2001
*/
#ifndef GNC_BUSINESS_CHOOSER_H_
#define GNC_BUSINESS_CHOOSER_H_
/*
* Generic function to choose business objects. This function
* is only called from within the business objects, but is made
* available here so other objects can use it. You provide the
* original selection, the Object Type Name (as registered),
* callbacks to call to create a new object or to edit an existing
* one, and a callback argument that is passed to the callbacks.
*
* Note that if a callback function is NULL, the associated button
* will still be clickable but will do nothing. XXXX -- this is a bug
*/
typedef gpointer (*gnc_business_chooser_new_cb)(gpointer cbarg, GtkWidget *toplevel);
typedef void (*gnc_business_chooser_edit_cb)(gpointer cbarg, gpointer sel_obj, GtkWidget *toplevel);
gpointer
gnc_ui_business_chooser_new (GtkWidget * parent,
gpointer orig_sel,
GNCBook *book, const char *type_name,
gnc_business_chooser_new_cb new_cb,
gnc_business_chooser_edit_cb edit_cb,
gpointer cbarg);
#endif /* GNC_BUSINESS_CHOOSER_H_ */

View File

@ -7,7 +7,9 @@
(gnc:module-load "gnucash/gnome-search" 0)
(define (add-customer-extensions)
(let ((last-cust (gnc:owner-create)))
(let ((last-cust (gnc:owner-create))
(last-order #f)
(last-invoice #f))
(define customer-menu
(gnc:make-menu (N_ "Customers")
@ -24,15 +26,15 @@
(gnc:owner-init-customer last-cust cust))))))
(define select-customer-item
(gnc:make-menu-item (N_ "Customer Selection")
(N_ "Customer Selection")
(gnc:make-menu-item (N_ "Find Customer")
(N_ "Find Customer")
(list "Extensions" "Customers" "")
(lambda ()
(let ((cust (gnc:customer-select
(gnc:get-current-book)
(let ((cust (gnc:customer-find
#f
(gnc:owner-get-customer
last-cust)
#f)))
(gnc:get-current-book))))
(if (not (null? cust))
(gnc:owner-init-customer last-cust cust))))))
@ -41,28 +43,60 @@
(N_ "New Order")
(list "Extensions" "Customers" "")
(lambda ()
(gnc:order-new #f last-cust
(gnc:get-current-book)))))
(let ((order (gnc:order-new
#f last-cust
(gnc:get-current-book))))
(if (not (null? order))
(set! last-order order))))))
(define find-order-item
(gnc:make-menu-item (N_ "Find Order")
(N_ "Find Order")
(list "Extensions" "Customers" "")
(lambda ()
(let ((order (gnc:order-find
#f last-order last-cust
(gnc:get-current-book))))
(if (not (null? order))
(set! last-order order))))))
(define new-invoice-item
(gnc:make-menu-item (N_ "New Invoice")
(N_ "New Invoice")
(list "Extensions" "Customers" "")
(lambda ()
(gnc:invoice-new #f last-cust
(gnc:get-current-book)))))
(let ((invoice (gnc:invoice-new
#f last-cust
(gnc:get-current-book))))
(if (not (null? invoice))
(set! last-invoice invoice))))))
(define find-invoice-item
(gnc:make-menu-item (N_ "Find Invoice")
(N_ "Find Invoice")
(list "Extensions" "Customers" "")
(lambda ()
(let ((invoice (gnc:invoice-find
#f last-invoice last-cust
(gnc:get-current-book))))
(if (not (null? invoice))
(set! last-invoice invoice))))))
(gnc:owner-init-customer last-cust #f)
(gnc:add-extension customer-menu)
(gnc:add-extension find-invoice-item)
(gnc:add-extension new-invoice-item)
(gnc:add-extension find-order-item)
(gnc:add-extension new-order-item)
(gnc:add-extension select-customer-item)
(gnc:add-extension new-customer-item)
))
(define (add-vendor-extensions)
(let ((last-vendor (gnc:owner-create)))
(let ((last-vendor (gnc:owner-create))
(last-order #f)
(last-invoice #f))
(define vendor-menu
(gnc:make-menu (N_ "Vendors")
@ -81,15 +115,15 @@
(define select-vendor-item
(gnc:make-menu-item (N_ "Vendor Selection")
(N_ "Vendor Selection")
(gnc:make-menu-item (N_ "Find Vendor")
(N_ "Find Vendor")
(list "Extensions" "Vendors" "")
(lambda ()
(let ((vendor (gnc:vendor-select
(gnc:get-current-book)
(let ((vendor (gnc:vendor-find
#f
(gnc:owner-get-vendor
last-vendor)
#f)))
(gnc:get-current-book))))
(if (not (null? vendor))
(gnc:owner-init-vendor last-vendor vendor))))))
@ -98,26 +132,90 @@
(N_ "New Order")
(list "Extensions" "Vendors" "")
(lambda ()
(gnc:order-new #f last-vendor
(gnc:get-current-book)))))
(let ((order (gnc:order-new
#f last-vendor
(gnc:get-current-book))))
(if (not (null? order))
(set! last-order order))))))
(define find-order-item
(gnc:make-menu-item (N_ "Find Order")
(N_ "Find Order")
(list "Extensions" "Vendors" "")
(lambda ()
(let ((order (gnc:order-find
#f last-order last-vendor
(gnc:get-current-book))))
(if (not (null? order))
(set! last-order order))))))
(define new-invoice-item
(gnc:make-menu-item (N_ "New Invoice")
(N_ "New Invoice")
(list "Extensions" "Vendors" "")
(lambda ()
(gnc:invoice-new #f last-vendor
(gnc:get-current-book)))))
(let ((invoice (gnc:invoice-new
#f last-vendor
(gnc:get-current-book))))
(if (not (null? invoice))
(set! last-invoice invoice))))))
(define find-invoice-item
(gnc:make-menu-item (N_ "Find Invoice")
(N_ "Find Invoice")
(list "Extensions" "Vendors" "")
(lambda ()
(let ((invoice (gnc:invoice-find
#f last-invoice last-vendor
(gnc:get-current-book))))
(if (not (null? invoice))
(set! last-invoice invoice))))))
(gnc:owner-init-vendor last-vendor #f)
(gnc:add-extension vendor-menu)
(gnc:add-extension find-invoice-item)
(gnc:add-extension new-invoice-item)
(gnc:add-extension find-order-item)
(gnc:add-extension new-order-item)
(gnc:add-extension select-vendor-item)
(gnc:add-extension new-vendor-item)
))
(define (add-employee-extensions)
(let ((last-employee #f))
(define employee-menu
(gnc:make-menu (N_ "Employees")
(list "Extensions" "")))
(define new-employee-item
(gnc:make-menu-item (N_ "New Employee")
(N_ "New Employee")
(list "Extensions" "Employees" "")
(lambda ()
(let ((employee (gnc:employee-new
#f (gnc:get-current-book))))
(if (not (null? employee))
(set! last-employee employee))))))
(define select-employee-item
(gnc:make-menu-item (N_ "Find Employee")
(N_ "Find Employee")
(list "Extensions" "Employees" "")
(lambda ()
(let ((employee (gnc:employee-find
#f
last-employee
(gnc:get-current-book))))
(if (not (null? employee))
(set! last-employee employee))))))
(gnc:add-extension employee-menu)
(gnc:add-extension select-employee-item)
(gnc:add-extension new-employee-item)
))
(define (add-business-extensions)
(define gnc:extensions-last-order #f)
@ -138,36 +236,6 @@
(gnc:job-select #f (gnc:get-current-book)
#f #f))))
(define new-employee-item
(gnc:make-menu-item (N_ "Test New Employee Dialog")
(N_ "Test New Employee Dialog")
(list "Extensions" "")
(lambda ()
(gnc:employee-new #f (gnc:get-current-book)))))
(define select-employee-item
(gnc:make-menu-item (N_ "Test Employee Selection Dialog")
(N_ "Test Employee Selection Dialog")
(list "Extensions" "")
(lambda ()
(gnc:employee-select (gnc:get-current-book)
#f #f))))
(define edit-order-item
(gnc:make-menu-item (N_ "Test Edit/View Order Dialog")
(N_ "Test Edit/View Order Dialog")
(list "Extensions" "")
(lambda ()
(gnc:order-edit #f gnc:extensions-last-order))))
(define edit-invoice-item
(gnc:make-menu-item (N_ "Test Edit/View Invoice Dialog")
(N_ "Test Edit/View Invoice Dialog")
(list "Extensions" "")
(lambda ()
(gnc:invoice-edit #f gnc:extensions-last-invoice))))
(define test-search
(gnc:make-menu-item (N_ "Test Search Dialog")
(N_ "Test Search Dialog")
@ -176,14 +244,11 @@
(gnc:search-dialog-test))))
;; (gnc:add-extension edit-invoice-item)
;; (gnc:add-extension edit-order-item)
(gnc:add-extension test-search)
(gnc:add-extension select-employee-item)
(gnc:add-extension new-employee-item)
(gnc:add-extension select-job-item)
(gnc:add-extension new-job-item)
(add-employee-extensions)
(add-vendor-extensions)
(add-customer-extensions)
)

View File

@ -117,3 +117,16 @@ void gnc_owner_get_owner (GtkWidget *widget, GncOwner *owner)
owner->owner.undefined =
gnc_general_select_get_selected (GNC_GENERAL_SELECT (widget));
}
void gnc_owner_set_owner (GtkWidget *widget, GncOwner *owner)
{
g_return_if_fail (widget != NULL);
g_return_if_fail (owner != NULL);
/* We'll assume that the owner has the proper 'type' because we
* can't change it here. Hopefully the caller has it set properly
*/
gnc_general_select_set_selected (GNC_GENERAL_SELECT (widget),
owner->owner.undefined);
}

View File

@ -19,5 +19,6 @@ GtkWidget * gnc_owner_edit_create (GtkWidget *label, GtkWidget *hbox,
GNCBook *book, GncOwner *owner);
void gnc_owner_get_owner (GtkWidget *widget, GncOwner *owner);
void gnc_owner_set_owner (GtkWidget *widget, GncOwner *owner);
#endif /* GNC_BUSINESS_UTILS_H_ */

View File

@ -40,13 +40,16 @@ gnc_module_init(int refcount)
if (!gnc_module_load ("gnucash/business-core", 0)) {
return FALSE;
}
/* We also depend on app-utils and gnome-utils modules */
/* We also depend on app-utils, gnome-utils, and gnome-search modules */
if (!gnc_module_load ("gnucash/app-utils", 0)) {
return FALSE;
}
if (!gnc_module_load ("gnucash/gnome-utils", 0)) {
return FALSE;
}
if (!gnc_module_load ("gnucash/gnome-search", 0)) {
return FALSE;
}
gh_eval_str("(use-modules (g-wrapped gw-business-gnome))");
gh_eval_str("(use-modules (gnucash business-gnome))");

View File

@ -18,12 +18,17 @@
#include "gnc-engine-util.h"
#include "window-help.h"
#include "dialog-search.h"
#include "search-param.h"
#include "gncAddress.h"
#include "gncCustomer.h"
#include "gncCustomerP.h"
#include "dialog-customer.h"
#include "business-chooser.h"
#include "dialog-job-select.h"
#include "dialog-order.h"
#include "dialog-invoice.h"
#define DIALOG_NEW_CUSTOMER_CM_CLASS "dialog-new-customer"
#define DIALOG_EDIT_CUSTOMER_CM_CLASS "dialog-edit-customer"
@ -36,6 +41,7 @@ typedef enum
struct _customer_select_window {
GNCBook * book;
GtkWidget * parent;
};
typedef struct _customer_window {
@ -626,41 +632,156 @@ gnc_customer_edit (GtkWidget *parent, GncCustomer *cust)
return;
}
/* Functions for widgets for customer selection */
/* Functions for customer selection widgets */
static gpointer gnc_customer_edit_new_cb (gpointer arg, GtkWidget *toplevel)
static gboolean
invoice_customer_cb (gpointer *cust_p, gpointer user_data)
{
struct _customer_select_window *sw = arg;
struct _customer_select_window *sw = user_data;
GncOwner owner;
GncCustomer *cust;
if (!arg) return NULL;
g_return_val_if_fail (cust_p && user_data, TRUE);
return gnc_customer_new (toplevel, sw->book);
cust = *cust_p;
if (!cust)
return TRUE;
gncOwnerInitCustomer (&owner, cust);
gnc_invoice_find (sw->parent, NULL, &owner, sw->book);
return TRUE;
}
static void gnc_customer_edit_edit_cb (gpointer arg, gpointer obj, GtkWidget *toplevel)
static gboolean
order_customer_cb (gpointer *cust_p, gpointer user_data)
{
GncCustomer *cust = obj;
struct _customer_select_window *sw = user_data;
GncOwner owner;
GncCustomer *cust;
if (!arg || !obj) return;
g_return_val_if_fail (cust_p && user_data, TRUE);
gnc_customer_edit (toplevel, cust);
cust = *cust_p;
if (!cust)
return TRUE;
gncOwnerInitCustomer (&owner, cust);
gnc_order_find (sw->parent, NULL, &owner, sw->book);
return TRUE;
}
static gboolean
jobs_customer_cb (gpointer *cust_p, gpointer user_data)
{
struct _customer_select_window *sw = user_data;
GncOwner owner;
GncCustomer *cust;
g_return_val_if_fail (cust_p && user_data, TRUE);
cust = *cust_p;
if (!cust)
return TRUE;
gncOwnerInitCustomer (&owner, cust);
gnc_ui_select_job_new (sw->parent, sw->book, &owner, NULL);
return TRUE;
}
static gboolean
edit_customer_cb (gpointer *cust_p, gpointer user_data)
{
struct _customer_select_window *sw = user_data;
GncCustomer *cust;
g_return_val_if_fail (cust_p && user_data, TRUE);
cust = *cust_p;
if (!cust)
return TRUE;
gnc_customer_edit (sw->parent, cust);
return TRUE;
}
static gboolean
select_customer_cb (gpointer *cust_p, gpointer user_data)
{
g_return_val_if_fail (cust_p && user_data, TRUE);
if (*cust_p)
return FALSE;
return TRUE;
}
static gpointer
new_customer_cb (gpointer user_data)
{
struct _customer_select_window *sw = user_data;
g_return_val_if_fail (user_data, NULL);
return gnc_customer_new (sw->parent, sw->book);
}
GncCustomer *
gnc_customer_find (GtkWidget *parent, GncCustomer *start, GNCBook *book)
{
GList *params = NULL;
gpointer res;
QueryNew *q, *q2 = NULL;
GNCSearchCallbackButton buttons[] = {
{ N_("Select Customer"), select_customer_cb},
{ N_("View/Edit Customer"), edit_customer_cb},
{ N_("Customer Jobs"), jobs_customer_cb},
{ N_("Customer Orders"), order_customer_cb},
{ N_("Customer Invoices"), invoice_customer_cb},
{ NULL },
};
GNCIdType type = GNC_CUSTOMER_MODULE_NAME;
struct _customer_select_window sw;
g_return_val_if_fail (book, NULL);
/* Build parameter list in reverse order*/
params = gnc_search_param_prepend (params, _("Shipping Contact"), NULL, type,
CUSTOMER_SHIPADDR, ADDRESS_NAME, NULL);
params = gnc_search_param_prepend (params, _("Billing Contact"), NULL, type,
CUSTOMER_ADDR, ADDRESS_NAME, NULL);
params = gnc_search_param_prepend (params, _("Customer Name"), NULL, type,
CUSTOMER_NAME, NULL);
params = gnc_search_param_prepend (params, _("Customer ID"), NULL, type,
CUSTOMER_ID, NULL);
/* Build the queries */
q = gncQueryCreate ();
gncQuerySetBook (q, book);
if (start) {
q2 = gncQueryCopy (q);
gncQueryAddGUIDMatch (q2, g_slist_prepend (NULL, CUSTOMER_GUID),
gncCustomerGetGUID (start), QUERY_AND);
}
/* launch select dialog and return the result */
sw.book = book;
sw.parent = parent;
res = gnc_search_dialog_choose_object (type, params, q, q2, buttons,
NULL, new_customer_cb, &sw);
gncQueryDestroy (q);
return res;
}
gpointer gnc_customer_edit_new_select (gpointer bookp, gpointer cust,
GtkWidget *toplevel)
{
GNCBook *book = bookp;
struct _customer_select_window sw;
g_return_val_if_fail (bookp != NULL, NULL);
sw.book = book;
return
gnc_ui_business_chooser_new (toplevel, cust,
book, GNC_CUSTOMER_MODULE_NAME,
gnc_customer_edit_new_cb,
gnc_customer_edit_edit_cb, &sw);
return gnc_customer_find (toplevel, cust, bookp);
}
gpointer gnc_customer_edit_new_edit (gpointer bookp, gpointer cust,

View File

@ -12,6 +12,9 @@
GncCustomer * gnc_customer_new (GtkWidget *parent, GNCBook *book);
void gnc_customer_edit (GtkWidget *parent, GncCustomer *cust);
GncCustomer *gnc_customer_find (GtkWidget *parent, GncCustomer *start,
GNCBook *book);
/* Callbacks to select a customer that match the necessary functions
* for use with the gnc_general_select widget.
*

View File

@ -17,13 +17,14 @@
#include "gnc-ui-util.h"
#include "gnc-engine-util.h"
#include "window-help.h"
#include "dialog-search.h"
#include "search-param.h"
#include "gncAddress.h"
#include "gncEmployee.h"
#include "gncEmployeeP.h"
#include "dialog-employee.h"
#include "business-chooser.h"
#define DIALOG_NEW_EMPLOYEE_CM_CLASS "dialog-new-employee"
#define DIALOG_EDIT_EMPLOYEE_CM_CLASS "dialog-edit-employee"
@ -36,6 +37,7 @@ typedef enum
struct _employee_select_window {
GNCBook * book;
GtkWidget * parent;
};
typedef struct _employee_window {
@ -531,41 +533,93 @@ gnc_employee_edit (GtkWidget *parent, GncEmployee *employee)
return;
}
/* Functions for widgets for employee selection */
/* Functions for employee selection widgets */
static gpointer gnc_employee_edit_new_cb (gpointer arg, GtkWidget *toplevel)
static gboolean
edit_employee_cb (gpointer *employee_p, gpointer user_data)
{
struct _employee_select_window *sw = arg;
struct _employee_select_window *sw = user_data;
GncEmployee *employee;
if (!arg) return NULL;
g_return_val_if_fail (employee_p && user_data, TRUE);
return gnc_employee_new (toplevel, sw->book);
employee = *employee_p;
if (!employee)
return TRUE;
gnc_employee_edit (sw->parent, employee);
return TRUE;
}
static void gnc_employee_edit_edit_cb (gpointer arg, gpointer obj, GtkWidget *toplevel)
static gboolean
select_employee_cb (gpointer *employee_p, gpointer user_data)
{
GncEmployee *employee = obj;
g_return_val_if_fail (employee_p && user_data, TRUE);
if (*employee_p)
return FALSE;
return TRUE;
}
if (!arg || !obj) return;
static gpointer
new_employee_cb (gpointer user_data)
{
struct _employee_select_window *sw = user_data;
g_return_val_if_fail (user_data, NULL);
gnc_employee_edit (toplevel, employee);
return gnc_employee_new (sw->parent, sw->book);
}
GncEmployee *
gnc_employee_find (GtkWidget *parent, GncEmployee *start, GNCBook *book)
{
GList *params = NULL;
gpointer res;
QueryNew *q, *q2 = NULL;
GNCSearchCallbackButton buttons[] = {
{ N_("Select Employee"), select_employee_cb},
{ N_("View/Edit Employee"), edit_employee_cb},
{ NULL },
};
GNCIdType type = GNC_EMPLOYEE_MODULE_NAME;
struct _employee_select_window sw;
g_return_val_if_fail (book, NULL);
/* Build parameter list in reverse order*/
params = gnc_search_param_prepend (params, _("Employee Name"), NULL,
type, EMPLOYEE_ADDR, ADDRESS_NAME, NULL);
params = gnc_search_param_prepend (params, _("Employee Username"), NULL,
type, EMPLOYEE_USERNAME, NULL);
params = gnc_search_param_prepend (params, _("Employee ID"), NULL, type,
EMPLOYEE_ID, NULL);
/* Build the queries */
q = gncQueryCreate ();
gncQuerySetBook (q, book);
if (start) {
q2 = gncQueryCopy (q);
gncQueryAddGUIDMatch (q2, g_slist_prepend (NULL, EMPLOYEE_GUID),
gncEmployeeGetGUID (start), QUERY_AND);
}
/* launch select dialog and return the result */
sw.book = book;
sw.parent = parent;
res = gnc_search_dialog_choose_object (type, params, q, q2, buttons,
NULL, new_employee_cb, &sw);
gncQueryDestroy (q);
return res;
}
gpointer gnc_employee_edit_new_select (gpointer bookp, gpointer employee,
GtkWidget *toplevel)
{
GNCBook *book = bookp;
struct _employee_select_window sw;
g_return_val_if_fail (bookp != NULL, NULL);
sw.book = book;
return
gnc_ui_business_chooser_new (toplevel, employee,
book, GNC_EMPLOYEE_MODULE_NAME,
gnc_employee_edit_new_cb,
gnc_employee_edit_edit_cb, &sw);
return gnc_employee_find (toplevel, employee, bookp);
}
gpointer gnc_employee_edit_new_edit (gpointer bookp, gpointer v,

View File

@ -11,6 +11,8 @@
/* Functions to create and edit employees */
GncEmployee * gnc_employee_new (GtkWidget *parent, GNCBook *book);
void gnc_employee_edit (GtkWidget *parent, GncEmployee *employee);
GncEmployee *gnc_employee_find (GtkWidget *parent, GncEmployee *start,
GNCBook *book);
/* Callbacks to select a employee that match the necessary functions
* for use with the gnc_general_select widget.

View File

@ -17,6 +17,8 @@
#include "gnc-engine-util.h"
#include "gnucash-sheet.h"
#include "window-help.h"
#include "dialog-search.h"
#include "search-param.h"
#include "gncInvoice.h"
#include "gncInvoiceP.h"
@ -24,7 +26,6 @@
#include "gncEntryLedger.h"
#include "dialog-invoice.h"
#include "business-chooser.h"
#include "business-utils.h"
#include "dialog-date-close.h"
@ -41,6 +42,8 @@ typedef enum
struct _invoice_select_window {
GNCBook * book;
GtkWidget * parent;
GncOwner * owner;
};
typedef struct _invoice_window {
@ -825,41 +828,120 @@ gnc_invoice_edit (GtkWidget *parent, GncInvoice *invoice)
return;
}
/* Functions for widgets for invoice selection */
/* Functions for invoice selection widgets */
static gpointer gnc_invoice_edit_new_cb (gpointer arg, GtkWidget *toplevel)
static gboolean
edit_invoice_cb (gpointer *invoice_p, gpointer user_data)
{
struct _invoice_select_window *sw = arg;
struct _invoice_select_window *sw = user_data;
GncInvoice *invoice;
if (!arg) return NULL;
g_return_val_if_fail (invoice_p && user_data, TRUE);
return gnc_invoice_new (toplevel, NULL, sw->book); /* XXX, set owner type? */
invoice = *invoice_p;
if (!invoice)
return TRUE;
gnc_invoice_edit (sw->parent, invoice);
return TRUE;
}
static void gnc_invoice_edit_edit_cb (gpointer arg, gpointer obj, GtkWidget *toplevel)
static gboolean
select_invoice_cb (gpointer *invoice_p, gpointer user_data)
{
GncInvoice *invoice = obj;
g_return_val_if_fail (invoice_p && user_data, TRUE);
if (*invoice_p)
return FALSE;
return TRUE;
}
if (!arg || !obj) return;
static gpointer
new_invoice_cb (gpointer user_data)
{
struct _invoice_select_window *sw = user_data;
g_return_val_if_fail (user_data, NULL);
gnc_invoice_edit (toplevel, invoice);
return gnc_invoice_new (sw->parent, sw->owner, sw->book);
}
GncInvoice *
gnc_invoice_find (GtkWidget *parent, GncInvoice *start, GncOwner *owner,
GNCBook *book)
{
GList *params = NULL;
gpointer res;
QueryNew *q, *q2 = NULL;
GNCSearchCallbackButton buttons[] = {
{ N_("Select Invoice"), select_invoice_cb},
{ N_("View/Edit Invoice"), edit_invoice_cb},
{ NULL },
};
GNCIdType type = GNC_INVOICE_MODULE_NAME;
struct _invoice_select_window sw;
g_return_val_if_fail (book, NULL);
/* Build parameter list in reverse invoice*/
params = gnc_search_param_prepend (params, _("Invoice Notes"), NULL, type,
INVOICE_NOTES, NULL);
params = gnc_search_param_prepend (params, _("Date Paid"), NULL, type,
INVOICE_PAID, NULL);
params = gnc_search_param_prepend (params, _("Is Paid?"), NULL, type,
INVOICE_IS_PAID, NULL);
params = gnc_search_param_prepend (params, _("Date Due"), NULL, type,
INVOICE_DUE, NULL);
params = gnc_search_param_prepend (params, _("Date Posted"), NULL, type,
INVOICE_POSTED, NULL);
params = gnc_search_param_prepend (params, _("Is Posted?"), NULL, type,
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, _("Invoice ID"), NULL, type,
INVOICE_ID, NULL);
/* Build the queries */
q = gncQueryCreate ();
gncQuerySetBook (q, book);
/* If owner is supplied, limit all searches to invoices who's owner
* is the supplied owner! Show all invoices by this owner.
*/
if (owner && gncOwnerGetGUID (owner)) {
gncQueryAddGUIDMatch (q, g_slist_prepend
(g_slist_prepend (NULL, OWNER_GUID),
INVOICE_OWNER),
gncOwnerGetGUID (owner), QUERY_AND);
q2 = gncQueryCopy (q);
}
if (start) {
if (q2 == NULL)
q2 = gncQueryCopy (q);
gncQueryAddGUIDMatch (q2, g_slist_prepend (NULL, INVOICE_GUID),
gncInvoiceGetGUID (start), QUERY_AND);
}
/* launch select dialog and return the result */
sw.book = book;
sw.parent = parent;
sw.owner = owner;
res = gnc_search_dialog_choose_object (type, params, q, q2, buttons,
NULL, new_invoice_cb, &sw);
gncQueryDestroy (q);
return res;
}
gpointer gnc_invoice_edit_new_select (gpointer bookp, gpointer invoice,
GtkWidget *toplevel)
{
GNCBook *book = bookp;
struct _invoice_select_window sw;
g_return_val_if_fail (bookp != NULL, NULL);
sw.book = book;
return
gnc_ui_business_chooser_new (toplevel, invoice,
book, GNC_INVOICE_MODULE_NAME,
gnc_invoice_edit_new_cb,
gnc_invoice_edit_edit_cb, &sw);
return gnc_invoice_find (toplevel, invoice, NULL, bookp);
}
gpointer gnc_invoice_edit_new_edit (gpointer bookp, gpointer v,

View File

@ -8,9 +8,14 @@
#ifndef GNC_DIALOG_INVOICE_H_
#define GNC_DIALOG_INVOICE_H_
#include "gncInvoice.h"
#include "gncOwner.h"
/* Functions to create and edit invoices */
GncInvoice * gnc_invoice_new (GtkWidget *parent, GncOwner *owner, GNCBook *book);
void gnc_invoice_edit (GtkWidget *parent, GncInvoice *invoice);
GncInvoice * gnc_invoice_find (GtkWidget *parent, GncInvoice *start,
GncOwner *owner, GNCBook *book);
/* Callbacks to select a invoice that match the necessary functions
* for use with the gnc_general_select widget.

View File

@ -13,49 +13,61 @@
#include "gnc-ui.h"
#include "gnc-gui-query.h"
#include "gncObject.h"
#include "QueryNew.h"
#include "gnc-general-select.h"
#include "gncJob.h"
#include "business-utils.h"
#include "dialog-job-select.h"
#include "dialog-job.h"
struct select_job_window {
GtkWidget * dialog;
GtkWidget * customer_combo;
GtkWidget * customer_entry;
GtkWidget * job_combo;
GtkWidget * job_entry;
GtkWidget * showcust_check;
GtkWidget * owner_hbox;
GtkWidget * owner_select;
GtkWidget * job_list;
GtkWidget * showjobs_check;
GNCBook * book;
GncJob * job;
GncOwner owner;
QueryNew * query;
GNCIdTypeConst owner_type;
};
static void
select_job_job_selected_cb(GtkListItem *item, struct select_job_window *w)
{
w->job = gtk_object_get_data (GTK_OBJECT (item), "item-list-pointer");
}
static void
update_job_select_picker (struct select_job_window *w)
{
GList *objs = NULL, *iterator;
GtkWidget *li;
GncJob *saved_job;
gboolean show_all = gtk_toggle_button_get_active (GTK_TOGGLE_BUTTON
(w->showjobs_check));
/* Clear out the existing choices */
gtk_list_clear_items (GTK_LIST (GTK_COMBO (w->job_combo)->list), 0, -1);
gtk_list_clear_items (GTK_LIST (w->job_list), 0, -1);
/*
* Fill out the list of jobs from the current owner
*/
/* Get the list of objects */
if (w->owner.owner.undefined == NULL) {
/* We have no owner, therefore there are no jobs */
w->job = NULL;
} else {
GList *objs = NULL, *iterator, *itemlist = NULL;
GtkWidget *li, *this_job = NULL;
GncJob *saved_job;
gboolean show_all = gtk_toggle_button_get_active (GTK_TOGGLE_BUTTON
(w->showjobs_check));
/* Get the list of jobs from this owner */
/* Save the current job */
saved_job = w->job;
w->job = NULL;
/* Get the list of jobs */
switch (gncOwnerGetType (&(w->owner))) {
case GNC_OWNER_CUSTOMER:
objs = gncCustomerGetJoblist (gncOwnerGetCustomer (&(w->owner)),
@ -68,126 +80,54 @@ update_job_select_picker (struct select_job_window *w)
default:
}
/* Build a list of strings (objs is pre-sorted, so keep the order!) */
/* Build a list of ListItems. objs is pre-sorted, so keep the order! */
for (iterator = objs; iterator; iterator = iterator->next) {
const gchar *label = gncObjectPrintable (GNC_JOB_MODULE_NAME,
iterator->data);
li = gtk_list_item_new_with_label (label);
gtk_object_set_data (GTK_OBJECT (li), "item-list-pointer", iterator->data);
gtk_signal_connect (GTK_OBJECT (li), "select",
GTK_SIGNAL_FUNC (select_job_job_selected_cb), w);
gtk_widget_show (li);
gtk_container_add (GTK_CONTAINER (GTK_COMBO (w->job_combo)->list), li);
itemlist = g_list_prepend (itemlist, li);
if (iterator->data == saved_job)
this_job = li;
}
/* And revert */
w->job = saved_job;
}
/* This will make sure we're in the right order at the end */
itemlist = g_list_reverse (itemlist);
/* No job list. Eit */
if (!objs)
w->job = NULL;
/* put the items into the List container */
if (itemlist)
gtk_list_prepend_items (GTK_LIST (w->job_list), itemlist);
else if (g_list_index (objs, w->job) == -1) {
/* job doesn't exist anymore!?! Choose something reasonable */
w->job = objs->data;
}
/* And select the appropriate item in the list. Choose the first
* item if we don't already have one
*/
if (this_job == NULL && itemlist)
this_job = itemlist->data;
/* And set the text label */
{
const char * label;
if (w->job)
label = gncObjectPrintable (GNC_JOB_MODULE_NAME, w->job);
else
label = "";
if (this_job)
gtk_list_select_child (GTK_LIST (w->job_list), this_job);
gtk_entry_set_text (GTK_ENTRY (w->job_entry), label);
}
g_list_free (objs);
}
static void
update_customer_select_picker (struct select_job_window *w)
{
GList *custs, *iterator;
GtkWidget *li;
GncOwner saved_owner;
gboolean show_all = gtk_toggle_button_get_active (GTK_TOGGLE_BUTTON
(w->showcust_check));
/* Clear out the existing choices */
gtk_list_clear_items (GTK_LIST (GTK_COMBO (w->customer_combo)->list), 0, -1);
/* Save the existing selection */
gncOwnerCopy (&(w->owner), &saved_owner);
/* Get the list of objects */
/* XXX: use show_all in the query */
custs = gncQueryRun (w->query, w->owner_type);
/* Build a list of strings (objs is pre-sorted, so keep the order!) */
for (iterator = custs; iterator; iterator = iterator->next) {
const gchar *label = gncObjectPrintable (w->owner_type, iterator->data);
li = gtk_list_item_new_with_label (label);
gtk_object_set_data (GTK_OBJECT (li), "item-list-pointer", iterator->data);
gtk_widget_show (li);
gtk_container_add (GTK_CONTAINER (GTK_COMBO (w->customer_combo)->list), li);
}
/* Revert the saved customer */
gncOwnerCopy (&saved_owner, &(w->owner));
if (! custs) {
/* no customers -- update the job picker (it will clear itself) */
w->owner.owner.undefined = NULL;
update_job_select_picker (w);
} else if (g_list_index (custs, w->owner.owner.undefined) == -1) {
/* customer doesn't exist anymore!?! Clear out the job, too */
w->owner.owner.undefined = custs->data;
update_job_select_picker (w);
}
/* And now set the current-selected item */
{
const char * label;
if (w->owner.owner.undefined)
label = gncObjectPrintable (w->owner_type, w->owner.owner.undefined);
else
label = "";
gtk_entry_set_text (GTK_ENTRY (w->customer_entry), label);
/* Don't free itemlist -- it's the properly of the List widget! */
g_list_free (objs);
}
}
static void
select_job_customer_changed_cb(GtkList *list, GtkWidget *li,
gpointer user_data)
update_owner_select_picker (struct select_job_window *w)
{
struct select_job_window * w = user_data;
if (!li)
return;
w->owner.owner.undefined =
gtk_object_get_data (GTK_OBJECT (li), "item-list-pointer");
w->job = NULL;
gnc_owner_set_owner (w->owner_select, &(w->owner));
update_job_select_picker (w);
}
static void
select_job_job_changed_cb(GtkList *list, GtkWidget *li, gpointer user_data)
select_job_owner_changed_cb (GtkWidget *widget, struct select_job_window *w)
{
struct select_job_window * w = user_data;
if (!li)
return;
w->job = gtk_object_get_data (GTK_OBJECT (li), "item-list-pointer");
gnc_owner_get_owner (widget, &(w->owner));
update_job_select_picker (w);
}
static void
@ -211,9 +151,8 @@ gnc_ui_select_job_new_cb(GtkButton * button, gpointer user_data)
if (new_selection) {
gncOwnerCopy (gncJobGetOwner (new_selection), &(w->owner));
update_customer_select_picker (w);
w->job = new_selection;
update_job_select_picker (w);
update_owner_select_picker (w);
}
}
@ -227,8 +166,7 @@ gnc_ui_select_job_edit_cb(GtkButton * button, gpointer user_data)
gnc_job_edit (w->dialog, w->job);
gncOwnerCopy (gncJobGetOwner (w->job), &(w->owner));
update_customer_select_picker (w);
update_job_select_picker (w);
update_owner_select_picker (w);
}
static void
@ -236,17 +174,10 @@ gnc_ui_select_job_cancel_cb(GtkButton * button, gpointer user_data)
{
struct select_job_window * w = user_data;
if (w)
if (w) {
w->job = NULL;
gnome_dialog_close(GNOME_DIALOG (w->dialog));
}
static void
gnc_ui_select_job_showcust_toggled_cb(GtkCheckButton * entry,
gpointer user_data)
{
struct select_job_window * w = user_data;
update_customer_select_picker (w);
}
}
static void
@ -272,8 +203,7 @@ gnc_ui_select_job_new (GtkWidget * parent, GNCBook *book,
struct select_job_window * win;
GladeXML *xml;
GncJob *retval;
GtkWidget *owner_label;
const char * type_name;
GtkWidget *owner_label, *owner_hbox;
g_return_val_if_fail (book != NULL, NULL);
@ -288,43 +218,19 @@ gnc_ui_select_job_new (GtkWidget * parent, GNCBook *book,
} else
gncOwnerInitCustomer (&(win->owner), NULL); /* XXX */
switch (gncOwnerGetType (&(win->owner))) {
case GNC_OWNER_CUSTOMER:
type_name = GNC_CUSTOMER_MODULE_NAME;
break;
case GNC_OWNER_VENDOR:
type_name = GNC_VENDOR_MODULE_NAME;
break;
default:
g_warning ("Cannot handle this owner type");
return NULL;
}
win->owner_type = type_name;
win->query = gncQueryCreate ();
gncQuerySetBook (win->query, book);
xml = gnc_glade_xml_new ("job.glade",
"Job Selector Dialog");
owner_label = glade_xml_get_widget (xml, "owner_label");
gtk_label_set_text (GTK_LABEL (owner_label),
gncObjectGetTypeLabel (type_name));
/* Grab the widgets */
win->dialog = glade_xml_get_widget (xml, "Job Selector Dialog");
win->customer_combo = glade_xml_get_widget (xml, "customer_combo");
win->customer_entry = glade_xml_get_widget (xml, "customer_entry");
win->showcust_check = glade_xml_get_widget (xml, "showcust_check");
win->job_combo = glade_xml_get_widget (xml, "job_combo");
win->job_entry = glade_xml_get_widget (xml, "job_entry");
win->job_list = glade_xml_get_widget (xml, "job_list");
win->showjobs_check = glade_xml_get_widget (xml, "showjobs_check");
if(parent) {
gnome_dialog_set_parent(GNOME_DIALOG(win->dialog), GTK_WINDOW(parent));
}
/* Setup the signals */
/* Connect the glade signals */
glade_xml_signal_connect_data
(xml, "gnc_ui_select_job_ok_cb",
GTK_SIGNAL_FUNC (gnc_ui_select_job_ok_cb), win);
@ -345,34 +251,29 @@ gnc_ui_select_job_new (GtkWidget * parent, GNCBook *book,
(xml, "gnc_ui_select_job_showjobs_toggled_cb",
GTK_SIGNAL_FUNC (gnc_ui_select_job_showjobs_toggled_cb), win);
glade_xml_signal_connect_data
(xml, "gnc_ui_select_job_showcust_toggled_cb",
GTK_SIGNAL_FUNC (gnc_ui_select_job_showcust_toggled_cb), win);
owner_label = glade_xml_get_widget (xml, "owner_label");
owner_hbox = glade_xml_get_widget (xml, "owner_hbox");
win->owner_select = gnc_owner_select_create (owner_label, owner_hbox,
book, &(win->owner));
gtk_signal_connect (GTK_OBJECT (GTK_COMBO (win->customer_combo)->list),
"select-child",
GTK_SIGNAL_FUNC(select_job_customer_changed_cb), win);
gtk_signal_connect (GTK_OBJECT (GTK_COMBO (win->job_combo)->list),
"select-child",
GTK_SIGNAL_FUNC(select_job_job_changed_cb), win);
gtk_signal_connect (GTK_OBJECT (win->owner_select), "changed",
GTK_SIGNAL_FUNC (select_job_owner_changed_cb),
win);
gtk_signal_connect (GTK_OBJECT(win->dialog), "close",
GTK_SIGNAL_FUNC(select_job_close), win);
/* Setup the menu */
update_customer_select_picker (win);
/* Setup the owner and job lists */
win->job = job;
update_job_select_picker (win);
update_owner_select_picker (win);
/* Run the widget */
gtk_window_set_modal(GTK_WINDOW(win->dialog), TRUE);
gtk_widget_show (win->dialog);
gtk_widget_show_all (win->dialog);
gtk_main();
/* exit */
retval = win->job;
gncQueryDestroy (win->query);
g_free(win);
return retval;

View File

@ -8,8 +8,11 @@
#ifndef GNC_DIALOG_JOB_SELECT_H_
#define GNC_DIALOG_JOB_SELECT_H_
#include "gncJob.h"
#include "gncOwner.h"
/* Create a dialog to select a job based upon potentially-existing
* customer and jobs. Allows creation of both jobs and customers.
* owner and jobs. Allows creation of both jobs and owners.
*/
GncJob *
gnc_ui_select_job_new (GtkWidget * parent, GNCBook *book,

View File

@ -19,7 +19,6 @@
#include "gncJob.h"
#include "gncJobP.h"
#include "business-chooser.h"
#include "business-utils.h"
#include "dialog-job-select.h"
#include "dialog-job.h"

View File

@ -8,6 +8,9 @@
#ifndef GNC_DIALOG_JOB_H_
#define GNC_DIALOG_JOB_H_
#include "gncJob.h"
#include "gncOwner.h"
/* Functions to create and edit jobs */
GncJob * gnc_job_new (GtkWidget *parent, GNCBook *book, GncOwner *owner);
void gnc_job_edit (GtkWidget *parent, GncJob *job);

View File

@ -17,6 +17,8 @@
#include "gnc-engine-util.h"
#include "gnucash-sheet.h"
#include "window-help.h"
#include "dialog-search.h"
#include "search-param.h"
#include "gncOrder.h"
#include "gncOrderP.h"
@ -25,7 +27,6 @@
#include "dialog-order.h"
#include "dialog-invoice.h"
#include "business-chooser.h"
#include "business-utils.h"
#include "dialog-date-close.h"
@ -42,6 +43,8 @@ typedef enum
struct _order_select_window {
GNCBook * book;
GtkWidget * parent;
GncOwner * owner;
};
typedef struct _order_window {
@ -724,41 +727,125 @@ gnc_order_edit (GtkWidget *parent, GncOrder *order)
return;
}
/* Functions for widgets for order selection */
/* Functions for order selection widgets */
static gpointer gnc_order_edit_new_cb (gpointer arg, GtkWidget *toplevel)
static gboolean
edit_order_cb (gpointer *order_p, gpointer user_data)
{
struct _order_select_window *sw = arg;
struct _order_select_window *sw = user_data;
GncOrder *order;
if (!arg) return NULL;
g_return_val_if_fail (order_p && user_data, TRUE);
return gnc_order_new (toplevel, NULL, sw->book); /* XXX, set owner type? */
order = *order_p;
if (!order)
return TRUE;
gnc_order_edit (sw->parent, order);
return TRUE;
}
static void gnc_order_edit_edit_cb (gpointer arg, gpointer obj, GtkWidget *toplevel)
static gboolean
select_order_cb (gpointer *order_p, gpointer user_data)
{
GncOrder *order = obj;
g_return_val_if_fail (order_p && user_data, TRUE);
if (*order_p)
return FALSE;
return TRUE;
}
if (!arg || !obj) return;
static gpointer
new_order_cb (gpointer user_data)
{
struct _order_select_window *sw = user_data;
g_return_val_if_fail (user_data, NULL);
gnc_order_edit (toplevel, order);
return gnc_order_new (sw->parent, sw->owner, sw->book);
}
GncOrder *
gnc_order_find (GtkWidget *parent, GncOrder *start, GncOwner *owner,
GNCBook *book)
{
GList *params = NULL;
gpointer res;
QueryNew *q, *q2 = NULL;
GNCSearchCallbackButton buttons[] = {
{ N_("Select Order"), select_order_cb},
{ N_("View/Edit Order"), edit_order_cb},
{ NULL },
};
GNCIdType type = GNC_ORDER_MODULE_NAME;
struct _order_select_window sw;
g_return_val_if_fail (book, NULL);
/* Build parameter list in reverse order*/
params = gnc_search_param_prepend (params, _("Order Notes"), NULL, type,
ORDER_NOTES, NULL);
params = gnc_search_param_prepend (params, _("Date Closed"), NULL, type,
ORDER_CLOSED, NULL);
params = gnc_search_param_prepend (params, _("Is Closed?"), NULL, type,
ORDER_IS_CLOSED, NULL);
params = gnc_search_param_prepend (params, _("Date Opened"), NULL, type,
ORDER_OPENED, NULL);
params = gnc_search_param_prepend (params, _("Owner Name "), NULL, type,
ORDER_OWNER, OWNER_NAME, NULL);
params = gnc_search_param_prepend (params, _("Order ID"), NULL, type,
ORDER_ID, NULL);
/* Build the queries */
q = gncQueryCreate ();
gncQuerySetBook (q, book);
/* If owner is supplied, limit all searches to orders who's owner
* (or parent) is the supplied owner!
*/
if (owner && gncOwnerGetGUID (owner)) {
QueryNew *tmp, *q3;
q3 = gncQueryCreate ();
gncQueryAddGUIDMatch (q3, g_slist_prepend
(g_slist_prepend (NULL, OWNER_GUID),
ORDER_OWNER),
gncOwnerGetGUID (owner), QUERY_OR);
gncQueryAddGUIDMatch (q3, g_slist_prepend
(g_slist_prepend (NULL, OWNER_PARENTG),
ORDER_OWNER),
gncOwnerGetGUID (owner), QUERY_OR);
tmp = gncQueryMerge (q, q3, QUERY_AND);
gncQueryDestroy (q);
gncQueryDestroy (q3);
q = tmp;
q2 = gncQueryCopy (q);
}
if (start) {
if (q2 == NULL)
q2 = gncQueryCopy (q);
gncQueryAddGUIDMatch (q2, g_slist_prepend (NULL, ORDER_GUID),
gncOrderGetGUID (start), QUERY_AND);
}
/* launch select dialog and return the result */
sw.book = book;
sw.parent = parent;
sw.owner = owner;
res = gnc_search_dialog_choose_object (type, params, q, q2, buttons,
NULL, new_order_cb, &sw);
gncQueryDestroy (q);
return res;
}
gpointer gnc_order_edit_new_select (gpointer bookp, gpointer order,
GtkWidget *toplevel)
{
GNCBook *book = bookp;
struct _order_select_window sw;
g_return_val_if_fail (bookp != NULL, NULL);
sw.book = book;
return
gnc_ui_business_chooser_new (toplevel, order,
book, GNC_ORDER_MODULE_NAME,
gnc_order_edit_new_cb,
gnc_order_edit_edit_cb, &sw);
return gnc_order_find (toplevel, order, NULL, bookp);
}
gpointer gnc_order_edit_new_edit (gpointer bookp, gpointer v,

View File

@ -8,9 +8,14 @@
#ifndef GNC_DIALOG_ORDER_H_
#define GNC_DIALOG_ORDER_H_
#include "gncOrder.h"
#include "gncOwner.h"
/* Functions to create and edit orders */
GncOrder * gnc_order_new (GtkWidget *parent, GncOwner *owner, GNCBook *book);
void gnc_order_edit (GtkWidget *parent, GncOrder *order);
GncOrder * gnc_order_find (GtkWidget *parent, GncOrder *start,
GncOwner *owner, GNCBook *book);
/* Callbacks to select a order that match the necessary functions
* for use with the gnc_general_select widget.

View File

@ -17,13 +17,14 @@
#include "gnc-ui-util.h"
#include "gnc-engine-util.h"
#include "window-help.h"
#include "dialog-search.h"
#include "search-param.h"
#include "gncAddress.h"
#include "gncVendor.h"
#include "gncVendorP.h"
#include "dialog-vendor.h"
#include "business-chooser.h"
#define DIALOG_NEW_VENDOR_CM_CLASS "dialog-new-vendor"
#define DIALOG_EDIT_VENDOR_CM_CLASS "dialog-edit-vendor"
@ -36,6 +37,7 @@ typedef enum
struct _vendor_select_window {
GNCBook * book;
GtkWidget * parent;
};
typedef struct _vendor_window {
@ -522,41 +524,93 @@ gnc_vendor_edit (GtkWidget *parent, GncVendor *vendor)
return;
}
/* Functions for widgets for vendor selection */
/* Functions for vendor selection widgets */
static gpointer gnc_vendor_edit_new_cb (gpointer arg, GtkWidget *toplevel)
static gboolean
edit_vendor_cb (gpointer *vendor_p, gpointer user_data)
{
struct _vendor_select_window *sw = arg;
struct _vendor_select_window *sw = user_data;
GncVendor *vendor;
if (!arg) return NULL;
g_return_val_if_fail (vendor_p && user_data, TRUE);
return gnc_vendor_new (toplevel, sw->book);
vendor = *vendor_p;
if (!vendor)
return TRUE;
gnc_vendor_edit (sw->parent, vendor);
return TRUE;
}
static void gnc_vendor_edit_edit_cb (gpointer arg, gpointer obj, GtkWidget *toplevel)
static gboolean
select_vendor_cb (gpointer *vendor_p, gpointer user_data)
{
GncVendor *vendor = obj;
g_return_val_if_fail (vendor_p && user_data, TRUE);
if (*vendor_p)
return FALSE;
return TRUE;
}
if (!arg || !obj) return;
static gpointer
new_vendor_cb (gpointer user_data)
{
struct _vendor_select_window *sw = user_data;
g_return_val_if_fail (user_data, NULL);
gnc_vendor_edit (toplevel, vendor);
return gnc_vendor_new (sw->parent, sw->book);
}
GncVendor *
gnc_vendor_find (GtkWidget *parent, GncVendor *start, GNCBook *book)
{
GList *params = NULL;
gpointer res;
QueryNew *q, *q2 = NULL;
GNCSearchCallbackButton buttons[] = {
{ N_("Select Vendor"), select_vendor_cb},
{ N_("View/Edit Vendor"), edit_vendor_cb},
{ NULL },
};
GNCIdType type = GNC_VENDOR_MODULE_NAME;
struct _vendor_select_window sw;
g_return_val_if_fail (book, NULL);
/* Build parameter list in reverse order*/
params = gnc_search_param_prepend (params, _("Billing Contact"), NULL, type,
VENDOR_ADDR, ADDRESS_NAME, NULL);
params = gnc_search_param_prepend (params, _("Vendor Name"), NULL, type,
VENDOR_NAME, NULL);
params = gnc_search_param_prepend (params, _("Vendor ID"), NULL, type,
VENDOR_ID, NULL);
/* Build the queries */
q = gncQueryCreate ();
gncQuerySetBook (q, book);
if (start) {
q2 = gncQueryCopy (q);
gncQueryAddGUIDMatch (q2, g_slist_prepend (NULL, VENDOR_GUID),
gncVendorGetGUID (start), QUERY_AND);
}
/* launch select dialog and return the result */
sw.book = book;
sw.parent = parent;
res = gnc_search_dialog_choose_object (type, params, q, q2, buttons,
NULL, new_vendor_cb, &sw);
gncQueryDestroy (q);
return res;
}
gpointer gnc_vendor_edit_new_select (gpointer bookp, gpointer vendor,
GtkWidget *toplevel)
{
GNCBook *book = bookp;
struct _vendor_select_window sw;
g_return_val_if_fail (bookp != NULL, NULL);
sw.book = book;
return
gnc_ui_business_chooser_new (toplevel, vendor,
book, GNC_VENDOR_MODULE_NAME,
gnc_vendor_edit_new_cb,
gnc_vendor_edit_edit_cb, &sw);
return gnc_vendor_find (toplevel, vendor, bookp);
}
gpointer gnc_vendor_edit_new_edit (gpointer bookp, gpointer v,

View File

@ -11,6 +11,8 @@
/* Functions to create and edit vendors */
GncVendor * gnc_vendor_new (GtkWidget *parent, GNCBook *book);
void gnc_vendor_edit (GtkWidget *parent, GncVendor *vendor);
GncVendor * gnc_vendor_find (GtkWidget *parent, GncVendor *start,
GNCBook *book);
/* Callbacks to select a vendor that match the necessary functions
* for use with the gnc_general_select widget.

View File

@ -71,12 +71,12 @@
(gw:wrap-function
ws
'gnc:customer-select
'gnc:customer-find
'<gnc:GncCustomer*>
"gnc_customer_edit_new_select"
'((<gnc:Book*> book) (<gnc:GncCustomer*> start_selection)
(<gnc:UIWidget> parent))
"Dialog: Select a GncCustomer. Parent and start_selection may be NULL.")
"gnc_customer_find"
'((<gnc:UIWidget> parent) (<gnc:GncCustomer*> start_selection)
(<gnc:Book*> book) )
"Dialog: Find a GncCustomer. Parent and start_selection may be NULL.")
;;
;; dialog-employee.h
@ -101,12 +101,12 @@
(gw:wrap-function
ws
'gnc:employee-select
'gnc:employee-find
'<gnc:GncEmployee*>
"gnc_employee_edit_new_select"
'((<gnc:Book*> book) (<gnc:GncEmployee*> start_selection)
(<gnc:UIWidget> parent))
"Dialog: Select a GncEmployee. Parent and start_selection may be NULL.")
"gnc_employee_find"
'((<gnc:UIWidget> parent) (<gnc:GncEmployee*> start_selection)
(<gnc:Book*> book))
"Dialog: Find a GncEmployee. Parent and start_selection may be NULL.")
;;
;; dialog-invoice.h
@ -131,12 +131,13 @@
(gw:wrap-function
ws
'gnc:invoice-select
'gnc:invoice-find
'<gnc:GncInvoice*>
"gnc_invoice_edit_new_select"
'((<gnc:Book*> book) (<gnc:GncInvoice*> start_selection)
(<gnc:UIWidget> parent))
"Dialog: Select a GncInvoice. Parent and start_selection may be NULL.")
"gnc_invoice_find"
'((<gnc:UIWidget> parent) (<gnc:GncInvoice*> start_selection)
(<gnc:GncOwner*> owner) (<gnc:Book*> book))
"Dialog: Select a GncInvoice. Any of the parent, start_selection, "
"and owner may be NULL.")
;;
;; dialog-job.h
@ -195,12 +196,13 @@
(gw:wrap-function
ws
'gnc:order-select
'gnc:order-find
'<gnc:GncOrder*>
"gnc_order_edit_new_select"
'((<gnc:Book*> book) (<gnc:GncOrder*> start_selection)
(<gnc:UIWidget> parent))
"Dialog: Select a GncOrder. Parent and start_selection may be NULL.")
"gnc_order_find"
'((<gnc:UIWidget> parent) (<gnc:GncOrder*> start_selection)
(<gnc:GncOwner*> order_owner) (<gnc:Book*> book) )
"Dialog: Select a GncOrder. Any of parent, start_selection, and "
"order_owner may be NULL.")
;;
;; dialog-vendor.h
@ -225,11 +227,11 @@
(gw:wrap-function
ws
'gnc:vendor-select
'gnc:vendor-find
'<gnc:GncVendor*>
"gnc_vendor_edit_new_select"
'((<gnc:Book*> book) (<gnc:GncVendor*> start_selection)
(<gnc:UIWidget> parent))
"gnc_vendor_find"
'((<gnc:UIWidget> parent) (<gnc:GncVendor*> start_selection)
(<gnc:Book*> book))
"Dialog: Select a GncVendor. Parent and start_selection may be NULL.")
)

View File

@ -351,6 +351,7 @@
<widget>
<class>GnomeDialog</class>
<name>Job Selector Dialog</name>
<title>Select Job</title>
<type>GTK_WINDOW_TOPLEVEL</type>
<position>GTK_WIN_POS_NONE</position>
<modal>False</modal>
@ -537,14 +538,11 @@
</widget>
<widget>
<class>GtkCombo</class>
<name>customer_combo</name>
<value_in_list>True</value_in_list>
<ok_if_empty>False</ok_if_empty>
<case_sensitive>False</case_sensitive>
<use_arrows>True</use_arrows>
<use_arrows_always>False</use_arrows_always>
<items></items>
<class>GtkHBox</class>
<name>owner_hbox</name>
<border_width>3</border_width>
<homogeneous>False</homogeneous>
<spacing>0</spacing>
<child>
<left_attach>1</left_attach>
<right_attach>2</right_attach>
@ -556,37 +554,23 @@
<yexpand>False</yexpand>
<xshrink>False</xshrink>
<yshrink>False</yshrink>
<xfill>False</xfill>
<yfill>False</yfill>
<xfill>True</xfill>
<yfill>True</yfill>
</child>
<widget>
<class>GtkEntry</class>
<child_name>GtkCombo:entry</child_name>
<name>customer_entry</name>
<can_focus>True</can_focus>
<signal>
<name>changed</name>
<handler>gnc_ui_select_job_customer_changed_cb</handler>
<data>Commodity_Selector_Dialog</data>
<last_modification_time>Tue, 13 Nov 2001 22:25:09 GMT</last_modification_time>
</signal>
<editable>False</editable>
<text_visible>True</text_visible>
<text_max_length>0</text_max_length>
<text></text>
<class>Placeholder</class>
</widget>
</widget>
<widget>
<class>GtkCombo</class>
<name>job_combo</name>
<value_in_list>True</value_in_list>
<ok_if_empty>False</ok_if_empty>
<case_sensitive>False</case_sensitive>
<use_arrows>True</use_arrows>
<use_arrows_always>False</use_arrows_always>
<items></items>
<class>GtkScrolledWindow</class>
<name>scrolledwindow1</name>
<border_width>3</border_width>
<hscrollbar_policy>GTK_POLICY_AUTOMATIC</hscrollbar_policy>
<vscrollbar_policy>GTK_POLICY_AUTOMATIC</vscrollbar_policy>
<hupdate_policy>GTK_UPDATE_CONTINUOUS</hupdate_policy>
<vupdate_policy>GTK_UPDATE_CONTINUOUS</vupdate_policy>
<child>
<left_attach>1</left_attach>
<right_attach>2</right_attach>
@ -598,19 +582,21 @@
<yexpand>False</yexpand>
<xshrink>False</xshrink>
<yshrink>False</yshrink>
<xfill>False</xfill>
<yfill>False</yfill>
<xfill>True</xfill>
<yfill>True</yfill>
</child>
<widget>
<class>GtkEntry</class>
<child_name>GtkCombo:entry</child_name>
<name>job_entry</name>
<can_focus>True</can_focus>
<editable>False</editable>
<text_visible>True</text_visible>
<text_max_length>0</text_max_length>
<text></text>
<class>GtkViewport</class>
<name>viewport1</name>
<shadow_type>GTK_SHADOW_IN</shadow_type>
<widget>
<class>GtkList</class>
<name>job_list</name>
<border_width>3</border_width>
<selection_mode>GTK_SELECTION_SINGLE</selection_mode>
</widget>
</widget>
</widget>
</widget>
@ -642,7 +628,7 @@
<widget>
<class>GtkTable</class>
<name>table1</name>
<rows>2</rows>
<rows>1</rows>
<columns>1</columns>
<homogeneous>False</homogeneous>
<row_spacing>0</row_spacing>
@ -653,35 +639,6 @@
<fill>False</fill>
</child>
<widget>
<class>GtkCheckButton</class>
<name>showcust_check</name>
<can_focus>True</can_focus>
<signal>
<name>toggled</name>
<handler>gnc_ui_select_job_showcust_toggled_cb</handler>
<data>Job_Selector_Dialog</data>
<last_modification_time>Sun, 11 Nov 2001 04:48:09 GMT</last_modification_time>
</signal>
<label>Show All Owners</label>
<active>False</active>
<draw_indicator>True</draw_indicator>
<child>
<left_attach>0</left_attach>
<right_attach>1</right_attach>
<top_attach>0</top_attach>
<bottom_attach>1</bottom_attach>
<xpad>0</xpad>
<ypad>0</ypad>
<xexpand>False</xexpand>
<yexpand>False</yexpand>
<xshrink>False</xshrink>
<yshrink>False</yshrink>
<xfill>True</xfill>
<yfill>False</yfill>
</child>
</widget>
<widget>
<class>GtkCheckButton</class>
<name>showjobs_check</name>
@ -698,8 +655,8 @@
<child>
<left_attach>0</left_attach>
<right_attach>1</right_attach>
<top_attach>1</top_attach>
<bottom_attach>2</bottom_attach>
<top_attach>0</top_attach>
<bottom_attach>1</bottom_attach>
<xpad>0</xpad>
<ypad>0</ypad>
<xexpand>False</xexpand>

View File

@ -45,6 +45,7 @@ struct _GNCSearchWindow {
/* Callbacks */
GNCSearchResultCB result_cb;
GNCSearchCallbackButton *buttons;
GNCSearchNewItemCB new_item_cb;
gpointer user_data;
/* What we're searching for, and how */
@ -96,6 +97,7 @@ static void
gnc_search_dialog_display_results (GNCSearchWindow *sw)
{
GList *list, *itemlist = NULL;
GtkWidget *selected = NULL;
/* Check if this is the first time this is called for this window.
* If so, then build the results sub-window, the scrolled listbox,
@ -158,10 +160,17 @@ gnc_search_dialog_display_results (GNCSearchWindow *sw)
gnc_search_dialog_select_item, sw);
itemlist = g_list_prepend (itemlist, item);
if (list->data == sw->selected_item)
selected = item;
}
itemlist = g_list_reverse (itemlist);
if (!selected && itemlist)
selected = itemlist->data;
gtk_list_prepend_items (GTK_LIST (sw->result_list), itemlist);
if (selected)
gtk_list_select_child (GTK_LIST (sw->result_list), selected);
gtk_widget_show_all (sw->result_list);
}
static void
@ -212,12 +221,6 @@ search_update_query (GNCSearchWindow *sw)
struct _crit_data *data = node->data;
QueryPredData_t pdata;
/* XXX: Ignore the last entry -- it's not been validated.
* XXX: Should we validate it?
*/
if (node->next == NULL)
break;
pdata = gnc_search_core_type_get_predicate (data->element);
if (pdata)
gncQueryAddTerm (q, gnc_search_param_get_param_path (data->param),
@ -314,6 +317,19 @@ search_find_cb (GtkButton *button, GNCSearchWindow *sw)
gnc_search_dialog_display_results (sw);
}
static void
search_new_item_cb (GtkButton *button, GNCSearchWindow *sw)
{
gpointer res;
g_return_if_fail (sw->new_item_cb);
res = (sw->new_item_cb)(sw->user_data);
if (res) {
sw->selected_item = res;
gnc_search_dialog_destroy (sw);
}
}
static void
search_cancel_cb (GtkButton *button, GNCSearchWindow *sw)
{
@ -535,6 +551,8 @@ gnc_search_dialog_init_widgets (GNCSearchWindow *sw)
GladeXML *xml;
GtkWidget *label, *pixmap, *add, *box;
GtkWidget *menu, *item, *omenu;
GtkWidget *new_item_button;
const char * type_label;
xml = gnc_glade_xml_new ("search.glade", "Search Dialog");
@ -550,8 +568,8 @@ gnc_search_dialog_init_widgets (GNCSearchWindow *sw)
/* Set the type label */
label = glade_xml_get_widget (xml, "type_label");
gtk_label_set_text (GTK_LABEL (label),
gncObjectGetTypeLabel (sw->search_for));
type_label = gncObjectGetTypeLabel (sw->search_for);
gtk_label_set_text (GTK_LABEL (label), type_label);
/* Set the 'add criterion' button */
pixmap = gnome_stock_new_with_icon (GNOME_STOCK_PIXMAP_ADD);
@ -591,14 +609,29 @@ 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");
/* Deal with the new_item button */
new_item_button = glade_xml_get_widget (xml, "new_item_button");
{
char *desc =
g_strdup_printf (_("New %s"), type_label ? type_label : _("item"));
gtk_label_set_text (GTK_LABEL (GTK_BIN (new_item_button)->child), desc);
g_free (desc);
}
/* show it all */
gtk_widget_show_all (sw->dialog);
/* Hide the 'new' button if there is no new_item_cb */
if (!sw->new_item_cb)
gtk_widget_hide_all (new_item_button);
/* Connect XML signals */
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_new_cb",
GTK_SIGNAL_FUNC (search_new_item_cb), sw);
glade_xml_signal_connect_data (xml, "gnc_ui_search_find_cb",
GTK_SIGNAL_FUNC (search_find_cb), sw);
@ -625,80 +658,58 @@ gnc_search_dialog_destroy (GNCSearchWindow *sw)
gnc_close_gui_component_by_data (DIALOG_SEARCH_CM_CLASS, sw);
}
static GNCSearchParam *
make_param (GNCIdTypeConst type, const char *title, const char *path1,
const char *path2, const char *path3)
{
GSList *l = NULL;
GNCSearchParam *param = gnc_search_param_new ();
gnc_search_param_set_title (param, title);
if (path3)
l = g_slist_prepend (l, (gpointer) path3);
if (path2)
l = g_slist_prepend (l, (gpointer) path2);
l = g_slist_prepend (l, (gpointer) path1);
gnc_search_param_set_param_path (param, type, l);
return param;
}
static GList *
get_params_list (GNCIdTypeConst type)
{
GList *list = NULL;
GNCSearchParam *param;
param = make_param (type, "Txn: All Accounts",
SPLIT_TRANS, TRANS_SPLITLIST, SPLIT_ACCOUNT_GUID);
gnc_search_param_override_param_type (param, "account-match-all");
list = g_list_prepend (list, param);
param = make_param (type, "Split Account", SPLIT_ACCOUNT, ACCOUNT_GUID,
NULL);
gnc_search_param_override_param_type (param, GNC_ID_ACCOUNT);
list = g_list_prepend (list, param);
list = g_list_prepend (list, make_param (type, "Split->Txn->Void?",
SPLIT_TRANS, TRANS_VOID_STATUS,
NULL));
list = g_list_prepend (list, make_param (type, "Split Int64",
"d-share-int64", NULL, NULL));
list = g_list_prepend (list, make_param (type, "Split Amount (double)",
"d-share-amount", NULL, NULL));
list = g_list_prepend (list, make_param (type, "Split Value (debcred)",
SPLIT_VALUE, NULL, NULL));
list = g_list_prepend (list, make_param (type, "Split Amount (numeric)",
SPLIT_AMOUNT, NULL, NULL));
list = g_list_prepend (list, make_param (type, "Date Reconciled (date)",
SPLIT_DATE_RECONCILED, NULL, NULL));
list = g_list_prepend (list, make_param (type, "Split Memo (string)",
SPLIT_MEMO, NULL, NULL));
list = gnc_search_param_prepend (list, "Txn: All Accounts",
"account-match-all",
type, SPLIT_TRANS, TRANS_SPLITLIST,
SPLIT_ACCOUNT_GUID, NULL);
list = gnc_search_param_prepend (list, "Split Account", GNC_ID_ACCOUNT,
type, SPLIT_ACCOUNT, ACCOUNT_GUID, NULL);
list = gnc_search_param_prepend (list, "Split->Txn->Void?", NULL, type,
SPLIT_TRANS, TRANS_VOID_STATUS, NULL);
list = gnc_search_param_prepend (list, "Split Int64", NULL, type,
"d-share-int64", NULL);
list = gnc_search_param_prepend (list, "Split Amount (double)", NULL, type,
"d-share-amount", NULL);
list = gnc_search_param_prepend (list, "Split Value (debcred)", NULL, type,
SPLIT_VALUE, NULL);
list = gnc_search_param_prepend (list, "Split Amount (numeric)", NULL, type,
SPLIT_AMOUNT, NULL);
list = gnc_search_param_prepend (list, "Date Reconciled (date)", NULL, type,
SPLIT_DATE_RECONCILED, NULL);
list = gnc_search_param_prepend (list, "Split Memo (string)", NULL, type,
SPLIT_MEMO, NULL);
return list;
}
GNCSearchWindow *
gnc_search_dialog_create (GNCIdTypeConst obj_type, QueryNew *start_query,
gboolean show_start_results,
gnc_search_dialog_create (GNCIdTypeConst obj_type, GList *param_list,
QueryNew *start_query, QueryNew *show_start_query,
GNCSearchCallbackButton *callbacks,
GNCSearchResultCB result_callback,
GNCSearchNewItemCB new_item_cb,
gpointer user_data)
{
GNCSearchWindow *sw = g_new0 (GNCSearchWindow, 1);
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);
/* Make sure the caller supplies callbacks xor result_callback */
g_return_val_if_fail ((callbacks && !result_callback) ||
(!callbacks && result_callback), NULL);
sw->search_for = obj_type;
sw->params_list = get_params_list (obj_type);
sw->params_list = param_list;
sw->buttons = callbacks;
sw->result_cb = result_callback;
sw->new_item_cb = new_item_cb;
sw->user_data = user_data;
if (start_query)
@ -707,8 +718,8 @@ gnc_search_dialog_create (GNCIdTypeConst obj_type, QueryNew *start_query,
gnc_search_dialog_init_widgets (sw);
/* Maybe display the original query results? */
if (callbacks && start_query && show_start_results) {
sw->q = gncQueryCopy (start_query);
if (callbacks && show_start_query) {
sw->q = show_start_query;
gnc_search_dialog_reset_widgets (sw);
gnc_search_dialog_display_results (sw);
}
@ -739,6 +750,7 @@ void
gnc_search_dialog_test (void)
{
gpointer result = NULL;
GNCSearchWindow *sw;
GNCSearchCallbackButton buttons[] = {
{ N_("View Split"), do_nothing },
{ N_("New Split"), do_nothing },
@ -748,8 +760,8 @@ gnc_search_dialog_test (void)
{ NULL }
};
GNCSearchWindow *sw = gnc_search_dialog_create (GNC_ID_SPLIT, NULL, FALSE,
buttons, NULL, NULL);
sw = gnc_search_dialog_create (GNC_ID_SPLIT, get_params_list (GNC_ID_SPLIT),
NULL, NULL, buttons, NULL, NULL, NULL);
gtk_signal_connect (GTK_OBJECT (sw->dialog), "close",
GTK_SIGNAL_FUNC (on_close_cb), &result);
@ -758,17 +770,20 @@ gnc_search_dialog_test (void)
}
gpointer gnc_search_dialog_choose_object (GNCIdTypeConst obj_type,
GList *param_list,
QueryNew *start_query,
gboolean show_start_results,
QueryNew *show_start_query,
GNCSearchCallbackButton *callbacks,
GNCSearchResultCB result_callback,
GNCSearchNewItemCB new_item_cb,
gpointer user_data)
{
gpointer result = NULL;
GNCSearchWindow *sw = gnc_search_dialog_create (obj_type, start_query,
show_start_results,
GNCSearchWindow *sw = gnc_search_dialog_create (obj_type, param_list,
start_query,
show_start_query,
callbacks, result_callback,
user_data);
new_item_cb, user_data);
gtk_signal_connect (GTK_OBJECT (sw->dialog), "close",
GTK_SIGNAL_FUNC (on_close_cb), &result);

View File

@ -23,10 +23,14 @@ typedef struct _GNCSearchWindow GNCSearchWindow;
*
* In the second callback, the query is the property of the search
* dialog; the callback should copy it if they want to keep it.
*
* The third callback will create a new item, and if the item is created,
* it will destroy the search dialog.
*/
typedef gboolean (*GNCSearchCallback)(gpointer *obj_p, gpointer user_data);
typedef gboolean (*GNCSearchCallback) (gpointer *obj_p, gpointer user_data);
typedef gboolean (*GNCSearchResultCB) (QueryNew *query, gpointer user_data,
gpointer *result);
typedef gpointer (*GNCSearchNewItemCB) (gpointer user_data);
typedef struct {
const char * label;
@ -36,24 +40,37 @@ typedef struct {
/* Caller MUST supply _EITHER_ a result_callback or a list of callback
* buttons. The caller MUST NOT supply both.
*
* The start_query is the property of the caller.
* The param_list is the property of the dialog but will NOT be destroyed.
* 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.
*/
GNCSearchWindow * gnc_search_dialog_create (GNCIdTypeConst obj_type,
GList *param_list,
QueryNew *start_query,
gboolean show_start_results,
QueryNew *show_start_query,
GNCSearchCallbackButton *callbacks,
GNCSearchResultCB result_callback,
GNCSearchNewItemCB new_item_cb,
gpointer user_data);
void gnc_search_dialog_destroy (GNCSearchWindow *sw);
void gnc_search_dialog_test (void);
/* Use this function to choose (and return) an object. */
/* Use this function to choose (and return) an object.
*
* The param_list is the property of the dialog but will NOT be destroyed.
* 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.
*/
gpointer gnc_search_dialog_choose_object (GNCIdTypeConst obj_type,
GList *param_list,
QueryNew *start_query,
gboolean show_start_results,
QueryNew *show_start_query,
GNCSearchCallbackButton *callbacks,
GNCSearchResultCB result_callback,
GNCSearchNewItemCB new_item_cb,
gpointer user_data);
#endif

View File

@ -8,6 +8,7 @@
#endif
#include <string.h>
#include <stdarg.h>
#include <gnome.h>
#include "gnc-engine-util.h"
@ -193,3 +194,44 @@ 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, ...)
{
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 *)) {
path = g_slist_prepend (path, 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);
/* Maybe over-ride the type */
if (type_override)
gnc_search_param_override_param_type (p, type_override);
/* And return it */
return g_list_prepend (list, p);
}

View File

@ -58,4 +58,15 @@ gboolean gnc_search_param_type_match (GNCSearchParam *a,
void gnc_search_param_override_param_type (GNCSearchParam *param,
GNCIdTypeConst param_type);
/*************************************************************
* Helper function ..
*/
/* Create a paramter and prepend it to a GSList */
GList * gnc_search_param_prepend (GList *list, char const *title,
GNCIdTypeConst type_override,
GNCIdTypeConst search_type,
const char *param, ...);
#endif /* _GNCSEARCH_PARAM_H */

View File

@ -32,7 +32,7 @@
<widget>
<class>GtkVBox</class>
<child_name>GnomeDialog:vbox</child_name>
<name>dialog_vbox</name>
<name>dialog-vbox1</name>
<homogeneous>False</homogeneous>
<spacing>8</spacing>
<child>
@ -44,7 +44,7 @@
<widget>
<class>GtkHButtonBox</class>
<child_name>GnomeDialog:action_area</child_name>
<name>dialog-action_area</name>
<name>dialog-action_area1</name>
<layout_style>GTK_BUTTONBOX_SPREAD</layout_style>
<spacing>8</spacing>
<child_min_width>85</child_min_width>
@ -54,14 +54,15 @@
<child>
<padding>0</padding>
<expand>False</expand>
<fill>True</fill>
<fill>False</fill>
<pack>GTK_PACK_END</pack>
</child>
<widget>
<class>GtkButton</class>
<name>button26</name>
<name>button33</name>
<can_default>True</can_default>
<has_default>True</has_default>
<can_focus>True</can_focus>
<signal>
<name>clicked</name>
@ -75,7 +76,7 @@
<widget>
<class>GtkButton</class>
<name>button27</name>
<name>button34</name>
<can_default>True</can_default>
<can_focus>True</can_focus>
<signal>
@ -89,7 +90,21 @@
<widget>
<class>GtkButton</class>
<name>button28</name>
<name>new_item_button</name>
<can_default>True</can_default>
<can_focus>True</can_focus>
<signal>
<name>clicked</name>
<handler>gnc_ui_search_new_cb</handler>
<data>Search Dialog</data>
<last_modification_time>Mon, 18 Feb 2002 05:35:22 GMT</last_modification_time>
</signal>
<label>New Item....</label>
</widget>
<widget>
<class>GtkButton</class>
<name>button35</name>
<can_default>True</can_default>
<can_focus>True</can_focus>
<signal>
@ -103,70 +118,10 @@
</widget>
<widget>
<class>GtkHBox</class>
<name>hbox71</name>
<class>GtkVBox</class>
<name>vbox89</name>
<homogeneous>False</homogeneous>
<spacing>0</spacing>
<child>
<padding>0</padding>
<expand>False</expand>
<fill>False</fill>
</child>
<widget>
<class>GtkHBox</class>
<name>hbox72</name>
<homogeneous>False</homogeneous>
<spacing>0</spacing>
<child>
<padding>0</padding>
<expand>False</expand>
<fill>False</fill>
</child>
<widget>
<class>GtkLabel</class>
<name>type_label</name>
<label>()</label>
<justify>GTK_JUSTIFY_CENTER</justify>
<wrap>False</wrap>
<xalign>0.5</xalign>
<yalign>0.5</yalign>
<xpad>0</xpad>
<ypad>0</ypad>
<child>
<padding>0</padding>
<expand>False</expand>
<fill>False</fill>
</child>
</widget>
<widget>
<class>GtkLabel</class>
<name>label844</name>
<label> Search </label>
<justify>GTK_JUSTIFY_CENTER</justify>
<wrap>False</wrap>
<xalign>0.5</xalign>
<yalign>0.5</yalign>
<xpad>0</xpad>
<ypad>0</ypad>
<child>
<padding>0</padding>
<expand>False</expand>
<fill>False</fill>
</child>
</widget>
</widget>
</widget>
<widget>
<class>GtkFrame</class>
<name>search_frame</name>
<border_width>3</border_width>
<label>Search Criteria</label>
<label_xalign>0</label_xalign>
<shadow_type>GTK_SHADOW_ETCHED_IN</shadow_type>
<child>
<padding>0</padding>
<expand>True</expand>
@ -174,16 +129,19 @@
</child>
<widget>
<class>GtkVBox</class>
<name>vbox88</name>
<border_width>3</border_width>
<class>GtkHBox</class>
<name>hbox71</name>
<homogeneous>False</homogeneous>
<spacing>0</spacing>
<child>
<padding>0</padding>
<expand>True</expand>
<fill>True</fill>
</child>
<widget>
<class>GtkHBox</class>
<name>hbox73</name>
<border_width>3</border_width>
<name>hbox72</name>
<homogeneous>False</homogeneous>
<spacing>0</spacing>
<child>
@ -192,46 +150,30 @@
<fill>False</fill>
</child>
<widget>
<class>GtkHBox</class>
<name>add_button_box</name>
<homogeneous>False</homogeneous>
<spacing>0</spacing>
<child>
<padding>0</padding>
<expand>False</expand>
<fill>False</fill>
</child>
<widget>
<class>Placeholder</class>
</widget>
</widget>
<widget>
<class>GtkHBox</class>
<name>type_menu_box</name>
<homogeneous>False</homogeneous>
<spacing>0</spacing>
<child>
<padding>0</padding>
<expand>False</expand>
<fill>False</fill>
<pack>GTK_PACK_END</pack>
</child>
<widget>
<class>Placeholder</class>
</widget>
</widget>
<widget>
<class>GtkLabel</class>
<name>label846</name>
<label>Search for items where</label>
<justify>GTK_JUSTIFY_RIGHT</justify>
<name>type_label</name>
<label>()</label>
<justify>GTK_JUSTIFY_CENTER</justify>
<wrap>False</wrap>
<xalign>1</xalign>
<xalign>0.5</xalign>
<yalign>0.5</yalign>
<xpad>0</xpad>
<ypad>0</ypad>
<child>
<padding>0</padding>
<expand>False</expand>
<fill>False</fill>
</child>
</widget>
<widget>
<class>GtkLabel</class>
<name>label844</name>
<label> Search </label>
<justify>GTK_JUSTIFY_CENTER</justify>
<wrap>False</wrap>
<xalign>0.5</xalign>
<yalign>0.5</yalign>
<xpad>0</xpad>
<ypad>0</ypad>
@ -239,57 +181,129 @@
<padding>0</padding>
<expand>False</expand>
<fill>False</fill>
<pack>GTK_PACK_END</pack>
</child>
</widget>
</widget>
</widget>
<widget>
<class>GtkFrame</class>
<name>search_frame</name>
<border_width>3</border_width>
<label>Search Criteria</label>
<label_xalign>0</label_xalign>
<shadow_type>GTK_SHADOW_ETCHED_IN</shadow_type>
<child>
<padding>0</padding>
<expand>True</expand>
<fill>True</fill>
</child>
<widget>
<class>GtkTable</class>
<name>criteria_table</name>
<class>GtkVBox</class>
<name>vbox88</name>
<border_width>3</border_width>
<rows>1</rows>
<columns>2</columns>
<homogeneous>False</homogeneous>
<row_spacing>0</row_spacing>
<column_spacing>0</column_spacing>
<child>
<padding>0</padding>
<expand>False</expand>
<fill>False</fill>
</child>
<spacing>0</spacing>
<widget>
<class>GtkHBox</class>
<name>hbox73</name>
<border_width>3</border_width>
<homogeneous>False</homogeneous>
<spacing>0</spacing>
<child>
<padding>0</padding>
<expand>False</expand>
<fill>False</fill>
</child>
<widget>
<class>GtkHBox</class>
<name>add_button_box</name>
<homogeneous>False</homogeneous>
<spacing>0</spacing>
<child>
<padding>0</padding>
<expand>False</expand>
<fill>False</fill>
</child>
<widget>
<class>Placeholder</class>
</widget>
</widget>
<widget>
<class>GtkHBox</class>
<name>type_menu_box</name>
<homogeneous>False</homogeneous>
<spacing>0</spacing>
<child>
<padding>0</padding>
<expand>False</expand>
<fill>False</fill>
<pack>GTK_PACK_END</pack>
</child>
<widget>
<class>Placeholder</class>
</widget>
</widget>
<widget>
<class>GtkLabel</class>
<name>label846</name>
<label>Search for items where</label>
<justify>GTK_JUSTIFY_RIGHT</justify>
<wrap>False</wrap>
<xalign>1</xalign>
<yalign>0.5</yalign>
<xpad>0</xpad>
<ypad>0</ypad>
<child>
<padding>0</padding>
<expand>False</expand>
<fill>False</fill>
<pack>GTK_PACK_END</pack>
</child>
</widget>
</widget>
<widget>
<class>GtkTable</class>
<name>criteria_table</name>
<border_width>3</border_width>
<rows>1</rows>
<columns>2</columns>
<homogeneous>False</homogeneous>
<row_spacing>0</row_spacing>
<column_spacing>0</column_spacing>
<child>
<padding>0</padding>
<expand>True</expand>
<fill>True</fill>
</child>
</widget>
</widget>
</widget>
</widget>
<widget>
<class>GtkHBox</class>
<name>result_hbox</name>
<homogeneous>False</homogeneous>
<spacing>0</spacing>
<child>
<padding>0</padding>
<expand>False</expand>
<fill>False</fill>
</child>
<widget>
<class>GtkHBox</class>
<name>hboxXXX</name>
<name>result_hbox</name>
<homogeneous>False</homogeneous>
<spacing>0</spacing>
<child>
<padding>0</padding>
<expand>False</expand>
<fill>False</fill>
<expand>True</expand>
<fill>True</fill>
</child>
<widget>
<class>GtkFrame</class>
<name>frame12</name>
<label>Type of search</label>
<label_xalign>0</label_xalign>
<shadow_type>GTK_SHADOW_ETCHED_IN</shadow_type>
<class>GtkHBox</class>
<name>hboxXXX</name>
<homogeneous>False</homogeneous>
<spacing>0</spacing>
<child>
<padding>0</padding>
<expand>False</expand>
@ -297,94 +311,107 @@
</child>
<widget>
<class>GtkVBox</class>
<name>vbox24</name>
<border_width>3</border_width>
<homogeneous>False</homogeneous>
<spacing>0</spacing>
<class>GtkFrame</class>
<name>frame12</name>
<label>Type of search</label>
<label_xalign>0</label_xalign>
<shadow_type>GTK_SHADOW_ETCHED_IN</shadow_type>
<child>
<padding>0</padding>
<expand>False</expand>
<fill>False</fill>
</child>
<widget>
<class>GtkRadioButton</class>
<name>new_search_radiobutton</name>
<can_focus>True</can_focus>
<signal>
<name>toggled</name>
<handler>gnc_ui_search_type_cb</handler>
<data>Search Dialog</data>
<last_modification_time>Thu, 07 Feb 2002 01:25:13 GMT</last_modification_time>
</signal>
<label>New search</label>
<active>False</active>
<draw_indicator>True</draw_indicator>
<group>search_type</group>
<child>
<padding>0</padding>
<expand>False</expand>
<fill>False</fill>
</child>
</widget>
<class>GtkVBox</class>
<name>vbox24</name>
<border_width>3</border_width>
<homogeneous>False</homogeneous>
<spacing>0</spacing>
<widget>
<class>GtkRadioButton</class>
<name>narrow_search_radiobutton</name>
<can_focus>True</can_focus>
<signal>
<name>toggled</name>
<handler>gnc_ui_search_type_cb</handler>
<data>Search Dialog</data>
<last_modification_time>Wed, 05 Apr 2000 14:20:05 GMT</last_modification_time>
</signal>
<label>Refine current search</label>
<active>False</active>
<draw_indicator>True</draw_indicator>
<group>search_type</group>
<child>
<padding>0</padding>
<expand>False</expand>
<fill>False</fill>
</child>
</widget>
<widget>
<class>GtkRadioButton</class>
<name>new_search_radiobutton</name>
<can_focus>True</can_focus>
<signal>
<name>toggled</name>
<handler>gnc_ui_search_type_cb</handler>
<data>Search Dialog</data>
<last_modification_time>Thu, 07 Feb 2002 01:25:13 GMT</last_modification_time>
</signal>
<label>New search</label>
<active>False</active>
<draw_indicator>True</draw_indicator>
<group>search_type</group>
<child>
<padding>0</padding>
<expand>False</expand>
<fill>False</fill>
</child>
</widget>
<widget>
<class>GtkRadioButton</class>
<name>add_search_radiobutton</name>
<can_focus>True</can_focus>
<signal>
<name>toggled</name>
<handler>gnc_ui_search_type_cb</handler>
<data>Search Dialog</data>
<last_modification_time>Wed, 05 Apr 2000 14:20:17 GMT</last_modification_time>
</signal>
<label>Add results to current search</label>
<active>False</active>
<draw_indicator>True</draw_indicator>
<group>search_type</group>
<child>
<padding>0</padding>
<expand>False</expand>
<fill>False</fill>
</child>
</widget>
<widget>
<class>GtkRadioButton</class>
<name>narrow_search_radiobutton</name>
<can_focus>True</can_focus>
<signal>
<name>toggled</name>
<handler>gnc_ui_search_type_cb</handler>
<data>Search Dialog</data>
<last_modification_time>Wed, 05 Apr 2000 14:20:05 GMT</last_modification_time>
</signal>
<label>Refine current search</label>
<active>False</active>
<draw_indicator>True</draw_indicator>
<group>search_type</group>
<child>
<padding>0</padding>
<expand>False</expand>
<fill>False</fill>
</child>
</widget>
<widget>
<class>GtkRadioButton</class>
<name>delete_search_radiobutton</name>
<can_focus>True</can_focus>
<signal>
<name>toggled</name>
<handler>gnc_ui_search_type_cb</handler>
<data>Search Dialog</data>
<last_modification_time>Wed, 05 Apr 2000 14:20:26 GMT</last_modification_time>
</signal>
<label>Delete results from current search</label>
<active>False</active>
<draw_indicator>True</draw_indicator>
<group>search_type</group>
<child>
<padding>0</padding>
<expand>False</expand>
<fill>False</fill>
</child>
<widget>
<class>GtkRadioButton</class>
<name>add_search_radiobutton</name>
<can_focus>True</can_focus>
<signal>
<name>toggled</name>
<handler>gnc_ui_search_type_cb</handler>
<data>Search Dialog</data>
<last_modification_time>Wed, 05 Apr 2000 14:20:17 GMT</last_modification_time>
</signal>
<label>Add results to current search</label>
<active>False</active>
<draw_indicator>True</draw_indicator>
<group>search_type</group>
<child>
<padding>0</padding>
<expand>False</expand>
<fill>False</fill>
</child>
</widget>
<widget>
<class>GtkRadioButton</class>
<name>delete_search_radiobutton</name>
<can_focus>True</can_focus>
<signal>
<name>toggled</name>
<handler>gnc_ui_search_type_cb</handler>
<data>Search Dialog</data>
<last_modification_time>Wed, 05 Apr 2000 14:20:26 GMT</last_modification_time>
</signal>
<label>Delete results from current search</label>
<active>False</active>
<draw_indicator>True</draw_indicator>
<group>search_type</group>
<child>
<padding>0</padding>
<expand>False</expand>
<fill>False</fill>
</child>
</widget>
</widget>
</widget>
</widget>