mirror of
https://github.com/saymrwulf/xous-core.git
synced 2026-11-15 08:30:02 +00:00
this autogenerated file should not be in the tree
This commit is contained in:
parent
254fe8a879
commit
0fe5fcdc35
1 changed files with 0 additions and 51 deletions
|
|
@ -1,51 +0,0 @@
|
|||
#![cfg_attr(rustfmt, rustfmt_skip)]
|
||||
// This file is auto-generated by xtask/main.rs generate_app_menus()
|
||||
use crate::StatusOpcode;
|
||||
use gam::{MenuItem, MenuPayload};
|
||||
use locales::t;
|
||||
use num_traits::*;
|
||||
use std::{error::Error, fmt};
|
||||
|
||||
#[derive(Debug)]
|
||||
pub enum AppDispatchError {
|
||||
IndexNotFound(usize),
|
||||
}
|
||||
|
||||
impl Error for AppDispatchError {}
|
||||
|
||||
impl fmt::Display for AppDispatchError {
|
||||
fn fmt(&self, f: &mut fmt::Formatter) -> fmt::Result {
|
||||
match self {
|
||||
AppDispatchError::IndexNotFound(app_index) => write!(f, "Index {} not found", app_index),
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
pub(crate) fn app_dispatch(gam: &gam::Gam, token: [u32; 4], index: usize) -> Result<(), AppDispatchError> {
|
||||
match index {
|
||||
0 => {
|
||||
gam.switch_to_app(gam::APP_NAME_VAULT, token).expect("couldn't raise app");
|
||||
Ok(())
|
||||
},
|
||||
_ => Err(AppDispatchError::IndexNotFound(index)),
|
||||
}
|
||||
}
|
||||
|
||||
pub(crate) fn app_index_to_name(index: usize) -> Result<&'static str, AppDispatchError> {
|
||||
match index {
|
||||
0 => Ok(t!("appmenu.vault", locales::LANG)),
|
||||
_ => Err(AppDispatchError::IndexNotFound(index)),
|
||||
}
|
||||
}
|
||||
|
||||
pub(crate) fn app_menu_items(menu_items: &mut Vec::<MenuItem>, status_conn: u32) {
|
||||
|
||||
menu_items.push(MenuItem {
|
||||
name: String::from(t!("appmenu.vault", locales::LANG)),
|
||||
action_conn: Some(status_conn),
|
||||
action_opcode: StatusOpcode::SwitchToApp.to_u32().unwrap(),
|
||||
action_payload: MenuPayload::Scalar([0, 0, 0, 0]),
|
||||
close_on_select: true,
|
||||
});
|
||||
|
||||
}
|
||||
Loading…
Reference in a new issue