#include "misc.hxx"
#include "board_window_state.hxx"
#include "thread_idx.hxx"
+#include "thread_window.hxx"
namespace dialektos {
unmerge_subject_txt(buffer);
merge_subject_txt(subjects, buffer);
tree_model_->set_buffer(buffer);
+
+ inform_to_threads(buffer);
}
void BoardWindow::on_refresh_end(const http::StatusLine& status,
state.to_xml(boost::filesystem::path(bbs_->get_board_state_path()));
}
+void BoardWindow::inform_to_threads(
+ boost::unordered_map<std::string, ModelColumns>& buffer) const {
+ typedef boost::unordered_map<std::string, ModelColumns> MapType;
+ typedef MapType::const_iterator Iter;
+
+ BOOST_FOREACH(ApplicationWindow& window, windows) {
+ if (ThreadWindow* thread_window = dynamic_cast<ThreadWindow*>(&window)) {
+ const bbs_detail::Base& bbs = thread_window->get_bbs_detail();
+ if (!bbs.belongs_to(*bbs_)) continue;
+
+ const std::string thread = bbs.get_thread_id();
+ Iter it = buffer.find(thread);
+ int res = 0;
+ if (it != buffer.end())
+ res = model_column::field<model_column::ResNum>(it->second);
+ inform_to_thread(*thread_window, res);
+ }
+ }
+}
+
+void BoardWindow::inform_to_thread(ThreadWindow& window, int res_num) const {
+ window.on_informed_from_board(res_num);
+}
+
} // namespace dialektos
struct ThreadIdx;
+class ThreadWindow;
class BoardWindow: public dialektos::ApplicationFrameWork {
public:
template <typename ColumnType>
void add_column(const BoardWindowState&);
+ void inform_to_threads(
+ boost::unordered_map<std::string, ModelColumns>&) const;
+ void inform_to_thread(ThreadWindow&, int res_num) const;
+
Gtk::TreeView tree_view_;
boost::scoped_ptr<bbs_detail::Base> bbs_;
Gtk::ScrolledWindow scrolled_;
state.to_xml(boost::filesystem::path(bbs_->get_thread_state_path()));
}
+void ThreadWindow::on_informed_from_board(const int res_num) {
+ if (res_num == 0) {
+ statusbar_.push("Dropped.");
+ } else if (res_num > idx_.line_count_) {
+ std::stringstream ss;
+ ss << boost::format("Update. %1% -> %2%") % idx_.line_count_ % res_num;
+ statusbar_.push(ss.str());
+ }
+}
+
+
void ThreadWindow::inform_to_board(const ThreadIdx& idx) const {
BOOST_FOREACH(ApplicationWindow& window, windows) {
if (BoardWindow* board_window = dynamic_cast<BoardWindow*>(&window)) {
bool load();
virtual ~ThreadWindow(){}
virtual void save_state() const;
+ void on_informed_from_board(int res_num);
+ const bbs_detail::Base& get_bbs_detail() const { return *bbs_; }
protected:
ThreadWindow(std::auto_ptr<bbs_detail::Base> bbs);