diff -r c3c073032757 -r 3cf3c6019e3b maemo-ui/src/mmyth_recordui.c --- a/maemo-ui/src/mmyth_recordui.c Wed Dec 06 20:22:48 2006 +0000 +++ b/maemo-ui/src/mmyth_recordui.c Thu Jun 14 18:21:08 2007 +0100 @@ -1,5 +1,5 @@ -#include -#include +#include +#include #include #include #include @@ -11,8 +11,8 @@ #include "mmyth_recordui.h" /* GMyth library includes */ -#include "gmyth_scheduler.h" -#include "gmyth_util.h" +#include +#include enum { START_DATE_COLUMN = 0, @@ -47,8 +47,8 @@ ScheduleInfo *schedule_info; GList *schedule_list; GtkTreeIter iter; - GString *start_date_time = NULL; - GString *end_date_time = NULL; + gchar *start_date_time = NULL; + gchar *end_date_time = NULL; GString *str_aux = g_string_new(""); gint res; @@ -66,16 +66,16 @@ gtk_tree_store_insert(recordui->sch_tree_store, &iter, NULL, new_row++); - start_date_time = gmyth_util_time_to_string(schedule_info->start_time); - end_date_time = gmyth_util_time_to_string(schedule_info->end_time); + start_date_time = gmyth_util_time_to_string_from_time_val(schedule_info->start_time); + end_date_time = gmyth_util_time_to_string_from_time_val(schedule_info->end_time); g_string_printf(str_aux, "%d", schedule_info->channel_id); gtk_tree_store_set(recordui->sch_tree_store, &iter, - START_DATE_COLUMN, start_date_time->str, + START_DATE_COLUMN, start_date_time, TITLE_COLUMN, schedule_info->title->str, CHAN_ID_COLUMN, str_aux->str, - END_TIME_COLUMN, end_date_time->str, //It doesn't appear + END_TIME_COLUMN, end_date_time, //It doesn't appear RECORD_ID_COLUMN, schedule_info->record_id, -1); //the last line is a hidden item to be used in searching tasks } @@ -84,9 +84,9 @@ /* free allocated memory */ if(!start_date_time) - g_string_free(start_date_time, FALSE); + g_free(start_date_time); if(!end_date_time) - g_string_free(end_date_time, FALSE); + g_free(end_date_time); g_string_free(str_aux, FALSE); return TRUE; @@ -99,8 +99,8 @@ RecordedInfo *recorded_info; GList *record_list = NULL; GtkTreeIter iter; - GString *start_date_time = NULL; - GString *end_date_time = NULL; + gchar *start_date_time = NULL; + gchar *end_date_time = NULL; GString *str_aux = g_string_new(""); gint res; @@ -117,31 +117,42 @@ gtk_tree_store_insert(recordui->rec_tree_store, &iter, NULL, new_row++); - start_date_time = gmyth_util_time_to_string(recorded_info->start_time); - end_date_time = gmyth_util_time_to_string(recorded_info->end_time); + start_date_time = gmyth_util_time_to_string_from_time_val(recorded_info->start_time); + end_date_time = gmyth_util_time_to_string_from_time_val(recorded_info->end_time); g_string_printf(str_aux, "%d", recorded_info->channel_id); gtk_tree_store_set(recordui->rec_tree_store, &iter, - START_DATE_COLUMN, start_date_time->str, + START_DATE_COLUMN, start_date_time, TITLE_COLUMN, recorded_info->title->str, CHAN_ID_COLUMN, str_aux->str, - END_TIME_COLUMN, end_date_time->str, //It doesn't appear + END_TIME_COLUMN, end_date_time, //It doesn't appear RECORD_ID_COLUMN, recorded_info->record_id, BASENAME_COLUMN, recorded_info->basename->str, -1); //the last line is a hidden item to be used in searching tasks } g_debug ("[%s] %d lines added to record list UI", __FUNCTION__, new_row); + + /* free allocated memory */ + if( NULL != start_date_time) + g_free(start_date_time); + if( NULL != end_date_time) + g_free(end_date_time); + g_string_free(str_aux, FALSE); return TRUE; } MMythRecordUI* -mmyth_recordui_new(void) +mmyth_recordui_new( GMythBackendInfo* backend_info ) { MMythRecordUI *recordui = g_new0 (MMythRecordUI, 1); + + g_return_val_if_fail( backend_info != NULL, NULL ); + + recordui->backend_info = backend_info; recordui->scrolled_window = gtk_scrolled_window_new (NULL, NULL); gtk_scrolled_window_set_policy (GTK_SCROLLED_WINDOW (recordui->scrolled_window), @@ -259,7 +270,7 @@ recordui->rec_label); // Gets the mmyth scheduler manager - recordui->scheduler = gmyth_scheduler_new (); + recordui->scheduler = gmyth_scheduler_new ( backend_info ); /* init connection to the backend */ gmyth_scheduler_connect (recordui->scheduler, recordui->scheduler->backend_info);