[Gnucash-changes] Allow pages to state whether they should be
loaded in the current window
David Hampton
hampton at cvs.gnucash.org
Wed Jul 20 16:02:00 EDT 2005
Log Message:
-----------
Allow pages to state whether they should be loaded in the current
window or in a new window. This will soon be controlled by
preferences.
Tags:
----
gnucash-gnome2-dev
Modified Files:
--------------
gnucash/src/business/business-gnome:
dialog-invoice.h
gnc-plugin-page-invoice.c
gnucash/src/business/business-gnome/schemas:
apps_gnucash_dialog_business_common.schemas
gnucash/src/core-utils:
gnc-gconf-utils.h
gnucash/src/gnome:
gnc-plugin-page-register.c
gnucash/src/gnome/schemas:
apps_gnucash_general.schemas
gnucash/src/gnome-utils:
gnc-main-window.c
gnc-main-window.h
gnc-plugin-page.c
gnc-plugin-page.h
gnucash/src/register/register-core:
table-allgui.h
gnucash/src/report/report-gnome:
gnc-plugin-page-report.c
Revision Data
-------------
Index: dialog-invoice.h
===================================================================
RCS file: /home/cvs/cvsroot/gnucash/src/business/business-gnome/dialog-invoice.h,v
retrieving revision 1.8.4.3
retrieving revision 1.8.4.4
diff -Lsrc/business/business-gnome/dialog-invoice.h -Lsrc/business/business-gnome/dialog-invoice.h -u -r1.8.4.3 -r1.8.4.4
--- src/business/business-gnome/dialog-invoice.h
+++ src/business/business-gnome/dialog-invoice.h
@@ -45,6 +45,11 @@
} invoice_sort_type_t;
+#define GCONF_SECTION_INVOICE "dialogs/business/invoice"
+#define GCONF_SECTION_BILL "dialogs/business/bill"
+#define GCONF_SECTION_VOUCHER "dialogs/business/voucher"
+
+
/* Create and edit an invoice */
InvoiceWindow * gnc_ui_invoice_edit (GncInvoice *invoice);
InvoiceWindow * gnc_ui_invoice_new (GncOwner *owner, QofBook *book);
Index: gnc-plugin-page-invoice.c
===================================================================
RCS file: /home/cvs/cvsroot/gnucash/src/business/business-gnome/Attic/gnc-plugin-page-invoice.c,v
retrieving revision 1.1.2.2
retrieving revision 1.1.2.3
diff -Lsrc/business/business-gnome/gnc-plugin-page-invoice.c -Lsrc/business/business-gnome/gnc-plugin-page-invoice.c -u -r1.1.2.2 -r1.1.2.3
--- src/business/business-gnome/gnc-plugin-page-invoice.c
+++ src/business/business-gnome/gnc-plugin-page-invoice.c
@@ -30,6 +30,7 @@
#include "dialog-account.h"
#include "gnc-component-manager.h"
+#include "gnc-gconf-utils.h"
#include "gnc-gobject-utils.h"
#include "gnc-gnome-utils.h"
#include "gnc-icons.h"
@@ -303,6 +304,7 @@
GncPluginPageInvoicePrivate *priv;
GncPluginPage *parent;
GtkActionGroup *action_group;
+ gboolean use_new;
priv = g_new0 (GncPluginPageInvoicePrivate, 1);
plugin_page->priv = priv;
@@ -313,6 +315,9 @@
gnc_plugin_page_set_tab_name(parent, _("Incoice"));
gnc_plugin_page_set_uri(parent, "default:");
+ use_new = gnc_gconf_get_bool(GCONF_SECTION_INVOICE, KEY_USE_NEW, NULL);
+ gnc_plugin_page_set_use_new_window(parent, use_new);
+
/* change me when the system supports multiple books */
gnc_plugin_page_add_book(parent, gnc_get_current_book());
Index: apps_gnucash_dialog_business_common.schemas
===================================================================
RCS file: /home/cvs/cvsroot/gnucash/src/business/business-gnome/schemas/Attic/apps_gnucash_dialog_business_common.schemas,v
retrieving revision 1.1.2.1
retrieving revision 1.1.2.2
diff -Lsrc/business/business-gnome/schemas/apps_gnucash_dialog_business_common.schemas -Lsrc/business/business-gnome/schemas/apps_gnucash_dialog_business_common.schemas -u -r1.1.2.1 -r1.1.2.2
--- src/business/business-gnome/schemas/apps_gnucash_dialog_business_common.schemas
+++ src/business/business-gnome/schemas/apps_gnucash_dialog_business_common.schemas
@@ -47,5 +47,21 @@
</locale>
</schema>
+ <schema>
+ <key>/schemas/apps/gnucash/dialogs/business/invoice/use_new_window</key>
+ <applyto>/apps/gnucash/dialogs/business/invoice/use_new_window</applyto>
+ <owner>gnucash</owner>
+ <type>bool</type>
+ <default>FALSE</default>
+ <locale name="C">
+ <short>Create a new window for each new invoice.</short>
+ <long>
+ Set this value to TRUE to have gnucash open each new
+ invoice in its own window. Set to FALSE to have gnucash
+ open new invoices as tabs in the front window.
+ </long>
+ </locale>
+ </schema>
+
</schemalist>
</gconfschemafile>
Index: gnc-gconf-utils.h
===================================================================
RCS file: /home/cvs/cvsroot/gnucash/src/core-utils/Attic/gnc-gconf-utils.h,v
retrieving revision 1.1.2.7
retrieving revision 1.1.2.8
diff -Lsrc/core-utils/gnc-gconf-utils.h -Lsrc/core-utils/gnc-gconf-utils.h -u -r1.1.2.7 -r1.1.2.8
--- src/core-utils/gnc-gconf-utils.h
+++ src/core-utils/gnc-gconf-utils.h
@@ -50,12 +50,14 @@
/* Section names used across multiple modules */
#define GCONF_GENERAL "general"
#define GCONF_GENERAL_REGISTER "general/register"
+#define GCONF_GENERAL_REPORT "general/report"
#define GCONF_WARNINGS "general/warnings"
#define GCONF_WARNINGS_TEMP "general/warnings/temporary"
#define GCONF_WARNINGS_PERM "general/warnings/permanent"
/* Keys used across multiple modules */
#define KEY_LAST_PATH "last_path"
+#define KEY_USE_NEW "use_new_window"
/** @name GConf Miscellaneous Functions
Index: gnc-plugin-page-register.c
===================================================================
RCS file: /home/cvs/cvsroot/gnucash/src/gnome/Attic/gnc-plugin-page-register.c,v
retrieving revision 1.1.2.32
retrieving revision 1.1.2.33
diff -Lsrc/gnome/gnc-plugin-page-register.c -Lsrc/gnome/gnc-plugin-page-register.c -u -r1.1.2.32 -r1.1.2.33
--- src/gnome/gnc-plugin-page-register.c
+++ src/gnome/gnc-plugin-page-register.c
@@ -39,6 +39,7 @@
#include "druid-stock-split.h"
#include "global-options.h"
#include "gnc-book.h"
+#include "gnc-gconf-utils.h"
#include "gnc-component-manager.h"
#include "gnc-date.h"
#include "gnc-date-edit.h"
@@ -367,6 +368,7 @@
GList *book_list;
gchar *label;
QofQuery *q;
+ gboolean use_new;
/* Is there an existing page? */
gsr = gnc_ledger_display_get_user_data (ledger);
@@ -388,6 +390,9 @@
gnc_plugin_page_set_tab_name(plugin_page, label);
g_free(label);
+ use_new = gnc_gconf_get_bool(GCONF_GENERAL_REGISTER, KEY_USE_NEW, NULL);
+ gnc_plugin_page_set_use_new_window(plugin_page, use_new);
+
q = gnc_ledger_display_get_query (ledger);
book_list = qof_query_get_books (q);
for (item = book_list; item; item = g_list_next(item))
Index: apps_gnucash_general.schemas
===================================================================
RCS file: /home/cvs/cvsroot/gnucash/src/gnome/schemas/Attic/apps_gnucash_general.schemas,v
retrieving revision 1.1.2.1
retrieving revision 1.1.2.2
diff -Lsrc/gnome/schemas/apps_gnucash_general.schemas -Lsrc/gnome/schemas/apps_gnucash_general.schemas -u -r1.1.2.1 -r1.1.2.2
--- src/gnome/schemas/apps_gnucash_general.schemas
+++ src/gnome/schemas/apps_gnucash_general.schemas
@@ -21,6 +21,38 @@
</schema>
<schema>
+ <key>/schemas/apps/gnucash/general/register/use_new_window</key>
+ <applyto>/apps/gnucash/general/register/use_new_window</applyto>
+ <owner>gnucash</owner>
+ <type>bool</type>
+ <default>FALSE</default>
+ <locale name="C">
+ <short>Create a new window for each new register.</short>
+ <long>
+ Set this value to TRUE to have gnucash open each new
+ register in its own window. Set to FALSE to have gnucash
+ open new registers as tabs in the front window.
+ </long>
+ </locale>
+ </schema>
+
+ <schema>
+ <key>/schemas/apps/gnucash/general/report/use_new_window</key>
+ <applyto>/apps/gnucash/general/report/use_new_window</applyto>
+ <owner>gnucash</owner>
+ <type>bool</type>
+ <default>FALSE</default>
+ <locale name="C">
+ <short>Create a new window for each new report.</short>
+ <long>
+ Set this value to TRUE to have gnucash open each new
+ report in its own window. Set to FALSE to have gnucash
+ open new registers as tabs in the front window.
+ </long>
+ </locale>
+ </schema>
+
+ <schema>
<key>/schemas/apps/gnucash/general/register/alternate_color_by_transaction</key>
<applyto>/apps/gnucash/general/register/alternate_color_by_transaction</applyto>
<owner>gnucash</owner>
Index: gnc-plugin-page.c
===================================================================
RCS file: /home/cvs/cvsroot/gnucash/src/gnome-utils/Attic/gnc-plugin-page.c,v
retrieving revision 1.1.2.4
retrieving revision 1.1.2.5
diff -Lsrc/gnome-utils/gnc-plugin-page.c -Lsrc/gnome-utils/gnc-plugin-page.c -u -r1.1.2.4 -r1.1.2.5
--- src/gnome-utils/gnc-plugin-page.c
+++ src/gnome-utils/gnc-plugin-page.c
@@ -50,6 +50,8 @@
{
GList *books;
+ gboolean use_new_window;
+
gchar *title;
gchar *tab_name;
gchar *uri;
@@ -423,3 +425,19 @@
g_free(page->priv->statusbar_text);
page->priv->statusbar_text = g_strdup(message);
}
+
+gboolean
+gnc_plugin_page_get_use_new_window (GncPluginPage *page)
+{
+ g_return_val_if_fail (GNC_IS_PLUGIN_PAGE (page), FALSE);
+
+ return page->priv->use_new_window;
+}
+
+void
+gnc_plugin_page_set_use_new_window (GncPluginPage *page, gboolean use_new)
+{
+ g_return_if_fail (GNC_IS_PLUGIN_PAGE (page));
+
+ page->priv->use_new_window = use_new;
+}
Index: gnc-main-window.h
===================================================================
RCS file: /home/cvs/cvsroot/gnucash/src/gnome-utils/Attic/gnc-main-window.h,v
retrieving revision 1.1.2.4
retrieving revision 1.1.2.5
diff -Lsrc/gnome-utils/gnc-main-window.h -Lsrc/gnome-utils/gnc-main-window.h -u -r1.1.2.4 -r1.1.2.5
--- src/gnome-utils/gnc-main-window.h
+++ src/gnome-utils/gnc-main-window.h
@@ -106,9 +106,9 @@
/** Display a data plugin page in a window. If the page already
* exists in any window, then that window will be brought to the
* front and the notebook switch to display the specified page. If
- * the page is new then it will be added to the specified window. If
- * the window is NULL, the new page will be added to the first
- * window.
+ * the page is new then it will be added to the specified window
+ * (unless the page itself requests otherwise.). If the window is
+ * NULL, the new page will be added to the first window.
*
* @param window The window to display a new page in.
*
Index: gnc-main-window.c
===================================================================
RCS file: /home/cvs/cvsroot/gnucash/src/gnome-utils/Attic/gnc-main-window.c,v
retrieving revision 1.1.2.13
retrieving revision 1.1.2.14
diff -Lsrc/gnome-utils/gnc-main-window.c -Lsrc/gnome-utils/gnc-main-window.c -u -r1.1.2.13 -r1.1.2.14
--- src/gnome-utils/gnc-main-window.c
+++ src/gnome-utils/gnc-main-window.c
@@ -1110,8 +1110,12 @@
return;
}
- if ((window == NULL) && active_windows)
+ if (gnc_plugin_page_get_use_new_window(page)) {
+ window = gnc_main_window_new ();
+ gtk_widget_show(GTK_WIDGET(window));
+ } else if ((window == NULL) && active_windows) {
window = active_windows->data;
+ }
/* Is this the first page in the first window? */
if ((window == active_windows->data) &&
Index: gnc-plugin-page.h
===================================================================
RCS file: /home/cvs/cvsroot/gnucash/src/gnome-utils/Attic/gnc-plugin-page.h,v
retrieving revision 1.1.2.3
retrieving revision 1.1.2.4
diff -Lsrc/gnome-utils/gnc-plugin-page.h -Lsrc/gnome-utils/gnc-plugin-page.h -u -r1.1.2.3 -r1.1.2.4
--- src/gnome-utils/gnc-plugin-page.h
+++ src/gnome-utils/gnc-plugin-page.h
@@ -192,6 +192,27 @@
*/
void gnc_plugin_page_set_statusbar_text (GncPluginPage *page, const char *name);
+
+/** Retrieve the "use new window" setting associated with this page.
+ *
+ * @param page The page whose setting should be retrieved.
+ *
+ * @return Whether this page should be created in a new window.
+ */
+gboolean gnc_plugin_page_get_use_new_window (GncPluginPage *page);
+
+/** Set the "use new window" setting associated with this page. If
+ * this setting is TRUE, the page will be installed into a new
+ * window. Otherwise the page will be installed into an existing
+ * window.
+ *
+ * @param page The page whose setting should be updated.
+ *
+ * @param use_new The new value for this setting.
+ */
+void gnc_plugin_page_set_use_new_window (GncPluginPage *page, gboolean use_new);
+
+
/* Signals */
void gnc_plugin_page_inserted (GncPluginPage *plugin_page);
void gnc_plugin_page_removed (GncPluginPage *plugin_page);
Index: table-allgui.h
===================================================================
RCS file: /home/cvs/cvsroot/gnucash/src/register/register-core/table-allgui.h,v
retrieving revision 1.15.4.2
retrieving revision 1.15.4.3
diff -Lsrc/register/register-core/table-allgui.h -Lsrc/register/register-core/table-allgui.h -u -r1.15.4.2 -r1.15.4.3
--- src/register/register-core/table-allgui.h
+++ src/register/register-core/table-allgui.h
@@ -99,8 +99,6 @@
#include "table-layout.h"
#include "table-model.h"
-#define GCONF_GENERAL_REGISTER "general/register"
-
/* The VirtualCell structure holds information about each virtual cell. */
typedef struct
{
Index: gnc-plugin-page-report.c
===================================================================
RCS file: /home/cvs/cvsroot/gnucash/src/report/report-gnome/Attic/gnc-plugin-page-report.c,v
retrieving revision 1.1.2.15
retrieving revision 1.1.2.16
diff -Lsrc/report/report-gnome/gnc-plugin-page-report.c -Lsrc/report/report-gnome/gnc-plugin-page-report.c -u -r1.1.2.15 -r1.1.2.16
--- src/report/report-gnome/gnc-plugin-page-report.c
+++ src/report/report-gnome/gnc-plugin-page-report.c
@@ -36,6 +36,7 @@
#include "gnc-component-manager.h"
#include "gnc-engine-util.h"
+#include "gnc-gconf-utils.h"
#include "gnc-gnome-utils.h"
#include "gnc-html-history.h"
#include "gnc-html.h"
@@ -677,6 +678,7 @@
GncPluginPage *parent;
GString *tmpStr;
gint reportId;
+ gboolean use_new;
priv = plugin_page->priv = g_new0( GncPluginPageReportPrivate, 1 );
@@ -695,6 +697,9 @@
gnc_plugin_page_set_tab_name(parent, tmpStr->str);
gnc_plugin_page_set_uri(parent, "default:");
+ use_new = gnc_gconf_get_bool(GCONF_GENERAL_REPORT, KEY_USE_NEW, NULL);
+ gnc_plugin_page_set_use_new_window(parent, use_new);
+
/* change me when the system supports multiple books */
gnc_plugin_page_add_book(parent, gnc_get_current_book());
More information about the gnucash-changes
mailing list