public function click_section(GtkTreeView $view, GtkTreeIter $iter, array $path) { // Set the path to make sure the selection is selected $view->set_cursor($path); /** @var GtkTreeModel */ $model = $view->get_model(); $value = $model->get_value($iter, 0); // Do multi processing here! ~_~ // TODO: Detect Windows verse Unix $proc = new Gorilla3d\Process(); // Unix $proc->setCommand("php threads.php &"); // Windows //$proc->setCommand("start php threads.php"); $proc->open(); $proc->write($value); // Keep checking if the process is done foreach (range(1, 6) as $i) { // Needed to not block UI while (Gtk::events_pending()) { Gtk::main_iteration(); } // Sleep 0.5 seconds before checking again (locks UI for 1/2 a second usleep(500000); echo "SLEEP!" . PHP_EOL; } $proc->close(); /* $sections = Fourchan\Sections::getSections(); $url = false; if(isset($sections[$value])) { $url = $sections[$value]; } else { echo "fart!\n"; } if($url) { $parser = new Fourchan\Parser($url); $parser->getPages(); $parser->getThreads(); // lots of threads >.< var_dump($parser->threads); } */ /** @var GtkTreeSelection */ /* For multiple selections $selection = $view->get_selection(); list($model, $arPaths) = $selection->get_selected_rows(); echo "Selection is now:\r\n"; foreach ($arPaths as $path) { $iter = $model->get_iter($path); echo ' ' . $model->get_value($iter, 0) . "\r\n"; } */ /* */ echo "clicked Thread!" . PHP_EOL; }