/* scroll a bar in a given direction */
static void
-scroll (GtkAdjustment* bar, const char *param) {
+scroll (GtkAdjustment* bar, GArray *argv) {
gdouble amount;
gchar *end;
- amount = g_ascii_strtod(param, &end);
+ amount = g_ascii_strtod(g_array_index(argv, gchar*, 0), &end);
if (*end == '%') amount = gtk_adjustment_get_page_size(bar) * amount * 0.01;
gtk_adjustment_set_value (bar, gtk_adjustment_get_value(bar)+amount);
}
-static void scroll_begin(WebKitWebView* page, const char *param) {
- (void) page; (void) param;
+static void scroll_begin(WebKitWebView* page, GArray *argv) {
+ (void) page; (void) argv;
gtk_adjustment_set_value (uzbl.gui.bar_v, gtk_adjustment_get_lower(uzbl.gui.bar_v));
}
-static void scroll_end(WebKitWebView* page, const char *param) {
- (void) page; (void) param;
+static void scroll_end(WebKitWebView* page, GArray *argv) {
+ (void) page; (void) argv;
gtk_adjustment_set_value (uzbl.gui.bar_v, gtk_adjustment_get_upper(uzbl.gui.bar_v) -
gtk_adjustment_get_page_size(uzbl.gui.bar_v));
}
-static void scroll_vert(WebKitWebView* page, const char *param) {
+static void scroll_vert(WebKitWebView* page, GArray *argv) {
(void) page;
- scroll(uzbl.gui.bar_v, param);
+ scroll(uzbl.gui.bar_v, argv);
}
-static void scroll_horz(WebKitWebView* page, const char *param) {
+static void scroll_horz(WebKitWebView* page, GArray *argv) {
(void) page;
- scroll(uzbl.gui.bar_h, param);
+ scroll(uzbl.gui.bar_h, argv);
}
static void
parse_command(const char *cmd, const char *param) {
Command c;
- if ((c = g_hash_table_lookup(uzbl.behave.commands, cmd)))
- c(uzbl.gui.web_view, param);
- else
+ if ((c = g_hash_table_lookup(uzbl.behave.commands, cmd))) {
+ int i;
+ gchar **par = split_quoted(param, TRUE);
+ GArray *a = g_array_new (TRUE, FALSE, sizeof(gchar*));
+ for (i = 0; i < g_strv_length(par); i++)
+ sharg_append(a, par[i]);
+ c(uzbl.gui.web_view, a);
+ g_strfreev (par);
+ g_array_free (a, TRUE);
+ } else
fprintf (stderr, "command \"%s\" not understood. ignoring.\n", cmd);
}
GRegex *keycmd_regex;
GRegex *get_regex;
GRegex *bind_regex;
+ gchar **sync_stdout;
} Communication;
download_cb (WebKitWebView *web_view, GObject *download, gpointer user_data);
static void
-toggle_status_cb (WebKitWebView* page, const char *param);
+toggle_status_cb (WebKitWebView* page, GArray *argv);
static void
link_hover_cb (WebKitWebView* page, const gchar* title, const gchar* link, gpointer data);
file_exists (const char * filename);
static void
-set_insert_mode(WebKitWebView *page, const gchar *param);
+set_insert_mode(WebKitWebView *page, GArray *argv);
static void
-load_uri (WebKitWebView * web_view, const gchar *param);
+load_uri (WebKitWebView * web_view, GArray *argv);
static void
new_window_load_uri (const gchar * uri);
static void
-close_uzbl (WebKitWebView *page, const char *param);
+close_uzbl (WebKitWebView *page, GArray *argv);
static gboolean
run_command(const gchar *command, const guint npre,
const gchar **args, const gboolean sync, char **stdout);
static void
-spawn(WebKitWebView *web_view, const char *param);
+spawn(WebKitWebView *web_view, GArray *argv);
static void
-spawn_sh(WebKitWebView *web_view, const char *param);
+spawn_sh(WebKitWebView *web_view, GArray *argv);
static void
parse_command(const char *cmd, const char *param);
static void
-runcmd(WebKitWebView *page, const char *param);
+runcmd(WebKitWebView *page, GArray *argv);
static void
parse_cmd_line(const char *ctl_line);
search_text (WebKitWebView *page, const char *param, const gboolean forward);
static void
-search_forward_text (WebKitWebView *page, const char *param);
+search_forward_text (WebKitWebView *page, GArray *argv);
static void
-search_reverse_text (WebKitWebView *page, const char *param);
+search_reverse_text (WebKitWebView *page, GArray *argv);
static void
-run_js (WebKitWebView * web_view, const gchar *param);
+run_js (WebKitWebView * web_view, GArray *argv);
static void handle_cookies (SoupSession *session,
SoupMessage *msg,