aboutsummaryrefslogtreecommitdiffhomepage
path: root/uzbl.c
diff options
context:
space:
mode:
authorGravatar DuClare <akarinotengoku@gmail.com>2009-05-19 11:04:06 +0300
committerGravatar DuClare <akarinotengoku@gmail.com>2009-05-19 11:04:06 +0300
commit692b7e70b4c629ea60aaba94ee46d4835ddfa7ba (patch)
tree4cba70ae4a8b051e2245bfcd71fc68150ba80a6b /uzbl.c
parentd228014222c889eb61150a5aa9b2efaf5259b880 (diff)
Argv stub
Diffstat (limited to 'uzbl.c')
-rw-r--r--uzbl.c33
1 files changed, 20 insertions, 13 deletions
diff --git a/uzbl.c b/uzbl.c
index fc95530..41d8cff 100644
--- a/uzbl.c
+++ b/uzbl.c
@@ -252,34 +252,34 @@ download_cb (WebKitWebView *web_view, GObject *download, gpointer user_data) {
/* 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
@@ -890,9 +890,16 @@ 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);
}