* src/gnome/dialog-options.c: fix destructor bug

* src/gnome/window-report.c: add options dialog to edited list
	even if opened by a URL click.

	* src/gnome/window-main.c: handle close of last window safely.
	Still don't save MDI info correctly with WM close, though


git-svn-id: svn+ssh://svn.gnucash.org/repo/gnucash/trunk@4173 57a11ea4-9604-0410-9ed3-97b8803252fd
This commit is contained in:
Bill Gribble 2001-05-12 12:47:32 +00:00
parent 14b2d233ce
commit 4e87eb3d6a
5 changed files with 59 additions and 27 deletions

View File

@ -1,3 +1,13 @@
2001-05-12 Bill Gribble <grib@billgribble.com>
* src/gnome/dialog-options.c: fix destructor bug
* src/gnome/window-report.c: add options dialog to edited list
even if opened by a URL click.
* src/gnome/window-main.c: handle close of last window safely.
Still don't save MDI info correctly with WM close, though.
2001-05-12 Dave Peticolas <dave@krondo.com>
* src/FileDialog.c (gncFileSaveAs): don't use a default filename

View File

@ -1919,7 +1919,6 @@ gnc_options_dialog_close_stub_cb(GtkWidget * w, gpointer data) {
gtk_widget_hide(container);
/* at this point, window may point to freed data */
if (!GTK_OBJECT_DESTROYED (container))
gtk_signal_handler_unblock_by_func(GTK_OBJECT(container),
GTK_SIGNAL_FUNC
@ -2048,14 +2047,21 @@ gnc_options_dialog_destroy(GNCOptionWin * win) {
if (!win) return;
gtk_widget_destroy(win->container);
gtk_signal_disconnect_by_func(GTK_OBJECT(win->container),
GTK_SIGNAL_FUNC
(gnc_options_dialog_destroy_stub_cb),
win);
if(!win->toplevel) {
gtk_widget_unref(win->container);
}
else {
gtk_widget_destroy(win->container);
}
gtk_object_unref (GTK_OBJECT(win->tips));
if(win->tips) {
gtk_object_unref (GTK_OBJECT(win->tips));
}
win->container = NULL;
win->notebook = NULL;
win->apply_cb = NULL;

View File

@ -70,9 +70,10 @@ static void gnc_main_window_create_menus(GNCMainInfo * maininfo);
* Shut down the Gnucash ui windows
********************************************************************/
static void
static int
gnc_main_window_destroy_cb(GtkObject * w) {
gnc_shutdown (0);
return TRUE;
}
@ -89,22 +90,28 @@ gnc_main_window_app_destroyed_cb(GnomeApp * app, gpointer user_data) {
GtkWidget *toolbar;
GList * child;
toolbar = gtk_object_get_user_data (GTK_OBJECT (app));
if (toolbar)
gtk_widget_unref (toolbar);
gtk_object_set_user_data (GTK_OBJECT (app), NULL);
for(child = mainwin->children; child; child = child->next) {
mc = child->data;
if(mc && mc->toolbar && mc->app && (mc->app == app)) {
/* we need to pull the toolbar out to prevent its being
* destroyed */
gtk_widget_ref(mc->toolbar);
gtk_container_remove(GTK_CONTAINER(mc->toolbar->parent), mc->toolbar);
if(g_list_length(mdi->windows) == 0) {
gnc_shutdown(0);
}
else {
toolbar = gtk_object_get_user_data (GTK_OBJECT (app));
if (toolbar)
gtk_widget_unref (toolbar);
gtk_object_set_user_data (GTK_OBJECT (app), NULL);
for(child = mainwin->children; child; child = child->next) {
mc = child->data;
if(mc && mc->toolbar && mc->app && (mc->app == app)) {
/* we need to pull the toolbar out to prevent its being
* destroyed */
gtk_widget_ref(mc->toolbar);
gtk_container_remove(GTK_CONTAINER(mc->toolbar->parent), mc->toolbar);
}
}
}
}
/********************************************************************
* gnc_main_window_app_created_cb()
* called when a new top-level GnomeApp is created.
@ -141,15 +148,13 @@ gnc_main_window_app_created_cb(GnomeMDI * mdi, GnomeApp * app,
item = gnome_dock_item_new("Summary Bar", behavior);
gtk_container_add( GTK_CONTAINER (item), summarybar );
if (app->layout)
{
if (app->layout) {
gnome_dock_layout_add_item( app->layout,
GNOME_DOCK_ITEM(item),
GNOME_DOCK_TOP,
2, 0, 0 );
}
else
{
else {
gnome_dock_add_item( GNOME_DOCK(app->dock),
GNOME_DOCK_ITEM(item),
GNOME_DOCK_TOP,

View File

@ -353,6 +353,9 @@ gnc_report_window_params_cb(GtkWidget * w, gpointer data) {
if(gh_call1(start_editor, report->cur_report) == SCM_BOOL_F) {
gnc_warning_dialog("There are no options for this report.");
}
else {
gnc_report_window_add_edited_report(report, report->cur_report);
}
}
return TRUE;
}
@ -433,10 +436,22 @@ gnc_report_window_load_cb(gnc_html * html, URLType type,
SCM inst_options;
SCM inst_options_ed;
/* 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((type == URL_TYPE_REPORT) && location && (strlen(location) > 3) &&
!strncmp("id=", location, 3)) {
sscanf(location+3, "%d", &report_id);
}
else if((type == URL_TYPE_OPTIONS) && location && (strlen(location) > 10) &&
!strncmp("report-id=", location, 10)) {
sscanf(location+10, "%d", &report_id);
inst_report = gh_call1(find_report, gh_int2scm(report_id));
if(inst_report != SCM_BOOL_F) {
gnc_report_window_add_edited_report(win, inst_report);
}
return;
}
else {
return;
}
@ -768,8 +783,7 @@ reportWindow(int report_id) {
}
void
gnc_print_report (int report_id)
{
gnc_print_report (int report_id) {
gnc_html *html;
char * location;
@ -833,7 +847,6 @@ gnc_options_dialog_close_cb(GNCOptionWin * propertybox,
GtkWidget *
gnc_report_window_default_params_editor(SCM options, SCM report) {
SCM get_editor = gh_eval_str("gnc:report-editor-widget");
SCM set_editor = gh_eval_str("gnc:report-set-editor-widget!");
SCM ptr;
SCM new_edited;
@ -867,7 +880,6 @@ gnc_report_window_default_params_editor(SCM options, SCM report) {
gnc_options_dialog_set_close_cb(prm->win,
gnc_options_dialog_close_cb,
(gpointer)prm);
return gnc_options_dialog_widget(prm->win);
}
}

View File

@ -191,7 +191,6 @@
(reports
(gnc:option-value
(gnc:lookup-option options "__general" "report-list"))))
(simple-format #t "view options changed cb\n")
(for-each
(lambda (child)
(gnc:report-set-dirty?! (gnc:find-report (car child)) #t))