From e26b1d6bcf0144ad6f04e3e9ee469c9a9d57fcaf Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Andreas=20K=C3=B6hler?= Date: Wed, 27 Feb 2008 20:55:33 +0000 Subject: [PATCH] Always recreate pages in the given window. Even if registers, reports or invoice pages have been configured to open in new windows they should not do so when restored at the startup of gnucash. git-svn-id: svn+ssh://svn.gnucash.org/repo/gnucash/trunk@16965 57a11ea4-9604-0410-9ed3-97b8803252fd --- src/business/business-gnome/dialog-invoice.c | 17 ++++++++++++----- src/business/business-gnome/dialog-invoice.h | 3 ++- .../business-gnome/gnc-plugin-page-invoice.c | 6 ++++-- src/gnome-utils/gnc-main-window.c | 3 ++- src/gnome/gnc-plugin-page-register.c | 3 +++ 5 files changed, 23 insertions(+), 9 deletions(-) diff --git a/src/business/business-gnome/dialog-invoice.c b/src/business/business-gnome/dialog-invoice.c index 2b7eab4f11..ba3daa9886 100644 --- a/src/business/business-gnome/dialog-invoice.c +++ b/src/business/business-gnome/dialog-invoice.c @@ -1654,7 +1654,8 @@ find_handler (gpointer find_data, gpointer user_data) static InvoiceWindow * gnc_invoice_new_page (GNCBook *bookp, InvoiceDialogType type, - GncInvoice *invoice, GncOwner *owner) + GncInvoice *invoice, GncOwner *owner, + GncMainWindow *window) { InvoiceWindow *iw; GncOwner *billto; @@ -1698,7 +1699,12 @@ gnc_invoice_new_page (GNCBook *bookp, InvoiceDialogType type, /* Now create the plugin page for this invoice and display it. */ new_page = gnc_plugin_page_invoice_new (iw); - gnc_main_window_open_page (gnc_plugin_business_get_window(), new_page); + if (window) + gnc_plugin_page_set_use_new_window (new_page, FALSE); + else + window = gnc_plugin_business_get_window (); + + gnc_main_window_open_page (window, new_page); /* Initialize the summary bar */ gnc_invoice_redraw_all_cb(iw->reg, iw); @@ -1712,7 +1718,8 @@ gnc_invoice_new_page (GNCBook *bookp, InvoiceDialogType type, #define KEY_OWNER_GUID "OwnerGUID" GncPluginPage * -gnc_invoice_recreate_page (GKeyFile *key_file, +gnc_invoice_recreate_page (GncMainWindow *window, + GKeyFile *key_file, const gchar *group_name) { InvoiceWindow *iw; @@ -1784,7 +1791,7 @@ gnc_invoice_recreate_page (GKeyFile *key_file, g_free(tmp_string); g_free(owner_type); - iw = gnc_invoice_new_page (book, type, invoice, &owner); + iw = gnc_invoice_new_page (book, type, invoice, &owner, window); return iw->page; give_up: @@ -2117,7 +2124,7 @@ gnc_ui_invoice_edit (GncInvoice *invoice) type = EDIT_INVOICE; iw = gnc_invoice_new_page (gncInvoiceGetBook(invoice), type, - invoice, gncInvoiceGetOwner (invoice)); + invoice, gncInvoiceGetOwner (invoice), NULL); return iw; } diff --git a/src/business/business-gnome/dialog-invoice.h b/src/business/business-gnome/dialog-invoice.h index 0654a26b9d..b7251b5c15 100644 --- a/src/business/business-gnome/dialog-invoice.h +++ b/src/business/business-gnome/dialog-invoice.h @@ -80,7 +80,8 @@ gchar *gnc_invoice_get_help (InvoiceWindow *iw); gchar *gnc_invoice_get_title (InvoiceWindow *iw); #ifdef __GNC_PLUGIN_PAGE_H -GncPluginPage *gnc_invoice_recreate_page (GKeyFile *key_file, const gchar *group_name); +#include "gnc-main-window.h" +GncPluginPage *gnc_invoice_recreate_page (GncMainWindow *window, GKeyFile *key_file, const gchar *group_name); void gnc_invoice_save_page (InvoiceWindow *iw, GKeyFile *key_file, const gchar *group_name); #endif diff --git a/src/business/business-gnome/gnc-plugin-page-invoice.c b/src/business/business-gnome/gnc-plugin-page-invoice.c index 63d62a0130..090ee3aa66 100644 --- a/src/business/business-gnome/gnc-plugin-page-invoice.c +++ b/src/business/business-gnome/gnc-plugin-page-invoice.c @@ -496,13 +496,15 @@ gnc_plugin_page_invoice_recreate_page (GtkWidget *window, const gchar *group_name) { GncPluginPage *page; - + + g_return_val_if_fail(GNC_IS_MAIN_WINDOW(window), NULL); g_return_val_if_fail(key_file, NULL); g_return_val_if_fail(group_name, NULL); ENTER("key_file %p, group_name %s", key_file, group_name); /* Create the new page. */ - page = gnc_invoice_recreate_page(key_file, group_name); + page = gnc_invoice_recreate_page(GNC_MAIN_WINDOW(window), + key_file, group_name); LEAVE(" "); return page; diff --git a/src/gnome-utils/gnc-main-window.c b/src/gnome-utils/gnc-main-window.c index 2b043e93a1..f4bf6a336e 100644 --- a/src/gnome-utils/gnc-main-window.c +++ b/src/gnome-utils/gnc-main-window.c @@ -503,7 +503,8 @@ gnc_main_window_restore_page (GncMainWindow *window, if (page) { /* Does the page still need to be installed into the window? */ if (page->window == NULL) { - gnc_main_window_open_page(window, page); + gnc_plugin_page_set_use_new_window(page, FALSE); + gnc_main_window_open_page(window, page); } /* Restore the page name */ diff --git a/src/gnome/gnc-plugin-page-register.c b/src/gnome/gnc-plugin-page-register.c index 13b801b018..5e05c59a42 100644 --- a/src/gnome/gnc-plugin-page-register.c +++ b/src/gnome/gnc-plugin-page-register.c @@ -1024,6 +1024,9 @@ gnc_plugin_page_register_recreate_page (GtkWidget *window, } g_free(reg_type); + /* Recreate page in given window */ + gnc_plugin_page_set_use_new_window(page, FALSE); + /* Install it now so we can them manipulate the created widget */ gnc_main_window_open_page(GNC_MAIN_WINDOW(window), page);