summaryrefslogtreecommitdiff
path: root/menu.c
diff options
context:
space:
mode:
authorKlaus Schmidinger <vdr@tvdr.de>2002-12-22 12:49:10 +0100
committerKlaus Schmidinger <vdr@tvdr.de>2002-12-22 12:49:10 +0100
commitde1366fc7ed67cd5b1952b5fef3269753f52dea6 (patch)
tree4a03c63a2b117015fedb3396b764e22b2f31043c /menu.c
parentda98c3de7280a64cc633ac06bc95b65552afe263 (diff)
downloadvdr-de1366fc7ed67cd5b1952b5fef3269753f52dea6.tar.gz
vdr-de1366fc7ed67cd5b1952b5fef3269753f52dea6.tar.bz2
Fixed handling channels in the 'Channels' menu in case there are ':@nnn' group separators without names
Diffstat (limited to 'menu.c')
-rw-r--r--menu.c32
1 files changed, 22 insertions, 10 deletions
diff --git a/menu.c b/menu.c
index a1c136fa..68fe3b97 100644
--- a/menu.c
+++ b/menu.c
@@ -4,7 +4,7 @@
* See the main source file 'vdr.c' for copyright information and
* how to reach the author.
*
- * $Id: menu.c 1.228 2002/12/01 10:31:55 kls Exp $
+ * $Id: menu.c 1.229 2002/12/22 12:40:43 kls Exp $
*/
#include "menu.h"
@@ -645,6 +645,7 @@ private:
public:
cMenuChannelItem(cChannel *Channel);
virtual void Set(void);
+ cChannel *Channel(void) { return channel; }
};
cMenuChannelItem::cMenuChannelItem(cChannel *Channel)
@@ -669,6 +670,7 @@ void cMenuChannelItem::Set(void)
class cMenuChannels : public cOsdMenu {
private:
+ cChannel *GetChannel(int Index);
void Propagate(void);
protected:
eOSState Switch(void);
@@ -691,6 +693,12 @@ cMenuChannels::cMenuChannels(void)
SetHelp(tr("Edit"), tr("New"), tr("Delete"), tr("Mark"));
}
+cChannel *cMenuChannels::GetChannel(int Index)
+{
+ cMenuChannelItem *p = (cMenuChannelItem *)Get(Index);
+ return p ? (cChannel *)p->Channel() : NULL;
+}
+
void cMenuChannels::Propagate(void)
{
Channels.ReNumber();
@@ -703,7 +711,7 @@ void cMenuChannels::Propagate(void)
eOSState cMenuChannels::Switch(void)
{
- cChannel *ch = Channels.Get(Current());
+ cChannel *ch = GetChannel(Current());
if (ch)
cDevice::PrimaryDevice()->SwitchChannel(ch, true);
return osEnd;
@@ -713,7 +721,7 @@ eOSState cMenuChannels::Edit(void)
{
if (HasSubMenu() || Count() == 0)
return osContinue;
- cChannel *ch = Channels.Get(Current());
+ cChannel *ch = GetChannel(Current());
if (ch)
return AddSubMenu(new cMenuEditChannel(ch));
return osContinue;
@@ -730,7 +738,7 @@ eOSState cMenuChannels::Delete(void)
{
if (Count() > 0) {
int Index = Current();
- cChannel *channel = Channels.Get(Index);
+ cChannel *channel = GetChannel(Current());
int DeletedChannel = channel->Number();
// Check if there is a timer using this channel:
for (cTimer *ti = Timers.First(); ti; ti = Timers.Next(ti)) {
@@ -751,12 +759,16 @@ eOSState cMenuChannels::Delete(void)
void cMenuChannels::Move(int From, int To)
{
- int FromNumber = Channels.Get(From)->Number();
- int ToNumber = Channels.Get(To)->Number();
- Channels.Move(From, To);
- cOsdMenu::Move(From, To);
- Propagate();
- isyslog("channel %d moved to %d", FromNumber, ToNumber);
+ cChannel *FromChannel = GetChannel(From);
+ cChannel *ToChannel = GetChannel(To);
+ if (FromChannel && ToChannel) {
+ int FromNumber = FromChannel->Number();
+ int ToNumber = ToChannel->Number();
+ Channels.Move(FromChannel, ToChannel);
+ cOsdMenu::Move(From, To);
+ Propagate();
+ isyslog("channel %d moved to %d", FromNumber, ToNumber);
+ }
}
eOSState cMenuChannels::ProcessKey(eKeys Key)