From: Jaroslav Kysela Date: Sat, 11 Oct 2014 19:35:30 +0000 (+0200) Subject: profile: do not allow to change profile names for shielded profiles X-Git-Tag: v4.1~1075 X-Git-Url: http://git.ipfire.org/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=cf5ef00f3938d1d5749a2b49e00fc40c5376c399;p=thirdparty%2Ftvheadend.git profile: do not allow to change profile names for shielded profiles --- diff --git a/src/profile.c b/src/profile.c index 9ac434dce..76440d4f5 100644 --- a/src/profile.c +++ b/src/profile.c @@ -156,6 +156,16 @@ profile_class_delete(idnode_t *self) profile_delete(pro, 1); } +static uint32_t +profile_class_enabled_opts(void *o) +{ + profile_t *pro = o; + uint32_t r = 0; + if (pro && profile_default == pro) + r |= PO_RDONLY; + return r; +} + static const void * profile_class_class_get(void *o) { @@ -194,6 +204,16 @@ profile_class_default_set(void *o, const void *v) return 0; } +static uint32_t +profile_class_name_opts(void *o) +{ + profile_t *pro = o; + uint32_t r = 0; + if (pro && pro->pro_shield) + r |= PO_RDONLY; + return r; +} + const idclass_t profile_class = { .ic_class = "profile", @@ -216,6 +236,7 @@ const idclass_t profile_class = .id = "enabled", .name = "Enabled", .off = offsetof(profile_t, pro_enabled), + .get_opts = profile_class_enabled_opts, }, { .type = PT_BOOL, @@ -229,6 +250,7 @@ const idclass_t profile_class = .id = "name", .name = "Profile Name", .off = offsetof(profile_t, pro_name), + .get_opts = profile_class_name_opts, .notify = idnode_notify_title_changed, }, {