#include "thread_window.hxx"
#include <glibmm/convert.h>
+#include <gtkmm/stock.h>
#include <boost/date_time/posix_time/posix_time.hpp>
#include <boost/filesystem.hpp>
#include <iostream>
#include "thread_idx.hxx"
#include "http_get.hxx"
#include "misc.hxx"
+#include "uri_opener.hxx"
namespace dialektos {
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>"
+ " <menubar name='MenuBar'>"
+ " <menu action='MenuFile'>"
+ " <menuitem action='FileDelete'/>"
+ " <separator/>"
+ " <menuitem action='FileBoard'/>"
+ " </menu>"
+ " </menubar>"
+ "</ui>";
+
+ ui_manager_->add_ui_from_string(ui);
+
set_default_size(400,300);
scrolled_.add(text_view_);
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();