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 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