void CRecDirChooser::initMenu(void) /**********************************************************************/ { char indexStr[10]; //************************************************/ addIntroItems(NONEXISTANT_LOCALE, NONEXISTANT_LOCALE, BTN_TYPE_CANCEL); for(int i=0 ; i < MAX_RECORDING_DIR ; i++) { if(!g_settings.recording_dir[i].empty()) { bool get_size = true; dirOptionText[i]=""; nfsIndex[i] = getNFSIDOfDir(g_settings.recording_dir[i].c_str()); //printf("dir %d = nfs: %d\n",i,nfsIndex[i]); if( nfsIndex[i] != -1) { int retvalue = pingthost(g_settings.network_nfs[nfsIndex[i]].ip.c_str(),60); // send ping and wait 60ms if (retvalue == 0)//LOCALE_PING_UNREACHABLE { dirOptionText[i] = g_Locale->getText(LOCALE_RECDIRCHOOSER_SERVER_DOWN); get_size = false; } #ifdef ENABLE_GUI_MOUNT else if (retvalue == 1)//LOCALE_PING_OK { // check if we can get more dir informations if (CFSMounter::isMounted (g_settings.network_nfs[nfsIndex[i]].local_dir)) { dirOptionText[i] = g_Locale->getText(LOCALE_RECDIRCHOOSER_NOT_MOUNTED); get_size = false; } } #endif } if(get_size) { // in any other case we can show the free space int drivefree; drivefree = getFreeDiscSpaceGB(g_settings.recording_dir[i].c_str()); char tmp[20]; snprintf(tmp, 19,g_Locale->getText(LOCALE_RECDIRCHOOSER_FREE),drivefree); tmp[19]=0; dirOptionText[i]=tmp; } snprintf(indexStr,10,"MID:%d",i); CMenuForwarder* fw = new CMenuForwarder(g_settings.recording_dir[i].c_str(), true, dirOptionText[i], this, indexStr); fw->setItemButton(NEUTRINO_ICON_BUTTON_OKAY, true); addItem(fw, i == 0); // select first item } } addItem(GenericMenuSeparatorLine); addItem(new CMenuForwarder(LOCALE_RECDIRCHOOSER_USER_DIR, true, NULL, this, "dirChooser")); }
void CRecDirChooser::initMenu(void) /**********************************************************************/ { char indexStr[10]; //************************************************/ addItem(GenericMenuSeparator); for(int i=0 ; i < MAX_RECORDING_DIR ; i++) { if(!g_settings.recording_dir[i].empty()) { bool get_size = true; dirOptionText[i]=""; nfsIndex[i] = getNFSIDOfDir(g_settings.recording_dir[i].c_str()); //printf("dir %d = nfs: %d\n",i,nfsIndex[i]); if( nfsIndex[i] != -1) { int retvalue = pingthost(g_settings.network_nfs_ip[nfsIndex[i]].c_str(),60); // send ping and wait 60ms if (retvalue == 0)//LOCALE_PING_UNREACHABLE { dirOptionText[i] = g_Locale->getText(LOCALE_RECDIRCHOOSER_SERVER_DOWN); get_size = false; } else if (retvalue == 1)//LOCALE_PING_OK { // check if we can get more dir informations if( CFSMounter::isMounted (g_settings.network_nfs_local_dir[nfsIndex[i]]) == 0) { dirOptionText[i] = g_Locale->getText(LOCALE_RECDIRCHOOSER_NOT_MOUNTED); get_size = false; } } } if(get_size) { // in any other case we can show the free space int drivefree; drivefree = getFreeDiscSpaceGB(g_settings.recording_dir[i].c_str()); char tmp[20]; snprintf(tmp, 19,g_Locale->getText(LOCALE_RECDIRCHOOSER_FREE),drivefree); tmp[19]=0; dirOptionText[i]=tmp; } snprintf(indexStr,10,"MID:%d",i); addItem(new CMenuForwarderNonLocalized( g_settings.recording_dir[i].c_str(), true, dirOptionText[i], this, indexStr)); } } addItem(GenericMenuSeparatorLine); addItem(new CMenuForwarder(LOCALE_RECDIRCHOOSER_USER_DIR, true, NULL, this, "dirChooser")); addItem(GenericMenuSeparator); }