aboutsummaryrefslogtreecommitdiffhomepage
path: root/uzbl-core.c
diff options
context:
space:
mode:
authorGravatar Rob <rob.manea@gmail.com>2009-11-20 14:45:32 +0100
committerGravatar Rob <rob.manea@gmail.com>2009-11-20 14:45:32 +0100
commitb40b524072a4e72a209830d2060f99a210f93433 (patch)
treebba9fc2505c8035fac9cc63b055fd0334b4b731e /uzbl-core.c
parentba0f52ab830159ca1d3d3ce92ff2f08ede8eca1c (diff)
added "builtins" command and corresponding event
Diffstat (limited to 'uzbl-core.c')
-rw-r--r--uzbl-core.c27
1 files changed, 26 insertions, 1 deletions
diff --git a/uzbl-core.c b/uzbl-core.c
index 2f808b5..e25385c 100644
--- a/uzbl-core.c
+++ b/uzbl-core.c
@@ -652,7 +652,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} },
+ { "builtins", {builtins, TRUE} }
};
void
@@ -665,6 +666,30 @@ commands_hash(void)
g_hash_table_insert(uzbl.behave.commands, (gpointer) cmdlist[i].key, &cmdlist[i].value);
}
+// TODO: we should probably build the command list once and just re-use that on every
+// invocation of "builtins"
+void
+builtins(WebKitWebView *page, GArray *argv, GString *result) {
+ (void) page;
+ (void) argv;
+ // see TODO below
+ (void) result;
+ unsigned int i,
+ len = LENGTH(cmdlist);
+ GString *command_list = g_string_new("");
+
+ for (i = 0; i < len; i++) {
+ g_string_append(command_list, cmdlist[i].key);
+ g_string_append_c(command_list, ' ');
+ }
+
+ // TODO: Do we also want to query for the builtins without generating an event?
+ //result = command_list;
+
+ send_event(BUILTINS, command_list->str, NULL);
+ g_string_free(command_list, TRUE);
+}
+
/* -- CORE FUNCTIONS -- */
bool