diff options
author | Milan Crha <mcrha@redhat.com> | 2011-10-07 21:35:15 +0800 |
---|---|---|
committer | Milan Crha <mcrha@redhat.com> | 2011-10-07 21:35:15 +0800 |
commit | aa75990c13d0fb2aea2ced1f9f7bd7d1785bdffc (patch) | |
tree | 108bd4a88211f42abfdc495d3cf71433b5af8cb1 /widgets | |
parent | d2232a718dc86dda4182d154a7fdfe1d218229dc (diff) | |
download | gsoc2013-evolution-aa75990c13d0fb2aea2ced1f9f7bd7d1785bdffc.tar.gz gsoc2013-evolution-aa75990c13d0fb2aea2ced1f9f7bd7d1785bdffc.tar.zst gsoc2013-evolution-aa75990c13d0fb2aea2ced1f9f7bd7d1785bdffc.zip |
Bug #235665 - Heavy hard disk access when resizing columns in views
Diffstat (limited to 'widgets')
-rw-r--r-- | widgets/table/e-table-header-item.c | 10 | ||||
-rw-r--r-- | widgets/table/e-table.c | 33 | ||||
-rw-r--r-- | widgets/table/e-table.h | 6 | ||||
-rw-r--r-- | widgets/table/e-tree.c | 36 | ||||
-rw-r--r-- | widgets/table/e-tree.h | 3 |
5 files changed, 86 insertions, 2 deletions
diff --git a/widgets/table/e-table-header-item.c b/widgets/table/e-table-header-item.c index b8aa55f369..43871a278a 100644 --- a/widgets/table/e-table-header-item.c +++ b/widgets/table/e-table-header-item.c @@ -1192,6 +1192,11 @@ ethi_end_resize (ETableHeaderItem *ethi) ethi->resize_col = -1; ethi->resize_guide = GINT_TO_POINTER (0); + if (ethi->table) + e_table_thaw_state_change (ethi->table); + else if (ethi->tree) + e_tree_thaw_state_change (ethi->tree); + gnome_canvas_item_request_update (GNOME_CANVAS_ITEM (ethi)); } @@ -1903,6 +1908,11 @@ ethi_event (GnomeCanvasItem *item, ethi->resize_col = col; ethi->resize_start_pos = start - ecol->width; ethi->resize_min_width = ecol->min_width; + + if (ethi->table) + e_table_freeze_state_change (ethi->table); + else if (ethi->tree) + e_tree_freeze_state_change (ethi->tree); } else { if (e->button.button == 1) { ethi->click_x = e->button.x; diff --git a/widgets/table/e-table.c b/widgets/table/e-table.c index 472681796f..e81dc6b23c 100644 --- a/widgets/table/e-table.c +++ b/widgets/table/e-table.c @@ -203,7 +203,10 @@ et_disconnect_model (ETable *et) static void e_table_state_change (ETable *et) { - g_signal_emit (G_OBJECT (et), et_signals[STATE_CHANGE], 0); + if (et->state_change_freeze) + et->state_changed = TRUE; + else + g_signal_emit (G_OBJECT (et), et_signals[STATE_CHANGE], 0); } #define CHECK_HORIZONTAL(et) \ @@ -605,6 +608,9 @@ e_table_init (ETable *e_table) e_table->current_search_col = NULL; e_table->header_width = 0; + + e_table->state_changed = FALSE; + e_table->state_change_freeze = 0; } /* Grab_focus handler for the ETable */ @@ -3709,3 +3715,28 @@ e_table_class_init (ETableClass *class) gal_a11y_e_table_init (); } + +void +e_table_freeze_state_change (ETable *table) +{ + g_return_if_fail (table != NULL); + + table->state_change_freeze++; + if (table->state_change_freeze == 1) + table->state_changed = FALSE; + + g_return_if_fail (table->state_change_freeze != 0); +} + +void +e_table_thaw_state_change (ETable *table) +{ + g_return_if_fail (table != NULL); + g_return_if_fail (table->state_change_freeze != 0); + + table->state_change_freeze--; + if (table->state_change_freeze == 0 && table->state_changed) { + table->state_changed = FALSE; + e_table_state_change (table); + } +} diff --git a/widgets/table/e-table.h b/widgets/table/e-table.h index e1e4e0eb8f..6c2908811c 100644 --- a/widgets/table/e-table.h +++ b/widgets/table/e-table.h @@ -170,6 +170,9 @@ struct _ETable { gint header_width; gchar *domain; + + gboolean state_changed; + guint state_change_freeze; }; struct _ETableClass { @@ -386,6 +389,9 @@ void e_table_right_click_up (ETable *table); void e_table_commit_click_to_add (ETable *table); +void e_table_freeze_state_change (ETable *table); +void e_table_thaw_state_change (ETable *table); + G_END_DECLS #endif /* _E_TABLE_H_ */ diff --git a/widgets/table/e-tree.c b/widgets/table/e-tree.c index effd1e9aa6..e24ce6a6e0 100644 --- a/widgets/table/e-tree.c +++ b/widgets/table/e-tree.c @@ -197,6 +197,9 @@ struct _ETreePrivate { ETreeDragSourceSite *site; GList *expanded_list; + + gboolean state_changed; + guint state_change_freeze; }; static guint et_signals[LAST_SIGNAL] = { 0, }; @@ -299,7 +302,10 @@ current_search_col (ETree *et) static void e_tree_state_change (ETree *et) { - g_signal_emit (G_OBJECT (et), et_signals[STATE_CHANGE], 0); + if (et->priv->state_change_freeze) + et->priv->state_changed = TRUE; + else + g_signal_emit (G_OBJECT (et), et_signals[STATE_CHANGE], 0); } static void @@ -629,6 +635,9 @@ e_tree_init (ETree *e_tree) G_CALLBACK (et_search_accept), e_tree); e_tree->priv->always_search = g_getenv ("GAL_ALWAYS_SEARCH") ? TRUE : FALSE; + + e_tree->priv->state_changed = FALSE; + e_tree->priv->state_change_freeze = 0; } /* Grab_focus handler for the ETree */ @@ -3787,3 +3796,28 @@ e_tree_set_info_message (ETree *tree, } else gnome_canvas_item_set (tree->priv->info_text, "text", info_message, NULL); } + +void +e_tree_freeze_state_change (ETree *tree) +{ + g_return_if_fail (tree != NULL); + + tree->priv->state_change_freeze++; + if (tree->priv->state_change_freeze == 1) + tree->priv->state_changed = FALSE; + + g_return_if_fail (tree->priv->state_change_freeze != 0); +} + +void +e_tree_thaw_state_change (ETree *tree) +{ + g_return_if_fail (tree != NULL); + g_return_if_fail (tree->priv->state_change_freeze != 0); + + tree->priv->state_change_freeze--; + if (tree->priv->state_change_freeze == 0 && tree->priv->state_changed) { + tree->priv->state_changed = FALSE; + e_tree_state_change (tree); + } +} diff --git a/widgets/table/e-tree.h b/widgets/table/e-tree.h index 6504caf474..08e56039b3 100644 --- a/widgets/table/e-tree.h +++ b/widgets/table/e-tree.h @@ -362,6 +362,9 @@ GnomeCanvasItem * void e_tree_set_info_message (ETree *tree, const gchar *info_message); +void e_tree_freeze_state_change (ETree *table); +void e_tree_thaw_state_change (ETree *table); + G_END_DECLS #endif /* _E_TREE_H_ */ |