diff options
author | Dan Winship <danw@src.gnome.org> | 2002-05-10 04:00:56 +0800 |
---|---|---|
committer | Dan Winship <danw@src.gnome.org> | 2002-05-10 04:00:56 +0800 |
commit | de7a5090a8a3f7038ab9232b6b29ed61a51412c5 (patch) | |
tree | 37373b5f703b47529fcf7224cba95a01640a51ad | |
parent | 61ad53bfa902a1d48346457bb59461684f904e5e (diff) | |
download | gsoc2013-evolution-de7a5090a8a3f7038ab9232b6b29ed61a51412c5.tar.gz gsoc2013-evolution-de7a5090a8a3f7038ab9232b6b29ed61a51412c5.tar.zst gsoc2013-evolution-de7a5090a8a3f7038ab9232b6b29ed61a51412c5.zip |
Bump file version to 2. (This will make older versions of gal ignore the
* e-tree-table-adapter.c
(e_tree_table_adapter_save_expanded_state): Bump file version to 2.
(This will make older versions of gal ignore the file, fixing the
problem where going from evo HEAD to evo 1.0.x makes the folder
tree disappear.) Store the default expanded state in the file now
to prevent this from happening again in the future.
(e_tree_table_adapter_load_expanded_state): Deal with version 2.
If the model's default expansion state doesn't match the saved
state, ignore the save file.
svn path=/trunk/; revision=16736
-rw-r--r-- | widgets/table/e-tree-table-adapter.c | 16 |
1 files changed, 12 insertions, 4 deletions
diff --git a/widgets/table/e-tree-table-adapter.c b/widgets/table/e-tree-table-adapter.c index 3f66b6b46c..c88557ab86 100644 --- a/widgets/table/e-tree-table-adapter.c +++ b/widgets/table/e-tree-table-adapter.c @@ -927,7 +927,8 @@ e_tree_table_adapter_save_expanded_state (ETreeTableAdapter *etta, const char *f NULL); xmlDocSetRootElement (doc, root); - e_xml_set_integer_prop_by_name(root, "vers", 1); + e_xml_set_integer_prop_by_name (root, "vers", 2); + e_xml_set_bool_prop_by_name (root, "default", e_tree_model_get_expanded_default (priv->source)); tar.root = root; tar.tree = etta->priv->source; @@ -949,6 +950,7 @@ e_tree_table_adapter_load_expanded_state (ETreeTableAdapter *etta, const char *f xmlNode *root; xmlNode *child; int vers; + gboolean model_default, saved_default; g_return_if_fail(etta != NULL); @@ -964,8 +966,14 @@ e_tree_table_adapter_load_expanded_state (ETreeTableAdapter *etta, const char *f return; } - vers = e_xml_get_integer_prop_by_name_with_default(root, "vers", 0); - if (vers != 1) { + vers = e_xml_get_integer_prop_by_name_with_default (root, "vers", 0); + if (vers > 2) { + xmlFreeDoc (doc); + return; + } + model_default = e_tree_model_get_expanded_default (priv->source); + saved_default = e_xml_get_bool_prop_by_name_with_default (root, "default", !model_default); + if (saved_default != model_default) { xmlFreeDoc (doc); return; } @@ -985,7 +993,7 @@ e_tree_table_adapter_load_expanded_state (ETreeTableAdapter *etta, const char *f return; } - add_expanded_node(etta, id, !e_tree_model_get_expanded_default(etta->priv->source)); + add_expanded_node(etta, id, !model_default); } xmlFreeDoc (doc); |