--- ./channels.c.cfilter	2006-04-09 17:49:14.481949759 +0200
+++ ./channels.c	2006-04-09 17:49:28.711973709 +0200
@@ -854,6 +854,15 @@
     }
   };
 
+bool cChannel::Filtered(void)
+{
+  switch(Setup.ChannelFilter) {
+    case 1:    return (groupSep || vpid != 0);
+    case 2:    return (groupSep || vpid == 0);
+    default:   return true;
+  } 
+}
+
 // -- cChannels --------------------------------------------------------------
 
 cChannels Channels;
--- ./channels.h.cfilter	2006-04-09 17:49:14.484949131 +0200
+++ ./channels.h	2006-04-09 17:49:28.713973291 +0200
@@ -217,6 +217,7 @@
   void SetLinkChannels(cLinkChannels *LinkChannels);
   void SetRefChannel(cChannel *RefChannel);
   void SetGroupSep(bool Sep = true);
+  bool Filtered(void);
   };
 
 class cChannels : public cRwLock, public cConfig<cChannel> {
--- ./config.c.cfilter	2006-04-09 14:12:01.000000000 +0200
+++ ./config.c	2006-04-09 17:51:10.095769580 +0200
@@ -271,6 +271,7 @@
   CurrentChannel = -1;
   CurrentVolume = MAXVOLUME;
   CurrentDolby = 0;
+  ChannelFilter = 0;
   InitialChannel = 0;
   InitialVolume = -1;
 }
@@ -432,6 +433,7 @@
   else if (!strcasecmp(Name, "CurrentChannel"))      CurrentChannel     = atoi(Value);
   else if (!strcasecmp(Name, "CurrentVolume"))       CurrentVolume      = atoi(Value);
   else if (!strcasecmp(Name, "CurrentDolby"))        CurrentDolby       = atoi(Value);
+  else if (!strcasecmp(Name, "ChannelFilter"))       ChannelFilter      = atoi(Value);
   else if (!strcasecmp(Name, "InitialChannel"))      InitialChannel     = atoi(Value);
   else if (!strcasecmp(Name, "InitialVolume"))       InitialVolume      = atoi(Value);
   else
@@ -500,6 +502,7 @@
   Store("CurrentChannel",     CurrentChannel);
   Store("CurrentVolume",      CurrentVolume);
   Store("CurrentDolby",       CurrentDolby);
+  Store("ChannelFilter",      ChannelFilter);
   Store("InitialChannel",     InitialChannel);
   Store("InitialVolume",      InitialVolume);
 
--- ./config.h.cfilter	2006-04-09 14:09:05.000000000 +0200
+++ ./config.h	2006-04-09 17:51:46.408174588 +0200
@@ -237,6 +237,7 @@
   int CurrentChannel;
   int CurrentVolume;
   int CurrentDolby;
+  int ChannelFilter;
   int InitialChannel;
   int InitialVolume;
   int __EndData__;
--- ./device.c.cfilter	2006-04-09 12:46:36.000000000 +0200
+++ ./device.c	2006-04-09 17:49:28.728970154 +0200
@@ -588,7 +588,7 @@
      cChannel *channel;
      while ((channel = Channels.GetByNumber(n, Direction)) != NULL) {
            // try only channels which are currently available
-           if (PrimaryDevice()->ProvidesChannel(channel, Setup.PrimaryLimit) || PrimaryDevice()->CanReplay() && GetDevice(channel, 0))
+           if (channel->Filtered() && (PrimaryDevice()->ProvidesChannel(channel, Setup.PrimaryLimit) || PrimaryDevice()->CanReplay() && GetDevice(channel, 0)))
               break;
            n = channel->Number() + Direction;
            }
--- ./i18n.c.cfilter	2006-04-09 15:04:50.000000000 +0200
+++ ./i18n.c	2006-04-09 17:49:28.741967436 +0200
@@ -4470,6 +4470,63 @@
     "",// TODO
     "",// TODO
   },
+  { "Setup.Miscellaneous$Filter channels",
+    "",// TODO
+    "",// TODO
+    "Filtra canali",
+    "",// TODO
+    "",// TODO
+    "",// TODO
+    "",// TODO
+    "",// TODO
+    "",// TODO
+    "Filtra canales",
+    "",// TODO
+    "",// TODO
+    "",// TODO
+    "",// TODO
+    "Filtra canals",
+    "",// TODO
+    "",// hrv TODO
+  },
+  { "Tv only",
+    "",// TODO
+    "",// TODO
+    "Solo Tv",
+    "",// TODO
+    "",// TODO
+    "",// TODO
+    "",// TODO
+    "",// TODO
+    "",// TODO
+    "Sólo Tv",
+    "",// TODO
+    "",// TODO
+    "",// TODO
+    "",// TODO
+    "Només Tv",
+    "",// TODO
+    "",// hrv TODO
+  },
+  { "Radio only",
+    "",// TODO
+    "",// TODO
+    "Solo Radio",
+    "",// TODO
+    "",// TODO
+    "",// TODO
+    "",// TODO
+    "",// TODO
+    "",// TODO
+    "Sólo Radio",
+    "",// TODO
+    "",// TODO
+    "",// TODO
+    "",// TODO
+    "Només Radio",
+    "",// TODO
+    "",// hrv TODO
+  },
   // The days of the week:
   { "MTWTFSS",
     "MDMDFSS",
--- ./menu.c.cfilter	2006-04-09 17:49:28.748965972 +0200
+++ ./menu.c	2006-04-09 17:53:11.228433104 +0200
@@ -413,7 +413,7 @@
   cMenuChannelItem *currentItem = NULL;
   Clear();
   for (cChannel *channel = Channels.First(); channel; channel = Channels.Next(channel)) {
-      if (!channel->GroupSep() || cMenuChannelItem::SortMode() == cMenuChannelItem::csmNumber && *channel->Name()) {
+      if ((!channel->GroupSep() || cMenuChannelItem::SortMode() == cMenuChannelItem::csmNumber && *channel->Name()) && ( channel == currentChannel || channel->Filtered() )) {
          cMenuChannelItem *item = new cMenuChannelItem(channel);
          Add(item);
          if (channel == currentChannel)
@@ -424,6 +424,16 @@
      Sort();
   SetCurrent(currentItem);
   SetHelp(tr("Button$Edit"), tr("Button$New"), tr("Button$Delete"), tr("Button$Mark"));
+  char *buffer = NULL;
+  switch(::Setup.ChannelFilter) {
+    case 1: asprintf(&buffer, "%s (%s)", tr("Channels"),tr("Tv only"));
+            break;
+    case 2: asprintf(&buffer, "%s (%s)", tr("Channels"),tr("Radio only"));
+            break;
+    default:  asprintf(&buffer, "%s", tr("Channels"));        
+  }
+  SetTitle(buffer);
+  free(buffer);
   Display();
 }
 
@@ -2576,6 +2586,8 @@
 // --- cMenuSetupMisc --------------------------------------------------------
 
 class cMenuSetupMisc : public cMenuSetupBase {
+private:
+  const char *channelFilterTexts[3];
 public:
   cMenuSetupMisc(void);
   };
@@ -2583,10 +2595,14 @@
 cMenuSetupMisc::cMenuSetupMisc(void)
 {
   SetSection(tr("Miscellaneous"));
+  channelFilterTexts[0] = tr("no");
+  channelFilterTexts[1] = tr("Tv only");
+  channelFilterTexts[2] = tr("Radio only");
   Add(new cMenuEditIntItem( tr("Setup.Miscellaneous$Min. event timeout (min)"),   &data.MinEventTimeout));
   Add(new cMenuEditIntItem( tr("Setup.Miscellaneous$Min. user inactivity (min)"), &data.MinUserInactivity));
   Add(new cMenuEditIntItem( tr("Setup.Miscellaneous$SVDRP timeout (s)"),          &data.SVDRPTimeout));
   Add(new cMenuEditIntItem( tr("Setup.Miscellaneous$Zap timeout (s)"),            &data.ZapTimeout));
+  Add(new cMenuEditStraItem(tr("Setup.Miscellaneous$Filter channels"),             &data.ChannelFilter, 3, channelFilterTexts));;    
   Add(new cMenuEditChanItem(tr("Setup.Miscellaneous$Initial channel"),            &data.InitialChannel, tr("Setup.Miscellaneous$as before")));
   Add(new cMenuEditIntItem( tr("Setup.Miscellaneous$Initial volume"),             &data.InitialVolume, -1, 255, tr("Setup.Miscellaneous$as before")));
 }
--- menu.c.orig	2006-04-10 19:09:50.078823657 +0200
+++ menu.c	2006-04-10 19:12:20.399322171 +0200
@@ -3149,7 +3149,7 @@
   if (Direction) {
      while (Channel) {
            Channel = Direction > 0 ? Channels.Next(Channel) : Channels.Prev(Channel);
-           if (Channel && !Channel->GroupSep() && (cDevice::PrimaryDevice()->ProvidesChannel(Channel, Setup.PrimaryLimit) || cDevice::GetDevice(Channel, 0)))
+           if (Channel && Channel->Filtered() && !Channel->GroupSep() && (cDevice::PrimaryDevice()->ProvidesChannel(Channel, Setup.PrimaryLimit) || cDevice::GetDevice(Channel, 0)))
               return Channel;
            }
      }
