diff options
-rw-r--r-- | events.c | 3 | ||||
-rw-r--r-- | events.h | 2 | ||||
-rw-r--r-- | uzbl-core.c | 27 | ||||
-rw-r--r-- | uzbl-core.h | 3 |
4 files changed, 32 insertions, 3 deletions
@@ -42,7 +42,8 @@ const char *event_table[LAST_EVENT] = { "FOCUS_GAINED" , "FILE_INCLUDED" , "PLUG_CREATED" , - "COMMAND_ERROR" + "COMMAND_ERROR" , + "BUILTINS" }; void @@ -13,7 +13,7 @@ enum event_type { INSTANCE_START, INSTANCE_EXIT, LOAD_PROGRESS, LINK_UNHOVER, FORM_ACTIVE, ROOT_ACTIVE, FOCUS_LOST, FOCUS_GAINED, FILE_INCLUDED, - PLUG_CREATED, COMMAND_ERROR, + PLUG_CREATED, COMMAND_ERROR, BUILTINS, /* must be last entry */ LAST_EVENT 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 diff --git a/uzbl-core.h b/uzbl-core.h index 82137e3..4779139 100644 --- a/uzbl-core.h +++ b/uzbl-core.h @@ -472,6 +472,9 @@ hardcopy(WebKitWebView *page, GArray *argv, GString *result); void include(WebKitWebView *page, GArray *argv, GString *result); +void +builtins(WebKitWebView *page, GArray *argv, GString *result); + typedef void (*Command)(WebKitWebView*, GArray *argv, GString *result); typedef struct { |