From 700543b394c4e87e3bc372fb00c221c456c2adf2 Mon Sep 17 00:00:00 2001 From: kamel5 Date: Thu, 11 Jul 2019 12:41:19 +0200 Subject: [PATCH] GetLastValidChannel --- channelgroups.c | 13 ++++++++++--- channelgroups.h | 1 + channeljump.c | 11 +---------- 3 files changed, 12 insertions(+), 13 deletions(-) diff --git a/channelgroups.c b/channelgroups.c index 8447ba4..bd9f8f5 100644 --- a/channelgroups.c +++ b/channelgroups.c @@ -1,4 +1,5 @@ #include +#include "config.h" #include "channelgroups.h" cChannelGroups::cChannelGroups(void) { @@ -145,9 +146,15 @@ void cChannelGroups::CreateGroupGrid(const char *name, int number, int start, in } int cChannelGroups::GetLastValidChannel(void) { - if (channelGroups.size() > 0) - return channelGroups[channelGroups.size()-1].StopChannel(); - return 0; + if (config.hideLastGroup && channelGroups.size() > 0) { + return channelGroups[channelGroups.size() - 1].StopChannel(); + } +#if VDRVERSNUM >= 20301 + LOCK_CHANNELS_READ; + return Channels->MaxNumber(); +#else + return Channels.MaxNumber(); +#endif } void cChannelGroups::DumpGroups(void) { diff --git a/channelgroups.h b/channelgroups.h index 02b146d..e919123 100644 --- a/channelgroups.h +++ b/channelgroups.h @@ -3,6 +3,7 @@ #include #include +#include "config.h" #include "channelgroup.h" // --- cChannelGroups ------------------------------------------------------------- diff --git a/channeljump.c b/channeljump.c index cf54b8c..f8d99d2 100644 --- a/channeljump.c +++ b/channeljump.c @@ -10,16 +10,7 @@ cChannelJump::cChannelJump(cChannelGroups *channelGroups) { this->channelGroups = channelGroups; pixmapText = NULL; channel = 0; - if (!config.hideLastGroup) { -#if VDRVERSNUM >= 20301 - LOCK_CHANNELS_READ; - maxChannels = Channels->MaxNumber(); -#else - maxChannels = Channels.MaxNumber(); -#endif - } else { - maxChannels = channelGroups->GetLastValidChannel(); - } + maxChannels = channelGroups->GetLastValidChannel(); timeout = Setup.ChannelEntryTimeout; startTime = cTimeMs::Now(); SetPixmaps();