aboutsummaryrefslogtreecommitdiffstats
path: root/shell
diff options
context:
space:
mode:
authorMilan Crha <mcrha@redhat.com>2010-04-01 22:18:40 +0800
committerMilan Crha <mcrha@redhat.com>2010-04-01 22:18:40 +0800
commitb276c75c7c0f537cf4f5d122b1bff41420ca3232 (patch)
tree829da2bb5e4c2795c884d0e53ffd0da1b344dfb1 /shell
parentba1c4eade6a41d285fae59969f2db4b253139041 (diff)
downloadgsoc2013-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')
-rw-r--r--shell/e-shell-view.c59
-rw-r--r--shell/e-shell-view.h4
2 files changed, 62 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);
+ }
}
/**
diff --git a/shell/e-shell-view.h b/shell/e-shell-view.h
index d014d694ce..1e189217e1 100644
--- a/shell/e-shell-view.h
+++ b/shell/e-shell-view.h
@@ -215,6 +215,10 @@ void e_shell_view_block_execute_search
void e_shell_view_unblock_execute_search
(EShellView *shell_view);
void e_shell_view_update_actions (EShellView *shell_view);
+void e_shell_view_block_update_actions
+ (EShellView *shell_view);
+void e_shell_view_unblock_update_actions
+ (EShellView *shell_view);
GtkWidget * e_shell_view_show_popup_menu (EShellView *shell_view,
const gchar *widget_path,
GdkEventButton *event);