From 5d4ce25afe538dad351d2b0fa37bc5f4c15967bd Mon Sep 17 00:00:00 2001 From: Barrucadu Date: Mon, 27 Apr 2009 21:50:37 +0100 Subject: Fixed XDG config dir implementation. Now looks for $XDG_CONFIG_HOME/uzbl/config. --- uzbl.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) (limited to 'uzbl.c') diff --git a/uzbl.c b/uzbl.c index 3528bf4..895d880 100644 --- a/uzbl.c +++ b/uzbl.c @@ -457,7 +457,7 @@ settings_init () { printf("XDG_CONFIG_HOME: %s\n", XDG_CONFIG_HOME); strcpy (conf, XDG_CONFIG_HOME); - strcat (conf, "/uzbl"); + strcat (conf, "/uzbl/config"); if (file_exists (conf)) { printf ("Config file %s found.\n", conf); config_file = &conf[0]; @@ -473,7 +473,7 @@ settings_init () { char *dir = (char *)strtok (dirs, ":"); while (dir && ! file_exists (conf)) { strcpy (conf, dir); - strcat (conf, "/uzbl"); + strcat (conf, "/uzbl/config"); if (file_exists (conf)) { printf ("Config file %s found.\n", conf); config_file = &conf[0]; -- cgit v1.2.3 From e6f0542071874fdc4d041e9f2161e0f0bac2ecf4 Mon Sep 17 00:00:00 2001 From: dusanx Date: Mon, 27 Apr 2009 22:57:38 +0200 Subject: Uri check -- append http:// if needed --- CHECKLIST | 5 ++++- uzbl.c | 19 +++++++++++++++---- 2 files changed, 19 insertions(+), 5 deletions(-) (limited to 'uzbl.c') diff --git a/CHECKLIST b/CHECKLIST index c2a722a..454ccaa 100644 --- a/CHECKLIST +++ b/CHECKLIST @@ -14,6 +14,9 @@ Also testers and interested people can use this list to see what uzbl is about, * invocations of external commands: you'll see it on stdout everytime uzbl calls an external script/program. the invocations should work and none of the arguments passed should be null/garbage/.. . all should be valid strings and contain things like the pid, fifo file, config file,.. (see README for details). * XDG_CONFIG_HOME and XDG_CONFIG_DIRS (+ default values) fully supported and working (looks for a config file called 'uzbl'). +* --uri can be specified without http:// -- if missing will be prepended. TODO: add stuff about internal/external keybinds, mod key, insert mode, status bar, -behavior settings,.... \ No newline at end of file +behavior settings,.... + +TODO: add 'http://' to url if there is no substr '://' diff --git a/uzbl.c b/uzbl.c index 3528bf4..da73bfe 100644 --- a/uzbl.c +++ b/uzbl.c @@ -214,9 +214,20 @@ static Command commands[] = /* -- CORE FUNCTIONS -- */ +static gchar* +uricheck (gchar* uri) { + if (g_strrstr (uri,"://") == NULL) { + GString* newuri = g_string_new (uri); + free(uri); + g_string_prepend (newuri, "http://"); + uri = g_string_free (newuri, FALSE); + } + return (uri); +} + + static bool -file_exists (const char * filename) -{ +file_exists (const char * filename) { FILE *file = fopen (filename, "r"); if (file) { fclose (file); @@ -260,7 +271,7 @@ parse_command(const char *cmd) { if (c->func_2_params != NULL) { if (command_param != NULL) { printf ("command executing: \"%s %s\"\n", command_name, command_param); - c->func_2_params (web_view, command_param); + c->func_2_params (web_view, uricheck(command_param)); } else { if (c->func_1_param != NULL) { printf ("command executing: \"%s\"\n", command_name); @@ -605,7 +616,7 @@ main (int argc, char* argv[]) { main_window = create_window (); gtk_container_add (GTK_CONTAINER (main_window), vbox); - webkit_web_view_load_uri (web_view, uri); + webkit_web_view_load_uri (web_view, uricheck(uri)); gtk_widget_grab_focus (GTK_WIDGET (web_view)); gtk_widget_show_all (main_window); -- cgit v1.2.3 From b6b60c7b63baa5e900fcfa88bfbc8f2504d1b80e Mon Sep 17 00:00:00 2001 From: Dieter Plaetinck Date: Mon, 27 Apr 2009 23:36:20 +0200 Subject: fix for http:// adding automatically. segfaults --- uzbl.c | 25 +++++++++++++++++++++++-- 1 file changed, 23 insertions(+), 2 deletions(-) (limited to 'uzbl.c') diff --git a/uzbl.c b/uzbl.c index 895d880..e98d10e 100644 --- a/uzbl.c +++ b/uzbl.c @@ -107,6 +107,9 @@ char *XDG_CONFIG_DIRS_default = "/etc/xdg"; static void update_title (GtkWindow* window); +static void +load_uri ( WebKitWebView * web_view, gchar * uri); + static gboolean run_command(const char *command, const char *args); @@ -207,13 +210,25 @@ static Command commands[] = { "stop", &webkit_web_view_stop_loading, NULL }, { "zoom_in", &webkit_web_view_zoom_in, NULL }, //Can crash (when max zoom reached?). { "zoom_out", &webkit_web_view_zoom_out, NULL }, - { "uri", NULL, &webkit_web_view_load_uri }, + { "uri", NULL, &load_uri }, { "toggle_status", &toggle_status_cb, NULL } //{ "get uri", &webkit_web_view_get_uri}, }; /* -- CORE FUNCTIONS -- */ +static gchar* +uricheck (gchar* uri) { + if (g_strrstr (uri,"://") == NULL){ + GString* newuri = g_string_new (uri); + free(uri); + g_string_prepend (newuri, "http://"); + uri = g_string_free (newuri, FALSE); + } + return (uri); +} + + static bool file_exists (const char * filename) { @@ -225,6 +240,12 @@ file_exists (const char * filename) return false; } +static void +load_uri ( WebKitWebView * web_view, gchar * uri) { + webkit_web_view_load_uri (web_view, uricheck(uri)); +} + + // make sure to put '' around args, so that if there is whitespace we can still keep arguments together. static gboolean run_command(const char *command, const char *args) { @@ -605,7 +626,7 @@ main (int argc, char* argv[]) { main_window = create_window (); gtk_container_add (GTK_CONTAINER (main_window), vbox); - webkit_web_view_load_uri (web_view, uri); + load_uri (web_view, uri); gtk_widget_grab_focus (GTK_WIDGET (web_view)); gtk_widget_show_all (main_window); -- cgit v1.2.3 From 25f4443fb0ccad632f46f83d43319b0d1f7acfc2 Mon Sep 17 00:00:00 2001 From: Barrucadu Date: Mon, 27 Apr 2009 23:16:45 +0100 Subject: Lots of fiddling with load_uri and uricheck. Segfaults when loading a URI. Irritating. --- uzbl.c | 25 +++++++++++++++---------- 1 file changed, 15 insertions(+), 10 deletions(-) (limited to 'uzbl.c') diff --git a/uzbl.c b/uzbl.c index e98d10e..aa1660d 100644 --- a/uzbl.c +++ b/uzbl.c @@ -210,7 +210,7 @@ static Command commands[] = { "stop", &webkit_web_view_stop_loading, NULL }, { "zoom_in", &webkit_web_view_zoom_in, NULL }, //Can crash (when max zoom reached?). { "zoom_out", &webkit_web_view_zoom_out, NULL }, - { "uri", NULL, &load_uri }, + { "uri", (void *) NULL, &load_uri }, { "toggle_status", &toggle_status_cb, NULL } //{ "get uri", &webkit_web_view_get_uri}, }; @@ -219,13 +219,13 @@ static Command commands[] = static gchar* uricheck (gchar* uri) { - if (g_strrstr (uri,"://") == NULL){ - GString* newuri = g_string_new (uri); - free(uri); - g_string_prepend (newuri, "http://"); - uri = g_string_free (newuri, FALSE); - } - return (uri); + if (! uri == NULL && g_strrstr (uri, "://") == NULL){ + GString newuri[512]; + strcpy ((char *)newuri, "http://"); + strcat ((char *)newuri, (char *)uri); + strcpy ((char *)uri, (char *)newuri); + } + return uri; } @@ -241,8 +241,13 @@ file_exists (const char * filename) } static void -load_uri ( WebKitWebView * web_view, gchar * uri) { - webkit_web_view_load_uri (web_view, uricheck(uri)); +load_uri (WebKitWebView * web_view, gchar * uri) { + if (! uri == NULL) { + const gchar* newuri = uricheck (uri); + g_assert (newuri); + + webkit_web_view_load_uri (web_view, newuri); + } } -- cgit v1.2.3 From 5d0a67929ce39365c9b7a46250c88af511e43c2f Mon Sep 17 00:00:00 2001 From: dusanx Date: Tue, 28 Apr 2009 01:00:44 +0200 Subject: Proper uri handling, fixed segfault --- uzbl.c | 28 +++++++++++----------------- 1 file changed, 11 insertions(+), 17 deletions(-) (limited to 'uzbl.c') diff --git a/uzbl.c b/uzbl.c index 1b4cd8b..309ff6a 100644 --- a/uzbl.c +++ b/uzbl.c @@ -108,7 +108,7 @@ static void update_title (GtkWindow* window); static void -load_uri ( WebKitWebView * web_view, gchar * uri); +load_uri ( WebKitWebView * web_view, const gchar * uri); static gboolean run_command(const char *command, const char *args); @@ -217,18 +217,6 @@ static Command commands[] = /* -- CORE FUNCTIONS -- */ -static gchar* -uricheck (gchar* uri) { - if (g_strrstr (uri,"://") == NULL) { - GString* newuri = g_string_new (uri); - free(uri); - g_string_prepend (newuri, "http://"); - uri = g_string_free (newuri, FALSE); - } - return (uri); -} - - static bool file_exists (const char * filename) { FILE *file = fopen (filename, "r"); @@ -240,8 +228,14 @@ file_exists (const char * filename) { } static void -load_uri ( WebKitWebView * web_view, gchar * uri) { - webkit_web_view_load_uri (web_view, uricheck(uri)); +load_uri (WebKitWebView * web_view, const gchar * uri) { + if (uri != NULL) { + GString* newuri = g_string_new (uri); + if (g_strrstr (uri, "://") == NULL) + g_string_prepend (newuri, "http://"); + webkit_web_view_load_uri (web_view, newuri->str); + g_string_free (newuri, TRUE); + } } @@ -280,7 +274,7 @@ parse_command(const char *cmd) { if (c->func_2_params != NULL) { if (command_param != NULL) { printf ("command executing: \"%s %s\"\n", command_name, command_param); - c->func_2_params (web_view, uricheck(command_param)); + c->func_2_params (web_view, command_param); } else { if (c->func_1_param != NULL) { printf ("command executing: \"%s\"\n", command_name); @@ -625,7 +619,7 @@ main (int argc, char* argv[]) { main_window = create_window (); gtk_container_add (GTK_CONTAINER (main_window), vbox); - webkit_web_view_load_uri (web_view, uricheck(uri)); + load_uri (web_view, uri); gtk_widget_grab_focus (GTK_WIDGET (web_view)); gtk_widget_show_all (main_window); -- cgit v1.2.3 From 3e42283eb5eb296ecac9b9219cdc728e92b3c287 Mon Sep 17 00:00:00 2001 From: dusanx Date: Tue, 28 Apr 2009 02:35:24 +0200 Subject: Download and open in new window --- CHECKLIST | 2 ++ uzbl.c | 24 ++++++++++++++++++++++++ 2 files changed, 26 insertions(+) (limited to 'uzbl.c') diff --git a/CHECKLIST b/CHECKLIST index 454ccaa..790fe69 100644 --- a/CHECKLIST +++ b/CHECKLIST @@ -15,6 +15,8 @@ Also testers and interested people can use this list to see what uzbl is about, all should be valid strings and contain things like the pid, fifo file, config file,.. (see README for details). * XDG_CONFIG_HOME and XDG_CONFIG_DIRS (+ default values) fully supported and working (looks for a config file called 'uzbl'). * --uri can be specified without http:// -- if missing will be prepended. +* Download completely finished +* Open in new window partially finished: target _new works, from popup meny does not work yet TODO: add stuff about internal/external keybinds, mod key, insert mode, status bar, behavior settings,.... diff --git a/uzbl.c b/uzbl.c index 309ff6a..f76642c 100644 --- a/uzbl.c +++ b/uzbl.c @@ -115,6 +115,28 @@ run_command(const char *command, const char *args); /* --- CALLBACKS --- */ +static gboolean +new_window_cb (WebKitWebView *web_view, WebKitWebFrame *frame, WebKitNetworkRequest *request, WebKitWebNavigationAction *navigation_action, WebKitWebPolicyDecision *policy_decision, gpointer user_data) { + (void) web_view; + (void) frame; + (void) navigation_action; + (void) policy_decision; + (void) user_data; + const gchar* uri = webkit_network_request_get_uri (request); + printf("New window requested -> %s \n", uri); + return (FALSE); +} + +static gboolean +download_cb (WebKitWebView *web_view, GObject *download, gpointer user_data) { + (void) web_view; + (void) user_data; + const gchar* uri = webkit_download_get_uri ((WebKitDownload*)download); + printf("Download -> %s\n",uri); + run_command(download_handler, uri); + return (FALSE); +} + static void go_back_cb (WebKitWebView* page) { (void) page; @@ -419,6 +441,8 @@ create_browser () { g_signal_connect (G_OBJECT (web_view), "load-committed", G_CALLBACK (log_history_cb), web_view); g_signal_connect (G_OBJECT (web_view), "hovering-over-link", G_CALLBACK (link_hover_cb), web_view); g_signal_connect (G_OBJECT (web_view), "key-press-event", G_CALLBACK (key_press_cb), web_view); + g_signal_connect (G_OBJECT (web_view), "new-window-policy-decision-requested", G_CALLBACK (new_window_cb), web_view); + g_signal_connect (G_OBJECT (web_view), "download-requested", G_CALLBACK (download_cb), web_view); return scrolled_window; } -- cgit v1.2.3 From 5879bdab1d267e0de73982f844a63bf9c67e84b8 Mon Sep 17 00:00:00 2001 From: dusanx Date: Tue, 28 Apr 2009 08:29:51 +0200 Subject: Follow in new window opens new window, memory leaks fixed --- uzbl.c | 19 +++++++++++++++---- 1 file changed, 15 insertions(+), 4 deletions(-) (limited to 'uzbl.c') diff --git a/uzbl.c b/uzbl.c index f76642c..0bbcf73 100644 --- a/uzbl.c +++ b/uzbl.c @@ -124,6 +124,15 @@ new_window_cb (WebKitWebView *web_view, WebKitWebFrame *frame, WebKitNetworkRequ (void) user_data; const gchar* uri = webkit_network_request_get_uri (request); printf("New window requested -> %s \n", uri); + gboolean result; + GString* to_execute = g_string_new (""); + g_string_printf (to_execute, "uzbl --uri '%s'", uri); + result = g_spawn_command_line_async (to_execute->str, NULL); + if (!result) { + g_string_printf (to_execute, "./uzbl --uri '%s'", uri); + result = g_spawn_command_line_async (to_execute->str, NULL); + } + g_string_free (to_execute, TRUE); return (FALSE); } @@ -219,6 +228,7 @@ log_history_cb () { GString* args = g_string_new (""); g_string_printf (args, "'%s' '%s' '%s'", uri, "TODO:page title here", date); run_command(history_handler, args->str); + g_string_free (args, TRUE); } } @@ -273,6 +283,7 @@ run_command(const char *command, const char *args) { } result = g_spawn_command_line_async (to_execute->str, NULL); printf("Called %s. Result: %s\n", to_execute->str, (result ? "TRUE" : "FALSE" )); + g_string_free (to_execute, TRUE); return result; } @@ -282,8 +293,8 @@ parse_command(const char *cmd) { Command *c = NULL; char buffer[512]; strcpy (buffer, cmd); - char * command_name = strtok (buffer, " "); - gchar * command_param = strtok (NULL, " ,"); + const gchar * command_name = strtok (buffer, " "); + const gchar * command_param = strtok (NULL, " ,"); Command *c_tmp = NULL; for (i = 0; i < LENGTH (commands); i++) { @@ -597,7 +608,7 @@ settings_init () { free (modkeyup); if (keysi) { - int i = 0; + int i = 0; for (i = 0; keysi[i]; i++) { gchar *binding = g_key_file_get_string (config, "bindings_internal", keysi[i], NULL); printf ("Action: %s, Binding: %s (internal)\n", g_strdup (keysi[i]), binding); @@ -605,7 +616,7 @@ settings_init () { } } if (keyse) { - int i = 0; + int i = 0; for (i = 0; keyse[i]; i++) { gchar *binding = g_key_file_get_string (config, "bindings_external", keyse[i], NULL); printf ("Action: %s, Binding: %s (external)\n", g_strdup (keyse[i]), binding); -- cgit v1.2.3 From 5586e11f8ac6265472b92dbb9a99ff0b7052d1e2 Mon Sep 17 00:00:00 2001 From: dusanx Date: Tue, 28 Apr 2009 08:57:36 +0200 Subject: Segfault fix --- uzbl.c | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) (limited to 'uzbl.c') diff --git a/uzbl.c b/uzbl.c index 0bbcf73..8eefe84 100644 --- a/uzbl.c +++ b/uzbl.c @@ -206,7 +206,9 @@ static void load_commit_cb (WebKitWebView* page, WebKitWebFrame* frame, gpointer data) { (void) page; (void) data; - strcpy (uri, webkit_web_frame_get_uri (frame)); + free (uri); + GString* newuri = g_string_new (webkit_web_frame_get_uri (frame)); + uri = g_string_free (newuri, FALSE); } static void -- cgit v1.2.3 From 19db1dd05caf52db5d8d5c5187f1406fd99a9627 Mon Sep 17 00:00:00 2001 From: Barrucadu Date: Tue, 28 Apr 2009 08:12:16 +0100 Subject: Added 'exit' command (bound to 'k' by default). --- examples/configs/sampleconfig | 1 + examples/configs/sampleconfig-dev | 1 + uzbl.c | 12 +++++++++++- 3 files changed, 13 insertions(+), 1 deletion(-) (limited to 'uzbl.c') diff --git a/examples/configs/sampleconfig b/examples/configs/sampleconfig index b92acc2..94cbbb8 100644 --- a/examples/configs/sampleconfig +++ b/examples/configs/sampleconfig @@ -32,6 +32,7 @@ follow_link_new_window = w zoom_in = + zoom_out = - toggle_status = t +exit = k [bindings_external] /bin/bash /usr/share/uzbl/examples/scripts/insert_bookmark.sh = B diff --git a/examples/configs/sampleconfig-dev b/examples/configs/sampleconfig-dev index f7f3bb7..4281ab8 100644 --- a/examples/configs/sampleconfig-dev +++ b/examples/configs/sampleconfig-dev @@ -32,6 +32,7 @@ follow_link_new_window = w zoom_in = + zoom_out = - toggle_status = t +exit = k [bindings_external] /bin/bash ./examples/scripts/insert_bookmark.sh = B diff --git a/uzbl.c b/uzbl.c index 438dae3..422607f 100644 --- a/uzbl.c +++ b/uzbl.c @@ -110,6 +110,9 @@ update_title (GtkWindow* window); static void load_uri ( WebKitWebView * web_view, const gchar * uri); +static void +close_uzbl ( WebKitWebView * web_view); + static gboolean run_command(const char *command, const char *args); @@ -245,7 +248,8 @@ static Command commands[] = { "zoom_in", &webkit_web_view_zoom_in, NULL }, //Can crash (when max zoom reached?). { "zoom_out", &webkit_web_view_zoom_out, NULL }, { "uri", (void *) NULL, &load_uri }, - { "toggle_status", &toggle_status_cb, NULL } + { "toggle_status", &toggle_status_cb, NULL }, + { "exit" , &close_uzbl, NULL }, //{ "get uri", &webkit_web_view_get_uri}, }; @@ -273,6 +277,12 @@ load_uri (WebKitWebView * web_view, const gchar * uri) { } +static void +close_uzbl (WebKitWebView * web_view) { + (void) web_view; + gtk_main_quit (); +} + // make sure to put '' around args, so that if there is whitespace we can still keep arguments together. static gboolean run_command(const char *command, const char *args) { -- cgit v1.2.3 From 80dedbd75159292dceea87bab4c5b90fd1bdd33e Mon Sep 17 00:00:00 2001 From: dusanx Date: Tue, 28 Apr 2009 10:33:29 +0200 Subject: Possible Debian segfault fix --- uzbl.c | 7 ++++--- 1 file changed, 4 insertions(+), 3 deletions(-) (limited to 'uzbl.c') diff --git a/uzbl.c b/uzbl.c index 8eefe84..ee10237 100644 --- a/uzbl.c +++ b/uzbl.c @@ -520,8 +520,9 @@ settings_init () { printf("XDG_CONFIG_DIRS: %s\n", XDG_CONFIG_DIRS); - char *dirs = XDG_CONFIG_DIRS; - char *dir = (char *)strtok (dirs, ":"); + char buffer[512]; + strcpy (buffer, XDG_CONFIG_DIRS); + const gchar* dir = strtok (buffer, ":"); while (dir && ! file_exists (conf)) { strcpy (conf, dir); strcat (conf, "/uzbl/config"); @@ -529,7 +530,7 @@ settings_init () { printf ("Config file %s found.\n", conf); config_file = &conf[0]; } - dir = (char *)strtok (NULL, ":"); + dir = strtok (NULL, ":"); } } } -- cgit v1.2.3 From 7446b36ea6a2067186cf5a25ccd99e16ecc95dcc Mon Sep 17 00:00:00 2001 From: Barrucadu Date: Tue, 28 Apr 2009 17:29:25 +0100 Subject: Tidied up settings loading code. Added home_page parameter to config, and added go_home function. --- examples/configs/sampleconfig | 1 + examples/configs/sampleconfig-dev | 1 + uzbl.c | 69 ++++++++++++++++++--------------------- 3 files changed, 33 insertions(+), 38 deletions(-) (limited to 'uzbl.c') diff --git a/examples/configs/sampleconfig b/examples/configs/sampleconfig index 94cbbb8..03f963d 100644 --- a/examples/configs/sampleconfig +++ b/examples/configs/sampleconfig @@ -18,6 +18,7 @@ always_insert_mode = 0 modkey = Mod1 show_status = 1 status_top = 0 +home_page = http://www.uzbl.org [bindings_internal] back = b diff --git a/examples/configs/sampleconfig-dev b/examples/configs/sampleconfig-dev index 4281ab8..9d890b60 100644 --- a/examples/configs/sampleconfig-dev +++ b/examples/configs/sampleconfig-dev @@ -18,6 +18,7 @@ always_insert_mode = 0 modkey = Mod1 show_status = 1 status_top = 0 +home_page = http://www.uzbl.org [bindings_internal] back = b diff --git a/uzbl.c b/uzbl.c index a2c6931..dc38794 100644 --- a/uzbl.c +++ b/uzbl.c @@ -69,6 +69,7 @@ static gboolean insert_mode = FALSE; static gboolean status_top = FALSE; static gchar* modkey = NULL; static guint modmask = 0; +static gchar* home_page = NULL; typedef struct { const char *binding; @@ -110,6 +111,9 @@ update_title (GtkWindow* window); static void load_uri ( WebKitWebView * web_view, const gchar * uri); +static void +go_home ( WebKitWebView * web_view); + static void close_uzbl ( WebKitWebView * web_view); @@ -249,6 +253,7 @@ static Command commands[] = { "zoom_out", &webkit_web_view_zoom_out, NULL }, { "uri", (void *) NULL, &load_uri }, { "toggle_status", &toggle_status_cb, NULL }, + { "home" , &go_home, NULL }, { "exit" , &close_uzbl, NULL }, //{ "get uri", &webkit_web_view_get_uri}, }; @@ -276,6 +281,11 @@ load_uri (WebKitWebView * web_view, const gchar * uri) { } } +static void +go_home (WebKitWebView * web_view) { + if (home_page) + webkit_web_view_load_uri (web_view, home_page); +} static void close_uzbl (WebKitWebView * web_view) { @@ -414,7 +424,7 @@ key_press_cb (WebKitWebView* page, GdkEventKey* event) (void) page; int i; gboolean result=FALSE; //TRUE to stop other handlers from being invoked for the event. FALSE to propagate the event further. - if (event->type != GDK_KEY_PRESS) + if (event->type != GDK_KEY_PRESS) return result; //TURN OFF/ON INSERT MODE @@ -558,48 +568,31 @@ settings_init () { } if (res) { - history_handler = g_key_file_get_value (config, "behavior", "history_handler", NULL); - download_handler = g_key_file_get_value (config, "behavior", "download_handler", NULL); + history_handler = g_key_file_get_value (config, "behavior", "history_handler", NULL); + download_handler = g_key_file_get_value (config, "behavior", "download_handler", NULL); always_insert_mode = g_key_file_get_boolean (config, "behavior", "always_insert_mode", NULL); - show_status = g_key_file_get_boolean (config, "behavior", "show_status", NULL); - modkey = g_key_file_get_value (config, "behavior", "modkey", NULL); - keysi = g_key_file_get_keys (config, "bindings_internal", NULL, NULL); - keyse = g_key_file_get_keys (config, "bindings_external", NULL, NULL); - status_top = g_key_file_get_boolean (config, "behavior", "status_top", NULL); + show_status = g_key_file_get_boolean (config, "behavior", "show_status", NULL); + modkey = g_key_file_get_value (config, "behavior", "modkey", NULL); + keysi = g_key_file_get_keys (config, "bindings_internal", NULL, NULL); + keyse = g_key_file_get_keys (config, "bindings_external", NULL, NULL); + status_top = g_key_file_get_boolean (config, "behavior", "status_top", NULL); + home_page = g_key_file_get_value (config, "behavior", "home_page", NULL); if (! fifodir) - fifodir = g_key_file_get_value (config, "behavior", "fifodir", NULL); + fifodir = g_key_file_get_value (config, "behavior", "fifodir", NULL); } - if (history_handler) { - printf ("History handler: %s\n", history_handler); - } else { - printf ("History handler disabled\n"); - } - - if (download_handler) { - printf ("Download manager: %s\n", download_handler); - } else { - printf ("Download manager disabled\n"); - } + 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", (fifodir ? fifodir : "/tmp")); + 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 ("Home page: %s\n", (home_page ? home_page : "disabled")); + + if (! modkey) + modkey = ""; - if (fifodir) { - printf ("Fifo directory: %s\n", fifodir); - } else { - printf ("Fifo directory: /tmp\n"); - } - - 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")); - - if (modkey) { - printf ("Modkey: %s\n", modkey); - } else { - printf ("Modkey disabled\n"); - modkey = ""; - } //POSSIBLE MODKEY VALUES (COMBINATIONS CAN BE USED) gchar* modkeyup = g_utf8_strup (modkey, -1); if (g_strrstr (modkeyup,"SHIFT") != NULL) modmask |= GDK_SHIFT_MASK; //the Shift key. -- cgit v1.2.3 From 4ac4d3369870d02526a81de8b73c467974d16a94 Mon Sep 17 00:00:00 2001 From: Dieter Plaetinck Date: Tue, 28 Apr 2009 21:53:57 +0200 Subject: fix for when handler == NULL --- uzbl.c | 8 +++++--- 1 file changed, 5 insertions(+), 3 deletions(-) (limited to 'uzbl.c') diff --git a/uzbl.c b/uzbl.c index dc38794..86ffb6c 100644 --- a/uzbl.c +++ b/uzbl.c @@ -147,9 +147,11 @@ static gboolean download_cb (WebKitWebView *web_view, GObject *download, gpointer user_data) { (void) web_view; (void) user_data; - const gchar* uri = webkit_download_get_uri ((WebKitDownload*)download); - printf("Download -> %s\n",uri); - run_command(download_handler, uri); + if (download_handler) { + const gchar* uri = webkit_download_get_uri ((WebKitDownload*)download); + printf("Download -> %s\n",uri); + run_command(download_handler, uri); + } return (FALSE); } -- cgit v1.2.3