public function onFullTextSearchClick() { if (!$this->manual) { // TODO: One might think aobut using an external browser or the online docs... $dialog = new \GtkMessageDialog($this->glade->get_widget('mainwindow'), 0, \Gtk::MESSAGE_ERROR, \Gtk::BUTTONS_OK, 'GtkHTML needed'); $dialog->set_markup('For doing full text searches GtkHTML support is required in your PHP configuration.'); $dialog->run(); $dialog->destroy(); return; } $input = trim($this->glade->get_widget('searchentry')->get_text()); if (strlen($input) == 0) { $dialog = new \GtkMessageDialog($this->glade->get_widget('mainwindow'), 0, \Gtk::MESSAGE_ERROR, \Gtk::BUTTONS_OK, 'No input'); $dialog->set_markup('No search term entered'); $dialog->run(); $dialog->destroy(); return; } $results = $this->manual->searchFulltext($input); $store = new \GtkTreeStore(\GObject::TYPE_STRING, \GObject::TYPE_PHP_VALUE); foreach ($results as $title => $found) { $man_container = $store->append(null, array($title, null)); $basenamelen = strlen('phar://' . $found->getArchiveFileName()); echo 'phar://' . $found->getArchiveFileName(), "\n"; foreach ($found as $item) { /** @var $item \SplFileObject */ $doc = \DomDocument::loadHTMLFile($item->getPathname()); $caption = $doc->getElementsByTagName('title')->item(0)->firstChild->wholeText; $store->append($man_container, array($caption, $item)); } } $tree = $this->glade->get_widget('searchtreeview'); $tree->set_model($store); $tree->get_selection()->connect('changed', array($this->mainWindow, 'onSearchResultClick')); /* TODO: Move to view */ $cell_renderer = new \GtkCellRendererText(); $colExt = new \GtkTreeViewColumn('', $cell_renderer, 'text', 0); $tree->append_column($colExt); }