aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorMilan Crha <mcrha@redhat.com>2009-12-18 01:17:21 +0800
committerMilan Crha <mcrha@redhat.com>2009-12-18 01:17:21 +0800
commitfe15c797a036820ac4b5e8cf232ad0a559fcd06b (patch)
tree52b9861302be476ee9671212233ea562d93634e3
parent858c42577c240a3ae83feaa6f5bb7c696da8df43 (diff)
downloadgsoc2013-evolution-fe15c797a036820ac4b5e8cf232ad0a559fcd06b.tar
gsoc2013-evolution-fe15c797a036820ac4b5e8cf232ad0a559fcd06b.tar.gz
gsoc2013-evolution-fe15c797a036820ac4b5e8cf232ad0a559fcd06b.tar.bz2
gsoc2013-evolution-fe15c797a036820ac4b5e8cf232ad0a559fcd06b.tar.lz
gsoc2013-evolution-fe15c797a036820ac4b5e8cf232ad0a559fcd06b.tar.xz
gsoc2013-evolution-fe15c797a036820ac4b5e8cf232ad0a559fcd06b.tar.zst
gsoc2013-evolution-fe15c797a036820ac4b5e8cf232ad0a559fcd06b.zip
Bug #603184 - Various problems with search box in folders
-rw-r--r--modules/mail/e-mail-shell-view.c3
-rw-r--r--shell/e-shell-content.c12
-rw-r--r--shell/e-shell-view.c37
-rw-r--r--shell/e-shell-view.h2
4 files changed, 51 insertions, 3 deletions
diff --git a/modules/mail/e-mail-shell-view.c b/modules/mail/e-mail-shell-view.c
index a3dbbed7ba..7e1d00393d 100644
--- a/modules/mail/e-mail-shell-view.c
+++ b/modules/mail/e-mail-shell-view.c
@@ -160,6 +160,9 @@ mail_shell_view_execute_search (EShellView *shell_view)
text = e_shell_content_get_search_text (shell_content);
if (value == MAIL_SEARCH_ADVANCED || text == NULL || *text == '\0') {
+ if (value != MAIL_SEARCH_ADVANCED)
+ e_shell_content_set_search_rule (shell_content, NULL);
+
query = e_shell_content_get_search_rule_as_string (shell_content);
if (!query)
diff --git a/shell/e-shell-content.c b/shell/e-shell-content.c
index 6ffa73fa0a..13f807e79b 100644
--- a/shell/e-shell-content.c
+++ b/shell/e-shell-content.c
@@ -127,7 +127,7 @@ shell_content_update_search_widgets (EShellContent *shell_content)
const GdkColor *color;
style = gtk_widget_get_style (widget);
- color = &style->base[GTK_STATE_SELECTED];
+ color = &style->light[GTK_STATE_SELECTED];
gtk_widget_modify_base (widget, GTK_STATE_NORMAL, color);
style = gtk_widget_get_style (widget);
@@ -172,11 +172,17 @@ shell_content_entry_activate_cb (EShellContent *shell_content,
EShellView *shell_view;
EShellWindow *shell_window;
GtkAction *action;
+ const gchar *text;
shell_view = e_shell_content_get_shell_view (shell_content);
shell_window = e_shell_view_get_shell_window (shell_view);
- action = E_SHELL_WINDOW_ACTION_SEARCH_QUICK (shell_window);
+ text = gtk_entry_get_text (entry);
+ if (text && *text)
+ action = E_SHELL_WINDOW_ACTION_SEARCH_QUICK (shell_window);
+ else
+ action = E_SHELL_WINDOW_ACTION_SEARCH_CLEAR (shell_window);
+
gtk_action_activate (action);
}
@@ -1664,6 +1670,7 @@ e_shell_content_restore_state (EShellContent *shell_content,
* the search action until the state is fully restored. */
action = E_SHELL_WINDOW_ACTION_SEARCH_QUICK (shell_window);
gtk_action_block_activate (action);
+ e_shell_view_block_execute_search (shell_view);
key = STATE_KEY_SEARCH_FILTER;
string = g_key_file_get_string (key_file, group_name, key, NULL);
@@ -1703,6 +1710,7 @@ e_shell_content_restore_state (EShellContent *shell_content,
action = E_SHELL_WINDOW_ACTION_SEARCH_QUICK (shell_window);
gtk_action_unblock_activate (action);
+ e_shell_view_unblock_execute_search (shell_view);
/* Now execute the search. */
e_shell_view_execute_search (shell_view);
diff --git a/shell/e-shell-view.c b/shell/e-shell-view.c
index 8ee65e0e4f..2439706224 100644
--- a/shell/e-shell-view.c
+++ b/shell/e-shell-view.c
@@ -52,6 +52,8 @@ struct _EShellViewPrivate {
GtkWidget *shell_content;
GtkWidget *shell_sidebar;
GtkWidget *shell_taskbar;
+
+ guint execute_search_blocked;
};
enum {
@@ -1121,7 +1123,40 @@ e_shell_view_execute_search (EShellView *shell_view)
{
g_return_if_fail (E_IS_SHELL_VIEW (shell_view));
- g_signal_emit (shell_view, signals[EXECUTE_SEARCH], 0);
+ if (!shell_view->priv->execute_search_blocked)
+ g_signal_emit (shell_view, signals[EXECUTE_SEARCH], 0);
+}
+
+/**
+ * e_shell_view_block_execute_search:
+ * @shell_view: an #EShellView
+ *
+ * Blocks e_shell_view_execute_search in a way it does nothing.
+ * Pair function for this is e_shell_view_unblock_execute_search.
+ **/
+void
+e_shell_view_block_execute_search (EShellView *shell_view)
+{
+ g_return_if_fail (E_IS_SHELL_VIEW (shell_view));
+ g_return_if_fail (shell_view->priv->execute_search_blocked + 1 != 0);
+
+ shell_view->priv->execute_search_blocked++;
+}
+
+/**
+ * e_shell_view_unblock_execute_search:
+ * @shell_view: an #EShellView
+ *
+ * Unblocks previously blocked e_shell_view_execute_search with
+ * function e_shell_view_block_execute_search.
+ **/
+void
+e_shell_view_unblock_execute_search (EShellView *shell_view)
+{
+ g_return_if_fail (E_IS_SHELL_VIEW (shell_view));
+ g_return_if_fail (shell_view->priv->execute_search_blocked > 0);
+
+ shell_view->priv->execute_search_blocked--;
}
/**
diff --git a/shell/e-shell-view.h b/shell/e-shell-view.h
index 7b8fb13861..8cbfabd0ba 100644
--- a/shell/e-shell-view.h
+++ b/shell/e-shell-view.h
@@ -179,6 +179,8 @@ EShellWindow * e_shell_view_get_shell_window (EShellView *shell_view);
GKeyFile * e_shell_view_get_state_key_file (EShellView *shell_view);
void e_shell_view_set_state_dirty (EShellView *shell_view);
void e_shell_view_execute_search (EShellView *shell_view);
+void e_shell_view_block_execute_search (EShellView *shell_view);
+void e_shell_view_unblock_execute_search (EShellView *shell_view);
void e_shell_view_update_actions (EShellView *shell_view);
GtkWidget * e_shell_view_show_popup_menu (EShellView *shell_view,
const gchar *widget_path,