[svn r647] Added verification on if the indent tool could be found.
2 #include <glib-object.h>
10 #include <gst/interfaces/xoverlay.h>
14 #include "mmyth_uicommon.h"
15 #include "mmyth_schedulerui.h"
16 #include "mmyth_recordui.h"
17 #include "mmyth_uisettings.h"
18 #include "mmyth_epg_grid_view.h"
19 #include "mmyth_tvplayer.h"
21 /* GMyth library includes */
23 #ifndef MAEMO_PLATFORM
24 static gint button_press_handler (GtkWidget *widget, GdkEvent *event);
27 static MMythUiCommon *create_main_view (MMythUi * mmyth_ui);
28 static MMythUiCommon *create_video_view (MMythUi * mmyth_ui);
29 static MMythUiCommon *create_epg_grid_view (MMythUi * mmyth_ui);
30 static MMythUiCommon *create_record_view (MMythUi * mmyth_ui);
31 static MMythUiCommon *create_schedule_view (MMythUi * mmyth_ui);
33 static void cb_video_close_button (GtkButton * button, gpointer user_data);
34 static void cb_record_button (GtkButton * button, gpointer user_data);
35 static void cb_menu_item_settings (GtkMenuItem *menuitem, gpointer user_data);
37 /* main box from button box separator*/
38 static GtkWidget *main_vseparator = NULL;
40 GdkPixbuf *icon_sports, *icon_news,
41 *icon_movies, *icon_shows, *icon_default;
43 #ifndef MAEMO_PLATFORM
45 static MMythUi *popup_mmyth_ui;
51 HildonProgram *program,
53 GtkWidget * main_window)
57 mmyth_ui = g_new0 (MMythUi, 1);
59 mmyth_ui->backend_info = gmyth_backend_info_new_full( "localhost", "mythtv", "mythtv", "mythconverg", 6543 );
61 mmyth_ui->main_window = main_window;
62 mmyth_ui->videow = NULL;
63 mmyth_ui->mmyth_recordui = NULL;
64 mmyth_ui->mmyth_schedulerui = NULL;
66 /* Horizontal box that divides the view into control and video area */
67 mmyth_ui->main_hbox = gtk_hbox_new (FALSE, 0);
68 gtk_widget_show (mmyth_ui->main_hbox);
69 g_object_ref (mmyth_ui->main_hbox);
71 main_bg_color.red = 65000;
72 main_bg_color.green = 65000;
73 main_bg_color.blue = 65000;
76 #ifndef MAEMO_PLATFORM
78 popup_mmyth_ui = mmyth_ui;
79 g_signal_connect (G_OBJECT (mmyth_ui->main_hbox), "event",
80 G_CALLBACK (button_press_handler),
81 G_OBJECT (mmyth_ui->main_hbox));
85 mmyth_ui->main_menu = GTK_MENU(gtk_menu_new());
86 hildon_program_set_common_menu(program, mmyth_ui->main_menu);
88 mmyth_ui->menu_setup = gtk_menu_item_new_with_label("Setup");
89 gtk_widget_set_size_request (GTK_WIDGET (mmyth_ui->menu_setup), 150, 40);
90 gtk_menu_append(mmyth_ui->main_menu, mmyth_ui->menu_setup);
92 g_signal_connect(G_OBJECT(mmyth_ui->menu_setup), "activate", G_CALLBACK(cb_menu_item_settings), mmyth_ui);
94 gtk_widget_show_all (GTK_WIDGET (mmyth_ui->main_menu));
97 // Main widget is mmyth_ui->main_hbox
98 mmyth_ui->main_uicommon = create_main_view (mmyth_ui);
100 gtk_container_add (GTK_CONTAINER (mmyth_ui->main_window),
101 mmyth_ui->main_hbox);
103 mmyth_ui_set_widget (mmyth_ui, mmyth_ui->main_uicommon);
109 mmyth_ui_finalize (MMythUi * mmyth_ui)
111 if (mmyth_ui != NULL) {
112 if (mmyth_ui->main_uicommon)
113 mmyth_uicommon_free (mmyth_ui->main_uicommon);
114 if (mmyth_ui->video_uicommon)
115 mmyth_uicommon_free (mmyth_ui->video_uicommon);
116 if (mmyth_ui->epg_grid_uicommon)
117 mmyth_uicommon_free (mmyth_ui->epg_grid_uicommon);
118 if (mmyth_ui->record_uicommon)
119 mmyth_uicommon_free (mmyth_ui->record_uicommon);
120 if (mmyth_ui->schedule_uicommon)
121 mmyth_uicommon_free (mmyth_ui->schedule_uicommon);
128 mmyth_ui_set_widget (MMythUi * mmyth_ui, MMythUiCommon * new_uicommon)
130 if (new_uicommon == NULL) {
131 g_warning ("MMythUI setting a NULL UI_Common as current display\n");
135 if (mmyth_ui->current_uicommon) {
136 if (mmyth_ui->current_uicommon == mmyth_ui->video_uicommon) {
137 gtk_widget_hide (mmyth_ui->current_uicommon->main_widget);
138 gtk_widget_hide (mmyth_ui->videow);
141 gtk_container_remove (GTK_CONTAINER (mmyth_ui->main_hbox),
142 mmyth_ui->current_uicommon->main_widget);
145 gtk_container_remove (GTK_CONTAINER (mmyth_ui->main_hbox),
146 mmyth_ui->current_uicommon->event_box);
147 gtk_container_remove (GTK_CONTAINER (mmyth_ui->main_hbox),
152 if (new_uicommon->main_widget == mmyth_ui->video_alignment) {
153 //gst_player_video_show (GST_PLAYER_VIDEO(mmyth_ui->videow));
154 gtk_widget_show (mmyth_ui->video_alignment);
155 gtk_widget_show (mmyth_ui->videow);
158 /* FIXME: Fst call is NULL when mmyth_player_init fails */
159 if(mmyth_ui->video_alignment != NULL)
160 gtk_widget_hide (mmyth_ui->video_alignment);
161 /* FIXME: Fst call is NULL when mmyth_player_init fails */
162 if(mmyth_ui->videow != NULL)
163 gtk_widget_hide (mmyth_ui->videow);
165 gtk_box_pack_start (GTK_BOX (mmyth_ui->main_hbox),
166 new_uicommon->main_widget, TRUE, TRUE, 0);
169 if(main_vseparator == NULL) {
170 /* FIXME: should free this variable*/
171 main_vseparator = gtk_vseparator_new();
172 g_object_ref (main_vseparator);
174 gtk_box_pack_start (GTK_BOX (mmyth_ui->main_hbox),
175 main_vseparator, FALSE, FALSE, 0);
176 gtk_widget_show (main_vseparator);
178 gtk_box_pack_end (GTK_BOX (mmyth_ui->main_hbox), new_uicommon->event_box, FALSE,
181 mmyth_ui->current_uicommon = new_uicommon;
185 /* The close callback is the same for all windows*/
187 cb_not_impl_button (GtkButton * button, gpointer user_data)
189 MMythUi *mmyth_ui = (MMythUi *) user_data;
191 GtkWidget *msg_dialog = gtk_message_dialog_new (
192 GTK_WINDOW(mmyth_ui->main_window),
194 GTK_DIALOG_DESTROY_WITH_PARENT,
197 "Feature not implemented");
198 gtk_widget_set_size_request (msg_dialog, 350, 120);
200 gtk_dialog_run (GTK_DIALOG (msg_dialog));
202 gtk_widget_destroy(GTK_WIDGET(msg_dialog));
205 /******************************************************************************
206 * POPUP MENU WIDGET METHODS *
207 *****************************************************************************/
210 cb_menu_item_settings (GtkMenuItem *menuitem,
214 MMythUi *mmyth_ui = (MMythUi*) user_data;
216 if (mmyth_uisettings_run (GTK_WINDOW (mmyth_ui->main_window))) {
217 // If user changes the settings, we restart the context
218 g_debug ("[%s] Restarting mmyth_context to new settings", __FUNCTION__);
219 //gmyth_context_initialize();
223 #ifndef MAEMO_PLATFORM
226 detacher (GtkWidget *attach_widget,GtkMenu *menu)
232 do_popup_menu (GtkWidget *my_widget, GdkEventButton *event)
236 int button, event_time;
238 GtkWidget *item_general;
241 popup = gtk_menu_new ();
243 item_general = gtk_image_menu_item_new_with_mnemonic ("Setup");
244 gtk_widget_show (item_general);
245 gtk_container_add (GTK_CONTAINER (popup), item_general);
247 image = gtk_image_new_from_stock ("gtk-edit", GTK_ICON_SIZE_MENU);
248 gtk_widget_show (image);
249 gtk_image_menu_item_set_image (GTK_IMAGE_MENU_ITEM (item_general), image);
251 g_signal_connect (G_OBJECT(item_general), "activate", G_CALLBACK (cb_menu_item_settings), popup_mmyth_ui);
254 button = event->button;
255 event_time = event->time;
258 event_time = gtk_get_current_event_time ();
261 gtk_menu_attach_to_widget (GTK_MENU (popup), my_widget, detacher);
262 gtk_menu_popup (GTK_MENU (popup), NULL, NULL, NULL, NULL,
264 gtk_widget_show_all(popup);
267 /* Respond to a button-press by posting a menu passed in as widget.
269 * Note that the "widget" argument is the menu being posted, NOT
270 * the button that was pressed.
273 button_press_handler (GtkWidget *widget, GdkEvent *event)
276 if (event->type == GDK_BUTTON_PRESS) {
277 GdkEventButton *bevent = (GdkEventButton *) event;
278 /* Ignore double-clicks and triple-clicks */
279 if (bevent->button == 3)
281 do_popup_menu (widget, bevent);
286 /* Tell calling code that we have not handled this event; pass it on. */
291 /******************************************************************************
292 * MAIN APP VIEW METHODS *
293 *****************************************************************************/
296 cb_close_button (GtkButton * button, gpointer user_data)
298 MMythUi *mmyth_ui = (MMythUi *) user_data;
300 mmyth_ui_set_widget (mmyth_ui, mmyth_ui->main_uicommon);
304 cb_watch_tv_button (GtkButton * button, gpointer user_data)
306 MMythUi *mmyth_ui = (MMythUi *) user_data;
307 gboolean res = FALSE;
309 if (!(mmyth_ui->video_uicommon))
310 mmyth_ui->video_uicommon = create_video_view (mmyth_ui);
312 // Creates the tv player that will retrieve the mythtv content, decode and show it
313 mmyth_ui->tvplayer = mmyth_tvplayer_new ();
314 /* choose here if this is a LiveTV session */
315 mmyth_ui->tvplayer->is_livetv = TRUE;
317 res = mmyth_tvplayer_initialize (mmyth_ui->tvplayer, mmyth_ui->backend_info);
320 g_warning ("[%s] Could not initialize tvplayer", __FUNCTION__);
322 g_object_unref (mmyth_ui->tvplayer);
323 mmyth_ui->tvplayer = NULL;
325 GtkWidget *dialog = gtk_message_dialog_new (
326 GTK_WINDOW(mmyth_ui->main_window),
327 GTK_DIALOG_DESTROY_WITH_PARENT,
330 "MMyth found errors while starting TV Player, please check "
331 "the GStreamer installation");
333 gtk_dialog_run (GTK_DIALOG (dialog));
334 gtk_widget_destroy (dialog);
338 //res = mmyth_tvplayer_livetv_setup (mmyth_ui->tvplayer);
340 if (mmyth_ui && mmyth_ui->tvplayer && res) {
341 mmyth_tvplayer_set_widget (mmyth_ui->tvplayer, mmyth_ui->videow);
342 mmyth_tvplayer_start_playing (mmyth_ui->tvplayer);
344 // TODO: Show Alert with error description!
345 g_warning ("[%s] MMythUI can't initialize tv_player", __FUNCTION__);
346 g_object_unref (mmyth_ui->tvplayer);
347 mmyth_ui->tvplayer = NULL;
348 // FIXME: Show the exact error that happened
349 GtkWidget *dialog = gtk_message_dialog_new (
350 GTK_WINDOW(mmyth_ui->main_window),
351 GTK_DIALOG_DESTROY_WITH_PARENT,
354 "Error while starting TV Player, please check if the backend"
355 " is running properly and a tv card is available!");
356 gtk_dialog_run (GTK_DIALOG (dialog));
357 gtk_widget_destroy (dialog);
360 mmyth_ui_set_widget (mmyth_ui, mmyth_ui->video_uicommon);
365 cb_epg_button (GtkButton * button, gpointer user_data)
367 MMythUi *mmyth_ui = (MMythUi *) user_data;
369 if (!(mmyth_ui->epg_grid_uicommon))
370 mmyth_ui->epg_grid_uicommon = create_epg_grid_view(mmyth_ui);
372 mmyth_ui_set_widget (mmyth_ui, mmyth_ui->epg_grid_uicommon);
375 static MMythUiCommon *
376 create_main_view (MMythUi * mmyth_ui)
378 MMythUiCommon *ui_common;
379 GtkWidget *main_widget;
382 g_debug ("Creating Main UI Common");
386 image = gtk_image_new_from_file ("../pixmaps/mmyth_logo.png");
388 image = gtk_image_new_from_file ( PIX_DIR "mmyth_logo.png");
391 main_widget = gtk_event_box_new();
393 gtk_container_add (GTK_CONTAINER (main_widget),
397 gtk_widget_show_all (main_widget);
398 g_object_ref (main_widget);
400 ui_common = mmyth_uicommon_new (main_widget,
401 "Watch TV", "EPG", "Recording");
405 g_signal_connect (G_OBJECT (ui_common->button1), "clicked",
406 G_CALLBACK (cb_watch_tv_button), mmyth_ui);
407 g_signal_connect (G_OBJECT (ui_common->button2), "clicked",
408 G_CALLBACK (cb_epg_button), mmyth_ui);
409 g_signal_connect (G_OBJECT (ui_common->button3), "clicked",
410 G_CALLBACK (cb_record_button), mmyth_ui);
416 /******************************************************************************
417 * epg GRID VIEW METHODS *
418 *****************************************************************************/
420 static MMythUiCommon *
421 create_epg_grid_view (MMythUi * mmyth_ui)
423 MMythUiCommon *ui_common;
425 g_debug ("Creating EPG Grid UI Common");
427 GtkWidget *epg_grid_view = GTK_WIDGET (epg_grid_view_new (mmyth_ui));
429 ui_common = mmyth_uicommon_new (epg_grid_view,
434 g_signal_connect (G_OBJECT (ui_common->button1), "clicked",
435 G_CALLBACK (cb_not_impl_button), mmyth_ui);
436 g_signal_connect (G_OBJECT (ui_common->button2), "clicked",
437 G_CALLBACK (cb_record_button), mmyth_ui);
438 g_signal_connect (G_OBJECT (ui_common->button3), "clicked",
439 G_CALLBACK (cb_close_button), mmyth_ui);
443 /******************************************************************************
444 * SCHEDULE VIEW METHODS *
445 ******************************************************************************/
448 cb_save_new_schedule (GtkButton *button, gpointer user_data)
450 MMythUi *mmyth_ui = (MMythUi *) user_data;
452 if (!(mmyth_ui->schedule_uicommon))
453 mmyth_ui->schedule_uicommon = create_schedule_view(mmyth_ui);
455 mmyth_schedulerui_save (mmyth_ui->mmyth_schedulerui);
457 mmyth_recordui_reload_schedule (mmyth_ui->mmyth_recordui);
459 mmyth_ui_set_widget (mmyth_ui, mmyth_ui->record_uicommon);
464 cb_edit_scheduled (GtkTreeView * tree_view, GtkTreePath *path,
465 GtkTreeViewColumn *column, gpointer user_data)
467 MMythUi *mmyth_ui = (MMythUi *) user_data;
468 GtkTreeSelection *selection;
469 GtkTreeModel *list_store;
472 //gint new_row = 0, record_id = 0;
473 ScheduleInfo *schedule_info;
474 GList *schedule_list;
478 //gtk_tree_store_clear(recordui->sch_tree_store);
480 res = gmyth_scheduler_get_schedule_list(mmyth_ui->mmyth_recordui->scheduler, &(schedule_list));
482 g_warning ("[%s] Retrieved NULL list of scheduled data from database", __FUNCTION__);
485 printf("\nX %d", res); fflush(stdout);
488 gtk_tree_view_get_selection(GTK_TREE_VIEW(mmyth_ui->mmyth_recordui->sch_treeview));
490 gtk_tree_selection_get_selected(selection, &list_store, &iter);
491 gtk_tree_model_get(list_store, &iter, 4, &index, -1);
493 mmyth_ui_set_widget (mmyth_ui, mmyth_ui->schedule_uicommon);
495 if (!(mmyth_ui->schedule_uicommon))
496 mmyth_ui->schedule_uicommon = create_schedule_view(mmyth_ui);
498 schedule_list = g_list_nth(schedule_list, g_ascii_strtoull( gtk_tree_path_to_string(path), NULL, 10 ));
499 schedule_info = (ScheduleInfo*) schedule_list->data;
501 printf("\nstarttime: %ld", schedule_info->start_time->tv_sec); fflush(stdout);
504 static MMythUiCommon *
505 create_schedule_view (MMythUi * mmyth_ui)
507 MMythUiCommon *ui_common;
508 GtkWidget *schedule_widget;
510 g_debug ("Creating Schedule UI Common");
512 mmyth_ui->mmyth_schedulerui = mmyth_schedulerui_new ( mmyth_ui->backend_info );
513 if (mmyth_ui->mmyth_schedulerui == NULL) {
514 g_warning ("[%s] Error while creating scheduler ui", __FUNCTION__);
518 schedule_widget = mmyth_ui->mmyth_schedulerui->main_widget;
520 gtk_widget_show_all (schedule_widget);
521 g_object_ref (schedule_widget);
523 ui_common = mmyth_uicommon_new (schedule_widget,
528 g_signal_connect (G_OBJECT (ui_common->button1), "clicked",
529 G_CALLBACK (cb_save_new_schedule), mmyth_ui);
530 g_signal_connect (G_OBJECT (ui_common->button2), "clicked",
531 G_CALLBACK (cb_not_impl_button), mmyth_ui);
532 g_signal_connect (G_OBJECT (ui_common->button3), "clicked",
533 G_CALLBACK (cb_record_button), mmyth_ui);
537 /******************************************************************************
538 * RECORD VIEW METHODS *
539 ******************************************************************************/
541 cb_record_button (GtkButton * button, gpointer user_data)
543 MMythUi *mmyth_ui = (MMythUi *) user_data;
545 if (!(mmyth_ui->record_uicommon)) {
546 mmyth_ui->record_uicommon = create_record_view (mmyth_ui);
547 mmyth_ui->schedule_uicommon = create_schedule_view (mmyth_ui);
550 mmyth_recordui_reload_all (mmyth_ui->mmyth_recordui);
552 mmyth_ui_set_widget (mmyth_ui, mmyth_ui->record_uicommon);
557 cb_record_close_button (GtkButton * button, gpointer user_data)
559 MMythUi *mmyth_ui = (MMythUi *) user_data;
561 mmyth_ui_set_widget(mmyth_ui, mmyth_ui->main_uicommon);
563 mmyth_recordui_free(mmyth_ui->mmyth_recordui);
565 if (mmyth_ui->record_uicommon) {
566 gtk_widget_destroy (mmyth_ui->record_uicommon->main_widget);
567 mmyth_uicommon_free(mmyth_ui->record_uicommon);
568 mmyth_ui->record_uicommon = NULL;
571 if (mmyth_ui->schedule_uicommon) {
572 // mmyth_uicommon_free(mmyth_ui->schedule_uicommon);
580 play_selected_recorded (gpointer user_data)
582 MMythUi *mmyth_ui = (MMythUi *) user_data;
583 gboolean res = FALSE;
585 gchar *path = mmyth_recordui_get_selected_recorded (mmyth_ui->mmyth_recordui);
588 // This should never happens. Play button is just activated when
589 // a recording is selected.
590 g_warning ("[%s] Play button pressed while none recorded is selected", __FUNCTION__);
594 if (!(mmyth_ui->video_uicommon))
595 mmyth_ui->video_uicommon = create_video_view (mmyth_ui);
597 // Creates the tv player that will retrieve the mythtv content, decode and show it
598 mmyth_ui->tvplayer = mmyth_tvplayer_new ();
599 g_debug ("[%s] New TV Player created: %d\n", __FUNCTION__, (int) (mmyth_ui->tvplayer));
600 res = mmyth_tvplayer_initialize (mmyth_ui->tvplayer, mmyth_ui->backend_info);
602 g_warning ("[%s] Could not initialize tvplayer", __FUNCTION__);
604 g_object_unref (mmyth_ui->tvplayer);
605 mmyth_ui->tvplayer = NULL;
607 GtkWidget *dialog = gtk_message_dialog_new (
608 GTK_WINDOW(mmyth_ui->main_window),
609 GTK_DIALOG_DESTROY_WITH_PARENT,
612 "MMyth found errors while starting TV Player, please check "
613 "the GStreamer installation");
615 gtk_dialog_run (GTK_DIALOG (dialog));
616 gtk_widget_destroy (dialog);
621 res = mmyth_tvplayer_record_setup (mmyth_ui->tvplayer, path);
623 if (mmyth_ui && mmyth_ui->tvplayer && res) {
624 mmyth_tvplayer_set_widget (mmyth_ui->tvplayer, mmyth_ui->videow);
625 mmyth_tvplayer_start_playing (mmyth_ui->tvplayer);
627 // TODO: Show Alert with error description!
628 g_warning ("[%s] MMythUI can't initialize tv_player", __FUNCTION__);
629 g_object_unref (mmyth_ui->tvplayer);
630 mmyth_ui->tvplayer = NULL;
631 // FIXME: Show the exact error that happened
632 GtkWidget *dialog = gtk_message_dialog_new (
633 GTK_WINDOW(mmyth_ui->main_window),
634 GTK_DIALOG_DESTROY_WITH_PARENT,
637 "Error while starting TV Player, please check if the backend"
638 " is running properly and a tv card is available!");
639 gtk_dialog_run (GTK_DIALOG (dialog));
640 gtk_widget_destroy (dialog);
644 mmyth_ui_set_widget (mmyth_ui, mmyth_ui->video_uicommon);
648 cb_play_clicked_recorded (GtkTreeView * tree_view, GtkTreePath *path,
649 GtkTreeViewColumn *column, gpointer user_data)
651 play_selected_recorded (user_data);
655 cb_play_selected (GtkButton * button, gpointer user_data)
657 play_selected_recorded (user_data);
661 cb_schedule_button (GtkButton * button, gpointer user_data)
663 MMythUi *mmyth_ui = (MMythUi *) user_data;
665 mmyth_ui_set_widget (mmyth_ui, mmyth_ui->schedule_uicommon);
669 cb_switch_page (GtkNotebook *notebook, GtkNotebookPage *page,
670 guint page_num, gpointer user_data)
672 MMythUi *mmyth_ui = (MMythUi *) user_data;
673 MMythUiCommon *ui_common;
676 assert (mmyth_ui->record_uicommon);
678 ui_common = mmyth_ui->record_uicommon;
680 if (page_num == 0) { // Switched to Schedule list
681 gtk_button_set_label (GTK_BUTTON (ui_common->button1), "New");
682 g_signal_handlers_disconnect_by_func (
683 G_OBJECT (ui_common->button1), G_CALLBACK (cb_play_selected), mmyth_ui);
684 g_signal_connect (G_OBJECT (ui_common->button1), "clicked",
685 G_CALLBACK (cb_schedule_button), mmyth_ui);
686 } else if (page_num == 1) {
687 gtk_button_set_label (GTK_BUTTON (ui_common->button1), "Play");
688 g_signal_handlers_disconnect_by_func (
689 G_OBJECT (ui_common->button1), G_CALLBACK (cb_schedule_button), mmyth_ui);
690 g_signal_connect (G_OBJECT (ui_common->button1), "clicked",
691 G_CALLBACK (cb_play_selected), mmyth_ui);
696 static MMythUiCommon *
697 create_record_view (MMythUi * mmyth_ui)
699 MMythUiCommon *ui_common;
701 g_debug ("Creating Record UI Common");
703 mmyth_ui->mmyth_recordui = mmyth_recordui_new ( mmyth_ui->backend_info );
705 // FIXME: Change MMythRecordUI to a GtkWidget child and avoid this call!
706 gtk_widget_show_all (mmyth_ui->mmyth_recordui->scrolled_window);
708 ui_common = mmyth_uicommon_new (mmyth_ui->mmyth_recordui->scrolled_window, "New", "Delete", "<<Back");
709 g_object_ref (mmyth_ui->mmyth_recordui->scrolled_window);
712 g_signal_connect (G_OBJECT (ui_common->button1), "clicked",
713 G_CALLBACK (cb_schedule_button), mmyth_ui);
714 g_signal_connect (G_OBJECT (ui_common->button2), "clicked",
715 G_CALLBACK (mmyth_recordui_delete_selected), mmyth_ui->mmyth_recordui);
716 g_signal_connect (G_OBJECT (ui_common->button3), "clicked",
717 G_CALLBACK (cb_record_close_button), mmyth_ui);
718 g_signal_connect (G_OBJECT (mmyth_ui->mmyth_recordui->notebook),
719 "switch-page", G_CALLBACK (cb_switch_page), mmyth_ui);
720 g_signal_connect (G_OBJECT (mmyth_ui->mmyth_recordui->rec_treeview),
721 "row-activated", G_CALLBACK (cb_play_clicked_recorded), mmyth_ui);
722 g_signal_connect (G_OBJECT (mmyth_ui->mmyth_recordui->sch_treeview),
723 "row-activated", G_CALLBACK (cb_edit_scheduled), mmyth_ui);
728 /******************************************************************************
729 * GST VIDEO WIDGET METHODS *
730 *****************************************************************************/
733 cb_video_close_button (GtkButton * button, gpointer user_data)
735 MMythUi *mmyth_ui = (MMythUi *) user_data;
737 g_debug ("MMythUI video close button pressed");
739 if (mmyth_ui && mmyth_ui->tvplayer) {
740 mmyth_tvplayer_stop_playing (mmyth_ui->tvplayer);
742 g_object_unref (mmyth_ui->tvplayer);
743 mmyth_ui->tvplayer = NULL;
745 g_warning ("cb_video_close_button called with NULL pointer\n");
748 mmyth_ui_set_widget (mmyth_ui, mmyth_ui->main_uicommon);
752 static MMythUiCommon *
753 create_video_view (MMythUi * mmyth_ui)
756 MMythUiCommon *ui_common;
758 g_debug ("Creating Video UI Common");
760 /* Creates widget to be user by MMythTVPlayer to draw the video */
761 mmyth_ui->videow = gtk_drawing_area_new ();
762 // FIXME: Get the widget size from settings
763 gtk_widget_set_size_request (mmyth_ui->videow, 300, 240);
765 //mmiptv_ui->logo = gdk_pixbuf_new_from_file ("logo.png", NULL);
767 // Creates an alignment to place the video widget inside
768 mmyth_ui->video_alignment = gtk_alignment_new (0.5, 0.5, 1, 1);
769 gtk_widget_hide (mmyth_ui->video_alignment);
771 gtk_container_add (GTK_CONTAINER (mmyth_ui->video_alignment),
774 /* Add the gst video widget to hbox. It should never be removed. */
775 /* FIXME: mmyth_ui->video_alignment == NULL when mmyth_player_init fails */
776 if((mmyth_ui->main_hbox != NULL) && (mmyth_ui->video_alignment != NULL)) {
777 gtk_box_pack_start (GTK_BOX (mmyth_ui->main_hbox),
778 mmyth_ui->video_alignment, TRUE, TRUE, 0);
780 g_warning ("[%s] Error while adding video_alignment to main widget", __FUNCTION__);
783 g_object_ref (mmyth_ui->videow);
784 g_object_ref (mmyth_ui->video_alignment);
786 ui_common = mmyth_uicommon_new (mmyth_ui->video_alignment,
787 " Full\nScreen", "Other\nServices",
791 g_signal_connect (G_OBJECT (ui_common->button1), "clicked",
792 G_CALLBACK (cb_not_impl_button), mmyth_ui);
793 g_signal_connect (G_OBJECT (ui_common->button2), "clicked",
794 G_CALLBACK (cb_not_impl_button), mmyth_ui);
795 g_signal_connect (G_OBJECT (ui_common->button3), "clicked",
796 G_CALLBACK (cb_video_close_button), mmyth_ui);
799 g_debug ("Video UI_Common sucessfull created");
807 mmyth_ui_get_video_widget (MMythUi *mmyth_ui) {
809 if (mmyth_ui && mmyth_ui->videow) {
811 return mmyth_ui->videow;