OSDN Git Service

Change idx sub dir's time stamp when saving idx.
[fukui-no-namari/dialektos.git] / src / board_window.hxx
1 /*
2  * Copyright (C) 2009 by Aiwota Programmer
3  * aiwotaprog@tetteke.tk
4  *
5  * This file is part of Dialektos.
6  *
7  * Dialektos is free software: you can redistribute it and/or modify
8  * it under the terms of the GNU General Public License as published by
9  * the Free Software Foundation, either version 3 of the License, or
10  * (at your option) any later version.
11  *
12  * Dialektos is distributed in the hope that it will be useful,
13  * but WITHOUT ANY WARRANTY; without even the implied warranty of
14  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
15  * GNU General Public License for more details.
16  *
17  * You should have received a copy of the GNU General Public License
18  * along with Dialektos.  If not, see <http://www.gnu.org/licenses/>.
19  */
20
21 #ifndef BOARD_WINDOW_HXX
22 #define BOARD_WINDOW_HXX
23
24 #include <glibmm/refptr.h>
25 #include <gtkmm/treeview.h>
26 #include <gtkmm/scrolledwindow.h>
27 #include <boost/scoped_ptr.hpp>
28 #include <memory>
29 #include "application_framework.hxx"
30 #include "thread_list_model.hxx"
31 #include "http_get.hxx"
32 #include "board_subject_item.hxx"
33 #include "board_subject_idx.hxx"
34
35
36 namespace dialektos {
37
38 namespace bbs_detail {
39   class Base;
40 }
41
42
43 class BoardWindow: public dialektos::ApplicationFrameWork {
44 public:
45   static void create(std::auto_ptr<bbs_detail::Base> bbs);
46   virtual ~BoardWindow();
47   virtual void save_state() const;
48 protected:
49   BoardWindow(std::auto_ptr<bbs_detail::Base> bbs);
50
51   void on_action_file_open();
52
53   virtual void on_action_view_refresh();
54   virtual void on_action_view_stop();
55 private:
56   virtual bool is_same(const bbs_detail::Base& bbs) const;
57   virtual std::string get_uri() const;
58
59   void on_row_activated(const Gtk::TreeModel::Path&,
60       Gtk::TreeViewColumn*);
61   void load();
62
63   void merge_subject_txt(
64       const std::vector<SubjectItem>&,
65       boost::unordered_map<std::string, ModelColumns>&);
66   void unmerge_subject_txt(
67       boost::unordered_map<std::string, ModelColumns>&);
68
69   void on_http_get_end(bool);
70   void on_refresh_end(const http::StatusLine&, const http::Header&);
71
72   void save_content(const http::Response&);
73
74   Gtk::TreeView tree_view_;
75   boost::scoped_ptr<bbs_detail::Base> bbs_;
76   Gtk::ScrolledWindow scrolled_;
77   Glib::RefPtr<ThreadListModel> tree_model_;
78   boost::scoped_ptr<http::GetInThread> http_getter_;
79   SubjectIdx idx_;
80 };
81
82
83 } // namespace dialektos
84
85 #endif