maemo-ui/src/mmyth_recordui.c
branchtrunk
changeset 763 4ac83e3152c0
parent 244 c88244670b08
     1.1 --- a/maemo-ui/src/mmyth_recordui.c	Fri Jan 05 19:27:27 2007 +0000
     1.2 +++ b/maemo-ui/src/mmyth_recordui.c	Sat Jun 30 00:27:43 2007 +0100
     1.3 @@ -10,334 +10,424 @@
     1.4  #include "mmyth_ui.h"
     1.5  #include "mmyth_recordui.h"
     1.6  
     1.7 -/* GMyth library includes */
     1.8 +/*
     1.9 + * GMyth library includes 
    1.10 + */
    1.11  #include <gmyth/gmyth_scheduler.h>
    1.12  #include <gmyth/gmyth_util.h>
    1.13  
    1.14  enum {
    1.15 -	START_DATE_COLUMN = 0,
    1.16 -	TITLE_COLUMN,
    1.17 -	CHAN_ID_COLUMN,
    1.18 -	END_TIME_COLUMN,
    1.19 -	RECORD_ID_COLUMN,
    1.20 -	BASENAME_COLUMN,
    1.21 -	N_COLUMNS
    1.22 +    START_DATE_COLUMN = 0,
    1.23 +    TITLE_COLUMN,
    1.24 +    CHAN_ID_COLUMN,
    1.25 +    END_TIME_COLUMN,
    1.26 +    RECORD_ID_COLUMN,
    1.27 +    BASENAME_COLUMN,
    1.28 +    N_COLUMNS
    1.29  };
    1.30  
    1.31  gboolean
    1.32 -mmyth_recordui_reload_all (MMythRecordUI *recordui)
    1.33 +mmyth_recordui_reload_all(MMythRecordUI * recordui)
    1.34  {
    1.35 -	gboolean res = FALSE;
    1.36 +    gboolean        res = FALSE;
    1.37  
    1.38 -	res = mmyth_recordui_reload_schedule (recordui);
    1.39 -		
    1.40 -	res = res & mmyth_recordui_reload_record (recordui);
    1.41 -	
    1.42 -	
    1.43 -	if (!res)
    1.44 -		g_warning ("[%s] Error while reloading schedule and recording content", __FUNCTION__);
    1.45 -		
    1.46 -	return res;
    1.47 +    res = mmyth_recordui_reload_schedule(recordui);
    1.48 +
    1.49 +    res = res & mmyth_recordui_reload_record(recordui);
    1.50 +
    1.51 +
    1.52 +    if (!res)
    1.53 +        g_warning
    1.54 +            ("[%s] Error while reloading schedule and recording content",
    1.55 +             __FUNCTION__);
    1.56 +
    1.57 +    return res;
    1.58  }
    1.59  
    1.60  gboolean
    1.61 -mmyth_recordui_reload_schedule (MMythRecordUI *recordui)
    1.62 +mmyth_recordui_reload_schedule(MMythRecordUI * recordui)
    1.63  {
    1.64 -	gint new_row = 0;
    1.65 -	ScheduleInfo *schedule_info;
    1.66 -	GList *schedule_list;
    1.67 -	GtkTreeIter iter;
    1.68 -     gchar *start_date_time = NULL;
    1.69 -    gchar *end_date_time = NULL;
    1.70 -    GString *str_aux = g_string_new("");
    1.71 -	gint res;
    1.72 +    gint            new_row = 0;
    1.73 +    ScheduleInfo   *schedule_info;
    1.74 +    GList          *schedule_list;
    1.75 +    GtkTreeIter     iter;
    1.76 +    gchar          *start_date_time = NULL;
    1.77 +    gchar          *end_date_time = NULL;
    1.78 +    GString        *str_aux = g_string_new("");
    1.79 +    gint            res;
    1.80  
    1.81 -	gtk_tree_store_clear(recordui->sch_tree_store);	
    1.82 +    gtk_tree_store_clear(recordui->sch_tree_store);
    1.83  
    1.84 -	res = gmyth_scheduler_get_schedule_list(recordui->scheduler, &(schedule_list));
    1.85 -	if (res < 0) {
    1.86 -		g_warning ("[%s] Retrieved NULL list of scheduled data from database", 
    1.87 -                   __FUNCTION__);
    1.88 -		return FALSE;
    1.89 -	}
    1.90 +    res =
    1.91 +        gmyth_scheduler_get_schedule_list(recordui->scheduler,
    1.92 +                                          &(schedule_list));
    1.93 +    if (res < 0) {
    1.94 +        g_warning
    1.95 +            ("[%s] Retrieved NULL list of scheduled data from database",
    1.96 +             __FUNCTION__);
    1.97 +        return FALSE;
    1.98 +    }
    1.99  
   1.100 -	for ( ; schedule_list; schedule_list = schedule_list->next) {
   1.101 - 	  	schedule_info = (ScheduleInfo*) schedule_list->data;
   1.102 +    for (; schedule_list; schedule_list = schedule_list->next) {
   1.103 +        schedule_info = (ScheduleInfo *) schedule_list->data;
   1.104  
   1.105 -  	  	gtk_tree_store_insert(recordui->sch_tree_store, &iter, NULL, new_row++);
   1.106 -        
   1.107 -        start_date_time = gmyth_util_time_to_string_from_time_val(schedule_info->start_time);
   1.108 -        end_date_time = gmyth_util_time_to_string_from_time_val(schedule_info->end_time);
   1.109 -        
   1.110 +        gtk_tree_store_insert(recordui->sch_tree_store, &iter, NULL,
   1.111 +                              new_row++);
   1.112 +
   1.113 +        start_date_time =
   1.114 +            gmyth_util_time_to_string_from_time_val(schedule_info->
   1.115 +                                                    start_time);
   1.116 +        end_date_time =
   1.117 +            gmyth_util_time_to_string_from_time_val(schedule_info->
   1.118 +                                                    end_time);
   1.119 +
   1.120          g_string_printf(str_aux, "%d", schedule_info->channel_id);
   1.121 -        
   1.122 -	  	gtk_tree_store_set(recordui->sch_tree_store, &iter,
   1.123 -	  		START_DATE_COLUMN, start_date_time, 
   1.124 -	  		TITLE_COLUMN, schedule_info->title->str,
   1.125 -	  		CHAN_ID_COLUMN, str_aux->str,
   1.126 -	  		END_TIME_COLUMN, end_date_time, //It doesn't appear
   1.127 -	  		RECORD_ID_COLUMN, schedule_info->record_id, 
   1.128 -			-1); //the last line is a hidden item to be used in searching tasks
   1.129 - 	}
   1.130 -  	
   1.131 -  	g_debug ("[%s] %d lines added to schedule list UI", __FUNCTION__, new_row);
   1.132 -  	
   1.133 -    /* free allocated memory */
   1.134 -    if(!start_date_time)
   1.135 +
   1.136 +        gtk_tree_store_set(recordui->sch_tree_store, &iter, START_DATE_COLUMN, start_date_time, TITLE_COLUMN, schedule_info->title->str, CHAN_ID_COLUMN, str_aux->str, END_TIME_COLUMN, end_date_time,  // It 
   1.137 +                                                                                                                                                                                                        // doesn't 
   1.138 +                                                                                                                                                                                                        // appear
   1.139 +                           RECORD_ID_COLUMN, schedule_info->record_id, -1); // the 
   1.140 +                                                                            // last 
   1.141 +                                                                            // line 
   1.142 +                                                                            // is 
   1.143 +                                                                            // a 
   1.144 +                                                                            // hidden 
   1.145 +                                                                            // item 
   1.146 +                                                                            // to 
   1.147 +                                                                            // be 
   1.148 +                                                                            // used 
   1.149 +                                                                            // in 
   1.150 +                                                                            // searching 
   1.151 +                                                                            // tasks
   1.152 +    }
   1.153 +
   1.154 +    g_debug("[%s] %d lines added to schedule list UI", __FUNCTION__,
   1.155 +            new_row);
   1.156 +
   1.157 +    /*
   1.158 +     * free allocated memory 
   1.159 +     */
   1.160 +    if (!start_date_time)
   1.161          g_free(start_date_time);
   1.162 -    if(!end_date_time)
   1.163 +    if (!end_date_time)
   1.164          g_free(end_date_time);
   1.165 -    g_string_free(str_aux,  FALSE);
   1.166 -    
   1.167 -  	return TRUE;
   1.168 +    g_string_free(str_aux, FALSE);
   1.169 +
   1.170 +    return TRUE;
   1.171  }
   1.172  
   1.173  gboolean
   1.174 -mmyth_recordui_reload_record (MMythRecordUI *recordui)
   1.175 +mmyth_recordui_reload_record(MMythRecordUI * recordui)
   1.176  {
   1.177 -	gint new_row = 0;
   1.178 -	RecordedInfo *recorded_info;
   1.179 -	GList *record_list = NULL;
   1.180 -	GtkTreeIter iter;
   1.181 -    gchar *start_date_time = NULL;
   1.182 -    gchar *end_date_time = NULL;
   1.183 -    GString *str_aux = g_string_new("");
   1.184 -	gint res;
   1.185 -	
   1.186 -	gtk_tree_store_clear(recordui->rec_tree_store);		
   1.187 +    gint            new_row = 0;
   1.188 +    RecordedInfo   *recorded_info;
   1.189 +    GList          *record_list = NULL;
   1.190 +    GtkTreeIter     iter;
   1.191 +    gchar          *start_date_time = NULL;
   1.192 +    gchar          *end_date_time = NULL;
   1.193 +    GString        *str_aux = g_string_new("");
   1.194 +    gint            res;
   1.195  
   1.196 -	res = gmyth_scheduler_get_recorded_list(recordui->scheduler, &record_list);
   1.197 -	if (res < 0) {
   1.198 -		g_warning ("[%s] Retrieved NULL list of recorded data from database", __FUNCTION__);
   1.199 -		return FALSE;
   1.200 -	}
   1.201 -	
   1.202 -	for (; record_list; record_list = record_list->next) {
   1.203 - 	  	recorded_info = (RecordedInfo*) record_list->data;
   1.204 +    gtk_tree_store_clear(recordui->rec_tree_store);
   1.205  
   1.206 -  	  	gtk_tree_store_insert(recordui->rec_tree_store, &iter, NULL, new_row++);
   1.207 +    res =
   1.208 +        gmyth_scheduler_get_recorded_list(recordui->scheduler,
   1.209 +                                          &record_list);
   1.210 +    if (res < 0) {
   1.211 +        g_warning
   1.212 +            ("[%s] Retrieved NULL list of recorded data from database",
   1.213 +             __FUNCTION__);
   1.214 +        return FALSE;
   1.215 +    }
   1.216  
   1.217 -        start_date_time = gmyth_util_time_to_string_from_time_val(recorded_info->start_time);
   1.218 -        end_date_time = gmyth_util_time_to_string_from_time_val(recorded_info->end_time);
   1.219 +    for (; record_list; record_list = record_list->next) {
   1.220 +        recorded_info = (RecordedInfo *) record_list->data;
   1.221 +
   1.222 +        gtk_tree_store_insert(recordui->rec_tree_store, &iter, NULL,
   1.223 +                              new_row++);
   1.224 +
   1.225 +        start_date_time =
   1.226 +            gmyth_util_time_to_string_from_time_val(recorded_info->
   1.227 +                                                    start_time);
   1.228 +        end_date_time =
   1.229 +            gmyth_util_time_to_string_from_time_val(recorded_info->
   1.230 +                                                    end_time);
   1.231  
   1.232          g_string_printf(str_aux, "%d", recorded_info->channel_id);
   1.233  
   1.234 -	  	gtk_tree_store_set(recordui->rec_tree_store, &iter,
   1.235 -	  		START_DATE_COLUMN, start_date_time, 
   1.236 -	  		TITLE_COLUMN, recorded_info->title->str,
   1.237 -	  		CHAN_ID_COLUMN, str_aux->str,
   1.238 -	  		END_TIME_COLUMN, end_date_time, //It doesn't appear
   1.239 -	  		RECORD_ID_COLUMN, recorded_info->record_id,
   1.240 -			BASENAME_COLUMN, recorded_info->basename->str, -1); 
   1.241 -            //the last line is a hidden item to be used in searching tasks	  		
   1.242 -  	}
   1.243 -  	
   1.244 -  	g_debug ("[%s] %d lines added to record list UI", __FUNCTION__, new_row);
   1.245 +        gtk_tree_store_set(recordui->rec_tree_store, &iter, START_DATE_COLUMN, start_date_time, TITLE_COLUMN, recorded_info->title->str, CHAN_ID_COLUMN, str_aux->str, END_TIME_COLUMN, end_date_time,  // It 
   1.246 +                                                                                                                                                                                                        // doesn't 
   1.247 +                                                                                                                                                                                                        // appear
   1.248 +                           RECORD_ID_COLUMN, recorded_info->record_id,
   1.249 +                           BASENAME_COLUMN, recorded_info->basename->str,
   1.250 +                           -1);
   1.251 +        // the last line is a hidden item to be used in searching tasks 
   1.252 +    }
   1.253  
   1.254 -     /* free allocated memory */
   1.255 -    if( NULL != start_date_time)
   1.256 +    g_debug("[%s] %d lines added to record list UI", __FUNCTION__,
   1.257 +            new_row);
   1.258 +
   1.259 +    /*
   1.260 +     * free allocated memory 
   1.261 +     */
   1.262 +    if (NULL != start_date_time)
   1.263          g_free(start_date_time);
   1.264 -    if( NULL != end_date_time)
   1.265 +    if (NULL != end_date_time)
   1.266          g_free(end_date_time);
   1.267 -    g_string_free(str_aux,  FALSE);
   1.268 -  	  	
   1.269 -  	return TRUE;
   1.270 +    g_string_free(str_aux, FALSE);
   1.271 +
   1.272 +    return TRUE;
   1.273  }
   1.274  
   1.275  
   1.276 -MMythRecordUI*
   1.277 -mmyth_recordui_new( GMythBackendInfo* backend_info )
   1.278 +MMythRecordUI  *
   1.279 +mmyth_recordui_new(GMythBackendInfo * backend_info)
   1.280  {
   1.281 -	MMythRecordUI *recordui = g_new0 (MMythRecordUI, 1);
   1.282 +    MMythRecordUI  *recordui = g_new0(MMythRecordUI, 1);
   1.283  
   1.284 -	g_return_val_if_fail( backend_info != NULL, NULL );
   1.285 +    g_return_val_if_fail(backend_info != NULL, NULL);
   1.286  
   1.287 -	recordui->backend_info = backend_info;
   1.288 -	
   1.289 -	recordui->scrolled_window = gtk_scrolled_window_new (NULL, NULL);
   1.290 -	gtk_scrolled_window_set_policy (GTK_SCROLLED_WINDOW (recordui->scrolled_window),
   1.291 -			GTK_POLICY_AUTOMATIC, GTK_POLICY_AUTOMATIC);
   1.292 +    recordui->backend_info = backend_info;
   1.293  
   1.294 -	recordui->viewport = gtk_viewport_new (NULL, NULL);
   1.295 -  	gtk_container_add (GTK_CONTAINER (recordui->scrolled_window), recordui->viewport);
   1.296 +    recordui->scrolled_window = gtk_scrolled_window_new(NULL, NULL);
   1.297 +    gtk_scrolled_window_set_policy(GTK_SCROLLED_WINDOW
   1.298 +                                   (recordui->scrolled_window),
   1.299 +                                   GTK_POLICY_AUTOMATIC,
   1.300 +                                   GTK_POLICY_AUTOMATIC);
   1.301  
   1.302 -  	recordui->notebook = gtk_notebook_new ();
   1.303 -  	gtk_container_set_border_width (GTK_CONTAINER (recordui->notebook), 1);
   1.304 -  	gtk_notebook_set_scrollable (GTK_NOTEBOOK (recordui->notebook), TRUE);
   1.305 -  	gtk_notebook_popup_enable (GTK_NOTEBOOK (recordui->notebook));
   1.306 -  	gtk_container_add (GTK_CONTAINER (recordui->viewport), recordui->notebook);
   1.307 -  	gtk_notebook_popup_disable(GTK_NOTEBOOK (recordui->notebook));
   1.308 +    recordui->viewport = gtk_viewport_new(NULL, NULL);
   1.309 +    gtk_container_add(GTK_CONTAINER(recordui->scrolled_window),
   1.310 +                      recordui->viewport);
   1.311  
   1.312 -	/* Schedule tab */
   1.313 -  	recordui->sch_scrolled_window = gtk_scrolled_window_new (NULL, NULL);
   1.314 -  	gtk_container_add (GTK_CONTAINER (recordui->notebook), recordui->sch_scrolled_window);
   1.315 -  	gtk_scrolled_window_set_policy (GTK_SCROLLED_WINDOW (recordui->sch_scrolled_window), 
   1.316 -                                    GTK_POLICY_AUTOMATIC, GTK_POLICY_AUTOMATIC);
   1.317 -  	gtk_scrolled_window_set_shadow_type (GTK_SCROLLED_WINDOW (recordui->sch_scrolled_window), 
   1.318 -                                         GTK_SHADOW_IN);
   1.319 +    recordui->notebook = gtk_notebook_new();
   1.320 +    gtk_container_set_border_width(GTK_CONTAINER(recordui->notebook), 1);
   1.321 +    gtk_notebook_set_scrollable(GTK_NOTEBOOK(recordui->notebook), TRUE);
   1.322 +    gtk_notebook_popup_enable(GTK_NOTEBOOK(recordui->notebook));
   1.323 +    gtk_container_add(GTK_CONTAINER(recordui->viewport),
   1.324 +                      recordui->notebook);
   1.325 +    gtk_notebook_popup_disable(GTK_NOTEBOOK(recordui->notebook));
   1.326  
   1.327 -    /* The basename column in the sched_tree_store is not being used*/
   1.328 -  	recordui->sch_tree_store = 
   1.329 -        gtk_tree_store_new (N_COLUMNS, G_TYPE_STRING, G_TYPE_STRING,
   1.330 -  		                    G_TYPE_STRING, G_TYPE_STRING, G_TYPE_INT, G_TYPE_STRING );
   1.331 -    
   1.332 -  	recordui->sch_treeview = 
   1.333 -        gtk_tree_view_new_with_model(GTK_TREE_MODEL(recordui->sch_tree_store));
   1.334 -  	gtk_container_add (GTK_CONTAINER (recordui->sch_scrolled_window), 
   1.335 -                       recordui->sch_treeview);
   1.336 -  	recordui->sch_renderer = gtk_cell_renderer_text_new();
   1.337 -  	//g_object_set(G_OBJECT(renderer1), "foreground", "green", "background", "black", NULL);
   1.338 -  	recordui->sch_column1 = 
   1.339 -        gtk_tree_view_column_new_with_attributes("Start time", recordui->sch_renderer, 
   1.340 -                                                 "text", START_DATE_COLUMN, NULL);
   1.341 -  	gtk_tree_view_append_column(GTK_TREE_VIEW(recordui->sch_treeview), 
   1.342 -                                recordui->sch_column1); 
   1.343 -  	recordui->sch_column2 = 
   1.344 -        gtk_tree_view_column_new_with_attributes("Title", recordui->sch_renderer, 
   1.345 -                                                 "text", TITLE_COLUMN, NULL);
   1.346 -  	gtk_tree_view_append_column(GTK_TREE_VIEW(recordui->sch_treeview), 
   1.347 +    /*
   1.348 +     * Schedule tab 
   1.349 +     */
   1.350 +    recordui->sch_scrolled_window = gtk_scrolled_window_new(NULL, NULL);
   1.351 +    gtk_container_add(GTK_CONTAINER(recordui->notebook),
   1.352 +                      recordui->sch_scrolled_window);
   1.353 +    gtk_scrolled_window_set_policy(GTK_SCROLLED_WINDOW
   1.354 +                                   (recordui->sch_scrolled_window),
   1.355 +                                   GTK_POLICY_AUTOMATIC,
   1.356 +                                   GTK_POLICY_AUTOMATIC);
   1.357 +    gtk_scrolled_window_set_shadow_type(GTK_SCROLLED_WINDOW
   1.358 +                                        (recordui->sch_scrolled_window),
   1.359 +                                        GTK_SHADOW_IN);
   1.360 +
   1.361 +    /*
   1.362 +     * The basename column in the sched_tree_store is not being used
   1.363 +     */
   1.364 +    recordui->sch_tree_store =
   1.365 +        gtk_tree_store_new(N_COLUMNS, G_TYPE_STRING, G_TYPE_STRING,
   1.366 +                           G_TYPE_STRING, G_TYPE_STRING, G_TYPE_INT,
   1.367 +                           G_TYPE_STRING);
   1.368 +
   1.369 +    recordui->sch_treeview =
   1.370 +        gtk_tree_view_new_with_model(GTK_TREE_MODEL
   1.371 +                                     (recordui->sch_tree_store));
   1.372 +    gtk_container_add(GTK_CONTAINER(recordui->sch_scrolled_window),
   1.373 +                      recordui->sch_treeview);
   1.374 +    recordui->sch_renderer = gtk_cell_renderer_text_new();
   1.375 +    // g_object_set(G_OBJECT(renderer1), "foreground", "green",
   1.376 +    // "background", "black", NULL);
   1.377 +    recordui->sch_column1 =
   1.378 +        gtk_tree_view_column_new_with_attributes("Start time",
   1.379 +                                                 recordui->sch_renderer,
   1.380 +                                                 "text", START_DATE_COLUMN,
   1.381 +                                                 NULL);
   1.382 +    gtk_tree_view_append_column(GTK_TREE_VIEW(recordui->sch_treeview),
   1.383 +                                recordui->sch_column1);
   1.384 +    recordui->sch_column2 =
   1.385 +        gtk_tree_view_column_new_with_attributes("Title",
   1.386 +                                                 recordui->sch_renderer,
   1.387 +                                                 "text", TITLE_COLUMN,
   1.388 +                                                 NULL);
   1.389 +    gtk_tree_view_append_column(GTK_TREE_VIEW(recordui->sch_treeview),
   1.390                                  recordui->sch_column2);
   1.391 -  	recordui->sch_column3 = 
   1.392 -        gtk_tree_view_column_new_with_attributes("Channel", recordui->sch_renderer, 
   1.393 -                                                 "text", CHAN_ID_COLUMN, NULL);
   1.394 -  	gtk_tree_view_append_column(GTK_TREE_VIEW(recordui->sch_treeview), 
   1.395 +    recordui->sch_column3 =
   1.396 +        gtk_tree_view_column_new_with_attributes("Channel",
   1.397 +                                                 recordui->sch_renderer,
   1.398 +                                                 "text", CHAN_ID_COLUMN,
   1.399 +                                                 NULL);
   1.400 +    gtk_tree_view_append_column(GTK_TREE_VIEW(recordui->sch_treeview),
   1.401                                  recordui->sch_column3);
   1.402 -  	gtk_tree_view_column_set_resizable(recordui->sch_column1, TRUE);
   1.403 -  	gtk_tree_view_column_set_resizable(recordui->sch_column2, TRUE);
   1.404 -  	gtk_tree_view_column_set_resizable(recordui->sch_column3, TRUE);
   1.405 -  	gtk_tree_view_column_set_reorderable(recordui->sch_column1, TRUE);
   1.406 -  	gtk_tree_view_column_set_reorderable(recordui->sch_column2, TRUE);
   1.407 -  	gtk_tree_view_column_set_reorderable(recordui->sch_column3, TRUE);  	  	  	  	
   1.408 -//  recordui->sch_column4 = 
   1.409 -//      gtk_tree_view_column_new_with_attributes("", recordui->sch_renderer, "text", END_TIME_COLUMN, NULL);
   1.410 -//  gtk_tree_view_append_column(GTK_TREE_VIEW(recordui->sch_treeview), 
   1.411 -//                                            recordui->sch_column4);
   1.412 +    gtk_tree_view_column_set_resizable(recordui->sch_column1, TRUE);
   1.413 +    gtk_tree_view_column_set_resizable(recordui->sch_column2, TRUE);
   1.414 +    gtk_tree_view_column_set_resizable(recordui->sch_column3, TRUE);
   1.415 +    gtk_tree_view_column_set_reorderable(recordui->sch_column1, TRUE);
   1.416 +    gtk_tree_view_column_set_reorderable(recordui->sch_column2, TRUE);
   1.417 +    gtk_tree_view_column_set_reorderable(recordui->sch_column3, TRUE);
   1.418 +    // recordui->sch_column4 = 
   1.419 +    // gtk_tree_view_column_new_with_attributes("",
   1.420 +    // recordui->sch_renderer, "text", END_TIME_COLUMN, NULL);
   1.421 +    // gtk_tree_view_append_column(GTK_TREE_VIEW(recordui->sch_treeview), 
   1.422 +    // recordui->sch_column4);
   1.423  
   1.424 -  	recordui->sch_label = gtk_label_new (("Schedule"));
   1.425 -  	gtk_notebook_set_tab_label (GTK_NOTEBOOK (recordui->notebook), 
   1.426 -                                gtk_notebook_get_nth_page (
   1.427 -                                               GTK_NOTEBOOK (recordui->notebook), 0), 
   1.428 -                                recordui->sch_label);
   1.429 +    recordui->sch_label = gtk_label_new(("Schedule"));
   1.430 +    gtk_notebook_set_tab_label(GTK_NOTEBOOK(recordui->notebook),
   1.431 +                               gtk_notebook_get_nth_page(GTK_NOTEBOOK
   1.432 +                                                         (recordui->
   1.433 +                                                          notebook), 0),
   1.434 +                               recordui->sch_label);
   1.435  
   1.436 -  // Record items  tab
   1.437 -  //   g_object_set(G_OBJECT(renderer2), "foreground", "blue", NULL);
   1.438 -  	recordui->rec_scrolled_window = gtk_scrolled_window_new (NULL, NULL);
   1.439 -  	gtk_container_add (GTK_CONTAINER (recordui->notebook), 
   1.440 -                       recordui->rec_scrolled_window);
   1.441 -  	gtk_scrolled_window_set_policy (GTK_SCROLLED_WINDOW (recordui->rec_scrolled_window), 
   1.442 -                                    GTK_POLICY_AUTOMATIC, GTK_POLICY_AUTOMATIC);
   1.443 -  	gtk_scrolled_window_set_shadow_type (GTK_SCROLLED_WINDOW (recordui->rec_scrolled_window), 
   1.444 -                                         GTK_SHADOW_IN);
   1.445 +    // Record items tab
   1.446 +    // g_object_set(G_OBJECT(renderer2), "foreground", "blue", NULL);
   1.447 +    recordui->rec_scrolled_window = gtk_scrolled_window_new(NULL, NULL);
   1.448 +    gtk_container_add(GTK_CONTAINER(recordui->notebook),
   1.449 +                      recordui->rec_scrolled_window);
   1.450 +    gtk_scrolled_window_set_policy(GTK_SCROLLED_WINDOW
   1.451 +                                   (recordui->rec_scrolled_window),
   1.452 +                                   GTK_POLICY_AUTOMATIC,
   1.453 +                                   GTK_POLICY_AUTOMATIC);
   1.454 +    gtk_scrolled_window_set_shadow_type(GTK_SCROLLED_WINDOW
   1.455 +                                        (recordui->rec_scrolled_window),
   1.456 +                                        GTK_SHADOW_IN);
   1.457  
   1.458 -  	recordui->rec_tree_store = 
   1.459 -        gtk_tree_store_new (N_COLUMNS, G_TYPE_STRING, G_TYPE_STRING,
   1.460 -                	        G_TYPE_STRING, G_TYPE_STRING, G_TYPE_INT, G_TYPE_STRING);
   1.461 -  	recordui->rec_treeview = 
   1.462 -        gtk_tree_view_new_with_model(GTK_TREE_MODEL(recordui->rec_tree_store));
   1.463 -  	gtk_container_add (GTK_CONTAINER (recordui->rec_scrolled_window), 
   1.464 -                       recordui->rec_treeview);
   1.465 -  	recordui->rec_renderer = gtk_cell_renderer_text_new();
   1.466 -  	//g_object_set(G_OBJECT(renderer1), "foreground", "green", "background", "black", NULL);
   1.467 - 
   1.468 -  	recordui->rec_column1 = 
   1.469 -        gtk_tree_view_column_new_with_attributes("Start time", recordui->rec_renderer, 
   1.470 -                                                 "text", START_DATE_COLUMN, NULL);
   1.471 -  	gtk_tree_view_append_column(GTK_TREE_VIEW(recordui->rec_treeview), 
   1.472 +    recordui->rec_tree_store =
   1.473 +        gtk_tree_store_new(N_COLUMNS, G_TYPE_STRING, G_TYPE_STRING,
   1.474 +                           G_TYPE_STRING, G_TYPE_STRING, G_TYPE_INT,
   1.475 +                           G_TYPE_STRING);
   1.476 +    recordui->rec_treeview =
   1.477 +        gtk_tree_view_new_with_model(GTK_TREE_MODEL
   1.478 +                                     (recordui->rec_tree_store));
   1.479 +    gtk_container_add(GTK_CONTAINER(recordui->rec_scrolled_window),
   1.480 +                      recordui->rec_treeview);
   1.481 +    recordui->rec_renderer = gtk_cell_renderer_text_new();
   1.482 +    // g_object_set(G_OBJECT(renderer1), "foreground", "green",
   1.483 +    // "background", "black", NULL);
   1.484 +
   1.485 +    recordui->rec_column1 =
   1.486 +        gtk_tree_view_column_new_with_attributes("Start time",
   1.487 +                                                 recordui->rec_renderer,
   1.488 +                                                 "text", START_DATE_COLUMN,
   1.489 +                                                 NULL);
   1.490 +    gtk_tree_view_append_column(GTK_TREE_VIEW(recordui->rec_treeview),
   1.491                                  recordui->rec_column1);
   1.492 -  	recordui->rec_column2 = 
   1.493 -        gtk_tree_view_column_new_with_attributes("Title", recordui->rec_renderer, 
   1.494 -                                                 "text", TITLE_COLUMN, NULL);
   1.495 -  	gtk_tree_view_append_column(GTK_TREE_VIEW(recordui->rec_treeview), 
   1.496 +    recordui->rec_column2 =
   1.497 +        gtk_tree_view_column_new_with_attributes("Title",
   1.498 +                                                 recordui->rec_renderer,
   1.499 +                                                 "text", TITLE_COLUMN,
   1.500 +                                                 NULL);
   1.501 +    gtk_tree_view_append_column(GTK_TREE_VIEW(recordui->rec_treeview),
   1.502                                  recordui->rec_column2);
   1.503 -  	recordui->rec_column3 = 
   1.504 -        gtk_tree_view_column_new_with_attributes("Channel", recordui->rec_renderer, 
   1.505 -                                                 "text", CHAN_ID_COLUMN, NULL);
   1.506 -  	gtk_tree_view_append_column(GTK_TREE_VIEW(recordui->rec_treeview), 
   1.507 +    recordui->rec_column3 =
   1.508 +        gtk_tree_view_column_new_with_attributes("Channel",
   1.509 +                                                 recordui->rec_renderer,
   1.510 +                                                 "text", CHAN_ID_COLUMN,
   1.511 +                                                 NULL);
   1.512 +    gtk_tree_view_append_column(GTK_TREE_VIEW(recordui->rec_treeview),
   1.513                                  recordui->rec_column3);
   1.514 -  	gtk_tree_view_column_set_resizable(recordui->rec_column1, TRUE);
   1.515 -  	gtk_tree_view_column_set_resizable(recordui->rec_column2, TRUE);
   1.516 -  	gtk_tree_view_column_set_resizable(recordui->rec_column3, TRUE);
   1.517 -  	gtk_tree_view_column_set_reorderable(recordui->rec_column1, TRUE);
   1.518 -  	gtk_tree_view_column_set_reorderable(recordui->rec_column2, TRUE);
   1.519 -  	gtk_tree_view_column_set_reorderable(recordui->rec_column3, TRUE);
   1.520 -//  recordui->rec_column4 = gtk_tree_view_column_new_with_attributes("", recordui->rec_renderer, "text", END_TIME_COLUMN, NULL);
   1.521 -//  gtk_tree_view_append_column(GTK_TREE_VIEW(recordui->rec_treeview), recordui->rec_column4);
   1.522 +    gtk_tree_view_column_set_resizable(recordui->rec_column1, TRUE);
   1.523 +    gtk_tree_view_column_set_resizable(recordui->rec_column2, TRUE);
   1.524 +    gtk_tree_view_column_set_resizable(recordui->rec_column3, TRUE);
   1.525 +    gtk_tree_view_column_set_reorderable(recordui->rec_column1, TRUE);
   1.526 +    gtk_tree_view_column_set_reorderable(recordui->rec_column2, TRUE);
   1.527 +    gtk_tree_view_column_set_reorderable(recordui->rec_column3, TRUE);
   1.528 +    // recordui->rec_column4 =
   1.529 +    // gtk_tree_view_column_new_with_attributes("",
   1.530 +    // recordui->rec_renderer, "text", END_TIME_COLUMN, NULL);
   1.531 +    // gtk_tree_view_append_column(GTK_TREE_VIEW(recordui->rec_treeview),
   1.532 +    // recordui->rec_column4);
   1.533  
   1.534 -  	recordui->rec_label = gtk_label_new (("Recorded"));
   1.535 -  	gtk_notebook_set_tab_label (GTK_NOTEBOOK (recordui->notebook), 
   1.536 -                                gtk_notebook_get_nth_page (
   1.537 -                                      GTK_NOTEBOOK (recordui->notebook), 1), 
   1.538 -                                recordui->rec_label);
   1.539 -  
   1.540 -  	// Gets the mmyth scheduler manager
   1.541 -  	recordui->scheduler = gmyth_scheduler_new ( backend_info );
   1.542 -    
   1.543 -    /* init connection to the backend */
   1.544 -    gmyth_scheduler_connect (recordui->scheduler, recordui->scheduler->backend_info);
   1.545 -    
   1.546 -	return recordui;
   1.547 +    recordui->rec_label = gtk_label_new(("Recorded"));
   1.548 +    gtk_notebook_set_tab_label(GTK_NOTEBOOK(recordui->notebook),
   1.549 +                               gtk_notebook_get_nth_page(GTK_NOTEBOOK
   1.550 +                                                         (recordui->
   1.551 +                                                          notebook), 1),
   1.552 +                               recordui->rec_label);
   1.553 +
   1.554 +    // Gets the mmyth scheduler manager
   1.555 +    recordui->scheduler = gmyth_scheduler_new(backend_info);
   1.556 +
   1.557 +    /*
   1.558 +     * init connection to the backend 
   1.559 +     */
   1.560 +    gmyth_scheduler_connect(recordui->scheduler,
   1.561 +                            recordui->scheduler->backend_info);
   1.562 +
   1.563 +    return recordui;
   1.564  }
   1.565  
   1.566  void
   1.567 -mmyth_recordui_free (MMythRecordUI *recordui)
   1.568 +mmyth_recordui_free(MMythRecordUI * recordui)
   1.569  {
   1.570 -	// FIXME: Release memory here!
   1.571 -    /* close connection to the backend */
   1.572 -    gmyth_scheduler_disconnect (recordui->scheduler);
   1.573 +    // FIXME: Release memory here!
   1.574 +    /*
   1.575 +     * close connection to the backend 
   1.576 +     */
   1.577 +    gmyth_scheduler_disconnect(recordui->scheduler);
   1.578  }
   1.579  
   1.580  void
   1.581 -mmyth_recordui_delete_selected (GtkButton *button, MMythRecordUI *recordui)
   1.582 +mmyth_recordui_delete_selected(GtkButton * button,
   1.583 +                               MMythRecordUI * recordui)
   1.584  {
   1.585 -	GtkTreeSelection *selection;
   1.586 -	GtkTreeModel *list_store;
   1.587 -	GtkTreeIter iter;
   1.588 -	int index;
   1.589 -	int curr_page = 0;
   1.590 -	
   1.591 -	curr_page = gtk_notebook_get_current_page(GTK_NOTEBOOK(recordui->notebook));
   1.592 +    GtkTreeSelection *selection;
   1.593 +    GtkTreeModel   *list_store;
   1.594 +    GtkTreeIter     iter;
   1.595 +    int             index;
   1.596 +    int             curr_page = 0;
   1.597  
   1.598 -	if ( curr_page == 0) {
   1.599 -		selection = gtk_tree_view_get_selection(GTK_TREE_VIEW(recordui->sch_treeview));
   1.600 -		if (selection != NULL) {
   1.601 -			gtk_tree_selection_get_selected(selection, &list_store, &iter);
   1.602 -			gtk_tree_model_get(list_store, &iter, RECORD_ID_COLUMN, &index, -1);
   1.603 -			gmyth_scheduler_delete_schedule(recordui->scheduler, index);
   1.604 -			mmyth_recordui_reload_schedule (recordui);
   1.605 -			return;
   1.606 -		}
   1.607 -			
   1.608 -	} else if (curr_page == 1) {
   1.609 -		selection = gtk_tree_view_get_selection(GTK_TREE_VIEW(recordui->rec_treeview));
   1.610 -		if (selection != NULL) {
   1.611 -			gtk_tree_selection_get_selected(selection, &list_store, &iter);
   1.612 -			gtk_tree_model_get(list_store, &iter, RECORD_ID_COLUMN, &index, -1);
   1.613 -			gmyth_scheduler_delete_recorded(recordui->scheduler, index);
   1.614 -			mmyth_recordui_reload_record (recordui);
   1.615 -			return;
   1.616 -		}
   1.617 -	}
   1.618 -	
   1.619 -	g_warning ("[%s] None element was removed from the list", __FUNCTION__);
   1.620 +    curr_page =
   1.621 +        gtk_notebook_get_current_page(GTK_NOTEBOOK(recordui->notebook));
   1.622 +
   1.623 +    if (curr_page == 0) {
   1.624 +        selection =
   1.625 +            gtk_tree_view_get_selection(GTK_TREE_VIEW
   1.626 +                                        (recordui->sch_treeview));
   1.627 +        if (selection != NULL) {
   1.628 +            gtk_tree_selection_get_selected(selection, &list_store, &iter);
   1.629 +            gtk_tree_model_get(list_store, &iter, RECORD_ID_COLUMN, &index,
   1.630 +                               -1);
   1.631 +            gmyth_scheduler_delete_schedule(recordui->scheduler, index);
   1.632 +            mmyth_recordui_reload_schedule(recordui);
   1.633 +            return;
   1.634 +        }
   1.635 +
   1.636 +    } else if (curr_page == 1) {
   1.637 +        selection =
   1.638 +            gtk_tree_view_get_selection(GTK_TREE_VIEW
   1.639 +                                        (recordui->rec_treeview));
   1.640 +        if (selection != NULL) {
   1.641 +            gtk_tree_selection_get_selected(selection, &list_store, &iter);
   1.642 +            gtk_tree_model_get(list_store, &iter, RECORD_ID_COLUMN, &index,
   1.643 +                               -1);
   1.644 +            gmyth_scheduler_delete_recorded(recordui->scheduler, index);
   1.645 +            mmyth_recordui_reload_record(recordui);
   1.646 +            return;
   1.647 +        }
   1.648 +    }
   1.649 +
   1.650 +    g_warning("[%s] None element was removed from the list", __FUNCTION__);
   1.651  }
   1.652  
   1.653 -/* FIXME: change this function name, it is returning the 
   1.654 - * basename_column that represents the nuv filename of 
   1.655 - * the recorded content */
   1.656 -gchar*
   1.657 -mmyth_recordui_get_selected_recorded (MMythRecordUI *recordui)
   1.658 +/*
   1.659 + * FIXME: change this function name, it is returning the basename_column
   1.660 + * that represents the nuv filename of the recorded content 
   1.661 + */
   1.662 +gchar          *
   1.663 +mmyth_recordui_get_selected_recorded(MMythRecordUI * recordui)
   1.664  {
   1.665 -	GtkTreeSelection *selection = NULL;
   1.666 -	GtkTreeModel *list_store = NULL;
   1.667 -	GtkTreeIter iter;
   1.668 -	gchar *path = NULL;
   1.669 +    GtkTreeSelection *selection = NULL;
   1.670 +    GtkTreeModel   *list_store = NULL;
   1.671 +    GtkTreeIter     iter;
   1.672 +    gchar          *path = NULL;
   1.673  
   1.674 -	/* returning nuv filename, basename_column */
   1.675 -	selection = gtk_tree_view_get_selection(GTK_TREE_VIEW(recordui->rec_treeview));
   1.676 -	if (gtk_tree_selection_get_selected (selection, &list_store, &iter)) {
   1.677 -		gtk_tree_model_get(list_store, &iter, BASENAME_COLUMN, &path, -1);
   1.678 -	}
   1.679 -
   1.680 -	// FIXME: MOVE THIS TO OTHER PLACE
   1.681 -	return path;
   1.682 +    /*
   1.683 +     * returning nuv filename, basename_column 
   1.684 +     */
   1.685 +    selection =
   1.686 +        gtk_tree_view_get_selection(GTK_TREE_VIEW(recordui->rec_treeview));
   1.687 +    if (gtk_tree_selection_get_selected(selection, &list_store, &iter)) {
   1.688 +        gtk_tree_model_get(list_store, &iter, BASENAME_COLUMN, &path, -1);
   1.689 +    }
   1.690 +    // FIXME: MOVE THIS TO OTHER PLACE
   1.691 +    return path;
   1.692  }