40 #include <glib/gi18n.h> 41 #include <glib/gstdio.h> 53 #include "dialog-utils.h" 54 #include "gnc-component-manager.h" 57 #include "gnc-guile-utils.h" 58 #include "gnc-html-history.h" 60 #include "gnc-html-factory.h" 68 #include "gnc-session.h" 72 #include "window-report.h" 73 #include "swig-runtime.h" 74 #include "guile-mappings.h" 75 #include "gnc-icons.h" 78 #include <unordered_map> 80 #include <gnc-report.h> 86 static QofLogModule log_module = GNC_MOD_GUI;
91 static std::unordered_map<std::string,unsigned> static_report_printnames;
104 gint component_manager_id;
105 GSimpleActionGroup* action_group;
110 size_t option_change_cb_id = 0;
117 size_t name_change_cb_id;
136 G_DEFINE_TYPE_WITH_PRIVATE(
GncPluginPageReport, gnc_plugin_page_report, GNC_TYPE_PLUGIN_PAGE)
138 #define GNC_PLUGIN_PAGE_REPORT_GET_PRIVATE(o) \ 139 ((GncPluginPageReportPrivate*)gnc_plugin_page_report_get_instance_private((GncPluginPageReport*)o)) 141 static GObject *gnc_plugin_page_report_constructor(GType this_type, guint n_properties, GObjectConstructParam *properties);
142 static void gnc_plugin_page_report_finalize (GObject *
object);
143 static void gnc_plugin_page_report_setup(
GncPluginPage *ppage );
145 static void gnc_plugin_page_report_constr_init(
GncPluginPageReport *plugin_page, gint reportId);
147 static GtkWidget* gnc_plugin_page_report_create_widget(
GncPluginPage *plugin_page );
148 static void gnc_plugin_page_report_destroy_widget(
GncPluginPage *plugin_page );
149 static void gnc_plugin_page_report_save_page (
GncPluginPage *plugin_page, GKeyFile *file,
const gchar *group);
150 static GncPluginPage *gnc_plugin_page_report_recreate_page (GtkWidget *window, GKeyFile *file,
const gchar *group);
151 static void gnc_plugin_page_report_name_changed (
GncPluginPage *page,
const gchar *name);
152 static void gnc_plugin_page_report_update_edit_menu (
GncPluginPage *page, gboolean hide);
153 static gboolean gnc_plugin_page_report_finish_pending (
GncPluginPage *page);
154 static void gnc_plugin_page_report_load_uri (
GncPluginPage *page);
156 static int gnc_plugin_page_report_check_urltype(URLType t);
158 static void gnc_plugin_page_report_load_cb(GncHtml * html, URLType type,
159 const gchar * location,
const gchar * label,
161 static void gnc_plugin_page_report_refresh (gpointer data);
162 static void gnc_plugin_page_report_set_fwd_button(
GncPluginPageReport * page,
int enabled);
163 static void gnc_plugin_page_report_set_back_button(
GncPluginPageReport * page,
int enabled);
164 static void gnc_plugin_page_report_history_destroy_cb(gnc_html_history_node * node, gpointer user_data);
165 static void close_handler(gpointer user_data);
167 static void gnc_plugin_page_report_option_change_cb(gpointer data);
171 static void gnc_plugin_page_report_menu_updates (
GncPluginPage *plugin_page);
172 void gnc_plugin_page_report_raise_editor(SCM report);
174 static void gnc_plugin_page_report_forw_cb (GSimpleAction *simple, GVariant *parameter, gpointer user_data);
175 static void gnc_plugin_page_report_back_cb (GSimpleAction *simple, GVariant *parameter, gpointer user_data);
176 static void gnc_plugin_page_report_reload_cb (GSimpleAction *simple, GVariant *parameter, gpointer user_data);
177 static void gnc_plugin_page_report_stop_cb (GSimpleAction *simple, GVariant *parameter, gpointer user_data);
178 static void gnc_plugin_page_report_save_cb (GSimpleAction *simple, GVariant *parameter, gpointer user_data);
179 static void gnc_plugin_page_report_save_as_cb (GSimpleAction *simple, GVariant *parameter, gpointer user_data);
180 static void gnc_plugin_page_report_export_cb (GSimpleAction *simple, GVariant *parameter, gpointer user_data);
181 static void gnc_plugin_page_report_options_cb (GSimpleAction *simple, GVariant *parameter, gpointer user_data);
182 static void gnc_plugin_page_report_print_cb (GSimpleAction *simple, GVariant *parameter, gpointer user_data);
183 static void gnc_plugin_page_report_exportpdf_cb (GSimpleAction *simple, GVariant *parameter, gpointer user_data);
184 static void gnc_plugin_page_report_copy_cb (GSimpleAction *simple, GVariant *parameter, gpointer user_data);
185 static void gnc_plugin_page_report_edit_tax_cb (GSimpleAction *simple, GVariant *parameter, gpointer user_data);
187 static GActionEntry report_actions[] =
189 {
"FilePrintAction", gnc_plugin_page_report_print_cb,
nullptr,
nullptr,
nullptr },
190 {
"FilePrintPDFAction", gnc_plugin_page_report_exportpdf_cb,
nullptr,
nullptr,
nullptr },
191 {
"EditCopyAction", gnc_plugin_page_report_copy_cb,
nullptr,
nullptr,
nullptr },
192 {
"EditTaxOptionsAction", gnc_plugin_page_report_edit_tax_cb,
nullptr,
nullptr,
nullptr },
193 {
"ViewRefreshAction", gnc_plugin_page_report_reload_cb,
nullptr,
nullptr,
nullptr },
194 {
"ReportSaveAction", gnc_plugin_page_report_save_cb,
nullptr,
nullptr,
nullptr },
195 {
"ReportSaveAsAction", gnc_plugin_page_report_save_as_cb,
nullptr,
nullptr,
nullptr },
196 {
"ReportExportAction", gnc_plugin_page_report_export_cb,
nullptr,
nullptr,
nullptr },
197 {
"ReportOptionsAction", gnc_plugin_page_report_options_cb,
nullptr,
nullptr,
nullptr },
198 {
"ReportBackAction", gnc_plugin_page_report_back_cb,
nullptr,
nullptr,
nullptr },
199 {
"ReportForwAction", gnc_plugin_page_report_forw_cb,
nullptr,
nullptr,
nullptr },
200 {
"ReportReloadAction", gnc_plugin_page_report_reload_cb,
nullptr,
nullptr,
nullptr },
201 {
"ReportStopAction", gnc_plugin_page_report_stop_cb,
nullptr,
nullptr,
nullptr },
203 static guint num_report_actions = G_N_ELEMENTS(report_actions);
204 static const gchar *initially_insensitive_actions[] =
209 static const gchar *disable_during_load_actions[] =
212 "FilePrintPDFAction",
213 "ReportOptionsAction",
218 static const gchar *gnc_plugin_load_ui_items [] =
227 "ReportsPlaceholder1",
234 {
"FilePrintAction", N_(
"Print") },
235 {
"ReportExportAction", N_(
"Export") },
236 {
"ReportOptionsAction", N_(
"Options") },
239 {
"ReportSaveAction", N_(
"Save Config") },
242 {
"ReportSaveAsAction", N_(
"Save Config As…") },
243 {
"FilePrintPDFAction", N_(
"Make Pdf") },
244 {
nullptr,
nullptr },
248 gnc_plugin_page_report_get_property( GObject *obj,
256 rep = GNC_PLUGIN_PAGE_REPORT( obj );
257 priv = GNC_PLUGIN_PAGE_REPORT_GET_PRIVATE(rep);
262 g_value_set_int( value, priv->
reportId );
265 PERR(
"Unknown property id %d", prop_id );
271 gnc_plugin_page_report_set_property( GObject *obj,
279 rep = GNC_PLUGIN_PAGE_REPORT( obj );
280 priv = GNC_PLUGIN_PAGE_REPORT_GET_PRIVATE(rep);
282 DEBUG(
"setting property with id %d / %p to value %d",
283 prop_id, priv, g_value_get_int( value ) );
288 priv->
reportId = g_value_get_int( value );
291 PERR(
"unknown property id %d", prop_id );
302 gnc_plugin_page_report_focus_widget (
GncPluginPage *report_plugin_page)
304 if (GNC_IS_PLUGIN_PAGE_REPORT(report_plugin_page))
315 g_simple_action_set_enabled (G_SIMPLE_ACTION(action), FALSE);
318 g_simple_action_set_enabled (G_SIMPLE_ACTION(action), FALSE);
322 gnc_plugin_load_ui_items);
327 gnc_plugin_page_report_menu_updates (report_plugin_page);
333 GtkWidget *widget = gnc_html_get_webview (priv->
html);
336 gnc_plugin_page_report_load_uri (report_plugin_page);
338 if (widget && GTK_IS_WIDGET(widget))
340 if (!gtk_widget_is_focus (GTK_WIDGET(widget)))
341 gtk_widget_grab_focus (GTK_WIDGET(widget));
351 GObjectClass *object_class = G_OBJECT_CLASS (klass);
354 object_class->constructor = gnc_plugin_page_report_constructor;
355 object_class->finalize = gnc_plugin_page_report_finalize;
357 object_class->set_property = gnc_plugin_page_report_set_property;
358 object_class->get_property = gnc_plugin_page_report_get_property;
360 gnc_plugin_page_class->
tab_icon = GNC_ICON_ACCOUNT_REPORT;
361 gnc_plugin_page_class->
plugin_name = GNC_PLUGIN_PAGE_REPORT_NAME;
363 gnc_plugin_page_class->
create_widget = gnc_plugin_page_report_create_widget;
364 gnc_plugin_page_class->
destroy_widget = gnc_plugin_page_report_destroy_widget;
365 gnc_plugin_page_class->
save_page = gnc_plugin_page_report_save_page;
366 gnc_plugin_page_class->
recreate_page = gnc_plugin_page_report_recreate_page;
369 gnc_plugin_page_class->
finish_pending = gnc_plugin_page_report_finish_pending;
373 auto paramspec{
static_cast<GParamFlags
>(G_PARAM_CONSTRUCT_ONLY | G_PARAM_READWRITE)};
374 g_object_class_install_property( object_class,
376 g_param_spec_int(
"report-id",
377 _(
"The numeric ID of the report."),
378 _(
"The numeric ID of the report."),
384 gnc_plugin_page_report_finalize (GObject *
object)
386 g_return_if_fail (GNC_IS_PLUGIN_PAGE_REPORT (
object));
388 ENTER(
"object %p",
object);
389 G_OBJECT_CLASS (gnc_plugin_page_report_parent_class)->finalize (
object);
394 gnc_plugin_page_report_set_progressbar (
GncPluginPage *page, gboolean
set)
396 GtkWidget *progressbar;
397 GtkAllocation allocation;
399 progressbar = gnc_window_get_progressbar (GNC_WINDOW(page->
window));
400 gtk_widget_get_allocation (GTK_WIDGET(progressbar), &allocation);
404 gtk_widget_set_size_request (GTK_WIDGET(progressbar), -1, allocation.height);
406 gtk_widget_set_size_request (GTK_WIDGET(progressbar), -1, -1);
418 char * url_location =
nullptr;
419 char * url_label =
nullptr;
421 report = GNC_PLUGIN_PAGE_REPORT(page);
422 priv = GNC_PLUGIN_PAGE_REPORT_GET_PRIVATE(report);
427 id_name = g_strdup_printf(
"id=%d", priv->
reportId );
428 child_name = gnc_build_url( URL_TYPE_REPORT, id_name,
nullptr );
429 type = gnc_html_parse_url( priv->
html, child_name, &url_location, &url_label);
430 DEBUG(
"passing id_name=[%s] child_name=[%s] type=[%s], location=[%s], label=[%s]",
431 id_name, child_name ? child_name :
"(null)",
432 type ? type :
"(null)", url_location ? url_location :
"(null)",
433 url_label ? url_label :
"(null)" );
438 g_object_add_weak_pointer(G_OBJECT(page), (gpointer*)(&weak_page));
439 gtk_widget_show_all( GTK_WIDGET(priv->
container) );
444 gnc_window_set_progressbar_window( GNC_WINDOW(page->
window) );
447 gnc_plugin_page_report_set_progressbar( page, TRUE );
449 gnc_html_show_url(priv->
html, type, url_location, url_label, 0);
450 g_free(url_location);
454 gnc_plugin_page_report_set_progressbar( page, FALSE );
455 g_object_remove_weak_pointer(G_OBJECT(page), (gpointer*)(&weak_page));
459 disable_during_load_actions, TRUE);
461 gnc_window_set_progressbar_window(
nullptr );
466 webkit_key_press_event_cb (GtkWidget *widget, GdkEventKey *event, gpointer user_data)
470 GdkModifierType modifiers = gtk_accelerator_get_default_mod_mask ();
476 if ((event->keyval == GDK_KEY_Page_Up || event->keyval == GDK_KEY_Page_Down ||
477 event->keyval == GDK_KEY_KP_Page_Up || event->keyval == GDK_KEY_KP_Page_Down)
478 && (event->state & modifiers) == (GDK_CONTROL_MASK | GDK_MOD1_MASK))
480 GtkNotebook *notebook = GTK_NOTEBOOK(gtk_widget_get_parent (GTK_WIDGET(priv->
container)));
481 gint pages = gtk_notebook_get_n_pages (notebook);
482 gint current_page = gtk_notebook_get_current_page (notebook);
484 if (event->keyval == GDK_KEY_Page_Up || event->keyval == GDK_KEY_KP_Page_Up)
486 if (current_page == 0)
487 gtk_notebook_set_current_page (notebook, pages - 1);
489 gtk_notebook_prev_page (notebook);
493 if (pages == current_page + 1)
494 gtk_notebook_set_current_page (notebook, 0);
496 gtk_notebook_next_page (notebook);
514 char * url_location =
nullptr;
515 char * url_label =
nullptr;
517 ENTER(
"page %p", page);
519 report = GNC_PLUGIN_PAGE_REPORT(page);
520 priv = GNC_PLUGIN_PAGE_REPORT_GET_PRIVATE(report);
524 priv->webkit2 = TRUE;
529 priv->
html = gnc_html_factory_create_html();
530 gnc_html_set_parent( priv->
html, topLvl );
531 priv->loaded = FALSE;
533 gnc_html_history_set_node_destroy_cb(gnc_html_get_history(priv->
html),
534 gnc_plugin_page_report_history_destroy_cb,
537 priv->
container = GTK_CONTAINER(gtk_frame_new(
nullptr));
538 gtk_frame_set_shadow_type(GTK_FRAME(priv->
container), GTK_SHADOW_NONE);
541 gtk_widget_set_name (GTK_WIDGET(priv->
container),
"gnc-id-report-page");
543 gtk_container_add(GTK_CONTAINER(priv->
container),
544 gnc_html_get_widget(priv->
html));
546 priv->component_manager_id =
547 gnc_register_gui_component(WINDOW_REPORT_CM_CLASS,
nullptr,
548 close_handler, page);
549 gnc_gui_component_set_session(priv->component_manager_id,
550 gnc_get_current_session());
552 gnc_html_set_urltype_cb(priv->
html, gnc_plugin_page_report_check_urltype);
553 gnc_html_set_load_cb(priv->
html, gnc_plugin_page_report_load_cb, report);
557 id_name = g_strdup_printf(
"id=%d", priv->
reportId );
558 child_name = gnc_build_url( URL_TYPE_REPORT, id_name,
nullptr );
559 type = gnc_html_parse_url( priv->
html, child_name, &url_location, &url_label);
561 gnc_plugin_page_report_load_cb (priv->
html, type, id_name, url_label, report);
565 g_free (url_location);
570 g_signal_connect (G_OBJECT(page),
"inserted",
575 webview = gnc_html_get_webview (priv->
html);
578 gtk_widget_add_events (webview, gtk_widget_get_events (webview) |
581 g_signal_connect (webview,
"key-press-event",
582 G_CALLBACK(webkit_key_press_event_cb),
586 gtk_widget_show_all( GTK_WIDGET(priv->
container) );
596 gnc_plugin_page_report_check_urltype(URLType t)
598 if (!g_strcmp0 (t, URL_TYPE_REPORT))
617 SCM set_needs_save = scm_c_eval_string(
"gnc:report-set-needs-save?!");
621 priv = GNC_PLUGIN_PAGE_REPORT_GET_PRIVATE(report);
623 priv->initial_report = SCM_BOOL_F;
624 priv->edited_reports = SCM_EOL;
625 priv->name_change_cb_id = 0;
627 g_object_get( ppage,
"report-id", &report_id,
nullptr );
629 PINFO(
"report-id: %d\n", report_id);
633 if ((inst_report = gnc_report_find(report_id)) == SCM_BOOL_F)
638 if (priv->initial_report == SCM_BOOL_F)
640 priv->initial_report = inst_report;
641 scm_gc_protect_object(priv->initial_report);
645 PINFO(
"set needs save");
646 scm_call_2(set_needs_save, inst_report, SCM_BOOL_T);
654 gnc_plugin_page_report_load_cb (GncHtml * html, URLType type,
655 const gchar * location,
const gchar * label,
661 SCM set_needs_save = scm_c_eval_string(
"gnc:report-set-needs-save?!");
664 ENTER(
"load_cb: type=[%s], location=[%s], label=[%s]",
665 type ? type :
"(null)", location ? location :
"(null)",
666 label ? label :
"(null)" );
671 priv = GNC_PLUGIN_PAGE_REPORT_GET_PRIVATE(report);
672 if (!g_strcmp0 (type, URL_TYPE_REPORT)
674 && (strlen(location) > 3)
675 && !strncmp(
"id=", location, 3))
677 report_id = gnc_report_id_string_to_report_id (location + 3);
680 LEAVE (
"id_string error %s", location);
683 DEBUG(
"parsed id=%d", report_id );
685 else if (!g_strcmp0( type, URL_TYPE_OPTIONS)
687 && (strlen(location) > 10)
688 && !strncmp(
"report-id=", location, 10))
690 report_id = atoi(location + 10);
691 inst_report = gnc_report_find(report_id);
692 if (inst_report != SCM_BOOL_F)
694 gnc_plugin_page_report_add_edited_report(priv, inst_report);
701 LEAVE(
" unknown URL type [%s] location [%s]", type, location );
707 if ((inst_report = gnc_report_find(report_id)) == SCM_BOOL_F)
709 LEAVE(
"error getting inst_report" );
713 if (priv->initial_report == SCM_BOOL_F)
715 priv->initial_report = inst_report;
716 scm_gc_protect_object(priv->initial_report);
718 DEBUG(
"calling set_needs_save for report with id=%d", report_id);
719 scm_call_2(set_needs_save, inst_report, SCM_BOOL_T);
721 priv->initial_odb = gnc_get_report_optiondb(inst_report);
723 priv->name_change_cb_id =
724 priv->initial_odb->register_callback(
725 gnc_plugin_page_report_refresh, priv);
731 priv->
cur_odb->unregister_callback(priv->option_change_cb_id);
732 priv->option_change_cb_id = 0;
741 priv->
cur_odb = gnc_get_report_optiondb(inst_report);
743 priv->option_change_cb_id =
744 priv->
cur_odb->register_callback(
745 gnc_plugin_page_report_option_change_cb, report);
747 if (gnc_html_history_forward_p(gnc_html_get_history(priv->
html)))
749 gnc_plugin_page_report_set_fwd_button(report, TRUE);
753 gnc_plugin_page_report_set_fwd_button(report, FALSE);
756 if (gnc_html_history_back_p(gnc_html_get_history(priv->
html)))
758 gnc_plugin_page_report_set_back_button(report, TRUE);
762 gnc_plugin_page_report_set_back_button(report, FALSE);
781 gnc_plugin_page_report_option_change_cb(gpointer data)
786 SCM dirty_report = scm_c_eval_string(
"gnc:report-set-dirty?!");
788 g_return_if_fail(GNC_IS_PLUGIN_PAGE_REPORT(data));
789 report = GNC_PLUGIN_PAGE_REPORT(data);
790 priv = GNC_PLUGIN_PAGE_REPORT_GET_PRIVATE(report);
791 page = GNC_PLUGIN_PAGE(report);
793 DEBUG(
"option_change" );
796 DEBUG(
"set-dirty, queue-draw" );
800 auto new_name{priv->
cur_odb->lookup_string_option(
"General",
802 if (new_name != old_name)
806 char *clean_name{g_strdup(new_name.c_str())};
808 ENTER(
"Cleaned-up new report name: %s", clean_name ? clean_name :
"(null)");
814 scm_call_2(dirty_report, priv->
cur_report, SCM_BOOL_T);
817 disable_during_load_actions, FALSE);
819 priv->reloading = TRUE;
822 gnc_window_set_progressbar_window( GNC_WINDOW(page->
window) );
825 gnc_plugin_page_report_set_progressbar( page, TRUE );
828 gnc_html_reload( priv->
html, TRUE );
830 gnc_plugin_page_report_set_progressbar( page, FALSE );
833 gnc_window_set_progressbar_window(
nullptr );
836 disable_during_load_actions, TRUE);
837 priv->reloading = FALSE;
842 gnc_plugin_page_report_history_destroy_cb(gnc_html_history_node * node,
846 static SCM remover = SCM_BOOL_F;
849 if (remover == SCM_BOOL_F)
851 remover = scm_c_eval_string(
"gnc:report-remove-by-id");
855 && !g_strcmp0 (node->type, URL_TYPE_REPORT)\
856 && !strncmp(
"id=", node->location, 3))
858 sscanf(node->location + 3,
"%d", &report_id);
871 gnc_plugin_page_report_refresh(gpointer data)
874 DEBUG(
"report-refresh called" );
880 gnc_plugin_page_report_destroy_widget(
GncPluginPage *plugin_page)
886 PINFO(
"destroy widget");
887 priv = GNC_PLUGIN_PAGE_REPORT_GET_PRIVATE(plugin_page);
893 g_idle_remove_by_data (plugin_page);
895 if (priv->component_manager_id)
897 gnc_unregister_gui_component(priv->component_manager_id);
898 priv->component_manager_id = 0;
901 gnc_plugin_page_report_destroy(priv);
902 gnc_report_remove_by_id(priv->
reportId);
908 #define SCHEME_OPTIONS "SchemeOptions" 909 #define SCHEME_OPTIONS_N "SchemeOptions%d" 922 gnc_plugin_page_report_save_page (
GncPluginPage *plugin_page,
924 const gchar *group_name)
928 SCM gen_save_text, scm_text;
929 SCM get_embedded_list, embedded, item, tmp_report;
932 gchar *text, *key_name;
934 g_return_if_fail (GNC_IS_PLUGIN_PAGE_REPORT(plugin_page));
935 g_return_if_fail (key_file !=
nullptr);
936 g_return_if_fail (group_name !=
nullptr);
938 ENTER(
"page %p, key_file %p, group_name %s", plugin_page, key_file,
941 report = GNC_PLUGIN_PAGE_REPORT(plugin_page);
942 priv = GNC_PLUGIN_PAGE_REPORT_GET_PRIVATE(report);
947 LEAVE(
"not saving invalid report");
951 gen_save_text = scm_c_eval_string(
"gnc:report-serialize");
952 get_embedded_list = scm_c_eval_string(
"gnc:report-embedded-list");
953 get_options = scm_c_eval_string(
"gnc:report-options");
954 embedded = scm_call_1(get_embedded_list, scm_call_1(get_options, priv->
cur_report));
955 count = scm_ilength(embedded);
958 item = SCM_CAR(embedded);
959 embedded = SCM_CDR(embedded);
960 if (!scm_is_number(item))
962 id = scm_to_int (item);
963 tmp_report = gnc_report_find(
id);
964 scm_text = scm_call_1(gen_save_text, tmp_report);
965 if (!scm_is_string (scm_text))
967 DEBUG(
"child report %d: nothing to save",
id);
971 key_name = g_strdup_printf(SCHEME_OPTIONS_N,
id);
972 text = gnc_scm_strip_comments(scm_text);
973 g_key_file_set_value(key_file, group_name, key_name, text);
978 scm_text = scm_call_1(gen_save_text, priv->
cur_report);
979 if (!scm_is_string (scm_text))
981 LEAVE(
"nothing to save");
985 text = gnc_scm_strip_comments(scm_text);
1002 gnc_plugin_page_report_recreate_page (GtkWidget *window,
1004 const gchar *group_name)
1009 GError *error =
nullptr;
1010 gchar *option_string;
1012 SCM scm_id, final_id = SCM_BOOL_F;
1015 g_return_val_if_fail(key_file,
nullptr);
1016 g_return_val_if_fail(group_name,
nullptr);
1017 ENTER(
"key_file %p, group_name %s", key_file, group_name);
1019 keys = g_key_file_get_keys(key_file, group_name, &num_keys, &error);
1022 g_warning(
"error reading group %s key list: %s",
1023 group_name, error->message);
1024 g_error_free(error);
1029 for (i = 0; i < num_keys; i++)
1033 option_string = g_key_file_get_value(key_file, group_name,
1037 g_warning(
"error reading group %s key %s: %s",
1038 group_name, keys[i], error->message);
1039 g_error_free(error);
1044 scm_id = scm_eval_string(scm_from_utf8_string(option_string));
1045 g_free(option_string);
1047 if (!scm_integer_p(scm_id))
1049 DEBUG(
"report id not an integer for key %s", keys[i]);
1054 if (final_id == SCM_BOOL_F)
1064 if (final_id == SCM_BOOL_F)
1066 LEAVE(
"report not specified");
1070 report_id = scm_to_int(final_id);
1071 report = gnc_report_find(report_id);
1074 LEAVE(
"report doesn't exist");
1096 gnc_plugin_page_report_name_changed (
GncPluginPage *page,
const gchar *name)
1100 g_return_if_fail(GNC_IS_PLUGIN_PAGE_REPORT(page));
1101 g_return_if_fail(name !=
nullptr);
1103 ENTER(
"page %p, name %s", page, name);
1104 priv = GNC_PLUGIN_PAGE_REPORT_GET_PRIVATE(page);
1110 auto old_name = priv->
cur_odb->lookup_string_option(
"General",
1112 std::string name_str{name};
1113 DEBUG(
"Comparing old name '%s' to new name '%s'",
1114 old_name.empty() ?
"(null)" : old_name.c_str(), name);
1115 if (old_name == name_str)
1122 priv->
cur_odb->set_string_option(
"General",
"Report name", name_str);
1127 gnc_plugin_page_report_option_change_cb(page);
1132 gnc_plugin_page_report_update_edit_menu (
GncPluginPage *page, gboolean hide)
1138 g_simple_action_set_enabled (G_SIMPLE_ACTION(action), TRUE);
1140 g_simple_action_set_enabled (G_SIMPLE_ACTION(action), FALSE);
1142 g_simple_action_set_enabled (G_SIMPLE_ACTION(action), FALSE);
1151 report = GNC_PLUGIN_PAGE_REPORT(page);
1152 priv = GNC_PLUGIN_PAGE_REPORT_GET_PRIVATE(report);
1153 return !priv->reloading;
1164 SCM get_editor = scm_c_eval_string(
"gnc:report-editor-widget");
1165 SCM set_editor = scm_c_eval_string(
"gnc:report-set-editor-widget!");
1169 for (edited = scm_list_copy(priv->edited_reports); !scm_is_null(edited);
1170 edited = SCM_CDR(edited))
1172 editor = scm_call_1(get_editor, SCM_CAR(edited));
1173 scm_call_2(set_editor, SCM_CAR(edited), SCM_BOOL_F);
1174 if (editor != SCM_BOOL_F)
1176 #define FUNC_NAME "gtk_widget_destroy" 1177 auto w{
static_cast<GtkWidget*
>(SWIG_MustGetPtr(editor, SWIG_TypeQuery(
"_p_GtkWidget"), 1, 0))};
1179 gtk_widget_destroy(GTK_WIDGET(w));
1183 if (priv->initial_odb)
1187 priv->initial_odb =
nullptr;
1190 gnc_html_destroy(priv->
html);
1193 priv->
html =
nullptr;
1197 if (priv->edited_reports != SCM_EOL)
1198 scm_gc_unprotect_object(priv->edited_reports);
1205 priv->action_group = NULL;
1209 gnc_plugin_page_report_constructor(GType this_type, guint n_properties, GObjectConstructParam *properties)
1211 GObject *obj = G_OBJECT_CLASS (gnc_plugin_page_report_parent_class)->constructor(this_type, n_properties, properties);
1213 gint reportId = -42;
1214 for (decltype(n_properties) i = 0; i < n_properties; i++)
1216 GObjectConstructParam prop = properties[i];
1217 if (strcmp(prop.pspec->name,
"report-id") == 0)
1219 reportId = g_value_get_int(prop.value);
1223 gnc_plugin_page_report_constr_init(GNC_PLUGIN_PAGE_REPORT(obj), reportId);
1229 gnc_plugin_page_report_menu_update (
GncPluginPage *plugin_page,
1232 GncMainWindow *window = GNC_MAIN_WINDOW(GNC_PLUGIN_PAGE(plugin_page)->window);
1233 GtkWidget *tool_item;
1235 for (gint i = 0; (tooltip_list[i].
action_name !=
nullptr); i++)
1238 tooltip_list[i].action_name,
1239 _(tooltip_list[i].label),
1240 _(tooltip_list[i].tooltip));
1243 tooltip_list[i].action_name);
1246 gtk_widget_set_tooltip_text (GTK_WIDGET(tool_item), _(tooltip_list[i].tooltip));
1247 g_object_set (G_OBJECT(tool_item),
"has-tooltip",
false,
nullptr);
1255 gnc_plugin_page_report_menu_updates (
GncPluginPage *plugin_page)
1259 GncMainWindow *window;
1264 gchar *report_save_str = g_strdup_printf (
1265 _(
"Update the current report's saved configuration. " 1266 "The report configuration will be saved in the file %s."), saved_reports_path);
1267 gchar *report_saveas_str = g_strdup_printf (
1268 _(
"Add the current report's configuration to the 'Reports->Saved Report Configurations' menu. " 1269 "The report configuration will be saved in the file %s."), saved_reports_path);
1271 report = GNC_PLUGIN_PAGE_REPORT(plugin_page);
1272 priv = GNC_PLUGIN_PAGE_REPORT_GET_PRIVATE(report);
1276 tooltip_list[0] = {
"ReportSaveAction", N_(
"Save _Report Configuration"), report_save_str };
1277 tooltip_list[1] = {
"ReportSaveAsAction", N_(
"Save Report Configuration As…"), report_saveas_str };
1278 tooltip_list[2] = {
nullptr,
nullptr,
nullptr };
1280 gnc_plugin_page_report_menu_update (plugin_page, tooltip_list);
1284 g_simple_action_set_enabled (G_SIMPLE_ACTION(action),
true);
1289 gtk_widget_hide (pdf_item);
1291 g_free (saved_reports_path);
1292 g_free (report_save_str);
1293 g_free (report_saveas_str);
1304 DEBUG(
"property reportId=%d", reportId);
1305 priv = GNC_PLUGIN_PAGE_REPORT_GET_PRIVATE(plugin_page);
1307 priv->webkit2 = FALSE;
1309 gnc_plugin_page_report_setup( GNC_PLUGIN_PAGE(plugin_page));
1312 parent = GNC_PLUGIN_PAGE(plugin_page);
1314 name = gnc_report_name (priv->initial_report);
1315 g_object_set (G_OBJECT(plugin_page),
1317 "ui-description",
"gnc-plugin-page-report.ui",
1318 "use-new-window", use_new,
1327 g_action_map_add_action_entries (G_ACTION_MAP(priv->action_group),
1335 disable_during_load_actions, FALSE);
1341 DEBUG(
"report id = %d", reportId );
1342 auto plugin_page{g_object_new(GNC_TYPE_PLUGIN_PAGE_REPORT,
"report-id",
1343 reportId,
nullptr)};
1344 DEBUG(
"plugin_page: %p", plugin_page );
1345 DEBUG(
"set %d on page %p", reportId, plugin_page );
1346 return GNC_PLUGIN_PAGE( plugin_page );
1353 SCM new_edited = scm_delete(priv->edited_reports, report);
1354 if (priv->edited_reports != SCM_EOL)
1355 scm_gc_unprotect_object(priv->edited_reports);
1356 priv->edited_reports = new_edited;
1357 if (new_edited != SCM_EOL)
1358 scm_gc_protect_object(priv->edited_reports);
1365 SCM new_edited = scm_cons(report, priv->edited_reports);
1366 if (priv->edited_reports != SCM_EOL)
1367 scm_gc_unprotect_object(priv->edited_reports);
1368 priv->edited_reports = new_edited;
1369 if (new_edited != SCM_EOL)
1370 scm_gc_protect_object(priv->edited_reports);
1374 gnc_plugin_page_report_raise_editor(SCM report)
1376 SCM get_editor = scm_c_eval_string(
"gnc:report-editor-widget");
1377 SCM editor = scm_call_1(get_editor, report);
1378 #define FUNC_NAME "gtk_window_present" 1379 auto w{
static_cast<GtkWidget *
>(SWIG_MustGetPtr(editor, SWIG_TypeQuery(
"_p_GtkWidget"), 1, 0))};
1381 gtk_window_present(GTK_WINDOW(w));
1385 close_handler (gpointer user_data)
1388 DEBUG(
"in close handler\n");
1396 "ReportForwAction");
1398 g_simple_action_set_enabled (G_SIMPLE_ACTION(action), enabled);
1405 "ReportBackAction");
1407 g_simple_action_set_enabled (G_SIMPLE_ACTION(action), enabled);
1414 gnc_plugin_page_report_forw_cb (GSimpleAction *simple,
1415 GVariant *parameter,
1420 gnc_html_history_node * node =
nullptr;
1423 priv = GNC_PLUGIN_PAGE_REPORT_GET_PRIVATE(report);
1424 gnc_html_history_forward(gnc_html_get_history(priv->
html));
1425 node = gnc_html_history_get_current(gnc_html_get_history(priv->
html));
1428 gnc_html_show_url(priv->
html, node->type, node->location,
1434 gnc_plugin_page_report_back_cb (GSimpleAction *simple,
1435 GVariant *parameter,
1440 gnc_html_history_node * node;
1443 priv = GNC_PLUGIN_PAGE_REPORT_GET_PRIVATE(report);
1444 gnc_html_history_back(gnc_html_get_history(priv->
html));
1445 node = gnc_html_history_get_current(gnc_html_get_history(priv->
html));
1448 gnc_html_show_url(priv->
html, node->type, node->location,
1456 gnc_plugin_page_report_reload_cb (
nullptr,
nullptr, report);
1460 gnc_plugin_page_report_reload_cb (GSimpleAction *simple,
1461 GVariant *parameter,
1470 page = GNC_PLUGIN_PAGE(report);
1471 priv = GNC_PLUGIN_PAGE_REPORT_GET_PRIVATE(report);
1475 DEBUG(
"reload-redraw" );
1476 dirty_report = scm_c_eval_string(
"gnc:report-set-dirty?!");
1477 scm_call_2(dirty_report, priv->
cur_report, SCM_BOOL_T);
1482 disable_during_load_actions, FALSE);
1484 priv->reloading = TRUE;
1486 gnc_window_set_progressbar_window( GNC_WINDOW(page->
window) );
1489 gnc_plugin_page_report_set_progressbar( page, TRUE );
1491 gnc_html_reload( priv->
html, TRUE );
1493 gnc_plugin_page_report_set_progressbar( page, FALSE );
1496 gnc_window_set_progressbar_window(
nullptr );
1498 disable_during_load_actions, TRUE);
1499 priv->reloading = FALSE;
1503 gnc_plugin_page_report_stop_cb (GSimpleAction *simple,
1504 GVariant *parameter,
1510 priv = GNC_PLUGIN_PAGE_REPORT_GET_PRIVATE(report);
1511 gnc_html_cancel(priv->
html);
1517 gnc_get_export_type_choice (SCM export_types, GtkWindow *parent)
1519 GList * choices =
nullptr;
1520 gboolean bad = FALSE;
1525 if (!scm_is_list (export_types))
1528 for (tail = export_types; !scm_is_null (tail); tail = SCM_CDR (tail))
1530 SCM pair = SCM_CAR (tail);
1534 if (!scm_is_pair (pair))
1536 g_warning (
"unexpected list element");
1541 scm = SCM_CAR (pair);
1542 if (!scm_is_string (scm))
1544 g_warning (
"unexpected pair element");
1549 name = gnc_scm_to_utf8_string (scm);
1550 choices = g_list_prepend (choices, name);
1555 choices = g_list_reverse (choices);
1557 choices = g_list_prepend (choices, g_strdup (_(
"HTML")));
1559 choice = gnc_choose_radio_option_dialog
1560 (GTK_WIDGET (parent), _(
"Choose export format"),
1561 _(
"Choose the export format for this report:"),
1562 nullptr, 0, choices);
1567 for (node = choices; node; node = node->next)
1568 g_free (node->data);
1569 g_list_free (choices);
1578 if (choice >= scm_ilength (export_types))
1581 return scm_list_ref (export_types, scm_from_int (choice));
1585 gnc_get_export_filename (SCM choice, GtkWindow *parent)
1590 const gchar * html_type = _(
"HTML");
1595 if (choice == SCM_BOOL_T)
1596 type = g_strdup (html_type);
1598 type = gnc_scm_to_utf8_string(SCM_CAR (choice));
1601 title = g_strdup_printf (_(
"Save %s To File"), type);
1602 default_dir = gnc_get_default_directory(GNC_PREFS_GROUP_REPORT);
1604 filepath = gnc_file_dialog (parent, title,
nullptr, default_dir,
1605 GNC_FILE_DIALOG_EXPORT);
1607 if (filepath !=
nullptr)
1610 if (g_strrstr(filepath,
".") ==
nullptr)
1611 filepath = g_strconcat(filepath,
".", g_ascii_strdown(type, strlen(type)),
nullptr);
1615 g_free (default_dir);
1620 default_dir = g_path_get_dirname(filepath);
1621 gnc_set_default_directory (GNC_PREFS_GROUP_REPORT, default_dir);
1622 g_free(default_dir);
1624 rc = g_stat (filepath, &statbuf);
1627 if (rc != 0 && errno != ENOENT)
1630 const char *format = _(
"You cannot save to that filename.\n\n%s");
1632 gnc_error_dialog (parent, format, strerror(errno));
1638 if (rc == 0 && !S_ISREG (statbuf.st_mode))
1640 const char *message = _(
"You cannot save to that file.");
1642 gnc_error_dialog (parent,
"%s", message);
1649 const char *format = _(
"The file %s already exists. " 1650 "Are you sure you want to overwrite it?");
1652 if (!gnc_verify_dialog (parent, FALSE, format, filepath))
1663 gnc_plugin_page_report_edit_tax_cb (GSimpleAction *simple,
1664 GVariant *parameter,
1670 window = GNC_PLUGIN_PAGE(report)->window;
1671 gnc_tax_info_dialog (window,
nullptr);
1675 gnc_plugin_page_report_save_as_cb (GSimpleAction *simple,
1676 GVariant *parameter,
1684 priv = GNC_PLUGIN_PAGE_REPORT_GET_PRIVATE(report);
1691 save_func = scm_c_eval_string(
"gnc:report-to-template-new");
1692 rpt_id = scm_call_1(save_func, priv->
cur_report);
1695 if (!scm_is_null (rpt_id))
1698 GtkWidget *window = reportPage->
window;
1701 g_return_if_fail(GNC_IS_MAIN_WINDOW(window));
1703 gnc_ui_custom_report_edit_name (GNC_MAIN_WINDOW (window), rpt_id);
1709 gnc_plugin_page_report_save_cb (GSimpleAction *simple,
1710 GVariant *parameter,
1715 SCM check_func, save_func;
1718 priv = GNC_PLUGIN_PAGE_REPORT_GET_PRIVATE(report);
1722 check_func = scm_c_eval_string(
"gnc:is-custom-report-type");
1723 if (scm_is_true (scm_call_1 (check_func, priv->
cur_report)))
1728 save_func = scm_c_eval_string(
"gnc:report-to-template-update");
1729 rpt_id = scm_call_1(save_func, priv->
cur_report);
1738 gnc_plugin_page_report_save_as_cb (simple, parameter, report);
1743 gnc_plugin_page_report_export_cb (GSimpleAction *simple,
1744 GVariant *parameter,
1755 (GNC_PLUGIN_PAGE (report)));
1757 priv = GNC_PLUGIN_PAGE_REPORT_GET_PRIVATE(report);
1758 export_types = scm_call_1 (scm_c_eval_string (
"gnc:report-export-types"),
1761 export_thunk = scm_call_1 (scm_c_eval_string (
"gnc:report-export-thunk"),
1764 if (scm_is_list (export_types) && scm_is_procedure (export_thunk))
1765 choice = gnc_get_export_type_choice (export_types, parent);
1767 choice = SCM_BOOL_T;
1769 if (choice == SCM_BOOL_F)
1772 filepath = gnc_get_export_filename (choice, parent);
1776 if (scm_is_pair (choice))
1778 SCM type = scm_cdr (choice);
1779 SCM document = scm_call_2 (export_thunk, priv->
cur_report, type);
1780 SCM query_result = scm_c_eval_string (
"gnc:html-document?");
1781 SCM get_export_string = scm_c_eval_string (
"gnc:html-document-export-string");
1782 SCM get_export_error = scm_c_eval_string (
"gnc:html-document-export-error");
1784 if (scm_is_false (scm_call_1 (query_result, document)))
1785 gnc_error_dialog (parent,
"%s",
1786 _(
"This report must be upgraded to return a " 1787 "document object with export-string or " 1791 SCM export_string = scm_call_1 (get_export_string, document);
1792 SCM export_error = scm_call_1 (get_export_error, document);
1794 if (scm_is_string (export_string))
1796 GError *err =
nullptr;
1797 gchar *exported = scm_to_utf8_string (export_string);
1798 if (!g_file_set_contents (filepath, exported, -1, &err))
1799 gnc_error_dialog (parent,
"Error during export: %s", err->message);
1804 else if (scm_is_string (export_error))
1806 gchar *str = scm_to_utf8_string (export_error);
1807 gnc_error_dialog (parent,
"error during export: %s", str);
1811 gnc_error_dialog (parent,
"%s",
1812 _(
"This report must be upgraded to return a " 1813 "document object with export-string or " 1819 result = gnc_html_export_to_file (priv->
html, filepath);
1823 const char *fmt = _(
"Could not open the file %s. " 1824 "The error is: %s");
1825 gnc_error_dialog (parent, fmt, filepath ? filepath :
"(null)",
1826 strerror (errno) ? strerror (errno) :
"" );
1834 gnc_plugin_page_report_options_cb (GSimpleAction *simple,
1835 GVariant *parameter,
1841 priv = GNC_PLUGIN_PAGE_REPORT_GET_PRIVATE(report);
1845 if (gnc_report_edit_options (priv->
cur_report, parent))
1846 gnc_plugin_page_report_add_edited_report(priv, priv->
cur_report);
1855 return GNC_INVOICE(opt_val);
1858 #define GNC_PREFS_GROUP_REPORT_PDFEXPORT GNC_PREFS_GROUP_GENERAL_REPORT ".pdf-export" 1859 #define GNC_PREF_FILENAME_DATE_FMT "filename-date-format" 1860 #define GNC_PREF_FILENAME_FMT "filename-format" 1864 gchar *job_name =
nullptr;
1865 gchar *report_name =
nullptr;
1866 const gchar *report_number =
"";
1868 const gchar *default_jobname = N_(
"GnuCash-Report");
1876 GNC_PREF_FILENAME_DATE_FMT);
1877 const gchar *date_format_string;
1878 if (!(format_code && *format_code))
1880 g_free(format_code);
1881 format_code = g_strdup(
"locale");
1885 PERR(
"Incorrect date format code, using ISO-8601.");
1890 g_free (format_code);
1895 report_name = g_strdup (_(default_jobname));
1909 GncInvoice *invoice;
1910 auto report_name_str = priv->
cur_odb->lookup_string_option(
"General",
1912 if (!report_name_str.empty())
1913 report_name = g_strdup(report_name_str.c_str());
1915 report_name = g_strdup (_(default_jobname));
1917 if (g_strcmp0(report_name, _(
"Printable Invoice")) == 0
1918 || g_strcmp0(report_name, _(
"Tax Invoice")) == 0
1919 || g_strcmp0(report_name, _(
"Easy Invoice")) == 0
1920 || g_strcmp0(report_name, _(
"Fancy Invoice")) == 0)
1924 g_free(report_name);
1925 report_name = g_strdup(_(
"Invoice"));
1928 invoice = lookup_invoice(priv);
1932 report_number = gncInvoiceGetID(invoice);
1936 if (report_name && job_date)
1941 if (format && *format)
1943 job_name = g_strdup_printf(format, report_name,
1944 report_number, job_date);
1948 PWARN(
"No GNC_PREF_FILENAME_FMT!");
1949 job_name = g_strdup_printf (
"%s %s %s", report_name,
1950 report_number, job_date);
1954 g_free (report_name);
1958 char forbidden_char =
'/';
1961 while (strchr(job_name, forbidden_char))
1963 *strchr(job_name, forbidden_char) =
'_';
1973 auto& value = static_report_printnames[job_name];
1979 gchar *tmp = g_strdup_printf(
"%s_%d", job_name, value);
1989 gnc_plugin_page_report_print_cb (GSimpleAction *simple,
1990 GVariant *parameter,
1995 gchar *job_name = report_create_jobname(priv);
2000 gnc_html_print (priv->
html, job_name, FALSE);
2002 gnc_html_print (priv->
html, job_name);
2009 gnc_plugin_page_report_exportpdf_cb (GSimpleAction *simple,
2010 GVariant *parameter,
2015 gchar *job_name = report_create_jobname(priv);
2016 GncInvoice *invoice;
2020 invoice = lookup_invoice(priv);
2024 owner = (
GncOwner*) gncInvoiceGetOwner(invoice);
2028 gchar *dirname =
nullptr;
2033 if (dirname && g_file_test (dirname,
2034 (GFileTest)(G_FILE_TEST_EXISTS | G_FILE_TEST_IS_DIR)))
2036 gchar *tmp = g_build_filename (dirname, job_name,
nullptr);
2046 gnc_html_print (priv->
html, job_name, TRUE);
2048 gnc_html_print (priv->
html, job_name);
2058 if (print_settings && gtk_print_settings_has_key (print_settings,
2061 const char* dirname = gtk_print_settings_get (print_settings,
2064 if (g_file_test (dirname,
2065 (GFileTest)(G_FILE_TEST_EXISTS | G_FILE_TEST_IS_DIR)))
2070 gncOwnerCommitEdit (owner);
2078 gnc_plugin_page_report_copy_cb (GSimpleAction *simple,
2079 GVariant *parameter,
2085 priv = GNC_PLUGIN_PAGE_REPORT_GET_PRIVATE(report);
2086 gnc_html_copy_to_clipboard(priv->
html);
2095 gnc_main_window_open_report(
int report_id, GncMainWindow *window)
2100 g_return_if_fail(GNC_IS_MAIN_WINDOW(window));
2107 gnc_main_window_open_report_url(
const char * url, GncMainWindow *window)
2111 DEBUG(
"report url: [%s]\n", url );
2114 g_return_if_fail(GNC_IS_MAIN_WINDOW(window));
Holds all of the options for a book, report, or stylesheet, organized by GncOptionSections.
GtkWidget * gnc_plugin_page_get_window(GncPluginPage *page)
Retrieve a pointer to the GncMainWindow (GtkWindow) containing this page.
const gchar * tab_icon
The relative name of the icon that should be shown on the tab for this page.
const QofInstance * gnc_option_db_lookup_qofinstance_value(GncOptionDB *odb, const char *section, const char *name)
Retrieve the QofInstance value of an option in the GncOptionDB.
gboolean(* focus_page_function)(GncPluginPage *plugin_page)
This function performs specific actions to set the focus on a specific widget.
void gnc_main_window_update_menu_and_toolbar(GncMainWindow *window, GncPluginPage *page, const gchar **ui_updates)
Update the main window menu with the placeholders listed in ui_updates and load the page specific too...
void qof_instance_get(const QofInstance *inst, const gchar *first_prop,...)
Wrapper for g_object_get.
The instance data structure for a content plugin.
gchar * gnc_prefs_get_string(const gchar *group, const gchar *pref_name)
Get a string value from the preferences backend.
gchar * gnc_build_userdata_path(const gchar *filename)
Make a path to filename in the user's gnucash data directory.
#define GNC_GTK_PRINT_SETTINGS_EXPORT_DIR
Key for saving the PDF-export directory in the print settings.
GtkWindow * gnc_ui_get_main_window(GtkWidget *widget)
Get a pointer to the final GncMainWindow widget is rooted in.
utility functions for the GnuCash UI
#define PINFO(format, args...)
Print an informational note.
GncPluginPage *(* recreate_page)(GtkWidget *window, GKeyFile *file, const gchar *group)
Create a new page based on the information saved during a previous instantiation of gnucash...
void gnc_main_window_menu_add_accelerator_keys(GncMainWindow *window)
Scan the main window menu and add accelerator keys to main window accelerator group.
void gnc_main_window_init_short_names(GncMainWindow *window, GncToolBarShortNames *toolbar_labels)
Update the labels of the toolbar items with short names.
#define DEBUG(format, args...)
Print a debugging message.
const gchar * gnc_plugin_page_get_page_name(GncPluginPage *page)
Retrieve the name of this page.
Functions that are supported by all types of windows.
void qof_instance_set(QofInstance *inst, const gchar *first_prop,...)
Wrapper for g_object_set Group setting multiple parameters in a single begin/commit/rollback.
GtkWidget * gnc_main_window_menu_find_menu_item(GncMainWindow *window, const gchar *action_name)
Find the menu item with the given action name for the window specified.
void gnc_utf8_strip_invalid_and_controls(gchar *str)
Strip any non-utf8 characters and any control characters (everything < 0x20, , , ...
GtkWidget * window
The window that contains the display widget for this plugin.
gboolean gnc_main_window_is_restoring_pages(GncMainWindow *window)
Check if the main window is restoring the plugin pages.
GSimpleActionGroup * gnc_plugin_page_create_action_group(GncPluginPage *page, const gchar *group_name)
Create the GSimpleActionGroup object associated with this page.
gboolean gnc_main_window_update_menu_for_action(GncMainWindow *window, const gchar *action_name, const gchar *label, const gchar *tooltip)
Find the GMenuModel item given the action name for the window specified.
#define PERR(format, args...)
Log a serious error.
#define ENTER(format, args...)
Print a function entry debugging message.
void gncOwnerBeginEdit(GncOwner *owner)
These are convenience wrappers around gnc{Vendor,Customer,Job,Employee}* functions.
GncPluginPage * gnc_main_window_get_current_page(GncMainWindow *window)
Retrieve a pointer to the page that is currently at the front of the specified window.
void gnc_main_window_open_page(GncMainWindow *window, GncPluginPage *page)
Display a data plugin page in a window.
QofInstance * qofOwnerGetOwner(const GncOwner *owner)
return the owner itself as an entity.
void(* update_edit_menu_actions)(GncPluginPage *plugin_page, gboolean hide)
This function vector allows page specific actions to override the generic code for setting the sensit...
void(* destroy_widget)(GncPluginPage *plugin_page)
Function called to destroy the display widget for a particular type of plugin.
#define PWARN(format, args...)
Log a warning.
This file contains the functions to present a GUI to manage custom reports.
The class data structure for a content plugin.
GAction * gnc_main_window_find_action(GncMainWindow *window, const gchar *action_name)
Find the GAction in the main window.
Functions providing the file history menu.
void gnc_plugin_page_disconnect_page_changed(GncPluginPage *page)
Disconnect the page_changed_id signal callback.
void gnc_option_db_destroy(GncOptionDB *odb)
Destruct and release a GncOptionDB.
char * gnc_print_time64(time64 time, const char *format)
print a time64 as a date string per format
const gchar * plugin_name
The textual name of this plugin.
GtkWidget *(* create_widget)(GncPluginPage *plugin_page)
Function called to create the display widget for a particular type of plugin.
void(* page_name_changed)(GncPluginPage *plugin_page, const gchar *name)
This function vector allows page specific actions to occur when the page name is changed.
Gnome specific utility functions.
gboolean(* finish_pending)(GncPluginPage *plugin_page)
This function vector is called to finish any outstanding activities.
All type declarations for the whole Gnucash engine.
void(* save_page)(GncPluginPage *page, GKeyFile *file, const gchar *group)
Save enough information about this page so that it can be recreated next time the user starts gnucash...
GncPluginPage * gnc_plugin_page_report_new(int reportId)
GtkPrintSettings * gnc_print_get_settings()
Returns the pointer to our static GtkPrintSettings object.
Generic api to store and retrieve preferences.
gboolean gnc_prefs_get_bool(const gchar *group, const gchar *pref_name)
Get a boolean value from the preferences backend.
void gnc_plugin_page_inserted_cb(GncPluginPage *page, gpointer user_data)
Set up the page_changed callback for when the current page is changed.
void gnc_main_window_close_page(GncPluginPage *page)
Remove a data plugin page from a window and display the previous page.
Functions for adding plugins to a GnuCash window.
#define LEAVE(format, args...)
Print a function exit debugging message.
time64 gnc_time(time64 *tbuf)
get the current time
Implementation details for GncOptionDB.
void gnc_plugin_page_add_book(GncPluginPage *page, QofBook *book)
Add a book reference to the specified page.
File path resolution utility functions.
gboolean gnc_date_string_to_dateformat(const gchar *format_string, QofDateFormat *format)
Converts the date format to a printable string.
const gchar * qof_date_format_get_string(QofDateFormat df)
This function returns a strftime formatting string for printing an all numeric date (e...
void main_window_update_page_name(GncPluginPage *page, const gchar *name_in)
Update the name of the page in the main window.
GAction * gnc_plugin_page_get_action(GncPluginPage *page, const gchar *name)
Retrieve a GAction object associated with this page.
QofDateFormat
Enum for determining a date format.
GtkWidget * gnc_main_window_toolbar_find_tool_item(GncMainWindow *window, const gchar *action_name)
Find the toolbar item with the given action name for the window specified.
#define SCHEME_OPTIONS
The key name used it the state file for storing the report options.