[Gnucash-changes] r13227 - gnucash/trunk/src/report/report-gnome -
Gracefully handle errors in report options.
Chris Shoemaker
chris at cvs.gnucash.org
Sat Feb 11 21:40:36 EST 2006
Author: chris
Date: 2006-02-11 21:40:35 -0500 (Sat, 11 Feb 2006)
New Revision: 13227
Trac: http://svn.gnucash.org/trac/changeset/13227
Modified:
gnucash/trunk/src/report/report-gnome/gnc-plugin-page-report.c
Log:
Gracefully handle errors in report options.
This prevents the whole program from crashing when unrecognized report
options are used.
Modified: gnucash/trunk/src/report/report-gnome/gnc-plugin-page-report.c
===================================================================
--- gnucash/trunk/src/report/report-gnome/gnc-plugin-page-report.c 2006-02-12 01:59:02 UTC (rev 13226)
+++ gnucash/trunk/src/report/report-gnome/gnc-plugin-page-report.c 2006-02-12 02:40:35 UTC (rev 13227)
@@ -49,6 +49,7 @@
#include <sys/stat.h>
#include <errno.h>
+#include "gfec.h"
#include "gnc-component-manager.h"
#include "gnc-engine.h"
#include "gnc-gconf-utils.h"
@@ -1287,16 +1288,24 @@
}
static void
+error_handler(const char *str)
+{
+ g_warning("Report Error: %s", str);
+}
+
+static void
gnc_plugin_page_report_options_cb( GtkAction *action, GncPluginPageReport *report )
{
GncPluginPageReportPrivate *priv;
SCM start_editor = scm_c_eval_string("gnc:report-edit-options");
+ SCM result;
priv = GNC_PLUGIN_PAGE_REPORT_GET_PRIVATE(report);
if (priv->cur_report == SCM_BOOL_F)
return;
- if (scm_call_1(start_editor, priv->cur_report) == SCM_BOOL_F) {
+ result = gfec_apply(start_editor, priv->cur_report, error_handler);
+ if (result == SCM_BOOL_F || result == SCM_UNDEFINED) {
gnc_warning_dialog(GTK_WIDGET(gnc_ui_get_toplevel()),
_("There are no options for this report."));
}
More information about the gnucash-changes
mailing list