aboutsummaryrefslogtreecommitdiffhomepage
path: root/src
diff options
context:
space:
mode:
authorGravatar koral <koral@mailoo.org>2011-02-02 16:29:46 +0100
committerGravatar koral <koral@mailoo.org>2011-02-02 16:29:46 +0100
commitf9920be8b0a74af775e20ef83f76fab7662ee120 (patch)
tree137a4ae47ffd63ac32d5c165465f6092e1f43927 /src
parent7fbebb427be655ee17de0b786e0ce9a3d86ea3d8 (diff)
parent835f5d8d09b429a4776192dbe00be5ae20704b16 (diff)
Merge branch 'experimental' of https://github.com/Dieterbe/uzbl into cleaning-commenting
Diffstat (limited to 'src')
-rw-r--r--src/callbacks.c13
-rw-r--r--src/uzbl-core.c55
2 files changed, 15 insertions, 53 deletions
diff --git a/src/callbacks.c b/src/callbacks.c
index f6fe284..b947c8e 100644
--- a/src/callbacks.c
+++ b/src/callbacks.c
@@ -831,16 +831,19 @@ download_cb(WebKitWebView *web_view, WebKitDownload *download, gpointer user_dat
g_object_get(download, "suggested-filename", &suggested_filename, NULL);
/* get the mimetype of the download */
- const gchar *content_type;
+ const gchar *content_type = NULL;
WebKitNetworkResponse *r = webkit_download_get_network_response(download);
/* downloads can be initiated from the context menu, in that case there is
no network response yet and trying to get one would crash. */
if(WEBKIT_IS_NETWORK_RESPONSE(r)) {
- SoupMessage *m = webkit_network_response_get_message(r);
- SoupMessageHeaders *h;
+ SoupMessage *m = webkit_network_response_get_message(r);
+ SoupMessageHeaders *h = NULL;
g_object_get(m, "response-headers", &h, NULL);
- content_type = soup_message_headers_get_one(h, "Content-Type");
- } else
+ if(h) /* some versions of libsoup don't have "response-headers" here */
+ content_type = soup_message_headers_get_one(h, "Content-Type");
+ }
+
+ if(!content_type)
content_type = "application/octet-stream";
/* get the filesize of the download, as given by the server.
diff --git a/src/uzbl-core.c b/src/uzbl-core.c
index 6bbed3c..877dbda 100644
--- a/src/uzbl-core.c
+++ b/src/uzbl-core.c
@@ -979,52 +979,6 @@ load_uri (WebKitWebView *web_view, GArray *argv, GString *result) {
}
/* Javascript*/
-
-JSValueRef
-js_run_command (JSContextRef ctx, JSObjectRef function, JSObjectRef thisObject,
- size_t argumentCount, const JSValueRef arguments[],
- JSValueRef* exception) {
- (void) function;
- (void) thisObject;
- (void) exception;
-
- JSStringRef js_result_string;
- GString *result = g_string_new("");
-
- if (argumentCount >= 1) {
- JSStringRef arg = JSValueToStringCopy(ctx, arguments[0], NULL);
- size_t arg_size = JSStringGetMaximumUTF8CStringSize(arg);
- char ctl_line[arg_size];
- JSStringGetUTF8CString(arg, ctl_line, arg_size);
-
- parse_cmd_line(ctl_line, result);
-
- JSStringRelease(arg);
- }
- js_result_string = JSStringCreateWithUTF8CString(result->str);
-
- g_string_free(result, TRUE);
-
- return JSValueMakeString(ctx, js_result_string);
-}
-
-JSStaticFunction js_static_functions[] = {
- {"run", js_run_command, kJSPropertyAttributeNone},
-};
-
-void
-js_init() {
- /* This function creates the class and its definition, only once */
- if (!uzbl.js.initialized) {
- /* it would be pretty cool to make this dynamic */
- uzbl.js.classdef = kJSClassDefinitionEmpty;
- uzbl.js.classdef.staticFunctions = js_static_functions;
-
- uzbl.js.classref = JSClassCreate(&uzbl.js.classdef);
- }
-}
-
-
void
eval_js(WebKitWebView * web_view, gchar *script, GString *result, const char *file) {
WebKitWebFrame *frame;
@@ -1037,8 +991,6 @@ eval_js(WebKitWebView * web_view, gchar *script, GString *result, const char *fi
JSStringRef js_result_string;
size_t js_result_size;
- js_init();
-
frame = webkit_web_view_get_main_frame(WEBKIT_WEB_VIEW(web_view));
context = webkit_web_frame_get_global_context(frame);
globalobject = JSContextGetGlobalObject(context);
@@ -1991,6 +1943,13 @@ create_window () {
gtk_window_set_default_size (GTK_WINDOW (window), 800, 600);
gtk_widget_set_name (window, "Uzbl browser");
+ /* if the window has been made small, it shouldn't try to resize itself due
+ * to a long statusbar. */
+ GdkGeometry hints;
+ hints.min_height = -1;
+ hints.min_width = 1;
+ gtk_window_set_geometry_hints (GTK_WINDOW (window), window, &hints, GDK_HINT_MIN_SIZE);
+
g_signal_connect (G_OBJECT (window), "destroy", G_CALLBACK (destroy_cb), NULL);
g_signal_connect (G_OBJECT (window), "configure-event", G_CALLBACK (configure_event_cb), NULL);