Sylvester Johansson (scj) - form filler script & different take on link follower
(mxf) - uzblcat
Mark Nevill - misc patches
+ Uli Schlachter (psychon) - basic mime_policy_cb & Makefile patch
+ (uranther) - zoom level
Originaly based on http://trac.webkit.org/browser/trunk/WebKitTools/GtkLauncher/main.c
Which is copyrighted:
-CPPFLAGS=$(shell pkg-config --cflags gtk+-2.0 webkit-1.0) -ggdb -Wall -pedantic -std=gnu99 -W -DARCH="\"$(shell uname -m)\"" -DG_ERRORCHECK_MUTEXES -DCOMMIT="\"$(shell git log | head -n1 | sed "s/.* //")\""
-LDFLAGS=$(shell pkg-config --libs gtk+-2.0 webkit-1.0)
+CPPFLAGS:=$(shell pkg-config --cflags gtk+-2.0 webkit-1.0) -ggdb -Wall -W -DARCH="\"$(shell uname -m)\"" -DG_ERRORCHECK_MUTEXES -DCOMMIT="\"$(shell git log | head -n1 | sed "s/.* //")\"" $(CPPFLAGS)
+LDFLAGS:=$(shell pkg-config --libs gtk+-2.0 webkit-1.0) $(LDFLAGS)
all: uzbl uzblctrl
PREFIX?=$(DESTDIR)/usr
--- /dev/null
+LIBS := gtk+-2.0 webkit-1.0
+ARCH := $(shell uname -m)
+COMMIT := $(shell git log | head -n1 | sed "s/.* //")
+DEBUG := -ggdb -Wall -W -DG_ERRORCHECK_MUTEXES
+
+CFLAGS := $(shell --cflags $(LIBS)) $(DEBUG) -DARCH="$(ARCH)" -DCOMMIT="\"$(COMMIT)\""
+LDFLAGS := $(shell --libs $(LIBS)) $(LDFLAGS)
+
+PREFIX ?= $(DESTDIR)/usr
+BINDIR ?= $(PREFIX)/bin
+UZBLDATA ?= $(PREFIX)/share/uzbl
+DOCSDIR ?= $(PREFIX)/share/uzbl/docs
+EXMPLSDIR ?= $(PREFIX)/share/uzbl/examples
+
+all: uzbl uzblctrl
+
+uzbl: uzbl.c uzbl.h config.h
+
+%: %.c
+ $(CC) $(CFLAGS) $(CPPFLAGS) $(LDFLAGS) $(LIBS) -o $@ $<
+
+test: uzbl
+ ./uzbl --uri http://www.uzbl.org
+
+test-config: uzbl
+ ./uzbl --uri http://www.uzbl.org < examples/configs/sampleconfig-dev
+
+test-config-real: uzbl
+ ./uzbl --uri http://www.uzbl.org < $(EXMPLSDIR)/configs/sampleconfig
+
+clean:
+ rm -f uzbl
+ rm -f uzblctrl
+
+install:
+ install -d $(BINDIR)
+ install -d $(DOCSDIR)
+ install -d $(EXMPLSDIR)
+ install -D -m755 uzbl $(BINDIR)/uzbl
+ install -D -m755 uzblctrl $(BINDIR)/uzblctrl
+ cp -ax docs/* $(DOCSDIR)
+ cp -ax config.h $(DOCSDIR)
+ cp -ax examples/* $(EXMPLSDIR)
+ install -D -m644 AUTHORS $(DOCSDIR)
+ install -D -m644 README $(DOCSDIR)
+
+
+uninstall:
+ rm -rf $(BINDIR)/uzbl
+ rm -rf $(BINDIR)/uzblctrl
+ rm -rf $(UZBLDATA)
# You can use any command in place of spawn
set history_handler = spawn /usr/share/uzbl/examples/scripts/history.sh
set download_handler = spawn /usr/share/uzbl/examples/scripts/download.sh
-#set cookie_handler = spawn /usr/share/uzbl/examples/scripts/cookies.sh
+set cookie_handler = spawn /usr/share/uzbl/examples/scripts/cookies.sh
set minimum_font_size = 6
set font_size = 11
# Usually you want to spawn a script to handle things, but any command (such as sh) can be used
set history_handler = spawn ./examples/scripts/history.sh
set download_handler = spawn ./examples/scripts/download.sh
-#set cookie_handler = spawn ./examples/scripts/cookies.sh
+set cookie_handler = spawn ./examples/scripts/cookies.sh
set minimum_font_size = 6
set font_size = 11
bind R = reload_ign_cache
bind + = zoom_in
bind - = zoom_out
+bind 0 = sh "echo set zoom_level = 1.0 > $4"
bind t = toggle_status
# Hilight matches. Notice the * after the slash - it makes the command incremental, i.e. gets called
# on every character you type. You can do `bind /_ = search %s' if you want it less interactive.
/* -*- c-basic-offset: 4; -*- */
-/* Original code taken from the example webkit-gtk+ application. see notice below. */
-/* Modified code is licensed under the GPL 3. See LICENSE file. */
+// Original code taken from the example webkit-gtk+ application. see notice below.
+// Modified code is licensed under the GPL 3. See LICENSE file.
/*
#include <gtk/gtk.h>
#include <gdk/gdkx.h>
#include <gdk/gdkkeysyms.h>
-
-#include <sys/types.h>
#include <sys/socket.h>
#include <sys/stat.h>
+#include <sys/types.h>
+#include <sys/un.h>
#include <sys/utsname.h>
#include <sys/time.h>
-#include <sys/un.h>
-
#include <webkit/webkit.h>
#include <libsoup/soup.h>
return (FALSE);
}
+static gboolean
+mime_policy_cb(WebKitWebView *web_view, WebKitWebFrame *frame, WebKitNetworkRequest *request, gchar *mime_type, WebKitWebPolicyDecision *policy_decision, gpointer user_data) {
+ (void) frame;
+ (void) request;
+ (void) user_data;
+
+ /* If we can display it, let's display it... */
+ if (webkit_web_view_can_show_mime_type (web_view, mime_type)) {
+ webkit_web_policy_decision_use (policy_decision);
+ return TRUE;
+ }
+
+ /* ...everything we can't displayed is downloaded */
+ webkit_web_policy_decision_download (policy_decision);
+ return TRUE;
+}
+
WebKitWebView*
create_web_view_cb (WebKitWebView *web_view, WebKitWebFrame *frame, gpointer user_data) {
(void) web_view;
token = g_scanner_get_next_token(uzbl.scan);
if(token == G_TOKEN_SYMBOL) {
- sym = (int)g_scanner_cur_value(uzbl.scan).v_symbol;
+ sym = GPOINTER_TO_INT(g_scanner_cur_value(uzbl.scan).v_symbol);
switch(sym) {
case SYM_URI:
if(escape_markup) {
if (c->type == TYPE_STR) {
buf = expand_vars(val);
g_free(*c->ptr);
- *c->ptr = g_strdup(val);
- } else if (c->type == TYPE_INT) {
+ *c->ptr = buf;
+ } else if(c->type == TYPE_INT) {
int *ip = (int *)c->ptr;
- *ip = (int)strtoul(val, &endp, 10);
+ buf = expand_vars(val);
+ *ip = (int)strtoul(buf, &endp, 10);
+ g_free(buf);
} else if (c->type == TYPE_FLOAT) {
float *fp = (float *)c->ptr;
- *fp = strtof(val, &endp);
+ buf = expand_vars(val);
+ *fp = strtof(buf, &endp);
+ g_free(buf);
}
/* invoke a command specific function */
g_signal_connect (G_OBJECT (g->web_view), "new-window-policy-decision-requested", G_CALLBACK (new_window_cb), g->web_view);
g_signal_connect (G_OBJECT (g->web_view), "download-requested", G_CALLBACK (download_cb), g->web_view);
g_signal_connect (G_OBJECT (g->web_view), "create-web-view", G_CALLBACK (create_web_view_cb), g->web_view);
+ g_signal_connect (G_OBJECT (g->web_view), "mime-type-policy-decision-requested", G_CALLBACK (mime_policy_cb), g->web_view);
return scrolled_window;
}
printf ("Binding %-10s : %s\n", key, act);
action = new_action(parts[0], parts[1]);
+ if (g_hash_table_remove (uzbl.bindings, key))
+ g_warning ("Overwriting existing binding for \"%s\"", key);
g_hash_table_replace(uzbl.bindings, g_strdup(key), action);
g_strfreev(parts);
}
GtkWidget* vbox;
GtkWidget* mainbar;
GtkWidget* mainbar_label;
- GtkScrollbar* scbar_v; /* Horizontal and Vertical Scrollbar */
- GtkScrollbar* scbar_h; /* (These are still hidden) */
- GtkAdjustment* bar_v; /* Information about document length */
- GtkAdjustment* bar_h; /* and scrolling position */
+ GtkScrollbar* scbar_v; // Horizontal and Vertical Scrollbar
+ GtkScrollbar* scbar_h; // (These are still hidden)
+ GtkAdjustment* bar_v; // Information about document length
+ GtkAdjustment* bar_h; // and scrolling position
WebKitWebView* web_view;
gchar* main_title;
static gboolean
new_window_cb (WebKitWebView *web_view, WebKitWebFrame *frame, WebKitNetworkRequest *request, WebKitWebNavigationAction *navigation_action, WebKitWebPolicyDecision *policy_decision, gpointer user_data);
+static gboolean
+mime_policy_cb(WebKitWebView *web_view, WebKitWebFrame *frame, WebKitNetworkRequest *request, gchar *mime_type, WebKitWebPolicyDecision *policy_decision, gpointer user_data);
+
WebKitWebView*
create_web_view_cb (WebKitWebView *web_view, WebKitWebFrame *frame, gpointer user_data);