/*
* Sylpheed -- a GTK+ based, lightweight, and fast e-mail client
- * Copyright (C) 1999-2012 Hiroyuki Yamamoto and the Claws Mail team
+ * Copyright (C) 1999-2013 Hiroyuki Yamamoto and the Claws Mail team
*
* This program is free software; you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
#include "prefs_matcher.h"
#include "manual.h"
#include "prefs_common.h"
+#include "statusbar.h"
static struct SummarySearchWindow {
GtkWidget *window;
gpointer data);
static gboolean adv_condition_entry_focus_evt_out(GtkWidget *widget, GdkEventFocus *event,
gpointer data);
-#ifndef MAEMO
static gboolean key_pressed (GtkWidget *widget,
GdkEventKey *event,
gpointer data);
-#endif
-#if !GTK_CHECK_VERSION(2,14,0)
-/* Work around http://bugzilla.gnome.org/show_bug.cgi?id=56070 */
#define GTK_BUTTON_SET_SENSITIVE(widget,sensitive) { \
- gboolean in_btn = FALSE; \
- if (GTK_IS_BUTTON(widget)) \
- in_btn = GTK_BUTTON(widget)->in_button; \
gtk_widget_set_sensitive(widget, sensitive); \
- if (GTK_IS_BUTTON(widget)) \
- GTK_BUTTON(widget)->in_button = in_btn; \
}
-#else
-#define GTK_BUTTON_SET_SENSITIVE(widget,sensitive) { \
- gtk_widget_set_sensitive(widget, sensitive); \
-}
-#endif
static gchar* add_history_get(GtkWidget *from, GList **history)
{
gchar *result;
+#if !GTK_CHECK_VERSION(2, 24, 0)
result = gtk_combo_box_get_active_text(GTK_COMBO_BOX(from));
+#else
+ result = gtk_combo_box_text_get_active_text(GTK_COMBO_BOX_TEXT(from));
+#endif
if (!result)
result = gtk_editable_get_chars(GTK_EDITABLE(gtk_bin_get_child(GTK_BIN(from))), 0, -1);
if (result && result[0] != '\0') {
/* add to history */
-
+#if !GTK_CHECK_VERSION(2, 24, 0)
combobox_unset_popdown_strings(GTK_COMBO_BOX(from));
+#else
+ combobox_unset_popdown_strings(GTK_COMBO_BOX_TEXT(from));
+#endif
*history = add_history(*history, result);
+#if !GTK_CHECK_VERSION(2, 24, 0)
combobox_set_popdown_strings(GTK_COMBO_BOX(from), *history);
+#else
+ combobox_set_popdown_strings(GTK_COMBO_BOX_TEXT(from), *history);
+#endif
return result;
} else {
gtk_container_set_border_width(GTK_CONTAINER (window), 8);
g_signal_connect(G_OBJECT(window), "delete_event",
G_CALLBACK(gtk_widget_hide_on_delete), NULL);
-#ifdef MAEMO
- maemo_connect_key_press_to_mainwindow(GTK_WINDOW(window));
-#else
g_signal_connect(G_OBJECT(window), "key_press_event",
G_CALLBACK(key_pressed), NULL);
-#endif
MANAGE_WINDOW_SIGNALS_CONNECT(window);
vbox1 = gtk_vbox_new (FALSE, 0);
gtk_table_set_row_spacings (GTK_TABLE (table1), 8);
gtk_table_set_col_spacings (GTK_TABLE (table1), 8);
+#if !GTK_CHECK_VERSION(2, 24, 0)
from_entry = gtk_combo_box_entry_new_text ();
+#else
+ from_entry = gtk_combo_box_text_new_with_entry ();
+#endif
gtk_combo_box_set_active(GTK_COMBO_BOX(from_entry), -1);
if (prefs_common.summary_search_from_history)
+#if !GTK_CHECK_VERSION(2, 24, 0)
combobox_set_popdown_strings(GTK_COMBO_BOX(from_entry),
prefs_common.summary_search_from_history);
+#else
+ combobox_set_popdown_strings(GTK_COMBO_BOX_TEXT(from_entry),
+ prefs_common.summary_search_from_history);
+#endif
gtk_widget_show (from_entry);
gtk_table_attach (GTK_TABLE (table1), from_entry, 1, 3, 0, 1,
GTK_EXPAND|GTK_FILL, 0, 0, 0);
g_signal_connect(G_OBJECT(gtk_bin_get_child(GTK_BIN((from_entry)))),
"focus_out_event", G_CALLBACK(from_entry_focus_evt_out), NULL);
+#if !GTK_CHECK_VERSION(2, 24, 0)
to_entry = gtk_combo_box_entry_new_text ();
+#else
+ to_entry = gtk_combo_box_text_new_with_entry ();
+#endif
gtk_combo_box_set_active(GTK_COMBO_BOX(to_entry), -1);
if (prefs_common.summary_search_to_history)
+#if !GTK_CHECK_VERSION(2, 24, 0)
combobox_set_popdown_strings(GTK_COMBO_BOX(to_entry),
prefs_common.summary_search_to_history);
+#else
+ combobox_set_popdown_strings(GTK_COMBO_BOX_TEXT(to_entry),
+ prefs_common.summary_search_to_history);
+#endif
gtk_widget_show (to_entry);
gtk_table_attach (GTK_TABLE (table1), to_entry, 1, 3, 1, 2,
GTK_EXPAND|GTK_FILL, 0, 0, 0);
g_signal_connect(G_OBJECT(gtk_bin_get_child(GTK_BIN((to_entry)))),
"focus_out_event", G_CALLBACK(to_entry_focus_evt_out), NULL);
+#if !GTK_CHECK_VERSION(2, 24, 0)
subject_entry = gtk_combo_box_entry_new_text ();
+#else
+ subject_entry = gtk_combo_box_text_new_with_entry ();
+#endif
gtk_combo_box_set_active(GTK_COMBO_BOX(subject_entry), -1);
if (prefs_common.summary_search_subject_history)
+#if !GTK_CHECK_VERSION(2, 24, 0)
combobox_set_popdown_strings(GTK_COMBO_BOX(subject_entry),
prefs_common.summary_search_subject_history);
+#else
+ combobox_set_popdown_strings(GTK_COMBO_BOX_TEXT(subject_entry),
+ prefs_common.summary_search_subject_history);
+#endif
gtk_widget_show (subject_entry);
gtk_table_attach (GTK_TABLE (table1), subject_entry, 1, 3, 2, 3,
GTK_EXPAND|GTK_FILL, 0, 0, 0);
g_signal_connect(G_OBJECT(gtk_bin_get_child(GTK_BIN((subject_entry)))),
"focus_out_event", G_CALLBACK(subject_entry_focus_evt_out), NULL);
+#if !GTK_CHECK_VERSION(2, 24, 0)
body_entry = gtk_combo_box_entry_new_text ();
+#else
+ body_entry = gtk_combo_box_text_new_with_entry ();
+#endif
gtk_combo_box_set_active(GTK_COMBO_BOX(body_entry), -1);
if (prefs_common.summary_search_body_history)
+#if !GTK_CHECK_VERSION(2, 24, 0)
combobox_set_popdown_strings(GTK_COMBO_BOX(body_entry),
prefs_common.summary_search_body_history);
+#else
+ combobox_set_popdown_strings(GTK_COMBO_BOX_TEXT(body_entry),
+ prefs_common.summary_search_body_history);
+#endif
gtk_widget_show (body_entry);
gtk_table_attach (GTK_TABLE (table1), body_entry, 1, 3, 3, 4,
GTK_EXPAND|GTK_FILL, 0, 0, 0);
g_signal_connect(G_OBJECT(gtk_bin_get_child(GTK_BIN((body_entry)))),
"focus_out_event", G_CALLBACK(body_entry_focus_evt_out), NULL);
+#if !GTK_CHECK_VERSION(2, 24, 0)
adv_condition_entry = gtk_combo_box_entry_new_text ();
+#else
+ adv_condition_entry = gtk_combo_box_text_new_with_entry ();
+#endif
gtk_combo_box_set_active(GTK_COMBO_BOX(adv_condition_entry), -1);
if (prefs_common.summary_search_adv_condition_history)
+#if !GTK_CHECK_VERSION(2, 24, 0)
combobox_set_popdown_strings(GTK_COMBO_BOX(adv_condition_entry),
prefs_common.summary_search_adv_condition_history);
+#else
+ combobox_set_popdown_strings(GTK_COMBO_BOX_TEXT(adv_condition_entry),
+ prefs_common.summary_search_adv_condition_history);
+#endif
gtk_widget_show (adv_condition_entry);
gtk_table_attach (GTK_TABLE (table1), adv_condition_entry, 1, 2, 4, 5,
GTK_EXPAND|GTK_FILL, 0, 0, 0);
search_window.search_in_progress = FALSE;
search_window.matched_msgnums = NULL;
search_window.is_searching = is_searching;
-#ifdef MAEMO
- maemo_window_full_screen_if_needed(GTK_WINDOW(search_window.window));
-#endif
}
static gboolean summary_search_verify_match(MsgInfo *msg)
return FALSE;
}
+static gboolean summary_search_progress_cb(gpointer data, guint at, guint matched, guint total)
+{
+ if (!search_window.is_searching) {
+ search_window.matcher_is_outdated = TRUE;
+ return FALSE;
+ }
+
+ return summaryview_search_root_progress(search_window.summaryview, at, matched, total);
+}
+
static gboolean summary_search_prepare_matcher()
{
gboolean adv_search;
search_window.advsearch = advsearch_new();
advsearch_set_on_error_cb(search_window.advsearch, NULL, NULL); /* TODO */
advsearch_set_on_progress_cb(search_window.advsearch,
- summaryview_search_root_progress,
- search_window.summaryview);
+ summary_search_progress_cb, NULL);
}
adv_search = gtk_toggle_button_get_active
msginfo = gtk_cmctree_node_get_row_data(ctree, node);
- matched = summary_search_verify_match(msginfo);
+ if (msginfo)
+ matched = summary_search_verify_match(msginfo);
+ else
+ matched = FALSE;
if (matched) {
if (search_all) {
} else {
if (messageview_is_visible(summaryview->messageview)) {
summary_unlock(summaryview);
- summary_select_node(summaryview, node, TRUE, TRUE);
+ summary_select_node(summaryview, node, 1);
summary_lock(summaryview);
} else {
- summary_select_node(summaryview, node, FALSE, TRUE);
+ summary_select_node(summaryview, node, 0);
}
break;
}
summary_hide_stop_button();
main_window_cursor_normal(summaryview->mainwin);
if (search_all) {
- summary_thaw(summaryview);
+ summary_thaw_with_status(summaryview);
}
summary_unlock(summaryview);
}
/* re-use the current search value if it's a condition expression,
otherwise ignore it silently */
+#if !GTK_CHECK_VERSION(2, 24, 0)
cond_str = gtk_combo_box_get_active_text(GTK_COMBO_BOX(search_window.adv_condition_entry));
+#else
+ cond_str = gtk_combo_box_text_get_active_text(GTK_COMBO_BOX_TEXT(search_window.adv_condition_entry));
+#endif
if (cond_str && *cond_str != '\0') {
matchers = matcher_parser_get_cond((gchar*)cond_str, NULL);
}
search_window.adv_condition_entry_has_focus = FALSE;
return FALSE;
}
-#ifndef MAEMO
+
static gboolean key_pressed(GtkWidget *widget, GdkEventKey *event,
gpointer data)
{
return FALSE;
}
-#endif