int32 ArpAddonManager::CreateAddonMenu(BMenu* inmenu, BMessage* tmpl) const { if( !inmenu ) return -1; BAutolock(Lock()); int32 num=0; for( int i=0; i<CountAddons(); i++ ) { const ArpAddonManager::BasicAddon* addon = AddonAt(i); if( addon && addon->LongName() ) { BMessage* msg = NULL; if( tmpl ) { msg = new BMessage(*tmpl); if( msg ) { const char* pname = addon->Name(); if( pname ) msg->AddString("addonname",pname); pname = addon->Path().Path(); if( pname ) msg->AddString("addonfile",pname); } } BMenuItem *item = new BMenuItem(addon->LongName(),msg); if( item ) { inmenu->AddItem(item); num++; } else delete msg; } } return num; }
ThemeManager::~ThemeManager() { FENTRY; SaveSettings(); if (CountThemes()) UnloadThemes(); if (CountAddons()) UnloadAddons(); }
ArpAddonManager::BasicAddon* ArpAddonManager::FindAddon(const char* name) const { BAutolock(Lock()); //int32 num=0; for( int i=0; i<CountAddons(); i++ ) { ArpAddonManager::BasicAddon* addon = AddonAt(i); if( addon ) { const char* pname = addon->Name(); if( pname && strcmp(pname, name) == 0 ) return addon; } } return NULL; }