summaryrefslogtreecommitdiffstats
path: root/apps/plugins/keybox.c
diff options
context:
space:
mode:
authorJohannes Schwarz <ubuntuxer@rockbox.org>2009-06-26 17:59:33 +0000
committerJohannes Schwarz <ubuntuxer@rockbox.org>2009-06-26 17:59:33 +0000
commit73d25744fb01844cc28402dfc4b48a030d270579 (patch)
tree34a3e43d7160f263178928553644cf3392a6341b /apps/plugins/keybox.c
parentc2565c9bcf02b8b9fe0311a15a731dde449c1552 (diff)
downloadrockbox-73d25744fb01844cc28402dfc4b48a030d270579.tar.gz
rockbox-73d25744fb01844cc28402dfc4b48a030d270579.tar.bz2
rockbox-73d25744fb01844cc28402dfc4b48a030d270579.zip
FS#10283 simplify plugins' menus by using stringlist with callback (by Teruaki Kawashima - some minor changes by myself)
git-svn-id: svn://svn.rockbox.org/rockbox/trunk@21523 a1c6a512-1295-4272-9138-f99709370657
Diffstat (limited to 'apps/plugins/keybox.c')
-rw-r--r--apps/plugins/keybox.c26
1 files changed, 6 insertions, 20 deletions
diff --git a/apps/plugins/keybox.c b/apps/plugins/keybox.c
index 5d625a33a2..08d5131eff 100644
--- a/apps/plugins/keybox.c
+++ b/apps/plugins/keybox.c
@@ -71,7 +71,6 @@ static uint32_t salt;
static union hash pwhash;
static bool data_changed = false;
-static int context_item_cb(int action, const struct menu_item_ex *this_item);
static void encrypt_buffer(char *buf, size_t size, uint32_t *key);
static void decrypt_buffer(char *buf, size_t size, uint32_t *key);
@@ -105,35 +104,22 @@ static void decrypt(uint32_t* v, uint32_t* k)
v[0]=v0; v[1]=v1;
}
-MENUITEM_RETURNVALUE(context_add_entry, "Add entry", 0,
- NULL, Icon_NOICON);
-MENUITEM_RETURNVALUE(context_edit_title, "Edit title", 1,
- &context_item_cb, Icon_NOICON);
-MENUITEM_RETURNVALUE(context_edit_name, "Edit user name", 2,
- &context_item_cb, Icon_NOICON);
-MENUITEM_RETURNVALUE(context_edit_password, "Edit password", 3,
- &context_item_cb, Icon_NOICON);
-MENUITEM_RETURNVALUE(context_delete_entry, "Delete entry", 4,
- &context_item_cb, Icon_NOICON);
-MENUITEM_RETURNVALUE(context_debug, "debug", 5,
- &context_item_cb, Icon_NOICON);
-
-MAKE_MENU(context_m, "Context menu",
- context_item_cb, Icon_NOICON,
- &context_add_entry, &context_edit_title, &context_edit_name,
- &context_edit_password, &context_delete_entry);
-
static int context_item_cb(int action, const struct menu_item_ex *this_item)
{
if (action == ACTION_REQUEST_MENUITEM
&& pw_list.num_entries == 0
- && this_item != &context_add_entry)
+ && ((intptr_t)this_item) != 0)
{
return ACTION_EXIT_MENUITEM;
}
return action;
}
+MENUITEM_STRINGLIST(context_m, "Context menu", context_item_cb,
+ "Add entry",
+ "Edit title", "Edit user name", "Edit password",
+ "Delete entry")
+
static char * kb_list_cb(int selected_item, void *data,
char *buffer, size_t buffer_len)
{