request = $request; // GTK $this->gtk = new GtkEntryCompletion; $this->gtk->set_inline_completion( $this::INLINE_COMPLETION ); $this->gtk->set_inline_selection( $this::INLINE_SELECTION ); $this->gtk->set_minimum_key_length( $this::MINIMUM_KEY_LENGTH ); $this->gtk->set_text_column( $this::TEXT_COLUMN ); // Requirements $this->suggestion = new Completion\Suggestion( $this ); $this->gtk->set_model( $this->suggestion->gtk ); } public function refresh( int $limit = 5, int $offset = 0, array $suggestions = [] ): void { $this->suggestion->clear(); foreach ($this->request->navbar->page->container->browser->database->bookmark->find( $this->request->getValue(), $offset, $limit ) as $history) { $suggestions[] = $history->request; } foreach ($this->request->navbar->page->container->browser->database->history->find( $this->request->getValue(), $offset, $limit ) as $history) { $suggestions[] = $history->url; } foreach (array_values(array_unique($suggestions)) as $index => $suggestion) { if ($index > $limit) break; $this->suggestion->append( $suggestion ); } } }