maemo-ui/src/mmyth_ui.c
branchtrunk
changeset 787 e42706ada231
parent 268 91eb7e03b1b1
     1.1 --- a/maemo-ui/src/mmyth_ui.c	Fri Jan 12 21:26:30 2007 +0000
     1.2 +++ b/maemo-ui/src/mmyth_ui.c	Sat Jul 14 17:20:54 2007 +0100
     1.3 @@ -18,272 +18,302 @@
     1.4  #include "mmyth_epg_grid_view.h"
     1.5  #include "mmyth_tvplayer.h"
     1.6  
     1.7 -/* GMyth library includes */
     1.8 +/*
     1.9 + * GMyth library includes 
    1.10 + */
    1.11  
    1.12  #ifndef MAEMO_PLATFORM
    1.13 -static gint button_press_handler (GtkWidget *widget, GdkEvent *event);
    1.14 +static gint     button_press_handler(GtkWidget * widget, GdkEvent * event);
    1.15  #endif
    1.16  
    1.17 -static MMythUiCommon *create_main_view (MMythUi * mmyth_ui);
    1.18 -static MMythUiCommon *create_video_view (MMythUi * mmyth_ui);
    1.19 -static MMythUiCommon *create_epg_grid_view (MMythUi * mmyth_ui);
    1.20 -static MMythUiCommon *create_record_view (MMythUi * mmyth_ui);
    1.21 -static MMythUiCommon *create_schedule_view (MMythUi * mmyth_ui);
    1.22 +static MMythUiCommon *create_main_view(MMythUi * mmyth_ui);
    1.23 +static MMythUiCommon *create_video_view(MMythUi * mmyth_ui);
    1.24 +static MMythUiCommon *create_epg_grid_view(MMythUi * mmyth_ui);
    1.25 +static MMythUiCommon *create_record_view(MMythUi * mmyth_ui);
    1.26 +static MMythUiCommon *create_schedule_view(MMythUi * mmyth_ui);
    1.27  
    1.28 -static void cb_video_close_button (GtkButton * button, gpointer user_data);
    1.29 -static void cb_record_button (GtkButton * button, gpointer user_data);
    1.30 -static void cb_menu_item_settings (GtkMenuItem *menuitem, gpointer user_data);
    1.31 +static void     cb_video_close_button(GtkButton * button,
    1.32 +                                      gpointer user_data);
    1.33 +static void     cb_record_button(GtkButton * button, gpointer user_data);
    1.34 +static void     cb_menu_item_settings(GtkMenuItem * menuitem,
    1.35 +                                      gpointer user_data);
    1.36  
    1.37 -/* main box from button box separator*/
    1.38 +/*
    1.39 + * main box from button box separator
    1.40 + */
    1.41  static GtkWidget *main_vseparator = NULL;
    1.42  
    1.43 -GdkPixbuf *icon_sports, *icon_news, 
    1.44 -          *icon_movies, *icon_shows, *icon_default;
    1.45 +GdkPixbuf      *icon_sports,
    1.46 +               *icon_news,
    1.47 +               *icon_movies,
    1.48 +               *icon_shows,
    1.49 +               *icon_default;
    1.50  
    1.51  #ifndef MAEMO_PLATFORM
    1.52 -/* FIXME: */
    1.53 +/*
    1.54 + * FIXME: 
    1.55 + */
    1.56  static MMythUi *popup_mmyth_ui;
    1.57  #endif
    1.58  
    1.59 -MMythUi *
    1.60 -mmyth_ui_initialize (
    1.61 +MMythUi        *
    1.62 +mmyth_ui_initialize(
    1.63  #ifdef MAEMO_PLATFORM
    1.64 -	HildonProgram *program,
    1.65 +                       HildonProgram * program,
    1.66  #endif
    1.67 -	GtkWidget * main_window)
    1.68 +                       GtkWidget * main_window)
    1.69  {
    1.70 -    MMythUi *mmyth_ui;
    1.71 +    MMythUi        *mmyth_ui;
    1.72  
    1.73 -    mmyth_ui = g_new0 (MMythUi, 1);
    1.74 +    mmyth_ui = g_new0(MMythUi, 1);
    1.75  
    1.76 -    mmyth_ui->backend_info = gmyth_backend_info_new_full( "localhost", "mythtv", "mythtv", "mythconverg", 6543 );
    1.77 +    mmyth_ui->backend_info =
    1.78 +        gmyth_backend_info_new_full("localhost", "mythtv", "mythtv",
    1.79 +                                    "mythconverg", 6543);
    1.80  
    1.81 -    mmyth_ui->main_window = main_window;    
    1.82 +    mmyth_ui->main_window = main_window;
    1.83      mmyth_ui->videow = NULL;
    1.84      mmyth_ui->mmyth_recordui = NULL;
    1.85      mmyth_ui->mmyth_schedulerui = NULL;
    1.86 -	
    1.87 -    /* Horizontal box that divides the view into control and video area */
    1.88 -    mmyth_ui->main_hbox = gtk_hbox_new (FALSE, 0);
    1.89 -    gtk_widget_show (mmyth_ui->main_hbox);
    1.90 -    g_object_ref (mmyth_ui->main_hbox);
    1.91  
    1.92 -    main_bg_color.red   = 65000;
    1.93 +    /*
    1.94 +     * Horizontal box that divides the view into control and video area 
    1.95 +     */
    1.96 +    mmyth_ui->main_hbox = gtk_hbox_new(FALSE, 0);
    1.97 +    gtk_widget_show(mmyth_ui->main_hbox);
    1.98 +    g_object_ref(mmyth_ui->main_hbox);
    1.99 +
   1.100 +    main_bg_color.red = 65000;
   1.101      main_bg_color.green = 65000;
   1.102 -    main_bg_color.blue  = 65000;
   1.103 -    
   1.104 -    
   1.105 +    main_bg_color.blue = 65000;
   1.106 +
   1.107 +
   1.108  #ifndef MAEMO_PLATFORM
   1.109 -    /* Popup menu */
   1.110 +    /*
   1.111 +     * Popup menu 
   1.112 +     */
   1.113      popup_mmyth_ui = mmyth_ui;
   1.114 -    g_signal_connect (G_OBJECT (mmyth_ui->main_hbox), "event",
   1.115 -                      G_CALLBACK (button_press_handler),
   1.116 -                      G_OBJECT (mmyth_ui->main_hbox));    
   1.117 +    g_signal_connect(G_OBJECT(mmyth_ui->main_hbox), "event",
   1.118 +                     G_CALLBACK(button_press_handler),
   1.119 +                     G_OBJECT(mmyth_ui->main_hbox));
   1.120  
   1.121 -#else // #ifdef MAEMO
   1.122 +#else                           // #ifdef MAEMO
   1.123  
   1.124      mmyth_ui->main_menu = GTK_MENU(gtk_menu_new());
   1.125      hildon_program_set_common_menu(program, mmyth_ui->main_menu);
   1.126  
   1.127      mmyth_ui->menu_setup = gtk_menu_item_new_with_label("Setup");
   1.128 -    gtk_widget_set_size_request (GTK_WIDGET (mmyth_ui->menu_setup), 150, 40);
   1.129 +    gtk_widget_set_size_request(GTK_WIDGET(mmyth_ui->menu_setup), 150, 40);
   1.130      gtk_menu_append(mmyth_ui->main_menu, mmyth_ui->menu_setup);
   1.131  
   1.132 -    g_signal_connect(G_OBJECT(mmyth_ui->menu_setup), "activate", G_CALLBACK(cb_menu_item_settings), mmyth_ui);
   1.133 +    g_signal_connect(G_OBJECT(mmyth_ui->menu_setup), "activate",
   1.134 +                     G_CALLBACK(cb_menu_item_settings), mmyth_ui);
   1.135  
   1.136 -    gtk_widget_show_all (GTK_WIDGET (mmyth_ui->main_menu));
   1.137 +    gtk_widget_show_all(GTK_WIDGET(mmyth_ui->main_menu));
   1.138  #endif
   1.139 -    
   1.140 +
   1.141      // Main widget is mmyth_ui->main_hbox
   1.142 -    mmyth_ui->main_uicommon       = create_main_view (mmyth_ui);
   1.143 +    mmyth_ui->main_uicommon = create_main_view(mmyth_ui);
   1.144  
   1.145 -    gtk_container_add (GTK_CONTAINER (mmyth_ui->main_window),
   1.146 -                       mmyth_ui->main_hbox);
   1.147 +    gtk_container_add(GTK_CONTAINER(mmyth_ui->main_window),
   1.148 +                      mmyth_ui->main_hbox);
   1.149  
   1.150 -    mmyth_ui_set_widget (mmyth_ui, mmyth_ui->main_uicommon);
   1.151 +    mmyth_ui_set_widget(mmyth_ui, mmyth_ui->main_uicommon);
   1.152  
   1.153      return mmyth_ui;
   1.154  }
   1.155  
   1.156  void
   1.157 -mmyth_ui_finalize (MMythUi * mmyth_ui)
   1.158 +mmyth_ui_finalize(MMythUi * mmyth_ui)
   1.159  {
   1.160      if (mmyth_ui != NULL) {
   1.161 -    	if (mmyth_ui->main_uicommon)
   1.162 -	    	mmyth_uicommon_free (mmyth_ui->main_uicommon);
   1.163 -    	if (mmyth_ui->video_uicommon)
   1.164 -		    mmyth_uicommon_free (mmyth_ui->video_uicommon);
   1.165 -		if (mmyth_ui->epg_grid_uicommon)
   1.166 -		    mmyth_uicommon_free (mmyth_ui->epg_grid_uicommon);
   1.167 -		if (mmyth_ui->record_uicommon)
   1.168 -		    mmyth_uicommon_free (mmyth_ui->record_uicommon);	    
   1.169 -		if (mmyth_ui->schedule_uicommon)
   1.170 -		    mmyth_uicommon_free (mmyth_ui->schedule_uicommon);
   1.171 +        if (mmyth_ui->main_uicommon)
   1.172 +            mmyth_uicommon_free(mmyth_ui->main_uicommon);
   1.173 +        if (mmyth_ui->video_uicommon)
   1.174 +            mmyth_uicommon_free(mmyth_ui->video_uicommon);
   1.175 +        if (mmyth_ui->epg_grid_uicommon)
   1.176 +            mmyth_uicommon_free(mmyth_ui->epg_grid_uicommon);
   1.177 +        if (mmyth_ui->record_uicommon)
   1.178 +            mmyth_uicommon_free(mmyth_ui->record_uicommon);
   1.179 +        if (mmyth_ui->schedule_uicommon)
   1.180 +            mmyth_uicommon_free(mmyth_ui->schedule_uicommon);
   1.181  
   1.182 -	    g_free (mmyth_ui);
   1.183 +        g_free(mmyth_ui);
   1.184      }
   1.185  }
   1.186  
   1.187  void
   1.188 -mmyth_ui_set_widget (MMythUi * mmyth_ui, MMythUiCommon * new_uicommon)
   1.189 +mmyth_ui_set_widget(MMythUi * mmyth_ui, MMythUiCommon * new_uicommon)
   1.190  {
   1.191 -	if (new_uicommon == NULL) {
   1.192 -		g_warning ("MMythUI setting a NULL UI_Common as current display\n");
   1.193 -		return;
   1.194 -	}
   1.195 -		
   1.196 +    if (new_uicommon == NULL) {
   1.197 +        g_warning("MMythUI setting a NULL UI_Common as current display\n");
   1.198 +        return;
   1.199 +    }
   1.200 +
   1.201      if (mmyth_ui->current_uicommon) {
   1.202          if (mmyth_ui->current_uicommon == mmyth_ui->video_uicommon) {
   1.203 -            gtk_widget_hide (mmyth_ui->current_uicommon->main_widget);
   1.204 -            gtk_widget_hide (mmyth_ui->videow);
   1.205 -        }
   1.206 -        else {
   1.207 -            gtk_container_remove (GTK_CONTAINER (mmyth_ui->main_hbox),
   1.208 -                                  mmyth_ui->current_uicommon->main_widget);
   1.209 +            gtk_widget_hide(mmyth_ui->current_uicommon->main_widget);
   1.210 +            gtk_widget_hide(mmyth_ui->videow);
   1.211 +        } else {
   1.212 +            gtk_container_remove(GTK_CONTAINER(mmyth_ui->main_hbox),
   1.213 +                                 mmyth_ui->current_uicommon->main_widget);
   1.214          }
   1.215  
   1.216 -        gtk_container_remove (GTK_CONTAINER (mmyth_ui->main_hbox),
   1.217 -                              mmyth_ui->current_uicommon->event_box);
   1.218 -        gtk_container_remove (GTK_CONTAINER (mmyth_ui->main_hbox),
   1.219 -                              main_vseparator);        
   1.220 +        gtk_container_remove(GTK_CONTAINER(mmyth_ui->main_hbox),
   1.221 +                             mmyth_ui->current_uicommon->event_box);
   1.222 +        gtk_container_remove(GTK_CONTAINER(mmyth_ui->main_hbox),
   1.223 +                             main_vseparator);
   1.224  
   1.225      }
   1.226  
   1.227      if (new_uicommon->main_widget == mmyth_ui->video_alignment) {
   1.228 -        //gst_player_video_show (GST_PLAYER_VIDEO(mmyth_ui->videow));
   1.229 -        gtk_widget_show (mmyth_ui->video_alignment);
   1.230 -        gtk_widget_show (mmyth_ui->videow);
   1.231 -    }
   1.232 -    else {
   1.233 -        /* FIXME: Fst call is NULL when mmyth_player_init fails */
   1.234 -        if(mmyth_ui->video_alignment != NULL)
   1.235 -            gtk_widget_hide (mmyth_ui->video_alignment);
   1.236 -        /* FIXME: Fst call is NULL when mmyth_player_init fails */
   1.237 -        if(mmyth_ui->videow != NULL)
   1.238 -            gtk_widget_hide (mmyth_ui->videow);
   1.239 +        // gst_player_video_show (GST_PLAYER_VIDEO(mmyth_ui->videow));
   1.240 +        gtk_widget_show(mmyth_ui->video_alignment);
   1.241 +        gtk_widget_show(mmyth_ui->videow);
   1.242 +    } else {
   1.243 +        /*
   1.244 +         * FIXME: Fst call is NULL when mmyth_player_init fails 
   1.245 +         */
   1.246 +        if (mmyth_ui->video_alignment != NULL)
   1.247 +            gtk_widget_hide(mmyth_ui->video_alignment);
   1.248 +        /*
   1.249 +         * FIXME: Fst call is NULL when mmyth_player_init fails 
   1.250 +         */
   1.251 +        if (mmyth_ui->videow != NULL)
   1.252 +            gtk_widget_hide(mmyth_ui->videow);
   1.253  
   1.254 -        gtk_box_pack_start (GTK_BOX (mmyth_ui->main_hbox),
   1.255 -                            new_uicommon->main_widget, TRUE, TRUE, 0);
   1.256 +        gtk_box_pack_start(GTK_BOX(mmyth_ui->main_hbox),
   1.257 +                           new_uicommon->main_widget, TRUE, TRUE, 0);
   1.258      }
   1.259  
   1.260 -    if(main_vseparator == NULL) {
   1.261 -        /* FIXME: should free this variable*/
   1.262 +    if (main_vseparator == NULL) {
   1.263 +        /*
   1.264 +         * FIXME: should free this variable
   1.265 +         */
   1.266          main_vseparator = gtk_vseparator_new();
   1.267 -        g_object_ref (main_vseparator);                   
   1.268 -    }  
   1.269 -    gtk_box_pack_start (GTK_BOX (mmyth_ui->main_hbox),
   1.270 -                        main_vseparator, FALSE, FALSE, 0);    
   1.271 -    gtk_widget_show (main_vseparator);
   1.272 +        g_object_ref(main_vseparator);
   1.273 +    }
   1.274 +    gtk_box_pack_start(GTK_BOX(mmyth_ui->main_hbox),
   1.275 +                       main_vseparator, FALSE, FALSE, 0);
   1.276 +    gtk_widget_show(main_vseparator);
   1.277  
   1.278 -    gtk_box_pack_end (GTK_BOX (mmyth_ui->main_hbox), new_uicommon->event_box, FALSE,
   1.279 -                      FALSE, 0);         
   1.280 +    gtk_box_pack_end(GTK_BOX(mmyth_ui->main_hbox), new_uicommon->event_box,
   1.281 +                     FALSE, FALSE, 0);
   1.282  
   1.283      mmyth_ui->current_uicommon = new_uicommon;
   1.284  
   1.285  }
   1.286  
   1.287 -/* The close callback is the same for all windows*/
   1.288 +/*
   1.289 + * The close callback is the same for all windows
   1.290 + */
   1.291  static void
   1.292 -cb_not_impl_button (GtkButton * button, gpointer user_data)
   1.293 +cb_not_impl_button(GtkButton * button, gpointer user_data)
   1.294  {
   1.295 -    MMythUi *mmyth_ui = (MMythUi *) user_data;
   1.296 +    MMythUi        *mmyth_ui = (MMythUi *) user_data;
   1.297  
   1.298 -    GtkWidget *msg_dialog = gtk_message_dialog_new (
   1.299 -                                           GTK_WINDOW(mmyth_ui->main_window),
   1.300 -                                           GTK_DIALOG_MODAL |
   1.301 -                                           GTK_DIALOG_DESTROY_WITH_PARENT,
   1.302 -                                           GTK_MESSAGE_INFO,
   1.303 -                                           GTK_BUTTONS_OK,
   1.304 -                                           "Feature not implemented");
   1.305 -    gtk_widget_set_size_request (msg_dialog, 350, 120);
   1.306 +    GtkWidget      *msg_dialog =
   1.307 +        gtk_message_dialog_new(GTK_WINDOW(mmyth_ui->main_window),
   1.308 +                               GTK_DIALOG_MODAL |
   1.309 +                               GTK_DIALOG_DESTROY_WITH_PARENT,
   1.310 +                               GTK_MESSAGE_INFO,
   1.311 +                               GTK_BUTTONS_OK,
   1.312 +                               "Feature not implemented");
   1.313 +    gtk_widget_set_size_request(msg_dialog, 350, 120);
   1.314  
   1.315 -    gtk_dialog_run (GTK_DIALOG (msg_dialog));
   1.316 +    gtk_dialog_run(GTK_DIALOG(msg_dialog));
   1.317  
   1.318 -    gtk_widget_destroy(GTK_WIDGET(msg_dialog)); 
   1.319 +    gtk_widget_destroy(GTK_WIDGET(msg_dialog));
   1.320  }
   1.321  
   1.322  /******************************************************************************
   1.323   *                        POPUP MENU WIDGET METHODS                           *
   1.324   *****************************************************************************/
   1.325  
   1.326 -static void 
   1.327 -cb_menu_item_settings (GtkMenuItem *menuitem,
   1.328 -                            gpointer user_data)
   1.329 +static void
   1.330 +cb_menu_item_settings(GtkMenuItem * menuitem, gpointer user_data)
   1.331  {
   1.332 -    
   1.333 -    MMythUi *mmyth_ui = (MMythUi*) user_data;
   1.334 -   
   1.335 -    if (mmyth_uisettings_run (GTK_WINDOW (mmyth_ui->main_window))) {
   1.336 -    	// If user changes the settings, we restart the context
   1.337 -    	g_debug ("[%s] Restarting mmyth_context to new settings", __FUNCTION__);
   1.338 -    	//gmyth_context_initialize();
   1.339 +
   1.340 +    MMythUi        *mmyth_ui = (MMythUi *) user_data;
   1.341 +
   1.342 +    if (mmyth_uisettings_run(GTK_WINDOW(mmyth_ui->main_window))) {
   1.343 +        // If user changes the settings, we restart the context
   1.344 +        g_debug("[%s] Restarting mmyth_context to new settings",
   1.345 +                __FUNCTION__);
   1.346 +        // gmyth_context_initialize();
   1.347      }
   1.348  }
   1.349  
   1.350  #ifndef MAEMO_PLATFORM
   1.351  
   1.352 -static void 
   1.353 -detacher (GtkWidget *attach_widget,GtkMenu *menu) 
   1.354 +static void
   1.355 +detacher(GtkWidget * attach_widget, GtkMenu * menu)
   1.356  {
   1.357 -	
   1.358 +
   1.359  }
   1.360  
   1.361  static void
   1.362 -do_popup_menu (GtkWidget *my_widget, GdkEventButton *event)
   1.363 +do_popup_menu(GtkWidget * my_widget, GdkEventButton * event)
   1.364  {
   1.365 -    GtkWidget *popup;
   1.366 +    GtkWidget      *popup;
   1.367  
   1.368 -  int button, event_time;
   1.369 +    int             button,
   1.370 +                    event_time;
   1.371  
   1.372 -  GtkWidget *item_general;
   1.373 -  GtkWidget *image;
   1.374 +    GtkWidget      *item_general;
   1.375 +    GtkWidget      *image;
   1.376  
   1.377 -  popup = gtk_menu_new ();
   1.378 +    popup = gtk_menu_new();
   1.379  
   1.380 -  item_general = gtk_image_menu_item_new_with_mnemonic ("Setup");
   1.381 -  gtk_widget_show (item_general);
   1.382 -  gtk_container_add (GTK_CONTAINER (popup), item_general);
   1.383 +    item_general = gtk_image_menu_item_new_with_mnemonic("Setup");
   1.384 +    gtk_widget_show(item_general);
   1.385 +    gtk_container_add(GTK_CONTAINER(popup), item_general);
   1.386  
   1.387 -  image = gtk_image_new_from_stock ("gtk-edit", GTK_ICON_SIZE_MENU);
   1.388 -  gtk_widget_show (image);
   1.389 -  gtk_image_menu_item_set_image (GTK_IMAGE_MENU_ITEM (item_general), image);
   1.390 +    image = gtk_image_new_from_stock("gtk-edit", GTK_ICON_SIZE_MENU);
   1.391 +    gtk_widget_show(image);
   1.392 +    gtk_image_menu_item_set_image(GTK_IMAGE_MENU_ITEM(item_general),
   1.393 +                                  image);
   1.394  
   1.395 -  g_signal_connect (G_OBJECT(item_general), "activate", G_CALLBACK (cb_menu_item_settings), popup_mmyth_ui);
   1.396 +    g_signal_connect(G_OBJECT(item_general), "activate",
   1.397 +                     G_CALLBACK(cb_menu_item_settings), popup_mmyth_ui);
   1.398  
   1.399      if (event) {
   1.400 -      button = event->button;
   1.401 -      event_time = event->time;
   1.402 +        button = event->button;
   1.403 +        event_time = event->time;
   1.404      } else {
   1.405 -      button = 0;
   1.406 -      event_time = gtk_get_current_event_time ();
   1.407 +        button = 0;
   1.408 +        event_time = gtk_get_current_event_time();
   1.409      }
   1.410 -    
   1.411 -    gtk_menu_attach_to_widget (GTK_MENU (popup), my_widget, detacher);
   1.412 -    gtk_menu_popup (GTK_MENU (popup), NULL, NULL, NULL, NULL, 
   1.413 -                  button, event_time);
   1.414 +
   1.415 +    gtk_menu_attach_to_widget(GTK_MENU(popup), my_widget, detacher);
   1.416 +    gtk_menu_popup(GTK_MENU(popup), NULL, NULL, NULL, NULL,
   1.417 +                   button, event_time);
   1.418      gtk_widget_show_all(popup);
   1.419  }
   1.420  
   1.421 -/* Respond to a button-press by posting a menu passed in as widget.
   1.422 - *
   1.423 - * Note that the "widget" argument is the menu being posted, NOT
   1.424 - * the button that was pressed.
   1.425 +/*
   1.426 + * Respond to a button-press by posting a menu passed in as widget. Note
   1.427 + * that the "widget" argument is the menu being posted, NOT the button
   1.428 + * that was pressed. 
   1.429   */
   1.430 -static gint 
   1.431 -button_press_handler (GtkWidget *widget, GdkEvent *event)
   1.432 +static          gint
   1.433 +button_press_handler(GtkWidget * widget, GdkEvent * event)
   1.434  {
   1.435  
   1.436      if (event->type == GDK_BUTTON_PRESS) {
   1.437 -      GdkEventButton *bevent = (GdkEventButton *) event; 
   1.438 -          /* Ignore double-clicks and triple-clicks */
   1.439 -      if (bevent->button == 3)
   1.440 -        {
   1.441 -          do_popup_menu (widget, bevent);
   1.442 -          return TRUE;
   1.443 +        GdkEventButton *bevent = (GdkEventButton *) event;
   1.444 +        /*
   1.445 +         * Ignore double-clicks and triple-clicks 
   1.446 +         */
   1.447 +        if (bevent->button == 3) {
   1.448 +            do_popup_menu(widget, bevent);
   1.449 +            return TRUE;
   1.450          }
   1.451      }
   1.452  
   1.453 -    /* Tell calling code that we have not handled this event; pass it on. */
   1.454 +    /*
   1.455 +     * Tell calling code that we have not handled this event; pass it on. 
   1.456 +     */
   1.457      return FALSE;
   1.458  }
   1.459  #endif
   1.460 @@ -293,121 +323,127 @@
   1.461   *****************************************************************************/
   1.462  
   1.463  static void
   1.464 -cb_close_button (GtkButton * button, gpointer user_data)
   1.465 +cb_close_button(GtkButton * button, gpointer user_data)
   1.466  {
   1.467 -    MMythUi *mmyth_ui = (MMythUi *) user_data;
   1.468 +    MMythUi        *mmyth_ui = (MMythUi *) user_data;
   1.469  
   1.470 -    mmyth_ui_set_widget (mmyth_ui, mmyth_ui->main_uicommon);
   1.471 +    mmyth_ui_set_widget(mmyth_ui, mmyth_ui->main_uicommon);
   1.472  }
   1.473  
   1.474  static void
   1.475 -cb_watch_tv_button (GtkButton * button, gpointer user_data)
   1.476 +cb_watch_tv_button(GtkButton * button, gpointer user_data)
   1.477  {
   1.478 -    MMythUi *mmyth_ui = (MMythUi *) user_data;
   1.479 -	gboolean res = FALSE;
   1.480 -	
   1.481 -	if (!(mmyth_ui->video_uicommon))
   1.482 -		mmyth_ui->video_uicommon = create_video_view (mmyth_ui);
   1.483 -	
   1.484 -	// Creates the tv player that will retrieve the mythtv content, decode and show it
   1.485 -	mmyth_ui->tvplayer = mmyth_tvplayer_new ();
   1.486 -	/* choose here if this is a LiveTV session */
   1.487 -	mmyth_ui->tvplayer->is_livetv = TRUE;
   1.488 +    MMythUi        *mmyth_ui = (MMythUi *) user_data;
   1.489 +    gboolean        res = FALSE;
   1.490  
   1.491 -	res = mmyth_tvplayer_initialize (mmyth_ui->tvplayer, mmyth_ui->backend_info);
   1.492 +    if (!(mmyth_ui->video_uicommon))
   1.493 +        mmyth_ui->video_uicommon = create_video_view(mmyth_ui);
   1.494  
   1.495 -	if (!res) {
   1.496 -		g_warning ("[%s] Could not initialize tvplayer", __FUNCTION__);
   1.497 +    // Creates the tv player that will retrieve the mythtv content, decode 
   1.498 +    // and show it
   1.499 +    mmyth_ui->tvplayer = mmyth_tvplayer_new();
   1.500 +    /*
   1.501 +     * choose here if this is a LiveTV session 
   1.502 +     */
   1.503 +    mmyth_ui->tvplayer->is_livetv = TRUE;
   1.504  
   1.505 -		g_object_unref (mmyth_ui->tvplayer);
   1.506 -		mmyth_ui->tvplayer = NULL;
   1.507 +    res =
   1.508 +        mmyth_tvplayer_initialize(mmyth_ui->tvplayer,
   1.509 +                                  mmyth_ui->backend_info);
   1.510  
   1.511 -		GtkWidget *dialog = gtk_message_dialog_new (
   1.512 -				GTK_WINDOW(mmyth_ui->main_window),
   1.513 -				GTK_DIALOG_DESTROY_WITH_PARENT,
   1.514 -                GTK_MESSAGE_ERROR,
   1.515 -                GTK_BUTTONS_CLOSE,
   1.516 -			 	"MMyth found errors while starting TV Player, please check "
   1.517 -			 	"the GStreamer installation");
   1.518 +    if (!res) {
   1.519 +        g_warning("[%s] Could not initialize tvplayer", __FUNCTION__);
   1.520  
   1.521 -		gtk_dialog_run (GTK_DIALOG (dialog));
   1.522 -		gtk_widget_destroy (dialog);
   1.523 -		
   1.524 -		return;
   1.525 -	}
   1.526 -	//res = mmyth_tvplayer_livetv_setup (mmyth_ui->tvplayer);
   1.527 -	//
   1.528 -	if (mmyth_ui && mmyth_ui->tvplayer && res) {
   1.529 -		mmyth_tvplayer_set_widget (mmyth_ui->tvplayer, mmyth_ui->videow);
   1.530 -		mmyth_tvplayer_start_playing (mmyth_ui->tvplayer);
   1.531 -	} else {
   1.532 -		// TODO: Show Alert with error description!
   1.533 -		g_warning ("[%s] MMythUI can't initialize tv_player", __FUNCTION__);
   1.534 -		g_object_unref (mmyth_ui->tvplayer);
   1.535 -		mmyth_ui->tvplayer = NULL;
   1.536 -		// FIXME: Show the exact error that happened
   1.537 -		GtkWidget *dialog = gtk_message_dialog_new (
   1.538 -				GTK_WINDOW(mmyth_ui->main_window),
   1.539 -				GTK_DIALOG_DESTROY_WITH_PARENT,
   1.540 -                GTK_MESSAGE_ERROR,
   1.541 -                GTK_BUTTONS_CLOSE,
   1.542 -                "Error while starting TV Player, please check if the backend"
   1.543 -                " is running properly and a tv card is available!");
   1.544 -		gtk_dialog_run (GTK_DIALOG (dialog));
   1.545 -		gtk_widget_destroy (dialog);		
   1.546 -		return;
   1.547 -	}
   1.548 -	mmyth_ui_set_widget (mmyth_ui, mmyth_ui->video_uicommon);
   1.549 -	
   1.550 +        g_object_unref(mmyth_ui->tvplayer);
   1.551 +        mmyth_ui->tvplayer = NULL;
   1.552 +
   1.553 +        GtkWidget      *dialog =
   1.554 +            gtk_message_dialog_new(GTK_WINDOW(mmyth_ui->main_window),
   1.555 +                                   GTK_DIALOG_DESTROY_WITH_PARENT,
   1.556 +                                   GTK_MESSAGE_ERROR,
   1.557 +                                   GTK_BUTTONS_CLOSE,
   1.558 +                                   "MMyth found errors while starting TV Player, please check "
   1.559 +                                   "the GStreamer installation");
   1.560 +
   1.561 +        gtk_dialog_run(GTK_DIALOG(dialog));
   1.562 +        gtk_widget_destroy(dialog);
   1.563 +
   1.564 +        return;
   1.565 +    }
   1.566 +    // res = mmyth_tvplayer_livetv_setup (mmyth_ui->tvplayer);
   1.567 +    // 
   1.568 +    if (mmyth_ui && mmyth_ui->tvplayer && res) {
   1.569 +        mmyth_tvplayer_set_widget(mmyth_ui->tvplayer, mmyth_ui->videow);
   1.570 +        mmyth_tvplayer_start_playing(mmyth_ui->tvplayer);
   1.571 +    } else {
   1.572 +        // TODO: Show Alert with error description!
   1.573 +        g_warning("[%s] MMythUI can't initialize tv_player", __FUNCTION__);
   1.574 +        g_object_unref(mmyth_ui->tvplayer);
   1.575 +        mmyth_ui->tvplayer = NULL;
   1.576 +        // FIXME: Show the exact error that happened
   1.577 +        GtkWidget      *dialog =
   1.578 +            gtk_message_dialog_new(GTK_WINDOW(mmyth_ui->main_window),
   1.579 +                                   GTK_DIALOG_DESTROY_WITH_PARENT,
   1.580 +                                   GTK_MESSAGE_ERROR,
   1.581 +                                   GTK_BUTTONS_CLOSE,
   1.582 +                                   "Error while starting TV Player, please check if the backend"
   1.583 +                                   " is running properly and a tv card is available!");
   1.584 +        gtk_dialog_run(GTK_DIALOG(dialog));
   1.585 +        gtk_widget_destroy(dialog);
   1.586 +        return;
   1.587 +    }
   1.588 +    mmyth_ui_set_widget(mmyth_ui, mmyth_ui->video_uicommon);
   1.589 +
   1.590  }
   1.591  
   1.592 -static void 
   1.593 -cb_epg_button (GtkButton * button, gpointer user_data)
   1.594 +static void
   1.595 +cb_epg_button(GtkButton * button, gpointer user_data)
   1.596  {
   1.597 -    MMythUi *mmyth_ui = (MMythUi *) user_data;
   1.598 -    
   1.599 +    MMythUi        *mmyth_ui = (MMythUi *) user_data;
   1.600 +
   1.601      if (!(mmyth_ui->epg_grid_uicommon))
   1.602 -    	mmyth_ui->epg_grid_uicommon = create_epg_grid_view(mmyth_ui);
   1.603 -    	
   1.604 -    mmyth_ui_set_widget (mmyth_ui, mmyth_ui->epg_grid_uicommon);
   1.605 +        mmyth_ui->epg_grid_uicommon = create_epg_grid_view(mmyth_ui);
   1.606 +
   1.607 +    mmyth_ui_set_widget(mmyth_ui, mmyth_ui->epg_grid_uicommon);
   1.608  }
   1.609  
   1.610  static MMythUiCommon *
   1.611 -create_main_view (MMythUi * mmyth_ui)
   1.612 +create_main_view(MMythUi * mmyth_ui)
   1.613  {
   1.614 -    MMythUiCommon *ui_common;
   1.615 -    GtkWidget *main_widget;
   1.616 -    GtkWidget *image;
   1.617 +    MMythUiCommon  *ui_common;
   1.618 +    GtkWidget      *main_widget;
   1.619 +    GtkWidget      *image;
   1.620  
   1.621 -	g_debug ("Creating Main UI Common");
   1.622 -	
   1.623 +    g_debug("Creating Main UI Common");
   1.624 +
   1.625      // FIXME: file path
   1.626  #ifdef MMYTH_DEV
   1.627 -    image = gtk_image_new_from_file ("../pixmaps/mmyth_logo.png");
   1.628 +    image = gtk_image_new_from_file("../pixmaps/mmyth_logo.png");
   1.629  #else
   1.630 -    image = gtk_image_new_from_file ( PIX_DIR "mmyth_logo.png");
   1.631 +    image = gtk_image_new_from_file(PIX_DIR "mmyth_logo.png");
   1.632  #endif
   1.633 -    
   1.634 +
   1.635      main_widget = gtk_event_box_new();
   1.636 -    
   1.637 -    gtk_container_add (GTK_CONTAINER (main_widget),
   1.638 -                       image);
   1.639  
   1.640 +    gtk_container_add(GTK_CONTAINER(main_widget), image);
   1.641  
   1.642 -    gtk_widget_show_all (main_widget);
   1.643 -    g_object_ref (main_widget);
   1.644  
   1.645 -    ui_common = mmyth_uicommon_new (main_widget,
   1.646 -                                    "Watch TV", "EPG", "Recording");
   1.647 +    gtk_widget_show_all(main_widget);
   1.648 +    g_object_ref(main_widget);
   1.649  
   1.650 -    /* Button signals */
   1.651 +    ui_common = mmyth_uicommon_new(main_widget,
   1.652 +                                   "Watch TV", "EPG", "Recording");
   1.653 +
   1.654 +    /*
   1.655 +     * Button signals 
   1.656 +     */
   1.657      // FIXME
   1.658 -    g_signal_connect (G_OBJECT (ui_common->button1), "clicked",
   1.659 -                      G_CALLBACK (cb_watch_tv_button), mmyth_ui);
   1.660 -    g_signal_connect (G_OBJECT (ui_common->button2), "clicked",
   1.661 -                      G_CALLBACK (cb_epg_button), mmyth_ui);
   1.662 -    g_signal_connect (G_OBJECT (ui_common->button3), "clicked",
   1.663 -                      G_CALLBACK (cb_record_button), mmyth_ui);
   1.664 +    g_signal_connect(G_OBJECT(ui_common->button1), "clicked",
   1.665 +                     G_CALLBACK(cb_watch_tv_button), mmyth_ui);
   1.666 +    g_signal_connect(G_OBJECT(ui_common->button2), "clicked",
   1.667 +                     G_CALLBACK(cb_epg_button), mmyth_ui);
   1.668 +    g_signal_connect(G_OBJECT(ui_common->button3), "clicked",
   1.669 +                     G_CALLBACK(cb_record_button), mmyth_ui);
   1.670  
   1.671      return ui_common;
   1.672  
   1.673 @@ -418,26 +454,28 @@
   1.674   *****************************************************************************/
   1.675  
   1.676  static MMythUiCommon *
   1.677 -create_epg_grid_view (MMythUi * mmyth_ui)
   1.678 +create_epg_grid_view(MMythUi * mmyth_ui)
   1.679  {
   1.680 -    MMythUiCommon *ui_common;        
   1.681 +    MMythUiCommon  *ui_common;
   1.682  
   1.683 -	g_debug ("Creating EPG Grid UI Common");
   1.684 -	
   1.685 -    GtkWidget *epg_grid_view = GTK_WIDGET (epg_grid_view_new (mmyth_ui));
   1.686 -    
   1.687 -    ui_common = mmyth_uicommon_new (epg_grid_view,
   1.688 -                                    "Play", "Record",
   1.689 -                                    "Close");    
   1.690 -    
   1.691 -    /* Button signals */
   1.692 -    g_signal_connect (G_OBJECT (ui_common->button1), "clicked",
   1.693 -                      G_CALLBACK (cb_not_impl_button), mmyth_ui);
   1.694 -    g_signal_connect (G_OBJECT (ui_common->button2), "clicked",
   1.695 -                      G_CALLBACK (cb_record_button), mmyth_ui);
   1.696 -    g_signal_connect (G_OBJECT (ui_common->button3), "clicked",
   1.697 -                      G_CALLBACK (cb_close_button), mmyth_ui);
   1.698 -    
   1.699 +    g_debug("Creating EPG Grid UI Common");
   1.700 +
   1.701 +    GtkWidget      *epg_grid_view =
   1.702 +        GTK_WIDGET(epg_grid_view_new(mmyth_ui));
   1.703 +
   1.704 +    ui_common = mmyth_uicommon_new(epg_grid_view,
   1.705 +                                   "Play", "Record", "Close");
   1.706 +
   1.707 +    /*
   1.708 +     * Button signals 
   1.709 +     */
   1.710 +    g_signal_connect(G_OBJECT(ui_common->button1), "clicked",
   1.711 +                     G_CALLBACK(cb_not_impl_button), mmyth_ui);
   1.712 +    g_signal_connect(G_OBJECT(ui_common->button2), "clicked",
   1.713 +                     G_CALLBACK(cb_record_button), mmyth_ui);
   1.714 +    g_signal_connect(G_OBJECT(ui_common->button3), "clicked",
   1.715 +                     G_CALLBACK(cb_close_button), mmyth_ui);
   1.716 +
   1.717      return ui_common;
   1.718  }
   1.719  /******************************************************************************
   1.720 @@ -445,282 +483,313 @@
   1.721   ******************************************************************************/
   1.722  
   1.723  static void
   1.724 -cb_save_new_schedule (GtkButton *button, gpointer user_data)
   1.725 +cb_save_new_schedule(GtkButton * button, gpointer user_data)
   1.726  {
   1.727 -    MMythUi *mmyth_ui = (MMythUi *) user_data;
   1.728 +    MMythUi        *mmyth_ui = (MMythUi *) user_data;
   1.729  
   1.730 -	if (!(mmyth_ui->schedule_uicommon))
   1.731 -		mmyth_ui->schedule_uicommon = create_schedule_view(mmyth_ui);
   1.732 -		
   1.733 -    mmyth_schedulerui_save (mmyth_ui->mmyth_schedulerui);
   1.734 -    
   1.735 -    mmyth_recordui_reload_schedule (mmyth_ui->mmyth_recordui);
   1.736 -    
   1.737 -    mmyth_ui_set_widget (mmyth_ui, mmyth_ui->record_uicommon);
   1.738 -    
   1.739 +    if (!(mmyth_ui->schedule_uicommon))
   1.740 +        mmyth_ui->schedule_uicommon = create_schedule_view(mmyth_ui);
   1.741 +
   1.742 +    mmyth_schedulerui_save(mmyth_ui->mmyth_schedulerui);
   1.743 +
   1.744 +    mmyth_recordui_reload_schedule(mmyth_ui->mmyth_recordui);
   1.745 +
   1.746 +    mmyth_ui_set_widget(mmyth_ui, mmyth_ui->record_uicommon);
   1.747 +
   1.748  }
   1.749  
   1.750  static void
   1.751 -cb_edit_scheduled (GtkTreeView * tree_view, GtkTreePath *path, 
   1.752 -		           GtkTreeViewColumn *column, gpointer user_data)
   1.753 +cb_edit_scheduled(GtkTreeView * tree_view, GtkTreePath * path,
   1.754 +                  GtkTreeViewColumn * column, gpointer user_data)
   1.755  {
   1.756 -    MMythUi *mmyth_ui = (MMythUi *) user_data;
   1.757 +    MMythUi        *mmyth_ui = (MMythUi *) user_data;
   1.758      GtkTreeSelection *selection;
   1.759 -	GtkTreeModel *list_store;
   1.760 -	GtkTreeIter iter;
   1.761 -	int index;
   1.762 -    //gint new_row = 0, record_id = 0;
   1.763 -	ScheduleInfo *schedule_info;
   1.764 -	GList *schedule_list;
   1.765 -	//GtkTreeIter iter;
   1.766 -	gint res;
   1.767 +    GtkTreeModel   *list_store;
   1.768 +    GtkTreeIter     iter;
   1.769 +    int             index;
   1.770 +    // gint new_row = 0, record_id = 0;
   1.771 +    ScheduleInfo   *schedule_info;
   1.772 +    GList          *schedule_list;
   1.773 +    // GtkTreeIter iter;
   1.774 +    gint            res;
   1.775  
   1.776 -	//gtk_tree_store_clear(recordui->sch_tree_store);	
   1.777 +    // gtk_tree_store_clear(recordui->sch_tree_store); 
   1.778  
   1.779 -	res = gmyth_scheduler_get_schedule_list(mmyth_ui->mmyth_recordui->scheduler, &(schedule_list));
   1.780 -	if (res < 0) {
   1.781 -		g_warning ("[%s] Retrieved NULL list of scheduled data from database", __FUNCTION__);
   1.782 -		//return FALSE;
   1.783 -	}
   1.784 -	printf("\nX %d", res); fflush(stdout);
   1.785 -    
   1.786 -   	selection = 
   1.787 -        gtk_tree_view_get_selection(GTK_TREE_VIEW(mmyth_ui->mmyth_recordui->sch_treeview));
   1.788 -    
   1.789 +    res =
   1.790 +        gmyth_scheduler_get_schedule_list(mmyth_ui->mmyth_recordui->
   1.791 +                                          scheduler, &(schedule_list));
   1.792 +    if (res < 0) {
   1.793 +        g_warning
   1.794 +            ("[%s] Retrieved NULL list of scheduled data from database",
   1.795 +             __FUNCTION__);
   1.796 +        // return FALSE;
   1.797 +    }
   1.798 +    printf("\nX %d", res);
   1.799 +    fflush(stdout);
   1.800 +
   1.801 +    selection =
   1.802 +        gtk_tree_view_get_selection(GTK_TREE_VIEW
   1.803 +                                    (mmyth_ui->mmyth_recordui->
   1.804 +                                     sch_treeview));
   1.805 +
   1.806      gtk_tree_selection_get_selected(selection, &list_store, &iter);
   1.807 -	gtk_tree_model_get(list_store, &iter, 4, &index, -1);
   1.808 -    
   1.809 -    mmyth_ui_set_widget (mmyth_ui, mmyth_ui->schedule_uicommon);
   1.810 -    
   1.811 -	if (!(mmyth_ui->schedule_uicommon))
   1.812 -		mmyth_ui->schedule_uicommon = create_schedule_view(mmyth_ui);
   1.813 -		
   1.814 -	schedule_list = g_list_nth(schedule_list, g_ascii_strtoull( gtk_tree_path_to_string(path), NULL, 10 ));
   1.815 -	schedule_info = (ScheduleInfo*) schedule_list->data;
   1.816 +    gtk_tree_model_get(list_store, &iter, 4, &index, -1);
   1.817  
   1.818 -    printf("\nstarttime: %ld", schedule_info->start_time->tv_sec); fflush(stdout);
   1.819 +    mmyth_ui_set_widget(mmyth_ui, mmyth_ui->schedule_uicommon);
   1.820 +
   1.821 +    if (!(mmyth_ui->schedule_uicommon))
   1.822 +        mmyth_ui->schedule_uicommon = create_schedule_view(mmyth_ui);
   1.823 +
   1.824 +    schedule_list =
   1.825 +        g_list_nth(schedule_list,
   1.826 +                   g_ascii_strtoull(gtk_tree_path_to_string(path), NULL,
   1.827 +                                    10));
   1.828 +    schedule_info = (ScheduleInfo *) schedule_list->data;
   1.829 +
   1.830 +    printf("\nstarttime: %ld", schedule_info->start_time->tv_sec);
   1.831 +    fflush(stdout);
   1.832  }
   1.833  
   1.834  static MMythUiCommon *
   1.835 -create_schedule_view (MMythUi * mmyth_ui)
   1.836 +create_schedule_view(MMythUi * mmyth_ui)
   1.837  {
   1.838 -    MMythUiCommon *ui_common;        
   1.839 -    GtkWidget *schedule_widget;
   1.840 -    
   1.841 -    g_debug ("Creating Schedule UI Common");
   1.842 +    MMythUiCommon  *ui_common;
   1.843 +    GtkWidget      *schedule_widget;
   1.844  
   1.845 -	mmyth_ui->mmyth_schedulerui = mmyth_schedulerui_new ( mmyth_ui->backend_info );
   1.846 -	if (mmyth_ui->mmyth_schedulerui == NULL) {
   1.847 -		g_warning ("[%s] Error while creating scheduler ui", __FUNCTION__);
   1.848 -		return NULL;
   1.849 -	}
   1.850 -	
   1.851 -	schedule_widget = mmyth_ui->mmyth_schedulerui->main_widget;
   1.852 +    g_debug("Creating Schedule UI Common");
   1.853  
   1.854 -    gtk_widget_show_all (schedule_widget);
   1.855 -    g_object_ref (schedule_widget);
   1.856 -    
   1.857 -    ui_common = mmyth_uicommon_new (schedule_widget,
   1.858 -                                    "Save", "Clear",
   1.859 -                                    "Cancel");    
   1.860 +    mmyth_ui->mmyth_schedulerui =
   1.861 +        mmyth_schedulerui_new(mmyth_ui->backend_info);
   1.862 +    if (mmyth_ui->mmyth_schedulerui == NULL) {
   1.863 +        g_warning("[%s] Error while creating scheduler ui", __FUNCTION__);
   1.864 +        return NULL;
   1.865 +    }
   1.866  
   1.867 -    /* Button signals */
   1.868 -    g_signal_connect (G_OBJECT (ui_common->button1), "clicked",
   1.869 -                      G_CALLBACK (cb_save_new_schedule), mmyth_ui);
   1.870 -    g_signal_connect (G_OBJECT (ui_common->button2), "clicked",
   1.871 -                      G_CALLBACK (cb_not_impl_button), mmyth_ui);
   1.872 -    g_signal_connect (G_OBJECT (ui_common->button3), "clicked",
   1.873 -                      G_CALLBACK (cb_record_button), mmyth_ui);
   1.874 -    
   1.875 +    schedule_widget = mmyth_ui->mmyth_schedulerui->main_widget;
   1.876 +
   1.877 +    gtk_widget_show_all(schedule_widget);
   1.878 +    g_object_ref(schedule_widget);
   1.879 +
   1.880 +    ui_common = mmyth_uicommon_new(schedule_widget,
   1.881 +                                   "Save", "Clear", "Cancel");
   1.882 +
   1.883 +    /*
   1.884 +     * Button signals 
   1.885 +     */
   1.886 +    g_signal_connect(G_OBJECT(ui_common->button1), "clicked",
   1.887 +                     G_CALLBACK(cb_save_new_schedule), mmyth_ui);
   1.888 +    g_signal_connect(G_OBJECT(ui_common->button2), "clicked",
   1.889 +                     G_CALLBACK(cb_not_impl_button), mmyth_ui);
   1.890 +    g_signal_connect(G_OBJECT(ui_common->button3), "clicked",
   1.891 +                     G_CALLBACK(cb_record_button), mmyth_ui);
   1.892 +
   1.893      return ui_common;
   1.894  }
   1.895  /******************************************************************************
   1.896   *                         RECORD VIEW METHODS                                *
   1.897   ******************************************************************************/
   1.898  static void
   1.899 -cb_record_button (GtkButton * button, gpointer user_data)
   1.900 +cb_record_button(GtkButton * button, gpointer user_data)
   1.901  {
   1.902 -    MMythUi *mmyth_ui = (MMythUi *) user_data;
   1.903 +    MMythUi        *mmyth_ui = (MMythUi *) user_data;
   1.904  
   1.905 -	if (!(mmyth_ui->record_uicommon)) {
   1.906 -		mmyth_ui->record_uicommon = create_record_view (mmyth_ui);
   1.907 -		mmyth_ui->schedule_uicommon = create_schedule_view (mmyth_ui);
   1.908 -	}
   1.909 -	
   1.910 -	mmyth_recordui_reload_all (mmyth_ui->mmyth_recordui);
   1.911 -	
   1.912 -    mmyth_ui_set_widget (mmyth_ui, mmyth_ui->record_uicommon);
   1.913 -
   1.914 -} 
   1.915 -
   1.916 -static void
   1.917 -cb_record_close_button (GtkButton * button, gpointer user_data)
   1.918 -{
   1.919 -    MMythUi *mmyth_ui = (MMythUi *) user_data;
   1.920 -
   1.921 -	mmyth_ui_set_widget(mmyth_ui, mmyth_ui->main_uicommon);
   1.922 -
   1.923 -	mmyth_recordui_free(mmyth_ui->mmyth_recordui);
   1.924 -	
   1.925 -	if (mmyth_ui->record_uicommon) {
   1.926 -		gtk_widget_destroy (mmyth_ui->record_uicommon->main_widget);
   1.927 -		mmyth_uicommon_free(mmyth_ui->record_uicommon);
   1.928 -		mmyth_ui->record_uicommon = NULL;
   1.929 -	}
   1.930 -
   1.931 -	if (mmyth_ui->schedule_uicommon) {
   1.932 -	//	mmyth_uicommon_free(mmyth_ui->schedule_uicommon);
   1.933 -	}	
   1.934 -} 
   1.935 -
   1.936 -
   1.937 -
   1.938 -
   1.939 -static void
   1.940 -play_selected_recorded (gpointer user_data)
   1.941 -{
   1.942 -    MMythUi *mmyth_ui = (MMythUi *) user_data;
   1.943 -    gboolean res = FALSE;
   1.944 -
   1.945 -    gchar *path = mmyth_recordui_get_selected_recorded (mmyth_ui->mmyth_recordui);
   1.946 -    
   1.947 -    if (path == NULL) {
   1.948 -    	// This should never happens. Play button is just activated when
   1.949 -    	// a recording is selected.
   1.950 -    	g_warning ("[%s] Play button pressed while none recorded is selected", __FUNCTION__);
   1.951 -    	return;
   1.952 +    if (!(mmyth_ui->record_uicommon)) {
   1.953 +        mmyth_ui->record_uicommon = create_record_view(mmyth_ui);
   1.954 +        mmyth_ui->schedule_uicommon = create_schedule_view(mmyth_ui);
   1.955      }
   1.956  
   1.957 -	if (!(mmyth_ui->video_uicommon))
   1.958 -		mmyth_ui->video_uicommon = create_video_view (mmyth_ui);
   1.959 -	
   1.960 -	// Creates the tv player that will retrieve the mythtv content, decode and show it
   1.961 -	mmyth_ui->tvplayer = mmyth_tvplayer_new ();
   1.962 -	g_debug ("[%s] New TV Player created: %d\n", __FUNCTION__, (int) (mmyth_ui->tvplayer));
   1.963 -	res = mmyth_tvplayer_initialize (mmyth_ui->tvplayer, mmyth_ui->backend_info);
   1.964 -	if (!res) {
   1.965 -		g_warning ("[%s] Could not initialize tvplayer", __FUNCTION__);
   1.966 +    mmyth_recordui_reload_all(mmyth_ui->mmyth_recordui);
   1.967  
   1.968 -		g_object_unref (mmyth_ui->tvplayer);
   1.969 -		mmyth_ui->tvplayer = NULL;
   1.970 +    mmyth_ui_set_widget(mmyth_ui, mmyth_ui->record_uicommon);
   1.971  
   1.972 -		GtkWidget *dialog = gtk_message_dialog_new (
   1.973 -				GTK_WINDOW(mmyth_ui->main_window),
   1.974 -				GTK_DIALOG_DESTROY_WITH_PARENT,
   1.975 -                GTK_MESSAGE_ERROR,
   1.976 -                GTK_BUTTONS_CLOSE,
   1.977 -			 	"MMyth found errors while starting TV Player, please check "
   1.978 -			 	"the GStreamer installation");
   1.979 -
   1.980 -		gtk_dialog_run (GTK_DIALOG (dialog));
   1.981 -		gtk_widget_destroy (dialog);
   1.982 -		
   1.983 -		return;
   1.984 -	}		
   1.985 -
   1.986 -	res = mmyth_tvplayer_record_setup (mmyth_ui->tvplayer, path);
   1.987 -	
   1.988 -	if (mmyth_ui && mmyth_ui->tvplayer && res) {
   1.989 -		mmyth_tvplayer_set_widget (mmyth_ui->tvplayer, mmyth_ui->videow);
   1.990 -		mmyth_tvplayer_start_playing (mmyth_ui->tvplayer);
   1.991 -	} else {
   1.992 -		// TODO: Show Alert with error description!
   1.993 -		g_warning ("[%s] MMythUI can't initialize tv_player", __FUNCTION__);
   1.994 -		g_object_unref (mmyth_ui->tvplayer);
   1.995 -		mmyth_ui->tvplayer = NULL;
   1.996 -		// FIXME: Show the exact error that happened
   1.997 -		GtkWidget *dialog = gtk_message_dialog_new (
   1.998 -				GTK_WINDOW(mmyth_ui->main_window),
   1.999 -				GTK_DIALOG_DESTROY_WITH_PARENT,
  1.1000 -                GTK_MESSAGE_ERROR,
  1.1001 -                GTK_BUTTONS_CLOSE,
  1.1002 -                "Error while starting TV Player, please check if the backend"
  1.1003 -                " is running properly and a tv card is available!");
  1.1004 -		gtk_dialog_run (GTK_DIALOG (dialog));
  1.1005 -		gtk_widget_destroy (dialog);		
  1.1006 -		return;
  1.1007 -	}
  1.1008 -	
  1.1009 -	mmyth_ui_set_widget (mmyth_ui, mmyth_ui->video_uicommon);    
  1.1010  }
  1.1011  
  1.1012  static void
  1.1013 -cb_play_clicked_recorded (GtkTreeView * tree_view, GtkTreePath *path, 
  1.1014 -		GtkTreeViewColumn *column, gpointer user_data)
  1.1015 +cb_record_close_button(GtkButton * button, gpointer user_data)
  1.1016  {
  1.1017 -	play_selected_recorded (user_data);
  1.1018 +    MMythUi        *mmyth_ui = (MMythUi *) user_data;
  1.1019 +
  1.1020 +    mmyth_ui_set_widget(mmyth_ui, mmyth_ui->main_uicommon);
  1.1021 +
  1.1022 +    mmyth_recordui_free(mmyth_ui->mmyth_recordui);
  1.1023 +
  1.1024 +    if (mmyth_ui->record_uicommon) {
  1.1025 +        gtk_widget_destroy(mmyth_ui->record_uicommon->main_widget);
  1.1026 +        mmyth_uicommon_free(mmyth_ui->record_uicommon);
  1.1027 +        mmyth_ui->record_uicommon = NULL;
  1.1028 +    }
  1.1029 +
  1.1030 +    if (mmyth_ui->schedule_uicommon) {
  1.1031 +        // mmyth_uicommon_free(mmyth_ui->schedule_uicommon);
  1.1032 +    }
  1.1033 +}
  1.1034 +
  1.1035 +
  1.1036 +
  1.1037 +
  1.1038 +static void
  1.1039 +play_selected_recorded(gpointer user_data)
  1.1040 +{
  1.1041 +    MMythUi        *mmyth_ui = (MMythUi *) user_data;
  1.1042 +    gboolean        res = FALSE;
  1.1043 +
  1.1044 +    gchar          *path =
  1.1045 +        mmyth_recordui_get_selected_recorded(mmyth_ui->mmyth_recordui);
  1.1046 +
  1.1047 +    if (path == NULL) {
  1.1048 +        // This should never happens. Play button is just activated when
  1.1049 +        // a recording is selected.
  1.1050 +        g_warning
  1.1051 +            ("[%s] Play button pressed while none recorded is selected",
  1.1052 +             __FUNCTION__);
  1.1053 +        return;
  1.1054 +    }
  1.1055 +
  1.1056 +    if (!(mmyth_ui->video_uicommon))
  1.1057 +        mmyth_ui->video_uicommon = create_video_view(mmyth_ui);
  1.1058 +
  1.1059 +    // Creates the tv player that will retrieve the mythtv content, decode 
  1.1060 +    // and show it
  1.1061 +    mmyth_ui->tvplayer = mmyth_tvplayer_new();
  1.1062 +    g_debug("[%s] New TV Player created: %d\n", __FUNCTION__,
  1.1063 +            (int) (mmyth_ui->tvplayer));
  1.1064 +    res =
  1.1065 +        mmyth_tvplayer_initialize(mmyth_ui->tvplayer,
  1.1066 +                                  mmyth_ui->backend_info);
  1.1067 +    if (!res) {
  1.1068 +        g_warning("[%s] Could not initialize tvplayer", __FUNCTION__);
  1.1069 +
  1.1070 +        g_object_unref(mmyth_ui->tvplayer);
  1.1071 +        mmyth_ui->tvplayer = NULL;
  1.1072 +
  1.1073 +        GtkWidget      *dialog =
  1.1074 +            gtk_message_dialog_new(GTK_WINDOW(mmyth_ui->main_window),
  1.1075 +                                   GTK_DIALOG_DESTROY_WITH_PARENT,
  1.1076 +                                   GTK_MESSAGE_ERROR,
  1.1077 +                                   GTK_BUTTONS_CLOSE,
  1.1078 +                                   "MMyth found errors while starting TV Player, please check "
  1.1079 +                                   "the GStreamer installation");
  1.1080 +
  1.1081 +        gtk_dialog_run(GTK_DIALOG(dialog));
  1.1082 +        gtk_widget_destroy(dialog);
  1.1083 +
  1.1084 +        return;
  1.1085 +    }
  1.1086 +
  1.1087 +    res = mmyth_tvplayer_record_setup(mmyth_ui->tvplayer, path);
  1.1088 +
  1.1089 +    if (mmyth_ui && mmyth_ui->tvplayer && res) {
  1.1090 +        mmyth_tvplayer_set_widget(mmyth_ui->tvplayer, mmyth_ui->videow);
  1.1091 +        mmyth_tvplayer_start_playing(mmyth_ui->tvplayer);
  1.1092 +    } else {
  1.1093 +        // TODO: Show Alert with error description!
  1.1094 +        g_warning("[%s] MMythUI can't initialize tv_player", __FUNCTION__);
  1.1095 +        g_object_unref(mmyth_ui->tvplayer);
  1.1096 +        mmyth_ui->tvplayer = NULL;
  1.1097 +        // FIXME: Show the exact error that happened
  1.1098 +        GtkWidget      *dialog =
  1.1099 +            gtk_message_dialog_new(GTK_WINDOW(mmyth_ui->main_window),
  1.1100 +                                   GTK_DIALOG_DESTROY_WITH_PARENT,
  1.1101 +                                   GTK_MESSAGE_ERROR,
  1.1102 +                                   GTK_BUTTONS_CLOSE,
  1.1103 +                                   "Error while starting TV Player, please check if the backend"
  1.1104 +                                   " is running properly and a tv card is available!");
  1.1105 +        gtk_dialog_run(GTK_DIALOG(dialog));
  1.1106 +        gtk_widget_destroy(dialog);
  1.1107 +        return;
  1.1108 +    }
  1.1109 +
  1.1110 +    mmyth_ui_set_widget(mmyth_ui, mmyth_ui->video_uicommon);
  1.1111  }
  1.1112  
  1.1113  static void
  1.1114 -cb_play_selected (GtkButton * button, gpointer user_data)
  1.1115 +cb_play_clicked_recorded(GtkTreeView * tree_view, GtkTreePath * path,
  1.1116 +                         GtkTreeViewColumn * column, gpointer user_data)
  1.1117  {
  1.1118 -	play_selected_recorded (user_data);
  1.1119 +    play_selected_recorded(user_data);
  1.1120  }
  1.1121  
  1.1122  static void
  1.1123 -cb_schedule_button (GtkButton * button, gpointer user_data)
  1.1124 +cb_play_selected(GtkButton * button, gpointer user_data)
  1.1125  {
  1.1126 -    MMythUi *mmyth_ui = (MMythUi *) user_data;
  1.1127 +    play_selected_recorded(user_data);
  1.1128 +}
  1.1129  
  1.1130 -    mmyth_ui_set_widget (mmyth_ui, mmyth_ui->schedule_uicommon);
  1.1131 +static void
  1.1132 +cb_schedule_button(GtkButton * button, gpointer user_data)
  1.1133 +{
  1.1134 +    MMythUi        *mmyth_ui = (MMythUi *) user_data;
  1.1135 +
  1.1136 +    mmyth_ui_set_widget(mmyth_ui, mmyth_ui->schedule_uicommon);
  1.1137  }
  1.1138  
  1.1139  void
  1.1140 -cb_switch_page (GtkNotebook *notebook, GtkNotebookPage *page,
  1.1141 -		guint page_num, gpointer user_data)
  1.1142 +cb_switch_page(GtkNotebook * notebook, GtkNotebookPage * page,
  1.1143 +               guint page_num, gpointer user_data)
  1.1144  {
  1.1145 -    MMythUi *mmyth_ui = (MMythUi *) user_data;
  1.1146 -    MMythUiCommon *ui_common; 
  1.1147 -    
  1.1148 -	assert (mmyth_ui);
  1.1149 -	assert (mmyth_ui->record_uicommon);
  1.1150 -	
  1.1151 +    MMythUi        *mmyth_ui = (MMythUi *) user_data;
  1.1152 +    MMythUiCommon  *ui_common;
  1.1153 +
  1.1154 +    assert(mmyth_ui);
  1.1155 +    assert(mmyth_ui->record_uicommon);
  1.1156 +
  1.1157      ui_common = mmyth_ui->record_uicommon;
  1.1158 -    
  1.1159 -    if (page_num == 0) { // Switched to Schedule list
  1.1160 -    	gtk_button_set_label (GTK_BUTTON (ui_common->button1), "New");
  1.1161 -		g_signal_handlers_disconnect_by_func (
  1.1162 -			G_OBJECT (ui_common->button1), G_CALLBACK (cb_play_selected), mmyth_ui);
  1.1163 -	    g_signal_connect (G_OBJECT (ui_common->button1), "clicked",
  1.1164 -            G_CALLBACK (cb_schedule_button), mmyth_ui);
  1.1165 +
  1.1166 +    if (page_num == 0) {        // Switched to Schedule list
  1.1167 +        gtk_button_set_label(GTK_BUTTON(ui_common->button1), "New");
  1.1168 +        g_signal_handlers_disconnect_by_func(G_OBJECT(ui_common->button1),
  1.1169 +                                             G_CALLBACK(cb_play_selected),
  1.1170 +                                             mmyth_ui);
  1.1171 +        g_signal_connect(G_OBJECT(ui_common->button1), "clicked",
  1.1172 +                         G_CALLBACK(cb_schedule_button), mmyth_ui);
  1.1173      } else if (page_num == 1) {
  1.1174 -    	gtk_button_set_label (GTK_BUTTON (ui_common->button1), "Play");
  1.1175 -		g_signal_handlers_disconnect_by_func (
  1.1176 -			G_OBJECT (ui_common->button1), G_CALLBACK (cb_schedule_button), mmyth_ui);
  1.1177 -	    g_signal_connect (G_OBJECT (ui_common->button1), "clicked",
  1.1178 -            G_CALLBACK (cb_play_selected), mmyth_ui);
  1.1179 +        gtk_button_set_label(GTK_BUTTON(ui_common->button1), "Play");
  1.1180 +        g_signal_handlers_disconnect_by_func(G_OBJECT(ui_common->button1),
  1.1181 +                                             G_CALLBACK
  1.1182 +                                             (cb_schedule_button),
  1.1183 +                                             mmyth_ui);
  1.1184 +        g_signal_connect(G_OBJECT(ui_common->button1), "clicked",
  1.1185 +                         G_CALLBACK(cb_play_selected), mmyth_ui);
  1.1186      }
  1.1187  }
  1.1188 -                                            
  1.1189 -                                            
  1.1190 +
  1.1191 +
  1.1192  static MMythUiCommon *
  1.1193 -create_record_view (MMythUi * mmyth_ui)
  1.1194 +create_record_view(MMythUi * mmyth_ui)
  1.1195  {
  1.1196 -    MMythUiCommon *ui_common;        
  1.1197 -    
  1.1198 -   	g_debug ("Creating Record UI Common");
  1.1199 -   	
  1.1200 -	mmyth_ui->mmyth_recordui = mmyth_recordui_new ( mmyth_ui->backend_info );
  1.1201 +    MMythUiCommon  *ui_common;
  1.1202  
  1.1203 -	// FIXME: Change MMythRecordUI to a GtkWidget child and avoid this call!
  1.1204 -    gtk_widget_show_all (mmyth_ui->mmyth_recordui->scrolled_window);
  1.1205 -    
  1.1206 -    ui_common = mmyth_uicommon_new (mmyth_ui->mmyth_recordui->scrolled_window, "New", "Delete", "<<Back");    
  1.1207 -    g_object_ref (mmyth_ui->mmyth_recordui->scrolled_window);
  1.1208 -        
  1.1209 -    /* Button signals */
  1.1210 -    g_signal_connect (G_OBJECT (ui_common->button1), "clicked",
  1.1211 -                      G_CALLBACK (cb_schedule_button), mmyth_ui);
  1.1212 -    g_signal_connect (G_OBJECT (ui_common->button2), "clicked",
  1.1213 -                      G_CALLBACK (mmyth_recordui_delete_selected), mmyth_ui->mmyth_recordui);
  1.1214 -    g_signal_connect (G_OBJECT (ui_common->button3), "clicked",
  1.1215 -                      G_CALLBACK (cb_record_close_button), mmyth_ui);
  1.1216 -    g_signal_connect (G_OBJECT (mmyth_ui->mmyth_recordui->notebook),
  1.1217 -		      "switch-page", G_CALLBACK (cb_switch_page), mmyth_ui);
  1.1218 -    g_signal_connect (G_OBJECT (mmyth_ui->mmyth_recordui->rec_treeview),
  1.1219 -		      "row-activated", G_CALLBACK (cb_play_clicked_recorded), mmyth_ui);
  1.1220 -    g_signal_connect (G_OBJECT (mmyth_ui->mmyth_recordui->sch_treeview),
  1.1221 -		      "row-activated", G_CALLBACK (cb_edit_scheduled), mmyth_ui);
  1.1222 +    g_debug("Creating Record UI Common");
  1.1223 +
  1.1224 +    mmyth_ui->mmyth_recordui = mmyth_recordui_new(mmyth_ui->backend_info);
  1.1225 +
  1.1226 +    // FIXME: Change MMythRecordUI to a GtkWidget child and avoid this
  1.1227 +    // call!
  1.1228 +    gtk_widget_show_all(mmyth_ui->mmyth_recordui->scrolled_window);
  1.1229 +
  1.1230 +    ui_common =
  1.1231 +        mmyth_uicommon_new(mmyth_ui->mmyth_recordui->scrolled_window,
  1.1232 +                           "New", "Delete", "<<Back");
  1.1233 +    g_object_ref(mmyth_ui->mmyth_recordui->scrolled_window);
  1.1234 +
  1.1235 +    /*
  1.1236 +     * Button signals 
  1.1237 +     */
  1.1238 +    g_signal_connect(G_OBJECT(ui_common->button1), "clicked",
  1.1239 +                     G_CALLBACK(cb_schedule_button), mmyth_ui);
  1.1240 +    g_signal_connect(G_OBJECT(ui_common->button2), "clicked",
  1.1241 +                     G_CALLBACK(mmyth_recordui_delete_selected),
  1.1242 +                     mmyth_ui->mmyth_recordui);
  1.1243 +    g_signal_connect(G_OBJECT(ui_common->button3), "clicked",
  1.1244 +                     G_CALLBACK(cb_record_close_button), mmyth_ui);
  1.1245 +    g_signal_connect(G_OBJECT(mmyth_ui->mmyth_recordui->notebook),
  1.1246 +                     "switch-page", G_CALLBACK(cb_switch_page), mmyth_ui);
  1.1247 +    g_signal_connect(G_OBJECT(mmyth_ui->mmyth_recordui->rec_treeview),
  1.1248 +                     "row-activated", G_CALLBACK(cb_play_clicked_recorded),
  1.1249 +                     mmyth_ui);
  1.1250 +    g_signal_connect(G_OBJECT(mmyth_ui->mmyth_recordui->sch_treeview),
  1.1251 +                     "row-activated", G_CALLBACK(cb_edit_scheduled),
  1.1252 +                     mmyth_ui);
  1.1253      return ui_common;
  1.1254  }
  1.1255  
  1.1256 @@ -730,86 +799,96 @@
  1.1257   *****************************************************************************/
  1.1258  
  1.1259  static void
  1.1260 -cb_video_close_button (GtkButton * button, gpointer user_data)
  1.1261 +cb_video_close_button(GtkButton * button, gpointer user_data)
  1.1262  {
  1.1263 -    MMythUi *mmyth_ui = (MMythUi *) user_data;
  1.1264 -	
  1.1265 -	g_debug ("MMythUI video close button pressed");
  1.1266 -	
  1.1267 -	if (mmyth_ui && mmyth_ui->tvplayer) {
  1.1268 -	    mmyth_tvplayer_stop_playing (mmyth_ui->tvplayer);
  1.1269 +    MMythUi        *mmyth_ui = (MMythUi *) user_data;
  1.1270  
  1.1271 -		g_object_unref (mmyth_ui->tvplayer);
  1.1272 -		mmyth_ui->tvplayer = NULL;	    
  1.1273 -	} else {
  1.1274 -		g_warning ("cb_video_close_button called with NULL pointer\n");
  1.1275 -	}
  1.1276 -	
  1.1277 -    mmyth_ui_set_widget (mmyth_ui, mmyth_ui->main_uicommon);
  1.1278 +    g_debug("MMythUI video close button pressed");
  1.1279 +
  1.1280 +    if (mmyth_ui && mmyth_ui->tvplayer) {
  1.1281 +        mmyth_tvplayer_stop_playing(mmyth_ui->tvplayer);
  1.1282 +
  1.1283 +        g_object_unref(mmyth_ui->tvplayer);
  1.1284 +        mmyth_ui->tvplayer = NULL;
  1.1285 +    } else {
  1.1286 +        g_warning("cb_video_close_button called with NULL pointer\n");
  1.1287 +    }
  1.1288 +
  1.1289 +    mmyth_ui_set_widget(mmyth_ui, mmyth_ui->main_uicommon);
  1.1290  }
  1.1291  
  1.1292  
  1.1293  static MMythUiCommon *
  1.1294 -create_video_view (MMythUi * mmyth_ui)
  1.1295 +create_video_view(MMythUi * mmyth_ui)
  1.1296  {
  1.1297  
  1.1298 -    MMythUiCommon *ui_common;
  1.1299 +    MMythUiCommon  *ui_common;
  1.1300  
  1.1301 -	g_debug ("Creating Video UI Common");
  1.1302 -	
  1.1303 -	/* Creates widget to be user by MMythTVPlayer to draw the video */
  1.1304 -    mmyth_ui->videow = gtk_drawing_area_new ();
  1.1305 +    g_debug("Creating Video UI Common");
  1.1306 +
  1.1307 +    /*
  1.1308 +     * Creates widget to be user by MMythTVPlayer to draw the video 
  1.1309 +     */
  1.1310 +    mmyth_ui->videow = gtk_drawing_area_new();
  1.1311      // FIXME: Get the widget size from settings
  1.1312 -    gtk_widget_set_size_request (mmyth_ui->videow, 300, 240);
  1.1313 +    gtk_widget_set_size_request(mmyth_ui->videow, 300, 240);
  1.1314  
  1.1315 -    //mmiptv_ui->logo = gdk_pixbuf_new_from_file ("logo.png", NULL);
  1.1316 +    // mmiptv_ui->logo = gdk_pixbuf_new_from_file ("logo.png", NULL);
  1.1317  
  1.1318 -	// Creates an alignment to place the video widget inside
  1.1319 -    mmyth_ui->video_alignment = gtk_alignment_new (0.5, 0.5, 1, 1);
  1.1320 -    gtk_widget_hide (mmyth_ui->video_alignment);
  1.1321 +    // Creates an alignment to place the video widget inside
  1.1322 +    mmyth_ui->video_alignment = gtk_alignment_new(0.5, 0.5, 1, 1);
  1.1323 +    gtk_widget_hide(mmyth_ui->video_alignment);
  1.1324  
  1.1325 -    gtk_container_add (GTK_CONTAINER (mmyth_ui->video_alignment),
  1.1326 -                       mmyth_ui->videow);
  1.1327 +    gtk_container_add(GTK_CONTAINER(mmyth_ui->video_alignment),
  1.1328 +                      mmyth_ui->videow);
  1.1329  
  1.1330 -    /* Add the gst video widget to hbox. It should never be removed. */    
  1.1331 -    /* FIXME: mmyth_ui->video_alignment == NULL when mmyth_player_init fails */
  1.1332 -    if((mmyth_ui->main_hbox != NULL) && (mmyth_ui->video_alignment != NULL)) {
  1.1333 -        gtk_box_pack_start (GTK_BOX (mmyth_ui->main_hbox),
  1.1334 -                            mmyth_ui->video_alignment, TRUE, TRUE, 0);    
  1.1335 -	} else {
  1.1336 -		g_warning ("[%s] Error while adding video_alignment to main widget", __FUNCTION__);	
  1.1337 +    /*
  1.1338 +     * Add the gst video widget to hbox. It should never be removed. 
  1.1339 +     */
  1.1340 +    /*
  1.1341 +     * FIXME: mmyth_ui->video_alignment == NULL when mmyth_player_init
  1.1342 +     * fails 
  1.1343 +     */
  1.1344 +    if ((mmyth_ui->main_hbox != NULL)
  1.1345 +        && (mmyth_ui->video_alignment != NULL)) {
  1.1346 +        gtk_box_pack_start(GTK_BOX(mmyth_ui->main_hbox),
  1.1347 +                           mmyth_ui->video_alignment, TRUE, TRUE, 0);
  1.1348 +    } else {
  1.1349 +        g_warning("[%s] Error while adding video_alignment to main widget",
  1.1350 +                  __FUNCTION__);
  1.1351      }
  1.1352  
  1.1353 -    g_object_ref (mmyth_ui->videow);
  1.1354 -    g_object_ref (mmyth_ui->video_alignment);
  1.1355 +    g_object_ref(mmyth_ui->videow);
  1.1356 +    g_object_ref(mmyth_ui->video_alignment);
  1.1357  
  1.1358 -    ui_common = mmyth_uicommon_new (mmyth_ui->video_alignment,
  1.1359 -                                    "  Full\nScreen", "Other\nServices",
  1.1360 -                                    "Close");
  1.1361 -                                    
  1.1362 -    
  1.1363 -    g_signal_connect (G_OBJECT (ui_common->button1), "clicked",
  1.1364 -                      G_CALLBACK (cb_not_impl_button), mmyth_ui);
  1.1365 -    g_signal_connect (G_OBJECT (ui_common->button2), "clicked",
  1.1366 -                      G_CALLBACK (cb_not_impl_button), mmyth_ui);    
  1.1367 -    g_signal_connect (G_OBJECT (ui_common->button3), "clicked",
  1.1368 -                      G_CALLBACK (cb_video_close_button), mmyth_ui);
  1.1369 +    ui_common = mmyth_uicommon_new(mmyth_ui->video_alignment,
  1.1370 +                                   "  Full\nScreen", "Other\nServices",
  1.1371 +                                   "Close");
  1.1372  
  1.1373 -	if (ui_common)
  1.1374 -		g_debug ("Video UI_Common sucessfull created");
  1.1375 -		
  1.1376 +
  1.1377 +    g_signal_connect(G_OBJECT(ui_common->button1), "clicked",
  1.1378 +                     G_CALLBACK(cb_not_impl_button), mmyth_ui);
  1.1379 +    g_signal_connect(G_OBJECT(ui_common->button2), "clicked",
  1.1380 +                     G_CALLBACK(cb_not_impl_button), mmyth_ui);
  1.1381 +    g_signal_connect(G_OBJECT(ui_common->button3), "clicked",
  1.1382 +                     G_CALLBACK(cb_video_close_button), mmyth_ui);
  1.1383 +
  1.1384 +    if (ui_common)
  1.1385 +        g_debug("Video UI_Common sucessfull created");
  1.1386 +
  1.1387      return ui_common;
  1.1388  }
  1.1389  
  1.1390  
  1.1391  
  1.1392 -GtkWidget*
  1.1393 -mmyth_ui_get_video_widget (MMythUi *mmyth_ui) {
  1.1394 -	
  1.1395 -	if (mmyth_ui && mmyth_ui->videow) {
  1.1396 -	
  1.1397 -		return mmyth_ui->videow;
  1.1398 -	}
  1.1399 -	
  1.1400 -	return NULL;	
  1.1401 +GtkWidget      *
  1.1402 +mmyth_ui_get_video_widget(MMythUi * mmyth_ui)
  1.1403 +{
  1.1404 +
  1.1405 +    if (mmyth_ui && mmyth_ui->videow) {
  1.1406 +
  1.1407 +        return mmyth_ui->videow;
  1.1408 +    }
  1.1409 +
  1.1410 +    return NULL;
  1.1411  }