aboutsummaryrefslogtreecommitdiffhomepage
diff options
context:
space:
mode:
-rw-r--r--AUTHORS1
-rw-r--r--Makefile6
-rw-r--r--README32
-rw-r--r--examples/config/config36
-rwxr-xr-xexamples/data/scripts/uzbl-tabbed4
-rw-r--r--src/callbacks.c24
-rw-r--r--src/callbacks.h3
-rw-r--r--src/events.c11
-rw-r--r--src/uzbl-core.c170
-rw-r--r--src/uzbl-core.h14
-rw-r--r--tests/Makefile8
11 files changed, 155 insertions, 154 deletions
diff --git a/AUTHORS b/AUTHORS
index f7e4a16..f5144a1 100644
--- a/AUTHORS
+++ b/AUTHORS
@@ -52,6 +52,7 @@ In alphabetical order:
Jan Kolkmeier (jouz) - scrolling, link following
Jason Woofenden (JasonWoof) - geometry=maximized, link following
Jochen Sprickerhof - session.sh enhancements
+ k0ral - split status bar, cleanup and bugfix patches
Lars-Dominik Braun (PromyLOPh) - added ability to enable/disable the webkit page cache
Laurence Withers (lwithers) - talk_to_socket
Luca Bruno <lucab@debian.org> - bashims fixes
diff --git a/Makefile b/Makefile
index 7724303..f33a626 100644
--- a/Makefile
+++ b/Makefile
@@ -9,12 +9,12 @@ DOCDIR?=$(INSTALLDIR)/share/uzbl/docs
RUN_PREFIX?=$(PREFIX)
# gtk2
-REQ_PKGS = gtk+-2.0 webkit-1.0
+REQ_PKGS += gtk+-2.0 webkit-1.0
CPPFLAGS =
# gtk3
-#REQ_PKGS = gtk+-3.0 webkitgtk-3.0
-#CPPFLAGS = -DGTK3
+#REQ_PKGS += gtk+-3.0 webkitgtk-3.0
+#CPPFLAGS = -DG_DISABLE_DEPRECATED -DGTK_DISABLE_DEPRECATED
# --- configuration ends here ---
diff --git a/README b/README
index e4e3cab..d1f2357 100644
--- a/README
+++ b/README
@@ -291,8 +291,10 @@ file).
* `keycmd`: Holds the input buffer (callback: update input buffer).
* `show_status`: Show statusbar or not.
* `status_top`: statusbar on top?
-* `status_format`: Marked up, to be expanded string for statusbar (callback:
- update statusbar).
+* `status_format`: Marked up, to be expanded string for statusbar's left side
+ (callback: update statusbar).
+* `status_format_right`: Marked up, to be expanded string for statusbar's right side
+ (callback: update statusbar).
* `status_background`: color which can be used to override Gtk theme.
* `title_format_long`: titlebar string when no statusbar shown (will be
expanded).
@@ -329,6 +331,7 @@ file).
rendered content.
* `useragent`: The User-Agent to send to the browser, expands variables in its
definition.
+* `accept_languages`: The Accept-Language header to send with HTTP requests.
* `zoom_level`: The factor by which elements in the page are scaled with respect
to their original size. Setting this will resize the currently displayed page.
* `zoom_type`: Whether to use "full-content" zoom (defaults to true). With
@@ -469,10 +472,10 @@ that should be evaluated on every update need to be escaped:
set title_format_short = \\\@(date)\\\@
# the title will stay constant as a literal "@(date)@"
-The `status_format` variable can contain
+The `status_format` and `status_format_right` variables can contain
[Pango](http://library.gnome.org/devel/pango/stable/PangoMarkupFormat.html)
-markup . In the `status_format`, variables that might contain characters like
-`<`, `&` and `>`, should be wrapped in a `@[ ]@` substitution so that they don't
+markup . In these variables, expansions that might produce the characters `<`,
+`&` or `>` should be wrapped in `@[ ]@` substitutions so that they don't
interfere with the status bar's markup; see the sample config for examples.
### EXTERNAL SCRIPTS
@@ -599,25 +602,6 @@ This script tries to authenticate as user alice with password wonderland once
and never retries authentication.
See examples for more sofisticated, interactive authentication handler.
-### JAVASCRIPT HELPER OBJECT DISABLED BECAUSE OF SECURITY LEAK
-
-JavaScript code run from `uzbl` is given a special object in the global
-namespace which gives special privileges to these scripts. This object is called
-`Uzbl`, and it is added and removed before and after the script execution so
-that it is hidden to web JavaScript code (there is no race condition, since all
-the JavaScript code runs in a single thread).
-
-Currently, the `Uzbl` object provides only one function:
-
-* `Uzbl.run( <command> )`
- - Command is any `uzbl` command as defined above.
- - Return value: a string, either empty or containing the output of the
- command. Very few commands return their output currently, including `js`,
- `script`, and `print`.
- - Examples:
- * `Uzbl.run("spawn insert_bookmark.sh")`
- * `uri = Uzbl.run("print @uri")` (see variable expansion below)
-
### EVENTS
Unlike commands, events are not handled in `uzbl` itself, but are propagated
diff --git a/examples/config/config b/examples/config/config
index ddeca7b..4934469 100644
--- a/examples/config/config
+++ b/examples/config/config
@@ -48,13 +48,19 @@ set download_handler = sync_spawn @scripts_dir/download.sh
# === Dynamic event handlers =================================================
+# What to do when a website wants to open a new window:
# Open link in new window
@on_event NEW_WINDOW sh 'uzbl-browser ${1:+-u "$1"}' %r
-# Open in current window
+# Open in current window (also see the REQ_NEW_WINDOW event handler below)
#@on_event NEW_WINDOW uri %s
-# Open in new tab
+# Open in new tab. Other options are NEW_TAB_NEXT, NEW_BG_TAB and NEW_BG_TAB_NEXT.
#@on_event NEW_WINDOW event NEW_TAB %s
+# What to do when the user requests a new window:
+# If your the NEW_WINDOW handler opens the uri in the current window, you'll
+# probably want to change this handler to open a new window or tab.
+@on_event REQ_NEW_WINDOW event NEW_WINDOW %s
+
# Load start handler
@on_event LOAD_START @set_status <span foreground="khaki">wait</span>
# Reset the keycmd on navigation
@@ -105,7 +111,8 @@ set selected_section = <span foreground="#606060">\@[\@SELECTED_URI]\@</span>
set download_section = <span foreground="white">\@downloads</span>
-set status_format = <span font_family="monospace">@mode_section @keycmd_section @progress_section @uri_section @name_section @status_section @scroll_section @selected_section @download_section</span>
+set status_format = <span font_family="monospace">@mode_section @keycmd_section @progress_section @name_section @status_section @scroll_section @selected_section @download_section</span>
+set status_format_right = <span font_family="monospace"><span foreground="#666">uri:</span> @uri_section</span>
set title_format_long = \@keycmd_prompt \@raw_modcmd \@raw_keycmd \@TITLE - Uzbl browser <\@NAME> \@SELECTED_URI
@@ -119,7 +126,7 @@ set progress.pending =
# === Useragent setup ========================================================
-set useragent = Uzbl (Webkit @{WEBKIT_MAJOR}.@{WEBKIT_MINOR}.@{WEBKIT_MICRO}) (@(+uname -sm)@ [@ARCH_UZBL]) (Commit @COMMIT)
+set useragent = Uzbl (Webkit @{WEBKIT_MAJOR}.@{WEBKIT_MINOR}) (@(+uname -sm)@ [@ARCH_UZBL])
# === Configure cookie blacklist ========================================================
# Drop google analytics tracking cookies
@@ -196,7 +203,7 @@ set ebind = @mode_bind global,-insert
# === Mouse bindings =========================================================
# Middle click open in new window
-@bind <Button2> = sh 'if [ "$1" ]; then uzbl-browser -u "$1"; else echo "uri $(xclip -o | sed s/\\\@/%40/g)" > "$UZBL_FIFO"; fi' '\@SELECTED_URI'
+@bind <Button2> = sh 'if [ "$1" ]; then echo "event REQ_NEW_WINDOW $1" > "$UZBL_FIFO"; else echo "uri $(xclip -o | sed s/\\\@/%40/g)" > "$UZBL_FIFO"; fi' '\@SELECTED_URI'
# --- Keyboard bindings ------------------------------------------------------
@@ -205,7 +212,7 @@ set ebind = @mode_bind global,-insert
@cbind :_ = %s
# open a new window or a new tab (see the on_event NEW_WINDOW settings above)
-@cbind w = event NEW_WINDOW
+@cbind w = event REQ_NEW_WINDOW
# Page movement binds
@cbind j = scroll vertical 20
@@ -285,18 +292,17 @@ set ebind = @mode_bind global,-insert
@cbind yu = sh 'echo -n "$UZBL_URI" | xclip'
@cbind yU = sh 'echo -n "$1" | xclip' \@SELECTED_URI
@cbind yy = sh 'echo -n "$UZBL_TITLE" | xclip'
-@cbind yY = sh 'echo -n "$1" | xclip' \@SELECTED_URI
# Clone current window
-@cbind c = sh 'uzbl-browser -u "$UZBL_URI"'
+@cbind c = event REQ_NEW_WINDOW \@uri
# Go the page from primary selection
-@cbind p = sh 'echo "uri `xclip -selection primary -o | sed s/\\\@/%40/g`" > "$UZBL_FIFO"'
+@cbind p = sh 'echo "uri $(xclip -o | sed s/\\\@/%40/g)" > "$UZBL_FIFO"'
# Go to the page in clipboard
-@cbind P = sh 'echo "uri `xclip -selection clipboard -o | sed s/\\\@/%40/g`" > "$UZBL_FIFO"'
+@cbind P = sh 'echo "uri $(xclip -selection clipboard -o | sed s/\\\@/%40/g)" > "$UZBL_FIFO"'
# Start a new uzbl instance from the page in primary selection
-@cbind 'p = sh 'exec uzbl-browser --uri "$(xclip -o)"'
+@cbind 'p = sh 'echo "event REQ_NEW_WINDOW $(xclip -o)" > "$UZBL_FIFO"'
# paste primary selection into keycmd at the cursor position
-@bind <Shift-Insert> = sh 'echo "event INJECT_KEYCMD `xclip -o | sed s/\\\@/%40/g`" > "$UZBL_FIFO"'
+@bind <Shift-Insert> = sh 'echo "event INJECT_KEYCMD $(xclip -o | sed s/\\\@/%40/g)" > "$UZBL_FIFO"'
# Bookmark inserting binds
@cbind <Ctrl>b<tags:>_ = sh 'echo `printf "$UZBL_URI %s"` >> "$XDG_DATA_HOME"/uzbl/bookmarks'
@@ -334,12 +340,6 @@ set formfiller = spawn @scripts_dir/formfiller.sh
@cbind gN = event NEW_TAB_NEXT
@cbind go<uri:>_ = event NEW_TAB %s
@cbind gO<uri:>_ = event NEW_TAB_NEXT %s
-@cbind gy = sh 'echo "event NEW_TAB `xclip -selection primary -o | sed s/\\\@/%40/g`" > "$UZBL_FIFO"'
-@cbind gY = sh 'echo "event NEW_TAB_NEXT `xclip -selection primary -o | sed s/\\\@/%40/g`" > "$UZBL_FIFO"'
-
-# Clone current tab
-@cbind gd = sh 'echo "event NEW_TAB $UZBL_URI" > "$UZBL_FIFO"'
-@cbind gD = sh 'echo "event NEW_TAB_NEXT $UZBL_URI" > "$UZBL_FIFO"'
# Closing / resting
@cbind gC = exit
diff --git a/examples/data/scripts/uzbl-tabbed b/examples/data/scripts/uzbl-tabbed
index 0086c04..1d64436 100755
--- a/examples/data/scripts/uzbl-tabbed
+++ b/examples/data/scripts/uzbl-tabbed
@@ -452,7 +452,7 @@ class UzblInstance:
type, args = args.split(" ", 1)
if type == "TITLE_CHANGED":
self.title = args.strip()
- self.title_changed()
+ self.title_changed(False)
elif type == "VARIABLE_SET":
var, _, val = args.split(" ", 2)
@@ -485,6 +485,8 @@ class UzblInstance:
if var == "uri":
self.uri = val.strip()
self.parent.update_tablist()
+ elif type == "LOAD_COMMIT":
+ self.uri = args
elif type == "NEW_TAB":
self.parent.new_tab(args)
elif type == "NEW_BG_TAB":
diff --git a/src/callbacks.c b/src/callbacks.c
index 673979e..fa2ed1f 100644
--- a/src/callbacks.c
+++ b/src/callbacks.c
@@ -309,6 +309,17 @@ cmd_useragent() {
}
void
+set_accept_languages() {
+ if (*uzbl.net.accept_languages == ' ') {
+ g_free (uzbl.net.accept_languages);
+ uzbl.net.accept_languages = NULL;
+ } else {
+ g_object_set(G_OBJECT(uzbl.net.soup_session),
+ SOUP_SESSION_ACCEPT_LANGUAGE, uzbl.net.accept_languages, NULL);
+ }
+}
+
+void
cmd_javascript_windows() {
g_object_set (G_OBJECT(view_settings()), "javascript-can-open-windows-automatically",
uzbl.behave.javascript_windows, NULL);
@@ -814,16 +825,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/callbacks.h b/src/callbacks.h
index 40fa80d..899e959 100644
--- a/src/callbacks.h
+++ b/src/callbacks.h
@@ -83,6 +83,9 @@ void
cmd_useragent() ;
void
+set_accept_languages();
+
+void
cmd_autoload_img();
void
diff --git a/src/events.c b/src/events.c
index baaf8f3..31a95d5 100644
--- a/src/events.c
+++ b/src/events.c
@@ -78,10 +78,15 @@ send_event_sockets(GPtrArray *sockets, GString *msg) {
msg->str, msg->len,
&len, &error);
- if (ret == G_IO_STATUS_ERROR)
+ if (ret == G_IO_STATUS_ERROR) {
g_warning ("Error sending event to socket: %s", error->message);
- else
- g_io_channel_flush(gio, &error);
+ g_clear_error (&error);
+ } else {
+ if (g_io_channel_flush(gio, &error) == G_IO_STATUS_ERROR) {
+ g_warning ("Error flushing: %s", error->message);
+ g_clear_error (&error);
+ }
+ }
}
}
}
diff --git a/src/uzbl-core.c b/src/uzbl-core.c
index 592a8dd..877dbda 100644
--- a/src/uzbl-core.c
+++ b/src/uzbl-core.c
@@ -85,6 +85,7 @@ const struct var_name_to_ptr_t {
{ "show_status", PTR_V_INT(uzbl.behave.show_status, 1, cmd_set_status)},
{ "status_top", PTR_V_INT(uzbl.behave.status_top, 1, move_statusbar)},
{ "status_format", PTR_V_STR(uzbl.behave.status_format, 1, NULL)},
+ { "status_format_right", PTR_V_STR(uzbl.behave.status_format_right, 1, NULL)},
{ "status_background", PTR_V_STR(uzbl.behave.status_background, 1, set_status_background)},
{ "title_format_long", PTR_V_STR(uzbl.behave.title_format_long, 1, NULL)},
{ "title_format_short", PTR_V_STR(uzbl.behave.title_format_short, 1, NULL)},
@@ -102,6 +103,7 @@ const struct var_name_to_ptr_t {
{ "max_conns", PTR_V_INT(uzbl.net.max_conns, 1, cmd_max_conns)},
{ "max_conns_host", PTR_V_INT(uzbl.net.max_conns_host, 1, cmd_max_conns_host)},
{ "useragent", PTR_V_STR(uzbl.net.useragent, 1, cmd_useragent)},
+ { "accept_languages", PTR_V_STR(uzbl.net.accept_languages, 1, set_accept_languages)},
{ "javascript_windows", PTR_V_INT(uzbl.behave.javascript_windows, 1, cmd_javascript_windows)},
/* requires webkit >=1.1.14 */
{ "view_source", PTR_V_INT(uzbl.behave.view_source, 0, cmd_view_source)},
@@ -977,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;
@@ -1035,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);
@@ -1144,6 +1098,7 @@ search_text (WebKitWebView *page, GArray *argv, const gboolean forward) {
if (g_strcmp0 (uzbl.state.searchtx, argv_idx(argv, 0)) != 0) {
webkit_web_view_unmark_text_matches (page);
webkit_web_view_mark_text_matches (page, argv_idx(argv, 0), FALSE, 0);
+ g_free (uzbl.state.searchtx);
uzbl.state.searchtx = g_strdup(argv_idx(argv, 0));
}
}
@@ -1163,10 +1118,7 @@ search_clear(WebKitWebView *page, GArray *argv, GString *result) {
(void) result;
webkit_web_view_unmark_text_matches (page);
- if(uzbl.state.searchtx) {
- g_free(uzbl.state.searchtx);
- uzbl.state.searchtx = NULL;
- }
+ uzbl.state.searchtx = strfree (uzbl.state.searchtx);
}
void
@@ -1692,13 +1644,12 @@ gboolean
remove_socket_from_array(GIOChannel *chan) {
gboolean ret = 0;
- /* TODO: Do wee need to manually free the IO channel or is this
- * happening implicitly on unref?
- */
ret = g_ptr_array_remove_fast(uzbl.comm.connect_chan, chan);
if(!ret)
ret = g_ptr_array_remove_fast(uzbl.comm.client_chan, chan);
+ if(ret)
+ g_io_channel_unref (chan);
return ret;
}
@@ -1770,14 +1721,23 @@ control_client_socket(GIOChannel *clientchan) {
ret = g_io_channel_read_line(clientchan, &ctl_line, &len, NULL, &error);
if (ret == G_IO_STATUS_ERROR) {
- g_warning ("Error reading: %s\n", error->message);
- remove_socket_from_array(clientchan);
- g_io_channel_shutdown(clientchan, TRUE, &error);
+ g_warning ("Error reading: %s", error->message);
+ g_clear_error (&error);
+ ret = g_io_channel_shutdown (clientchan, TRUE, &error);
+ remove_socket_from_array (clientchan);
+ if (ret == G_IO_STATUS_ERROR) {
+ g_warning ("Error closing: %s", error->message);
+ g_clear_error (&error);
+ }
return FALSE;
} else if (ret == G_IO_STATUS_EOF) {
- remove_socket_from_array(clientchan);
/* shutdown and remove channel watch from main loop */
- g_io_channel_shutdown(clientchan, TRUE, &error);
+ ret = g_io_channel_shutdown (clientchan, TRUE, &error);
+ remove_socket_from_array (clientchan);
+ if (ret == G_IO_STATUS_ERROR) {
+ g_warning ("Error closing: %s", error->message);
+ g_clear_error (&error);
+ }
return FALSE;
}
@@ -1788,11 +1748,14 @@ control_client_socket(GIOChannel *clientchan) {
&len, &error);
if (ret == G_IO_STATUS_ERROR) {
g_warning ("Error writing: %s", error->message);
+ g_clear_error (&error);
+ }
+ if (g_io_channel_flush(clientchan, &error) == G_IO_STATUS_ERROR) {
+ g_warning ("Error flushing: %s", error->message);
+ g_clear_error (&error);
}
- g_io_channel_flush(clientchan, &error);
}
- if (error) g_error_free (error);
g_string_free(result, TRUE);
g_free(ctl_line);
return TRUE;
@@ -1872,42 +1835,43 @@ init_socket(gchar *dir) { /* return dir or, on error, free dir and return NULL *
return NULL;
}
-/*
- NOTE: we want to keep variables like b->title_format_long in their "unprocessed" state
- it will probably improve performance if we would "cache" the processed variant, but for now it works well enough...
-*/
-// this function may be called very early when the templates are not set (yet), hence the checks
void
update_title (void) {
Behaviour *b = &uzbl.behave;
- gchar *parsed;
- const gchar *current_title;
- /* this check is here because if we're starting up or shutting down it might not be a window */
- gboolean have_main_window = !uzbl.state.plug_mode && GTK_IS_WINDOW(uzbl.gui.main_window);
- if(have_main_window)
- current_title = gtk_window_get_title (GTK_WINDOW(uzbl.gui.main_window));
+ const gchar *title_format = b->title_format_long;
+ /* Update the status bar if shown */
if (b->show_status) {
- if (b->title_format_short && have_main_window) {
- parsed = expand(b->title_format_short, 0);
- if(!current_title || strcmp(current_title, parsed))
- gtk_window_set_title (GTK_WINDOW(uzbl.gui.main_window), parsed);
- g_free(parsed);
- }
- if (b->status_format && GTK_IS_LABEL(uzbl.gui.mainbar_label)) {
- parsed = expand(b->status_format, 0);
- gtk_label_set_markup(GTK_LABEL(uzbl.gui.mainbar_label), parsed);
+ title_format = b->title_format_short;
+
+ /* Left side */
+ if (b->status_format && GTK_IS_LABEL(uzbl.gui.mainbar_label_left)) {
+ gchar *parsed = expand(b->status_format, 0);
+ gtk_label_set_markup(GTK_LABEL(uzbl.gui.mainbar_label_left), parsed);
g_free(parsed);
}
- } else {
- if (b->title_format_long && have_main_window) {
- parsed = expand(b->title_format_long, 0);
- if(!current_title || strcmp(current_title, parsed))
- gtk_window_set_title (GTK_WINDOW(uzbl.gui.main_window), parsed);
+
+ /* Right side */
+ if (b->status_format_right && GTK_IS_LABEL(uzbl.gui.mainbar_label_right)) {
+ gchar *parsed = expand(b->status_format_right, 0);
+ gtk_label_set_markup(GTK_LABEL(uzbl.gui.mainbar_label_right), parsed);
g_free(parsed);
}
}
+
+ /* Update window title */
+ /* If we're starting up or shutting down there might not be a window yet. */
+ gboolean have_main_window = !uzbl.state.plug_mode && GTK_IS_WINDOW(uzbl.gui.main_window);
+ if (title_format && have_main_window) {
+ gchar *parsed = expand(title_format, 0);
+ const gchar *current_title = gtk_window_get_title (GTK_WINDOW(uzbl.gui.main_window));
+ /* xmonad hogs CPU if the window title updates too frequently, so we
+ * don't set it unless we need to. */
+ if(!current_title || strcmp(current_title, parsed))
+ gtk_window_set_title (GTK_WINDOW(uzbl.gui.main_window), parsed);
+ g_free(parsed);
+ }
}
void
@@ -1945,12 +1909,23 @@ create_mainbar () {
GUI *g = &uzbl.gui;
g->mainbar = gtk_hbox_new (FALSE, 0);
- g->mainbar_label = gtk_label_new ("");
- gtk_label_set_selectable((GtkLabel *)g->mainbar_label, TRUE);
- gtk_label_set_ellipsize(GTK_LABEL(g->mainbar_label), PANGO_ELLIPSIZE_END);
- gtk_misc_set_alignment (GTK_MISC(g->mainbar_label), 0, 0);
- gtk_misc_set_padding (GTK_MISC(g->mainbar_label), 2, 2);
- gtk_box_pack_start (GTK_BOX (g->mainbar), g->mainbar_label, TRUE, TRUE, 0);
+
+ /* Left panel */
+ g->mainbar_label_left = gtk_label_new ("");
+ gtk_label_set_selectable(GTK_LABEL(g->mainbar_label_left), TRUE);
+ gtk_misc_set_alignment (GTK_MISC(g->mainbar_label_left), 0, 0);
+ gtk_misc_set_padding (GTK_MISC(g->mainbar_label_left), 2, 2);
+
+ gtk_box_pack_start (GTK_BOX (g->mainbar), g->mainbar_label_left, FALSE, FALSE, 0);
+
+ /* Right panel */
+ g->mainbar_label_right = gtk_label_new ("");
+ gtk_label_set_selectable(GTK_LABEL(g->mainbar_label_right), TRUE);
+ gtk_misc_set_alignment (GTK_MISC(g->mainbar_label_right), 1, 0);
+ gtk_misc_set_padding (GTK_MISC(g->mainbar_label_right), 2, 2);
+ gtk_label_set_ellipsize(GTK_LABEL(g->mainbar_label_right), PANGO_ELLIPSIZE_START);
+
+ gtk_box_pack_start (GTK_BOX (g->mainbar), g->mainbar_label_right, TRUE, TRUE, 0);
g_object_connect((GObject*)g->mainbar,
"signal::key-press-event", (GCallback)key_press_cb, NULL,
@@ -1968,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);
@@ -2261,7 +2243,7 @@ retrieve_geometry() {
void
set_webview_scroll_adjustments() {
-#ifdef GTK3
+#if GTK_CHECK_VERSION(2,91,0)
gtk_scrollable_set_hadjustment (GTK_SCROLLABLE(uzbl.gui.web_view), uzbl.gui.bar_h);
gtk_scrollable_set_vadjustment (GTK_SCROLLABLE(uzbl.gui.web_view), uzbl.gui.bar_v);
#else
diff --git a/src/uzbl-core.h b/src/uzbl-core.h
index 129c6a5..f81722d 100644
--- a/src/uzbl-core.h
+++ b/src/uzbl-core.h
@@ -51,8 +51,12 @@ typedef struct {
GtkPlug* plug;
GtkWidget* scrolled_win;
GtkWidget* vbox;
+
+ /* Mainbar */
GtkWidget* mainbar;
- GtkWidget* mainbar_label;
+ GtkWidget* mainbar_label_left;
+ GtkWidget* mainbar_label_right;
+
GtkScrollbar* scbar_v; // Horizontal and Vertical Scrollbar
GtkScrollbar* scbar_h; // (These are still hidden)
GtkAdjustment* bar_v; // Information about document length
@@ -111,6 +115,7 @@ typedef struct {
SoupLogger *soup_logger;
char *proxy_url;
char *useragent;
+ char *accept_languages;
gint max_conns;
gint max_conns_host;
} Network;
@@ -118,10 +123,15 @@ typedef struct {
/* behaviour */
typedef struct {
+ /* Status bar */
gchar* status_format;
+ gchar* status_format_right;
+ gchar* status_background;
+
+ /* Window title */
gchar* title_format_short;
gchar* title_format_long;
- gchar* status_background;
+
gchar* fifo_dir;
gchar* socket_dir;
gchar* cookie_handler;
diff --git a/tests/Makefile b/tests/Makefile
index bfe74c5..2a5e2b6 100644
--- a/tests/Makefile
+++ b/tests/Makefile
@@ -1,10 +1,10 @@
# gtk2
-REQ_PKGS = gtk+-2.0 webkit-1.0
-CPPFLAGS = -DERRORCHECK_MUTEXES -I ../
+REQ_PKGS += gtk+-2.0 webkit-1.0
+CPPFLAGS = -I ../ -DERRORCHECK_MUTEXES
# gtk3
-#REQ_PKGS = gtk+-3.0 webkitgtk-3.0
-#CPPFLAGS = -DERRORCHECK_MUTEXES -DGTK3 -I ../
+#REQ_PKGS += gtk+-3.0 webkitgtk-3.0
+#CPPFLAGS = -I ../ -DERRORCHECK_MUTEXES -DG_DISABLE_DEPRECATED -DGTK_DISABLE_DEPRECATED
# --- configuration ends here ---