/* * reader.c - Reader Turbo application * * Copyright (C) 2003 BLADOX, s.r.o. * * This program is free software; you can redistribute it and/or modify it * under the terms of the GNU General Public License as published by the * Free Software Foundation; either version 2, or (at your option) any * later version. * * This program is distributed in the hope that it will be useful, but * WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU * General Public License for more details. */ #include <config.h> #include <turbo/turbo.h> #include <stdlib.h> u8 PROGMEM t_Foo_en[] = "Reader"; u8 PROGMEM t_docs[] = "/docs"; SNodeP dummy_n = { NULL, NULL }; u8 reader_df (SCtx * ctx, u8 action) { if (action == APP_ENTER) { Inode *ino = inode (); get_inode (ino, ctx->eD); if (ino->type == INODE_TYPE_DIR) { cd_i (ctx->eD); spider_append_r (ctx, &dummy_n); ctx->n_default = 2; } else return display_more (ctx->eD); } else if (action == APP_LEAVE) spider_clear_r (ctx); return APP_OK; } void action_menu (void *data) { SCtx *c; u8 i = mc_detect (); if (i != MC_OK) { if (i == MC_NOT_PRESENT) perror (ERR_MC_NOT_PRESENT); else perror (ERR_MC_NOT_READY); return; } c = spider_init (); if (c == NULL) return; cd (t_docs); c->eD = pwd (); c->df_fnc = reader_df; spider (c); } void turbo_handler (u8 action, void *data) { switch (action) { case ACTION_INSERT_MENU: insert_menu (t_Foo_en); break; case ACTION_MENU_SELECTION: stk_thread (action_menu, data); break; default: break; } }
Copyright © 2004-2006 BLADOX | Turbo version 1.2
|