diff options
Diffstat (limited to 'src/uzbl-core.c')
-rw-r--r-- | src/uzbl-core.c | 459 |
1 files changed, 106 insertions, 353 deletions
diff --git a/src/uzbl-core.c b/src/uzbl-core.c index 2e87d1b..1bac5ed 100644 --- a/src/uzbl-core.c +++ b/src/uzbl-core.c @@ -34,6 +34,7 @@ #include "events.h" #include "inspector.h" #include "config.h" +#include "util.h" UzblCore uzbl; @@ -62,15 +63,6 @@ GOptionEntry entries[] = { NULL, 0, 0, 0, NULL, NULL, NULL } }; -XDG_Var XDG[] = -{ - { "XDG_CONFIG_HOME", "~/.config" }, - { "XDG_DATA_HOME", "~/.local/share" }, - { "XDG_CACHE_HOME", "~/.cache" }, - { "XDG_CONFIG_DIRS", "/etc/xdg" }, - { "XDG_DATA_DIRS", "/usr/local/share/:/usr/share/" }, -}; - /* abbreviations to help keep the table's width humane */ #define PTR_V_STR(var, d, fun) { .ptr.s = &(var), .type = TYPE_STR, .dump = d, .writeable = 1, .func = fun } #define PTR_V_INT(var, d, fun) { .ptr.i = (int*)&(var), .type = TYPE_INT, .dump = d, .writeable = 1, .func = fun } @@ -93,12 +85,12 @@ 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_background", PTR_V_STR(uzbl.behave.status_background, 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)}, { "icon", PTR_V_STR(uzbl.gui.icon, 1, set_icon)}, { "forward_keys", PTR_V_INT(uzbl.behave.forward_keys, 1, NULL)}, - { "cookie_handler", PTR_V_STR(uzbl.behave.cookie_handler, 1, NULL)}, + { "cookie_handler", PTR_V_STR(uzbl.behave.cookie_handler, 1, cmd_set_cookie_handler)}, { "authentication_handler", PTR_V_STR(uzbl.behave.authentication_handler, 1, set_authentication_handler)}, { "scheme_handler", PTR_V_STR(uzbl.behave.scheme_handler, 1, NULL)}, { "fifo_dir", PTR_V_STR(uzbl.behave.fifo_dir, 1, cmd_fifo_dir)}, @@ -373,48 +365,6 @@ strfree(gchar *str) { gchar* argv_idx(const GArray *a, const guint idx) { return g_array_index(a, gchar*, idx); } -char * -str_replace (const char* search, const char* replace, const char* string) { - gchar **buf; - char *ret; - - if(!string) - return NULL; - - buf = g_strsplit (string, search, -1); - ret = g_strjoinv (replace, buf); - g_strfreev(buf); - - return ret; -} - -GArray* -read_file_by_line (const gchar *path) { - GIOChannel *chan = NULL; - gchar *readbuf = NULL; - gsize len; - GArray *lines = g_array_new(TRUE, FALSE, sizeof(gchar*)); - int i = 0; - - chan = g_io_channel_new_file(path, "r", NULL); - if (chan) { - while (g_io_channel_read_line(chan, &readbuf, &len, NULL, NULL) == G_IO_STATUS_NORMAL) { - const gchar* val = g_strdup (readbuf); - g_array_append_val (lines, val); - g_free (readbuf); - i ++; - } - - g_io_channel_unref (chan); - } else { - gchar *tmp = g_strdup_printf("File %s can not be read.", path); - send_event(COMMAND_ERROR, tmp, NULL); - g_free(tmp); - } - - return lines; -} - /* search a PATH style string for an existing file+path combination */ gchar* find_existing_file(gchar* path_list) { @@ -680,7 +630,6 @@ struct {const char *key; CommandInfo value;} cmdlist[] = { "sync_spawn", {spawn_sync, 0} }, // needed for cookie handler { "sh", {spawn_sh, 0} }, { "sync_sh", {spawn_sh_sync, 0} }, // needed for cookie handler - { "talk_to_socket", {talk_to_socket, 0} }, { "exit", {close_uzbl, 0} }, { "search", {search_forward_text, TRUE} }, { "search_reverse", {search_reverse_text, TRUE} }, @@ -706,7 +655,8 @@ struct {const char *key; CommandInfo value;} cmdlist[] = { "menu_image_remove", {menu_remove_image, TRUE} }, { "menu_editable_remove", {menu_remove_edit, TRUE} }, { "hardcopy", {hardcopy, TRUE} }, - { "include", {include, TRUE} } + { "include", {include, TRUE} }, + { "show_inspector", {show_inspector, 0} } }; void @@ -736,11 +686,6 @@ builtins() { /* -- CORE FUNCTIONS -- */ -bool -file_exists (const char * filename) { - return (access(filename, F_OK) == 0); -} - void set_var(WebKitWebView *page, GArray *argv, GString *result) { (void) page; (void) result; @@ -971,28 +916,30 @@ hardcopy(WebKitWebView *page, GArray *argv, GString *result) { webkit_web_frame_print(webkit_web_view_get_main_frame(page)); } +/* just a wrapper so parse_cmd_line can be used with for_each_line_in_file */ +static void +parse_cmd_line_cb(const char *line, void *user_data) { + (void) user_data; + parse_cmd_line(line, NULL); +} + void include(WebKitWebView *page, GArray *argv, GString *result) { (void) page; (void) result; gchar *pe = NULL, - *path = NULL, - *line; - int i=0; + *path = NULL; if(!argv_idx(argv, 0)) return; pe = parseenv(argv_idx(argv, 0)); if((path = find_existing_file(pe))) { - GArray* lines = read_file_by_line(path); - - while ((line = g_array_index(lines, gchar*, i))) { - parse_cmd_line (line, NULL); - i++; - g_free (line); + if(!for_each_line_in_file(path, parse_cmd_line_cb, NULL)) { + gchar *tmp = g_strdup_printf("File %s can not be read.", path); + send_event(COMMAND_ERROR, tmp, NULL); + g_free(tmp); } - g_array_free (lines, TRUE); send_event(FILE_INCLUDED, path, NULL); g_free(path); @@ -1001,6 +948,13 @@ include(WebKitWebView *page, GArray *argv, GString *result) { } void +show_inspector(WebKitWebView *page, GArray *argv, GString *result) { + (void) page; (void) argv; (void) result; + + webkit_web_inspector_show(uzbl.gui.inspector); +} + +void act_dump_config() { dump_config(); } @@ -1157,32 +1111,23 @@ run_external_js (WebKitWebView * web_view, GArray *argv, GString *result) { if (argv_idx(argv, 0) && ((path = find_existing_file(argv_idx(argv, 0)))) ) { - GArray* lines = read_file_by_line (path); - gchar* js = NULL; - int i = 0; - gchar* line; - - while ((line = g_array_index(lines, gchar*, i))) { - if (js == NULL) { - js = g_strdup (line); - } else { - gchar* newjs = g_strconcat (js, line, NULL); - js = newjs; - } - i ++; - g_free (line); + gchar *file_contents = NULL; + + GIOChannel *chan = g_io_channel_new_file(path, "r", NULL); + if (chan) { + gsize len; + g_io_channel_read_to_end(chan, &file_contents, &len, NULL); + g_io_channel_unref (chan); } if (uzbl.state.verbose) printf ("External JavaScript file %s loaded\n", argv_idx(argv, 0)); - gchar* newjs = str_replace("%s", argv_idx (argv, 1)?argv_idx (argv, 1):"", js); - g_free (js); - js = newjs; + gchar *js = str_replace("%s", argv_idx (argv, 1) ? argv_idx (argv, 1) : "", file_contents); + g_free (file_contents); eval_js (web_view, js, result, path); g_free (js); - g_array_free (lines, TRUE); g_free(path); } } @@ -1264,6 +1209,29 @@ sharg_append(GArray *a, const gchar *str) { g_array_append_val(a, s); } +gboolean +uzbl_setup_environ() { + gchar *util_dirs = expand("@scripts_util_dir", 0); + gchar *util_dir = NULL; + gboolean succeed = FALSE; + + if(!util_dirs) { + g_free(util_dirs); + return succeed; + } + + if(!(util_dir = find_existing_file(util_dirs))) { + g_free(util_dirs); + return succeed; + } + + succeed = g_setenv("UZBL_UTIL_DIR", util_dir, TRUE); + + g_free(util_dirs); + g_free(util_dir); + return succeed; +} + // make sure that the args string you pass can properly be interpreted (eg properly escaped against whitespace, quotes etc) gboolean run_command (const gchar *command, const guint npre, const gchar **args, @@ -1275,6 +1243,8 @@ run_command (const gchar *command, const guint npre, const gchar **args, gchar *pid = itos(getpid()); gchar *xwin = itos(uzbl.xwin); guint i; + gboolean environ_set = uzbl_setup_environ(); + sharg_append(a, command); for (i = 0; i < npre; i++) /* add n args before the default vars */ sharg_append(a, args[i]); @@ -1313,6 +1283,9 @@ run_command (const gchar *command, const guint npre, const gchar **args, printf("Stdout: %s\n", *output_stdout); } } + if (!environ_set) { + g_printerr("failed to set the environment for scripts"); + } if (err) { g_printerr("error on run_command: %s\n", err->message); g_error_free (err); @@ -1433,118 +1406,6 @@ spawn_sh_sync(WebKitWebView *web_view, GArray *argv, GString *result) { } void -talk_to_socket(WebKitWebView *web_view, GArray *argv, GString *result) { - (void)web_view; (void)result; - - int fd, len; - struct sockaddr_un sa; - char* sockpath; - ssize_t ret; - struct pollfd pfd; - struct iovec* iov; - guint i; - - if(uzbl.comm.sync_stdout) uzbl.comm.sync_stdout = strfree(uzbl.comm.sync_stdout); - - /* This function could be optimised by storing a hash table of socket paths - and associated connected file descriptors rather than closing and - re-opening for every call. Also we could launch a script if socket connect - fails. */ - - /* First element argv[0] is path to socket. Following elements are tokens to - write to the socket. We write them as a single packet with each token - separated by an ASCII nul (\0). */ - if(argv->len < 2) { - g_printerr("talk_to_socket called with only %d args (need at least two).\n", - (int)argv->len); - return; - } - - /* copy socket path, null terminate result */ - sockpath = g_array_index(argv, char*, 0); - g_strlcpy(sa.sun_path, sockpath, sizeof(sa.sun_path)); - sa.sun_family = AF_UNIX; - - /* create socket file descriptor and connect it to path */ - fd = socket(AF_UNIX, SOCK_SEQPACKET, 0); - if(fd == -1) { - g_printerr("talk_to_socket: creating socket failed (%s)\n", strerror(errno)); - return; - } - if(connect(fd, (struct sockaddr*)&sa, sizeof(sa))) { - g_printerr("talk_to_socket: connect failed (%s)\n", strerror(errno)); - close(fd); - return; - } - - /* build request vector */ - iov = g_malloc(sizeof(struct iovec) * (argv->len - 1)); - if(!iov) { - g_printerr("talk_to_socket: unable to allocated memory for token vector\n"); - close(fd); - return; - } - for(i = 1; i < argv->len; ++i) { - iov[i - 1].iov_base = g_array_index(argv, char*, i); - iov[i - 1].iov_len = strlen(iov[i - 1].iov_base) + 1; /* string plus \0 */ - } - - /* write request */ - ret = writev(fd, iov, argv->len - 1); - g_free(iov); - if(ret == -1) { - g_printerr("talk_to_socket: write failed (%s)\n", strerror(errno)); - close(fd); - return; - } - - /* wait for a response, with a 500ms timeout */ - pfd.fd = fd; - pfd.events = POLLIN; - while(1) { - ret = poll(&pfd, 1, 500); - if(ret == 1) break; - if(ret == 0) errno = ETIMEDOUT; - if(errno == EINTR) continue; - g_printerr("talk_to_socket: poll failed while waiting for input (%s)\n", - strerror(errno)); - close(fd); - return; - } - - /* get length of response */ - if(ioctl(fd, FIONREAD, &len) == -1) { - g_printerr("talk_to_socket: cannot find daemon response length, " - "ioctl failed (%s)\n", strerror(errno)); - close(fd); - return; - } - - /* if there is a response, read it */ - if(len) { - uzbl.comm.sync_stdout = g_malloc(len + 1); - if(!uzbl.comm.sync_stdout) { - g_printerr("talk_to_socket: failed to allocate %d bytes\n", len); - close(fd); - return; - } - uzbl.comm.sync_stdout[len] = 0; /* ensure result is null terminated */ - - ret = read(fd, uzbl.comm.sync_stdout, len); - if(ret == -1) { - g_printerr("talk_to_socket: failed to read from socket (%s)\n", - strerror(errno)); - close(fd); - return; - } - } - - /* clean up */ - close(fd); - return; -} - -void parse_command(const char *cmd, const char *param, GString *result) { CommandInfo *c; GString *tmp = g_string_new(""); @@ -1717,7 +1578,6 @@ parse_cmd_line(const char *ctl_line, GString *result) { g_free(ctlstrip); } - /*@null@*/ gchar* build_stream_name(int type, const gchar* dir) { State *s = &uzbl.state; @@ -1995,10 +1855,15 @@ update_title (void) { Behaviour *b = &uzbl.behave; gchar *parsed; + if(!GTK_IS_WINDOW(uzbl.gui.main_window)) + return; /* we're just starting up or just shutting down. */ + + const gchar *current_title = gtk_window_get_title (GTK_WINDOW(uzbl.gui.main_window)); + if (b->show_status) { - if (b->title_format_short) { + if (b->title_format_short && uzbl.gui.main_window) { parsed = expand(b->title_format_short, 0); - if (uzbl.gui.main_window) + if(!current_title || strcmp(current_title, parsed)) gtk_window_set_title (GTK_WINDOW(uzbl.gui.main_window), parsed); g_free(parsed); } @@ -2007,19 +1872,10 @@ update_title (void) { gtk_label_set_markup(GTK_LABEL(uzbl.gui.mainbar_label), parsed); g_free(parsed); } - if (b->status_background) { - GdkColor color; - gdk_color_parse (b->status_background, &color); - //labels and hboxes do not draw their own background. applying this on the vbox/main_window is ok as the statusbar is the only affected widget. (if not, we could also use GtkEventBox) - if (uzbl.gui.main_window) - gtk_widget_modify_bg (uzbl.gui.main_window, GTK_STATE_NORMAL, &color); - else if (uzbl.gui.plug) - gtk_widget_modify_bg (GTK_WIDGET(uzbl.gui.plug), GTK_STATE_NORMAL, &color); - } } else { - if (b->title_format_long) { + if (b->title_format_long && uzbl.gui.main_window) { parsed = expand(b->title_format_long, 0); - if (uzbl.gui.main_window) + if(!current_title || strcmp(current_title, parsed)) gtk_window_set_title (GTK_WINDOW(uzbl.gui.main_window), parsed); g_free(parsed); } @@ -2038,12 +1894,10 @@ create_browser () { "signal::button-press-event", (GCallback)button_press_cb, NULL, "signal::button-release-event", (GCallback)button_release_cb, NULL, "signal::motion-notify-event", (GCallback)motion_notify_cb, NULL, - "signal::title-changed", (GCallback)title_change_cb, NULL, + "signal::notify::title", (GCallback)title_change_cb, NULL, "signal::selection-changed", (GCallback)selection_changed_cb, NULL, - "signal::load-progress-changed", (GCallback)progress_change_cb, NULL, - "signal::load-committed", (GCallback)load_commit_cb, NULL, - "signal::load-started", (GCallback)load_start_cb, NULL, - "signal::load-finished", (GCallback)load_finish_cb, NULL, + "signal::notify::progress", (GCallback)progress_change_cb, NULL, + "signal::notify::load-status", (GCallback)load_status_change_cb, NULL, "signal::load-error", (GCallback)load_error_cb, NULL, "signal::hovering-over-link", (GCallback)link_hover_cb, NULL, "signal::navigation-policy-decision-requested", (GCallback)navigation_decision_cb, NULL, @@ -2126,8 +1980,7 @@ inject_handler_args(const gchar *actname, const gchar *origargs, const gchar *ne if ((g_strcmp0(actname, "spawn") == 0) || (g_strcmp0(actname, "sh") == 0) || (g_strcmp0(actname, "sync_spawn") == 0) || - (g_strcmp0(actname, "sync_sh") == 0) || - (g_strcmp0(actname, "talk_to_socket") == 0)) { + (g_strcmp0(actname, "sync_sh") == 0)) { guint i; GString *a = g_string_new(""); gchar **spawnparts = split_quoted(origargs, FALSE); @@ -2223,59 +2076,6 @@ run_handler (const gchar *act, const gchar *args) { g_strfreev(parts); } -/*@null@*/ gchar* -get_xdg_var (XDG_Var xdg) { - const gchar* actual_value = getenv (xdg.environmental); - const gchar* home = getenv ("HOME"); - gchar* return_value; - - if (! actual_value || strcmp (actual_value, "") == 0) { - if (xdg.default_value) { - return_value = str_replace ("~", home, xdg.default_value); - } else { - return_value = NULL; - } - } else { - return_value = str_replace("~", home, actual_value); - } - - return return_value; -} - -/*@null@*/ gchar* -find_xdg_file (int xdg_type, const char* filename) { - /* xdg_type = 0 => config - xdg_type = 1 => data - xdg_type = 2 => cache*/ - - gchar* xdgv = get_xdg_var (XDG[xdg_type]); - gchar* temporary_file = g_strconcat (xdgv, filename, NULL); - g_free (xdgv); - - gchar* temporary_string; - char* saveptr; - char* buf; - - if (! file_exists (temporary_file) && xdg_type != 2) { - buf = get_xdg_var (XDG[3 + xdg_type]); - temporary_string = (char *) strtok_r (buf, ":", &saveptr); - g_free(buf); - - while ((temporary_string = (char * ) strtok_r (NULL, ":", &saveptr)) && ! file_exists (temporary_file)) { - g_free (temporary_file); - temporary_file = g_strconcat (temporary_string, filename, NULL); - } - } - - //g_free (temporary_string); - segfaults. - - if (file_exists (temporary_file)) { - return temporary_file; - } else { - g_free(temporary_file); - return NULL; - } -} void settings_init () { State *s = &uzbl.state; @@ -2296,25 +2096,17 @@ settings_init () { } if (s->config_file) { - GArray* lines = read_file_by_line (s->config_file); - int i = 0; - gchar* line; - - while ((line = g_array_index(lines, gchar*, i))) { - parse_cmd_line (line, NULL); - i ++; - g_free (line); + if(!for_each_line_in_file(s->config_file, parse_cmd_line_cb, NULL)) { + gchar *tmp = g_strdup_printf("File %s can not be read.", s->config_file); + send_event(COMMAND_ERROR, tmp, NULL); + g_free(tmp); } - g_array_free (lines, TRUE); - } else { - if (uzbl.state.verbose) - printf ("No configuration file loaded.\n"); - } + } else if (uzbl.state.verbose) + printf ("No configuration file loaded.\n"); if(s->connect_socket_names) init_connect_socket(); - g_signal_connect_after(n->soup_session, "request-started", G_CALLBACK(handle_cookies), NULL); g_signal_connect(n->soup_session, "authenticate", G_CALLBACK(handle_authentication), NULL); } @@ -2374,57 +2166,6 @@ void handle_authentication (SoupSession *session, SoupMessage *msg, SoupAuth *au } } -void handle_cookies (SoupSession *session, SoupMessage *msg, gpointer user_data) { - (void) session; - (void) user_data; - - soup_message_add_header_handler(msg, "got-headers", "Set-Cookie", G_CALLBACK(save_cookies_http), NULL); - GString *s = g_string_new (""); - SoupURI * soup_uri = soup_message_get_uri(msg); - g_string_printf(s, "GET '%s' '%s' '%s'", soup_uri->scheme, soup_uri->host, soup_uri->path); - - if(uzbl.behave.cookie_handler) - run_handler(uzbl.behave.cookie_handler, s->str); - - if(uzbl.behave.cookie_handler && - uzbl.comm.sync_stdout && strcmp (uzbl.comm.sync_stdout, "") != 0) { - char *p = strchr(uzbl.comm.sync_stdout, '\n' ); - if ( p != NULL ) *p = '\0'; - soup_message_headers_replace (msg->request_headers, "Cookie", (const char *) uzbl.comm.sync_stdout); - - int len = strlen(uzbl.comm.sync_stdout); - - if(len > 0) { - SoupCookie *soup_cookie; - char *cookies = (char *) g_malloc(len+1); - strncpy(cookies, uzbl.comm.sync_stdout, len+1); - - /* Disconnect to avoid recursion */ - g_object_disconnect(G_OBJECT(uzbl.net.soup_cookie_jar), "any_signal", G_CALLBACK(save_cookies_js), NULL, NULL); - - p = cookies - 1; - while(p != NULL) { - p = p + 1; - soup_cookie = soup_cookie_parse((const char *) p, soup_uri); - if (soup_cookie) { - if(soup_cookie->domain == NULL) - soup_cookie->domain = soup_uri->host; - soup_cookie_jar_add_cookie(uzbl.net.soup_cookie_jar, soup_cookie); - } - p = strchr(p, ';'); - } - - g_object_connect(G_OBJECT(uzbl.net.soup_cookie_jar), "signal::changed", G_CALLBACK(save_cookies_js), NULL, NULL); - g_free(cookies); - } - } - - if (uzbl.comm.sync_stdout) - uzbl.comm.sync_stdout = strfree(uzbl.comm.sync_stdout); - - g_string_free(s, TRUE); -} - void dump_var_hash(gpointer k, gpointer v, gpointer ud) { (void) ud; @@ -2523,9 +2264,8 @@ initialize(int argc, char *argv[]) { uzbl.net.soup_session = webkit_get_default_session(); - uzbl.net.soup_cookie_jar = soup_cookie_jar_new(); + uzbl.net.soup_cookie_jar = uzbl_cookie_jar_new(); soup_session_add_feature(uzbl.net.soup_session, SOUP_SESSION_FEATURE(uzbl.net.soup_cookie_jar)); - g_object_connect(G_OBJECT(uzbl.net.soup_cookie_jar), "signal::changed", G_CALLBACK(save_cookies_js), NULL, NULL); for(i=0; sigs[i]; i++) { if(setup_signal(sigs[i], catch_signal) == SIG_ERR) @@ -2549,6 +2289,7 @@ initialize(int argc, char *argv[]) { void load_uri_imp(gchar *uri) { GString* newuri; + SoupURI* soup_uri; /* Strip leading whitespaces */ while (*uri) { @@ -2560,26 +2301,28 @@ load_uri_imp(gchar *uri) { eval_js(uzbl.gui.web_view, uri, NULL, "javascript:"); return; } + newuri = g_string_new (uri); - if (!soup_uri_new(uri)) { - GString* fullpath = g_string_new (""); + soup_uri = soup_uri_new(uri); + + if (!soup_uri) { + gchar* fullpath; if (g_path_is_absolute (newuri->str)) - g_string_assign (fullpath, newuri->str); + fullpath = newuri->str; else { - gchar* wd; - wd = g_get_current_dir (); - g_string_assign (fullpath, g_build_filename (wd, newuri->str, NULL)); - free(wd); + gchar* wd = g_get_current_dir (); + fullpath = g_build_filename (wd, newuri->str, NULL); + g_free(wd); } struct stat stat_result; - if (! g_stat(fullpath->str, &stat_result)) { - g_string_prepend (fullpath, "file://"); - g_string_assign (newuri, fullpath->str); - } + if (! g_stat(fullpath, &stat_result)) + g_string_printf (newuri, "file://%s", fullpath); else g_string_prepend (newuri, "http://"); - g_string_free (fullpath, TRUE); + } else { + soup_uri_free(soup_uri); } + /* if we do handle cookies, ask our handler for them */ webkit_web_view_load_uri (uzbl.gui.web_view, newuri->str); g_string_free (newuri, TRUE); @@ -2630,6 +2373,16 @@ main (int argc, char* argv[]) { uzbl.gui.bar_h = gtk_range_get_adjustment((GtkRange*) uzbl.gui.scbar_h); gtk_widget_set_scroll_adjustments ((GtkWidget*) uzbl.gui.web_view, uzbl.gui.bar_h, uzbl.gui.bar_v); + g_object_connect((GObject*)uzbl.gui.bar_v, + "signal::value-changed", (GCallback)scroll_vert_cb, NULL, + "signal::changed", (GCallback)scroll_vert_cb, NULL, + NULL); + + g_object_connect((GObject*)uzbl.gui.bar_h, + "signal::value-changed", (GCallback)scroll_horiz_cb, NULL, + "signal::changed", (GCallback)scroll_horiz_cb, NULL, + NULL); + if(!uzbl.state.instance_name) uzbl.state.instance_name = itos((int)uzbl.xwin); |