diff --git a/src/zapit/include/zapit/bouquets.h b/src/zapit/include/zapit/bouquets.h index a0b63a317..11b8cdeff 100644 --- a/src/zapit/include/zapit/bouquets.h +++ b/src/zapit/include/zapit/bouquets.h @@ -110,7 +110,7 @@ class CBouquetManager void loadBouquets(bool ignoreBouquetFile = false); void renumServices(); - CZapitBouquet* addBouquet(const std::string & name, bool ub = false, bool myfav = false); + CZapitBouquet* addBouquet(const std::string & name, bool ub = false, bool myfav = false, bool to_begin = false); void deleteBouquet(const unsigned int id); void deleteBouquet(const CZapitBouquet* bouquet); int existsBouquet(char const * const name, bool ignore_user = false); diff --git a/src/zapit/src/bouquets.cpp b/src/zapit/src/bouquets.cpp index 8b23860ed..d7526423a 100644 --- a/src/zapit/src/bouquets.cpp +++ b/src/zapit/src/bouquets.cpp @@ -511,7 +511,7 @@ void CBouquetManager::renumServices() makeRemainingChannelsBouquet(); } -CZapitBouquet* CBouquetManager::addBouquet(const std::string & name, bool ub, bool myfav) +CZapitBouquet* CBouquetManager::addBouquet(const std::string & name, bool ub, bool myfav, bool to_begin) { CZapitBouquet* newBouquet = new CZapitBouquet(myfav ? "favorites" : name); newBouquet->bUser = ub; @@ -521,9 +521,13 @@ CZapitBouquet* CBouquetManager::addBouquet(const std::string & name, bool ub, bo //printf("CBouquetManager::addBouquet: %s, user %s\n", name.c_str(), ub ? "YES" : "NO"); if(ub) { BouquetList::iterator it; - for(it = Bouquets.begin(); it != Bouquets.end(); ++it) - if(!(*it)->bUser) - break; + if (to_begin) { + it = Bouquets.begin(); + } else { + for(it = Bouquets.begin(); it != Bouquets.end(); ++it) + if(!(*it)->bUser) + break; + } Bouquets.insert(it, newBouquet); } else Bouquets.push_back(newBouquet); diff --git a/src/zapit/src/fastscan.cpp b/src/zapit/src/fastscan.cpp index 7d09d1d4c..054e9f786 100644 --- a/src/zapit/src/fastscan.cpp +++ b/src/zapit/src/fastscan.cpp @@ -485,7 +485,7 @@ bool CServiceScan::ParseFst(unsigned short pid, fast_scan_operator_t * op) bouquetId = g_bouquetManager->existsUBouquet(op->name); if (bouquetId == -1) { - bouquet = g_bouquetManager->addBouquet(std::string(op->name), true); + bouquet = g_bouquetManager->addBouquet(std::string(op->name), true, false, true); bouquetId = g_bouquetManager->existsUBouquet(op->name); } else diff --git a/src/zapit/src/scan.cpp b/src/zapit/src/scan.cpp index 21bea0247..d94cd08eb 100644 --- a/src/zapit/src/scan.cpp +++ b/src/zapit/src/scan.cpp @@ -334,7 +334,7 @@ _repeat: CZapitBouquet* bouquet; int bouquetId = g_bouquetManager->existsUBouquet(pname.c_str()); if (bouquetId == -1) - bouquet = g_bouquetManager->addBouquet(pname, true); + bouquet = g_bouquetManager->addBouquet(pname, true, false, true); else bouquet = g_bouquetManager->Bouquets[bouquetId];