[svn r324] Added function to request how many recorders are available.
4 * @file gmyth/gmyth_common.c
6 * @brief <p> This file contains basic common functions for the gmyth library.
8 * Copyright (C) 2006 INdT - Instituto Nokia de Tecnologia.
9 * @author Leonardo Sobral Cunha <leonardo.cunha@indt.org.br>
13 * This program is free software; you can redistribute it and/or modify
14 * it under the terms of the GNU Lesser General Public License as published by
15 * the Free Software Foundation; either version 2 of the License, or
16 * (at your option) any later version.
18 * This program is distributed in the hope that it will be useful,
19 * but WITHOUT ANY WARRANTY; without even the implied warranty of
20 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
21 * GNU General Public License for more details.
23 * You should have received a copy of the GNU Lesser General Public License
24 * along with this program; if not, write to the Free Software
25 * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
32 #include "gmyth_common.h"
33 #include "gmyth_debug.h"
34 #include "gmyth_util.h"
36 static void free_channel_data(gpointer data, gpointer user_data);
37 static void free_program_data(gpointer data, gpointer user_data);
39 /** Frees the memory allocated to the GMythChannelInfo objects inside list.
40 * The list memory is also released by g_list_free(). If LIST is NULL it
43 * @param list the GList containing a list of GMythChannelInfo to free.
46 gmyth_free_channel_list(GList *list)
49 g_warning ("%s received null GList as parameter", __FUNCTION__);
53 g_list_foreach (list, free_channel_data, NULL);
58 /** Frees the memory allocated to the GMythProgramInfo objects inside list.
59 * The list memory is also released by g_list_free(). If list is NULL it
62 * @param list the GList containing a list of GMythProgramInfo to free.
65 gmyth_free_program_list(GList *list)
68 g_warning ("%s received null GList as parameter", __FUNCTION__);
72 g_list_foreach (list, free_program_data, NULL);
78 gmyth_channel_info_print(GMythChannelInfo *channel_info)
80 if ( channel_info != NULL )
82 gmyth_debug("ChannelInfo (Name, Num, ID) = (%s, %s, %d)\n",
83 channel_info->channel_name->str, channel_info->channel_num->str,
84 channel_info->channel_ID);
89 gmyth_program_info_print(GMythProgramInfo *program_info)
92 if ( program_info != NULL ) {
94 gmyth_debug( "ProgramInfo\n\tTitle = %s\n\t"
95 "Description = %s\n\t"
100 , program_info->title->str,
101 program_info->description->str,
102 gmyth_util_time_to_string_from_time_val(program_info->startts),
103 gmyth_util_time_to_string_from_time_val(program_info->endts),
104 program_info->pathname->str,
105 program_info->filesize );
112 free_channel_data(gpointer data, gpointer user_data)
115 g_free((GMythChannelInfo*) data);
119 free_program_data(gpointer data, gpointer user_data)
122 g_object_unref((GMythProgramInfo*) data);