From 5ae159c03ffdcaacd17c167d9255978e0e4d7407 Mon Sep 17 00:00:00 2001 From: David Hampton Date: Sat, 17 Jun 2006 00:44:21 +0000 Subject: [PATCH] Instead of marking the first page so that it can't be closed, mark the first *accounts* page so that it can't be closed. git-svn-id: svn+ssh://svn.gnucash.org/repo/gnucash/trunk@14376 57a11ea4-9604-0410-9ed3-97b8803252fd --- ChangeLog | 5 +++++ src/gnome-utils/gnc-main-window.c | 14 +------------- src/gnome-utils/gnc-main-window.h | 2 ++ src/gnome/gnc-plugin-page-account-tree.c | 10 ++++++++++ 4 files changed, 18 insertions(+), 13 deletions(-) diff --git a/ChangeLog b/ChangeLog index 7a578d0b4f..c2e9de1d83 100644 --- a/ChangeLog +++ b/ChangeLog @@ -1,5 +1,10 @@ 2006-06-16 David Hampton + * src/gnome-utils/gnc-main-window.[ch]: + * src/gnome/gnc-plugin-page-account-tree.c: Instead of marking the + first page so that it can't be closed, mark the first *accounts* + page so that it can't be closed. + * src/register/register-gnome/gnucash-header.c: Remove five year old workaround for a resizing bug. Fixes #344764. Also explicitly initialize a couple of variables. diff --git a/src/gnome-utils/gnc-main-window.c b/src/gnome-utils/gnc-main-window.c index 2d46ffdc38..dcda9430dc 100644 --- a/src/gnome-utils/gnc-main-window.c +++ b/src/gnome-utils/gnc-main-window.c @@ -80,7 +80,6 @@ enum { * back to the corresponding GncPluginPage object. */ #define PLUGIN_PAGE_LABEL "plugin-page" -#define PLUGIN_PAGE_IMMUTABLE "page-immutable" #define PLUGIN_PAGE_CLOSE_BUTTON "close-button" #define KEY_SHOW_CLOSE_BUTTON "tab_close_buttons" @@ -2001,7 +2000,6 @@ gnc_main_window_open_page (GncMainWindow *window, GtkWidget *label, *entry; const gchar *icon; GtkWidget *image; - gboolean immutable = FALSE; GList *tmp; if (window) @@ -2031,16 +2029,6 @@ gnc_main_window_open_page (GncMainWindow *window, window = active_windows->data; } - /* Is this the first page in the first window? */ - if (window == active_windows->data) { - priv = GNC_MAIN_WINDOW_GET_PRIVATE(window); - if (priv->installed_pages == NULL) { - immutable = TRUE; - g_object_set_data (G_OBJECT (page), PLUGIN_PAGE_IMMUTABLE, - GINT_TO_POINTER(1)); - } - } - page->window = GTK_WIDGET(window); page->notebook_page = gnc_plugin_page_create_widget (page); g_object_set_data (G_OBJECT (page->notebook_page), @@ -2080,7 +2068,7 @@ gnc_main_window_open_page (GncMainWindow *window, page); /* Add close button - Not for immutable pages */ - if (!immutable) { + if (!g_object_get_data (G_OBJECT (page), PLUGIN_PAGE_IMMUTABLE)) { GtkWidget *close_image, *close_button; GtkRequisition requisition; diff --git a/src/gnome-utils/gnc-main-window.h b/src/gnome-utils/gnc-main-window.h index 7d3be956c7..c52e51ad5b 100644 --- a/src/gnome-utils/gnc-main-window.h +++ b/src/gnome-utils/gnc-main-window.h @@ -51,6 +51,8 @@ G_BEGIN_DECLS #define GNC_MAIN_WINDOW_NAME "GncMainWindow" +#define PLUGIN_PAGE_IMMUTABLE "page-immutable" + /* typedefs & structures */ /** The instance data structure for a main window object. */ diff --git a/src/gnome/gnc-plugin-page-account-tree.c b/src/gnome/gnc-plugin-page-account-tree.c index 8285393d41..c3daf03370 100644 --- a/src/gnome/gnc-plugin-page-account-tree.c +++ b/src/gnome/gnc-plugin-page-account-tree.c @@ -53,6 +53,7 @@ #include "gnc-component-manager.h" #include "gnc-engine.h" #include "gnc-gnome-utils.h" +#include "gnc-gobject-utils.h" #include "gnc-html.h" #include "gnc-icons.h" #include "gnc-plugin-account-tree.h" @@ -297,6 +298,7 @@ gnc_plugin_page_account_tree_init (GncPluginPageAccountTree *plugin_page) GtkActionGroup *action_group; GncPluginPageAccountTreePrivate *priv; GncPluginPage *parent; + const GList *page_list; ENTER("page %p", plugin_page); priv = GNC_PLUGIN_PAGE_ACCOUNT_TREE_GET_PRIVATE(plugin_page); @@ -312,6 +314,14 @@ gnc_plugin_page_account_tree_init (GncPluginPageAccountTree *plugin_page) /* change me when the system supports multiple books */ gnc_plugin_page_add_book(parent, gnc_get_current_book()); + /* Is this the first accounts page? */ + page_list = + gnc_gobject_tracking_get_list(GNC_PLUGIN_PAGE_ACCOUNT_TREE_NAME); + if (plugin_page == page_list->data) { + g_object_set_data(G_OBJECT(plugin_page), PLUGIN_PAGE_IMMUTABLE, + GINT_TO_POINTER(1)); + } + /* Create menu and toolbar information */ action_group = gnc_plugin_page_create_action_group(parent,