r16965 - gnucash/trunk/src - Always recreate pages in the given window.

Andreas Köhler andi5 at cvs.gnucash.org
Wed Feb 27 15:55:34 EST 2008


Author: andi5
Date: 2008-02-27 15:55:33 -0500 (Wed, 27 Feb 2008)
New Revision: 16965
Trac: http://svn.gnucash.org/trac/changeset/16965

Modified:
   gnucash/trunk/src/business/business-gnome/dialog-invoice.c
   gnucash/trunk/src/business/business-gnome/dialog-invoice.h
   gnucash/trunk/src/business/business-gnome/gnc-plugin-page-invoice.c
   gnucash/trunk/src/gnome-utils/gnc-main-window.c
   gnucash/trunk/src/gnome/gnc-plugin-page-register.c
Log:
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.


Modified: gnucash/trunk/src/business/business-gnome/dialog-invoice.c
===================================================================
--- gnucash/trunk/src/business/business-gnome/dialog-invoice.c	2008-02-25 23:27:39 UTC (rev 16964)
+++ gnucash/trunk/src/business/business-gnome/dialog-invoice.c	2008-02-27 20:55:33 UTC (rev 16965)
@@ -1654,7 +1654,8 @@
 
 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,8 +1699,13 @@
 
   /* 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 @@
 #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 @@
   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 @@
     type = EDIT_INVOICE;
 
   iw = gnc_invoice_new_page (gncInvoiceGetBook(invoice), type,
-			     invoice, gncInvoiceGetOwner (invoice));
+			     invoice, gncInvoiceGetOwner (invoice), NULL);
 
   return iw;
 }

Modified: gnucash/trunk/src/business/business-gnome/dialog-invoice.h
===================================================================
--- gnucash/trunk/src/business/business-gnome/dialog-invoice.h	2008-02-25 23:27:39 UTC (rev 16964)
+++ gnucash/trunk/src/business/business-gnome/dialog-invoice.h	2008-02-27 20:55:33 UTC (rev 16965)
@@ -80,7 +80,8 @@
 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
 

Modified: gnucash/trunk/src/business/business-gnome/gnc-plugin-page-invoice.c
===================================================================
--- gnucash/trunk/src/business/business-gnome/gnc-plugin-page-invoice.c	2008-02-25 23:27:39 UTC (rev 16964)
+++ gnucash/trunk/src/business/business-gnome/gnc-plugin-page-invoice.c	2008-02-27 20:55:33 UTC (rev 16965)
@@ -496,13 +496,15 @@
 				       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;

Modified: gnucash/trunk/src/gnome/gnc-plugin-page-register.c
===================================================================
--- gnucash/trunk/src/gnome/gnc-plugin-page-register.c	2008-02-25 23:27:39 UTC (rev 16964)
+++ gnucash/trunk/src/gnome/gnc-plugin-page-register.c	2008-02-27 20:55:33 UTC (rev 16965)
@@ -1024,6 +1024,9 @@
   }
   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);
 

Modified: gnucash/trunk/src/gnome-utils/gnc-main-window.c
===================================================================
--- gnucash/trunk/src/gnome-utils/gnc-main-window.c	2008-02-25 23:27:39 UTC (rev 16964)
+++ gnucash/trunk/src/gnome-utils/gnc-main-window.c	2008-02-27 20:55:33 UTC (rev 16965)
@@ -503,7 +503,8 @@
     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 */



More information about the gnucash-changes mailing list