sync with 0.7.5cvs9
[claws.git] / src / summary_search.c
index 3a2d8c8fa2a35b3bb710cb3570b895e971181ea6..60e517d618dd821f2bd1b9fa9ec2be5d915c0b36 100644 (file)
@@ -1,6 +1,6 @@
 /*
  * Sylpheed -- a GTK+ based, lightweight, and fast e-mail client
- * Copyright (C) 1999-2001 Hiroyuki Yamamoto
+ * Copyright (C) 1999-2002 Hiroyuki Yamamoto
  *
  * 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
@@ -103,10 +103,7 @@ static void summary_search_create(SummaryView *summaryview)
                           GTK_SIGNAL_FUNC(gtk_widget_hide_on_delete), NULL);
        gtk_signal_connect(GTK_OBJECT(window), "key_press_event",
                           GTK_SIGNAL_FUNC(key_pressed), NULL);
-       gtk_signal_connect(GTK_OBJECT(window), "focus_in_event",
-                          GTK_SIGNAL_FUNC(manage_window_focus_in), NULL);
-       gtk_signal_connect(GTK_OBJECT(window), "focus_out_event",
-                          GTK_SIGNAL_FUNC(manage_window_focus_out), NULL);
+       MANAGE_WINDOW_SIGNALS_CONNECT(window);
 
        vbox1 = gtk_vbox_new (FALSE, 0);
        gtk_widget_show (vbox1);
@@ -235,6 +232,9 @@ static void summary_search_execute(GtkButton *button, gpointer data)
        wchar_t *(* WCSFindFunc) (const wchar_t *haystack,
                                  const wchar_t *needle);
 
+       if (summary_is_locked(summaryview)) return;
+       summary_lock(summaryview);
+
        case_sens = gtk_toggle_button_get_active
                (GTK_TOGGLE_BUTTON(case_checkbtn));
        backward = gtk_toggle_button_get_active
@@ -270,7 +270,10 @@ static void summary_search_execute(GtkButton *button, gpointer data)
                else
                        node = GTK_CTREE_NODE(GTK_CLIST(ctree)->row_list);
 
-               if (!node) return;
+               if (!node) {
+                       summary_unlock(summaryview);
+                       return;
+               }
        } else {
                if (backward)
                        node = GTK_CTREE_NODE_PREV(summaryview->selected);
@@ -352,8 +355,10 @@ static void summary_search_execute(GtkButton *button, gpointer data)
                                gtk_ctree_select(ctree, node);
                        else {
                                if (summaryview->msg_is_toggled_on) {
+                                       summary_unlock(summaryview);
                                        summary_select_node
-                                               (summaryview, node, TRUE, FALSE);
+                                               (summaryview, node, TRUE, TRUE);
+                                       summary_lock(summaryview);
                                        if (body_matched) {
                                                messageview_search_string
                                                        (summaryview->messageview,
@@ -361,7 +366,7 @@ static void summary_search_execute(GtkButton *button, gpointer data)
                                        }
                                } else {
                                        summary_select_node
-                                               (summaryview, node, FALSE, FALSE);
+                                               (summaryview, node, FALSE, TRUE);
                                }
                                break;
                        }
@@ -373,6 +378,8 @@ static void summary_search_execute(GtkButton *button, gpointer data)
 
        if (*body_str)
                main_window_cursor_normal(summaryview->mainwin);
+
+       summary_unlock(summaryview);
 }
 
 static void summary_search_clear(GtkButton *button, gpointer data)