]> git.ipfire.org Git - thirdparty/tvheadend.git/commitdiff
Fix the service <-> channel mapping editor
authorJaroslav Kysela <perex@perex.cz>
Sun, 16 Mar 2014 18:52:50 +0000 (19:52 +0100)
committerJaroslav Kysela <perex@perex.cz>
Sun, 16 Mar 2014 18:52:50 +0000 (19:52 +0100)
- the channel entry should be saved after unlink (not before)
- the service or channel entry should be notified about changes
  to keep the channel / service grids in sync

src/service.c
src/service_mapper.c

index 5a250ef7d4ef56a15cc1ccf3fd452acb2bedf6f9..851512a5ba53bd598af87602b24299b3dcfc1b02 100644 (file)
@@ -83,7 +83,6 @@ static int
 service_class_channel_set
   ( void *obj, const void *p )
 {
-  int save = 0;
   service_t *svc = obj;
   htsmsg_t  *chns = (htsmsg_t*)p;
   const char *str;
@@ -99,13 +98,14 @@ service_class_channel_set
   HTSMSG_FOREACH(f, chns) {
     if ((str = htsmsg_field_get_str(f)))
       if ((ch = channel_find(str)))
-        save |= service_mapper_link(svc, ch, 1);
+        service_mapper_link(svc, ch, 1);
   }
 
   /* Delete unlinked */
   service_mapper_clean(svc, NULL, 1);
-    
-  return save;
+
+  /* no save - the link information is in the saved channel record */
+  return 0;
 }
 
 static htsmsg_t *
index 349eee1464ddfa7ac3a47178d5a395aed746e97c..732ea021ed1694ed46cddfb2ca8a4a5d884b205f 100644 (file)
@@ -201,15 +201,16 @@ service_mapper_link ( service_t *s, channel_t *c, int dosave )
   LIST_INSERT_HEAD(&s->s_channels,  csm, csm_svc_link);
   LIST_INSERT_HEAD(&c->ch_services, csm, csm_chn_link);
   if (dosave) channel_save(c);
+  idnode_notify_simple(dosave ? &c->ch_id : &s->s_id);
   return 1;
 }
 
 static void
 service_mapper_unlink0 ( channel_service_mapping_t *csm, int save )
 {
-  if (save) channel_save(csm->csm_chn);
   LIST_REMOVE(csm, csm_chn_link);
   LIST_REMOVE(csm, csm_svc_link);
+  if (save) channel_save(csm->csm_chn);
   free(csm);
 }
 
@@ -239,6 +240,7 @@ service_mapper_clean ( service_t *s, channel_t *c, int dosave )
     if (csm->csm_mark) {
       service_mapper_unlink0(csm, dosave);
       save = 1;
+      idnode_notify_simple(s ? &csm->csm_chn->ch_id : &csm->csm_svc->s_id);
     }
   }
   return save;