diff options
author | Milan Crha <mcrha@redhat.com> | 2010-04-01 22:18:40 +0800 |
---|---|---|
committer | Milan Crha <mcrha@redhat.com> | 2010-04-01 22:18:40 +0800 |
commit | b276c75c7c0f537cf4f5d122b1bff41420ca3232 (patch) | |
tree | 829da2bb5e4c2795c884d0e53ffd0da1b344dfb1 /shell/e-shell-view.c | |
parent | ba1c4eade6a41d285fae59969f2db4b253139041 (diff) | |
download | gsoc2013-evolution-b276c75c7c0f537cf4f5d122b1bff41420ca3232.tar.gz gsoc2013-evolution-b276c75c7c0f537cf4f5d122b1bff41420ca3232.tar.zst gsoc2013-evolution-b276c75c7c0f537cf4f5d122b1bff41420ca3232.zip |
Bug #613352 - Changed time range not propagated to calendar
Diffstat (limited to 'shell/e-shell-view.c')
-rw-r--r-- | shell/e-shell-view.c | 59 |
1 files changed, 58 insertions, 1 deletions
diff --git a/shell/e-shell-view.c b/shell/e-shell-view.c index 537024a548..3a5c6e219d 100644 --- a/shell/e-shell-view.c +++ b/shell/e-shell-view.c @@ -60,6 +60,9 @@ struct _EShellViewPrivate { EFilterRule *search_rule; guint execute_search_blocked; + + guint update_actions_blocked; + gboolean update_actions_called; }; enum { @@ -629,6 +632,9 @@ shell_view_update_actions (EShellView *shell_view) EShellWindow *shell_window; EFocusTracker *focus_tracker; + g_return_if_fail (!shell_view->priv->update_actions_blocked); + g_return_if_fail (e_shell_view_is_active (shell_view)); + shell_window = e_shell_view_get_shell_window (shell_view); focus_tracker = e_shell_window_get_focus_tracker (shell_window); @@ -1514,13 +1520,64 @@ e_shell_view_unblock_execute_search (EShellView *shell_view) * #EShellView::update-actions signal is typically emitted just before * showing a popup menu or just after the user selects an item in the * shell view. + * + * Emission can be blocked by e_shell_view_block_update_actions(). **/ void e_shell_view_update_actions (EShellView *shell_view) { g_return_if_fail (E_IS_SHELL_VIEW (shell_view)); - g_signal_emit (shell_view, signals[UPDATE_ACTIONS], 0); + if (!e_shell_view_is_active (shell_view)) + return; + + if (shell_view->priv->update_actions_blocked > 0) { + shell_view->priv->update_actions_called = TRUE; + } else { + shell_view->priv->update_actions_called = FALSE; + g_signal_emit (shell_view, signals[UPDATE_ACTIONS], 0); + } +} + +/** + * e_shell_view_block_update_actions: + * @shell_view: an #EShellView + * + * Block emission of #EShellView::update-actions signal through + * e_shell_view_update_actions(). The emission si blocked until + * e_shell_view_unblock_update_actions() is called same times as + * this function. + **/ +void +e_shell_view_block_update_actions (EShellView *shell_view) +{ + g_return_if_fail (E_IS_SHELL_VIEW (shell_view)); + g_return_if_fail (shell_view->priv->update_actions_blocked + 1 != 0); + + shell_view->priv->update_actions_blocked++; + if (shell_view->priv->update_actions_blocked == 1) + shell_view->priv->update_actions_called = FALSE; +} + +/** + * e_shell_view_unblock_update_actions: + * @shell_view: an #EShellView + * + * Unblock emission of #EShellView::update-actions signal through + * e_shell_view_update_actions(), previously blocked by function + * e_shell_view_block_update_actions(). + **/ +void +e_shell_view_unblock_update_actions (EShellView *shell_view) +{ + g_return_if_fail (E_IS_SHELL_VIEW (shell_view)); + g_return_if_fail (shell_view->priv->update_actions_blocked > 0); + + shell_view->priv->update_actions_blocked--; + if (!shell_view->priv->update_actions_blocked && shell_view->priv->update_actions_called) { + shell_view->priv->update_actions_called = FALSE; + e_shell_view_update_actions (shell_view); + } } /** |