diff options
author | Milan Crha <mcrha@redhat.com> | 2008-08-11 17:48:17 +0800 |
---|---|---|
committer | Milan Crha <mcrha@src.gnome.org> | 2008-08-11 17:48:17 +0800 |
commit | c29e1c65703bc651f786130024da2efcedcf607d (patch) | |
tree | 4609e99044300bf5c11f9c471a5602f8da1efb93 /widgets/table/e-tree-table-adapter.c | |
parent | 3608dcb62d99c6aa894a73f2a22f2aacf1299c58 (diff) | |
download | gsoc2013-evolution-c29e1c65703bc651f786130024da2efcedcf607d.tar.gz gsoc2013-evolution-c29e1c65703bc651f786130024da2efcedcf607d.tar.zst gsoc2013-evolution-c29e1c65703bc651f786130024da2efcedcf607d.zip |
** Fix for bug #352695
2008-08-11 Milan Crha <mcrha@redhat.com>
** Fix for bug #352695
* widgets/table/e-tree-table-adapter.h:
(e_tree_table_adapter_save_expanded_state_xml),
(e_tree_table_adapter_load_expanded_state_xml):
* widgets/table/e-tree-table-adapter.c:
(e_tree_table_adapter_save_expanded_state_xml),
(e_tree_table_adapter_save_expanded_state),
(e_tree_table_adapter_load_expanded_state_xml),
(e_tree_table_adapter_load_expanded_state):
* widgets/table/e-tree.h: (e_tree_save_expanded_state_xml),
(e_tree_load_expanded_state_xml):
* widgets/table/e-tree.c: (e_tree_save_expanded_state_xml),
(e_tree_load_expanded_state_xml):
Be able to store expanded state also in memory, not only on the disk.
* mail/message-list.c: (struct _MessageListPrivate), (save_tree_state),
(load_tree_state), (on_model_row_changed), (message_list_init),
(message_list_construct), (struct _regen_list_msg), (regen_list_done),
(regen_list_free), (mail_regen_list): Be able to recognize whether
there has been any change on any row in a list and save expanded
state only in case there was any change. Also use in-memory storing
of the expanded state in case we do not want to rewrite full view
It's for searches only, and it's not stored between sessions.
svn path=/trunk/; revision=35953
Diffstat (limited to 'widgets/table/e-tree-table-adapter.c')
-rw-r--r-- | widgets/table/e-tree-table-adapter.c | 47 |
1 files changed, 35 insertions, 12 deletions
diff --git a/widgets/table/e-tree-table-adapter.c b/widgets/table/e-tree-table-adapter.c index 579b231bb3..b5567a0b95 100644 --- a/widgets/table/e-tree-table-adapter.c +++ b/widgets/table/e-tree-table-adapter.c @@ -912,14 +912,14 @@ save_expanded_state_func (gpointer keyp, gpointer value, gpointer data) } } -void -e_tree_table_adapter_save_expanded_state (ETreeTableAdapter *etta, const char *filename) +xmlDoc * +e_tree_table_adapter_save_expanded_state_xml (ETreeTableAdapter *etta) { TreeAndRoot tar; xmlDocPtr doc; xmlNode *root; - g_return_if_fail(etta != NULL); + g_return_val_if_fail (etta != NULL, NULL); doc = xmlNewDoc ((const unsigned char *)"1.0"); root = xmlNewDocNode (doc, NULL, (const unsigned char *)"expanded_state", NULL); @@ -934,8 +934,21 @@ e_tree_table_adapter_save_expanded_state (ETreeTableAdapter *etta, const char *f g_hash_table_foreach (etta->priv->nodes, save_expanded_state_func, &tar); - e_xml_save_file (filename, doc); - xmlFreeDoc (doc); + return doc; +} + +void +e_tree_table_adapter_save_expanded_state (ETreeTableAdapter *etta, const char *filename) +{ + xmlDoc *doc; + + g_return_if_fail (etta != NULL); + + doc = e_tree_table_adapter_save_expanded_state_xml (etta); + if (doc) { + e_xml_save_file (filename, doc); + xmlFreeDoc (doc); + } } static xmlDoc * @@ -1022,18 +1035,14 @@ e_tree_table_adapter_load_all_expanded_state (ETreeTableAdapter *etta, gboolean } void -e_tree_table_adapter_load_expanded_state (ETreeTableAdapter *etta, const char *filename) +e_tree_table_adapter_load_expanded_state_xml (ETreeTableAdapter *etta, xmlDoc *doc) { - xmlDoc *doc; xmlNode *root, *child; gboolean model_default; gboolean file_default = FALSE; - g_return_if_fail(etta != NULL); - - doc = open_file(etta, filename); - if (!doc) - return; + g_return_if_fail (etta != NULL); + g_return_if_fail (doc != NULL); root = xmlDocGetRootElement (doc); @@ -1083,6 +1092,20 @@ e_tree_table_adapter_load_expanded_state (ETreeTableAdapter *etta, const char *f g_free (id); } +} + +void +e_tree_table_adapter_load_expanded_state (ETreeTableAdapter *etta, const char *filename) +{ + xmlDoc *doc; + + g_return_if_fail(etta != NULL); + + doc = open_file(etta, filename); + if (!doc) + return; + + e_tree_table_adapter_load_expanded_state_xml (etta, doc); xmlFreeDoc (doc); |