aboutsummaryrefslogtreecommitdiffhomepage
path: root/src/uzbl-core.c
diff options
context:
space:
mode:
Diffstat (limited to 'src/uzbl-core.c')
-rw-r--r--src/uzbl-core.c52
1 files changed, 49 insertions, 3 deletions
diff --git a/src/uzbl-core.c b/src/uzbl-core.c
index d73fbdf..204c89c 100644
--- a/src/uzbl-core.c
+++ b/src/uzbl-core.c
@@ -551,7 +551,9 @@ CommandInfo cmdlist[] =
{ "include", include, TRUE },
{ "show_inspector", show_inspector, 0 },
{ "add_cookie", add_cookie, 0 },
- { "delete_cookie", delete_cookie, 0 }
+ { "delete_cookie", delete_cookie, 0 },
+ { "clear_cookies", clear_cookies, 0 },
+ { "download", download, 0 }
};
void
@@ -725,6 +727,42 @@ delete_cookie(WebKitWebView *page, GArray *argv, GString *result) {
uzbl.net.soup_cookie_jar->in_manual_add = 0;
}
+
+void
+clear_cookies(WebKitWebView *page, GArray *argv, GString *result) {
+ (void) page; (void) argv; (void) result;
+
+ // Replace the current cookie jar with a new empty jar
+ soup_session_remove_feature (uzbl.net.soup_session,
+ SOUP_SESSION_FEATURE (uzbl.net.soup_cookie_jar));
+ g_object_unref (G_OBJECT (uzbl.net.soup_cookie_jar));
+ uzbl.net.soup_cookie_jar = uzbl_cookie_jar_new ();
+ soup_session_add_feature(uzbl.net.soup_session,
+ SOUP_SESSION_FEATURE (uzbl.net.soup_cookie_jar));
+}
+
+void
+download(WebKitWebView *web_view, GArray *argv, GString *result) {
+ (void) result;
+
+ const gchar *uri = argv_idx(argv, 0);
+ const gchar *destination = NULL;
+ if(argv->len > 1)
+ destination = argv_idx(argv, 1);
+
+ WebKitNetworkRequest *req = webkit_network_request_new(uri);
+ WebKitDownload *download = webkit_download_new(req);
+
+ download_cb(web_view, download, destination);
+
+ if(webkit_download_get_destination_uri(download))
+ webkit_download_start(download);
+ else
+ g_object_unref(download);
+
+ g_object_unref(req);
+}
+
void
act_dump_config() {
dump_config();
@@ -1116,8 +1154,6 @@ spawn_sh_sync(WebKitWebView *web_view, GArray *argv, GString *result) {
void
run_parsed_command(const CommandInfo *c, GArray *a, GString *result) {
- c->function(uzbl.gui.web_view, a, result);
-
/* send the COMMAND_EXECUTED event, except for set and event/request commands */
if(strcmp("set", c->key) &&
strcmp("event", c->key) &&
@@ -1128,12 +1164,18 @@ run_parsed_command(const CommandInfo *c, GArray *a, GString *result) {
guint i = 0;
while ((p = argv_idx(a, i++)))
g_string_append_printf(param, " '%s'", p);
+
+ /* might be destructive on array a */
+ c->function(uzbl.gui.web_view, a, result);
+
send_event(COMMAND_EXECUTED, NULL,
TYPE_NAME, c->key,
TYPE_FORMATTEDSTR, param->str,
NULL);
g_string_free(param, TRUE);
}
+ else
+ c->function(uzbl.gui.web_view, a, result);
if(result) {
g_free(uzbl.state.last_result);
@@ -1478,6 +1520,10 @@ create_window() {
gtk_widget_set_name (window, "Uzbl browser");
gtk_window_set_title(GTK_WINDOW(window), "Uzbl browser");
+#if GTK_CHECK_VERSION(3,0,0)
+ gtk_window_set_has_resize_grip (window, FALSE);
+#endif
+
/* if the window has been made small, it shouldn't try to resize itself due
* to a long statusbar. */
GdkGeometry hints;