From 468f35efc44107fc07002638124f63839438aa4c Mon Sep 17 00:00:00 2001 From: David Keijser Date: Tue, 24 May 2011 18:21:09 +0200 Subject: refactor search commands --- src/commands.c | 4 ++-- src/uzbl-core.c | 11 +++++------ src/uzbl-core.h | 2 +- 3 files changed, 8 insertions(+), 9 deletions(-) (limited to 'src') diff --git a/src/commands.c b/src/commands.c index 28a3b39..87e7876 100644 --- a/src/commands.c +++ b/src/commands.c @@ -366,13 +366,13 @@ search_clear(WebKitWebView *page, GArray *argv, GString *result) { void search_forward_text (WebKitWebView *page, GArray *argv, GString *result) { (void) result; - search_text(page, argv, TRUE); + search_text(page, argv_idx(argv, 0), TRUE); } void search_reverse_text(WebKitWebView *page, GArray *argv, GString *result) { (void) result; - search_text(page, argv, FALSE); + search_text(page, argv_idx(argv, 0), FALSE); } void diff --git a/src/uzbl-core.c b/src/uzbl-core.c index d670774..d284859 100644 --- a/src/uzbl-core.c +++ b/src/uzbl-core.c @@ -563,17 +563,16 @@ eval_js(WebKitWebView * web_view, const gchar *script, GString *result, const ch } void -search_text (WebKitWebView *page, GArray *argv, const gboolean forward) { - if (argv_idx(argv, 0) && (*argv_idx(argv, 0) != '\0')) { - if (g_strcmp0 (uzbl.state.searchtx, argv_idx(argv, 0)) != 0) { +search_text (WebKitWebView *page, const gchar *key, const gboolean forward) { + if (key && (*key != '\0')) { + if (g_strcmp0 (uzbl.state.searchtx, key) != 0) { webkit_web_view_unmark_text_matches (page); - webkit_web_view_mark_text_matches (page, argv_idx(argv, 0), FALSE, 0); + webkit_web_view_mark_text_matches (page, key, FALSE, 0); g_free (uzbl.state.searchtx); - uzbl.state.searchtx = g_strdup(argv_idx(argv, 0)); + uzbl.state.searchtx = g_strdup (key); } } - if (uzbl.state.searchtx) { if (uzbl.state.verbose) printf ("Searching: %s\n", uzbl.state.searchtx); diff --git a/src/uzbl-core.h b/src/uzbl-core.h index 8e322e6..8108e9a 100644 --- a/src/uzbl-core.h +++ b/src/uzbl-core.h @@ -280,7 +280,7 @@ void run_handler(const gchar *act, const gchar *args); void settings_init(); /* Search functions */ -void search_text (WebKitWebView *page, GArray *argv, const gboolean forward); +void search_text (WebKitWebView *page, const gchar *key, const gboolean forward); /* Javascript functions */ void eval_js(WebKitWebView *web_view, const gchar *script, GString *result, const gchar *script_file); -- cgit v1.2.3