folderview.h (3853B)
1 /* 2 * Claws Mail -- a GTK based, lightweight, and fast e-mail client 3 * Copyright (C) 1999-2012 Hiroyuki Yamamoto and the Claws Mail team 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 3 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, see <http://www.gnu.org/licenses/>. 17 * 18 */ 19 20 #ifndef __FOLDERVIEW_H__ 21 #define __FOLDERVIEW_H__ 22 23 typedef struct _FolderViewPopup FolderViewPopup; 24 typedef struct _FolderColumnState FolderColumnState; 25 26 #include <glib.h> 27 #include <gtk/gtk.h> 28 #include "gtk/gtksctree.h" 29 30 #include "mainwindow.h" 31 #include "viewtypes.h" 32 #include "folder.h" 33 34 typedef enum 35 { 36 F_COL_FOLDER, 37 F_COL_NEW, 38 F_COL_UNREAD, 39 F_COL_TOTAL 40 } FolderColumnType; 41 42 #define N_FOLDER_COLS 4 43 44 struct _FolderColumnState 45 { 46 FolderColumnType type; 47 gboolean visible; 48 }; 49 50 struct _FolderView 51 { 52 GtkWidget *scrolledwin; 53 GtkWidget *ctree; 54 GtkWidget *headerpopupmenu; 55 56 GHashTable *popups; 57 58 GtkCMCTreeNode *selected; 59 GtkCMCTreeNode *opened; 60 61 gboolean open_folder; 62 63 GdkRGBA color_new; 64 GdkRGBA 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 FolderColumnState col_state[N_FOLDER_COLS]; 73 gint col_pos[N_FOLDER_COLS]; 74 Folder *scanning_folder; 75 GtkUIManager *ui_manager; 76 GtkActionGroup *popup_common_action_group; 77 GtkActionGroup *popup_specific_action_group; 78 gint scroll_value; 79 guint deferred_refresh_id; 80 guint scroll_timeout_id; 81 guint postpone_select_id; 82 }; 83 84 struct _FolderViewPopup 85 { 86 gchar *klass; 87 gchar *path; 88 GtkActionEntry *entries; 89 gint n_entries; 90 GtkToggleActionEntry *toggle_entries; 91 gint n_toggle_entries; 92 GtkRadioActionEntry *radio_entries; 93 gint n_radio_entries; 94 gint radio_default; 95 void (*radio_callback) (GtkAction *action, GtkRadioAction *current, gpointer data); 96 void (*add_menuitems) (GtkUIManager *ui_manager, FolderItem *item); 97 void (*set_sensitivity) (GtkUIManager *ui_manager, FolderItem *item); 98 }; 99 100 void folderview_initialize (void); 101 FolderView *folderview_create (MainWindow *mainwin); 102 void folderview_init (FolderView *folderview); 103 104 void folderview_set (FolderView *folderview); 105 void folderview_set_all (void); 106 107 void folderview_select (FolderView *folderview, 108 FolderItem *item); 109 void folderview_unselect (FolderView *folderview); 110 void folderview_select_next_with_flag (FolderView *folderview, 111 MsgPermFlags flag); 112 113 FolderItem *folderview_get_selected_item(FolderView *folderview); 114 FolderItem *folderview_get_opened_item(FolderView *folderview); 115 116 void folderview_rescan_tree (Folder *folder, 117 gboolean rebuild); 118 gint folderview_check_new (Folder *folder); 119 void folderview_check_new_all (void); 120 121 void folderview_update_all_updated (gboolean update_summary); 122 123 void folderview_run_processing(FolderItem *item); 124 125 void folderview_move_folder (FolderView *folderview, 126 FolderItem *from_folder, 127 FolderItem *to_folder, 128 gboolean copy); 129 130 void folderview_set_column_order (FolderView *folderview); 131 132 void folderview_close_opened (FolderView *folderview, 133 gboolean dirty); 134 void folderview_remove_item(FolderView *folderview, 135 FolderItem *item); 136 137 void folderview_freeze(FolderView *folderview); 138 void folderview_thaw(FolderView *folderview); 139 void folderview_grab_focus(FolderView *folderview); 140 141 #endif /* __FOLDERVIEW_H__ */