[Gnucash-changes] r14376 - gnucash/trunk - Instead of marking the first page so that it can't be closed, mark the

David Hampton hampton at cvs.gnucash.org
Fri Jun 16 20:44:23 EDT 2006


Author: hampton
Date: 2006-06-16 20:44:21 -0400 (Fri, 16 Jun 2006)
New Revision: 14376
Trac: http://svn.gnucash.org/trac/changeset/14376

Modified:
   gnucash/trunk/ChangeLog
   gnucash/trunk/src/gnome-utils/gnc-main-window.c
   gnucash/trunk/src/gnome-utils/gnc-main-window.h
   gnucash/trunk/src/gnome/gnc-plugin-page-account-tree.c
Log:
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.


Modified: gnucash/trunk/ChangeLog
===================================================================
--- gnucash/trunk/ChangeLog	2006-06-17 00:38:08 UTC (rev 14375)
+++ gnucash/trunk/ChangeLog	2006-06-17 00:44:21 UTC (rev 14376)
@@ -1,5 +1,10 @@
 2006-06-16  David Hampton  <hampton at employees.org>
 
+	* 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.

Modified: gnucash/trunk/src/gnome/gnc-plugin-page-account-tree.c
===================================================================
--- gnucash/trunk/src/gnome/gnc-plugin-page-account-tree.c	2006-06-17 00:38:08 UTC (rev 14375)
+++ gnucash/trunk/src/gnome/gnc-plugin-page-account-tree.c	2006-06-17 00:44:21 UTC (rev 14376)
@@ -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 @@
 	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 @@
 	/* 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,

Modified: gnucash/trunk/src/gnome-utils/gnc-main-window.c
===================================================================
--- gnucash/trunk/src/gnome-utils/gnc-main-window.c	2006-06-17 00:38:08 UTC (rev 14375)
+++ gnucash/trunk/src/gnome-utils/gnc-main-window.c	2006-06-17 00:44:21 UTC (rev 14376)
@@ -80,7 +80,6 @@
  *  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 @@
 	GtkWidget *label, *entry;
 	const gchar *icon;
 	GtkWidget *image;
-	gboolean immutable = FALSE;
 	GList *tmp;
 
 	if (window)
@@ -2031,16 +2029,6 @@
 	  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 @@
 			 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;
 	  

Modified: gnucash/trunk/src/gnome-utils/gnc-main-window.h
===================================================================
--- gnucash/trunk/src/gnome-utils/gnc-main-window.h	2006-06-17 00:38:08 UTC (rev 14375)
+++ gnucash/trunk/src/gnome-utils/gnc-main-window.h	2006-06-17 00:44:21 UTC (rev 14376)
@@ -51,6 +51,8 @@
 
 #define GNC_MAIN_WINDOW_NAME "GncMainWindow"
 
+#define PLUGIN_PAGE_IMMUTABLE    "page-immutable"
+
 /* typedefs & structures */
 
 /** The instance data structure for a main window object. */



More information about the gnucash-changes mailing list