evolution r35954 - in trunk: mail widgets/table
- From: mcrha svn gnome org
- To: svn-commits-list gnome org
- Subject: evolution r35954 - in trunk: mail widgets/table
- Date: Mon, 11 Aug 2008 10:08:14 +0000 (UTC)
Author: mcrha
Date: Mon Aug 11 10:08:14 2008
New Revision: 35954
URL: http://svn.gnome.org/viewvc/evolution?rev=35954&view=rev
Log:
2008-08-11 Milan Crha <mcrha redhat com>
** Fix for bug #519292
* mail/message-list.c: (load_tree_expand_all): Drop function.
* mail/message-list.c: (regen_list_done): Rather use desired expanded state
value when creating the tree instead of the default model's value for
this to have 'expand/collapse all' commands work better and quicker.
* widgets/tablee-tree.h: (e_tree_load_all_expanded_state):
* widgets/tablee-tree.c: (e_tree_load_all_expanded_state):
* widgets/tablee-tree-table-adapter.h:
(e_tree_table_adapter_load_all_expanded_state):
* widgets/tablee-tree-table-adapter.c:
(e_tree_table_adapter_load_all_expanded_state),
(set_expanded_state_func), (set_collapsed_state_func):
Drop functions in favor of new functions.
* widgets/tablee-tree.h: (e_tree_force_expanded_state):
* widgets/tablee-tree.c: (e_tree_force_expanded_state):
* widgets/tablee-tree-table-adapter.h: (e_tree_table_adapter_force_expanded_state):
* widgets/tablee-tree-table-adapter.c: (e_tree_table_adapter_force_expanded_state),
(struct ETreeTableAdapterPriv), (create_gnode), (etta_init):
Use either default value of the model to expanded state of new node or
use the one which has been set (forced) by new functions.
Modified:
trunk/mail/ChangeLog
trunk/mail/message-list.c
trunk/widgets/table/ChangeLog
trunk/widgets/table/e-tree-table-adapter.c
trunk/widgets/table/e-tree-table-adapter.h
trunk/widgets/table/e-tree.c
trunk/widgets/table/e-tree.h
Modified: trunk/mail/message-list.c
==============================================================================
--- trunk/mail/message-list.c (original)
+++ trunk/mail/message-list.c Mon Aug 11 10:08:14 2008
@@ -1804,16 +1804,6 @@
}
static void
-load_tree_expand_all (MessageList *ml, gboolean state)
-{
-
- if (ml->folder == NULL || ml->tree == NULL)
- return;
-
- e_tree_load_all_expanded_state (ml->tree, state);
- save_tree_state (ml);
-}
-static void
load_tree_state (MessageList *ml, xmlDoc *expand_state)
{
if (ml->folder == NULL || ml->tree == NULL)
@@ -4147,6 +4137,8 @@
e_profile_event_emit("list.buildtree", m->folder->full_name, 0);
if (m->dotree) {
+ gboolean forcing_expand_state = m->ml->expand_all || m->ml->collapse_all;
+
if (m->ml->just_set_folder) {
m->ml->just_set_folder = FALSE;
if (m->expand_state) {
@@ -4156,17 +4148,21 @@
}
}
+ if (forcing_expand_state)
+ e_tree_force_expanded_state (m->ml->tree, m->ml->expand_all ? 1 : -1);
+
build_tree (m->ml, m->tree, m->changes);
if (m->ml->thread_tree)
camel_folder_thread_messages_unref(m->ml->thread_tree);
m->ml->thread_tree = m->tree;
m->tree = NULL;
- if (m->ml->expand_all)
- load_tree_expand_all (m->ml, TRUE);
- else if (m->ml->collapse_all)
- load_tree_expand_all (m->ml, FALSE);
- else
+ if (forcing_expand_state) {
+ if (m->ml->folder != NULL && m->ml->tree != NULL)
+ save_tree_state (m->ml);
+ /* do not forget to set this back to use the default value... */
+ e_tree_force_expanded_state (m->ml->tree, 0);
+ } else
load_tree_state (m->ml, m->expand_state);
m->ml->expand_all = 0;
Modified: trunk/widgets/table/e-tree-table-adapter.c
==============================================================================
--- trunk/widgets/table/e-tree-table-adapter.c (original)
+++ trunk/widgets/table/e-tree-table-adapter.c Mon Aug 11 10:08:14 2008
@@ -82,6 +82,8 @@
int sort_info_changed_id;
guint resort_idle_id;
+
+ int force_expanded_state; /* use this instead of model's default if not 0; <0 ... collapse, >0 ... expand */
};
static void etta_sort_info_changed (ETableSortInfo *sort_info, ETreeTableAdapter *etta);
@@ -322,7 +324,7 @@
node = g_new0(node_t, 1);
node->path = path;
node->index = -1;
- node->expanded = e_tree_model_get_expanded_default(etta->priv->source);
+ node->expanded = etta->priv->force_expanded_state == 0 ? e_tree_model_get_expanded_default (etta->priv->source) : etta->priv->force_expanded_state > 0;
node->expandable = e_tree_model_node_is_expandable(etta->priv->source, path);
node->expandable_set = 1;
node->num_visible_children = 0;
@@ -737,6 +739,7 @@
etta->priv->node_request_collapse_id = 0;
etta->priv->resort_idle_id = 0;
+ etta->priv->force_expanded_state = 0;
}
static void
@@ -996,42 +999,13 @@
return doc;
}
-static void
-set_expanded_state_func (gpointer keyp, gpointer value, gpointer data)
-{
- ETreePath path = keyp;
- node_t *node = ((GNode *)value)->data;
- ETreeTableAdapter *etta = (ETreeTableAdapter *) data;
-
- if (node->expanded != TRUE) {
- e_tree_table_adapter_node_set_expanded_recurse (etta, path, TRUE);
- node->expanded = TRUE;
- }
-}
-
-static void
-set_collapsed_state_func (gpointer keyp, gpointer value, gpointer data)
-{
- ETreePath path = keyp;
- node_t *node = ((GNode *)value)->data;
- ETreeTableAdapter *etta = (ETreeTableAdapter *) data;
-
- if (node->expanded != FALSE) {
- e_tree_table_adapter_node_set_expanded_recurse (etta, path, FALSE);
- node->expanded = FALSE;
- }
-}
-
+/* state: <0 ... collapse; 0 ... use default; >0 ... expand */
void
-e_tree_table_adapter_load_all_expanded_state (ETreeTableAdapter *etta, gboolean state)
+e_tree_table_adapter_force_expanded_state (ETreeTableAdapter *etta, int state)
{
+ g_return_if_fail (etta != NULL);
- g_return_if_fail(etta != NULL);
-
- if (state)
- g_hash_table_foreach (etta->priv->nodes, set_expanded_state_func, etta);
- else
- g_hash_table_foreach (etta->priv->nodes, set_collapsed_state_func, etta);
+ etta->priv->force_expanded_state = state;
}
void
Modified: trunk/widgets/table/e-tree-table-adapter.h
==============================================================================
--- trunk/widgets/table/e-tree-table-adapter.h (original)
+++ trunk/widgets/table/e-tree-table-adapter.h Mon Aug 11 10:08:14 2008
@@ -72,8 +72,8 @@
void e_tree_table_adapter_node_set_expanded_recurse (ETreeTableAdapter *etta,
ETreePath path,
gboolean expanded);
-void e_tree_table_adapter_load_all_expanded_state (ETreeTableAdapter *etta,
- gboolean state);
+void e_tree_table_adapter_force_expanded_state (ETreeTableAdapter *etta,
+ int state);
void e_tree_table_adapter_root_node_set_visible (ETreeTableAdapter *etta,
gboolean visible);
ETreePath e_tree_table_adapter_node_at_row (ETreeTableAdapter *etta,
Modified: trunk/widgets/table/e-tree.c
==============================================================================
--- trunk/widgets/table/e-tree.c (original)
+++ trunk/widgets/table/e-tree.c Mon Aug 11 10:08:14 2008
@@ -2088,10 +2088,13 @@
e_tree_table_adapter_load_expanded_state_xml (et->priv->etta, doc);
}
+/* state: <0 ... collapse; 0 ... no force - use default; >0 ... expand;
+ when using this, be sure to reset to 0 once no forcing is required
+ anymore, aka the build of the tree is done */
void
-e_tree_load_all_expanded_state (ETree *et, gboolean state)
+e_tree_force_expanded_state (ETree *et, int state)
{
- e_tree_table_adapter_load_all_expanded_state (et->priv->etta, state);
+ e_tree_table_adapter_force_expanded_state (et->priv->etta, state);
}
gint
Modified: trunk/widgets/table/e-tree.h
==============================================================================
--- trunk/widgets/table/e-tree.h (original)
+++ trunk/widgets/table/e-tree.h Mon Aug 11 10:08:14 2008
@@ -292,7 +292,7 @@
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);
+void e_tree_force_expanded_state (ETree *et, int state);
typedef enum {
E_TREE_FIND_NEXT_BACKWARD = 0,
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]