7
* Copyright (C) 2003 Enrico Zini <enrico@debian.org>
9
* This program is free software; you can redistribute it and/or modify
10
* it under the terms of the GNU General Public License as published by
11
* the Free Software Foundation; either version 2 of the License, or
12
* (at your option) any later version.
14
* This program is distributed in the hope that it will be useful,
15
* but WITHOUT ANY WARRANTY; without even the implied warranty of
16
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
17
* GNU General Public License for more details.
19
* You should have received a copy of the GNU General Public License
20
* along with this program; if not, write to the Free Software
21
* Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
26
#include <libbuffy/MailFolder.h>
28
#include <sigc++/sigc++.h>
29
#include <gtkmm/scrolledwindow.h>
30
#include <gtkmm/treeview.h>
31
#include <gtkmm/liststore.h>
32
#include <gtkmm/treemodelfilter.h>
33
#include <gtkmm/treemodelsort.h>
34
#include <gtkmm/box.h>
35
#include <gtkmm/label.h>
36
#include <gtkmm/entry.h>
37
#include <gtkmm/menu.h>
39
class FolderList : public Gtk::VBox, public MailFolderConsumer
42
typedef SigC::Signal1<void, MailFolder> type_signal_open_folder;
46
Gtk::TreeView folderList;
47
Glib::RefPtr<Gtk::ListStore> folderListModel;
48
Glib::RefPtr<Gtk::TreeModelFilter> filteredModel;
49
Glib::RefPtr<Gtk::TreeModelSort> sortedModel;
50
Gtk::ScrolledWindow scrolledFolderList;
52
bool viewEmpty, viewRead, viewImportant;
58
Gtk::Label filterLabel;
59
Gtk::Entry filterEdit;
62
std::vector<std::string> selected;
66
class FolderListModelColumns : public Gtk::TreeModel::ColumnRecord
69
FolderListModelColumns() { add(folder); add(name); add(msg_new); add(msg_unread); add(msg_total); add(msg_flagged); }
71
Gtk::TreeModelColumn<MailFolder> folder;
72
Gtk::TreeModelColumn<Glib::ustring> name;
73
Gtk::TreeModelColumn<int> msg_new;
74
Gtk::TreeModelColumn<int> msg_unread;
75
Gtk::TreeModelColumn<int> msg_total;
76
Gtk::TreeModelColumn<int> msg_flagged;
79
FolderListModelColumns folderListModelColumns;
81
type_signal_open_folder _signal_open_folder;
87
void on_filter_changed();
88
void on_document_changed();
90
bool on_event(GdkEvent* e);
91
void on_row_activated(const Gtk::TreeModel::Path& path, Gtk::TreeViewColumn*);
92
bool filter_row(const Gtk::TreeModel::const_iterator& iter);
96
virtual ~FolderList() {}
98
void consume(MailFolder& folder);
102
bool do_timer_tick();
104
void configureFilter(bool viewEmpty, bool viewRead, bool viewImportant);
106
type_signal_open_folder signal_open_folder() throw ()
107
{ return _signal_open_folder; }
111
std::map< std::string, Tagcoll::TagSet > getAllFolders();
112
std::map< std::string, Tagcoll::TagSet > getSelection();
113
int getSelectionSize();
116
//type_signal_changed signal_changed() throw () { return _signal_changed; }
117
//virtual void do_changed();
120
virtual void do_selection_changed();
121
virtual void do_focus_in();
122
virtual void on_itemList_drag_data_get(
123
const Glib::RefPtr<Gdk::DragContext>&, Gtk::SelectionData& selection_data, guint, guint);
124
virtual void on_itemList_drop_drag_data_received(
125
const Glib::RefPtr<Gdk::DragContext>& context, int, int, const Gtk::SelectionData& selection_data, guint, guint time);
126
virtual bool on_focus_in(GdkEventFocus*);
129
type_signal_selection_changed signal_selection_changed() throw ()
130
{ return _signal_selection_changed; }
131
type_signal_focus_in signal_focus_in() throw ()
132
{ return _signal_focus_in; }
133
type_signal_request_tagcoll_change signal_request_tagcoll_change() throw ()
134
{ return _signal_request_tagcoll_change; }
135
type_signal_request_tagset_merge signal_request_tagset_merge() throw ()
136
{ return _signal_request_tagset_merge; }
137
type_signal_request_tagset_intersect signal_request_tagset_intersect() throw ()
138
{ return _signal_request_tagset_intersect; }
139
type_signal_request_item_copy signal_request_item_copy() throw ()
140
{ return _signal_request_item_copy; }
141
type_signal_request_item_move signal_request_item_move() throw ()
142
{ return _signal_request_item_move; }
143
type_signal_select_tagset signal_select_tagset() throw ()
144
{ return _signal_select_tagset; }
145
type_signal_select_tagset_other_panel signal_select_tagset_other_panel() throw ()
146
{ return _signal_select_tagset_other_panel; }
150
// vim:set ts=4 sw=4: