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 | |
parent | 3608dcb62d99c6aa894a73f2a22f2aacf1299c58 (diff) | |
download | gsoc2013-evolution-c29e1c65703bc651f786130024da2efcedcf607d.tar gsoc2013-evolution-c29e1c65703bc651f786130024da2efcedcf607d.tar.gz gsoc2013-evolution-c29e1c65703bc651f786130024da2efcedcf607d.tar.bz2 gsoc2013-evolution-c29e1c65703bc651f786130024da2efcedcf607d.tar.lz gsoc2013-evolution-c29e1c65703bc651f786130024da2efcedcf607d.tar.xz 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')
-rw-r--r-- | widgets/table/ChangeLog | 18 | ||||
-rw-r--r-- | widgets/table/e-tree-table-adapter.c | 47 | ||||
-rw-r--r-- | widgets/table/e-tree-table-adapter.h | 4 | ||||
-rw-r--r-- | widgets/table/e-tree.c | 19 | ||||
-rw-r--r-- | widgets/table/e-tree.h | 4 |
5 files changed, 80 insertions, 12 deletions
diff --git a/widgets/table/ChangeLog b/widgets/table/ChangeLog index d5fe462ccd..47bba15e2a 100644 --- a/widgets/table/ChangeLog +++ b/widgets/table/ChangeLog @@ -1,3 +1,21 @@ +2008-08-11 Milan Crha <mcrha@redhat.com> + + ** Part of fix for bug #352695 + + * e-tree-table-adapter.h: + (e_tree_table_adapter_save_expanded_state_xml), + (e_tree_table_adapter_load_expanded_state_xml): + * 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): + * e-tree.h: (e_tree_save_expanded_state_xml), + (e_tree_load_expanded_state_xml): + * 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. + 2008-07-15 Milan Crha <mcrha@redhat.com> ** Part of fix for bug #329821 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); diff --git a/widgets/table/e-tree-table-adapter.h b/widgets/table/e-tree-table-adapter.h index cd23ba06bb..e7fed9c2a7 100644 --- a/widgets/table/e-tree-table-adapter.h +++ b/widgets/table/e-tree-table-adapter.h @@ -30,6 +30,7 @@ #include <table/e-tree-model.h> #include <table/e-table-sort-info.h> #include <table/e-table-header.h> +#include <libxml/tree.h> G_BEGIN_DECLS @@ -89,6 +90,9 @@ void e_tree_table_adapter_save_expanded_state (ETreeTableAdapter void e_tree_table_adapter_load_expanded_state (ETreeTableAdapter *etta, const char *filename); +xmlDoc *e_tree_table_adapter_save_expanded_state_xml (ETreeTableAdapter *etta); +void e_tree_table_adapter_load_expanded_state_xml (ETreeTableAdapter *etta, xmlDoc *doc); + void e_tree_table_adapter_set_sort_info (ETreeTableAdapter *etta, ETableSortInfo *sort_info); diff --git a/widgets/table/e-tree.c b/widgets/table/e-tree.c index 8b685a724b..64f0bde2d1 100644 --- a/widgets/table/e-tree.c +++ b/widgets/table/e-tree.c @@ -2069,6 +2069,25 @@ e_tree_load_expanded_state (ETree *et, char *filename) e_tree_table_adapter_load_expanded_state (et->priv->etta, filename); } +xmlDoc * +e_tree_save_expanded_state_xml (ETree *et) +{ + g_return_val_if_fail (et != NULL, NULL); + g_return_val_if_fail (E_IS_TREE (et), NULL); + + return e_tree_table_adapter_save_expanded_state_xml (et->priv->etta); +} + +void +e_tree_load_expanded_state_xml (ETree *et, xmlDoc *doc) +{ + g_return_if_fail (et != NULL); + g_return_if_fail (E_IS_TREE (et)); + g_return_if_fail (doc != NULL); + + e_tree_table_adapter_load_expanded_state_xml (et->priv->etta, doc); +} + void e_tree_load_all_expanded_state (ETree *et, gboolean state) { diff --git a/widgets/table/e-tree.h b/widgets/table/e-tree.h index 6e736f1a0e..30bb0fdb40 100644 --- a/widgets/table/e-tree.h +++ b/widgets/table/e-tree.h @@ -286,6 +286,10 @@ void e_tree_save_expanded_state (ETree *et, char *filename); void e_tree_load_expanded_state (ETree *et, char *filename); + +xmlDoc *e_tree_save_expanded_state_xml (ETree *et); +void e_tree_load_expanded_state_xml (ETree *et, xmlDoc *doc); + int e_tree_row_count (ETree *et); GtkWidget *e_tree_get_tooltip (ETree *et); void e_tree_load_all_expanded_state (ETree *et, gboolean state); |