From: Aiwota Programmer Date: Sun, 28 Jun 2009 21:00:30 +0000 (+0900) Subject: 'Show board' menuitem and 'Delete' menuitem are added. X-Git-Url: http://git.osdn.net/view?p=fukui-no-namari%2Fdialektos.git;a=commitdiff_plain;h=c4528a03960220a38fcdd4efe0b83cf25c6f4741 'Show board' menuitem and 'Delete' menuitem are added. --- diff --git a/src/thread_window.cxx b/src/thread_window.cxx index 999fae3..f666b25 100644 --- a/src/thread_window.cxx +++ b/src/thread_window.cxx @@ -21,6 +21,7 @@ #include "thread_window.hxx" #include +#include #include #include #include @@ -29,6 +30,7 @@ #include "thread_idx.hxx" #include "http_get.hxx" #include "misc.hxx" +#include "uri_opener.hxx" namespace dialektos { @@ -44,6 +46,26 @@ ThreadWindow::ThreadWindow(std::auto_ptr bbs) : scrolled_(text_view_.get_adjustment()), bbs_(bbs), http_getter_(), idx_() { + // additional menuitems for board window + action_group_->add(Gtk::Action::create("FileDelete", Gtk::Stock::DELETE), + sigc::mem_fun(*this, &ThreadWindow::on_action_file_delete)); + action_group_->add( + Gtk::Action::create("FileBoard", Gtk::Stock::GO_UP, "Show _Board"), + sigc::mem_fun(*this, &ThreadWindow::on_action_file_board)); + + Glib::ustring ui = + "" + " " + " " + " " + " " + " " + " " + " " + ""; + + ui_manager_->add_ui_from_string(ui); + set_default_size(400,300); scrolled_.add(text_view_); @@ -109,6 +131,26 @@ void ThreadWindow::on_action_view_stop() { if (http_getter_) http_getter_->cancel(); } +void ThreadWindow::on_action_file_delete() { + const boost::filesystem::path dat(bbs_->get_thread_file_path()); + try { + if (boost::filesystem::exists(dat)) boost::filesystem::remove(dat); + } catch (const boost::filesystem::filesystem_error& e) { + std::cerr << e.what() << std::endl; + } + + const boost::filesystem::path xml(bbs_->get_thread_idx_path()); + try { + if (boost::filesystem::exists(xml)) boost::filesystem::remove(xml); + } catch (const boost::filesystem::filesystem_error& e) { + std::cerr << e.what() << std::endl; + } +} + +void ThreadWindow::on_action_file_board() { + uri_opener::open(bbs_->get_board_uri()); +} + void ThreadWindow::on_http_get_end(bool success) { // const std::string uri = http_getter_->get_uri(); // const http::Header request_header = http_getter_->get_request_header(); diff --git a/src/thread_window.hxx b/src/thread_window.hxx index 8056a4a..b9e690f 100644 --- a/src/thread_window.hxx +++ b/src/thread_window.hxx @@ -49,6 +49,8 @@ protected: virtual void on_action_view_refresh(); virtual void on_action_view_stop(); + void on_action_file_delete(); + void on_action_file_board(); private: virtual bool is_same(const bbs_detail::Base& bbs) const; virtual std::string get_uri() const;