sync with 0.7.5cvs9
[claws.git] / src / summary_search.c
index 80f5ef23fc5ee48db2f5505a48cf9639840a5c92..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
@@ -95,19 +95,15 @@ static void summary_search_create(SummaryView *summaryview)
        GtkWidget *confirm_area;
 
        window = gtk_window_new (GTK_WINDOW_DIALOG);
-       gtk_window_set_title (GTK_WINDOW (window), _("Search folder"));
+       gtk_window_set_title (GTK_WINDOW (window), _("Search messages"));
        gtk_widget_set_usize (window, 450, -1);
-       /*gtk_window_set_position(GTK_WINDOW(window), GTK_WIN_POS_CENTER);*/
        gtk_window_set_policy(GTK_WINDOW(window), FALSE, TRUE, TRUE);
        gtk_container_set_border_width (GTK_CONTAINER (window), 8);
        gtk_signal_connect(GTK_OBJECT(window), "delete_event",
                           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);
@@ -236,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
@@ -271,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);
@@ -353,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);
+                                               (summaryview, node, TRUE, TRUE);
+                                       summary_lock(summaryview);
                                        if (body_matched) {
                                                messageview_search_string
                                                        (summaryview->messageview,
@@ -362,7 +366,7 @@ static void summary_search_execute(GtkButton *button, gpointer data)
                                        }
                                } else {
                                        summary_select_node
-                                               (summaryview, node, FALSE);
+                                               (summaryview, node, FALSE, TRUE);
                                }
                                break;
                        }
@@ -374,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)