diff options
Fix setting up completion
1 files changed, 14 insertions, 2 deletions
| -rw-r--r-- | badwolf.c | 16 |
@@ -23,6 +23,7 @@ const gchar *version = VERSION; static gchar *web_extensions_directory; static int context_id_counter = 0; +GtkTreeModel *bookmarks_completion_model; static gboolean WebViewCb_close(WebKitWebView *webView, gpointer user_data); static gboolean WebViewCb_web_process_terminated(WebKitWebView *webView, @@ -738,9 +739,17 @@ new_browser(struct Window *window, const gchar *target_url, struct Client *old_b gtk_label_set_single_line_mode(GTK_LABEL(browser->statuslabel), TRUE); gtk_label_set_ellipsize(GTK_LABEL(browser->statuslabel), BADWOLF_STATUSLABEL_ELLIPSIZE); + if(bookmarks_completion_model != NULL) + { + GtkEntryCompletion *location_completion = gtk_entry_completion_new(); + GtkTreeModel *location_completion_model = bookmarks_completion_model; + + bookmarks_completion_setup(location_completion, location_completion_model); + gtk_entry_set_completion(GTK_ENTRY(browser->location), location_completion); + } + gtk_entry_set_text(GTK_ENTRY(browser->location), target_url); gtk_entry_set_input_purpose(GTK_ENTRY(browser->location), GTK_INPUT_PURPOSE_URL); - gtk_entry_set_completion(GTK_ENTRY(browser->location), location_completion); gtk_entry_set_placeholder_text(GTK_ENTRY(browser->search), _("search in current page")); @@ -933,7 +942,8 @@ main(int argc, char *argv[]) g_build_filename(g_get_user_data_dir(), "badwolf", "webkit-web-extension", NULL); fprintf(stderr, _("webkit-web-extension directory set to: %s\n"), web_extensions_directory); - location_completion_init(); + bookmarks_completion_model = bookmarks_completion_init(); + g_object_ref(bookmarks_completion_model); window->main_window = gtk_window_new(GTK_WINDOW_TOPLEVEL); window->notebook = gtk_notebook_new(); @@ -1002,6 +1012,8 @@ main(int argc, char *argv[]) gtk_main(); + g_object_unref(bookmarks_completion_model); + #if 0 /* TRANSLATOR Ignore this entry. Done for forcing Unicode in xgettext. */ _("ΓΈ"); |