2005-08-05 [colin] 1.9.13cvs16
[claws.git] / src / folderview.h
1 /*
2  * Sylpheed -- a GTK+ based, lightweight, and fast e-mail client
3  * Copyright (C) 1999-2004 Hiroyuki Yamamoto
4  *
5  * This program is free software; you can redistribute it and/or modify
6  * it under the terms of the GNU General Public License as published by
7  * the Free Software Foundation; either version 2 of the License, or
8  * (at your option) any later version.
9  *
10  * This program is distributed in the hope that it will be useful,
11  * but WITHOUT ANY WARRANTY; without even the implied warranty of
12  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
13  * GNU General Public License for more details.
14  *
15  * You should have received a copy of the GNU General Public License
16  * along with this program; if not, write to the Free Software
17  * Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
18  */
19
20 #ifndef __FOLDERVIEW_H__
21 #define __FOLDERVIEW_H__
22
23 typedef struct _FolderView      FolderView;
24 typedef struct _FolderViewPopup FolderViewPopup;
25 typedef struct _FolderColumnState       FolderColumnState;
26
27 #include <glib.h>
28 #include <gtk/gtkwidget.h>
29 #include <gtk/gtkctree.h>
30
31 #include "mainwindow.h"
32 #include "summaryview.h"
33 #include "folder.h"
34
35 typedef enum
36 {
37         F_COL_FOLDER,
38         F_COL_NEW,
39         F_COL_UNREAD,
40         F_COL_TOTAL
41 } FolderColumnType;
42
43 #define N_FOLDER_COLS   4
44
45 struct _FolderColumnState
46 {
47         FolderColumnType type;
48         gboolean visible;
49 };
50
51 struct _FolderView
52 {
53         GtkWidget *scrolledwin;
54         GtkWidget *ctree;
55
56         GHashTable *popups;
57
58         GtkCTreeNode *selected;
59         GtkCTreeNode *opened;
60
61         gboolean open_folder;
62
63         GdkColor color_new;
64         GdkColor color_op;
65
66         MainWindow   *mainwin;
67         SummaryView  *summaryview;
68
69         gint folder_update_callback_id;
70         gint folder_item_update_callback_id;
71         
72         /* DND states */
73         GSList *nodes_to_recollapse;
74         guint   drag_timer;             /* timer id */
75         FolderItem *drag_item;          /* dragged item */
76         GtkCTreeNode *drag_node;        /* drag node */
77         
78         GtkTargetList *target_list; /* DnD */
79         FolderColumnState col_state[N_FOLDER_COLS];
80         gint col_pos[N_FOLDER_COLS];
81 };
82
83 struct _FolderViewPopup
84 {
85         gchar            *klass;
86         gchar            *path;
87         GSList           *entries;
88         void            (*set_sensitivity)      (GtkItemFactory *menu, FolderItem *item);
89 };
90
91 void folderview_initialize              (void);
92 FolderView *folderview_create           (void);
93 void folderview_init                    (FolderView     *folderview);
94
95 void folderview_set                     (FolderView     *folderview);
96 void folderview_set_all                 (void);
97
98 void folderview_select                  (FolderView     *folderview,
99                                          FolderItem     *item);
100 void folderview_unselect                (FolderView     *folderview);
101 void folderview_select_next_unread      (FolderView     *folderview);
102
103 FolderItem *folderview_get_selected_item(FolderView     *folderview);
104
105 void folderview_update_msg_num          (FolderView     *folderview,
106                                          GtkCTreeNode   *row);
107
108 void folderview_append_item             (FolderItem     *item);
109
110 void folderview_rescan_tree             (Folder         *folder);
111 void folderview_rescan_all              (void);
112 gint folderview_check_new               (Folder         *folder);
113 void folderview_check_new_all           (void);
114
115 void folderview_update_item_foreach     (GHashTable     *table,
116                                          gboolean        update_summary);
117 void folderview_update_all_updated      (gboolean        update_summary);
118
119 void folderview_move_folder             (FolderView     *folderview,
120                                          FolderItem     *from_folder,
121                                          FolderItem     *to_folder);
122
123 void folderview_set_target_folder_color (gint           color_op);
124
125 void folderview_reflect_prefs_pixmap_theme      (FolderView *folderview);
126
127 void folderview_reflect_prefs           (void);
128 void folderview_register_popup          (FolderViewPopup        *fpopup);
129 void folderview_unregister_popup        (FolderViewPopup        *fpopup);
130 void folderview_update_search_icon      (FolderItem             *item,  
131                                          gboolean                matches);
132 void folderview_set_column_order        (FolderView             *folderview);
133
134 #endif /* __FOLDERVIEW_H__ */