Summary Files Commits Branches @commit @diff @stats
path: root / badwolf.c
diff options
context:
space:
mode:
Commit720eb415a73893bf4c3894c10e27c66996f7e67e (patch)
Author
 Haelwenn (lanodan) Monnier <contact@hacktivis.me>
2019-12-16 14:35:37 +0100
Committer
 Haelwenn (lanodan) Monnier <contact@hacktivis.me>
2020-08-22 09:00:21 +0200
Files623ff17b265161d3bb3f1f4f878a517262e28368 /badwolf.c
goodwolf-720eb415a73893bf4c3894c10e27c66996f7e67e.tar
goodwolf-720eb415a73893bf4c3894c10e27c66996f7e67e.tar.gz
goodwolf-720eb415a73893bf4c3894c10e27c66996f7e67e.zip
Parent41cfd1ccae96dda3378b9666e38e70e547fe87f2 (diff)
Fix setting up completion
1 files changed, 14 insertions, 2 deletions
-rw-r--r--badwolf.c16
diff --git a/badwolf.c b/badwolf.c
index f284378..ca1f5d7 100644
--- a/badwolf.c
+++ b/badwolf.c
@@ -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. */
_("ΓΈ");