aboutsummaryrefslogtreecommitdiffstats
path: root/modules/calendar/e-memo-shell-view.c
diff options
context:
space:
mode:
Diffstat (limited to 'modules/calendar/e-memo-shell-view.c')
-rw-r--r--modules/calendar/e-memo-shell-view.c67
1 files changed, 35 insertions, 32 deletions
diff --git a/modules/calendar/e-memo-shell-view.c b/modules/calendar/e-memo-shell-view.c
index 5cc8e159bb..5d932e1599 100644
--- a/modules/calendar/e-memo-shell-view.c
+++ b/modules/calendar/e-memo-shell-view.c
@@ -58,51 +58,59 @@ memo_shell_view_execute_search (EShellView *shell_view)
EShellWindow *shell_window;
EShellContent *shell_content;
GtkRadioAction *action;
- GString *string;
ECalComponentPreview *memo_preview;
EMemoTable *memo_table;
ECalModel *model;
- const gchar *format;
- const gchar *text;
gchar *query;
gchar *temp;
gint value;
shell_content = e_shell_view_get_shell_content (shell_view);
- text = e_shell_content_get_search_text (shell_content);
-
shell_window = e_shell_view_get_shell_window (shell_view);
action = GTK_RADIO_ACTION (ACTION (MEMO_SEARCH_ANY_FIELD_CONTAINS));
value = gtk_radio_action_get_current_value (action);
- if (text == NULL || *text == '\0') {
- text = "";
- value = MEMO_SEARCH_SUMMARY_CONTAINS;
- }
+ if (value == MEMO_SEARCH_ADVANCED) {
+ query = e_shell_content_get_search_rule_as_string (shell_content);
- switch (value) {
- default:
+ if (!query)
+ query = g_strdup ("");
+ } else {
+ const gchar *format;
+ const gchar *text;
+ GString *string;
+
+ text = e_shell_content_get_search_text (shell_content);
+
+ if (text == NULL || *text == '\0') {
text = "";
- /* fall through */
+ value = MEMO_SEARCH_SUMMARY_CONTAINS;
+ }
- case MEMO_SEARCH_SUMMARY_CONTAINS:
- format = "(contains? \"summary\" %s)";
- break;
+ switch (value) {
+ default:
+ text = "";
+ /* fall through */
- case MEMO_SEARCH_DESCRIPTION_CONTAINS:
- format = "(contains? \"description\" %s)";
- break;
+ case MEMO_SEARCH_SUMMARY_CONTAINS:
+ format = "(contains? \"summary\" %s)";
+ break;
- case MEMO_SEARCH_ANY_FIELD_CONTAINS:
- format = "(contains? \"any\" %s)";
- break;
- }
+ case MEMO_SEARCH_DESCRIPTION_CONTAINS:
+ format = "(contains? \"description\" %s)";
+ break;
- /* Build the query. */
- string = g_string_new ("");
- e_sexp_encode_string (string, text);
- query = g_strdup_printf (format, string->str);
- g_string_free (string, TRUE);
+ case MEMO_SEARCH_ANY_FIELD_CONTAINS:
+ format = "(contains? \"any\" %s)";
+ break;
+ }
+
+ /* Build the query. */
+ string = g_string_new ("");
+ e_sexp_encode_string (string, text);
+ query = g_strdup_printf (format, string->str);
+ g_string_free (string, TRUE);
+ }
/* Apply selected filter. */
value = e_shell_content_get_filter_value (shell_content);
@@ -134,11 +142,6 @@ memo_shell_view_execute_search (EShellView *shell_view)
}
}
- /* XXX This is wrong. We need to programmatically construct an
- * EFilterRule, tell it to build code, and pass the resulting
- * expression string to ECalModel. */
- e_shell_content_set_search_rule (shell_content, NULL);
-
/* Submit the query. */
memo_shell_content = E_MEMO_SHELL_CONTENT (shell_content);
memo_table = e_memo_shell_content_get_memo_table (memo_shell_content);