[svn r245] Fixes a lot of bugs concerning GMythBackendInfo usage. trunk
authorrosfran
Fri Jan 05 19:27:27 2007 +0000 (2007-01-05)
branchtrunk
changeset 244c88244670b08
parent 243 beb4c07dfb65
child 245 f9329edd3b5e
[svn r245] Fixes a lot of bugs concerning GMythBackendInfo usage.
maemo-ui/src/Makefile.am
maemo-ui/src/mmyth_epg_grid_view.c
maemo-ui/src/mmyth_epg_grid_widget.c
maemo-ui/src/mmyth_main.c
maemo-ui/src/mmyth_recordui.c
maemo-ui/src/mmyth_recordui.h
maemo-ui/src/mmyth_schedulerui.c
maemo-ui/src/mmyth_schedulerui.h
maemo-ui/src/mmyth_tvplayer.c
maemo-ui/src/mmyth_tvplayer.h
maemo-ui/src/mmyth_ui.c
maemo-ui/src/mmyth_uicommon.c
maemo-ui/src/mmyth_uisettings.c
     1.1 --- a/maemo-ui/src/Makefile.am	Fri Jan 05 15:06:09 2007 +0000
     1.2 +++ b/maemo-ui/src/Makefile.am	Fri Jan 05 19:27:27 2007 +0000
     1.3 @@ -29,6 +29,7 @@
     1.4  		$(GTK_LIBS) \
     1.5  		$(GST_LIBS) \
     1.6  		$(GSTBASE_LIBS) \
     1.7 -		$(HILDON_LIBS) \
     1.8 -		$(GSTINTERFACES_LIBS)
     1.9 +		$(HILDON_LIBS)
    1.10  
    1.11 +#		$(GSTINTERFACES_LIBS)
    1.12 +
     2.1 --- a/maemo-ui/src/mmyth_epg_grid_view.c	Fri Jan 05 15:06:09 2007 +0000
     2.2 +++ b/maemo-ui/src/mmyth_epg_grid_view.c	Fri Jan 05 19:27:27 2007 +0000
     2.3 @@ -78,8 +78,8 @@
     2.4          // Convert it to local time representation. 
     2.5          /* FIXME: conversion from time to localtime is different
     2.6          in different machines */
     2.7 -        long int schedule_start_time = proginfo->startts;
     2.8 -        long int schedule_end_time   = proginfo->endts;
     2.9 +        long int schedule_start_time = proginfo->startts->tv_sec;
    2.10 +        long int schedule_end_time   = proginfo->endts->tv_sec;
    2.11      
    2.12          if (localtime_r(&schedule_start_time, &loctime_start) == NULL) {
    2.13              g_warning ("localtime_r error in mmyth_epg_grid_view!\n");
     3.1 --- a/maemo-ui/src/mmyth_epg_grid_widget.c	Fri Jan 05 15:06:09 2007 +0000
     3.2 +++ b/maemo-ui/src/mmyth_epg_grid_widget.c	Fri Jan 05 19:27:27 2007 +0000
     3.3 @@ -27,8 +27,8 @@
     3.4      gboolean show_favorites;
     3.5      gint current_start_channel_id;
     3.6      
     3.7 -    time_t current_start_time;
     3.8 -    time_t current_end_time;
     3.9 +    GTimeVal* current_start_time;
    3.10 +    GTimeVal* current_end_time;
    3.11  
    3.12      guint selected_channel_index;
    3.13      
    3.14 @@ -47,7 +47,7 @@
    3.15  static void mmyth_epg_grid_widget_init                (MMythEpgGridWidget *object);
    3.16  static void mmyth_epg_grid_widget_private_init        (MMythEpgGridWidgetPrivate *private);
    3.17  static void mmyth_epg_grid_widget_mount_services      (MMythEpgGridWidget *object, 
    3.18 -                                                       int start_time, int end_time);
    3.19 +                                                       GTimeVal* start_time, GTimeVal* end_time);
    3.20  static void mmyth_epg_grid_widget_mount_header        (MMythEpgGridWidget *object);
    3.21  static void mmyth_epg_grid_widget_clicked             (GtkWidget* widget, 
    3.22                                                         GdkEventExpose *event, 
    3.23 @@ -101,8 +101,11 @@
    3.24      private->selected_channel_index = 0;
    3.25          
    3.26      /* TODO fix the current start/end time */
    3.27 -    private->current_start_time = time(&cur_time);
    3.28 -    private->current_end_time = time(&cur_time) + 10800;   
    3.29 +    private->current_start_time = g_new0( GTimeVal, 1 );
    3.30 +    private->current_start_time->tv_sec = time(&cur_time);
    3.31 +
    3.32 +    private->current_end_time = g_new0( GTimeVal, 1 );
    3.33 +    private->current_end_time->tv_sec = time(&cur_time) + 10800;
    3.34      
    3.35      private->DISPLAY_CHANS = MAX_DISPLAY_CHANS;
    3.36  
    3.37 @@ -171,8 +174,8 @@
    3.38  }
    3.39  
    3.40  static void
    3.41 -mmyth_epg_grid_widget_mount_services(MMythEpgGridWidget *mmyth_epg_grid_widget, 
    3.42 -                                     int start_time, int end_time)
    3.43 +mmyth_epg_grid_widget_mount_services( MMythEpgGridWidget *mmyth_epg_grid_widget, 
    3.44 +                                     GTimeVal* start_time, GTimeVal* end_time )
    3.45  {
    3.46      GList *proglist;
    3.47      GList *channel_list = NULL;
    3.48 @@ -253,15 +256,17 @@
    3.49              
    3.50              GString *content_name = proginfo->title;
    3.51                      
    3.52 -       	    int initial_time, last_time, duration;
    3.53 +       	    GTimeVal* initial_time = g_new0( GTimeVal, 1 );
    3.54 +	    GTimeVal* last_time = g_new0( GTimeVal, 1 ); 
    3.55 +	    GTimeVal* duration = g_new0( GTimeVal, 1 );
    3.56  
    3.57 -            int schedule_start_time = proginfo->startts;
    3.58 -            int schedule_end_time   = proginfo->endts;
    3.59 +            GTimeVal* schedule_start_time = proginfo->startts;
    3.60 +            GTimeVal* schedule_end_time   = proginfo->endts;
    3.61  
    3.62 -	        initial_time = 
    3.63 -                (schedule_start_time < start_time) ? start_time : schedule_start_time;
    3.64 -            last_time = (schedule_end_time > end_time) ? end_time : schedule_end_time;
    3.65 -	        duration = last_time - initial_time;
    3.66 +	        initial_time->tv_sec = 
    3.67 +                (schedule_start_time->tv_sec < start_time->tv_sec) ? start_time->tv_sec : schedule_start_time->tv_sec;
    3.68 +            last_time->tv_sec = (schedule_end_time->tv_sec > end_time->tv_sec) ? end_time->tv_sec : schedule_end_time->tv_sec;
    3.69 +	        duration->tv_sec = last_time->tv_sec - initial_time->tv_sec;
    3.70  		    
    3.71              // Verify program time 
    3.72              #if 0
    3.73 @@ -286,17 +291,17 @@
    3.74              #endif
    3.75      		
    3.76      	    /* fprintf(stderr, "duration = %d\n", duration); */
    3.77 -    	    double duration_hour = duration / (double) 3600.0;
    3.78 +    	    double duration_hour = duration->tv_sec / (double) 3600.0;
    3.79      	    /* fprintf(stderr, "duration_hour = %lf\n", duration_hour); */
    3.80      		
    3.81              int size = PIXELS_HOUR * duration_hour;
    3.82                  
    3.83              /* complete hour */
    3.84              /* FIXME: UGLY WRONG HACK TO ALIGN PROGRAM TIME!!!*/
    3.85 -            if(last_time%3600 != 0) {
    3.86 +            if( last_time->tv_sec % 3600 != 0 ) {
    3.87                  size -= PROGRAM_SEPARATION;                
    3.88              }
    3.89 -            if(initial_time%3600 != 0) {
    3.90 +            if ( initial_time->tv_sec % 3600 != 0 ) {
    3.91                  size -= PROGRAM_SEPARATION;                
    3.92              }
    3.93  
    3.94 @@ -308,7 +313,7 @@
    3.95  							  GDK_BUTTON_PRESS_MASK | GDK_BUTTON_RELEASE_MASK);
    3.96              
    3.97              /* create EpgGridItem */
    3.98 -            EpgGridItem *epg_grid_item = g_new(EpgGridItem, 1);
    3.99 +            EpgGridItem *epg_grid_item = g_new0(EpgGridItem, 1);
   3.100              epg_grid_item->proginfo  = proginfo;
   3.101              epg_grid_item->event_box = event_box;
   3.102              epg_grid_item->object    = mmyth_epg_grid_widget;
   3.103 @@ -336,7 +341,7 @@
   3.104                                GDK_BUTTON_PRESS_MASK | GDK_BUTTON_RELEASE_MASK);
   3.105  
   3.106              /* create EpgGridItem */
   3.107 -            EpgGridItem *epg_grid_item = g_new(EpgGridItem, 1);
   3.108 +            EpgGridItem *epg_grid_item = g_new0(EpgGridItem, 1);
   3.109              epg_grid_item->proginfo  = NULL;
   3.110              epg_grid_item->event_box = event_box;
   3.111              epg_grid_item->object    = mmyth_epg_grid_widget;
   3.112 @@ -378,9 +383,9 @@
   3.113  	/* hours title line */
   3.114      GtkWidget *epg_programs_hours_hbox = gtk_hbox_new (TRUE, 0); 
   3.115  
   3.116 -    if (localtime_r((time_t *)&private->current_start_time, &hour_tm) == NULL) {
   3.117 +    if (localtime_r((time_t *)&private->current_start_time->tv_sec, &hour_tm) == NULL) {
   3.118          g_warning ("localtime_r error in mmyth_epg_grid_widget!\n");
   3.119 -        return NULL;
   3.120 +        return;
   3.121      }    
   3.122  
   3.123      if (hour_tm.tm_min>30) {
     4.1 --- a/maemo-ui/src/mmyth_main.c	Fri Jan 05 15:06:09 2007 +0000
     4.2 +++ b/maemo-ui/src/mmyth_main.c	Fri Jan 05 19:27:27 2007 +0000
     4.3 @@ -9,7 +9,6 @@
     4.4  #endif
     4.5  
     4.6  #include <gmyth/gmyth_recorder.h>
     4.7 -#include <gmyth/gmyth_settings.h>
     4.8  #include <gmyth/gmyth_context.h>
     4.9  #include <gmyth/gmyth_tvchain.h>
    4.10  #include <gmyth/gmyth_remote_util.h>
     5.1 --- a/maemo-ui/src/mmyth_recordui.c	Fri Jan 05 15:06:09 2007 +0000
     5.2 +++ b/maemo-ui/src/mmyth_recordui.c	Fri Jan 05 19:27:27 2007 +0000
     5.3 @@ -1,5 +1,5 @@
     5.4 -#include<gtk/gtk.h>
     5.5 -#include<glib.h>
     5.6 +#include <gtk/gtk.h>
     5.7 +#include <glib.h>
     5.8  #include <sys/types.h>
     5.9  #include <sys/stat.h>
    5.10  #include <unistd.h>
    5.11 @@ -11,8 +11,8 @@
    5.12  #include "mmyth_recordui.h"
    5.13  
    5.14  /* GMyth library includes */
    5.15 -#include "gmyth_scheduler.h"
    5.16 -#include "gmyth_util.h"
    5.17 +#include <gmyth/gmyth_scheduler.h>
    5.18 +#include <gmyth/gmyth_util.h>
    5.19  
    5.20  enum {
    5.21  	START_DATE_COLUMN = 0,
    5.22 @@ -47,8 +47,8 @@
    5.23  	ScheduleInfo *schedule_info;
    5.24  	GList *schedule_list;
    5.25  	GtkTreeIter iter;
    5.26 -    GString *start_date_time = NULL;
    5.27 -    GString *end_date_time = NULL;
    5.28 +     gchar *start_date_time = NULL;
    5.29 +    gchar *end_date_time = NULL;
    5.30      GString *str_aux = g_string_new("");
    5.31  	gint res;
    5.32  
    5.33 @@ -66,16 +66,16 @@
    5.34  
    5.35    	  	gtk_tree_store_insert(recordui->sch_tree_store, &iter, NULL, new_row++);
    5.36          
    5.37 -        start_date_time = gmyth_util_time_to_string(schedule_info->start_time);
    5.38 -        end_date_time = gmyth_util_time_to_string(schedule_info->end_time);
    5.39 +        start_date_time = gmyth_util_time_to_string_from_time_val(schedule_info->start_time);
    5.40 +        end_date_time = gmyth_util_time_to_string_from_time_val(schedule_info->end_time);
    5.41          
    5.42          g_string_printf(str_aux, "%d", schedule_info->channel_id);
    5.43          
    5.44  	  	gtk_tree_store_set(recordui->sch_tree_store, &iter,
    5.45 -	  		START_DATE_COLUMN, start_date_time->str, 
    5.46 +	  		START_DATE_COLUMN, start_date_time, 
    5.47  	  		TITLE_COLUMN, schedule_info->title->str,
    5.48  	  		CHAN_ID_COLUMN, str_aux->str,
    5.49 -	  		END_TIME_COLUMN, end_date_time->str, //It doesn't appear
    5.50 +	  		END_TIME_COLUMN, end_date_time, //It doesn't appear
    5.51  	  		RECORD_ID_COLUMN, schedule_info->record_id, 
    5.52  			-1); //the last line is a hidden item to be used in searching tasks
    5.53   	}
    5.54 @@ -84,9 +84,9 @@
    5.55    	
    5.56      /* free allocated memory */
    5.57      if(!start_date_time)
    5.58 -        g_string_free(start_date_time, FALSE);
    5.59 +        g_free(start_date_time);
    5.60      if(!end_date_time)
    5.61 -        g_string_free(end_date_time, FALSE);
    5.62 +        g_free(end_date_time);
    5.63      g_string_free(str_aux,  FALSE);
    5.64      
    5.65    	return TRUE;
    5.66 @@ -99,8 +99,8 @@
    5.67  	RecordedInfo *recorded_info;
    5.68  	GList *record_list = NULL;
    5.69  	GtkTreeIter iter;
    5.70 -    GString *start_date_time = NULL;
    5.71 -    GString *end_date_time = NULL;
    5.72 +    gchar *start_date_time = NULL;
    5.73 +    gchar *end_date_time = NULL;
    5.74      GString *str_aux = g_string_new("");
    5.75  	gint res;
    5.76  	
    5.77 @@ -117,31 +117,42 @@
    5.78  
    5.79    	  	gtk_tree_store_insert(recordui->rec_tree_store, &iter, NULL, new_row++);
    5.80  
    5.81 -        start_date_time = gmyth_util_time_to_string(recorded_info->start_time);
    5.82 -        end_date_time = gmyth_util_time_to_string(recorded_info->end_time);
    5.83 +        start_date_time = gmyth_util_time_to_string_from_time_val(recorded_info->start_time);
    5.84 +        end_date_time = gmyth_util_time_to_string_from_time_val(recorded_info->end_time);
    5.85  
    5.86          g_string_printf(str_aux, "%d", recorded_info->channel_id);
    5.87  
    5.88  	  	gtk_tree_store_set(recordui->rec_tree_store, &iter,
    5.89 -	  		START_DATE_COLUMN, start_date_time->str, 
    5.90 +	  		START_DATE_COLUMN, start_date_time, 
    5.91  	  		TITLE_COLUMN, recorded_info->title->str,
    5.92  	  		CHAN_ID_COLUMN, str_aux->str,
    5.93 -	  		END_TIME_COLUMN, end_date_time->str, //It doesn't appear
    5.94 +	  		END_TIME_COLUMN, end_date_time, //It doesn't appear
    5.95  	  		RECORD_ID_COLUMN, recorded_info->record_id,
    5.96  			BASENAME_COLUMN, recorded_info->basename->str, -1); 
    5.97              //the last line is a hidden item to be used in searching tasks	  		
    5.98    	}
    5.99    	
   5.100    	g_debug ("[%s] %d lines added to record list UI", __FUNCTION__, new_row);
   5.101 +
   5.102 +     /* free allocated memory */
   5.103 +    if( NULL != start_date_time)
   5.104 +        g_free(start_date_time);
   5.105 +    if( NULL != end_date_time)
   5.106 +        g_free(end_date_time);
   5.107 +    g_string_free(str_aux,  FALSE);
   5.108    	  	
   5.109    	return TRUE;
   5.110  }
   5.111  
   5.112  
   5.113  MMythRecordUI*
   5.114 -mmyth_recordui_new(void)
   5.115 +mmyth_recordui_new( GMythBackendInfo* backend_info )
   5.116  {
   5.117  	MMythRecordUI *recordui = g_new0 (MMythRecordUI, 1);
   5.118 +
   5.119 +	g_return_val_if_fail( backend_info != NULL, NULL );
   5.120 +
   5.121 +	recordui->backend_info = backend_info;
   5.122  	
   5.123  	recordui->scrolled_window = gtk_scrolled_window_new (NULL, NULL);
   5.124  	gtk_scrolled_window_set_policy (GTK_SCROLLED_WINDOW (recordui->scrolled_window),
   5.125 @@ -259,7 +270,7 @@
   5.126                                  recordui->rec_label);
   5.127    
   5.128    	// Gets the mmyth scheduler manager
   5.129 -  	recordui->scheduler = gmyth_scheduler_new ();
   5.130 +  	recordui->scheduler = gmyth_scheduler_new ( backend_info );
   5.131      
   5.132      /* init connection to the backend */
   5.133      gmyth_scheduler_connect (recordui->scheduler, recordui->scheduler->backend_info);
     6.1 --- a/maemo-ui/src/mmyth_recordui.h	Fri Jan 05 15:06:09 2007 +0000
     6.2 +++ b/maemo-ui/src/mmyth_recordui.h	Fri Jan 05 19:27:27 2007 +0000
     6.3 @@ -1,7 +1,8 @@
     6.4  #ifndef MMYTH_RECORD_H_
     6.5  #define MMYTH_RECORD_H_
     6.6  
     6.7 -#include "gmyth_scheduler.h"
     6.8 +#include <gmyth/gmyth_scheduler.h>
     6.9 +#include <gmyth/gmyth_backendinfo.h>
    6.10  
    6.11  typedef struct _MMythRecordUI
    6.12  {
    6.13 @@ -32,10 +33,12 @@
    6.14  	GtkTreeStore *rec_tree_store;
    6.15  	
    6.16  	GMythScheduler *scheduler;
    6.17 +
    6.18 +	GMythBackendInfo* backend_info;
    6.19  	
    6.20  } MMythRecordUI;
    6.21  
    6.22 -MMythRecordUI* mmyth_recordui_new(void);
    6.23 +MMythRecordUI* mmyth_recordui_new( GMythBackendInfo* backend_info );
    6.24  void mmyth_recordui_free (MMythRecordUI *recordui);
    6.25  
    6.26  void mmyth_recordui_delete_selected (GtkButton *button, MMythRecordUI *recordui);
     7.1 --- a/maemo-ui/src/mmyth_schedulerui.c	Fri Jan 05 15:06:09 2007 +0000
     7.2 +++ b/maemo-ui/src/mmyth_schedulerui.c	Fri Jan 05 19:27:27 2007 +0000
     7.3 @@ -13,9 +13,9 @@
     7.4  #include "mmyth_schedulerui.h"
     7.5  
     7.6  /* GMyth library includes */
     7.7 -#include "gmyth_scheduler.h"
     7.8 -#include "gmyth_common.h"
     7.9 -#include "gmyth_epg.h"
    7.10 +#include <gmyth/gmyth_scheduler.h>
    7.11 +#include <gmyth/gmyth_common.h>
    7.12 +#include <gmyth/gmyth_epg.h>
    7.13  
    7.14  static void run_calendar_dialog (GtkButton *button, gpointer data);
    7.15  
    7.16 @@ -27,7 +27,7 @@
    7.17  static void add_title_field (MMythSchedulerUI *scheduler_ui, GtkWidget *vbox);
    7.18  
    7.19  MMythSchedulerUI*
    7.20 -mmyth_schedulerui_new (void)
    7.21 +mmyth_schedulerui_new ( GMythBackendInfo *backend_info )
    7.22  {
    7.23  	GtkWidget *scrolledwindow;	
    7.24  	GtkWidget *viewport;	
    7.25 @@ -37,6 +37,8 @@
    7.26  	GtkWidget *label;
    7.27  
    7.28  	MMythSchedulerUI *scheduler_ui = g_new0 (MMythSchedulerUI, 1);
    7.29 +
    7.30 +	scheduler_ui->backend_info = backend_info;
    7.31  	
    7.32  	scrolledwindow = gtk_scrolled_window_new (NULL, NULL);
    7.33  	scheduler_ui->main_widget = scrolledwindow;
    7.34 @@ -127,83 +129,85 @@
    7.35  gboolean
    7.36  mmyth_schedulerui_save (MMythSchedulerUI *scheduler_ui)
    7.37  {
    7.38 -    GMythScheduler *scheduler;
    7.39 +	GMythScheduler *scheduler;
    7.40  	ScheduleInfo *schedule_info;
    7.41  	GMythChannelInfo *channel_info;
    7.42  
    7.43  	GList *clist;
    7.44  	gint index, duration;
    7.45 -    gint frequency;
    7.46 -    struct tm start_tm;
    7.47 -	
    7.48 +	gint frequency;
    7.49 +	struct tm start_tm;
    7.50 +
    7.51  	schedule_info = g_new0(ScheduleInfo, 1);
    7.52 -    if(schedule_info == NULL) {
    7.53 -        g_warning ("Error allocating memory");
    7.54 -        return FALSE;
    7.55 -    }
    7.56 -        
    7.57 -    clist = scheduler_ui->channel_list;
    7.58 -      
    7.59 -    index = gtk_combo_box_get_active(GTK_COMBO_BOX(scheduler_ui->channel_combobox));
    7.60 +	if(schedule_info == NULL) {
    7.61 +		g_warning ("Error allocating memory");
    7.62 +		return FALSE;
    7.63 +	}
    7.64  
    7.65 -    if (clist != NULL)
    7.66 +	clist = scheduler_ui->channel_list;
    7.67 +
    7.68 +	index = gtk_combo_box_get_active(GTK_COMBO_BOX(scheduler_ui->channel_combobox));
    7.69 +
    7.70 +	if (clist != NULL)
    7.71  		clist = g_list_nth(clist, index);
    7.72 -    
    7.73 -    if (clist) {
    7.74 -	    g_debug ("[%s] New schedule: %d", __FUNCTION__, index);
    7.75 -    } else {
    7.76 -	    g_warning ("[%s] Error when adding new schedule", __FUNCTION__);
    7.77 -	    return FALSE;
    7.78 -    }
    7.79 -    
    7.80 -    channel_info = clist->data;
    7.81 -    
    7.82 -    /* initialize schedule_info */
    7.83 -    schedule_info->channel_id = channel_info->channel_ID;
    7.84 -    
    7.85 -    start_tm.tm_hour = 
    7.86 -        (int)gtk_spin_button_get_value(GTK_SPIN_BUTTON(scheduler_ui->hour_spinbutton));
    7.87 +
    7.88 +	if (clist) {
    7.89 +		g_debug ("[%s] New schedule: %d", __FUNCTION__, index);
    7.90 +	} else {
    7.91 +		g_warning ("[%s] Error when adding new schedule", __FUNCTION__);
    7.92 +		return FALSE;
    7.93 +	}
    7.94 +
    7.95 +	channel_info = clist->data;
    7.96 +
    7.97 +	/* initialize schedule_info */
    7.98 +	schedule_info->channel_id = channel_info->channel_ID;
    7.99 +
   7.100 +	start_tm.tm_hour = 
   7.101 +		(int)gtk_spin_button_get_value(GTK_SPIN_BUTTON(scheduler_ui->hour_spinbutton));
   7.102  	start_tm.tm_min = 
   7.103 -        (int)gtk_spin_button_get_value(GTK_SPIN_BUTTON(scheduler_ui->min_spinbutton));
   7.104 -    start_tm.tm_sec = 0;
   7.105 +		(int)gtk_spin_button_get_value(GTK_SPIN_BUTTON(scheduler_ui->min_spinbutton));
   7.106 +	start_tm.tm_sec = 0;
   7.107  
   7.108  	start_tm.tm_mday = (gint)scheduler_ui->day_temp;
   7.109  	start_tm.tm_mon =  (gint)scheduler_ui->month_temp;
   7.110  	start_tm.tm_year = (gint)scheduler_ui->year_temp - 1900; //years since 1900
   7.111 +	GTimeVal* time_val_local = g_new0( GTimeVal, 1 );
   7.112 +	time_val_local->tv_sec = timelocal(&start_tm);
   7.113  
   7.114 -    schedule_info->start_time = timelocal(&start_tm);
   7.115 -    if (schedule_info->start_time == (time_t)(-1)) {
   7.116 -        g_warning ("timelocal error!\n");
   7.117 -        return FALSE;
   7.118 -    }
   7.119 +	schedule_info->start_time = time_val_local;
   7.120 +	if ( NULL == schedule_info->start_time ) {
   7.121 +		g_warning ("timelocal error!\n");
   7.122 +		return FALSE;
   7.123 +	}
   7.124  
   7.125  	duration = (gint) gtk_spin_button_get_value(
   7.126 -                        GTK_SPIN_BUTTON(scheduler_ui->duration_spinbutton));
   7.127 -    schedule_info->end_time = schedule_info->start_time + (duration*60);
   7.128 +			GTK_SPIN_BUTTON(scheduler_ui->duration_spinbutton));
   7.129 +	schedule_info->end_time = schedule_info->start_time + (duration*60);
   7.130  
   7.131 -    /* TODO: frequency is not implemented yet */
   7.132 +	/* TODO: frequency is not implemented yet */
   7.133  	frequency = gtk_combo_box_get_active(GTK_COMBO_BOX(scheduler_ui->freq_combobox));
   7.134  
   7.135  	schedule_info->title = g_string_new("");
   7.136  	g_string_printf(schedule_info->title, "%s", 
   7.137 -                    gtk_entry_get_text(GTK_ENTRY(scheduler_ui->title_entry)));
   7.138 -	
   7.139 -    /* FIXME: Architecture change to reuse the scheduler created in the recordui! */
   7.140 -    scheduler = gmyth_scheduler_new ();
   7.141 +			gtk_entry_get_text(GTK_ENTRY(scheduler_ui->title_entry)));
   7.142  
   7.143 -    gmyth_scheduler_connect(scheduler, scheduler->backend_info);
   7.144 +	/* FIXME: Architecture change to reuse the scheduler created in the recordui! */
   7.145 +	scheduler = gmyth_scheduler_new ();
   7.146  
   7.147 -    /* FIXME: set record_id = -1 to add a new schedule */
   7.148 -    schedule_info->record_id = -1;
   7.149 -    gmyth_scheduler_add_schedule (scheduler, schedule_info);
   7.150 +	gmyth_scheduler_connect(scheduler, scheduler->backend_info);
   7.151  
   7.152 -    gmyth_scheduler_disconnect(scheduler);
   7.153 -    
   7.154 -    /* free allocated memory */
   7.155 -    g_object_unref (scheduler);
   7.156 -    g_free (schedule_info);
   7.157 -	
   7.158 -    return TRUE;
   7.159 +	/* FIXME: set record_id = -1 to add a new schedule */
   7.160 +	schedule_info->record_id = -1;
   7.161 +	gmyth_scheduler_add_schedule (scheduler, schedule_info);
   7.162 +
   7.163 +	gmyth_scheduler_disconnect(scheduler);
   7.164 +
   7.165 +	/* free allocated memory */
   7.166 +	g_object_unref (scheduler);
   7.167 +	g_free (schedule_info);
   7.168 +
   7.169 +	return TRUE;
   7.170  } 
   7.171  
   7.172  static GtkWidget*
   7.173 @@ -235,7 +239,7 @@
   7.174  	gtk_box_pack_start (GTK_BOX (hbox), combobox, FALSE, FALSE, 0);
   7.175  			
   7.176  	GMythEPG *mmyth_epg = gmyth_epg_new ();
   7.177 -	if (!gmyth_epg_connect (mmyth_epg, mmyth_epg->sqlquery->backend_info)) {
   7.178 +	if (!gmyth_epg_connect (mmyth_epg, scheduler_ui->backend_info)) {
   7.179  		// FIXME: Without this list the scheduler UI should not be shown!
   7.180  		g_warning ("[%s] Error when getting list of channels", __FUNCTION__);
   7.181  	}
   7.182 @@ -271,7 +275,7 @@
   7.183  
   7.184      if (localtime_r((time_t *)&real_time, &sched_time) == NULL) {
   7.185          g_warning ("localtime_r error in mmyth_epg_grid_view!\n");
   7.186 -        return NULL;
   7.187 +        return;
   7.188      }
   7.189   
   7.190  	if (sched_time.tm_min>30){
     8.1 --- a/maemo-ui/src/mmyth_schedulerui.h	Fri Jan 05 15:06:09 2007 +0000
     8.2 +++ b/maemo-ui/src/mmyth_schedulerui.h	Fri Jan 05 19:27:27 2007 +0000
     8.3 @@ -3,6 +3,8 @@
     8.4  
     8.5  #include <glib.h>
     8.6  
     8.7 +#include <gmyth/gmyth_backendinfo.h>
     8.8 +
     8.9  typedef struct _MMythSchedulerUI {
    8.10  	
    8.11  	GList *channel_list;
    8.12 @@ -21,6 +23,9 @@
    8.13  	GtkWidget *calendar;
    8.14  	
    8.15  	guint year_temp, month_temp, day_temp;
    8.16 +
    8.17 +	GMythBackendInfo* backend_info;
    8.18 +
    8.19  } MMythSchedulerUI;
    8.20  
    8.21  typedef struct {
    8.22 @@ -35,7 +40,7 @@
    8.23  
    8.24  } ScheduleEntry;
    8.25  
    8.26 -MMythSchedulerUI* mmyth_schedulerui_new (void);
    8.27 +MMythSchedulerUI* mmyth_schedulerui_new ( GMythBackendInfo* backend_info );
    8.28  
    8.29  gboolean mmyth_schedulerui_save (MMythSchedulerUI *scheduler_ui);
    8.30  
     9.1 --- a/maemo-ui/src/mmyth_tvplayer.c	Fri Jan 05 15:06:09 2007 +0000
     9.2 +++ b/maemo-ui/src/mmyth_tvplayer.c	Fri Jan 05 19:27:27 2007 +0000
     9.3 @@ -353,11 +353,11 @@
     9.4   * @return TRUE if successfull, FALSE if any error happens.
     9.5   */
     9.6  gboolean
     9.7 -mmyth_tvplayer_record_setup (MMythTVPlayer *tvplayer, gchar *filename)
     9.8 +mmyth_tvplayer_record_setup (MMythTVPlayer *tvplayer, const gchar *filename)
     9.9  {
    9.10  	// FIXME: we should receive the uri instead of filename
    9.11 -	gchar *hostname = gmyth_backend_info_get_hostname (tvplayer->backend_info);
    9.12 -	gint port = gmyth_backend_info_get_port(tvplayer->backend_info);
    9.13 +	const gchar *hostname = gmyth_backend_info_get_hostname (tvplayer->backend_info);
    9.14 +	const gint port = gmyth_backend_info_get_port(tvplayer->backend_info);
    9.15  	
    9.16  	GString *fullpath = g_string_new ("myth://");
    9.17  	g_string_append_printf (fullpath, "%s:%d/%s", hostname, port, filename);
    9.18 @@ -382,7 +382,6 @@
    9.19  mmyth_tvplayer_livetv_setup (MMythTVPlayer *tvplayer)
    9.20  {
    9.21  	gboolean res = TRUE;
    9.22 -	gchar *hostname;
    9.23  
    9.24  	tvplayer->livetv = gmyth_livetv_new ();
    9.25  
    10.1 --- a/maemo-ui/src/mmyth_tvplayer.h	Fri Jan 05 15:06:09 2007 +0000
    10.2 +++ b/maemo-ui/src/mmyth_tvplayer.h	Fri Jan 05 19:27:27 2007 +0000
    10.3 @@ -111,7 +111,7 @@
    10.4  gboolean       mmyth_tvplayer_is_playing   (MMythTVPlayer *tvplayer);
    10.5  
    10.6  gboolean       mmyth_tvplayer_record_setup (MMythTVPlayer *tvplayer, 
    10.7 -                                            gchar *filename);
    10.8 +                                            const gchar *filename);
    10.9  gboolean       mmyth_tvplayer_livetv_setup (MMythTVPlayer *tvplayer);
   10.10  
   10.11  G_END_DECLS
    11.1 --- a/maemo-ui/src/mmyth_ui.c	Fri Jan 05 15:06:09 2007 +0000
    11.2 +++ b/maemo-ui/src/mmyth_ui.c	Fri Jan 05 19:27:27 2007 +0000
    11.3 @@ -495,10 +495,10 @@
    11.4  	if (!(mmyth_ui->schedule_uicommon))
    11.5  		mmyth_ui->schedule_uicommon = create_schedule_view(mmyth_ui);
    11.6  		
    11.7 -	schedule_list = g_list_nth(schedule_list, atoi(gtk_tree_path_to_string(path)));
    11.8 +	schedule_list = g_list_nth(schedule_list, g_ascii_strtoull( gtk_tree_path_to_string(path), NULL, 10 ));
    11.9  	schedule_info = (ScheduleInfo*) schedule_list->data;
   11.10  
   11.11 -    printf("\nstarttime: %ld", schedule_info->start_time); fflush(stdout);		
   11.12 +    printf("\nstarttime: %ld", schedule_info->start_time->tv_sec); fflush(stdout);
   11.13  }
   11.14  
   11.15  static MMythUiCommon *
   11.16 @@ -509,7 +509,7 @@
   11.17      
   11.18      g_debug ("Creating Schedule UI Common");
   11.19  
   11.20 -	mmyth_ui->mmyth_schedulerui = mmyth_schedulerui_new ();
   11.21 +	mmyth_ui->mmyth_schedulerui = mmyth_schedulerui_new ( mmyth_ui->backend_info );
   11.22  	if (mmyth_ui->mmyth_schedulerui == NULL) {
   11.23  		g_warning ("[%s] Error while creating scheduler ui", __FUNCTION__);
   11.24  		return NULL;
   11.25 @@ -700,7 +700,7 @@
   11.26      
   11.27     	g_debug ("Creating Record UI Common");
   11.28     	
   11.29 -	mmyth_ui->mmyth_recordui = mmyth_recordui_new ();
   11.30 +	mmyth_ui->mmyth_recordui = mmyth_recordui_new ( mmyth_ui->backend_info );
   11.31  
   11.32  	// FIXME: Change MMythRecordUI to a GtkWidget child and avoid this call!
   11.33      gtk_widget_show_all (mmyth_ui->mmyth_recordui->scrolled_window);
    12.1 --- a/maemo-ui/src/mmyth_uicommon.c	Fri Jan 05 15:06:09 2007 +0000
    12.2 +++ b/maemo-ui/src/mmyth_uicommon.c	Fri Jan 05 19:27:27 2007 +0000
    12.3 @@ -18,7 +18,7 @@
    12.4  
    12.5      if (localtime_r((time_t *)&real_time, &sched_time) == NULL) {
    12.6          g_error ("localtime_r error in mmyth_epg_grid_view!\n");
    12.7 -        return NULL;
    12.8 +        return;
    12.9      }
   12.10  
   12.11  	g_string_printf(time_showed, "%d:%02d:%02d", 
    13.1 --- a/maemo-ui/src/mmyth_uisettings.c	Fri Jan 05 15:06:09 2007 +0000
    13.2 +++ b/maemo-ui/src/mmyth_uisettings.c	Fri Jan 05 19:27:27 2007 +0000
    13.3 @@ -138,7 +138,6 @@
    13.4  static void
    13.5  settings_dialog_update_data (void) 
    13.6  {
    13.7 -	GString *tmp_entry_text;
    13.8  	//GMythSettings *backend_info = gmyth_context_get_settings();
    13.9  	
   13.10  	if (!backend_info) {