r15284 - gnucash/branches/2.0 - Save and restore the visibility of the toolbar, statusbar, and
Derek Atkins
warlord at cvs.gnucash.org
Sat Dec 30 14:45:55 EST 2006
Author: warlord
Date: 2006-12-30 14:45:54 -0500 (Sat, 30 Dec 2006)
New Revision: 15284
Trac: http://svn.gnucash.org/trac/changeset/15284
Modified:
gnucash/branches/2.0/
gnucash/branches/2.0/ChangeLog
gnucash/branches/2.0/src/gnome-utils/gnc-main-window.c
Log:
Save and restore the visibility of the toolbar, statusbar, and
summarybar. Fixes #106259.
Merge from r15258
Property changes on: gnucash/branches/2.0
___________________________________________________________________
Name: svk:merge
- 3889ce50-311e-0410-a464-f059747ec5d1:/local/gnucash/branches/2.0:697
d2ab10a8-8a95-4986-baff-8d511d9f15b2:/local/gnucash/branches/2.0:13801
d2ab10a8-8a95-4986-baff-8d511d9f15b2:/local/gnucash/trunk:13282
+ 3889ce50-311e-0410-a464-f059747ec5d1:/local/gnucash/branches/2.0:697
d2ab10a8-8a95-4986-baff-8d511d9f15b2:/local/gnucash/branches/2.0:13802
d2ab10a8-8a95-4986-baff-8d511d9f15b2:/local/gnucash/trunk:13282
Modified: gnucash/branches/2.0/ChangeLog
===================================================================
--- gnucash/branches/2.0/ChangeLog 2006-12-30 19:45:37 UTC (rev 15283)
+++ gnucash/branches/2.0/ChangeLog 2006-12-30 19:45:54 UTC (rev 15284)
@@ -1,3 +1,8 @@
+2006-12-30 David Hampton <hampton at employees.org>
+
+ * Save and restore the visibility of the toolbar, statusbar, and
+ summarybar. Fixes #106259.
+
2006-12-30 Andreas Köhler <andi5.py at gmx.net>
* Avoid crash when renaming page in a page-less window by returning if
Modified: gnucash/branches/2.0/src/gnome-utils/gnc-main-window.c
===================================================================
--- gnucash/branches/2.0/src/gnome-utils/gnc-main-window.c 2006-12-30 19:45:37 UTC (rev 15283)
+++ gnucash/branches/2.0/src/gnome-utils/gnc-main-window.c 2006-12-30 19:45:54 UTC (rev 15284)
@@ -395,6 +395,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"
@@ -500,9 +503,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;
@@ -593,6 +597,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;
@@ -733,8 +777,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 */
@@ -783,6 +828,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