diff options
| author | Johannes Schwarz <ubuntuxer@rockbox.org> | 2009-06-26 17:59:33 +0000 |
|---|---|---|
| committer | Johannes Schwarz <ubuntuxer@rockbox.org> | 2009-06-26 17:59:33 +0000 |
| commit | 73d25744fb01844cc28402dfc4b48a030d270579 (patch) | |
| tree | 34a3e43d7160f263178928553644cf3392a6341b /apps/plugins/calendar.c | |
| parent | c2565c9bcf02b8b9fe0311a15a731dde449c1552 (diff) | |
| download | rockbox-73d25744fb01844cc28402dfc4b48a030d270579.zip rockbox-73d25744fb01844cc28402dfc4b48a030d270579.tar.gz rockbox-73d25744fb01844cc28402dfc4b48a030d270579.tar.bz2 rockbox-73d25744fb01844cc28402dfc4b48a030d270579.tar.xz | |
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/calendar.c')
| -rw-r--r-- | apps/plugins/calendar.c | 27 |
1 files changed, 7 insertions, 20 deletions
diff --git a/apps/plugins/calendar.c b/apps/plugins/calendar.c index 72b572e..873a09b 100644 --- a/apps/plugins/calendar.c +++ b/apps/plugins/calendar.c @@ -627,8 +627,9 @@ static void add_memo(struct shown *shown, int type) static int edit_menu_cb(int action, const struct menu_item_ex *this_item) { - (void) this_item; - if (action == ACTION_REQUEST_MENUITEM && memos_in_shown_memory <= 0) + int i = (intptr_t)this_item; + if (action == ACTION_REQUEST_MENUITEM + && memos_in_shown_memory <= 0 && (i==0 || i==1)) return ACTION_EXIT_MENUITEM; return action; } @@ -638,24 +639,10 @@ static bool edit_memo(int change, struct shown *shown) bool exit = false; int selected = 0; - MENUITEM_RETURNVALUE(edit_menu_remove, "Remove", 0, - edit_menu_cb, Icon_NOICON); - MENUITEM_RETURNVALUE(edit_menu_edit, "Edit", 1, - edit_menu_cb, Icon_NOICON); - MENUITEM_RETURNVALUE(edit_menu_weekly, "New Weekly", 2, - NULL, Icon_NOICON); - MENUITEM_RETURNVALUE(edit_menu_monthly, "New Monthly", 3, - NULL, Icon_NOICON); - MENUITEM_RETURNVALUE(edit_menu_yearly, "New Yearly", 4, - NULL, Icon_NOICON); - MENUITEM_RETURNVALUE(edit_menu_oneoff, "New One off", 5, - NULL, Icon_NOICON); - - MAKE_MENU(edit_menu, "Edit menu", - NULL, Icon_NOICON, - &edit_menu_remove, &edit_menu_edit, - &edit_menu_weekly, &edit_menu_monthly, - &edit_menu_yearly, &edit_menu_oneoff); + MENUITEM_STRINGLIST(edit_menu, "Edit menu", edit_menu_cb, + "Remove", "Edit", + "New Weekly", "New Monthly", + "New Yearly", "New One off"); while (!exit) { |