From 93d0b4abb5f1b7641fce1c224415e225cb63ef1a Mon Sep 17 00:00:00 2001 From: Derek Atkins Date: Sat, 1 Feb 2003 16:06:26 +0000 Subject: [PATCH] * src/business/business-gnome/dialog-invoice.c: * src/business/business-gnome/glade/invoice.glade: add handlers to immediately save the active and notes fields as they are edited. Fixes #104954 NOTE: This has a side effect of removing an invoice from any open searches, but NOT replacing it if you click on the "active" button. * src/business/business-gnome/business-gnome.scm: fix the "bill reminder" so it doesn't create a query if there are no payables accounts. * src/gnome-utils/gnc-menu-extensions.c: dgettext() and gettext() return const char*. git-svn-id: svn+ssh://svn.gnucash.org/repo/gnucash/trunk@7901 57a11ea4-9604-0410-9ed3-97b8803252fd --- ChangeLog | 16 +++++++++++ .../business-gnome/business-gnome.scm | 14 ++++++---- src/business/business-gnome/dialog-invoice.c | 28 +++++++++++++++++++ .../business-gnome/glade/invoice.glade | 12 ++++++++ src/gnome-utils/gnc-menu-extensions.c | 2 +- 5 files changed, 65 insertions(+), 7 deletions(-) diff --git a/ChangeLog b/ChangeLog index 903c0bb4be..1f14cfa6f8 100644 --- a/ChangeLog +++ b/ChangeLog @@ -14,6 +14,22 @@ Fixes Morrison J. Chang's QIF import problem. + * src/business/business-gnome/dialog-invoice.c: + * src/business/business-gnome/glade/invoice.glade: + add handlers to immediately save the active and notes fields + as they are edited. Fixes #104954 + + NOTE: This has a side effect of removing an invoice from any + open searches, but NOT replacing it if you click on the "active" + button. + + * src/business/business-gnome/business-gnome.scm: fix the "bill + reminder" so it doesn't create a query if there are no payables + accounts. + + * src/gnome-utils/gnc-menu-extensions.c: dgettext() and gettext() + return const char*. + 2003-01-30 Derek Atkins * po/np.po -- add the proper "Plural" header so it builds again. diff --git a/src/business/business-gnome/business-gnome.scm b/src/business/business-gnome/business-gnome.scm index 0854e34ba2..718e5f24b9 100644 --- a/src/business/business-gnome/business-gnome.scm +++ b/src/business/business-gnome/business-gnome.scm @@ -39,10 +39,12 @@ accts)) (define (make-query book accts) - (let ((q (gnc:malloc-query))) - (gnc:query-add-account-match q accts 'guid-match-any 'query-and) - (gnc:query-set-book q book) - q)) + (if (and accts (not (null? accts))) + (let ((q (gnc:malloc-query))) + (gnc:query-add-account-match q accts 'guid-match-any 'query-and) + (gnc:query-set-book q book) + q) + #f)) (define (get-open-lots query) (let ((all-lots (gnc:query-get-lots query 'query-txn-match-any)) @@ -64,13 +66,13 @@ (let* ((book (gnc:session-get-book session)) (payables-accounts (get-payables book)) (query (make-query book payables-accounts)) - (open-lots (get-open-lots query)) + (open-lots (if query (get-open-lots query) '())) (days (option-value "Bills Due Days")) (compare-date (compute-date (gnc:get-today) days)) (bills '())) ;; free up the space we don't need right now... - (gnc:free-query query) + (if query (gnc:free-query query)) ;; compute the bills that are soon to be (or over-) due (for-each diff --git a/src/business/business-gnome/dialog-invoice.c b/src/business/business-gnome/dialog-invoice.c index da46258912..4260dbb2b9 100644 --- a/src/business/business-gnome/dialog-invoice.c +++ b/src/business/business-gnome/dialog-invoice.c @@ -179,6 +179,9 @@ void gnc_invoice_window_toolbar_cb (GtkWidget *widget, gpointer data); void gnc_invoice_window_statusbar_cb (GtkWidget *widget, gpointer data); void gnc_invoice_window_summarybar_cb (GtkWidget *widget, gpointer data); +void gnc_invoice_window_active_toggled_cb (GtkWidget *widget, gpointer data); +void gnc_invoice_window_leave_notes_cb (GtkWidget *widget, GdkEventFocus *event, gpointer data); + #define INV_WIDTH_PREFIX "invoice_reg" #define BILL_WIDTH_PREFIX "bill_reg" static int inv_last_width = 0; @@ -853,6 +856,31 @@ gnc_invoice_window_summarybar_cb (GtkWidget *widget, gpointer data) } } +void +gnc_invoice_window_active_toggled_cb (GtkWidget *widget, gpointer data) +{ + InvoiceWindow *iw = data; + GncInvoice *invoice = iw_get_invoice(iw); + + if (!invoice) return; + + gncInvoiceSetActive (invoice, + gtk_toggle_button_get_active (GTK_TOGGLE_BUTTON (widget))); +} + +void +gnc_invoice_window_leave_notes_cb (GtkWidget *widget, GdkEventFocus *event, + gpointer data) +{ + InvoiceWindow *iw = data; + GncInvoice *invoice = iw_get_invoice(iw); + + if (!invoice) return; + + gncInvoiceSetNotes (invoice, gtk_editable_get_chars + (GTK_EDITABLE (widget), 0, -1)); +} + static GtkWidget * add_summary_label (GtkWidget *summarybar, const char *label_str) { diff --git a/src/business/business-gnome/glade/invoice.glade b/src/business/business-gnome/glade/invoice.glade index 83191ec33b..1f5f3d205a 100644 --- a/src/business/business-gnome/glade/invoice.glade +++ b/src/business/business-gnome/glade/invoice.glade @@ -1636,6 +1636,12 @@ GtkCheckButton active_check True + + toggled + gnc_invoice_window_active_toggled_cb + Invoice Entry Window + Sat, 01 Feb 2003 01:03:48 GMT + False True @@ -1898,6 +1904,12 @@ GtkText notes_text True + + focus-out-event + gnc_invoice_window_leave_notes_cb + Invoice Entry Window + Sat, 01 Feb 2003 01:12:00 GMT + True diff --git a/src/gnome-utils/gnc-menu-extensions.c b/src/gnome-utils/gnc-menu-extensions.c index 64d5a2212f..8a4ab63ff5 100644 --- a/src/gnome-utils/gnc-menu-extensions.c +++ b/src/gnome-utils/gnc-menu-extensions.c @@ -369,7 +369,7 @@ g_strncmp_ignore_char( const gchar *first, const gchar *second, gint length, gch static const gchar * gnc_gnome_app_helper_gettext (const gchar *str) { - char *s; + const char *s; /* First try to look up the string in gettext domain gnome-libs, * since this is where the original gnome stock labels have been