diff options
author | dusanx <ef_dva@yahoo.com> | 2009-05-03 16:58:11 +0200 |
---|---|---|
committer | dusanx <ef_dva@yahoo.com> | 2009-05-03 16:58:11 +0200 |
commit | 1825c5b18e7369cf63025ea13ebcf898135bc65b (patch) | |
tree | 4d2485dcfe8fb655429c43b48086de2f5fd50679 | |
parent | 871baf52aa5c5a3d0c2e73c26959e202278d40f7 (diff) |
Search
-rw-r--r-- | examples/configs/sampleconfig-dev | 1 | ||||
-rw-r--r-- | uzbl.c | 17 | ||||
-rw-r--r-- | uzbl.h | 3 |
3 files changed, 21 insertions, 0 deletions
diff --git a/examples/configs/sampleconfig-dev b/examples/configs/sampleconfig-dev index e9c9cc1..b486660 100644 --- a/examples/configs/sampleconfig-dev +++ b/examples/configs/sampleconfig-dev @@ -44,6 +44,7 @@ B = spawn ./examples/scripts/insert_bookmark.sh u = spawn ./examples/scripts/load_url_from_history.sh U = spawn ./examples/scripts/load_url_from_bookmarks.sh #parameter command examples (all need space but can be removed from individual commands). underscore is important. +/_ = search %s o _ = uri %s :wiki _ = uri http://wiki.archlinux.org/index.php/Special:Search?search=%s&go=Go gg _ = uri http://www.google.com/search?q=%s @@ -70,6 +70,7 @@ static char fifo_path[64]; static char socket_path[108]; static char executable_path[500]; static GString* keycmd; +static gchar searchtx[500] = "\0"; /* state variables (initial values coming from command line arguments but may be changed later) */ static gchar* uri = NULL; @@ -320,6 +321,7 @@ static struct {char *name; Command command;} cmdlist[] = { "toggle_status", toggle_status_cb }, { "spawn", spawn }, { "exit", close_uzbl }, + { "search", search_text }, { "insert_mode", set_insert_mode } }; @@ -388,6 +390,20 @@ load_uri (WebKitWebView * web_view, const gchar *param) { } static void +search_text (WebKitWebView *page, const char *param) { + if ((param) && (param[0] != '\0')) { + printf("\nima param!!!\n"); + strcpy(searchtx, param); + } + if (searchtx[0] != '\0') { + printf ("\n\nsearching: %s\n\n", searchtx); + webkit_web_view_mark_text_matches (page, searchtx, FALSE, 0); + webkit_web_view_set_highlight_text_matches (page, TRUE); + webkit_web_view_search_text (page, searchtx, FALSE, TRUE, TRUE); + } +} + +static void new_window_load_uri (const gchar * uri) { GString* to_execute = g_string_new (""); g_string_append_printf (to_execute, "%s --uri '%s'", executable_path, uri); @@ -742,6 +758,7 @@ key_press_cb (WebKitWebView* page, GdkEventKey* event) g_string_free (actionparam, TRUE); g_string_free (parampart, TRUE); g_string_truncate(keycmd, 0); + update_title(); } g_string_truncate(short_keys, short_keys->len - 1); @@ -116,4 +116,7 @@ add_binding (const gchar *key, const gchar *act); static void settings_init (); +static void +search_text (WebKitWebView *page, const char *param); + /* vi: set et ts=4: */ |