From eabeb419e37673ebd79c9c1355eac82068393103 Mon Sep 17 00:00:00 2001 From: keis Date: Sun, 11 Sep 2011 15:58:45 +0200 Subject: remove event formatting from run_parsed_command * split event formatting and sending into separate functions and expose both in events.h * make it possible to format array of strings --- src/uzbl-core.c | 20 ++++++++------------ 1 file changed, 8 insertions(+), 12 deletions(-) (limited to 'src/uzbl-core.c') diff --git a/src/uzbl-core.c b/src/uzbl-core.c index af60767..b37582e 100644 --- a/src/uzbl-core.c +++ b/src/uzbl-core.c @@ -619,21 +619,17 @@ run_parsed_command(const CommandInfo *c, GArray *a, GString *result) { if(strcmp("set", c->key) && strcmp("event", c->key) && strcmp("request", c->key)) { - // FIXME, build string inside send_event - GString *param = g_string_new(""); - const gchar *p; - guint i = 0; - while ((p = argv_idx(a, i++))) - g_string_append_printf(param, " '%s'", p); - - /* might be destructive on array a */ - c->function(uzbl.gui.web_view, a, result); - send_event(COMMAND_EXECUTED, NULL, + Event *event = format_event (COMMAND_EXECUTED, NULL, TYPE_NAME, c->key, - TYPE_FORMATTEDSTR, param->str, + TYPE_STR_ARRAY, a, NULL); - g_string_free(param, TRUE); + + /* might be destructive on array a */ + c->function(uzbl.gui.web_view, a, result); + + send_formatted_event (event); + event_free (event); } else c->function(uzbl.gui.web_view, a, result); -- cgit v1.2.3