merge with Dieterbe/experimental
authoruranther <jwheaton@purdue.edu>
Mon, 1 Jun 2009 17:44:45 +0000 (13:44 -0400)
committeruranther <jwheaton@purdue.edu>
Mon, 1 Jun 2009 17:44:45 +0000 (13:44 -0400)
1  2 
Makefile
examples/configs/sampleconfig
examples/configs/sampleconfig-dev
uzbl.c
uzbl.h

diff --cc Makefile
+++ b/Makefile
@@@ -1,7 -1,9 +1,9 @@@
 -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)
 +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)
  all: uzbl uzblctrl
  
+ PREFIX?=$(DESTDIR)/usr
  test: uzbl
        ./uzbl --uri http://www.uzbl.org
  
@@@ -8,10 -8,10 +8,10 @@@
  # from insert mode by combining them with the modkey
  
  # TODO: ability to attach misc things (spawn <foo>, script <bar>,.. to internal events)
- # You can use any action in place of spawn
+ # 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
@@@ -8,10 -8,10 +8,10 @@@
  # from insert mode by combining them with the modkey
  
  # TODO: ability to attach misc things (spawn <foo>, script <bar>,.. to internal events)
- # Usually you want to spawn a script to handle things, but any action (such as sh) can be used
+ # 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
diff --cc uzbl.c
--- 1/uzbl.c
--- 2/uzbl.c
+++ b/uzbl.c
@@@ -84,70 -85,72 +85,70 @@@ typedef const struct 
      void (*func)(void);
  } uzbl_cmdprop;
  
 -enum {TYPE_INT, TYPE_STR};
 +enum {TYPE_INT, TYPE_STR, TYPE_FLOAT};
  
  /* an abbreviation to help keep the table's width humane */
- #define PTR(var, t, fun) { .ptr = (void*)&(var), .type = TYPE_##t, .func = fun }
+ #define PTR(var, t, d, fun) { .ptr = (void*)&(var), .type = TYPE_##t, .dump = d, .func = fun }
  
  const struct {
      char *name;
      uzbl_cmdprop cp;
  } var_name_to_ptr[] = {
- /*    variable name         pointer to variable in code          type  callback function    */
+ /*    variable name         pointer to variable in code          type  dump callback function    */
  /*  --------------------------------------------------------------------------------------- */
 -    { "uri",                 PTR(uzbl.state.uri,                  STR,  1,   cmd_load_uri)},
 -    { "verbose",             PTR(uzbl.state.verbose,              INT,  1,   NULL)},
 -    { "mode",                PTR(uzbl.behave.mode,                INT,  0,   NULL)},
 -    { "inject_html",         PTR(uzbl.behave.inject_html,         STR,  0,   cmd_inject_html)},
 -    { "base_url",            PTR(uzbl.behave.base_url,            STR,  1,   NULL)},
 -    { "html_endmarker",      PTR(uzbl.behave.html_endmarker,      STR,  1,   NULL)},
 -    { "html_mode_timeout",   PTR(uzbl.behave.html_timeout,        INT,  1,   NULL)},
 -    { "status_message",      PTR(uzbl.gui.sbar.msg,               STR,  1,   update_title)},
 -    { "show_status",         PTR(uzbl.behave.show_status,         INT,  1,   cmd_set_status)},
 -    { "status_top",          PTR(uzbl.behave.status_top,          INT,  1,   move_statusbar)},
 -    { "status_format",       PTR(uzbl.behave.status_format,       STR,  1,   update_title)},
 -    { "status_pbar_done",    PTR(uzbl.gui.sbar.progress_s,        STR,  1,   update_title)},
 -    { "status_pbar_pending", PTR(uzbl.gui.sbar.progress_u,        STR,  1,   update_title)},
 -    { "status_pbar_width",   PTR(uzbl.gui.sbar.progress_w,        INT,  1,   update_title)},
 -    { "status_background",   PTR(uzbl.behave.status_background,   STR,  1,   update_title)},
 -    { "insert_indicator",    PTR(uzbl.behave.insert_indicator,    STR,  1,   update_title)},
 -    { "command_indicator",   PTR(uzbl.behave.cmd_indicator,       STR,  1,   update_title)},
 -    { "title_format_long",   PTR(uzbl.behave.title_format_long,   STR,  1,   update_title)},
 -    { "title_format_short",  PTR(uzbl.behave.title_format_short,  STR,  1,   update_title)},
 -    { "insert_mode",         PTR(uzbl.behave.insert_mode,         INT,  1,   NULL)},
 -    { "always_insert_mode",  PTR(uzbl.behave.always_insert_mode,  INT,  1,   cmd_always_insert_mode)},
 -    { "reset_command_mode",  PTR(uzbl.behave.reset_command_mode,  INT,  1,   NULL)},
 -    { "modkey",              PTR(uzbl.behave.modkey,              STR,  1,   cmd_modkey)},
 -    { "load_finish_handler", PTR(uzbl.behave.load_finish_handler, STR,  1,   NULL)},
 -    { "load_start_handler",  PTR(uzbl.behave.load_start_handler,  STR,  1,   NULL)},
 -    { "load_commit_handler", PTR(uzbl.behave.load_commit_handler, STR,  1,   NULL)},
 -    { "history_handler",     PTR(uzbl.behave.history_handler,     STR,  1,   NULL)},
 -    { "download_handler",    PTR(uzbl.behave.download_handler,    STR,  1,   NULL)},
 -    { "cookie_handler",      PTR(uzbl.behave.cookie_handler,      STR,  1,   cmd_cookie_handler)},
 -    { "fifo_dir",            PTR(uzbl.behave.fifo_dir,            STR,  1,   cmd_fifo_dir)},
 -    { "socket_dir",          PTR(uzbl.behave.socket_dir,          STR,  1,   cmd_socket_dir)},
 -    { "http_debug",          PTR(uzbl.behave.http_debug,          INT,  1,   cmd_http_debug)},
 -    { "shell_cmd",           PTR(uzbl.behave.shell_cmd,           STR,  1,   NULL)},
 -    { "proxy_url",           PTR(uzbl.net.proxy_url,              STR,  1,   set_proxy_url)},
 -    { "max_conns",           PTR(uzbl.net.max_conns,              INT,  1,   cmd_max_conns)},
 -    { "max_conns_host",      PTR(uzbl.net.max_conns_host,         INT,  1,   cmd_max_conns_host)},
 -    { "useragent",           PTR(uzbl.net.useragent,              STR,  1,   cmd_useragent)},
 -    /* exported WebKitWebSettings properties*/
 -    { "font_size",           PTR(uzbl.behave.font_size,           INT,  1,   cmd_font_size)},
 -    { "monospace_size",      PTR(uzbl.behave.monospace_size,      INT,  1,   cmd_font_size)},
 -    { "minimum_font_size",   PTR(uzbl.behave.minimum_font_size,   INT,  1,   cmd_minimum_font_size)},
 -    { "disable_plugins",     PTR(uzbl.behave.disable_plugins,     INT,  1,   cmd_disable_plugins)},
 -    { "disable_scripts",     PTR(uzbl.behave.disable_scripts,     INT,  1,   cmd_disable_scripts)},
 -    { "autoload_images",     PTR(uzbl.behave.autoload_img,        INT,  1,   cmd_autoload_img)},
 -    { "autoshrink_images",   PTR(uzbl.behave.autoshrink_img,      INT,  1,   cmd_autoshrink_img)},
 -    { "enable_spellcheck",   PTR(uzbl.behave.enable_spellcheck,   INT,  1,   cmd_enable_spellcheck)},
 -    { "enable_private",      PTR(uzbl.behave.enable_private,      INT,  1,   cmd_enable_private)},
 -    { "print_backgrounds",   PTR(uzbl.behave.print_bg,            INT,  1,   cmd_print_bg)},
 -    { "stylesheet_uri",      PTR(uzbl.behave.style_uri,           STR,  1,   cmd_style_uri)},
 -    { "resizable_text_areas",PTR(uzbl.behave.resizable_txt,       INT,  1,   cmd_resizable_txt)},
 -    { "default_encoding",    PTR(uzbl.behave.default_encoding,    STR,  1,   cmd_default_encoding)},
 -    { "enforce_96_dpi",      PTR(uzbl.behave.enforce_96dpi,       INT,  1,   cmd_enforce_96dpi)},
 -    { "caret_browsing",      PTR(uzbl.behave.caret_browsing,      INT,  1,   cmd_caret_browsing)},
 -
 -    { NULL,                  {.ptr = NULL, .type = TYPE_INT, .dump = 0, .func = NULL}}
 +    { "uri",                 PTR(uzbl.state.uri,                  STR, cmd_load_uri)},
 +    { "mode",                PTR(uzbl.behave.mode,                INT, NULL)},
 +    { "inject_html",         PTR(uzbl.behave.inject_html,         STR, cmd_inject_html)},
 +    { "base_url",            PTR(uzbl.behave.base_url,            STR, NULL)},
 +    { "html_endmarker",      PTR(uzbl.behave.html_endmarker,      STR, NULL)},
 +    { "html_mode_timeout",   PTR(uzbl.behave.html_timeout,        INT, NULL)},
 +    { "status_message",      PTR(uzbl.gui.sbar.msg,               STR, update_title)},
 +    { "show_status",         PTR(uzbl.behave.show_status,         INT, cmd_set_status)},
 +    { "status_top",          PTR(uzbl.behave.status_top,          INT, move_statusbar)},
 +    { "status_format",       PTR(uzbl.behave.status_format,       STR, update_title)},
 +    { "status_pbar_done",    PTR(uzbl.gui.sbar.progress_s,        STR, update_title)},
 +    { "status_pbar_pending", PTR(uzbl.gui.sbar.progress_u,        STR, update_title)},
 +    { "status_pbar_width",   PTR(uzbl.gui.sbar.progress_w,        INT, update_title)},
 +    { "status_background",   PTR(uzbl.behave.status_background,   STR, update_title)},
 +    { "title_format_long",   PTR(uzbl.behave.title_format_long,   STR, update_title)},
 +    { "title_format_short",  PTR(uzbl.behave.title_format_short,  STR, update_title)},
 +    { "insert_mode",         PTR(uzbl.behave.insert_mode,         INT, NULL)},
 +    { "always_insert_mode",  PTR(uzbl.behave.always_insert_mode,  INT, cmd_always_insert_mode)},
 +    { "reset_command_mode",  PTR(uzbl.behave.reset_command_mode,  INT, NULL)},
 +    { "modkey",              PTR(uzbl.behave.modkey,              STR, cmd_modkey)},
 +    { "load_finish_handler", PTR(uzbl.behave.load_finish_handler, STR, NULL)},
 +    { "load_start_handler",  PTR(uzbl.behave.load_start_handler,  STR, NULL)},
 +    { "load_commit_handler", PTR(uzbl.behave.load_commit_handler, STR, NULL)},
 +    { "history_handler",     PTR(uzbl.behave.history_handler,     STR, NULL)},
 +    { "download_handler",    PTR(uzbl.behave.download_handler,    STR, NULL)},
 +    { "cookie_handler",      PTR(uzbl.behave.cookie_handler,      STR, cmd_cookie_handler)},
 +    { "fifo_dir",            PTR(uzbl.behave.fifo_dir,            STR, cmd_fifo_dir)},
 +    { "socket_dir",          PTR(uzbl.behave.socket_dir,          STR, cmd_socket_dir)},
 +    { "http_debug",          PTR(uzbl.behave.http_debug,          INT, cmd_http_debug)},
 +    { "shell_cmd",           PTR(uzbl.behave.shell_cmd,           STR, NULL)},
 +    { "proxy_url",           PTR(uzbl.net.proxy_url,              STR, set_proxy_url)},
 +    { "max_conns",           PTR(uzbl.net.max_conns,              INT, cmd_max_conns)},
 +    { "max_conns_host",      PTR(uzbl.net.max_conns_host,         INT, cmd_max_conns_host)},
 +    { "useragent",           PTR(uzbl.net.useragent,              STR, cmd_useragent)},
 +    /* exported WebKitWebSettings properties */
 +    { "font_size",           PTR(uzbl.behave.font_size,           INT, cmd_font_size)},
 +    { "monospace_size",      PTR(uzbl.behave.monospace_size,      INT, cmd_font_size)},
 +    { "minimum_font_size",   PTR(uzbl.behave.minimum_font_size,   INT, cmd_minimum_font_size)},
 +    { "zoom_level",          PTR(uzbl.behave.zoom_level,          FLOAT, cmd_zoom_level)},
 +    { "disable_plugins",     PTR(uzbl.behave.disable_plugins,     INT, cmd_disable_plugins)},
 +    { "disable_scripts",     PTR(uzbl.behave.disable_scripts,     INT, cmd_disable_scripts)},
 +    { "autoload_images",     PTR(uzbl.behave.autoload_img,        INT, cmd_autoload_img)},
 +    { "autoshrink_images",   PTR(uzbl.behave.autoshrink_img,      INT, cmd_autoshrink_img)},
 +    { "enable_spellcheck",   PTR(uzbl.behave.enable_spellcheck,   INT, cmd_enable_spellcheck)},
 +    { "enable_private",      PTR(uzbl.behave.enable_private,      INT, cmd_enable_private)},
 +    { "print_backgrounds",   PTR(uzbl.behave.print_bg,            INT, cmd_print_bg)},
 +    { "stylesheet_uri",      PTR(uzbl.behave.style_uri,           STR, cmd_style_uri)},
 +    { "resizable_text_areas",PTR(uzbl.behave.resizable_txt,       INT, cmd_resizable_txt)},
 +    { "default_encoding",    PTR(uzbl.behave.default_encoding,    STR, cmd_default_encoding)},
 +    { "enforce_96_dpi",      PTR(uzbl.behave.enforce_96dpi,       INT, cmd_enforce_96dpi)},
 +    { "caret_browsing",      PTR(uzbl.behave.caret_browsing,      INT, cmd_caret_browsing)},
 +
 +    { NULL,                  {.ptr = NULL, .type = TYPE_INT, .func = NULL}}
  }, *n2v_p = var_name_to_ptr;
  
  const struct {
@@@ -1426,14 -1522,14 +1524,15 @@@ set_var_value(gchar *name, gchar *val) 
      if( (c = g_hash_table_lookup(uzbl.comm.proto_var, name)) ) {
          /* check for the variable type */
          if (c->type == TYPE_STR) {
+             buf = expand_vars(val);
              g_free(*c->ptr);
 -            *c->ptr = buf;
 -        } else if(c->type == TYPE_INT) {
 +            *c->ptr = g_strdup(val);
 +        } else if (c->type == TYPE_INT) {
              int *ip = (int *)c->ptr;
 -            buf = expand_vars(val);
 -            *ip = (int)strtoul(buf, &endp, 10);
 -            g_free(buf);
 +            *ip = (int)strtoul(val, &endp, 10);
 +        } else if (c->type == TYPE_FLOAT) {
 +            float *fp = (float *)c->ptr;
 +            *fp = strtof(val, &endp);
          }
  
          /* invoke a command specific function */
diff --cc uzbl.h
Simple merge