AUDIT: r15258 - gnucash/trunk/src/gnome-utils - Save and restore the visibility of the toolbar, statusbar, and

David Hampton hampton at cvs.gnucash.org
Mon Dec 25 19:07:58 EST 2006


Author: hampton
Date: 2006-12-25 19:07:58 -0500 (Mon, 25 Dec 2006)
New Revision: 15258
Trac: http://svn.gnucash.org/trac/changeset/15258

Modified:
   gnucash/trunk/src/gnome-utils/gnc-main-window.c
Log:
Save and restore the visibility of the toolbar, statusbar, and
summarybar.  Fixes #106259.
BP


Modified: gnucash/trunk/src/gnome-utils/gnc-main-window.c
===================================================================
--- gnucash/trunk/src/gnome-utils/gnc-main-window.c	2006-12-25 20:18:36 UTC (rev 15257)
+++ gnucash/trunk/src/gnome-utils/gnc-main-window.c	2006-12-26 00:07:58 UTC (rev 15258)
@@ -403,6 +403,9 @@
 #define WINDOW_GEOMETRY		"Window Geometry"
 #define WINDOW_POSITION		"Window Position"
 #define WINDOW_MAXIMIZED	"Window Maximized"
+#define TOOLBAR_VISIBLE		"Toolbar Visible"
+#define STATUSBAR_VISIBLE	"Statusbar Visible"
+#define SUMMARYBAR_VISIBLE	"Summarybar Visible"
 #define WINDOW_FIRSTPAGE	"First Page"
 #define WINDOW_PAGECOUNT	"Page Count"
 #define WINDOW_PAGEORDER	"Page Order"
@@ -511,9 +514,10 @@
 gnc_main_window_restore_window (GncMainWindow *window, GncMainWindowSaveData *data)
 {
   GncMainWindowPrivate *priv;
+  GtkAction *action;
   gint *pos, *geom, *order;
   gsize length;
-  gboolean max;
+  gboolean max, visible, desired_visibility;
   gchar *window_group;
   gint page_start, page_count, i;
   GError *error = NULL;
@@ -612,6 +616,46 @@
     gtk_window_maximize(GTK_WINDOW(window));
   }
 
+  /* Common view menu items */
+  action = gnc_main_window_find_action(window, "ViewToolbarAction");
+  visible = gtk_toggle_action_get_active(GTK_TOGGLE_ACTION(action));
+  desired_visibility = g_key_file_get_boolean(data->key_file, window_group,
+					      TOOLBAR_VISIBLE, &error);
+  if (error) {
+    g_warning("error reading group %s key %s: %s",
+	      window_group, TOOLBAR_VISIBLE, error->message);
+    g_error_free(error);
+    error = NULL;
+  } else if (visible != desired_visibility) {
+    gtk_toggle_action_set_active(GTK_TOGGLE_ACTION(action),desired_visibility);
+  }
+
+  action = gnc_main_window_find_action(window, "ViewSummaryAction");
+  visible = gtk_toggle_action_get_active(GTK_TOGGLE_ACTION(action));
+  desired_visibility = g_key_file_get_boolean(data->key_file, window_group,
+					      SUMMARYBAR_VISIBLE, &error);
+  if (error) {
+    g_warning("error reading group %s key %s: %s",
+	      window_group, TOOLBAR_VISIBLE, error->message);
+    g_error_free(error);
+    error = NULL;
+  } else if (visible != desired_visibility) {
+    gtk_toggle_action_set_active(GTK_TOGGLE_ACTION(action),desired_visibility);
+  }
+
+  action = gnc_main_window_find_action(window, "ViewStatusbarAction");
+  visible = gtk_toggle_action_get_active(GTK_TOGGLE_ACTION(action));
+  desired_visibility = g_key_file_get_boolean(data->key_file, window_group,
+					      STATUSBAR_VISIBLE, &error);
+  if (error) {
+    g_warning("error reading group %s key %s: %s",
+	      window_group, TOOLBAR_VISIBLE, error->message);
+    g_error_free(error);
+    error = NULL;
+  } else if (visible != desired_visibility) {
+    gtk_toggle_action_set_active(GTK_TOGGLE_ACTION(action),desired_visibility);
+  }
+
   /* Now populate the window with pages. */
   for (i = 0; i < page_count; i++) {
     data->page_offset = page_start;
@@ -752,8 +796,9 @@
 gnc_main_window_save_window (GncMainWindow *window, GncMainWindowSaveData *data)
 {
   GncMainWindowPrivate *priv;
+  GtkAction *action;
   gint i, num_pages, coords[4], *order;
-  gboolean maximized;
+  gboolean maximized, visible;
   gchar *window_group;
 
   /* Setup */
@@ -802,6 +847,20 @@
 	coords[2], coords[3],
 	maximized ? "maximized" : "not maximized");
 
+  /* Common view menu items */
+  action = gnc_main_window_find_action(window, "ViewToolbarAction");
+  visible = gtk_toggle_action_get_active(GTK_TOGGLE_ACTION(action));
+  g_key_file_set_boolean(data->key_file, window_group,
+			 TOOLBAR_VISIBLE, visible);
+  action = gnc_main_window_find_action(window, "ViewSummaryAction");
+  visible = gtk_toggle_action_get_active(GTK_TOGGLE_ACTION(action));
+  g_key_file_set_boolean(data->key_file, window_group,
+			 SUMMARYBAR_VISIBLE, visible);
+  action = gnc_main_window_find_action(window, "ViewStatusbarAction");
+  visible = gtk_toggle_action_get_active(GTK_TOGGLE_ACTION(action));
+  g_key_file_set_boolean(data->key_file, window_group,
+			 STATUSBAR_VISIBLE, visible);
+
   /* Save individual pages in this window */
   g_list_foreach(priv->installed_pages, (GFunc)gnc_main_window_save_page, data);
 



More information about the gnucash-changes mailing list