# HG changeset patch
# User rosfran
# Date 1168025247 0
# Node ID c88244670b08e3a7298c02d0fb021719ca5a3416
# Parent  beb4c07dfb65315e6de000f9bd687526f05066f4
[svn r245] Fixes a lot of bugs concerning GMythBackendInfo usage.

diff -r beb4c07dfb65 -r c88244670b08 maemo-ui/src/Makefile.am
--- a/maemo-ui/src/Makefile.am	Fri Jan 05 15:06:09 2007 +0000
+++ b/maemo-ui/src/Makefile.am	Fri Jan 05 19:27:27 2007 +0000
@@ -29,6 +29,7 @@
 		$(GTK_LIBS) \
 		$(GST_LIBS) \
 		$(GSTBASE_LIBS) \
-		$(HILDON_LIBS) \
-		$(GSTINTERFACES_LIBS)
+		$(HILDON_LIBS)
 
+#		$(GSTINTERFACES_LIBS)
+
diff -r beb4c07dfb65 -r c88244670b08 maemo-ui/src/mmyth_epg_grid_view.c
--- a/maemo-ui/src/mmyth_epg_grid_view.c	Fri Jan 05 15:06:09 2007 +0000
+++ b/maemo-ui/src/mmyth_epg_grid_view.c	Fri Jan 05 19:27:27 2007 +0000
@@ -78,8 +78,8 @@
         // Convert it to local time representation. 
         /* FIXME: conversion from time to localtime is different
         in different machines */
-        long int schedule_start_time = proginfo->startts;
-        long int schedule_end_time   = proginfo->endts;
+        long int schedule_start_time = proginfo->startts->tv_sec;
+        long int schedule_end_time   = proginfo->endts->tv_sec;
     
         if (localtime_r(&schedule_start_time, &loctime_start) == NULL) {
             g_warning ("localtime_r error in mmyth_epg_grid_view!\n");
diff -r beb4c07dfb65 -r c88244670b08 maemo-ui/src/mmyth_epg_grid_widget.c
--- a/maemo-ui/src/mmyth_epg_grid_widget.c	Fri Jan 05 15:06:09 2007 +0000
+++ b/maemo-ui/src/mmyth_epg_grid_widget.c	Fri Jan 05 19:27:27 2007 +0000
@@ -27,8 +27,8 @@
     gboolean show_favorites;
     gint current_start_channel_id;
     
-    time_t current_start_time;
-    time_t current_end_time;
+    GTimeVal* current_start_time;
+    GTimeVal* current_end_time;
 
     guint selected_channel_index;
     
@@ -47,7 +47,7 @@
 static void mmyth_epg_grid_widget_init                (MMythEpgGridWidget *object);
 static void mmyth_epg_grid_widget_private_init        (MMythEpgGridWidgetPrivate *private);
 static void mmyth_epg_grid_widget_mount_services      (MMythEpgGridWidget *object, 
-                                                       int start_time, int end_time);
+                                                       GTimeVal* start_time, GTimeVal* end_time);
 static void mmyth_epg_grid_widget_mount_header        (MMythEpgGridWidget *object);
 static void mmyth_epg_grid_widget_clicked             (GtkWidget* widget, 
                                                        GdkEventExpose *event, 
@@ -101,8 +101,11 @@
     private->selected_channel_index = 0;
         
     /* TODO fix the current start/end time */
-    private->current_start_time = time(&cur_time);
-    private->current_end_time = time(&cur_time) + 10800;   
+    private->current_start_time = g_new0( GTimeVal, 1 );
+    private->current_start_time->tv_sec = time(&cur_time);
+
+    private->current_end_time = g_new0( GTimeVal, 1 );
+    private->current_end_time->tv_sec = time(&cur_time) + 10800;
     
     private->DISPLAY_CHANS = MAX_DISPLAY_CHANS;
 
@@ -171,8 +174,8 @@
 }
 
 static void
-mmyth_epg_grid_widget_mount_services(MMythEpgGridWidget *mmyth_epg_grid_widget, 
-                                     int start_time, int end_time)
+mmyth_epg_grid_widget_mount_services( MMythEpgGridWidget *mmyth_epg_grid_widget, 
+                                     GTimeVal* start_time, GTimeVal* end_time )
 {
     GList *proglist;
     GList *channel_list = NULL;
@@ -253,15 +256,17 @@
             
             GString *content_name = proginfo->title;
                     
-       	    int initial_time, last_time, duration;
+       	    GTimeVal* initial_time = g_new0( GTimeVal, 1 );
+	    GTimeVal* last_time = g_new0( GTimeVal, 1 ); 
+	    GTimeVal* duration = g_new0( GTimeVal, 1 );
 
-            int schedule_start_time = proginfo->startts;
-            int schedule_end_time   = proginfo->endts;
+            GTimeVal* schedule_start_time = proginfo->startts;
+            GTimeVal* schedule_end_time   = proginfo->endts;
 
-	        initial_time = 
-                (schedule_start_time < start_time) ? start_time : schedule_start_time;
-            last_time = (schedule_end_time > end_time) ? end_time : schedule_end_time;
-	        duration = last_time - initial_time;
+	        initial_time->tv_sec = 
+                (schedule_start_time->tv_sec < start_time->tv_sec) ? start_time->tv_sec : schedule_start_time->tv_sec;
+            last_time->tv_sec = (schedule_end_time->tv_sec > end_time->tv_sec) ? end_time->tv_sec : schedule_end_time->tv_sec;
+	        duration->tv_sec = last_time->tv_sec - initial_time->tv_sec;
 		    
             // Verify program time 
             #if 0
@@ -286,17 +291,17 @@
             #endif
     		
     	    /* fprintf(stderr, "duration = %d\n", duration); */
-    	    double duration_hour = duration / (double) 3600.0;
+    	    double duration_hour = duration->tv_sec / (double) 3600.0;
     	    /* fprintf(stderr, "duration_hour = %lf\n", duration_hour); */
     		
             int size = PIXELS_HOUR * duration_hour;
                 
             /* complete hour */
             /* FIXME: UGLY WRONG HACK TO ALIGN PROGRAM TIME!!!*/
-            if(last_time%3600 != 0) {
+            if( last_time->tv_sec % 3600 != 0 ) {
                 size -= PROGRAM_SEPARATION;                
             }
-            if(initial_time%3600 != 0) {
+            if ( initial_time->tv_sec % 3600 != 0 ) {
                 size -= PROGRAM_SEPARATION;                
             }
 
@@ -308,7 +313,7 @@
 							  GDK_BUTTON_PRESS_MASK | GDK_BUTTON_RELEASE_MASK);
             
             /* create EpgGridItem */
-            EpgGridItem *epg_grid_item = g_new(EpgGridItem, 1);
+            EpgGridItem *epg_grid_item = g_new0(EpgGridItem, 1);
             epg_grid_item->proginfo  = proginfo;
             epg_grid_item->event_box = event_box;
             epg_grid_item->object    = mmyth_epg_grid_widget;
@@ -336,7 +341,7 @@
                               GDK_BUTTON_PRESS_MASK | GDK_BUTTON_RELEASE_MASK);
 
             /* create EpgGridItem */
-            EpgGridItem *epg_grid_item = g_new(EpgGridItem, 1);
+            EpgGridItem *epg_grid_item = g_new0(EpgGridItem, 1);
             epg_grid_item->proginfo  = NULL;
             epg_grid_item->event_box = event_box;
             epg_grid_item->object    = mmyth_epg_grid_widget;
@@ -378,9 +383,9 @@
 	/* hours title line */
     GtkWidget *epg_programs_hours_hbox = gtk_hbox_new (TRUE, 0); 
 
-    if (localtime_r((time_t *)&private->current_start_time, &hour_tm) == NULL) {
+    if (localtime_r((time_t *)&private->current_start_time->tv_sec, &hour_tm) == NULL) {
         g_warning ("localtime_r error in mmyth_epg_grid_widget!\n");
-        return NULL;
+        return;
     }    
 
     if (hour_tm.tm_min>30) {
diff -r beb4c07dfb65 -r c88244670b08 maemo-ui/src/mmyth_main.c
--- a/maemo-ui/src/mmyth_main.c	Fri Jan 05 15:06:09 2007 +0000
+++ b/maemo-ui/src/mmyth_main.c	Fri Jan 05 19:27:27 2007 +0000
@@ -9,7 +9,6 @@
 #endif
 
 #include <gmyth/gmyth_recorder.h>
-#include <gmyth/gmyth_settings.h>
 #include <gmyth/gmyth_context.h>
 #include <gmyth/gmyth_tvchain.h>
 #include <gmyth/gmyth_remote_util.h>
diff -r beb4c07dfb65 -r c88244670b08 maemo-ui/src/mmyth_recordui.c
--- a/maemo-ui/src/mmyth_recordui.c	Fri Jan 05 15:06:09 2007 +0000
+++ b/maemo-ui/src/mmyth_recordui.c	Fri Jan 05 19:27:27 2007 +0000
@@ -1,5 +1,5 @@
-#include<gtk/gtk.h>
-#include<glib.h>
+#include <gtk/gtk.h>
+#include <glib.h>
 #include <sys/types.h>
 #include <sys/stat.h>
 #include <unistd.h>
@@ -11,8 +11,8 @@
 #include "mmyth_recordui.h"
 
 /* GMyth library includes */
-#include "gmyth_scheduler.h"
-#include "gmyth_util.h"
+#include <gmyth/gmyth_scheduler.h>
+#include <gmyth/gmyth_util.h>
 
 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);
diff -r beb4c07dfb65 -r c88244670b08 maemo-ui/src/mmyth_recordui.h
--- a/maemo-ui/src/mmyth_recordui.h	Fri Jan 05 15:06:09 2007 +0000
+++ b/maemo-ui/src/mmyth_recordui.h	Fri Jan 05 19:27:27 2007 +0000
@@ -1,7 +1,8 @@
 #ifndef MMYTH_RECORD_H_
 #define MMYTH_RECORD_H_
 
-#include "gmyth_scheduler.h"
+#include <gmyth/gmyth_scheduler.h>
+#include <gmyth/gmyth_backendinfo.h>
 
 typedef struct _MMythRecordUI
 {
@@ -32,10 +33,12 @@
 	GtkTreeStore *rec_tree_store;
 	
 	GMythScheduler *scheduler;
+
+	GMythBackendInfo* backend_info;
 	
 } MMythRecordUI;
 
-MMythRecordUI* mmyth_recordui_new(void);
+MMythRecordUI* mmyth_recordui_new( GMythBackendInfo* backend_info );
 void mmyth_recordui_free (MMythRecordUI *recordui);
 
 void mmyth_recordui_delete_selected (GtkButton *button, MMythRecordUI *recordui);
diff -r beb4c07dfb65 -r c88244670b08 maemo-ui/src/mmyth_schedulerui.c
--- a/maemo-ui/src/mmyth_schedulerui.c	Fri Jan 05 15:06:09 2007 +0000
+++ b/maemo-ui/src/mmyth_schedulerui.c	Fri Jan 05 19:27:27 2007 +0000
@@ -13,9 +13,9 @@
 #include "mmyth_schedulerui.h"
 
 /* GMyth library includes */
-#include "gmyth_scheduler.h"
-#include "gmyth_common.h"
-#include "gmyth_epg.h"
+#include <gmyth/gmyth_scheduler.h>
+#include <gmyth/gmyth_common.h>
+#include <gmyth/gmyth_epg.h>
 
 static void run_calendar_dialog (GtkButton *button, gpointer data);
 
@@ -27,7 +27,7 @@
 static void add_title_field (MMythSchedulerUI *scheduler_ui, GtkWidget *vbox);
 
 MMythSchedulerUI*
-mmyth_schedulerui_new (void)
+mmyth_schedulerui_new ( GMythBackendInfo *backend_info )
 {
 	GtkWidget *scrolledwindow;	
 	GtkWidget *viewport;	
@@ -37,6 +37,8 @@
 	GtkWidget *label;
 
 	MMythSchedulerUI *scheduler_ui = g_new0 (MMythSchedulerUI, 1);
+
+	scheduler_ui->backend_info = backend_info;
 	
 	scrolledwindow = gtk_scrolled_window_new (NULL, NULL);
 	scheduler_ui->main_widget = scrolledwindow;
@@ -127,83 +129,85 @@
 gboolean
 mmyth_schedulerui_save (MMythSchedulerUI *scheduler_ui)
 {
-    GMythScheduler *scheduler;
+	GMythScheduler *scheduler;
 	ScheduleInfo *schedule_info;
 	GMythChannelInfo *channel_info;
 
 	GList *clist;
 	gint index, duration;
-    gint frequency;
-    struct tm start_tm;
-	
+	gint frequency;
+	struct tm start_tm;
+
 	schedule_info = g_new0(ScheduleInfo, 1);
-    if(schedule_info == NULL) {
-        g_warning ("Error allocating memory");
-        return FALSE;
-    }
-        
-    clist = scheduler_ui->channel_list;
-      
-    index = gtk_combo_box_get_active(GTK_COMBO_BOX(scheduler_ui->channel_combobox));
+	if(schedule_info == NULL) {
+		g_warning ("Error allocating memory");
+		return FALSE;
+	}
 
-    if (clist != NULL)
+	clist = scheduler_ui->channel_list;
+
+	index = gtk_combo_box_get_active(GTK_COMBO_BOX(scheduler_ui->channel_combobox));
+
+	if (clist != NULL)
 		clist = g_list_nth(clist, index);
-    
-    if (clist) {
-	    g_debug ("[%s] New schedule: %d", __FUNCTION__, index);
-    } else {
-	    g_warning ("[%s] Error when adding new schedule", __FUNCTION__);
-	    return FALSE;
-    }
-    
-    channel_info = clist->data;
-    
-    /* initialize schedule_info */
-    schedule_info->channel_id = channel_info->channel_ID;
-    
-    start_tm.tm_hour = 
-        (int)gtk_spin_button_get_value(GTK_SPIN_BUTTON(scheduler_ui->hour_spinbutton));
+
+	if (clist) {
+		g_debug ("[%s] New schedule: %d", __FUNCTION__, index);
+	} else {
+		g_warning ("[%s] Error when adding new schedule", __FUNCTION__);
+		return FALSE;
+	}
+
+	channel_info = clist->data;
+
+	/* initialize schedule_info */
+	schedule_info->channel_id = channel_info->channel_ID;
+
+	start_tm.tm_hour = 
+		(int)gtk_spin_button_get_value(GTK_SPIN_BUTTON(scheduler_ui->hour_spinbutton));
 	start_tm.tm_min = 
-        (int)gtk_spin_button_get_value(GTK_SPIN_BUTTON(scheduler_ui->min_spinbutton));
-    start_tm.tm_sec = 0;
+		(int)gtk_spin_button_get_value(GTK_SPIN_BUTTON(scheduler_ui->min_spinbutton));
+	start_tm.tm_sec = 0;
 
 	start_tm.tm_mday = (gint)scheduler_ui->day_temp;
 	start_tm.tm_mon =  (gint)scheduler_ui->month_temp;
 	start_tm.tm_year = (gint)scheduler_ui->year_temp - 1900; //years since 1900
+	GTimeVal* time_val_local = g_new0( GTimeVal, 1 );
+	time_val_local->tv_sec = timelocal(&start_tm);
 
-    schedule_info->start_time = timelocal(&start_tm);
-    if (schedule_info->start_time == (time_t)(-1)) {
-        g_warning ("timelocal error!\n");
-        return FALSE;
-    }
+	schedule_info->start_time = time_val_local;
+	if ( NULL == schedule_info->start_time ) {
+		g_warning ("timelocal error!\n");
+		return FALSE;
+	}
 
 	duration = (gint) gtk_spin_button_get_value(
-                        GTK_SPIN_BUTTON(scheduler_ui->duration_spinbutton));
-    schedule_info->end_time = schedule_info->start_time + (duration*60);
+			GTK_SPIN_BUTTON(scheduler_ui->duration_spinbutton));
+	schedule_info->end_time = schedule_info->start_time + (duration*60);
 
-    /* TODO: frequency is not implemented yet */
+	/* TODO: frequency is not implemented yet */
 	frequency = gtk_combo_box_get_active(GTK_COMBO_BOX(scheduler_ui->freq_combobox));
 
 	schedule_info->title = g_string_new("");
 	g_string_printf(schedule_info->title, "%s", 
-                    gtk_entry_get_text(GTK_ENTRY(scheduler_ui->title_entry)));
-	
-    /* FIXME: Architecture change to reuse the scheduler created in the recordui! */
-    scheduler = gmyth_scheduler_new ();
+			gtk_entry_get_text(GTK_ENTRY(scheduler_ui->title_entry)));
 
-    gmyth_scheduler_connect(scheduler, scheduler->backend_info);
+	/* FIXME: Architecture change to reuse the scheduler created in the recordui! */
+	scheduler = gmyth_scheduler_new ();
 
-    /* FIXME: set record_id = -1 to add a new schedule */
-    schedule_info->record_id = -1;
-    gmyth_scheduler_add_schedule (scheduler, schedule_info);
+	gmyth_scheduler_connect(scheduler, scheduler->backend_info);
 
-    gmyth_scheduler_disconnect(scheduler);
-    
-    /* free allocated memory */
-    g_object_unref (scheduler);
-    g_free (schedule_info);
-	
-    return TRUE;
+	/* FIXME: set record_id = -1 to add a new schedule */
+	schedule_info->record_id = -1;
+	gmyth_scheduler_add_schedule (scheduler, schedule_info);
+
+	gmyth_scheduler_disconnect(scheduler);
+
+	/* free allocated memory */
+	g_object_unref (scheduler);
+	g_free (schedule_info);
+
+	return TRUE;
 } 
 
 static GtkWidget*
@@ -235,7 +239,7 @@
 	gtk_box_pack_start (GTK_BOX (hbox), combobox, FALSE, FALSE, 0);
 			
 	GMythEPG *mmyth_epg = gmyth_epg_new ();
-	if (!gmyth_epg_connect (mmyth_epg, mmyth_epg->sqlquery->backend_info)) {
+	if (!gmyth_epg_connect (mmyth_epg, scheduler_ui->backend_info)) {
 		// FIXME: Without this list the scheduler UI should not be shown!
 		g_warning ("[%s] Error when getting list of channels", __FUNCTION__);
 	}
@@ -271,7 +275,7 @@
 
     if (localtime_r((time_t *)&real_time, &sched_time) == NULL) {
         g_warning ("localtime_r error in mmyth_epg_grid_view!\n");
-        return NULL;
+        return;
     }
  
 	if (sched_time.tm_min>30){
diff -r beb4c07dfb65 -r c88244670b08 maemo-ui/src/mmyth_schedulerui.h
--- a/maemo-ui/src/mmyth_schedulerui.h	Fri Jan 05 15:06:09 2007 +0000
+++ b/maemo-ui/src/mmyth_schedulerui.h	Fri Jan 05 19:27:27 2007 +0000
@@ -3,6 +3,8 @@
 
 #include <glib.h>
 
+#include <gmyth/gmyth_backendinfo.h>
+
 typedef struct _MMythSchedulerUI {
 	
 	GList *channel_list;
@@ -21,6 +23,9 @@
 	GtkWidget *calendar;
 	
 	guint year_temp, month_temp, day_temp;
+
+	GMythBackendInfo* backend_info;
+
 } MMythSchedulerUI;
 
 typedef struct {
@@ -35,7 +40,7 @@
 
 } ScheduleEntry;
 
-MMythSchedulerUI* mmyth_schedulerui_new (void);
+MMythSchedulerUI* mmyth_schedulerui_new ( GMythBackendInfo* backend_info );
 
 gboolean mmyth_schedulerui_save (MMythSchedulerUI *scheduler_ui);
 
diff -r beb4c07dfb65 -r c88244670b08 maemo-ui/src/mmyth_tvplayer.c
--- a/maemo-ui/src/mmyth_tvplayer.c	Fri Jan 05 15:06:09 2007 +0000
+++ b/maemo-ui/src/mmyth_tvplayer.c	Fri Jan 05 19:27:27 2007 +0000
@@ -353,11 +353,11 @@
  * @return TRUE if successfull, FALSE if any error happens.
  */
 gboolean
-mmyth_tvplayer_record_setup (MMythTVPlayer *tvplayer, gchar *filename)
+mmyth_tvplayer_record_setup (MMythTVPlayer *tvplayer, const gchar *filename)
 {
 	// FIXME: we should receive the uri instead of filename
-	gchar *hostname = gmyth_backend_info_get_hostname (tvplayer->backend_info);
-	gint port = gmyth_backend_info_get_port(tvplayer->backend_info);
+	const gchar *hostname = gmyth_backend_info_get_hostname (tvplayer->backend_info);
+	const gint port = gmyth_backend_info_get_port(tvplayer->backend_info);
 	
 	GString *fullpath = g_string_new ("myth://");
 	g_string_append_printf (fullpath, "%s:%d/%s", hostname, port, filename);
@@ -382,7 +382,6 @@
 mmyth_tvplayer_livetv_setup (MMythTVPlayer *tvplayer)
 {
 	gboolean res = TRUE;
-	gchar *hostname;
 
 	tvplayer->livetv = gmyth_livetv_new ();
 
diff -r beb4c07dfb65 -r c88244670b08 maemo-ui/src/mmyth_tvplayer.h
--- a/maemo-ui/src/mmyth_tvplayer.h	Fri Jan 05 15:06:09 2007 +0000
+++ b/maemo-ui/src/mmyth_tvplayer.h	Fri Jan 05 19:27:27 2007 +0000
@@ -111,7 +111,7 @@
 gboolean       mmyth_tvplayer_is_playing   (MMythTVPlayer *tvplayer);
 
 gboolean       mmyth_tvplayer_record_setup (MMythTVPlayer *tvplayer, 
-                                            gchar *filename);
+                                            const gchar *filename);
 gboolean       mmyth_tvplayer_livetv_setup (MMythTVPlayer *tvplayer);
 
 G_END_DECLS
diff -r beb4c07dfb65 -r c88244670b08 maemo-ui/src/mmyth_ui.c
--- a/maemo-ui/src/mmyth_ui.c	Fri Jan 05 15:06:09 2007 +0000
+++ b/maemo-ui/src/mmyth_ui.c	Fri Jan 05 19:27:27 2007 +0000
@@ -495,10 +495,10 @@
 	if (!(mmyth_ui->schedule_uicommon))
 		mmyth_ui->schedule_uicommon = create_schedule_view(mmyth_ui);
 		
-	schedule_list = g_list_nth(schedule_list, atoi(gtk_tree_path_to_string(path)));
+	schedule_list = g_list_nth(schedule_list, g_ascii_strtoull( gtk_tree_path_to_string(path), NULL, 10 ));
 	schedule_info = (ScheduleInfo*) schedule_list->data;
 
-    printf("\nstarttime: %ld", schedule_info->start_time); fflush(stdout);		
+    printf("\nstarttime: %ld", schedule_info->start_time->tv_sec); fflush(stdout);
 }
 
 static MMythUiCommon *
@@ -509,7 +509,7 @@
     
     g_debug ("Creating Schedule UI Common");
 
-	mmyth_ui->mmyth_schedulerui = mmyth_schedulerui_new ();
+	mmyth_ui->mmyth_schedulerui = mmyth_schedulerui_new ( mmyth_ui->backend_info );
 	if (mmyth_ui->mmyth_schedulerui == NULL) {
 		g_warning ("[%s] Error while creating scheduler ui", __FUNCTION__);
 		return NULL;
@@ -700,7 +700,7 @@
     
    	g_debug ("Creating Record UI Common");
    	
-	mmyth_ui->mmyth_recordui = mmyth_recordui_new ();
+	mmyth_ui->mmyth_recordui = mmyth_recordui_new ( mmyth_ui->backend_info );
 
 	// FIXME: Change MMythRecordUI to a GtkWidget child and avoid this call!
     gtk_widget_show_all (mmyth_ui->mmyth_recordui->scrolled_window);
diff -r beb4c07dfb65 -r c88244670b08 maemo-ui/src/mmyth_uicommon.c
--- a/maemo-ui/src/mmyth_uicommon.c	Fri Jan 05 15:06:09 2007 +0000
+++ b/maemo-ui/src/mmyth_uicommon.c	Fri Jan 05 19:27:27 2007 +0000
@@ -18,7 +18,7 @@
 
     if (localtime_r((time_t *)&real_time, &sched_time) == NULL) {
         g_error ("localtime_r error in mmyth_epg_grid_view!\n");
-        return NULL;
+        return;
     }
 
 	g_string_printf(time_showed, "%d:%02d:%02d", 
diff -r beb4c07dfb65 -r c88244670b08 maemo-ui/src/mmyth_uisettings.c
--- a/maemo-ui/src/mmyth_uisettings.c	Fri Jan 05 15:06:09 2007 +0000
+++ b/maemo-ui/src/mmyth_uisettings.c	Fri Jan 05 19:27:27 2007 +0000
@@ -138,7 +138,6 @@
 static void
 settings_dialog_update_data (void) 
 {
-	GString *tmp_entry_text;
 	//GMythSettings *backend_info = gmyth_context_get_settings();
 	
 	if (!backend_info) {