aboutsummaryrefslogtreecommitdiffstats
path: root/shell
diff options
context:
space:
mode:
authorMilan Crha <mcrha@redhat.com>2013-08-20 17:25:06 +0800
committerMilan Crha <mcrha@redhat.com>2013-08-20 17:25:06 +0800
commitb7e728dd46329cd4a932af75c99b65aa2f211bd0 (patch)
tree6e4e661f37d035f1791ce3a3ee066cbdffcd9f3b /shell
parentbb6ab693783cc17f36d1e8da7f07d488611bffad (diff)
downloadgsoc2013-evolution-b7e728dd46329cd4a932af75c99b65aa2f211bd0.tar
gsoc2013-evolution-b7e728dd46329cd4a932af75c99b65aa2f211bd0.tar.gz
gsoc2013-evolution-b7e728dd46329cd4a932af75c99b65aa2f211bd0.tar.bz2
gsoc2013-evolution-b7e728dd46329cd4a932af75c99b65aa2f211bd0.tar.lz
gsoc2013-evolution-b7e728dd46329cd4a932af75c99b65aa2f211bd0.tar.xz
gsoc2013-evolution-b7e728dd46329cd4a932af75c99b65aa2f211bd0.tar.zst
gsoc2013-evolution-b7e728dd46329cd4a932af75c99b65aa2f211bd0.zip
Bug #682277 - Multiselect of messages causes slow UI update
Diffstat (limited to 'shell')
-rw-r--r--shell/e-shell-view.c50
-rw-r--r--shell/e-shell-view.h2
2 files changed, 50 insertions, 2 deletions
diff --git a/shell/e-shell-view.c b/shell/e-shell-view.c
index a7aa4e8541..e5ba407d7b 100644
--- a/shell/e-shell-view.c
+++ b/shell/e-shell-view.c
@@ -74,6 +74,8 @@ struct _EShellViewPrivate {
GtkWidget *preferences_window;
gulong preferences_hide_handler_id;
+
+ guint update_actions_idle_id;
};
enum {
@@ -515,6 +517,11 @@ shell_view_dispose (GObject *object)
shell_view_save_state (E_SHELL_VIEW (object), TRUE);
}
+ if (priv->update_actions_idle_id > 0) {
+ g_source_remove (priv->update_actions_idle_id);
+ priv->update_actions_idle_id = 0;
+ }
+
if (priv->state_save_activity != NULL) {
g_object_remove_weak_pointer (
G_OBJECT (priv->state_save_activity),
@@ -625,7 +632,7 @@ shell_view_constructed (GObject *object)
shell_view->priv->preferences_window = g_object_ref (widget);
handler_id = g_signal_connect_swapped (
shell_view->priv->preferences_window, "hide",
- G_CALLBACK (e_shell_view_update_actions), shell_view);
+ G_CALLBACK (e_shell_view_update_actions_in_idle), shell_view);
shell_view->priv->preferences_hide_handler_id = handler_id;
e_extensible_load_extensions (E_EXTENSIBLE (object));
@@ -1822,8 +1829,47 @@ e_shell_view_update_actions (EShellView *shell_view)
{
g_return_if_fail (E_IS_SHELL_VIEW (shell_view));
- if (e_shell_view_is_active (shell_view))
+ if (e_shell_view_is_active (shell_view)) {
+ if (shell_view->priv->update_actions_idle_id > 0) {
+ g_source_remove (shell_view->priv->update_actions_idle_id);
+ shell_view->priv->update_actions_idle_id = 0;
+ }
+
g_signal_emit (shell_view, signals[UPDATE_ACTIONS], 0);
+ }
+}
+
+static gboolean
+shell_view_call_update_actions_idle (gpointer user_data)
+{
+ EShellView *shell_view = user_data;
+
+ g_return_val_if_fail (E_IS_SHELL_VIEW (shell_view), FALSE);
+
+ shell_view->priv->update_actions_idle_id = 0;
+ e_shell_view_update_actions (shell_view);
+
+ return FALSE;
+}
+
+/**
+ * e_shell_view_update_actions_in_idle:
+ * @shell_view: an #EShellView
+ *
+ * Schedules e_shell_view_update_actions() call on idle.
+ *
+ * Since: 3.10
+ **/
+void
+e_shell_view_update_actions_in_idle (EShellView *shell_view)
+{
+ g_return_if_fail (E_IS_SHELL_VIEW (shell_view));
+
+ if (!e_shell_view_is_active (shell_view))
+ return;
+
+ if (shell_view->priv->update_actions_idle_id == 0)
+ shell_view->priv->update_actions_idle_id = g_idle_add (shell_view_call_update_actions_idle, shell_view);
}
/**
diff --git a/shell/e-shell-view.h b/shell/e-shell-view.h
index db51c31ca8..7ccbacc659 100644
--- a/shell/e-shell-view.h
+++ b/shell/e-shell-view.h
@@ -234,6 +234,8 @@ void e_shell_view_unblock_execute_search
gboolean e_shell_view_is_execute_search_blocked
(EShellView *shell_view);
void e_shell_view_update_actions (EShellView *shell_view);
+void e_shell_view_update_actions_in_idle
+ (EShellView *shell_view);
GtkWidget * e_shell_view_show_popup_menu (EShellView *shell_view,
const gchar *widget_path,
GdkEvent *button_event);