[Gnucash-changes] Removal of old code.
David Hampton
hampton at cvs.gnucash.org
Sun Jun 5 03:30:08 EDT 2005
Log Message:
-----------
Removal of old code.
Tags:
----
gnucash-gnome2-dev
Modified Files:
--------------
gnucash/src/gnome-utils:
gw-gnome-utils-spec.scm
gnucash/src/report/report-gnome:
window-report.c
window-report.h
Revision Data
-------------
Index: gw-gnome-utils-spec.scm
===================================================================
RCS file: /home/cvs/cvsroot/gnucash/src/gnome-utils/gw-gnome-utils-spec.scm,v
retrieving revision 1.19.4.6
retrieving revision 1.19.4.7
diff -Lsrc/gnome-utils/gw-gnome-utils-spec.scm -Lsrc/gnome-utils/gw-gnome-utils-spec.scm -u -r1.19.4.6 -r1.19.4.7
--- src/gnome-utils/gw-gnome-utils-spec.scm
+++ src/gnome-utils/gw-gnome-utils-spec.scm
@@ -23,11 +23,6 @@
(gw:wrapset-set-guile-module! ws '(g-wrapped gw-gnome-utils))
- (gw:wrap-value ws 'gnc:window-name-main '(<gw:mchars> callee-owned const) "WINDOW_NAME_MAIN")
- (gw:wrap-value ws 'gnc:window-name-register '(<gw:mchars> callee-owned const) "WINDOW_NAME_REGISTER")
- (gw:wrap-value ws 'gnc:window-name-invoice '(<gw:mchars> callee-owned const) "WINDOW_NAME_INVOICE")
- (gw:wrap-value ws 'gnc:window-name-all '(<gw:mchars> callee-owned const) "WINDOW_NAME_ALL")
-
(gw:wrap-value ws 'gnc:additional-menus-placeholder '(<gw:mchars> callee-owned const) "ADDITIONAL_MENUS_PLACEHOLDER")
(gw:wrapset-add-cs-declarations!
Index: window-report.c
===================================================================
RCS file: /home/cvs/cvsroot/gnucash/src/report/report-gnome/window-report.c,v
retrieving revision 1.15.4.11
retrieving revision 1.15.4.12
diff -Lsrc/report/report-gnome/window-report.c -Lsrc/report/report-gnome/window-report.c -u -r1.15.4.11 -r1.15.4.12
--- src/report/report-gnome/window-report.c
+++ src/report/report-gnome/window-report.c
@@ -35,17 +35,8 @@
#include <g-wrap-wct.h>
#include "dialog-options.h"
-#include "dialog-utils.h"
#include "file-utils.h"
-#include "gnc-component-manager.h"
-#include "gnc-engine-util.h"
-#include "gnc-file-dialog.h"
-#include "gnc-gui-query.h"
-#include "gnc-html-history.h"
-#include "gnc-html.h"
-#include "gnc-plugin-page.h"
#include "gnc-report.h"
-#include "gnc-main-window.h"
#include "gnc-ui.h"
#include "option-util.h"
#include "window-report.h"
@@ -55,998 +46,16 @@
#define WINDOW_REPORT_CM_CLASS "window-report"
-struct gnc_report_window_s
-{
- GNCMDIChildInfo * mc;
- GtkWidget * container;
-
- /* the report that's currently being shown. For any option change
- * we need to rerun the report */
- SCM cur_report;
- GNCOptionDB * cur_odb;
- SCM option_change_cb_id;
-
- /* initial_report is special; it's the one that's saved and
- * restored. The name_change_callback only gets called when
- * the initial_report name is changed. */
- SCM initial_report;
- GNCOptionDB * initial_odb;
- SCM name_change_cb_id;
-
- SCM edited_reports;
-
- /* This is set to mark the fact that we need to reload the html */
- gboolean need_reload;
-
- gnc_html * html;
-};
-
-
-static void gnc_report_window_print_cb(GtkWidget * w, gpointer data);
-static void gnc_report_window_reload_cb(GtkWidget * w, gpointer data);
-
-/********************************************************************
- * REPORT WINDOW FUNCTIONS
- * creating/managing report-window mdi children
- ********************************************************************/
-
-/********************************************************************
- * gnc_report_window_view_labeler
- * label the window/tab/menu item with the report name
- ********************************************************************/
-
-static GtkWidget *
-gnc_report_window_view_labeler(GnomeMDIChild * child, GtkWidget * current,
- gpointer user_data)
-{
- GNCMDIChildInfo * rwin = gtk_object_get_user_data(GTK_OBJECT(child));
- gnc_report_window * report;
- SCM get_name = scm_c_eval_string("gnc:report-name");
- char * name = NULL;
-
- if(rwin) {
- report = rwin->user_data;
- if(report->initial_report != SCM_BOOL_F) {
- name = gh_scm2newstr(scm_call_1(get_name,
- report->initial_report),
- NULL);
- }
- else {
- name = strdup(_("(Report not found)"));
- }
- g_free(rwin->title);
- rwin->title = g_strdup(name);
- }
- else {
- name = strdup(_("Report"));
- }
-
- if(current == NULL) {
- current = gtk_label_new(name);
- free(name);
- }
- else {
- gtk_label_set_text(GTK_LABEL(current), name);
- free(name);
- }
- gtk_misc_set_alignment (GTK_MISC(current), 0.0, 0.5);
- return current;
-}
-
-static void
-gnc_report_window_view_destroy(GtkObject * obj, gpointer user_data)
-{
- GNCMDIChildInfo * mc = user_data;
-
- gnc_mdi_remove_child(gnc_mdi_get_current(), mc);
- g_free(mc->toolbar_info);
- g_free(mc->menu_info);
- g_free(mc->title);
- g_free(mc);
-}
-
-static void
-gnc_report_window_menu_tweaking (GNCMDIChildInfo * mc)
-{
- /* Do not i18n these strings!!! */
-}
/********************************************************************
- * report_view_new
- * create a new report view.
- ********************************************************************/
-
-static GtkWidget *
-gnc_report_window_view_new(GnomeMDIChild * child, gpointer user_data)
-{
- GNCMDIInfo * maininfo = user_data;
- GNCMDIChildInfo * mc = g_new0(GNCMDIChildInfo, 1);
- gnc_report_window * win = gnc_report_window_new(mc);
- URLType type;
- char * url_location = NULL;
- char * url_label = NULL;
-
- mc->contents = gnc_report_window_get_container(win);
- mc->app = NULL;
- mc->toolbar = NULL;
- mc->user_data = win;
- mc->child = child;
- mc->title = g_strdup("Report");
- mc->menu_tweaking = gnc_report_window_menu_tweaking;
- gnc_mdi_add_child (maininfo, mc);
-
- /* Override a couple of standard buttons. */
- gnc_mdi_set_dispatch_cb(mc, GNC_DISP_PRINT,
- gnc_report_window_print_cb, win);
- gnc_mdi_set_dispatch_cb(mc, GNC_DISP_REFRESH,
- gnc_report_window_reload_cb, win);
- type = gnc_html_parse_url(gnc_report_window_get_html(win),
- child->name, &url_location, &url_label);
-
- gnc_html_show_url(gnc_report_window_get_html(win),
- type, url_location, url_label, 0);
-
- gtk_object_set_user_data(GTK_OBJECT(child), mc);
-
- /* make sure menu entry and label get refreshed */
- gnome_mdi_child_set_name(child, child->name);
-
- g_signal_connect(G_OBJECT(child), "destroy",
- G_CALLBACK (gnc_report_window_view_destroy), mc);
-
- gnc_report_window_create_menu(win, mc);
- gnc_report_window_create_toolbar(win, mc);
- gnc_mdi_create_child_toolbar(maininfo, mc);
-
- if(mc->menu_info) {
- gnome_mdi_child_set_menu_template(child, mc->menu_info);
- }
-
- g_free(url_location);
- g_free(url_label);
- return mc->contents;
-}
-
-
-/********************************************************************
- * gnc_report_window_create_child()
- * return an MDI child that will create views of the specified report
- * (configstring is the report URL)
- ********************************************************************/
-
-GnomeMDIChild *
-gnc_report_window_create_child(const gchar * configstring)
-{
- GnomeMDIGenericChild * reportchild =
- gnome_mdi_generic_child_new(configstring);
- GNCMDIInfo * maininfo = gnc_mdi_get_current();
-
- gnome_mdi_generic_child_set_label_func(reportchild,
- gnc_report_window_view_labeler,
- maininfo);
- gnome_mdi_generic_child_set_view_creator(reportchild,
- gnc_report_window_view_new,
- maininfo);
- return GNOME_MDI_CHILD(reportchild);
-}
-
-
-/********************************************************************
- * gnc_main_window_open_report()
- * open an report in a top level window from an ID number
+ *
********************************************************************/
void
-gnc_main_window_open_report(int report_id, gint toplevel)
-{
-
- GncMainWindow *mainWin;
- GncPluginPage *reportPage;
-
- mainWin = GNC_MAIN_WINDOW( gnc_ui_get_toplevel() );
- reportPage = gnc_plugin_page_report_new( report_id );
- gnc_main_window_open_page( mainWin, reportPage );
-
-#if 0
- // [+JSLED] id_name=[id=1]
- // [+JSLED] url: gnc-report:id=1
- char * id_name = g_strdup_printf("id=%d", report_id);
- char * child_name = gnc_build_url (URL_TYPE_REPORT, id_name, NULL);
- g_free (id_name);
- gnc_main_window_open_report_url(child_name, toplevel);
-#endif /* 0 */
-}
-
-void
-gnc_main_window_open_report_url(const char * url, gint toplevel)
-{
- GncMainWindow *mainWin;
- GncPluginPage *reportPage;
-
- printf( "report url: [%s]\n", url );
-
- mainWin = GNC_MAIN_WINDOW( gnc_ui_get_toplevel() );
- reportPage = gnc_plugin_page_report_new( 42 /* url? */ );
- gnc_main_window_open_page( mainWin, reportPage );
-
-#if 0
- GnomeMDIChild * reportchild = gnc_report_window_create_child(url);
- GNCMDIInfo * maininfo = gnc_mdi_get_current();
-
- gnome_mdi_add_child(GNOME_MDI(maininfo->mdi),
- GNOME_MDI_CHILD(reportchild));
- if(toplevel) {
- gnome_mdi_add_toplevel_view(GNOME_MDI(maininfo->mdi),
- GNOME_MDI_CHILD(reportchild));
- }
- else {
- GNCMDIChildInfo * childwin;
-
- gnome_mdi_add_view(GNOME_MDI(maininfo->mdi),
- GNOME_MDI_CHILD(reportchild));
-
- childwin = gtk_object_get_user_data(GTK_OBJECT(reportchild));
- if (childwin && childwin->app && GTK_WIDGET (childwin->app)->window)
- gdk_window_raise (GTK_WIDGET (childwin->app)->window);
- }
-#endif /* 0 */
-}
-
-
-/********************************************************************
- * gnc_report_window_check_urltype
- * is it OK to show a certain URLType in this window?
- ********************************************************************/
-
-static int
-gnc_report_window_check_urltype(URLType t)
-{
- if (!safe_strcmp (t, URL_TYPE_REPORT)) {
- return TRUE;
- } else {
- return FALSE;
- }
-}
-
-
-/********************************************************************
- * toolbar callbacks
- ********************************************************************/
-
-static int
-gnc_report_window_fwd_cb(GtkWidget * w, gpointer data)
-{
- gnc_report_window * report = data;
- gnc_html_history_node * node = NULL;
-
- gnc_html_history_forward(gnc_html_get_history(report->html));
- node = gnc_html_history_get_current(gnc_html_get_history(report->html));
- if(node) {
- gnc_html_show_url(report->html, node->type, node->location,
- node->label, 0);
- }
- return TRUE;
-}
-
-static int
-gnc_report_window_back_cb(GtkWidget * w, gpointer data)
-{
- gnc_report_window * report = data;
- gnc_html_history_node * node;
-
- gnc_html_history_back(gnc_html_get_history(report->html));
- node = gnc_html_history_get_current(gnc_html_get_history(report->html));
- if(node) {
- gnc_html_show_url(report->html, node->type, node->location,
- node->label, 0);
- }
- return TRUE;
-}
-
-
-static int
-gnc_report_window_stop_button_cb(GtkWidget * w, gpointer data)
-{
- gnc_report_window * report = data;
- gnc_html_cancel(report->html);
- return TRUE;
-}
-
-/* Returns SCM_BOOL_F if cancel. Returns SCM_BOOL_T if html.
- * Otherwise returns pair from export_types. */
-static SCM
-gnc_get_export_type_choice (SCM export_types)
-{
- GList * choices = NULL;
- gboolean bad = FALSE;
- GList * node;
- int choice;
- SCM tail;
-
- if (!SCM_LISTP (export_types))
- return SCM_BOOL_F;
-
- for (tail = export_types; !SCM_NULLP (tail); tail = SCM_CDR (tail))
- {
- SCM pair = SCM_CAR (tail);
- char * name;
- SCM scm;
-
- if (!SCM_CONSP (pair))
- {
- g_warning ("unexpected list element");
- bad = TRUE;
- break;
- }
-
- scm = SCM_CAR (pair);
- if (!SCM_STRINGP (scm))
- {
- g_warning ("unexpected pair element");
- bad = TRUE;
- break;
- }
-
- name = gh_scm2newstr (scm, NULL);
- choices = g_list_prepend (choices, g_strdup (name));
- if (name) free (name);
- }
-
- if (!bad)
- {
- choices = g_list_reverse (choices);
-
- choices = g_list_prepend (choices, g_strdup (_("HTML")));
-
- choice = gnc_choose_radio_option_dialog
- (NULL, _("Choose export format"),
- _("Choose the export format for this report:"), 0, choices);
- }
- else
- choice = -1;
-
- for (node = choices; node; node = node->next)
- g_free (node->data);
- g_list_free (choices);
-
- if (choice < 0)
- return SCM_BOOL_F;
-
- if (choice == 0)
- return SCM_BOOL_T;
-
- choice--;
- if (choice >= scm_ilength (export_types))
- return SCM_BOOL_F;
-
- return scm_list_ref (export_types, scm_int2num (choice));
-}
-
-static char *
-gnc_get_export_filename (SCM choice)
-{
- char * filepath;
- struct stat statbuf;
- char * title;
- char * type;
- int rc;
-
- if (choice == SCM_BOOL_T)
- type = g_strdup (_("HTML"));
- else
- {
- char * s = gh_scm2newstr (SCM_CAR (choice), NULL);
- type = g_strdup (s);
- if (s) free (s);
- }
-
- /* %s is the type of what is about to be saved, e.g. "HTML". */
- title = g_strdup_printf (_("Save %s To File"), type);
-
- filepath = gnc_file_dialog (title, NULL, NULL);
-
- g_free (title);
- g_free (type);
-
- if (!filepath)
- return NULL;
-
- rc = stat (filepath, &statbuf);
-
- /* Check for an error that isn't a non-existant file. */
- if (rc != 0 && errno != ENOENT)
- {
- /* %s is the strerror(3) string of the error that occurred. */
- const char *format = _("You cannot save to that filename.\n\n%s");
-
- gnc_error_dialog (NULL, format, strerror(errno));
- g_free(filepath);
- return NULL;
- }
-
- /* Check for a file that isn't a regular file. */
- if (rc == 0 && !S_ISREG (statbuf.st_mode))
- {
- const char *message = _("You cannot save to that file.");
-
- gnc_error_dialog (NULL, message);
- g_free(filepath);
- return NULL;
- }
-
- if (rc == 0)
- {
- const char *format = _("The file \n %s\n already exists.\n"
- "Are you sure you want to overwrite it?");
-
- if (!gnc_verify_dialog (NULL, FALSE, format, filepath)) {
- g_free(filepath);
- return NULL;
- }
- }
-
- return filepath;
-}
-
-static int
-gnc_report_window_export_button_cb(GtkWidget * w, gpointer data)
-{
- gnc_report_window * report = data;
- char * filepath;
- SCM export_types;
- SCM export_thunk;
- gboolean result;
- SCM choice;
-
- export_types = scm_call_1 (scm_c_eval_string ("gnc:report-export-types"),
- report->cur_report);
-
- export_thunk = scm_call_1 (scm_c_eval_string ("gnc:report-export-thunk"),
- report->cur_report);
-
- if (SCM_LISTP (export_types) && SCM_PROCEDUREP (export_thunk))
- choice = gnc_get_export_type_choice (export_types);
- else
- choice = SCM_BOOL_T;
-
- if (choice == SCM_BOOL_F)
- return TRUE;
-
- filepath = gnc_get_export_filename (choice);
- if (!filepath)
- return TRUE;
-
- if (SCM_CONSP (choice))
- {
- SCM file_scm;
- SCM res;
-
- choice = SCM_CDR (choice);
- file_scm = scm_makfrom0str (filepath);
-
- res = scm_call_3 (export_thunk, report->cur_report, choice, file_scm);
-
- result = (res != SCM_BOOL_F);
- }
- else
- result = gnc_html_export (report->html, filepath);
-
- if (!result)
- {
- const char *fmt = _("Could not open the file\n"
- " %s\n%s");
- gnc_error_dialog (NULL, fmt, filepath ? filepath : "(null)",
- strerror (errno) ? strerror (errno) : "");
- }
-
- g_free(filepath);
- return TRUE;
-}
-
-
-static int
-gnc_report_window_params_cb(GtkWidget * w, gpointer data)
-{
- gnc_report_window * report = data;
- SCM start_editor = scm_c_eval_string("gnc:report-edit-options");
-
- if(report->cur_report != SCM_BOOL_F)
- {
- if(scm_call_1(start_editor, report->cur_report) == SCM_BOOL_F) {
- gnc_warning_dialog(GTK_WIDGET(report->mc->app),
- _("There are no options for this report."));
- }
- else {
- gnc_report_window_add_edited_report(report, report->cur_report);
- }
- }
-
- return TRUE;
-}
-
-static int
-gnc_report_window_save_cb(GtkWidget * w, gpointer data)
-{
- gnc_report_window * report = data;
- SCM save_func = gh_eval_str("gnc:report-save-to-savefile");
-
- if(report->cur_report != SCM_BOOL_F)
- {
- gh_call1(save_func, report->cur_report);
- }
-
- return TRUE;
-}
-
-/* We got a draw event. See if we need to reload the report */
-static void
-gnc_report_window_draw_cb(GtkWidget *unused, GdkRectangle *unused1, gpointer data)
-{
- gnc_report_window *win = data;
-
- if (!win->need_reload)
- return;
-
- win->need_reload = FALSE;
- gnc_html_reload(win->html);
-}
-
-static void
-gnc_report_window_reload_cb(GtkWidget * unused, gpointer data)
-{
- gnc_report_window * report = data;
- SCM dirty_report = scm_c_eval_string("gnc:report-set-dirty?!");
-
- if(report->cur_report != SCM_BOOL_F) {
- scm_call_2(dirty_report, report->cur_report, SCM_BOOL_T);
-
- /* now queue the fact that we need to reload this report */
- report->need_reload = TRUE;
- gtk_widget_queue_draw(report->container);
- }
-}
-
-static void
-gnc_report_window_set_back_button(gnc_report_window * win, int enabled)
-{
- GnomeApp * app = win->mc->app;
- GnomeUIInfo * info;
-
- /* the code below is broken, so just return */
- return;
-
- if(app) {
- info = gnome_mdi_get_child_menu_info(app);
- if(info) gtk_widget_set_sensitive(info[0].widget, enabled);
- }
-}
-
-static void
-gnc_report_window_set_fwd_button(gnc_report_window * win, int enabled)
-{
- GnomeApp * app = win->mc->app;
- GnomeUIInfo * info;
-
- /* the code below is broken, so just return */
- return;
-
- if(app) {
- info = gnome_mdi_get_child_menu_info(app);
- if(info) gtk_widget_set_sensitive(info[1].widget, enabled);
- }
-}
-
-void
-gnc_report_window_reload(gnc_report_window * win)
-{
- gnc_html_reload(win->html);
-}
-
-static void
-gnc_report_window_option_change_cb(gpointer data)
-{
- gnc_report_window * report = data;
- SCM dirty_report = scm_c_eval_string("gnc:report-set-dirty?!");
-
- if(report->cur_report != SCM_BOOL_F) {
- /* it's probably already dirty, but make sure */
- scm_call_2(dirty_report, report->cur_report, SCM_BOOL_T);
-
- /* Now queue the fact that we need to reload this report */
- report->need_reload = TRUE;
- gtk_widget_queue_draw(report->container);
- }
-}
-
-static void
-gnc_report_window_refresh (gpointer data)
-{
- gnc_mdi_child_refresh (data);
-}
-
-/********************************************************************
- * gnc_report_window_load_cb
- * called after a report is loaded into the gnc_html widget
- ********************************************************************/
-
-static void
-gnc_report_window_load_cb(gnc_html * html, URLType type,
- const gchar * location, const gchar * label,
- gpointer data)
-{
- gnc_report_window * win = data;
- int report_id;
- SCM find_report = scm_c_eval_string("gnc:find-report");
- SCM get_options = scm_c_eval_string("gnc:report-options");
- SCM set_needs_save = scm_c_eval_string("gnc:report-set-needs-save?!");
- SCM inst_report;
-
- /* we get this callback if a new report is requested to be loaded OR
- * if any URL is clicked. If an options URL is clicked, we want to
- * know about it */
- if(!safe_strcmp (type, URL_TYPE_REPORT) &&
- location && (strlen(location) > 3) &&
- !strncmp("id=", location, 3)) {
- sscanf(location+3, "%d", &report_id);
- }
- else if(!safe_strcmp( type, URL_TYPE_OPTIONS)
- && location && (strlen(location) > 10) &&
- !strncmp("report-id=", location, 10)) {
- sscanf(location+10, "%d", &report_id);
- inst_report = scm_call_1(find_report, scm_int2num(report_id));
- if(inst_report != SCM_BOOL_F) {
- gnc_report_window_add_edited_report(win, inst_report);
- }
- return;
- }
- else {
- return;
- }
-
- /* get the inst-report from the Scheme-side hash, and get its
- * options and editor thunk */
- if((inst_report = scm_call_1(find_report, scm_int2num(report_id))) ==
- SCM_BOOL_F) {
- return;
- }
-
- if(win->initial_report == SCM_BOOL_F) {
- scm_gc_unprotect_object(win->initial_report);
- win->initial_report = inst_report;
- scm_gc_protect_object(win->initial_report);
-
- scm_call_2(set_needs_save, inst_report, SCM_BOOL_T);
-
- win->initial_odb = gnc_option_db_new(scm_call_1(get_options, inst_report));
- win->name_change_cb_id =
- gnc_option_db_register_change_callback(win->initial_odb,
- gnc_report_window_refresh,
- win->mc,
- "General", "Report name");
- }
-
- if((win->cur_report != SCM_BOOL_F) && (win->cur_odb != NULL)) {
- gnc_option_db_unregister_change_callback_id(win->cur_odb,
- win->option_change_cb_id);
- gnc_option_db_destroy(win->cur_odb);
- win->cur_odb = NULL;
- }
-
- if(win->cur_report != SCM_BOOL_F)
- scm_gc_unprotect_object(win->cur_report);
- win->cur_report = inst_report;
- scm_gc_protect_object(win->cur_report);
-
- win->cur_odb = gnc_option_db_new(scm_call_1(get_options, inst_report));
- win->option_change_cb_id =
- gnc_option_db_register_change_callback(win->cur_odb,
- gnc_report_window_option_change_cb,
- win, NULL, NULL);
-
- if(gnc_html_history_forward_p(gnc_html_get_history(win->html))) {
- gnc_report_window_set_fwd_button(win, TRUE);
- }
- else {
- gnc_report_window_set_fwd_button(win, FALSE);
- }
-
- if(gnc_html_history_back_p(gnc_html_get_history(win->html))) {
- gnc_report_window_set_back_button(win, TRUE);
- }
- else {
- gnc_report_window_set_back_button(win, FALSE);
- }
-}
-
-
-/********************************************************************
- * gnc_report_window_destroy_cb
- ********************************************************************/
-
-static void
-gnc_report_window_destroy_cb(GtkWidget * w, gpointer data)
-{
- gnc_report_window * win = data;
- /* make sure we don't get a double dose -o- destruction */
- gtk_signal_disconnect_by_data(GTK_OBJECT(win->container),
- data);
-
- gnc_report_window_destroy(win);
-}
-
-
-/********************************************************************
- * gnc_report_window_print_cb
- ********************************************************************/
-
-static void
-gnc_report_window_print_cb(GtkWidget * w, gpointer data)
-{
- gnc_report_window * win = data;
- gnc_html_print(win->html);
-}
-
-static void
-gnc_report_window_history_destroy_cb(gnc_html_history_node * node,
- gpointer user_data)
-{
- static SCM remover = SCM_BOOL_F;
- int report_id;
-
- if(remover == SCM_BOOL_F) {
- remover = scm_c_eval_string("gnc:report-remove-by-id");
- }
-
- if(node &&
- !safe_strcmp (node->type, URL_TYPE_REPORT) &&
- !strncmp("id=", node->location, 3)) {
- sscanf(node->location+3, "%d", &report_id);
- /* printf("unreffing report %d and children\n", report_id);
- scm_call_1(remover, scm_int2num(report_id)); */
- }
- else {
- return;
- }
-}
-
-static void
-close_handler (gpointer user_data)
-{
- gnc_report_window *win = user_data;
- printf("in close handler\n");
- gnc_report_window_destroy (win);
-}
-
-/********************************************************************
- * gnc_report_window_new
- * allocates and opens up a report window
- ********************************************************************/
-
-gnc_report_window *
-gnc_report_window_new(GNCMDIChildInfo * mc)
-{
- gnc_report_window * report = g_new0(gnc_report_window, 1);
- GtkObject * tlo;
-
- report->mc = mc;
- report->html = gnc_html_new( GTK_WINDOW(gnc_ui_get_toplevel()) );
- report->cur_report = SCM_BOOL_F;
- report->initial_report = SCM_BOOL_F;
- report->edited_reports = SCM_EOL;
- report->name_change_cb_id = SCM_BOOL_F;
-
- scm_gc_protect_object(report->cur_report);
- scm_gc_protect_object(report->initial_report);
- scm_gc_protect_object(report->edited_reports);
-
- gnc_html_history_set_node_destroy_cb(gnc_html_get_history(report->html),
- gnc_report_window_history_destroy_cb,
- (gpointer)report);
-
-
- report->container = gtk_frame_new(NULL);
- gtk_frame_set_shadow_type(GTK_FRAME(report->container), GTK_SHADOW_NONE);
-
- tlo = GTK_OBJECT(report->container);
- gtk_container_add(GTK_CONTAINER(report->container),
- gnc_html_get_widget(report->html));
-
- gnc_register_gui_component (WINDOW_REPORT_CM_CLASS, NULL,
- close_handler, report);
-
- gnc_html_set_urltype_cb(report->html, gnc_report_window_check_urltype);
- gnc_html_set_load_cb(report->html, gnc_report_window_load_cb, report);
-
- gtk_signal_connect(GTK_OBJECT(report->container), "destroy",
- GTK_SIGNAL_FUNC(gnc_report_window_destroy_cb),
- report);
- gtk_signal_connect(GTK_OBJECT(report->container), "draw",
- GTK_SIGNAL_FUNC(gnc_report_window_draw_cb), report);
-
-
- gtk_widget_show_all(report->container);
-
- return report;
-}
-
-
-/********************************************************************
- * gnc_report_window_create_toolbar
- * make a toolbar for the top-level MDI app
- ********************************************************************/
-
-void
-gnc_report_window_create_toolbar(gnc_report_window * win,
- GNCMDIChildInfo * child)
-{
- GnomeUIInfo toolbar_data[] =
- {
- { GNOME_APP_UI_ITEM,
- _("Back"),
- _("Move back one step in the history"),
- gnc_report_window_back_cb, win,
- NULL,
- GNOME_APP_PIXMAP_STOCK,
- GNOME_STOCK_PIXMAP_BACK,
- 0, 0, NULL
- },
- { GNOME_APP_UI_ITEM,
- _("Forward"),
- _("Move forward one step in the history"),
- gnc_report_window_fwd_cb, win,
- NULL,
- GNOME_APP_PIXMAP_STOCK,
- GNOME_STOCK_PIXMAP_FORWARD,
- 0, 0, NULL
- },
- { GNOME_APP_UI_ITEM,
- N_("Reload"),
- N_("Reload the current report"),
- gnc_report_window_reload_cb, win,
- NULL,
- GNOME_APP_PIXMAP_STOCK,
- GNOME_STOCK_PIXMAP_REFRESH,
- 0, 0, NULL
- },
- { GNOME_APP_UI_ITEM,
- N_("Stop"),
- N_("Cancel outstanding HTML requests"),
- gnc_report_window_stop_button_cb, win,
- NULL,
- GNOME_APP_PIXMAP_STOCK,
- GNOME_STOCK_PIXMAP_STOP,
- 0, 0, NULL
- },
- GNOMEUIINFO_SEPARATOR,
- { GNOME_APP_UI_ITEM,
- _("Export"),
- _("Export HTML-formatted report to file"),
- gnc_report_window_export_button_cb, win,
- NULL,
- GNOME_APP_PIXMAP_STOCK,
- GNOME_STOCK_PIXMAP_CONVERT,
- 0, 0, NULL
- },
- { GNOME_APP_UI_ITEM,
- _("Options"),
- _("Edit report options"),
- gnc_report_window_params_cb, win,
- NULL,
- GNOME_APP_PIXMAP_STOCK,
- GNOME_STOCK_PIXMAP_PROPERTIES,
- 0, 0, NULL
- },
- { GNOME_APP_UI_ITEM,
- _("Print"),
- _("Print report window"),
- gnc_report_window_print_cb, win,
- NULL,
- GNOME_APP_PIXMAP_STOCK,
- GNOME_STOCK_PIXMAP_PRINT,
- 0, 0, NULL
- },
- { GNOME_APP_UI_ITEM,
- _("Save report"),
- _("Save the current report for later use in ~/.gnucash/saved-reports-1.8 so that they are accessible as menu entries in the report menu. Will go into effect at the next startup of gnucash."),
- gnc_report_window_save_cb, win,
- NULL,
- GNOME_APP_PIXMAP_STOCK,
- GNOME_STOCK_PIXMAP_SAVE,
- 0, 0, NULL
- },
- GNOMEUIINFO_END
- };
-
- child->toolbar_info = g_memdup (toolbar_data, sizeof(toolbar_data));
-}
-
-
-/********************************************************************
- * gnc_report_window_create_menu
- * child menu for reports (none currently)
- ********************************************************************/
-void
-gnc_report_window_create_menu(gnc_report_window * report,
- GNCMDIChildInfo * child)
-{
- child->menu_info = NULL;
-}
-
-/********************************************************************
- * gnc_report_window_destroy
- * free and destroy a window
- ********************************************************************/
-
-void
-gnc_report_window_destroy(gnc_report_window * win)
-{
-
- SCM get_editor = scm_c_eval_string("gnc:report-editor-widget");
- SCM set_editor = scm_c_eval_string("gnc:report-set-editor-widget!");
- SCM edited, editor;
-
- gnc_unregister_gui_component_by_data (WINDOW_REPORT_CM_CLASS, win);
-
- /* close any open editors */
- for(edited = scm_list_copy(win->edited_reports); !SCM_NULLP(edited);
- edited = SCM_CDR(edited)) {
- editor = scm_call_1(get_editor, SCM_CAR(edited));
- scm_call_2(set_editor, SCM_CAR(edited), SCM_BOOL_F);
- if(editor != SCM_BOOL_F) {
- gtk_widget_destroy(GTK_WIDGET(gw_wcp_get_ptr(editor)));
- }
- }
-
- if(win->initial_odb) {
- gnc_option_db_unregister_change_callback_id(win->initial_odb,
- win->name_change_cb_id);
-
- gnc_option_db_destroy(win->initial_odb);
- win->initial_odb = NULL;
- }
-
- gnc_html_destroy(win->html);
-
- win->container = NULL;
- win->html = NULL;
-
- scm_gc_unprotect_object(win->cur_report);
- scm_gc_unprotect_object(win->edited_reports);
-
- g_free(win);
-}
-
-gnc_html *
-gnc_report_window_get_html(gnc_report_window * report)
-{
- return report->html;
-}
-
-GtkWidget *
-gnc_report_window_get_container(gnc_report_window * report)
-{
- return report->container;
-}
-
-SCM
-gnc_report_window_get_report(gnc_report_window * report)
-{
- return report->cur_report;
-}
-
-void
-gnc_report_window_show_report(gnc_report_window * report, int report_id)
-{
- char * location = g_strdup_printf("id=%d", report_id);
- gnc_html_show_url(report->html, URL_TYPE_REPORT, location, NULL, 0);
- g_free(location);
-}
-
-void
reportWindow(int report_id)
{
gnc_set_busy_cursor (NULL, TRUE);
- gnc_main_window_open_report(report_id, FALSE);
+ gnc_main_window_open_report(report_id, NULL);
gnc_unset_busy_cursor (NULL);
}
@@ -1170,24 +179,6 @@
}
void
-gnc_report_window_remove_edited_report(gnc_report_window * win, SCM report)
-{
- SCM new_edited = scm_delete(win->edited_reports, report);
- scm_gc_unprotect_object(win->edited_reports);
- win->edited_reports = new_edited;
- scm_gc_protect_object(win->edited_reports);
-}
-
-void
-gnc_report_window_add_edited_report(gnc_report_window * win, SCM report)
-{
- SCM new_edited = scm_cons(report, win->edited_reports);
- scm_gc_unprotect_object(win->edited_reports);
- win->edited_reports = new_edited;
- scm_gc_protect_object(win->edited_reports);
-}
-
-void
gnc_report_raise_editor(SCM report)
{
SCM get_editor = scm_c_eval_string("gnc:report-editor-widget");
@@ -1280,7 +271,7 @@
char *url;
url = gnc_build_url (URL_TYPE_REPORT, location, label);
- gnc_main_window_open_report_url (url, FALSE);
+ gnc_main_window_open_report_url (url, NULL);
g_free (url);
result->load_to_stream = FALSE;
Index: window-report.h
===================================================================
RCS file: /home/cvs/cvsroot/gnucash/src/report/report-gnome/window-report.h,v
retrieving revision 1.2.4.2
retrieving revision 1.2.4.3
diff -Lsrc/report/report-gnome/window-report.h -Lsrc/report/report-gnome/window-report.h -u -r1.2.4.2 -r1.2.4.3
--- src/report/report-gnome/window-report.h
+++ src/report/report-gnome/window-report.h
@@ -33,47 +33,9 @@
/** PROTOTYPES ******************************************************/
-// "private"
-gnc_report_window * gnc_report_window_new(GNCMDIChildInfo * mc);
-// private; attached as 'destroy' signal
-void gnc_report_window_destroy(gnc_report_window * rep);
-// private
-void gnc_report_window_show_report(gnc_report_window * rw, int id);
-// scm-exposed
-void gnc_report_window_reload(gnc_report_window * rw);
-// private
-gnc_html * gnc_report_window_get_html(gnc_report_window * rw);
-// private
-GtkWidget * gnc_report_window_get_container(gnc_report_window * rw);
-// private / unused[!]
-SCM gnc_report_window_get_report(gnc_report_window * rw);
-
-// private
-void gnc_report_window_create_menu(gnc_report_window * report,
- GNCMDIChildInfo * child);
-// private
-void gnc_report_window_create_toolbar(gnc_report_window * report,
- GNCMDIChildInfo * child);
-
// scm-exposed
GtkWidget * gnc_report_window_default_params_editor(SCM options, SCM report);
-// entry-point from scm menu-extension callback [gnc:menu-extension].
-void gnc_main_window_open_report (int report_id, gint toplevel);
-// directly called through from above
-void gnc_main_window_open_report_url (const char * url, gint toplevel);
-
-// called from window-main, otherwise private [early in g_m_w_o_report[_url]
-// statisfaction path]
-GnomeMDIChild * gnc_report_window_create_child(const gchar * url);
-
-/**
- * jsled:
- * gnc_main_window_open_report_url + gnc_report_window_create_child
- * => GtkNotebook + gnc_plugin_page stuff.
- **/
-
-
// called from multiple places
// [business-gnome/dialog-invoice.c;gnome/window-register.c]; and
// scm-exposed; 3-liner which calls gnc_main_window_open_report after handling busy-cursor.
@@ -81,12 +43,6 @@
// window-register; scm-exposed
void gnc_print_report (int report_id);
// scm-exposed; ~priv
-void gnc_report_window_add_edited_report(gnc_report_window * win,
- SCM report);
-// private
-void gnc_report_window_remove_edited_report(gnc_report_window * win,
- SCM report);
-// scm-exposed; ~priv
void gnc_report_raise_editor(SCM report);
// module[/plugin]-init
void gnc_report_init (void);
More information about the gnucash-changes
mailing list