Remove state saving/restoring code from new and old register code

This is similar to what the previous commit did for GncTreeView
and means column widths, column's visibility and register sort order
are currently no longer saved or restored for any register.

This is done because the state code relies heavily on gconf
and unfortunately can't be mapped to gsettings in its present
form. State save/restore  will be added again later, once
the gconf conversion is complete.

git-svn-id: svn+ssh://svn.gnucash.org/repo/gnucash/trunk@23262 57a11ea4-9604-0410-9ed3-97b8803252fd
This commit is contained in:
Geert Janssens 2013-10-07 14:28:01 +00:00
parent 6e42833321
commit ccdd93b25b
7 changed files with 27 additions and 39 deletions

View File

@ -33,7 +33,6 @@
#include "gnc-tree-model-split-reg.h" #include "gnc-tree-model-split-reg.h"
#include "gnc-component-manager.h" #include "gnc-component-manager.h"
#include "gnc-commodity.h" #include "gnc-commodity.h"
#include "gnc-gconf-utils.h"
#include "gnc-prefs.h" #include "gnc-prefs.h"
#include "gnc-engine.h" #include "gnc-engine.h"
#include "gnc-event.h" #include "gnc-event.h"
@ -1020,22 +1019,25 @@ gnc_tree_model_split_reg_default_query (GncTreeModelSplitReg *model, Account *de
state_key = g_strconcat (STATE_SECTION_PREFIX, (gchar*)guid_to_string (guid), NULL); state_key = g_strconcat (STATE_SECTION_PREFIX, (gchar*)guid_to_string (guid), NULL);
/* Restore the sort column from gconf */ /* Restore the sort column from saved state */
col = gnc_gconf_get_int (state_key, "sort_col", NULL); // FIXME currently not implemented
col = 0;
if (col == 0) if (col == 0)
model->sort_col = 1; model->sort_col = 1;
else else
model->sort_col = col; model->sort_col = col;
/* Restore the sort depth from gconf */ /* Restore the sort depth from saved state */
depth = gnc_gconf_get_int (state_key, "sort_depth", NULL); // FIXME currently not implemented
depth = 0;
if (depth == 0) if (depth == 0)
model->sort_depth = 1; model->sort_depth = 1;
else else
model->sort_depth = depth; model->sort_depth = depth;
/* Restore the sort order from gconf */ /* Restore the sort order from saved state */
sort_string = gnc_gconf_get_string (state_key, "sort_order", NULL); // FIXME currently not implemented
sort_string = NULL;
if (g_strcmp0 ("descending", sort_string) == 0) if (g_strcmp0 ("descending", sort_string) == 0)
model->sort_direction = -1; model->sort_direction = -1;
else else

View File

@ -19,7 +19,6 @@ libgnc_gnome_la_LIBADD = \
${LIBXML2_LIBS} \ ${LIBXML2_LIBS} \
${GUILE_LIBS} \ ${GUILE_LIBS} \
${GTK_LIBS} \ ${GTK_LIBS} \
${GCONF_LIBS} \
${GLIB_LIBS} \ ${GLIB_LIBS} \
${QOF_LIBS} ${QOF_LIBS}
@ -144,7 +143,6 @@ AM_CPPFLAGS = \
${LIBXML2_CFLAGS} \ ${LIBXML2_CFLAGS} \
${GUILE_INCS} \ ${GUILE_INCS} \
${GTK_CFLAGS} \ ${GTK_CFLAGS} \
${GCONF_CFLAGS} \
$(GLIB_CFLAGS) \ $(GLIB_CFLAGS) \
${GTK_MAC_CFLAGS} ${GTK_MAC_CFLAGS}

View File

@ -686,13 +686,13 @@ gnc_split_reg_ld_destroy( GNCLedgerDisplay *ledger )
{ {
GNCSplitReg *gsr = gnc_ledger_display_get_user_data( ledger ); GNCSplitReg *gsr = gnc_ledger_display_get_user_data( ledger );
gchar *prefs_key; gchar *state_key;
const GncGUID * guid; const GncGUID * guid;
Account * account; Account * account;
account = gnc_ledger_display_leader(ledger); account = gnc_ledger_display_leader(ledger);
guid = xaccAccountGetGUID(account); guid = xaccAccountGetGUID(account);
prefs_key = (gchar*)guid_to_string (guid); state_key = (gchar*)guid_to_string (guid);
if (gsr) if (gsr)
@ -702,7 +702,7 @@ gnc_split_reg_ld_destroy( GNCLedgerDisplay *ledger )
reg = gnc_ledger_display_get_split_register (ledger); reg = gnc_ledger_display_get_split_register (ledger);
if (reg && reg->table) if (reg && reg->table)
gnc_table_save_state (reg->table, prefs_key); gnc_table_save_state (reg->table, state_key);
/* /*
* Don't destroy the window here any more. The register no longer * Don't destroy the window here any more. The register no longer

View File

@ -37,7 +37,6 @@
#include "gnc-ledger-display2.h" #include "gnc-ledger-display2.h"
#include "gnc-euro.h" #include "gnc-euro.h"
#include "gnc-gconf-utils.h"
#include "gnome-utils/gnc-warnings.h" #include "gnome-utils/gnc-warnings.h"
#include "dialog-utils.h" #include "dialog-utils.h"
@ -291,11 +290,11 @@ gsr2_create_table (GNCSplitReg2 *gsr)
gnc_ledger_display2_set_split_view_register (gsr->ledger, view); gnc_ledger_display2_set_split_view_register (gsr->ledger, view);
/* Restore the sort depth from gconf */ /* Restore the sort depth from saved state */
view->sort_depth = gnc_gconf_get_int (state_key, "sort_depth", NULL); /* Restore the sort order from saved state */
// FIXME currently not implemented
/* Restore the sort order from gconf */ sort_string = NULL;
sort_string = gnc_gconf_get_string (state_key, "sort_order", NULL);
if (g_strcmp0 ("descending", sort_string) == 0) if (g_strcmp0 ("descending", sort_string) == 0)
view->sort_direction = -1; view->sort_direction = -1;
else else
@ -820,10 +819,9 @@ gnc_split_reg2_sort_changed_cb (GtkTreeSortable *sortable, gpointer user_data)
model->sort_direction = 1; model->sort_direction = 1;
} }
/* Save the sort depth to gconf */ /* Save the sort depth state */
state_section = gnc_tree_view_get_state_section (GNC_TREE_VIEW (view)); state_section = gnc_tree_view_get_state_section (GNC_TREE_VIEW (view));
gnc_gconf_set_int (state_section, "sort_depth", view->sort_depth, NULL); // FIXME currently not implemented
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); LEAVE("v_sort_col %d, v_sort_direction is %d v_sort_depth is %d", view->sort_col, view->sort_direction, view->sort_depth);

View File

@ -166,7 +166,7 @@ Table * gnc_table_new (TableLayout *layout,
TableControl *control); TableControl *control);
void gnc_virtual_location_init (VirtualLocation *vloc); void gnc_virtual_location_init (VirtualLocation *vloc);
void gnc_table_save_state (Table *table, gchar *gconf_key); void gnc_table_save_state (Table *table, gchar *state_key);
void gnc_table_destroy (Table *table); void gnc_table_destroy (Table *table);
@ -303,7 +303,7 @@ gboolean gnc_table_find_close_valid_cell (Table *table,
/** UI-specific functions *******************************/ /** UI-specific functions *******************************/
/* Initialize the GUI from a table */ /* Initialize the GUI from a table */
void gnc_table_init_gui (GtkWidget *widget, gchar * gconf_key); void gnc_table_init_gui (GtkWidget *widget, gchar * state_key);
void gnc_table_realize_gui (Table *table); void gnc_table_realize_gui (Table *table);

View File

@ -13,7 +13,6 @@ libgncmod_register_gnome_la_LIBADD = \
${top_builddir}/src/gnome-utils/libgncmod-gnome-utils.la \ ${top_builddir}/src/gnome-utils/libgncmod-gnome-utils.la \
${top_builddir}/src/libqof/qof/libgnc-qof.la \ ${top_builddir}/src/libqof/qof/libgnc-qof.la \
${GLIB_LIBS} \ ${GLIB_LIBS} \
${GCONF_LIBS} \
${GNOMECANVAS_LIBS} ${GNOMECANVAS_LIBS}
libgncmod_register_gnome_la_SOURCES = \ libgncmod_register_gnome_la_SOURCES = \
@ -63,7 +62,6 @@ AM_CPPFLAGS = \
-I${top_srcdir}/src/register/register-core \ -I${top_srcdir}/src/register/register-core \
-I${top_srcdir}/src/libqof/qof \ -I${top_srcdir}/src/libqof/qof \
${GLIB_CFLAGS} \ ${GLIB_CFLAGS} \
${GCONF_CFLAGS} \
${GTK_XIM_FLAGS} \ ${GTK_XIM_FLAGS} \
${GNOMECANVAS_CFLAGS} ${GNOMECANVAS_CFLAGS}

View File

@ -48,13 +48,11 @@
#include "gnucash-style.h" #include "gnucash-style.h"
#include "table-allgui.h" #include "table-allgui.h"
#include "table-gnome.h" #include "table-gnome.h"
#include "gnc-gconf-utils.h"
#include "gnc-prefs.h" #include "gnc-prefs.h"
#include "gnc-engine.h" #include "gnc-engine.h"
#include "gnc-ledger-display.h" #include "gnc-ledger-display.h"
#define GCONF_SECTION "window/pages/register"
/** Static Globals *****************************************************/ /** Static Globals *****************************************************/
@ -66,24 +64,20 @@ static QofLogModule log_module = GNC_MOD_REGISTER;
/** Implementation *****************************************************/ /** Implementation *****************************************************/
void void
gnc_table_save_state (Table *table, gchar * gconf_key) gnc_table_save_state (Table *table, gchar * state_key)
{ {
GnucashSheet *sheet; GnucashSheet *sheet;
GNCHeaderWidths widths; GNCHeaderWidths widths;
GList *node; GList *node;
gchar *key; gchar *key;
gchar * gconf_section = NULL;
if(gconf_key != NULL)gconf_section = g_strjoin(NULL,GCONF_SECTION, "/", gconf_key,NULL);
PINFO("gconf_key=%s",gconf_key );
if (!table) if (!table)
return; return;
if (table->ui_data == NULL) if (table->ui_data == NULL)
return; return;
if (gnc_prefs_get_bool(GNC_PREFS_GROUP_GENERAL, GNC_PREF_SAVE_GEOMETRY)) if (!gnc_prefs_get_bool(GNC_PREFS_GROUP_GENERAL, GNC_PREF_SAVE_GEOMETRY))
return; return;
sheet = GNUCASH_SHEET (table->ui_data); sheet = GNUCASH_SHEET (table->ui_data);
@ -107,7 +101,7 @@ gnc_table_save_state (Table *table, gchar * gconf_key)
/* Remember whether the column is visible */ /* Remember whether the column is visible */
key = g_strdup_printf("%s_width", cell->cell_name); key = g_strdup_printf("%s_width", cell->cell_name);
gnc_gconf_set_int( gconf_section, key, width, NULL); // FIXME the actual state saving is currently not implemented
g_free(key); g_free(key);
} }
@ -158,7 +152,7 @@ table_destroy_cb (Table *table)
to pass NULL as second parameter. */ to pass NULL as second parameter. */
void void
gnc_table_init_gui (GtkWidget *widget, gchar * gconf_key) gnc_table_init_gui (GtkWidget *widget, gchar * state_key)
{ {
GNCHeaderWidths widths; GNCHeaderWidths widths;
GnucashSheet *sheet; GnucashSheet *sheet;
@ -169,13 +163,10 @@ gnc_table_init_gui (GtkWidget *widget, gchar * gconf_key)
guint value; guint value;
// Stuff for per-register settings load. // Stuff for per-register settings load.
gchar * gconf_section = NULL;
if(gconf_key != NULL) gconf_section =g_strjoin(NULL,GCONF_SECTION, "/", gconf_key,NULL);
g_return_if_fail (widget != NULL); g_return_if_fail (widget != NULL);
g_return_if_fail (GNUCASH_IS_REGISTER (widget)); g_return_if_fail (GNUCASH_IS_REGISTER (widget));
PINFO("gconf_key=%s",gconf_key); PINFO("state_key=%s",state_key);
ENTER("widget=%p, data=%p", widget, ""); ENTER("widget=%p, data=%p", widget, "");
@ -206,7 +197,8 @@ gnc_table_init_gui (GtkWidget *widget, gchar * gconf_key)
/* Remember whether the column is visible */ /* Remember whether the column is visible */
key = g_strdup_printf("%s_width", cell->cell_name); key = g_strdup_printf("%s_width", cell->cell_name);
value = gnc_gconf_get_int(gconf_section, key, NULL); // FIXME the actual state loading is currently not implemented
value = 0;
if (value != 0) if (value != 0)
gnc_header_widths_set_width (widths, cell->cell_name, value); gnc_header_widths_set_width (widths, cell->cell_name, value);
g_free(key); g_free(key);