From d8728e61b587e80efe30f0fc198ed195b8067b3e Mon Sep 17 00:00:00 2001 From: Barrucadu Date: Sat, 2 May 2009 23:27:15 +0100 Subject: Added no_fifo and no_socket variables to config file. --- uzbl.c | 18 ++++++++++++++---- 1 file changed, 14 insertions(+), 4 deletions(-) (limited to 'uzbl.c') diff --git a/uzbl.c b/uzbl.c index f6234cd..b6795f9 100644 --- a/uzbl.c +++ b/uzbl.c @@ -90,6 +90,8 @@ static gboolean status_top = FALSE; static gchar* modkey = NULL; static guint modmask = 0; static guint http_debug = 0; +static gboolean no_fifo = FALSE; +static gboolean no_socket = FALSE; /* settings from config: group bindings, key -> action */ static GHashTable* bindings; @@ -838,6 +840,8 @@ settings_init () { if (! socket_dir) socket_dir = g_key_file_get_value (config, "behavior", "socket_dir", NULL); keys = g_key_file_get_keys (config, "bindings", NULL, NULL); + no_fifo = g_key_file_get_boolean (config, "behavior", "no_fifo", NULL); + no_socket = g_key_file_get_boolean (config, "behavior", "no_socket", NULL); } printf ("History handler: %s\n", (history_handler ? history_handler : "disabled")); @@ -848,6 +852,8 @@ settings_init () { printf ("Show status: %s\n", (show_status ? "TRUE" : "FALSE")); printf ("Status top: %s\n", (status_top ? "TRUE" : "FALSE")); printf ("Modkey: %s\n", (modkey ? modkey : "disabled")); + printf ("FIFO: %s\n", (no_fifo ? "disabled" : "enabled")); + printf ("Socket: %s\n", (no_socket ? "disabled" : "enabled")); if (! modkey) modkey = ""; @@ -980,15 +986,19 @@ main (int argc, char* argv[]) { if (!show_status) gtk_widget_hide(mainbar); - create_fifo (); - create_socket(); + if (!no_fifo) + create_fifo (); + if (!no_socket) + create_socket(); gtk_main (); g_string_free(keycmd, TRUE); - unlink (socket_path); - unlink (fifo_path); + if (!no_fifo) + unlink (fifo_path); + if (!no_socket) + unlink (socket_path); g_hash_table_destroy(bindings); g_hash_table_destroy(commands); -- cgit v1.2.3 From 8f9c1fbc0aa1cf4f848c859573b71390b058f5af Mon Sep 17 00:00:00 2001 From: Barrucadu Date: Sun, 3 May 2009 12:28:02 +0100 Subject: Removed no_fifo and no_socket variables. --- examples/configs/sampleconfig | 2 -- examples/configs/sampleconfig-dev | 2 -- uzbl.c | 18 ++++++------------ 3 files changed, 6 insertions(+), 16 deletions(-) (limited to 'uzbl.c') diff --git a/examples/configs/sampleconfig b/examples/configs/sampleconfig index 61ab373..3fddc89 100644 --- a/examples/configs/sampleconfig +++ b/examples/configs/sampleconfig @@ -19,8 +19,6 @@ always_insert_mode = 0 modkey = Mod1 show_status = 1 status_top = 0 -no_fifo = 0 -no_socket = 0 [bindings] # scroll down/up/left/right diff --git a/examples/configs/sampleconfig-dev b/examples/configs/sampleconfig-dev index c339c07..b151e92 100644 --- a/examples/configs/sampleconfig-dev +++ b/examples/configs/sampleconfig-dev @@ -19,8 +19,6 @@ always_insert_mode = 0 modkey = Mod1 show_status = 1 status_top = 0 -no_fifo = 0 -no_socket = 0 [bindings] ## scroll down/up/left/right diff --git a/uzbl.c b/uzbl.c index debef04..1730377 100644 --- a/uzbl.c +++ b/uzbl.c @@ -90,8 +90,6 @@ static gboolean status_top = FALSE; static gchar* modkey = NULL; static guint modmask = 0; static guint http_debug = 0; -static gboolean no_fifo = FALSE; -static gboolean no_socket = FALSE; /* settings from config: group bindings, key -> action */ static GHashTable* bindings; @@ -873,20 +871,16 @@ settings_init () { if (! socket_dir) socket_dir = g_key_file_get_value (config, "behavior", "socket_dir", NULL); keys = g_key_file_get_keys (config, "bindings", NULL, NULL); - no_fifo = g_key_file_get_boolean (config, "behavior", "no_fifo", NULL); - no_socket = g_key_file_get_boolean (config, "behavior", "no_socket", NULL); } printf ("History handler: %s\n", (history_handler ? history_handler : "disabled")); printf ("Download manager: %s\n", (download_handler ? download_handler : "disabled")); - printf ("Fifo directory: %s\n", (fifo_dir ? fifo_dir : "/tmp")); - printf ("Socket directory: %s\n", (socket_dir ? socket_dir : "/tmp")); + printf ("Fifo directory: %s\n", (fifo_dir ? fifo_dir : "disabled")); + printf ("Socket directory: %s\n", (socket_dir ? socket_dir : "disabled")); printf ("Always insert mode: %s\n", (always_insert_mode ? "TRUE" : "FALSE")); printf ("Show status: %s\n", (show_status ? "TRUE" : "FALSE")); printf ("Status top: %s\n", (status_top ? "TRUE" : "FALSE")); printf ("Modkey: %s\n", (modkey ? modkey : "disabled")); - printf ("FIFO: %s\n", (no_fifo ? "disabled" : "enabled")); - printf ("Socket: %s\n", (no_socket ? "disabled" : "enabled")); if (! modkey) modkey = ""; @@ -1019,18 +1013,18 @@ main (int argc, char* argv[]) { if (!show_status) gtk_widget_hide(mainbar); - if (!no_fifo) + if (fifo_dir) create_fifo (); - if (!no_socket) + if (socket_dir) create_socket(); gtk_main (); g_string_free(keycmd, TRUE); - if (!no_fifo) + if (fifo_dir) unlink (fifo_path); - if (!no_socket) + if (socket_dir) unlink (socket_path); g_hash_table_destroy(bindings); -- cgit v1.2.3 From 246be6d1a5cbe625cfe4c8a1b4a35c67ec0c0c0e Mon Sep 17 00:00:00 2001 From: Barrucadu Date: Sun, 3 May 2009 17:58:10 +0100 Subject: Fixed a warning. --- uzbl.c | 1 - 1 file changed, 1 deletion(-) (limited to 'uzbl.c') diff --git a/uzbl.c b/uzbl.c index ce80aa1..b0e669f 100644 --- a/uzbl.c +++ b/uzbl.c @@ -281,7 +281,6 @@ log_history_cb () { #define VIEWFUNC(name) static void view_##name(WebKitWebView *page, const char *param){(void)param; webkit_web_view_##name(page);} VIEWFUNC(reload) -VIEWFUNC(reload_bypass_cache) VIEWFUNC(stop_loading) VIEWFUNC(zoom_in) VIEWFUNC(zoom_out) -- cgit v1.2.3 From d0dfcc7ad664f4ff25ade28a38a2157ce4fda94d Mon Sep 17 00:00:00 2001 From: Barrucadu Date: Sun, 3 May 2009 19:03:59 +0100 Subject: Fixed code style error. --- uzbl.c | 35 +++++++++++++++++------------------ 1 file changed, 17 insertions(+), 18 deletions(-) (limited to 'uzbl.c') diff --git a/uzbl.c b/uzbl.c index b0e669f..2f24b56 100644 --- a/uzbl.c +++ b/uzbl.c @@ -469,24 +469,23 @@ build_stream_name(int type) { xwin_str = itos((int)xwin); switch(type) { - case FIFO: - if (fifo_dir) - sprintf (fifo_path, "%s/uzbl_fifo_%s", fifo_dir, - instance_name ? instance_name : xwin_str); - else - sprintf (fifo_path, "/tmp/uzbl_fifo_%s", - instance_name ? instance_name : xwin_str); - break; - case SOCKET: - if (socket_dir) - sprintf (socket_path, "%s/uzbl_socket_%s", socket_dir, - instance_name ? instance_name : xwin_str); - else - sprintf (socket_path, "/tmp/uzbl_socket_%s", - instance_name ? instance_name : xwin_str); - break; - default: - break; + case FIFO: + if (fifo_dir) { + sprintf (fifo_path, "%s/uzbl_fifo_%s", fifo_dir, instance_name ? instance_name : xwin_str); + } else { + sprintf (fifo_path, "/tmp/uzbl_fifo_%s", instance_name ? instance_name : xwin_str); + } + break; + + case SOCKET: + if (socket_dir) { + sprintf (socket_path, "%s/uzbl_socket_%s", socket_dir, instance_name ? instance_name : xwin_str); + } else { + sprintf (socket_path, "/tmp/uzbl_socket_%s", instance_name ? instance_name : xwin_str); + } + break; + default: + break; } g_free(xwin_str); } -- cgit v1.2.3 From 01cfcffd7762edd4bed94e91b2013890680765a9 Mon Sep 17 00:00:00 2001 From: Barrucadu Date: Sun, 3 May 2009 19:32:49 +0100 Subject: Added command "script" to run javascript on the current page. --- CHECKLIST | 1 + examples/configs/sampleconfig | 2 +- examples/configs/sampleconfig-dev | 1 + uzbl.c | 7 +++++++ uzbl.h | 3 +++ 5 files changed, 13 insertions(+), 1 deletion(-) (limited to 'uzbl.c') diff --git a/CHECKLIST b/CHECKLIST index 9a9bfbf..66f7bf6 100644 --- a/CHECKLIST +++ b/CHECKLIST @@ -34,3 +34,4 @@ Also testers and interested people can use this list to see what uzbl is about, * searching: /_ = search %s <-- hilight all ; = search <-- jump over all hits +* run javascript on curent page through "script" command. \ No newline at end of file diff --git a/examples/configs/sampleconfig b/examples/configs/sampleconfig index 6f4d8d9..e4fd3a6 100644 --- a/examples/configs/sampleconfig +++ b/examples/configs/sampleconfig @@ -50,7 +50,7 @@ B = spawn /usr/share/uzbl/examples/scripts/insert_bookmark.sh u = spawn /usr/share/uzbl/examples/scripts/load_url_from_history.sh U = spawn /usr/share/uzbl/examples/scripts/load_url_from_bookmarks.sh ZZ = exit - +S = script alert("hi"); [network] proxy_server = diff --git a/examples/configs/sampleconfig-dev b/examples/configs/sampleconfig-dev index 7e1e31d..7ce220f 100644 --- a/examples/configs/sampleconfig-dev +++ b/examples/configs/sampleconfig-dev @@ -50,6 +50,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 ZZ = exit +S = script alert("hi"); [network] # to start a local socks server, do : ssh -fND localhost:8118 localhost diff --git a/uzbl.c b/uzbl.c index 2f24b56..edd0b38 100644 --- a/uzbl.c +++ b/uzbl.c @@ -303,6 +303,7 @@ static struct {char *name; Command command;} cmdlist[] = { "zoom_in", view_zoom_in, }, //Can crash (when max zoom reached?). { "zoom_out", view_zoom_out, }, { "uri", load_uri }, + { "script", run_js }, { "toggle_status", toggle_status_cb }, { "spawn", spawn }, { "exit", close_uzbl }, @@ -374,6 +375,12 @@ load_uri (WebKitWebView * web_view, const gchar *param) { } } +static void +run_js (WebKitWebView * web_view, const gchar *param) { + if (param) + webkit_web_view_execute_script (web_view, param); +} + static void search_text (WebKitWebView *page, const char *param) { if ((param) && (param[0] != '\0')) { diff --git a/uzbl.h b/uzbl.h index f9e3053..f81e3f6 100644 --- a/uzbl.h +++ b/uzbl.h @@ -119,4 +119,7 @@ settings_init (); static void search_text (WebKitWebView *page, const char *param); +static void +run_js (WebKitWebView * web_view, const gchar *param); + /* vi: set et ts=4: */ -- cgit v1.2.3