aboutsummaryrefslogtreecommitdiffhomepage
path: root/uzbl.c
diff options
context:
space:
mode:
Diffstat (limited to 'uzbl.c')
-rw-r--r--uzbl.c106
1 files changed, 47 insertions, 59 deletions
diff --git a/uzbl.c b/uzbl.c
index 92278bf..74c9027 100644
--- a/uzbl.c
+++ b/uzbl.c
@@ -90,8 +90,6 @@ static gboolean status_top = FALSE;
static gchar* modkey = NULL;
static guint modmask = 0;
static guint http_debug = 0;
-static gdouble hscroll = 20;
-static gdouble vscroll = 20;
/* settings from config: group bindings, key -> action */
static GHashTable* bindings;
@@ -165,36 +163,28 @@ download_cb (WebKitWebView *web_view, GObject *download, gpointer user_data) {
/* scroll a bar in a given direction */
static void
-scroll (double i, GtkAdjustment* bar) {
- gtk_adjustment_set_value (bar, gtk_adjustment_get_value(bar)+i);
-}
+scroll (GtkAdjustment* bar, const char *param) {
+ gdouble amount;
+ gchar *end;
-static void scroll_up (WebKitWebView* page, const char *param) {
- (void) page;
- (void) param;
+ amount = g_ascii_strtod(param, &end);
- scroll (-vscroll, bar_v);
-}
+ if (*end)
+ fprintf(stderr, "found something after double: %s\n", end);
-static void scroll_left (WebKitWebView* page, const char *param) {
- (void) page;
- (void) param;
-
- scroll (-hscroll, bar_h);
+ gtk_adjustment_set_value (bar, gtk_adjustment_get_value(bar)+amount);
}
-static void scroll_down (WebKitWebView* page, const char *param) {
+static void scroll_vert(WebKitWebView* page, const char *param) {
(void) page;
- (void) param;
- scroll (vscroll, bar_v);
+ scroll(bar_v, param);
}
-static void scroll_right (WebKitWebView* page, const char *param) {
+static void scroll_horz(WebKitWebView* page, const char *param) {
(void) page;
- (void) param;
- scroll (hscroll, bar_h);
+ scroll(bar_h, param);
}
static void
@@ -293,10 +283,8 @@ static struct {char *name; Command command;} cmdlist[] =
{
{ "back", view_go_back },
{ "forward", view_go_forward },
- { "scroll_down", scroll_down },
- { "scroll_up", scroll_up },
- { "scroll_left", scroll_left },
- { "scroll_right", scroll_right },
+ { "scroll_vert", scroll_vert },
+ { "scroll_horz", scroll_horz },
{ "reload", view_reload, }, //Buggy
{ "refresh", view_reload, }, /* for convenience, will change */
{ "stop", view_stop_loading, },
@@ -802,42 +790,42 @@ settings_init () {
g_strfreev(keys);
}
- /* networking options */
- proxy_url = g_key_file_get_value(config, "network", "proxy_server", NULL);
- http_debug = g_key_file_get_integer(config, "network", "http_debug", NULL);
- useragent = g_key_file_get_value(config, "network", "user-agent", NULL);
- max_conns = g_key_file_get_integer(config, "network", "max_conns", NULL);
- max_conns_host = g_key_file_get_integer(config, "network", "max_conns_per_host", NULL);
-
- if(proxy_url){
- g_object_set(G_OBJECT(soup_session), SOUP_SESSION_PROXY_URI, soup_uri_new(proxy_url), NULL);
- printf("Proxy configured: %s\n", proxy_url ? proxy_url : "none");
- }
+ /* networking options */
+ proxy_url = g_key_file_get_value (config, "network", "proxy_server", NULL);
+ http_debug = g_key_file_get_integer (config, "network", "http_debug", NULL);
+ useragent = g_key_file_get_value (config, "network", "user-agent", NULL);
+ max_conns = g_key_file_get_integer (config, "network", "max_conns", NULL);
+ max_conns_host = g_key_file_get_integer (config, "network", "max_conns_per_host", NULL);
+
+ if(proxy_url){
+ g_object_set(G_OBJECT(soup_session), SOUP_SESSION_PROXY_URI, soup_uri_new(proxy_url), NULL);
+ }
- if(!(http_debug <= 3)){
- http_debug = 0;
- fprintf(stderr, "Wrong http_debug level, ignoring.\n");
- } else {
- soup_logger = soup_logger_new(http_debug, -1);
- soup_session_add_feature(soup_session, SOUP_SESSION_FEATURE(soup_logger));
- printf("HTTP logging level: %d\n", http_debug);
- }
+ if(!(http_debug <= 3)){
+ http_debug = 0;
+ fprintf(stderr, "Wrong http_debug level, ignoring.\n");
+ } else if (http_debug > 0) {
+ soup_logger = soup_logger_new(http_debug, -1);
+ soup_session_add_feature(soup_session, SOUP_SESSION_FEATURE(soup_logger));
+ }
- if(useragent){
- g_object_set(G_OBJECT(soup_session), SOUP_SESSION_USER_AGENT, useragent, NULL);
- printf("User-agent: %s\n", useragent);
- } else {
- printf("User-agent: webkit default\n");
- }
-
- if(max_conns >= 1){
- g_object_set(G_OBJECT(soup_session), SOUP_SESSION_MAX_CONNS, max_conns, NULL);
- printf("Maximum connections set to: %d\n", max_conns);
- }
- if(max_conns_host >= 1){
- g_object_set(G_OBJECT(soup_session), SOUP_SESSION_MAX_CONNS_PER_HOST, max_conns_host, NULL);
- printf("Maximum connections per host set to: %d\n", max_conns_host);
- }
+ if(useragent){
+ g_object_set(G_OBJECT(soup_session), SOUP_SESSION_USER_AGENT, useragent, NULL);
+ }
+
+ if(max_conns >= 1){
+ g_object_set(G_OBJECT(soup_session), SOUP_SESSION_MAX_CONNS, max_conns, NULL);
+ }
+
+ if(max_conns_host >= 1){
+ g_object_set(G_OBJECT(soup_session), SOUP_SESSION_MAX_CONNS_PER_HOST, max_conns_host, NULL);
+ }
+
+ printf("Proxy configured: %s\n", proxy_url ? proxy_url : "none");
+ printf("HTTP logging level: %d\n", http_debug);
+ printf("User-agent: %s\n", useragent? useragent : "default");
+ printf("Maximum connections: %d\n", max_conns ? max_conns : 0);
+ printf("Maximum connections per host: %d\n", max_conns_host ? max_conns_host: 0);
}