r23258 - gnucash/trunk - Refactor gnc-tree-view based widgets such that only gnc-tree-view itself deals with gconf

Geert Janssens gjanssens at code.gnucash.org
Mon Oct 7 10:26:12 EDT 2013


Author: gjanssens
Date: 2013-10-07 10:26:11 -0400 (Mon, 07 Oct 2013)
New Revision: 23258
Trac: http://svn.gnucash.org/trac/changeset/23258

Modified:
   gnucash/trunk/configure.ac
   gnucash/trunk/src/business/business-gnome/gnc-plugin-page-owner-tree.c
   gnucash/trunk/src/gnome-utils/gnc-tree-model-split-reg.c
   gnucash/trunk/src/gnome-utils/gnc-tree-view.c
   gnucash/trunk/src/gnome-utils/gnc-tree-view.h
   gnucash/trunk/src/gnome/dialog-commodities.c
   gnucash/trunk/src/gnome/dialog-price-edit-db.c
   gnucash/trunk/src/gnome/gnc-budget-view.c
   gnucash/trunk/src/gnome/gnc-budget-view.h
   gnucash/trunk/src/gnome/gnc-plugin-page-account-tree.c
   gnucash/trunk/src/gnome/gnc-plugin-page-budget.c
   gnucash/trunk/src/gnome/gnc-plugin-page-sx-list.c
   gnucash/trunk/src/gnome/gnc-plugin-register2.c
   gnucash/trunk/src/gnome/gnc-split-reg2.c
   gnucash/trunk/src/import-export/import-account-matcher.c
Log:
Refactor gnc-tree-view based widgets such that only gnc-tree-view itself deals with gconf

The only exception is gnc-split-reg2, which has it's own implementation
of sort parameters (also linked to gconf unfortunately).

Tree views store column visibility and sort preferences in gconf. This is
actually state information and should be kept in the gnucash state file
(*.gcm in .gnucash/books). It will definitely not be ported to gsettings,
simply because gsettings can't handle floating sections (sections not
strictly tied to schema).

So in the process, where it makes sense the word gconf is already
replaced with "state". That helps with cleaning up the remaining gconf
code in gnucash, and indicates these parts need to be reworked to
use the state file as backend.

Modified: gnucash/trunk/configure.ac
===================================================================
--- gnucash/trunk/configure.ac	2013-10-07 14:25:39 UTC (rev 23257)
+++ gnucash/trunk/configure.ac	2013-10-07 14:26:11 UTC (rev 23258)
@@ -1338,7 +1338,6 @@
   src/import-export/qif-import/gschemas/Makefile
   src/import-export/qif-import/test/Makefile
   src/import-export/gschemas/Makefile
-  src/import-export/schemas/Makefile
   src/import-export/ofx/Makefile
   src/import-export/ofx/test/Makefile
   src/import-export/csv-import/Makefile
@@ -1393,7 +1392,6 @@
   src/business/business-gnome/Makefile
   src/business/business-gnome/gtkbuilder/Makefile
   src/business/business-gnome/gschemas/Makefile
-  src/business/business-gnome/schemas/Makefile
   src/business/business-gnome/ui/Makefile
   src/business/business-ledger/Makefile
   dnl # Stuff for bill/invoice import plugin

Modified: gnucash/trunk/src/business/business-gnome/gnc-plugin-page-owner-tree.c
===================================================================
--- gnucash/trunk/src/business/business-gnome/gnc-plugin-page-owner-tree.c	2013-10-07 14:25:39 UTC (rev 23257)
+++ gnucash/trunk/src/business/business-gnome/gnc-plugin-page-owner-tree.c	2013-10-07 14:26:11 UTC (rev 23258)
@@ -51,7 +51,6 @@
 #include "dialog-utils.h"
 #include "gnc-component-manager.h"
 #include "gnc-engine.h"
-#include "gnc-gconf-utils.h"
 #include "gnc-gnome-utils.h"
 #include "gnc-gobject-utils.h"
 #include "gnc-icons.h"
@@ -67,7 +66,7 @@
 static QofLogModule log_module = GNC_MOD_GUI;
 
 #define PLUGIN_PAGE_ACCT_TREE_CM_CLASS "plugin-page-owner-tree"
-#define GCONF_SECTION "window/pages/owner_tree"
+#define STATE_SECTION_PREFIX "window/pages/"
 
 #define DELETE_DIALOG_FILTER  "filter"
 #define DELETE_DIALOG_OWNER "owner"
@@ -84,7 +83,6 @@
     GtkTreeView *tree_view;
     gint         component_id;
     GncOwnerType owner_type;
-    const gchar *gconf_section;
     OwnerFilterDialog fd;
 } GncPluginPageOwnerTreePrivate;
 
@@ -347,7 +345,6 @@
     GncPluginPageOwnerTree *plugin_page;
 
     GncPluginPageOwnerTreePrivate *priv;
-    gchar* label = "";
     const GList *item;
 
     GtkActionGroup *action_group;
@@ -377,37 +374,6 @@
     priv = GNC_PLUGIN_PAGE_OWNER_TREE_GET_PRIVATE(plugin_page);
     priv->owner_type = owner_type;
 
-    switch (owner_type)
-    {
-    case GNC_OWNER_NONE :
-    case GNC_OWNER_UNDEFINED :
-        break;
-    case GNC_OWNER_CUSTOMER :
-    {
-        label = N_("Customers");
-        priv->gconf_section = g_strdup("window/pages/customer_tree");
-        break;
-    }
-    case GNC_OWNER_JOB :
-    {
-        label = N_("Jobs");
-        priv->gconf_section = g_strdup("window/pages/job_tree");
-        break;
-    }
-    case GNC_OWNER_VENDOR :
-    {
-        label = N_("Vendors");
-        priv->gconf_section = g_strdup("window/pages/vendor_tree");
-        break;
-    }
-    case GNC_OWNER_EMPLOYEE :
-    {
-        label = N_("Employees");
-        priv->gconf_section = g_strdup("window/pages/employee_tree");
-        break;
-    }
-    }
-
     /* Hide menu and toolbar items that are not relevant for the active owner list */
     action_group = gnc_plugin_page_get_action_group(GNC_PLUGIN_PAGE(plugin_page));
     g_value_init (&gvalue, G_TYPE_BOOLEAN);
@@ -418,9 +384,6 @@
         g_object_set_property (G_OBJECT(action), "visible", &gvalue);
     }
 
-
-    g_object_set(G_OBJECT(plugin_page), "page-name", label, NULL);
-
     LEAVE("new %s tree page %p", gncOwnerTypeToQofIdType(owner_type), plugin_page);
     return GNC_PLUGIN_PAGE(plugin_page);
 }
@@ -596,6 +559,8 @@
     GtkTreeView *tree_view;
     GtkWidget *scrolled_window;
     GtkTreeViewColumn *col;
+    gchar *state_section = NULL;
+    gchar* label = "";
 
     ENTER("page %p", plugin_page);
     page = GNC_PLUGIN_PAGE_OWNER_TREE (plugin_page);
@@ -633,11 +598,38 @@
     g_object_set_data(G_OBJECT(col), DEFAULT_VISIBLE, GINT_TO_POINTER(1));
     gnc_tree_view_configure_columns(GNC_TREE_VIEW(tree_view));
 
-    g_object_set(G_OBJECT(tree_view),
-                 "gconf-section", priv->gconf_section,
-                 "show-column-menu", TRUE,
-                 NULL);
 
+
+    switch (priv->owner_type)
+    {
+    case GNC_OWNER_NONE :
+    case GNC_OWNER_UNDEFINED :
+        break;
+    case GNC_OWNER_CUSTOMER :
+        label = N_("Customers");
+        state_section = g_strconcat(STATE_SECTION_PREFIX, "customer_tree", NULL);
+        break;
+    case GNC_OWNER_JOB :
+        label = N_("Jobs");
+        state_section = g_strconcat(STATE_SECTION_PREFIX, "job_tree", NULL);
+        break;
+    case GNC_OWNER_VENDOR :
+        label = N_("Vendors");
+        state_section = g_strconcat(STATE_SECTION_PREFIX, "vendor_tree", NULL);
+        break;
+    case GNC_OWNER_EMPLOYEE :
+        label = N_("Employees");
+        state_section = g_strconcat(STATE_SECTION_PREFIX, "job_tree", NULL);
+        break;
+    }
+
+    g_object_set(G_OBJECT(tree_view), "state-section", state_section,
+                                      "show-column-menu", TRUE,
+                                      NULL);
+    g_free (state_section);
+
+    g_object_set(G_OBJECT(plugin_page), "page-name", label, NULL);
+
     priv->tree_view = tree_view;
     selection = gtk_tree_view_get_selection(tree_view);
     g_signal_connect (G_OBJECT (selection), "changed",

Modified: gnucash/trunk/src/gnome/dialog-commodities.c
===================================================================
--- gnucash/trunk/src/gnome/dialog-commodities.c	2013-10-07 14:25:39 UTC (rev 23257)
+++ gnucash/trunk/src/gnome/dialog-commodities.c	2013-10-07 14:26:11 UTC (rev 23258)
@@ -41,7 +41,7 @@
 
 
 #define DIALOG_COMMODITIES_CM_CLASS "dialog-commodities"
-#define GCONF_SECTION "dialogs/edit_commodities"
+#define STATE_SECTION "dialogs/edit_commodities"
 #define GNC_PREFS_GROUP   "dialogs.edit_commodities"
 #define GNC_PREF_INCL_ISO "include_iso"
 
@@ -336,7 +336,7 @@
 
     scrolled_window = GTK_WIDGET(gtk_builder_get_object (builder, "commodity_list_window"));
     view = gnc_tree_view_commodity_new(cd->book,
-                                       "gconf-section", GCONF_SECTION,
+                                       "state-section", STATE_SECTION,
                                        "show-column-menu", TRUE,
                                        NULL);
     cd->commodity_tree = GNC_TREE_VIEW_COMMODITY(view);

Modified: gnucash/trunk/src/gnome/dialog-price-edit-db.c
===================================================================
--- gnucash/trunk/src/gnome/dialog-price-edit-db.c	2013-10-07 14:25:39 UTC (rev 23257)
+++ gnucash/trunk/src/gnome/dialog-price-edit-db.c	2013-10-07 14:26:11 UTC (rev 23258)
@@ -51,7 +51,7 @@
 
 
 #define DIALOG_PRICE_DB_CM_CLASS "dialog-price-edit-db"
-#define GCONF_SECTION "dialogs/edit_prices"
+#define STATE_SECTION "dialogs/edit_prices"
 #define GNC_PREFS_GROUP "dialogs.edit_prices"
 
 /* This static indicates the debugging module that this .o belongs to.  */
@@ -443,7 +443,7 @@
     /* price tree */
     scrolled_window = GTK_WIDGET(gtk_builder_get_object (builder, "price_list_window"));
     view = gnc_tree_view_price_new(pdb_dialog->book,
-                                   "gconf-section", GCONF_SECTION,
+                                   "state-section", STATE_SECTION,
                                    "show-column-menu", TRUE,
                                    NULL);
     pdb_dialog->price_tree = GNC_TREE_VIEW_PRICE(view);

Modified: gnucash/trunk/src/gnome/gnc-budget-view.c
===================================================================
--- gnucash/trunk/src/gnome/gnc-budget-view.c	2013-10-07 14:25:39 UTC (rev 23257)
+++ gnucash/trunk/src/gnome/gnc-budget-view.c	2013-10-07 14:26:11 UTC (rev 23258)
@@ -45,7 +45,6 @@
 
 #include "dialog-options.h"
 #include "dialog-utils.h"
-#include "gnc-gconf-utils.h"
 #include "gnc-gnome-utils.h"
 #include "gnc-gobject-utils.h"
 #include "gnc-icons.h"
@@ -69,7 +68,7 @@
 static QofLogModule log_module = GNC_MOD_BUDGET;
 
 #define PLUGIN_PAGE_BUDGET_CM_CLASS "budget-view"
-#define GCONF_SECTION "window/pages/budget"
+#define STATE_SECTION_PREFIX "window/pages/budget"
 
 typedef struct GncBudgetViewPrivate GncBudgetViewPrivate;
 
@@ -120,7 +119,6 @@
     GtkTreeView *tree_view;
     GtkTreeView *totals_tree_view;
 
-    gchar* gconf_section;
     GncBudget* budget;
     GncGUID key;
 
@@ -141,7 +139,7 @@
 G_DEFINE_TYPE(GncBudgetView, gnc_budget_view, GTK_TYPE_VBOX)
 
 GncBudgetView *
-gnc_budget_view_new(GncBudget *budget, AccountFilterDialog* fd, const gchar* gconf_section)
+gnc_budget_view_new(GncBudget *budget, AccountFilterDialog* fd)
 {
     GncBudgetView *budget_view;
     GncBudgetViewPrivate *priv;
@@ -157,7 +155,6 @@
     priv->budget = budget;
     priv->key = *gnc_budget_get_guid(budget);
     priv->fd = fd;
-    priv->gconf_section = g_strdup(gconf_section);
     priv->total_col = NULL;
     gbv_create_widget(budget_view);
 
@@ -233,10 +230,6 @@
     view = GNC_BUDGET_VIEW(object);
     g_return_if_fail(GNC_IS_BUDGET_VIEW(view));
 
-    priv = GNC_BUDGET_VIEW_GET_PRIVATE(view);
-
-    g_free(priv->gconf_section);
-
     G_OBJECT_CLASS(gnc_budget_view_parent_class)->finalize(object);
     LEAVE(" ");
 }
@@ -317,7 +310,6 @@
     GtkTreeView *tree_view;
     GtkWidget *scrolled_window;
     GtkWidget *inner_scrolled_window;
-    const gchar *budget_guid_str;
     GtkVBox* vbox;
     GtkWidget* inner_vbox;
     GtkListStore* totals_tree_model;
@@ -325,6 +317,7 @@
     GtkTreeViewColumn* totals_title_col;
     GtkTreeIter iter;
     GtkWidget* h_separator;
+    gchar *state_section;
 
     priv = GNC_BUDGET_VIEW_GET_PRIVATE(view);
     vbox = GTK_VBOX(view);
@@ -351,7 +344,9 @@
     tree_view = gnc_tree_view_account_new(FALSE);
     gtk_container_add(GTK_CONTAINER(inner_scrolled_window), GTK_WIDGET(tree_view));
 
-    g_object_set(G_OBJECT(tree_view), "gconf-section", priv->gconf_section, NULL);
+    state_section = g_strjoin("/", STATE_SECTION_PREFIX, guid_to_string(&priv->key), NULL);
+    g_object_set(G_OBJECT(tree_view), "state-section", state_section, NULL);
+    g_free (state_section);
 
     gnc_tree_view_configure_columns(GNC_TREE_VIEW(tree_view));
     priv->tree_view = tree_view;
@@ -510,7 +505,28 @@
     return TRUE;
 }
 
+/***********************************************************************
+ *  The budget associated with this view is about to be removed from   *
+ *  the book. So drop any saved state we still have.                   *
+ *                                                                     *
+ *  @param view The view to which the budget is associated.            *
+ **********************************************************************/
+void
+gnc_budget_view_delete_budget(GncBudgetView *view)
+{
+    GncBudgetViewPrivate *priv;
 
+    g_return_if_fail(view != NULL);
+
+    ENTER("view %p", view);
+
+    gnc_tree_view_remove_state_information (GNC_TREE_VIEW (view));
+
+    LEAVE(" ");
+}
+
+
+
 #if 0
 /***********************************************************************
  *   This button press handler calls the common button press handler

Modified: gnucash/trunk/src/gnome/gnc-budget-view.h
===================================================================
--- gnucash/trunk/src/gnome/gnc-budget-view.h	2013-10-07 14:25:39 UTC (rev 23257)
+++ gnucash/trunk/src/gnome/gnc-budget-view.h	2013-10-07 14:26:11 UTC (rev 23258)
@@ -60,10 +60,10 @@
  *
  *  @return The newly created widget
  */
-GncBudgetView *gnc_budget_view_new(GncBudget *budget, AccountFilterDialog* fd,
-                                   const gchar* gconf_section);
+GncBudgetView *gnc_budget_view_new(GncBudget *budget, AccountFilterDialog* fd);
 void gnc_budget_view_save(GncBudgetView* view, GKeyFile *key_file, const gchar* group_name);
 void gnc_budget_view_refresh(GncBudgetView* view);
+void gnc_budget_view_delete_budget(GncBudgetView* view);
 gboolean gnc_budget_view_restore(GncBudgetView* view, GKeyFile *key_file, const gchar* group_name);
 GtkTreeSelection* gnc_budget_view_get_selection(GncBudgetView* view);
 Account* gnc_budget_view_get_account_from_path(GncBudgetView* view, GtkTreePath* path);

Modified: gnucash/trunk/src/gnome/gnc-plugin-page-account-tree.c
===================================================================
--- gnucash/trunk/src/gnome/gnc-plugin-page-account-tree.c	2013-10-07 14:25:39 UTC (rev 23257)
+++ gnucash/trunk/src/gnome/gnc-plugin-page-account-tree.c	2013-10-07 14:26:11 UTC (rev 23258)
@@ -50,7 +50,6 @@
 #include "gnc-account-sel.h"
 #include "gnc-component-manager.h"
 #include "gnc-engine.h"
-#include "gnc-gconf-utils.h"
 #include "gnc-gnome-utils.h"
 #include "gnc-gobject-utils.h"
 #include "gnc-icons.h"
@@ -72,7 +71,7 @@
 static QofLogModule log_module = GNC_MOD_GUI;
 
 #define PLUGIN_PAGE_ACCT_TREE_CM_CLASS "plugin-page-acct-tree"
-#define GCONF_SECTION "window/pages/account_tree"
+#define STATE_SECTION "window/pages/account_tree"
 
 #define DELETE_DIALOG_FILTER       "filter"
 #define DELETE_DIALOG_ACCOUNT      "account"
@@ -535,7 +534,7 @@
     g_object_set_data(G_OBJECT(col), DEFAULT_VISIBLE, GINT_TO_POINTER(1));
     gnc_tree_view_configure_columns(GNC_TREE_VIEW(tree_view));
     g_object_set(G_OBJECT(tree_view),
-                 "gconf-section", GCONF_SECTION,
+                 "state-section", STATE_SECTION,
                  "show-column-menu", TRUE,
                  NULL);
 

Modified: gnucash/trunk/src/gnome/gnc-plugin-page-budget.c
===================================================================
--- gnucash/trunk/src/gnome/gnc-plugin-page-budget.c	2013-10-07 14:25:39 UTC (rev 23257)
+++ gnucash/trunk/src/gnome/gnc-plugin-page-budget.c	2013-10-07 14:26:11 UTC (rev 23258)
@@ -47,7 +47,6 @@
 
 #include "dialog-options.h"
 #include "dialog-utils.h"
-#include "gnc-gconf-utils.h"
 #include "gnc-gnome-utils.h"
 #include "gnc-gobject-utils.h"
 #include "gnc-icons.h"
@@ -74,7 +73,6 @@
 static QofLogModule log_module = GNC_MOD_BUDGET;
 
 #define PLUGIN_PAGE_BUDGET_CM_CLASS "plugin-page-budget"
-#define GCONF_SECTION "window/pages/budget"
 
 /************************************************************
  *                        Prototypes                        *
@@ -191,7 +189,6 @@
     GncBudgetView* budget_view;
     GtkTreeView *tree_view;
 
-    gchar* gconf_section;
     gint component_id;
 
     GncBudget* budget;
@@ -272,7 +269,6 @@
     priv->budget = budget;
     priv->delete_budget = FALSE;
     priv->key = *gnc_budget_get_guid(budget);
-    priv->gconf_section = g_strjoin("/", GCONF_SECTION, guid_to_string(&priv->key), NULL);
     label = g_strdup_printf("%s: %s", _("Budget"), gnc_budget_get_name(budget));
     g_object_set(G_OBJECT(plugin_page), "page-name", label, NULL);
     g_free(label);
@@ -356,10 +352,6 @@
     page = GNC_PLUGIN_PAGE_BUDGET (object);
     g_return_if_fail (GNC_IS_PLUGIN_PAGE_BUDGET (page));
 
-    priv = GNC_PLUGIN_PAGE_BUDGET_GET_PRIVATE(page);
-
-    g_free(priv->gconf_section);
-
     G_OBJECT_CLASS (parent_class)->finalize (object);
     LEAVE(" ");
 }
@@ -425,7 +417,7 @@
         return GTK_WIDGET(priv->budget_view);
     }
 
-    priv->budget_view = gnc_budget_view_new(priv->budget, &priv->fd, priv->gconf_section);
+    priv->budget_view = gnc_budget_view_new(priv->budget, &priv->fd);
 
 #if 0
     g_signal_connect(G_OBJECT(selection), "changed",
@@ -462,16 +454,13 @@
     ENTER("page %p", plugin_page);
     priv = GNC_PLUGIN_PAGE_BUDGET_GET_PRIVATE(plugin_page);
 
-    if (priv->delete_budget)
+    if (priv->budget_view)
     {
-        if (priv->gconf_section)
+        if (priv->delete_budget)
         {
-            gnc_gconf_unset_dir (priv->gconf_section, NULL);
+            gnc_budget_view_delete_budget (priv->budget_view);
         }
-    }
 
-    if (priv->budget_view)
-    {
         g_object_unref(G_OBJECT(priv->budget_view));
         priv->budget_view = NULL;
     }

Modified: gnucash/trunk/src/gnome/gnc-plugin-page-sx-list.c
===================================================================
--- gnucash/trunk/src/gnome/gnc-plugin-page-sx-list.c	2013-10-07 14:25:39 UTC (rev 23257)
+++ gnucash/trunk/src/gnome/gnc-plugin-page-sx-list.c	2013-10-07 14:26:11 UTC (rev 23258)
@@ -79,7 +79,7 @@
 G_GNUC_UNUSED static QofLogModule log_module = GNC_MOD_GUI_SX;
 
 #define PLUGIN_PAGE_SX_LIST_CM_CLASS "plugin-page-sx-list"
-#define GCONF_SECTION "window/pages/sx_list"
+#define STATE_SECTION "window/pages/sx_list"
 
 typedef struct GncPluginPageSxListPrivate
 {
@@ -402,7 +402,7 @@
 
         priv->tree_view = GTK_TREE_VIEW(gnc_tree_view_sx_list_new(priv->instances));
         g_object_set(G_OBJECT(priv->tree_view),
-                     "gconf-section", GCONF_SECTION,
+                     "state-section", STATE_SECTION,
                      "show-column-menu", TRUE,
                      NULL);
         gtk_container_add(GTK_CONTAINER( swin ), GTK_WIDGET(priv->tree_view));

Modified: gnucash/trunk/src/gnome/gnc-plugin-register2.c
===================================================================
--- gnucash/trunk/src/gnome/gnc-plugin-register2.c	2013-10-07 14:25:39 UTC (rev 23257)
+++ gnucash/trunk/src/gnome/gnc-plugin-register2.c	2013-10-07 14:26:11 UTC (rev 23258)
@@ -45,7 +45,6 @@
 
 #define PLUGIN_ACTIONS_NAME "gnc-plugin-register2-actions"
 #define PLUGIN_UI_FILENAME  "gnc-plugin-register2-ui.xml"
-#define GCONF_REGISTER2_SECTION "general/register"
 
 static GtkActionEntry gnc_plugin_actions [] =
 {

Modified: gnucash/trunk/src/gnome/gnc-split-reg2.c
===================================================================
--- gnucash/trunk/src/gnome/gnc-split-reg2.c	2013-10-07 14:25:39 UTC (rev 23257)
+++ gnucash/trunk/src/gnome/gnc-split-reg2.c	2013-10-07 14:26:11 UTC (rev 23258)
@@ -40,7 +40,7 @@
 #include "gnc-gconf-utils.h"
 #include "dialog-utils.h"
 
-#define GCONF_SECTION "window/pages/register2"
+#define STATE_SECTION_PREFIX "window/pages/register2/"
 
 static QofLogModule log_module = GNC_MOD_GUI;
 
@@ -234,10 +234,9 @@
     GtkWidget *hbox;
     gdouble num_of_trans;
 
-    gchar *gconf_key;
+    gchar *state_key;
     const GncGUID * guid;
     Account * account;
-    const gchar *gconf_section;
     const gchar *sort_string;
     
     account = gnc_ledger_display2_leader (gsr->ledger);
@@ -251,25 +250,21 @@
                                      gnc_split_reg2_get_parent);
 
     ledger_type = gnc_ledger_display2_type (gsr->ledger);
-
     model = gnc_ledger_display2_get_split_model_register (gsr->ledger);
 
-    /* Used for saving different register column widths under seperate keys */
-    if (ledger_type == LD2_SUBACCOUNT)
-        gconf_key = g_strconcat (GCONF_SECTION,"/", (gchar*)guid_to_string (guid), "_sub", NULL);
+    /* Used for saving different register column widths under separate keys */
+    // We need to give the General Ledger a Key other than all zeros which the search register gets.
+    if (ledger_type == LD2_GL && model->type == GENERAL_LEDGER2)
+        state_key = g_strconcat (STATE_SECTION_PREFIX, "00000000000000000000000000000001", NULL);
+    else if (ledger_type == LD2_SUBACCOUNT)
+        state_key = g_strconcat (STATE_SECTION_PREFIX, (gchar*)guid_to_string (guid), "_sub", NULL);
     else
-        gconf_key = g_strconcat (GCONF_SECTION,"/", (gchar*)guid_to_string (guid), NULL);
+        state_key = g_strconcat (STATE_SECTION_PREFIX, (gchar*)guid_to_string (guid), NULL);
 
     gnc_tree_model_split_reg_set_display (model, ((ledger_type == LD2_SUBACCOUNT)?TRUE:FALSE), ((ledger_type == LD2_GL)?TRUE:FALSE));
-
     view = gnc_tree_view_split_reg_new_with_model (model);
-
     g_object_unref (G_OBJECT (model));
 
-    // We need to give the General Ledger a Key other than all zeros which the search register gets.
-    if (ledger_type == LD2_GL && model->type == GENERAL_LEDGER2)
-        gconf_key = g_strconcat (GCONF_SECTION,"/", "00000000000000000000000000000001", NULL);
-
     // Create a hbox for treeview and scrollbar.
     hbox = gtk_hbox_new (FALSE, 0);
     gtk_widget_show (hbox);
@@ -296,19 +291,19 @@
     gnc_ledger_display2_set_split_view_register (gsr->ledger, view);
 
     /* Restore the sort depth from gconf */
-    view->sort_depth = gnc_gconf_get_int (gconf_key, "sort_depth", NULL);
+    view->sort_depth = gnc_gconf_get_int (state_key, "sort_depth", NULL);
 
     /* Restore the sort order from gconf */
-    sort_string = gnc_gconf_get_string (gconf_key, "sort_order", NULL);
+    sort_string = gnc_gconf_get_string (state_key, "sort_order", NULL);
     if (g_strcmp0 ("descending", sort_string) == 0)
         view->sort_direction = -1;
     else
         view->sort_direction = 1;
 
-    /* Restore the sort column from gconf */
+    /* Restore the sort column from saved state */
     view->sort_col = model->sort_col;
 
-    g_object_set (G_OBJECT (view), "gconf-section", gconf_key, 
+    g_object_set (G_OBJECT (view), "state-section", state_key,
                  "show-column-menu", FALSE, NULL);
 
     gnc_tree_view_configure_columns (GNC_TREE_VIEW (view));
@@ -683,13 +678,13 @@
 {
     GNCSplitReg2 *gsr = gnc_ledger_display2_get_user_data (ledger);
     
-    gchar *gconf_key;
+    gchar *state_key;
     const GncGUID * guid;
     Account * account;
     
     account = gnc_ledger_display2_leader (ledger);
     guid = xaccAccountGetGUID (account);
-    gconf_key = (gchar*)guid_to_string (guid);
+    state_key = (gchar*)guid_to_string (guid);
     
     if (gsr)
     {
@@ -699,7 +694,7 @@
 
 /*FIXME This may not be required
         if (model && model->table)
-            gnc_table_save_state (model->table, gconf_key);
+            gnc_table_save_state (model->table, state_key);
 */
         /*
          * Don't destroy the window here any more.  The register no longer
@@ -796,7 +791,7 @@
     GtkSortType   type;
     gint          sortcol;
     gint          sort_depth;
-    const gchar  *gconf_section;
+    const gchar  *state_section;
 
     gtk_tree_sortable_get_sort_column_id (sortable, &sortcol, &type);
     ENTER("sortcol is %d", sortcol);
@@ -825,9 +820,9 @@
     }
 
     /* Save the sort depth to gconf */
-    gconf_section = gnc_tree_view_get_gconf_section (GNC_TREE_VIEW (view));
-    gnc_gconf_set_int (gconf_section, "sort_depth", view->sort_depth, NULL);
-    gnc_gconf_set_int (gconf_section, "sort_col", view->sort_col, NULL);
+    state_section = gnc_tree_view_get_state_section (GNC_TREE_VIEW (view));
+    gnc_gconf_set_int (state_section, "sort_depth", view->sort_depth, NULL);
+    gnc_gconf_set_int (state_section, "sort_col", view->sort_col, NULL);
 
     LEAVE("v_sort_col %d, v_sort_direction is %d  v_sort_depth is %d", view->sort_col, view->sort_direction, view->sort_depth);
 

Modified: gnucash/trunk/src/gnome-utils/gnc-tree-model-split-reg.c
===================================================================
--- gnucash/trunk/src/gnome-utils/gnc-tree-model-split-reg.c	2013-10-07 14:25:39 UTC (rev 23257)
+++ gnucash/trunk/src/gnome-utils/gnc-tree-model-split-reg.c	2013-10-07 14:26:11 UTC (rev 23258)
@@ -47,7 +47,7 @@
 
 #define TREE_MODEL_SPLIT_REG_CM_CLASS "tree-model-split-reg"
 
-#define GCONF_SECTION "window/pages/register2"
+#define STATE_SECTION_PREFIX "window/pages/register2/"
 
 /* Signal codes */
 enum
@@ -1003,40 +1003,39 @@
 void
 gnc_tree_model_split_reg_default_query (GncTreeModelSplitReg *model, Account *default_account, Query *query)
 {
-    gchar *gconf_key;
+    gchar *state_key;
     const GncGUID * guid;
-    const gchar *gconf_section;
     const gchar *sort_string;
     gint  depth, col;
     
     guid = xaccAccountGetGUID (default_account);
 
     /* Used for saving different register column widths under seperate keys */
-    if (model->priv->display_subacc == TRUE)
-        gconf_key = g_strconcat (GCONF_SECTION,"/", (gchar*)guid_to_string (guid), "_sub", NULL);
-    else
-        gconf_key = g_strconcat (GCONF_SECTION,"/", (gchar*)guid_to_string (guid), NULL);
- 
     // We need to give the General Ledger a Key other than all zeros which the search register gets.
     if (model->priv->display_gl == TRUE && model->type == GENERAL_LEDGER2)
-        gconf_key = g_strconcat (GCONF_SECTION,"/", "00000000000000000000000000000001", NULL);
+        state_key = g_strconcat (STATE_SECTION_PREFIX, "00000000000000000000000000000001", NULL);
+    else if (model->priv->display_subacc == TRUE)
+        state_key = g_strconcat (STATE_SECTION_PREFIX, (gchar*)guid_to_string (guid), "_sub", NULL);
+    else
+        state_key = g_strconcat (STATE_SECTION_PREFIX, (gchar*)guid_to_string (guid), NULL);
+ 
 
     /* Restore the sort column from gconf */
-    col = gnc_gconf_get_int (gconf_key, "sort_col", NULL);
+    col = gnc_gconf_get_int (state_key, "sort_col", NULL);
     if (col == 0)    
         model->sort_col = 1;
     else
         model->sort_col = col;
 
     /* Restore the sort depth from gconf */
-    depth = gnc_gconf_get_int (gconf_key, "sort_depth", NULL);
+    depth = gnc_gconf_get_int (state_key, "sort_depth", NULL);
     if (depth == 0)
         model->sort_depth = 1;
     else
         model->sort_depth = depth;
 
     /* Restore the sort order from gconf */
-    sort_string = gnc_gconf_get_string (gconf_key, "sort_order", NULL);
+    sort_string = gnc_gconf_get_string (state_key, "sort_order", NULL);
     if (g_strcmp0 ("descending", sort_string) == 0)
         model->sort_direction = -1;
     else

Modified: gnucash/trunk/src/gnome-utils/gnc-tree-view.c
===================================================================
--- gnucash/trunk/src/gnome-utils/gnc-tree-view.c	2013-10-07 14:25:39 UTC (rev 23257)
+++ gnucash/trunk/src/gnome-utils/gnc-tree-view.c	2013-10-07 14:26:11 UTC (rev 23258)
@@ -45,26 +45,26 @@
 #include "gnc-gobject-utils.h"
 #include "gnc-cell-renderer-date.h"
 
-/* The actual gconf key for a particular column visibility.  This is
+/* The actual state key for a particular column visibility.  This is
  * attached to the menu items that are in the column selection menu.
- * Makes it very easy to update gconf when a menu item is toggled. */
-#define GCONF_KEY  "gconf-key"
+ * Makes it very easy to update saved state when a menu item is toggled. */
+#define STATE_KEY  "state-key"
 
-/* Gconf keys within this particular section of gconf. */
-#define GCONF_KEY_SORT_COLUMN  "sort_column"
-#define GCONF_KEY_SORT_ORDER   "sort_order"
-#define GCONF_KEY_COLUMN_ORDER "column_order"
+/* State keys within this particular saved state section. */
+#define STATE_KEY_SORT_COLUMN  "sort_column"
+#define STATE_KEY_SORT_ORDER   "sort_order"
+#define STATE_KEY_COLUMN_ORDER "column_order"
 
-/* Partial gconf keys within this particular section of gconf. These
+/* Partial state keys within this particular saved state section. These
    are appended to the various column names to create the actual
    keys. */
-#define GCONF_KEY_VISIBLE      "visible"
-#define GCONF_KEY_WIDTH        "width"
+#define STATE_KEY_VISIBLE      "visible"
+#define STATE_KEY_WIDTH        "width"
 
 enum
 {
     PROP_0,
-    PROP_GCONF_SECTION,
+    PROP_STATE_SECTION,
     PROP_SHOW_COLUMN_MENU,
 };
 
@@ -86,7 +86,7 @@
                                         guint            prop_id,
                                         GValue          *value,
                                         GParamSpec      *pspec);
-static void gnc_tree_view_remove_gconf(GncTreeView *view);
+static void gnc_tree_view_remove_gconf_callbacks(GncTreeView *view);
 static gboolean gnc_tree_view_drop_ok_cb (GtkTreeView *view,
         GtkTreeViewColumn *column,
         GtkTreeViewColumn *prev_column,
@@ -114,9 +114,9 @@
     /* Sort callback model */
     GtkTreeModel      *sort_model;
 
-    /* Gconf related values */
-    gchar             *gconf_section;
-    gboolean           seen_gconf_visibility;
+    /* State related values */
+    gchar             *state_section;
+    gboolean           seen_state_visibility;
     gulong             columns_changed_cb_id;
     gulong             sort_column_changed_cb_id;
     gulong             size_allocate_cb_id;
@@ -195,10 +195,10 @@
     g_type_class_add_private(klass, sizeof(GncTreeViewPrivate));
 
     g_object_class_install_property (gobject_class,
-                                     PROP_GCONF_SECTION,
-                                     g_param_spec_string ("gconf-section",
-                                             "Gconf Section",
-                                             "The Gconf section to use for storing settings",
+                                     PROP_STATE_SECTION,
+                                     g_param_spec_string ("state-section",
+                                             "State Section",
+                                             "The section name in the saved state to use for (re)storing the treeview's visual state (visible columns, sort order,...",
                                              NULL,
                                              G_PARAM_READWRITE));
     g_object_class_install_property (gobject_class,
@@ -239,8 +239,8 @@
     priv->column_menu = NULL;
     priv->show_column_menu = FALSE;
     priv->sort_model = NULL;
-    priv->gconf_section = NULL;
-    priv->seen_gconf_visibility = FALSE;
+    priv->state_section = NULL;
+    priv->seen_state_visibility = FALSE;
     priv->columns_changed_cb_id = 0;
     priv->sort_column_changed_cb_id = 0;
     priv->size_allocate_cb_id = 0;
@@ -335,7 +335,7 @@
 
     view = GNC_TREE_VIEW (object);
 
-    gnc_tree_view_remove_gconf(view);
+    gnc_tree_view_remove_gconf_callbacks(view);
 
     priv = GNC_TREE_VIEW_GET_PRIVATE(view);
 
@@ -379,8 +379,8 @@
     priv = GNC_TREE_VIEW_GET_PRIVATE(view);
     switch (prop_id)
     {
-    case PROP_GCONF_SECTION:
-        g_value_set_string (value, priv->gconf_section);
+    case PROP_STATE_SECTION:
+        g_value_set_string (value, priv->state_section);
         break;
     case PROP_SHOW_COLUMN_MENU:
         g_value_set_boolean (value, priv->show_column_menu);
@@ -410,8 +410,8 @@
 
     switch (prop_id)
     {
-    case PROP_GCONF_SECTION:
-        gnc_tree_view_set_gconf_section (view, g_value_get_string (value));
+    case PROP_STATE_SECTION:
+        gnc_tree_view_set_state_section (view, g_value_get_string (value));
         break;
     case PROP_SHOW_COLUMN_MENU:
         gnc_tree_view_set_show_column_menu (view, g_value_get_boolean (value));
@@ -471,7 +471,7 @@
     return found;
 }
 
-/** Find a tree column given the "pref name" used with gconf.  This
+/** Find a tree column given the "pref name" used with saved state.  This
  *  function simply runs the list of all (visible and invisible)
  *  columns looking for a match.  Column names were attached to each
  *  column at the time the column was created.
@@ -590,7 +590,6 @@
 {
     GncTreeViewPrivate *priv;
     GtkTreeViewColumn *column;
-    const gchar  	    *gconf_section;
     gchar        	    *column_pref_name;
     GtkSortType  	     order;
     gint         	     id;
@@ -600,9 +599,9 @@
 
     ENTER(" ");
     priv = GNC_TREE_VIEW_GET_PRIVATE(view);
-    if (!priv->gconf_section)
+    if (!priv->state_section)
     {
-        LEAVE("no gconf section");
+        LEAVE("no state section");
         return;
     }
 
@@ -619,10 +618,9 @@
         column_pref_name = "none";
 
     /* Store the values in gconf */
-    gconf_section = priv->gconf_section;
-    gnc_gconf_set_string(gconf_section, GCONF_KEY_SORT_COLUMN,
+    gnc_gconf_set_string(priv->state_section, STATE_KEY_SORT_COLUMN,
                          column_pref_name, NULL);
-    gnc_gconf_set_string(gconf_section, GCONF_KEY_SORT_ORDER,
+    gnc_gconf_set_string(priv->state_section, STATE_KEY_SORT_ORDER,
                          gnc_enum_to_nick(GTK_TYPE_SORT_TYPE, order), NULL);
     LEAVE(" ");
 }
@@ -662,7 +660,7 @@
     }
     g_list_free(column_list);
 
-    gnc_gconf_set_list(priv->gconf_section, GCONF_KEY_COLUMN_ORDER,
+    gnc_gconf_set_list(priv->state_section, STATE_KEY_COLUMN_ORDER,
                        GCONF_VALUE_STRING, column_names, NULL);
     g_slist_free(column_names);
     //LEAVE(" ");
@@ -670,9 +668,9 @@
 
 /** This is the helper function for gtk_tree_view_size_allocate_cb().
  *  It compares the actual column width to the width as stored in
- *  gconf.  If the two are different, it the updates gconf with the
+ *  gconf.  If the two are different, it updates gconf with the
  *  actual width.  This will trigger a notification from gconf that
- *  the size has changes, and that code must be smart enough to
+ *  the size has changed, and that code must be smart enough to
  *  prevent an infinite loop.  Not storing unchanged values prevents
  *  spurious callbacks from gconf and just saves processing time.
  *
@@ -704,11 +702,11 @@
         return;
 
     /* Do it */
-    key = g_strdup_printf("%s_%s", column_pref_name, GCONF_KEY_WIDTH);
-    current_width = gnc_gconf_get_int(priv->gconf_section, key, NULL);
+    key = g_strdup_printf("%s_%s", column_pref_name, STATE_KEY_WIDTH);
+    current_width = gnc_gconf_get_int(priv->state_section, key, NULL);
     if (new_width != current_width)
     {
-        gnc_gconf_set_int(priv->gconf_section, key, new_width, NULL);
+        gnc_gconf_set_int(priv->state_section, key, new_width, NULL);
         DEBUG("set %s width to %d", column_pref_name, new_width);
     }
     g_free(key);
@@ -809,12 +807,12 @@
     }
 
     /* Using gconf? */
-    if (priv->gconf_section)
+    if (priv->state_section)
     {
-        if (priv->seen_gconf_visibility)
+        if (priv->seen_state_visibility)
         {
-            key = g_strdup_printf("%s_%s", pref_name, GCONF_KEY_VISIBLE);
-            visible = gnc_gconf_get_bool(priv->gconf_section, key, NULL);
+            key = g_strdup_printf("%s_%s", pref_name, STATE_KEY_VISIBLE);
+            visible = gnc_gconf_get_bool(priv->state_section, key, NULL);
             g_free(key);
             LEAVE("%d, gconf visibility", visible);
             return visible;
@@ -858,7 +856,7 @@
     priv = GNC_TREE_VIEW_GET_PRIVATE(view);
     visible = gnc_tree_view_column_visible(view, column, NULL);
     gtk_tree_view_column_set_visible(column, visible);
-    if (priv->gconf_section)
+    if (priv->state_section)
     {
         name = (gchar *)g_object_get_data(G_OBJECT(column), PREF_NAME);
         if (!name)
@@ -866,8 +864,8 @@
             LEAVE("no pref name");
             return;
         }
-        key = g_strdup_printf("%s_%s", name, GCONF_KEY_VISIBLE);
-        gnc_gconf_set_bool(priv->gconf_section, key, visible, NULL);
+        key = g_strdup_printf("%s_%s", name, STATE_KEY_VISIBLE);
+        gnc_gconf_set_bool(priv->state_section, key, visible, NULL);
         g_free(key);
         LEAVE("made %s, set gconf key", visible ? "visible" : "invisible");
         return;
@@ -1071,15 +1069,15 @@
 
     DEBUG("Key %s, value %p", key, value);
     local = strrchr(key, '/') + 1;
-    if (strcmp(local, GCONF_KEY_SORT_COLUMN) == 0)
+    if (strcmp(local, STATE_KEY_SORT_COLUMN) == 0)
     {
         gnc_tree_view_set_sort_column(view, gconf_value_get_string(value));
     }
-    else if (strcmp(local, GCONF_KEY_SORT_ORDER) == 0)
+    else if (strcmp(local, STATE_KEY_SORT_ORDER) == 0)
     {
         gnc_tree_view_set_sort_order(view, gconf_value_get_string(value));
     }
-    else if (strcmp(local, GCONF_KEY_COLUMN_ORDER) == 0)
+    else if (strcmp(local, STATE_KEY_COLUMN_ORDER) == 0)
     {
         gnc_tree_view_set_column_order(view, gconf_value_get_list(value));
     }
@@ -1092,9 +1090,9 @@
         type_name = strrchr(column_name, '_');
         *type_name++ = '\0';
 
-        if (strcmp(type_name, GCONF_KEY_VISIBLE) == 0)
+        if (strcmp(type_name, STATE_KEY_VISIBLE) == 0)
         {
-            priv->seen_gconf_visibility = TRUE;
+            priv->seen_state_visibility = TRUE;
             column = gnc_tree_view_find_column_by_name(view, column_name);
             if (column)
             {
@@ -1105,7 +1103,7 @@
                 }
             }
         }
-        else if (strcmp(type_name, GCONF_KEY_WIDTH) == 0)
+        else if (strcmp(type_name, STATE_KEY_WIDTH) == 0)
         {
             width = gconf_value_get_int(value);
             column = gnc_tree_view_find_column_by_name(view, column_name);
@@ -1147,12 +1145,12 @@
 
     ENTER("view %p", view);
     priv = GNC_TREE_VIEW_GET_PRIVATE(view);
-    all_entries = gnc_gconf_client_all_entries(priv->gconf_section);
+    all_entries = gnc_gconf_client_all_entries(priv->state_section);
 
     /* Set a flag indicating that the gconf data section may be empty.
      * It will be checked later on and appropriate action taken if its
      * still set. */
-    priv->seen_gconf_visibility = FALSE;
+    priv->seen_state_visibility = FALSE;
 
     /* Pull all the entries from gconf */
     for (etmp = all_entries; etmp; etmp = g_slist_next(etmp))
@@ -1163,7 +1161,7 @@
     g_slist_free(all_entries);
 
     /* No visibilities seen yet.  Write out any columns we may have */
-    if (!priv->seen_gconf_visibility)
+    if (!priv->seen_state_visibility)
     {
         columns = gtk_tree_view_get_columns(GTK_TREE_VIEW(view));
         g_list_foreach(columns, (GFunc)gnc_tree_view_update_visibility, view);
@@ -1185,14 +1183,14 @@
  *  @internal
  */
 static void
-gnc_tree_view_remove_gconf(GncTreeView *view)
+gnc_tree_view_remove_gconf_callbacks(GncTreeView *view)
 {
     GncTreeViewPrivate *priv;
     GtkTreeModel *model;
 
     ENTER(" ");
     priv = GNC_TREE_VIEW_GET_PRIVATE(view);
-    if (!priv->gconf_section)
+    if (!priv->state_section)
     {
         LEAVE("no gconf section");
         return;
@@ -1229,24 +1227,61 @@
     }
 
     DEBUG("removing gconf notification");
-    gnc_gconf_remove_notification(G_OBJECT(view), priv->gconf_section,
+    gnc_gconf_remove_notification(G_OBJECT(view), priv->state_section,
                                   GNC_TREE_VIEW_NAME);
-    g_free(priv->gconf_section);
-    priv->gconf_section = NULL;
+    g_free(priv->state_section);
+    priv->state_section = NULL;
     LEAVE(" ");
 }
 
+/** This function is called to completely wipe the treeview's state
+ *  information (column visibility, width, sorting order,..). This
+ *  information is currently saved in gconf, so the gconf section
+ *  associated to the tree view will be wiped. It will first disconnect
+ *  the tree view from the gconf section and then removes the gconf
+ *  section with keys from gconf.  This function may
+ *  be called at any time; either when the user wants to disconnect or
+ *  when the view object is being destroyed.
+ *
+ *  @param view The tree view.
+ */
+
+void gnc_tree_view_remove_state_information(GncTreeView *view)
+{
+    GncTreeViewPrivate *priv;
+    gchar *section = NULL;
+
+    ENTER(" ");
+    priv = GNC_TREE_VIEW_GET_PRIVATE(view);
+    if (!priv->state_section)
+    {
+        LEAVE("no state section");
+        return;
+    }
+
+    /* Make a copy of the section name, because
+     * the call to gnc_tree_view_remove_gconf_callbacks
+     * unsets it and we still need it to really remove
+     * the gconf section itself.
+     */
+    section = g_strdup (priv->state_section);
+    gnc_tree_view_remove_gconf_callbacks (view);
+    gnc_gconf_unset_dir (section, NULL);
+    g_free (section);
+    LEAVE(" ");
+}
+
 /** This function is called to set up or remove an association between
- *  a gconf section and the display of a view.  It will first remove
+ *  a saved state section and the display of a view.  It will first remove
  *  any existing association, and then install the new one.  This
- *  involves storing the gconf section value, requesting notification
+ *  involves storing the state section value, requesting notification
  *  from gconf of any changes to keys in that section, then attaching
  *  several signals to catch user changes to the view.
  *
  *  Parameters are defined in gnc-tree-view.h
  */
 void
-gnc_tree_view_set_gconf_section (GncTreeView *view,
+gnc_tree_view_set_state_section (GncTreeView *view,
                                  const gchar *section)
 {
     GncTreeViewPrivate *priv;
@@ -1256,7 +1291,7 @@
     g_return_if_fail(GNC_IS_TREE_VIEW(view));
 
     ENTER("view %p, section %s", view, section);
-    gnc_tree_view_remove_gconf(view);
+    gnc_tree_view_remove_gconf_callbacks(view);
 
     if (!section)
     {
@@ -1266,7 +1301,7 @@
 
     /* Catch changes in gconf. Propagate to view. */
     priv = GNC_TREE_VIEW_GET_PRIVATE(view);
-    priv->gconf_section = g_strdup(section);
+    priv->state_section = g_strdup(section);
     gnc_gconf_add_notification(G_OBJECT(view), section,
                                gnc_tree_view_gconf_changed,
                                GNC_TREE_VIEW_NAME);
@@ -1299,20 +1334,20 @@
 
 /** This function is called to get the current association between a
  *  gconf section and the display of a view.  It returns the same
- *  value passed to gnc_tree_view_set_gconf_section(); i.e. a string
+ *  value passed to gnc_tree_view_set_state_section(); i.e. a string
  *  like "dialogs/edit_prices".
  *
  *  Parameters are defined in gnc-tree-view.h
  */
 const gchar *
-gnc_tree_view_get_gconf_section (GncTreeView *view)
+gnc_tree_view_get_state_section (GncTreeView *view)
 {
     GncTreeViewPrivate *priv;
 
     g_return_val_if_fail(GNC_IS_TREE_VIEW(view), NULL);
 
     priv = GNC_TREE_VIEW_GET_PRIVATE(view);
-    return(priv->gconf_section);
+    return(priv->state_section);
 }
 
 
@@ -1349,23 +1384,23 @@
 
     ENTER("checkmenuitem %p, view %p", checkmenuitem, view);
     priv = GNC_TREE_VIEW_GET_PRIVATE(view);
-    if (!priv->gconf_section)
+    if (!priv->state_section)
     {
-        LEAVE("no gconf section");
+        LEAVE("no state section");
         return;
     }
 
-    key = g_object_get_data(G_OBJECT(checkmenuitem), GCONF_KEY);
+    key = g_object_get_data(G_OBJECT(checkmenuitem), STATE_KEY);
     value = gtk_check_menu_item_get_active(checkmenuitem);
-    gnc_gconf_set_bool(priv->gconf_section, key, value, NULL);
-    LEAVE("set gconf section %s, key %s, visible %d",
-          priv->gconf_section, key, value);
+    gnc_gconf_set_bool(priv->state_section, key, value, NULL);
+    LEAVE("set state section %s, key %s, visible %d",
+          priv->state_section, key, value);
 }
 
 /** This function is called to create a single checkmenuitem in the
  *  column selection menu.  It is called once for each column in the
  *  view.  It creates a menu item for the corresponding column, and
- *  attaches to it a copy of the gconf key for this column's
+ *  attaches to it a copy of the state key for this column's
  *  visibility.  This makes the toggle callback function trivial.
  *
  *  This function will create the column selection menu if one doesn't
@@ -1388,9 +1423,9 @@
 
     // ENTER("view %p, column %p", view, column);
     priv = GNC_TREE_VIEW_GET_PRIVATE(view);
-    if (!priv->gconf_section)
+    if (!priv->state_section)
     {
-        // LEAVE("no gconf section");
+        // LEAVE("no state section");
         return;
     }
 
@@ -1427,8 +1462,8 @@
 		     (GCallback)gnc_tree_view_menu_item_toggled, view);
 
     /* Store data on the widget for callbacks */
-    key = g_strdup_printf("%s_%s", pref_name, GCONF_KEY_VISIBLE);
-    g_object_set_data_full(G_OBJECT(widget), GCONF_KEY, key, g_free);
+    key = g_strdup_printf("%s_%s", pref_name, STATE_KEY_VISIBLE);
+    g_object_set_data_full(G_OBJECT(widget), STATE_KEY, key, g_free);
     // LEAVE(" ");
 }
 
@@ -1436,7 +1471,7 @@
  *  first destroys any old column selection menu, then checks to see
  *  if a new menu should be built.  If so, it calls the
  *  gnc_tree_view_create_menu_item() for each column in the view.
- *  This function is invoked then either the "gconf-section" or the
+ *  This function is invoked when either the "state-section" or the
  *  "show-column-menu" property is changed on the view.
  *
  *  @param view Build a selection menu for this tree view.
@@ -1461,7 +1496,7 @@
         priv->column_menu = NULL;
     }
 
-    if (priv->show_column_menu && priv->gconf_section)
+    if (priv->show_column_menu && priv->state_section)
     {
         /* Show the menu popup button */
         if (priv->column_menu_column)
@@ -1479,14 +1514,14 @@
             gtk_tree_view_column_set_visible(priv->column_menu_column, FALSE);
     }
     LEAVE("menu: show %d, section %s", priv->show_column_menu,
-          priv->gconf_section ? priv->gconf_section : "(null)");
+          priv->state_section ? priv->state_section : "(null)");
 }
 
 /** This function is called to synchronize the checkbox on a menu item
- *  with the current gconf visibility value for the corresponding
+ *  with the current state visibility value for the corresponding
  *  column (which will be the visibility of the column if the rest of
  *  the code in this file is working correctly).  It simply takes the
- *  gconf key attached to the menu item, reads it, and sets the menu
+ *  state key attached to the menu item, reads it, and sets the menu
  *  item to the retrieved value.  It does take care to block signals
  *  from the menu item to prevent updating gconf (since the value was
  *  just read from gconf).
@@ -1509,14 +1544,14 @@
     g_return_if_fail(GNC_IS_TREE_VIEW(view));
 
     priv = GNC_TREE_VIEW_GET_PRIVATE(view);
-    key = g_object_get_data(G_OBJECT(checkmenuitem), GCONF_KEY);
+    key = g_object_get_data(G_OBJECT(checkmenuitem), STATE_KEY);
     if (g_object_get_data(G_OBJECT(checkmenuitem), ALWAYS_VISIBLE))
     {
         visible = TRUE;
     }
     else
     {
-        visible = gnc_gconf_get_bool(priv->gconf_section, key, NULL);
+        visible = gnc_gconf_get_bool(priv->state_section, key, NULL);
     }
 
     g_signal_handlers_block_by_func(checkmenuitem,
@@ -1528,7 +1563,7 @@
 
 /** This function when the user clicks on the button to show the
  *  column selection menu.  It first synchronize the checkboxes on all
- *  menu item with the gconf visibility values.  It then pops up the
+ *  menu item with the state visibility values.  It then pops up the
  *  menu for the user to choose from.
  *
  *  @param column The tree column containing the column selection
@@ -1677,7 +1712,7 @@
 
 /** This function is called to set the "show-column-menu" property on
  *  this view.  This function has no visible effect if the
- *  "gconf-section" property has not been set.
+ *  "state-section" property has not been set.
  *
  *  Parameters are defined in gnc-tree-view.h
  */
@@ -1746,7 +1781,7 @@
     gtk_tree_view_set_model (GTK_TREE_VIEW(view), model);
 
     /* Maybe add a new callback */
-    if (model && priv->gconf_section)
+    if (model && priv->state_section)
     {
         priv->sort_column_changed_cb_id =
             g_signal_connect(GTK_TREE_SORTABLE(model), "sort-column-changed",
@@ -1791,8 +1826,8 @@
     g_list_free(columns);
 
     priv = GNC_TREE_VIEW_GET_PRIVATE(view);
-    if (priv->gconf_section)
-        priv->seen_gconf_visibility = TRUE;
+    if (priv->state_section)
+        priv->seen_state_visibility = TRUE;
 
     /* If only the first column is visible, hide the spacer and make that
      * column expand. */
@@ -1816,7 +1851,7 @@
  *  @param pref_name The internal name of this column.  This name is
  *  used in several functions to look up the column, and it is also
  *  used to create the keys used to record the column width and
- *  visibility in gconf.
+ *  visibility in saved state.
  *
  *  @param data_column The index of the GtkTreeModel data column used
  *  to determine the data that will be displayed in this column for
@@ -1824,7 +1859,7 @@
  *  plan on using an non-model data source for this column.
  *
  *  @param default_width The width this column should be if not
- *  specified by gconf.  If the this value is zero, the column will
+ *  specified by saved state.  If the this value is zero, the column will
  *  be marked as automatically sized.
  *
  *  @param resizable Whether to mark the column as user resizable.
@@ -1879,10 +1914,10 @@
     else
     {
         priv = GNC_TREE_VIEW_GET_PRIVATE(view);
-        if (priv->gconf_section)
+        if (priv->state_section)
         {
-            key = g_strdup_printf("%s_%s", pref_name, GCONF_KEY_WIDTH);
-            width = gnc_gconf_get_int(priv->gconf_section, key, NULL);
+            key = g_strdup_printf("%s_%s", pref_name, STATE_KEY_WIDTH);
+            width = gnc_gconf_get_int(priv->state_section, key, NULL);
             g_free(key);
         }
 
@@ -1939,7 +1974,7 @@
  *  It takes all the parameters necessary to hook a GtkTreeModel
  *  column to a GtkTreeViewColumn.  It handles creating a tooltip to
  *  show the full title name, and setting the sort and edit callback
- *  functions.  If the tree has a gconf section associated with it,
+ *  functions.  If the tree has a state section associated with it,
  *  this function also wires up the column so that its visibility and
  *  width are remembered.
  *
@@ -1992,7 +2027,7 @@
 
 /** This function adds a new text column to a GncTreeView base view.
  *  It takes all the parameters necessary to hook a GtkTreeModel
- *  column to a GtkTreeViewColumn.  If the tree has a gconf section
+ *  column to a GtkTreeViewColumn.  If the tree has a state section
  *  associated with it, this function also wires up the column so that
  *  its visibility and width are remembered.
  *
@@ -2059,7 +2094,7 @@
 
 /** This function adds a new date column to a GncTreeView base view.
  *  It takes all the parameters necessary to hook a GtkTreeModel
- *  column to a GtkTreeViewColumn.  If the tree has a gconf section
+ *  column to a GtkTreeViewColumn.  If the tree has a state section
  *  associated with it, this function also wires up the column so that
  *  its visibility and width are remembered.
  *
@@ -2201,7 +2236,7 @@
 /** This function adds a new numeric column to a GncTreeView base
  *  view.  It takes all the parameters necessary to hook a
  *  GtkTreeModel column to a GtkTreeViewColumn.  If the tree has a
- *  gconf section associated with it, this function also wires up the
+ *  state section associated with it, this function also wires up the
  *  column so that its visibility and width are remembered.  A numeric
  *  column is nothing more then a text column with a few extra
  *  attributes.

Modified: gnucash/trunk/src/gnome-utils/gnc-tree-view.h
===================================================================
--- gnucash/trunk/src/gnome-utils/gnc-tree-view.h	2013-10-07 14:25:39 UTC (rev 23257)
+++ gnucash/trunk/src/gnome-utils/gnc-tree-view.h	2013-10-07 14:26:11 UTC (rev 23258)
@@ -368,12 +368,12 @@
  *  everything after "/apps/gnucash".  I.E. "dialogs/edit_prices".
  *  Use NULL to disconnect a gconf association.
  */
-void gnc_tree_view_set_gconf_section (GncTreeView *view,
+void gnc_tree_view_set_state_section (GncTreeView *view,
                                       const gchar *section);
 
 /** This function is called to get the current association between a
  *  gconf section and the display of a view.  It returns the same
- *  value passed to gnc_tree_view_set_gconf_section(); i.e. a string
+ *  value passed to gnc_tree_view_set_state_section(); i.e. a string
  *  like "dialogs/edit_prices".
  *
  *  @param view The tree view.
@@ -381,8 +381,22 @@
  *  @return The current gconf section.  This is everything after
  *  "/apps/gnucash".  I.E "dialogs/edit_prices".
  */
-const gchar *gnc_tree_view_get_gconf_section (GncTreeView *view);
+const gchar *gnc_tree_view_get_state_section (GncTreeView *view);
 
+
+/** This function is called to completely wipe the treeview's state
+ *  information (column visibility, width, sorting order,..). This
+ *  information is currently saved in gconf, so the gconf section
+ *  associated to the tree view will be wiped. It will first disconnect
+ *  the tree view from the gconf section and then removes the gconf
+ *  section with keys from gconf.  This function may
+ *  be called at any time; either when the user wants to disconnect or
+ *  when the view object is being destroyed.
+ *
+ *  @param view The tree view.
+ */
+void gnc_tree_view_remove_state_information(GncTreeView *view);
+
 /** This function set the columns that will be allocated the free space
  *  in the view.
  *
@@ -419,7 +433,7 @@
 
 /** This function is called to set the "show-column-menu" property on
  *  this view.  This function has no visible effect if the
- *  "gconf-section" property has not been set.
+ *  "state-section" property has not been set.
  *
  *  @param view The tree view.
  *

Modified: gnucash/trunk/src/import-export/import-account-matcher.c
===================================================================
--- gnucash/trunk/src/import-export/import-account-matcher.c	2013-10-07 14:25:39 UTC (rev 23257)
+++ gnucash/trunk/src/import-export/import-account-matcher.c	2013-10-07 14:26:11 UTC (rev 23258)
@@ -45,7 +45,7 @@
 
 static QofLogModule log_module = GNC_MOD_IMPORT;
 
-#define GCONF_SECTION "dialogs/import/generic_matcher/account_matcher"
+#define STATE_SECTION "dialogs/import/generic_matcher/account_matcher"
 
 /*-******************************************************************\
  * Functions needed by gnc_import_select_account
@@ -124,7 +124,7 @@
     /* Configure the columns */
     gnc_tree_view_configure_columns (GNC_TREE_VIEW(picker->account_tree));
     g_object_set(account_tree,
-                 "gconf-section", GCONF_SECTION,
+                 "state-section", STATE_SECTION,
                  "show-column-menu", TRUE,
                  (gchar*) NULL);
 }



More information about the gnucash-changes mailing list