2
* Copyright (C) 2001-2004 Michael H. Schimek
3
* Copyright (C) 2000-2003 I�aki Garc�a Etxebarria
5
* This program is free software; you can redistribute it and/or modify
6
* it under the terms of the GNU General Public License as published by
7
* the Free Software Foundation; either version 2 of the License, or
8
* (at your option) any later version.
10
* This program is distributed in the hope that it will be useful,
11
* but WITHOUT ANY WARRANTY; without even the implied warranty of
12
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
13
* GNU General Public License for more details.
15
* You should have received a copy of the GNU General Public License
16
* along with this program; if not, write to the Free Software
17
* Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
20
/* $Id: control.c,v 1.2 2005/07/04 21:56:41 mschimek Exp $ */
22
#include <stdlib.h> /* malloc() */
27
tv_control_copy (tv_control * dst,
28
const tv_control * src)
42
if (!(dst->label = strdup (src->label))) {
46
dst->hash = src->hash;
47
dst->type = src->type;
50
if (TV_CONTROL_TYPE_CHOICE == src->type) {
53
dst->menu = malloc ((src->maximum + 2) * sizeof (*dst->menu));
55
tv_control_destroy (dst);
59
for (i = 0; i <= (unsigned int) src->maximum; ++i) {
60
assert (NULL != src->menu[i]);
62
dst->menu[i] = strdup (src->menu[i]);
64
tv_control_destroy (dst);
72
dst->minimum = src->minimum;
73
dst->maximum = src->maximum;
74
dst->step = src->step;
75
dst->reset = src->reset;
77
dst->value = src->value;
83
tv_control_dup (const tv_control * c)
87
if (!(nc = malloc (sizeof (*nc)))) {
93
if (!tv_control_copy (nc, c)) {
102
tv_control_destroy (tv_control * c)
106
tv_callback_delete_all (c->_callback,
107
/* notify: any */ NULL,
108
/* destroy: any */ NULL,
109
/* user_data: any */ NULL,
115
for (i = 0; c->menu[i]; ++i) {
129
tv_control_delete (tv_control * c)
132
tv_control_destroy (c);