0.9.3claws34
[claws.git] / src / summaryview.c
index 10a53e571229750afaa7106c74b58ebcc0828a04..f55298bc7dad4edd89fd7686ed6019250883c969 100644 (file)
@@ -44,9 +44,6 @@
 #include <stdlib.h>
 #include <string.h>
 #include <ctype.h>
-#include <unistd.h>
-#include <sys/stat.h>
-#include <regex.h>
 
 #include "intl.h"
 #include "main.h"
@@ -78,7 +75,7 @@
 #include "addressbook.h"
 #include "addr_compl.h"
 #include "scoring.h"
-#include "prefs_folder_item.h"
+#include "folder_item_prefs.h"
 #include "filtering.h"
 #include "string_match.h"
 #include "toolbar.h"
@@ -257,7 +254,7 @@ static void summary_colorlabel_menu_create(SummaryView      *summaryview);
 static GtkWidget *summary_ctree_create (SummaryView    *summaryview);
 
 /* callback functions */
-static void summary_toggle_pressed     (GtkWidget              *eventbox,
+static gint summary_toggle_pressed     (GtkWidget              *eventbox,
                                         GdkEventButton         *event,
                                         SummaryView            *summaryview);
 static void summary_button_pressed     (GtkWidget              *ctree,
@@ -266,10 +263,10 @@ static void summary_button_pressed        (GtkWidget              *ctree,
 static void summary_button_released    (GtkWidget              *ctree,
                                         GdkEventButton         *event,
                                         SummaryView            *summaryview);
-static void summary_key_pressed                (GtkWidget              *ctree,
+static gint summary_key_pressed                (GtkWidget              *ctree,
                                         GdkEventKey            *event,
                                         SummaryView            *summaryview);
-static void summary_searchbar_pressed  (GtkWidget              *ctree,
+static gint summary_searchbar_pressed  (GtkWidget              *ctree,
                                         GdkEventKey            *event,
                                         SummaryView            *summaryview);
 static void summary_searchbar_focus_evt        (GtkWidget              *ctree,
@@ -529,7 +526,8 @@ static DescriptionWindow search_descr = {
        search_descr_strings
 };
        
-static void search_description_cb (GtkWidget *widget) {
+static void search_description_cb(GtkWidget *widget)
+{
        description_window_create(&search_descr);
 };
 
@@ -711,6 +709,8 @@ SummaryView *summary_create(void)
        summaryview->msginfo_update_callback_id =
                hooks_register_hook(MSGINFO_UPDATE_HOOKLIST, summary_update_msg, (gpointer) summaryview);
 
+       summaryview->target_list = gtk_target_list_new(summary_drag_types, 1);
+
        /* CLAWS: need this to get the SummaryView * from
         * the CList */
        gtk_object_set_data(GTK_OBJECT(ctree), "summaryview", (gpointer)summaryview); 
@@ -2440,7 +2440,13 @@ static void summary_display_msg_full(SummaryView *summaryview,
        MsgFlags flags;
        gchar *filename;
 
-       if (!new_window && summaryview->displayed == row) return;
+       if (!new_window) {
+               if (summaryview->displayed == row)
+                       return;
+               else
+                       summaryview->messageview->filtered = FALSE;
+       }                       
+       
        g_return_if_fail(row != NULL);
 
        if (summary_is_locked(summaryview)) return;
@@ -2824,7 +2830,6 @@ static void summary_lock_row(SummaryView *summaryview, GtkCTreeNode *row)
 
 static void summary_unlock_row(SummaryView *summaryview, GtkCTreeNode *row)
 {
-       gboolean changed = FALSE;
        GtkCTree *ctree = GTK_CTREE(summaryview->ctree);
        MsgInfo *msginfo;
 
@@ -4408,12 +4413,12 @@ void summary_set_column_order(SummaryView *summaryview)
 
 /* callback functions */
 
-static void summary_toggle_pressed(GtkWidget *eventbox, GdkEventButton *event,
+static gint summary_toggle_pressed(GtkWidget *eventbox, GdkEventButton *event,
                                   SummaryView *summaryview)
 {
-       if (!event) return;
-
-       summary_toggle_view(summaryview);
+       if (event)  
+               summary_toggle_view(summaryview);
+       return TRUE;
 }
 
 static void summary_button_pressed(GtkWidget *ctree, GdkEventButton *event,
@@ -4451,7 +4456,7 @@ void summary_pass_key_press_event(SummaryView *summaryview, GdkEventKey *event)
 #define RETURN_IF_LOCKED() \
        if (summaryview->mainwin->lock_count) return
 
-static void summary_key_pressed(GtkWidget *widget, GdkEventKey *event,
+static gint summary_key_pressed(GtkWidget *widget, GdkEventKey *event,
                                SummaryView *summaryview)
 {
        GtkCTree *ctree = GTK_CTREE(widget);
@@ -4459,14 +4464,14 @@ static void summary_key_pressed(GtkWidget *widget, GdkEventKey *event,
        MessageView *messageview;
        TextView *textview;
 
-       if (summary_is_locked(summaryview)) return;
-       if (!event) return;
+       if (summary_is_locked(summaryview)) return TRUE;
+       if (!event) return TRUE;
 
        switch (event->keyval) {
        case GDK_Left:          /* Move focus */
        case GDK_Escape:
                gtk_widget_grab_focus(summaryview->folderview->ctree);
-               return;
+               return TRUE;
        default:
                break;
        }
@@ -4476,7 +4481,7 @@ static void summary_key_pressed(GtkWidget *widget, GdkEventKey *event,
                if (node)
                        gtk_sctree_select(GTK_SCTREE(ctree), node);
                else
-                       return;
+                       return TRUE;
        }
 
        messageview = summaryview->messageview;
@@ -4523,13 +4528,15 @@ static void summary_key_pressed(GtkWidget *widget, GdkEventKey *event,
        default:
                break;
        }
+       return TRUE;
 }
 
-static void summary_searchbar_pressed(GtkWidget *widget, GdkEventKey *event,
+static gint summary_searchbar_pressed(GtkWidget *widget, GdkEventKey *event,
                                SummaryView *summaryview)
 {
        if (event != NULL && event->keyval == GDK_Return)
                summary_show(summaryview, summaryview->folder_item);
+       return TRUE;            
 }
 
 static void summary_searchbar_focus_evt(GtkWidget *widget, GdkEventFocus *event,
@@ -4831,7 +4838,6 @@ static void summary_locked_clicked(GtkWidget *button,
 static void summary_start_drag(GtkWidget *widget, gint button, GdkEvent *event,
                               SummaryView *summaryview)
 {
-       GtkTargetList *list;
        GdkDragContext *context;
 
        g_return_if_fail(summaryview != NULL);
@@ -4839,9 +4845,7 @@ static void summary_start_drag(GtkWidget *widget, gint button, GdkEvent *event,
        g_return_if_fail(summaryview->folder_item->folder != NULL);
        if (summaryview->selected == NULL) return;
 
-       list = gtk_target_list_new(summary_drag_types, 1);
-
-       context = gtk_drag_begin(widget, list,
+       context = gtk_drag_begin(widget, summaryview->target_list,
                                 GDK_ACTION_MOVE|GDK_ACTION_COPY|GDK_ACTION_DEFAULT, button, event);
        gtk_drag_set_icon_default(context);
 }
@@ -4985,7 +4989,7 @@ static gint summary_cmp_by_subject(GtkCList *clist,                        \
  static gint summary_cmp_by_simplified_subject
        (GtkCList *clist, gconstpointer ptr1, gconstpointer ptr2)
 {
-       const PrefsFolderItem *prefs;
+       const FolderItemPrefs *prefs;
        const gchar *str1, *str2;
        const GtkCListRow *r1 = (const GtkCListRow *) ptr1;
        const GtkCListRow *r2 = (const GtkCListRow *) ptr2;