OSDN Git Service

Add menuitem 'copy'.
[fukui-no-namari/dialektos.git] / src / board_window.cxx
index 6a7a2ac..fe8de9d 100644 (file)
@@ -292,6 +292,26 @@ void BoardWindow::on_action_file_open() {
   std::cout << "file open activated" << std::endl;
 }
 
+void BoardWindow::on_action_edit_copy() {
+  Glib::RefPtr<const Gtk::TreeSelection> selection =
+    tree_view_.get_selection();
+
+  std::vector<Gtk::TreeModel::Path> paths = selection->get_selected_rows();
+  if (paths.empty()) return;
+
+  std::string selected;
+  BOOST_FOREACH(Gtk::TreeModel::Path path, paths) {
+    Gtk::TreeRow row = *(tree_model_->get_iter(path));
+    std::string id;
+    row.get_value(boost::mpl::find<model_column::List,
+        model_column::ID>::type::pos::value, id);
+    if (id.empty()) continue;
+    if (!selected.empty()) selected += "\n";
+    selected += bbs_->get_another_thread_uri(id);
+  }
+  Gtk::Clipboard::get()->set_text(selected);
+}
+
 void BoardWindow::on_action_view_refresh() {
   if (http_getter_) return;