static int voip_fillAddressBookMenu(interfaceMenu_t *pMenu, void *pArg) { int i = 0; char *str; FILE *file; interface_clearMenuEntries((interfaceMenu_t*)&AddressBookMenu); str = _T("ADD"); interface_addMenuEntry((interfaceMenu_t*)&AddressBookMenu, str, voip_newAddressBookURI, (void*)ENTRY_INFO_SET(LIST_ADDRESS, LAST_DIALED), thumbnail_dial); file = m3u_initFile(ADDRESSBOOK_FILENAME, "r"); if(file != NULL) { while ( m3u_readEntry(file) == 0 ) { interface_addMenuEntry((interfaceMenu_t*)&AddressBookMenu, m3u_description, voip_dialNumber, (void*)ENTRY_INFO_SET(LIST_ADDRESS, i), thumbnail_account_buddy ); i++; } } if(i == 0) { str = _T("ADDRESS_BOOK_EMPTY"); interface_addMenuEntryDisabled((interfaceMenu_t*)&AddressBookMenu, str, -1 ); } if( interface_getSelectedItem( (interfaceMenu_t*)&AddressBookMenu ) >= i ) { interface_setSelectedItem( (interfaceMenu_t*)&AddressBookMenu, i ); } interface_menuActionShowMenu(pMenu, (void*)&AddressBookMenu); interface_displayMenu(1); return 0; }
static int youtube_keyCallback(interfaceMenu_t *pMenu, pinterfaceCommandEvent_t cmd, void* pArg) { int selectedIndex = interface_getSelectedItem((interfaceMenu_t*)&YoutubeMenu); char url[YOUTUBE_LINK_SIZE]; if (selectedIndex > 0 ) { switch( cmd->command ) { case interfaceCommandGreen: snprintf(url, sizeof(url), "http://www.youtube.com/watch?v=%s", youtubeInfo.videos[selectedIndex-1].video_id); eprintf("Youtube: Stream %02d: '%s'\n", selectedIndex-1, url); interface_showMessageBox(url, -1, 0); return 0; #ifdef ENABLE_FAVORITES case interfaceCommandYellow: char description[MENU_ENTRY_INFO_LENGTH]; interface_getMenuEntryInfo( (interfaceMenu_t*)&YoutubeMenu, selectedIndex, description, sizeof(description) ); snprintf(url, sizeof(url), "http://www.youtube.com/watch?v=%s", youtubeInfo.videos[selectedIndex-1].video_id); eprintf("Youtube: Add to Playlist '%s'\n", url); playlist_addUrl( url, description ); return 0; break; #endif default:; } } return 1; }
static int voip_fillAccountMenu(interfaceMenu_t *pMenu, void *pArg) { char buf[MENU_ENTRY_INFO_LENGTH], *str; interface_clearMenuEntries((interfaceMenu_t*)&AccountMenu); snprintf(buf,MENU_ENTRY_INFO_LENGTH, "%s: %s", _T("VOIP_ENABLE"), appControlInfo.voipInfo.enabled ? _T("ON") : _T("OFF")); interface_addMenuEntry((interfaceMenu_t*)&AccountMenu, buf, voip_toggleEnabled, NULL, appControlInfo.voipInfo.enabled ? thumbnail_yes : thumbnail_no); if (appControlInfo.voipInfo.enabled) { //snprintf(buf,MENU_ENTRY_INFO_LENGTH, "SIP: %s", appControlInfo.voipInfo.sip); //interface_addMenuEntry((interfaceMenu_t*)&AccountMenu, interfaceMenuEntryText, buf, strlen(buf), 0, voip_toggleParam, NULL, NULL, (void*)PARAM_SIP, thumbnail_account); str = _T( voip_loggingIn ? "SERVER_QUERY" : (appControlInfo.voipInfo.connected || appControlInfo.voipInfo.server[0] == 0 ? "DISCONNECT" : "LOGIN_TO_SERVER") ); interface_addMenuEntryCustom((interfaceMenu_t*)&AccountMenu, interfaceMenuEntryText, str, strlen(str), appControlInfo.voipInfo.connected || appControlInfo.voipInfo.server[0] != 0, appControlInfo.voipInfo.connected || appControlInfo.voipInfo.server[0] == 0 ? voip_logoutFromServer : voip_reloginToServer, NULL, NULL, NULL, NULL, appControlInfo.voipInfo.connected ? thumbnail_account_active : thumbnail_account_inactive); snprintf(buf,MENU_ENTRY_INFO_LENGTH, "%s: %s", _T("SERVER"), appControlInfo.voipInfo.server[0] != 0 ? appControlInfo.voipInfo.server : _T("NONE") ); interface_addMenuEntry((interfaceMenu_t*)&AccountMenu, buf, voip_toggleParam, (void*)PARAM_SERVER, thumbnail_account); if( appControlInfo.voipInfo.server[0] != 0 ) { snprintf(buf,MENU_ENTRY_INFO_LENGTH, "%s: %s", _T("LOGIN"), appControlInfo.voipInfo.login); interface_addMenuEntry((interfaceMenu_t*)&AccountMenu, buf, voip_toggleParam, (void*)PARAM_LOGIN, thumbnail_account); snprintf(buf,MENU_ENTRY_INFO_LENGTH, "%s: ***", _T("PASSWORD")/*, appControlInfo.voipInfo.passwd*/); interface_addMenuEntry((interfaceMenu_t*)&AccountMenu, buf, voip_toggleParam, (void*)PARAM_PASSWD, thumbnail_account); /*snprintf(buf,MENU_ENTRY_INFO_LENGTH, "%s: %s", _T("REALM"), appControlInfo.voipInfo.realm); interface_addMenuEntry((interfaceMenu_t*)&AccountMenu, buf, voip_toggleParam, (void*)PARAM_REALM, thumbnail_account);*/ } } if( appControlInfo.voipInfo.connected == 0 && appControlInfo.voipInfo.server[0] == 0 && interface_getSelectedItem((interfaceMenu_t*)&AccountMenu) == 0 ) { interface_setSelectedItem((interfaceMenu_t*)&AccountMenu, MENU_ITEM_BACK); } interface_setMenuLogo((interfaceMenu_t*)&AccountMenu, appControlInfo.voipInfo.connected ? thumbnail_account_active : thumbnail_account_inactive, -1, 0, 0, 0); if( pArg != NULL || (interfaceInfo.currentMenu == (interfaceMenu_t*)&AccountMenu) ) { interface_menuActionShowMenu(pMenu, (void*)&AccountMenu); interface_displayMenu(1); } return 0; }