diff options
-rw-r--r-- | CHECKLIST | 7 | ||||
-rw-r--r-- | uzbl.c | 54 |
2 files changed, 39 insertions, 22 deletions
@@ -14,6 +14,11 @@ 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. +* 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,....
\ No newline at end of file +behavior settings,.... + +TODO: add 'http://' to url if there is no substr '://' @@ -108,13 +108,35 @@ 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); /* --- 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; @@ -217,21 +239,8 @@ static Command commands[] = /* -- CORE FUNCTIONS -- */ -static gchar* -uricheck (gchar* 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; -} - - static bool -file_exists (const char * filename) -{ +file_exists (const char * filename) { FILE *file = fopen (filename, "r"); if (file) { fclose (file); @@ -241,12 +250,13 @@ file_exists (const char * filename) } static void -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); +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); } } @@ -431,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; } |