maemo-ui/src/mmyth_recordui.c
branchtrunk
changeset 617 a76074f53743
parent 208 c3c073032757
child 754 cb885ee44618
     1.1 --- a/maemo-ui/src/mmyth_recordui.c	Wed Dec 06 20:22:48 2006 +0000
     1.2 +++ b/maemo-ui/src/mmyth_recordui.c	Tue May 01 23:02:19 2007 +0100
     1.3 @@ -1,5 +1,5 @@
     1.4 -#include<gtk/gtk.h>
     1.5 -#include<glib.h>
     1.6 +#include <gtk/gtk.h>
     1.7 +#include <glib.h>
     1.8  #include <sys/types.h>
     1.9  #include <sys/stat.h>
    1.10  #include <unistd.h>
    1.11 @@ -11,8 +11,8 @@
    1.12  #include "mmyth_recordui.h"
    1.13  
    1.14  /* GMyth library includes */
    1.15 -#include "gmyth_scheduler.h"
    1.16 -#include "gmyth_util.h"
    1.17 +#include <gmyth/gmyth_scheduler.h>
    1.18 +#include <gmyth/gmyth_util.h>
    1.19  
    1.20  enum {
    1.21  	START_DATE_COLUMN = 0,
    1.22 @@ -47,8 +47,8 @@
    1.23  	ScheduleInfo *schedule_info;
    1.24  	GList *schedule_list;
    1.25  	GtkTreeIter iter;
    1.26 -    GString *start_date_time = NULL;
    1.27 -    GString *end_date_time = NULL;
    1.28 +     gchar *start_date_time = NULL;
    1.29 +    gchar *end_date_time = NULL;
    1.30      GString *str_aux = g_string_new("");
    1.31  	gint res;
    1.32  
    1.33 @@ -66,16 +66,16 @@
    1.34  
    1.35    	  	gtk_tree_store_insert(recordui->sch_tree_store, &iter, NULL, new_row++);
    1.36          
    1.37 -        start_date_time = gmyth_util_time_to_string(schedule_info->start_time);
    1.38 -        end_date_time = gmyth_util_time_to_string(schedule_info->end_time);
    1.39 +        start_date_time = gmyth_util_time_to_string_from_time_val(schedule_info->start_time);
    1.40 +        end_date_time = gmyth_util_time_to_string_from_time_val(schedule_info->end_time);
    1.41          
    1.42          g_string_printf(str_aux, "%d", schedule_info->channel_id);
    1.43          
    1.44  	  	gtk_tree_store_set(recordui->sch_tree_store, &iter,
    1.45 -	  		START_DATE_COLUMN, start_date_time->str, 
    1.46 +	  		START_DATE_COLUMN, start_date_time, 
    1.47  	  		TITLE_COLUMN, schedule_info->title->str,
    1.48  	  		CHAN_ID_COLUMN, str_aux->str,
    1.49 -	  		END_TIME_COLUMN, end_date_time->str, //It doesn't appear
    1.50 +	  		END_TIME_COLUMN, end_date_time, //It doesn't appear
    1.51  	  		RECORD_ID_COLUMN, schedule_info->record_id, 
    1.52  			-1); //the last line is a hidden item to be used in searching tasks
    1.53   	}
    1.54 @@ -84,9 +84,9 @@
    1.55    	
    1.56      /* free allocated memory */
    1.57      if(!start_date_time)
    1.58 -        g_string_free(start_date_time, FALSE);
    1.59 +        g_free(start_date_time);
    1.60      if(!end_date_time)
    1.61 -        g_string_free(end_date_time, FALSE);
    1.62 +        g_free(end_date_time);
    1.63      g_string_free(str_aux,  FALSE);
    1.64      
    1.65    	return TRUE;
    1.66 @@ -99,8 +99,8 @@
    1.67  	RecordedInfo *recorded_info;
    1.68  	GList *record_list = NULL;
    1.69  	GtkTreeIter iter;
    1.70 -    GString *start_date_time = NULL;
    1.71 -    GString *end_date_time = NULL;
    1.72 +    gchar *start_date_time = NULL;
    1.73 +    gchar *end_date_time = NULL;
    1.74      GString *str_aux = g_string_new("");
    1.75  	gint res;
    1.76  	
    1.77 @@ -117,31 +117,42 @@
    1.78  
    1.79    	  	gtk_tree_store_insert(recordui->rec_tree_store, &iter, NULL, new_row++);
    1.80  
    1.81 -        start_date_time = gmyth_util_time_to_string(recorded_info->start_time);
    1.82 -        end_date_time = gmyth_util_time_to_string(recorded_info->end_time);
    1.83 +        start_date_time = gmyth_util_time_to_string_from_time_val(recorded_info->start_time);
    1.84 +        end_date_time = gmyth_util_time_to_string_from_time_val(recorded_info->end_time);
    1.85  
    1.86          g_string_printf(str_aux, "%d", recorded_info->channel_id);
    1.87  
    1.88  	  	gtk_tree_store_set(recordui->rec_tree_store, &iter,
    1.89 -	  		START_DATE_COLUMN, start_date_time->str, 
    1.90 +	  		START_DATE_COLUMN, start_date_time, 
    1.91  	  		TITLE_COLUMN, recorded_info->title->str,
    1.92  	  		CHAN_ID_COLUMN, str_aux->str,
    1.93 -	  		END_TIME_COLUMN, end_date_time->str, //It doesn't appear
    1.94 +	  		END_TIME_COLUMN, end_date_time, //It doesn't appear
    1.95  	  		RECORD_ID_COLUMN, recorded_info->record_id,
    1.96  			BASENAME_COLUMN, recorded_info->basename->str, -1); 
    1.97              //the last line is a hidden item to be used in searching tasks	  		
    1.98    	}
    1.99    	
   1.100    	g_debug ("[%s] %d lines added to record list UI", __FUNCTION__, new_row);
   1.101 +
   1.102 +     /* free allocated memory */
   1.103 +    if( NULL != start_date_time)
   1.104 +        g_free(start_date_time);
   1.105 +    if( NULL != end_date_time)
   1.106 +        g_free(end_date_time);
   1.107 +    g_string_free(str_aux,  FALSE);
   1.108    	  	
   1.109    	return TRUE;
   1.110  }
   1.111  
   1.112  
   1.113  MMythRecordUI*
   1.114 -mmyth_recordui_new(void)
   1.115 +mmyth_recordui_new( GMythBackendInfo* backend_info )
   1.116  {
   1.117  	MMythRecordUI *recordui = g_new0 (MMythRecordUI, 1);
   1.118 +
   1.119 +	g_return_val_if_fail( backend_info != NULL, NULL );
   1.120 +
   1.121 +	recordui->backend_info = backend_info;
   1.122  	
   1.123  	recordui->scrolled_window = gtk_scrolled_window_new (NULL, NULL);
   1.124  	gtk_scrolled_window_set_policy (GTK_SCROLLED_WINDOW (recordui->scrolled_window),
   1.125 @@ -259,7 +270,7 @@
   1.126                                  recordui->rec_label);
   1.127    
   1.128    	// Gets the mmyth scheduler manager
   1.129 -  	recordui->scheduler = gmyth_scheduler_new ();
   1.130 +  	recordui->scheduler = gmyth_scheduler_new ( backend_info );
   1.131      
   1.132      /* init connection to the backend */
   1.133      gmyth_scheduler_connect (recordui->scheduler, recordui->scheduler->backend_info);