Пример #1
0
struct _menuUnit* info_ui_init()
{
    struct _menuUnit *p = common_ui_init();
    return_null_if_fail(p != NULL);
    menuUnit_set_name(p, "<~info.name>");
    menuUnit_set_title(p, "<~info.title>");
    menuUnit_set_icon(p, "@info");
    assert_if_fail(menuNode_init(p) != NULL);
    //mount
    struct _menuUnit *temp = common_ui_init();
    menuUnit_set_name(temp, "<~info.mount.name>"); 
    menuUnit_set_icon(temp, "@info.mount");
    menuUnit_set_show(temp, &info_mount_show);
    assert_if_fail(menuNode_add(p, temp) == RET_OK);
    //log
    temp = common_ui_init();
    menuUnit_set_name(temp, "<~info.log.name>"); 
    menuUnit_set_icon(temp, "@info.log");
    menuUnit_set_show(temp, &info_log_show);
    assert_if_fail(menuNode_add(p, temp) == RET_OK);

    //about
    temp = common_ui_init();
    menuUnit_set_name(temp, "<~info.about.name>"); 
    menuUnit_set_icon(temp, "@info.about");
    menuUnit_set_show(temp, &info_about_show);
    assert_if_fail(menuNode_add(p, temp) == RET_OK);
    return p;
}
Пример #2
0
struct _menuUnit * sd_ui_init()
{
    struct _menuUnit *p = common_ui_init();
    return_null_if_fail(p != NULL);
    strncpy(p->name, "<~sd.name>", MENU_LEN);
    strncpy(p->title_name, "<~sd.title_name>", MENU_LEN);
    strncpy(p->icon, "@sd",  MENU_LEN);
    p->result = 0;
    return_null_if_fail(menuNode_init(p) != NULL);
    //install from sd
    struct _menuUnit  *temp = common_ui_init();
    return_null_if_fail(temp != NULL);
    menuUnit_set_icon(temp, "@sd.choose");
    strncpy(temp->name, "<~sd.install.name>", MENU_LEN);
    temp->show = &sd_menu_show;
    assert_if_fail(menuNode_add(p, temp) == RET_OK);
    //install update.bin from sd
    temp = common_ui_init();
    menuUnit_set_icon(temp, "@sd.install");
    strncpy(temp->name,"<~sd.update.name>", MENU_LEN);
    temp->show = &sd_update_show;
    assert_if_fail(menuNode_add(p, temp) == RET_OK);
    if (acfg()->sd_ext == 1)
    {
        //install from external_sd
        struct _menuUnit  *temp = common_ui_init();
        return_null_if_fail(temp != NULL);
        menuUnit_set_icon(temp, "@sd.choose");
        strncpy(temp->name, "<~sdext.install.name>", MENU_LEN);
        temp->show = &sdext_menu_show;
        assert_if_fail(menuNode_add(p, temp) == RET_OK);
    }
    return p;
}
Пример #3
0
static STATUS mount_child_show(menuUnit *p)
{
    return_val_if_fail(p != NULL, MENU_BACK);
    intentType intent_type = (p->desc[0] == '0')?INTENT_MOUNT : INTENT_UNMOUNT;
    switch(p->result)
    {
        case MOUNT_CACHE:
            miuiIntent_send(intent_type, 1, "/cache");
            break;
        case MOUNT_DATA:
            miuiIntent_send(intent_type, 1,  "/data");
            break;
        case MOUNT_SYSTEM:
            miuiIntent_send(intent_type, 1, "/system");
            break;
        case MOUNT_SDCARD:
            miuiIntent_send(intent_type, 1, "/sdcard");
            break;
        case MOUNT_SDEXT:
            miuiIntent_send(intent_type, 1, "/internal_sd");
            break;
        case MOUNT_TOGGLE:
        {
            if (intent_type == INTENT_MOUNT)
                //mount 
                miuiIntent_send(INTENT_TOGGLE, 1, "1");
            else 
                //untoggle
                miuiIntent_send(INTENT_TOGGLE, 1, "0");
            break;
        }
        default:
            break;
    }
    if(strstr(miuiIntent_result_get_string(), "mounted") != NULL)
    {
        menuUnit_set_icon(p, ICON_ENABLE);
        menuUnit_set_desc(p, MOUNT_DESC_MOUNT);
    }
    else if(strstr(miuiIntent_result_get_string(), "ok") != NULL)
    {
        menuUnit_set_icon(p, ICON_DISABLE);
        menuUnit_set_desc(p, MOUNT_DESC_UNMOUNT);
    }
    else 
    {
        assert_ui_if_fail(0);
    }
    return MENU_BACK;
}
Пример #4
0
struct _menuUnit* backup_ui_init()
{
    struct _menuUnit *p = common_ui_init();
    return_null_if_fail(p != NULL);
    menuUnit_set_name(p, "<~backup.name>");
    menuUnit_set_title(p, "<~backup.title>");
    menuUnit_set_icon(p, "@backup");
    menuUnit_set_show(p, &common_menu_show);
    return_null_if_fail(menuNode_init(p) != NULL);
    backup_menu = p;

    //set backup default format
     struct _menuUnit* temp = set_backup_fromat_init();
     assert_if_fail(menuNode_add(p, temp) == RET_OK);
    //backup
    temp = common_ui_init();
    assert_if_fail(menuNode_add(p, temp) == RET_OK);
    menuUnit_set_name(temp, "<~backup.backup.name>");
    menuUnit_set_result(temp, BACKUP_ALL);
    menuUnit_set_show(temp, &backup_child_show);
    //restore
    temp = common_ui_init();
    assert_if_fail(menuNode_add(p, temp) == RET_OK);
    menuUnit_set_name(temp, "<~backup.restore.name>");
    menuUnit_set_result(temp, RESTORE_ALL);
    menuUnit_set_show(temp, &restore_child_show);
    //advanced backup
    temp = advanced_backup_ui_init();
    assert_if_fail(menuNode_add(p, temp) == RET_OK);
    //advanced restore
    temp = advanced_restore_ui_init();
    assert_if_fail(menuNode_add(p, temp) == RET_OK);
    return p;
}
Пример #5
0
struct _menuUnit * sd_ui_init()
{
    struct _menuUnit *p = common_ui_init();
    return_null_if_fail(p != NULL);
    strncpy(p->name, "<~sd.name>", MENU_LEN);
    strncpy(p->title_name, "<~sd.title_name>", MENU_LEN);
    strncpy(p->icon, "@sd",  MENU_LEN);
    p->result = 0;
    sd_menu = p;
    return_null_if_fail(menuNode_init(p) != NULL);
    struct _menuUnit  *temp = common_ui_init();
    return_null_if_fail(temp != NULL);
    menuUnit_set_icon(temp, "@sd.choose");
    strncpy(temp->name, "<~sd.install.name>", MENU_LEN);
    temp->show = &sd_menu_show;
    assert_if_fail(menuNode_add(p, temp) == RET_OK);
    temp = common_ui_init();
    menuUnit_set_icon(temp, "@sd.install");
    strncpy(temp->name,"<~sd.update.name>", MENU_LEN);
    temp->show = &sd_update_show;
    assert_if_fail(menuNode_add(p, temp) == RET_OK);
    return p;
}
Пример #6
0
struct _menuUnit* wipe_ui_init()
{
    ag_canvas(&canvas_wipemenu,agw(),agh());
	
    struct _menuUnit* p = common_ui_init();
    return_null_if_fail(p != NULL);
    return_null_if_fail(menuUnit_set_name(p, "<~wipe.name>") == RET_OK);
    return_null_if_fail(menuUnit_set_title(p, "<~wipe.title>") == RET_OK);
    return_null_if_fail(menuUnit_set_icon(p, "@wipe") == RET_OK);
    return_null_if_fail(RET_OK == menuUnit_set_show(p, &wipe_menu_show));
    return_null_if_fail(menuNode_init(p) != NULL);
    //wipe_data/factory reset
    struct _menuUnit* temp = common_ui_init();
    assert_if_fail(menuNode_add(p, temp) == RET_OK);
    return_null_if_fail(menuUnit_set_name(temp, "<~wipe.factory.name>") == RET_OK);
    return_null_if_fail(menuUnit_set_result(temp, WIPE_FACTORY) == RET_OK);
    return_null_if_fail(menuUnit_set_desc(temp, "<~wipe.factory.desc>") == RET_OK);
    return_null_if_fail(menuUnit_set_icon(temp, "@wipe.all") == RET_OK);	
    return_null_if_fail(RET_OK == menuUnit_set_show(temp, &wipe_item_show));
    //wipe_data
    temp = common_ui_init();
    assert_if_fail(menuNode_add(p, temp) == RET_OK);
    return_null_if_fail(menuUnit_set_name(temp, "<~wipe.data.name>") == RET_OK);
    return_null_if_fail(menuUnit_set_result(temp, WIPE_DATA) == RET_OK);
    return_null_if_fail(menuUnit_set_desc(temp, "<~wipe.data.desc>") == RET_OK);
    return_null_if_fail(menuUnit_set_icon(temp, "@wipe.data") == RET_OK);		
    return_null_if_fail(RET_OK == menuUnit_set_show(temp, &wipe_item_show));
    //wipe_cache
    temp = common_ui_init();
    assert_if_fail(menuNode_add(p, temp) == RET_OK);
    return_null_if_fail(menuUnit_set_name(temp, "<~wipe.cache.name>") == RET_OK);
    return_null_if_fail(menuUnit_set_result(temp, WIPE_CACHE) == RET_OK);
    return_null_if_fail(menuUnit_set_desc(temp, "<~wipe.cache.desc>") == RET_OK);
    return_null_if_fail(menuUnit_set_icon(temp, "@wipe.cache") == RET_OK);		
    return_null_if_fail(RET_OK == menuUnit_set_show(temp, &wipe_item_show));
    return p;
}
Пример #7
0
struct _menuUnit* set_backup_fromat_init() {
	struct _menuUnit* p = common_ui_init();
	return_null_if_fail(p != NULL);
	menuUnit_set_name(p, "<~root.set.backup.format>");
	menuUnit_set_title(p, "set backup format");
	menuUnit_set_icon(p, "@root");
	assert_if_fail(menuNode_init(p) != NULL);
	//tar backup format
	struct _menuUnit* temp = common_ui_init();
	menuUnit_set_name(temp, "tar backup format(default)");
	menuUnit_set_show(temp, &set_default_backup_format);
	temp->result = TAR_FORMAT;
	assert_if_fail(menuNode_add(p, temp) == RET_OK);
	//dup backup format
	temp = common_ui_init();
	menuUnit_set_name(temp, "dup backup format");
	menuUnit_set_show(temp, &set_default_backup_format);
	temp->result = DUP_FORMAT;
	assert_if_fail(menuNode_add(p, temp) == RET_OK);
	return p;
}
Пример #8
0
static STATUS mount_menu_show(menuUnit *p)
{
    //traverse all mount files
    //ensure cache
    miuiIntent_send(INTENT_ISMOUNT, 1, "/cache");
    if (miuiIntent_result_get_int() == 1)
    {
        menuUnit_set_icon(mount_cache_node, ICON_ENABLE);
        menuUnit_set_desc(mount_cache_node, MOUNT_DESC_MOUNT);
    }
    else
    {
        menuUnit_set_icon(mount_cache_node, ICON_DISABLE);
        menuUnit_set_desc(mount_cache_node, MOUNT_DESC_UNMOUNT);
    }
    //ensure data
    miuiIntent_send(INTENT_ISMOUNT, 1, "/data");
    if (miuiIntent_result_get_int() == 1)
    {
        menuUnit_set_icon(mount_data_node, ICON_ENABLE);
        menuUnit_set_desc(mount_data_node, MOUNT_DESC_MOUNT);
    }
    else
    {
        menuUnit_set_icon(mount_data_node, ICON_DISABLE);
        menuUnit_set_desc(mount_data_node, MOUNT_DESC_UNMOUNT);
    }
    //ensure system
    miuiIntent_send(INTENT_ISMOUNT, 1, "/system");
    if (miuiIntent_result_get_int() == 1)
    {
        menuUnit_set_icon(mount_system_node, ICON_ENABLE);
        menuUnit_set_desc(mount_system_node, MOUNT_DESC_MOUNT);
    }
    else
    {
        menuUnit_set_icon(mount_system_node, ICON_DISABLE);
        menuUnit_set_desc(mount_system_node, MOUNT_DESC_UNMOUNT);
    }
    //ensure sdcard 
    miuiIntent_send(INTENT_ISMOUNT, 1, "/sdcard");
    if (miuiIntent_result_get_int() == 1)
    {
        menuUnit_set_icon(mount_sd_node, ICON_ENABLE);
        menuUnit_set_desc(mount_sd_node, MOUNT_DESC_MOUNT);
    }
    else
    {
        menuUnit_set_icon(mount_sd_node, ICON_DISABLE);
        menuUnit_set_desc(mount_sd_node, MOUNT_DESC_UNMOUNT);
    }
    if (acfg()->sd_ext == 1)
    {
        //ensure sd-ext 
        miuiIntent_send(INTENT_ISMOUNT, 1, "/internal_sd");
        if (miuiIntent_result_get_int() == 1)
        {
            menuUnit_set_icon(mount_sd_ext_node, ICON_ENABLE);
            menuUnit_set_desc(mount_sd_ext_node, MOUNT_DESC_MOUNT);
        }
        else
        {
            menuUnit_set_icon(mount_sd_ext_node, ICON_DISABLE);
            menuUnit_set_desc(mount_sd_ext_node, MOUNT_DESC_UNMOUNT);
        }
    }

    //show menu
    return_val_if_fail(p != NULL, RET_FAIL);
    int n = p->get_child_count(p);
    return_val_if_fail(n > 0, RET_FAIL);
    int selindex = 0;
    return_val_if_fail(n >= 1, RET_FAIL);
    return_val_if_fail(n < ITEM_COUNT, RET_FAIL);
    struct _menuUnit *temp = p->child;
    return_val_if_fail(temp != NULL, RET_FAIL);
    char **menu_item = malloc(n * sizeof(char *));
    assert_if_fail(menu_item != NULL);
    char **icon_item=malloc(n * sizeof(char *));
    assert_if_fail(icon_item != NULL);
    char **title_item= malloc(n * sizeof(char *));
    assert_if_fail(title_item != NULL);
    int i = 0;
    for (i = 0; i < n; i++)
    {
        menu_item[i] = temp->name;
        title_item[i] = temp->title_name;
        icon_item[i] = temp->icon;
        temp = temp->nextSilbing;
    }
    selindex = miui_mainmenu(p->name, menu_item, NULL, icon_item, n);
    p->result = selindex;
    if (menu_item != NULL) free(menu_item);
    if (title_item != NULL) free(title_item);
    if (icon_item != NULL) free(icon_item);
    return p->result;
}
Пример #9
0
struct _menuUnit *mount_ui_init()
{
    struct _menuUnit* p = common_ui_init();
    return_null_if_fail(p != NULL);
    strncpy(p->name, "<~mount.name>", MENU_LEN);
    menuUnit_set_title(p, "<~mount.title>");
    menuUnit_set_icon(p, "@mount");
    menuUnit_set_show(p, &mount_menu_show);
    return_null_if_fail(menuNode_init(p) != NULL);
    //mount cache?
    struct _menuUnit* temp = common_ui_init();
    assert_if_fail(menuNode_add(p, temp) == RET_OK);
    return_null_if_fail(menuUnit_set_name(temp, "<~mount.cache.name>") == RET_OK);
    return_null_if_fail(menuUnit_set_icon(temp, ICON_DISABLE) == RET_OK);
    return_null_if_fail(menuUnit_set_result(temp, MOUNT_CACHE) == RET_OK);
    return_null_if_fail(menuUnit_set_desc(temp, MOUNT_DESC_UNMOUNT) == RET_OK);
    return_null_if_fail(RET_OK == menuUnit_set_show(temp, &mount_child_show));
    mount_cache_node = temp;
    //mount data
    temp = common_ui_init();
    assert_if_fail(menuNode_add(p, temp) == RET_OK);
    return_null_if_fail(menuUnit_set_name(temp, "<~mount.data.name>") == RET_OK);
    return_null_if_fail(menuUnit_set_result(temp, MOUNT_DATA) == RET_OK);
    return_null_if_fail(menuUnit_set_icon(temp, ICON_DISABLE) == RET_OK);
    return_null_if_fail(menuUnit_set_desc(temp, MOUNT_DESC_UNMOUNT) == RET_OK);
    return_null_if_fail(RET_OK == menuUnit_set_show(temp, &mount_child_show));
    mount_data_node = temp;

    //mount system
    temp = common_ui_init();
    assert_if_fail(menuNode_add(p, temp) == RET_OK);
    return_null_if_fail(menuUnit_set_name(temp, "<~mount.system.name>") == RET_OK);
    return_null_if_fail(menuUnit_set_result(temp, MOUNT_SYSTEM) == RET_OK);
    return_null_if_fail(menuUnit_set_icon(temp, ICON_DISABLE) == RET_OK);
    return_null_if_fail(menuUnit_set_desc(temp, MOUNT_DESC_UNMOUNT) == RET_OK);
    return_null_if_fail(RET_OK == menuUnit_set_show(temp, &mount_child_show));
    mount_system_node = temp;
    //mount sdcard
    temp = common_ui_init();
    assert_if_fail(menuNode_add(p, temp) == RET_OK);
    return_null_if_fail(menuUnit_set_name(temp, "<~mount.sdcard.name>") == RET_OK);
    return_null_if_fail(menuUnit_set_result(temp, MOUNT_SDCARD) == RET_OK);
    return_null_if_fail(menuUnit_set_icon(temp, ICON_DISABLE) == RET_OK);
    return_null_if_fail(menuUnit_set_desc(temp, MOUNT_DESC_UNMOUNT) == RET_OK);
    return_null_if_fail(RET_OK == menuUnit_set_show(temp, &mount_child_show));
    mount_sd_node = temp;

    if (acfg()->sd_ext == 1)
    {
        //mount internal_sd
        temp = common_ui_init();
        assert_if_fail(menuNode_add(p, temp) == RET_OK);
        return_null_if_fail(menuUnit_set_name(temp, "<~mount.sdext.name>") == RET_OK);
        return_null_if_fail(menuUnit_set_result(temp, MOUNT_SDEXT) == RET_OK);
        return_null_if_fail(menuUnit_set_icon(temp, ICON_DISABLE) == RET_OK);
        return_null_if_fail(menuUnit_set_desc(temp, MOUNT_DESC_UNMOUNT) == RET_OK);
        return_null_if_fail(RET_OK == menuUnit_set_show(temp, &mount_child_show));
        mount_sd_ext_node = temp;
    }
    //toggle usb stroage
    if (acfg()->lun_file[0] != 0)
    {
        temp = common_ui_init();
        assert_if_fail(menuNode_add(p, temp) == RET_OK);
        return_null_if_fail(menuUnit_set_name(temp, "<~mount.toggle.name>") == RET_OK);
        return_null_if_fail(menuUnit_set_result(temp, MOUNT_TOGGLE) == RET_OK);
        return_null_if_fail(menuUnit_set_icon(temp, ICON_DISABLE) == RET_OK);
        return_null_if_fail(menuUnit_set_desc(temp, MOUNT_DESC_UNMOUNT) == RET_OK);
        return_null_if_fail(RET_OK == menuUnit_set_show(temp, &mount_child_show));
    }
    mount_node = p;
    return p;

}
Пример #10
0
struct _menuUnit* wipe_ui_init()
{
    struct _menuUnit* p = common_ui_init();
    return_null_if_fail(p != NULL);
    return_null_if_fail(menuUnit_set_name(p, "<~wipe.name>") == RET_OK);
    return_null_if_fail(menuUnit_set_title(p, "<~wipe.title>") == RET_OK);
    return_null_if_fail(menuUnit_set_icon(p, "@wipe") == RET_OK);
    return_null_if_fail(RET_OK == menuUnit_set_show(p, &wipe_menu_show));
    return_null_if_fail(menuNode_init(p) != NULL);
    //wipe_data/factory reset
    struct _menuUnit* temp = common_ui_init();
    assert_if_fail(menuNode_add(p, temp) == RET_OK);
    return_null_if_fail(menuUnit_set_name(temp, "<~wipe.factory.name>") == RET_OK);
    return_null_if_fail(menuUnit_set_result(temp, WIPE_FACTORY) == RET_OK);
    return_null_if_fail(RET_OK == menuUnit_set_show(temp, &wipe_item_show));
    //wipe_data
    temp = common_ui_init();
    assert_if_fail(menuNode_add(p, temp) == RET_OK);
    return_null_if_fail(menuUnit_set_name(temp, "<~wipe.data.name>") == RET_OK);
    return_null_if_fail(menuUnit_set_result(temp, WIPE_DATA) == RET_OK);
    return_null_if_fail(RET_OK == menuUnit_set_show(temp, &wipe_item_show));
    //wipe_cache
    temp = common_ui_init();
    assert_if_fail(menuNode_add(p, temp) == RET_OK);
    return_null_if_fail(menuUnit_set_name(temp, "<~wipe.cache.name>") == RET_OK);
    return_null_if_fail(menuUnit_set_result(temp, WIPE_CACHE) == RET_OK);
    return_null_if_fail(RET_OK == menuUnit_set_show(temp, &wipe_item_show));
    //format system
    temp = common_ui_init();
    assert_if_fail(menuNode_add(p, temp) == RET_OK);
    return_null_if_fail(menuUnit_set_name(temp, "<~format.system.name>") == RET_OK);
    return_null_if_fail(menuUnit_set_result(temp, FORMAT_SYSTEM) == RET_OK);
    return_null_if_fail(RET_OK == menuUnit_set_show(temp, &wipe_item_show));
    //format data
    temp = common_ui_init();
    assert_if_fail(menuNode_add(p, temp) == RET_OK);
    return_null_if_fail(menuUnit_set_name(temp, "<~format.data.name>") == RET_OK);
    return_null_if_fail(menuUnit_set_result(temp, FORMAT_DATA) == RET_OK);
    return_null_if_fail(RET_OK == menuUnit_set_show(temp, &wipe_item_show));
    //format cache
    temp = common_ui_init();
    assert_if_fail(menuNode_add(p, temp) == RET_OK);
    return_null_if_fail(menuUnit_set_name(temp, "<~format.cache.name>") == RET_OK);
    return_null_if_fail(menuUnit_set_result(temp, FORMAT_CACHE) == RET_OK);
    return_null_if_fail(RET_OK == menuUnit_set_show(temp, &wipe_item_show));
    //format BOOT
    temp = common_ui_init();
    assert_if_fail(menuNode_add(p, temp) == RET_OK);
    return_null_if_fail(menuUnit_set_name(temp, "<~format.boot.name>") == RET_OK);
    return_null_if_fail(menuUnit_set_result(temp, FORMAT_BOOT) == RET_OK);
    return_null_if_fail(RET_OK == menuUnit_set_show(temp, &wipe_item_show));
    //format SDCARD
    temp = common_ui_init();
    assert_if_fail(menuNode_add(p, temp) == RET_OK);
    return_null_if_fail(menuUnit_set_name(temp, "<~format.sdcard.name>") == RET_OK);
    return_null_if_fail(menuUnit_set_result(temp, FORMAT_SDCARD) == RET_OK);
    return_null_if_fail(RET_OK == menuUnit_set_show(temp, &wipe_item_show));
    //format ALL
    temp = common_ui_init();
    assert_if_fail(menuNode_add(p, temp) == RET_OK);
    return_null_if_fail(menuUnit_set_name(temp, "<~format.all.name>") == RET_OK);
    return_null_if_fail(menuUnit_set_result(temp, FORMAT_ALL) == RET_OK);
    return_null_if_fail(RET_OK == menuUnit_set_show(temp, &wipe_item_show));
    return p;
}