[svn r110] Moved function IS_RECORDING from FileTransfer to Recorder.
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 */
22 #include "gmyth_context.h"
24 #ifndef MAEMO_PLATFORM
25 static gint button_press_handler (GtkWidget *widget, GdkEvent *event);
28 static MMythUiCommon *create_main_view (MMythUi * mmyth_ui);
29 static MMythUiCommon *create_video_view (MMythUi * mmyth_ui);
30 static MMythUiCommon *create_epg_grid_view (MMythUi * mmyth_ui);
31 static MMythUiCommon *create_record_view (MMythUi * mmyth_ui);
32 static MMythUiCommon *create_schedule_view (MMythUi * mmyth_ui);
34 static void cb_video_close_button (GtkButton * button, gpointer user_data);
35 static void cb_record_button (GtkButton * button, gpointer user_data);
36 static void cb_menu_item_settings (GtkMenuItem *menuitem, gpointer user_data);
38 /* main box from button box separator*/
39 static GtkWidget *main_vseparator = NULL;
41 GdkPixbuf *icon_sports, *icon_news,
42 *icon_movies, *icon_shows, *icon_default;
44 #ifndef MAEMO_PLATFORM
46 static MMythUi *popup_mmyth_ui;
52 HildonProgram *program,
54 GtkWidget * main_window)
58 mmyth_ui = g_new0 (MMythUi, 1);
60 mmyth_ui->main_window = main_window;
61 mmyth_ui->videow = NULL;
62 mmyth_ui->mmyth_recordui = NULL;
63 mmyth_ui->mmyth_schedulerui = NULL;
65 /* Horizontal box that divides the view into control and video area */
66 mmyth_ui->main_hbox = gtk_hbox_new (FALSE, 0);
67 gtk_widget_show (mmyth_ui->main_hbox);
68 g_object_ref (mmyth_ui->main_hbox);
70 main_bg_color.red = 65000;
71 main_bg_color.green = 65000;
72 main_bg_color.blue = 65000;
75 #ifndef MAEMO_PLATFORM
77 popup_mmyth_ui = mmyth_ui;
78 g_signal_connect (G_OBJECT (mmyth_ui->main_hbox), "event",
79 G_CALLBACK (button_press_handler),
80 G_OBJECT (mmyth_ui->main_hbox));
84 mmyth_ui->main_menu = GTK_MENU(gtk_menu_new());
85 hildon_program_set_common_menu(program, mmyth_ui->main_menu);
87 mmyth_ui->menu_setup = gtk_menu_item_new_with_label("Setup");
88 gtk_widget_set_size_request (GTK_WIDGET (mmyth_ui->menu_setup), 150, 40);
89 gtk_menu_append(mmyth_ui->main_menu, mmyth_ui->menu_setup);
91 g_signal_connect(G_OBJECT(mmyth_ui->menu_setup), "activate", G_CALLBACK(cb_menu_item_settings), mmyth_ui);
93 gtk_widget_show_all (GTK_WIDGET (mmyth_ui->main_menu));
96 // Main widget is mmyth_ui->main_hbox
97 mmyth_ui->main_uicommon = create_main_view (mmyth_ui);
99 gtk_container_add (GTK_CONTAINER (mmyth_ui->main_window),
100 mmyth_ui->main_hbox);
102 mmyth_ui_set_widget (mmyth_ui, mmyth_ui->main_uicommon);
108 mmyth_ui_finalize (MMythUi * mmyth_ui)
110 if (mmyth_ui != NULL) {
111 if (mmyth_ui->main_uicommon)
112 mmyth_uicommon_free (mmyth_ui->main_uicommon);
113 if (mmyth_ui->video_uicommon)
114 mmyth_uicommon_free (mmyth_ui->video_uicommon);
115 if (mmyth_ui->epg_grid_uicommon)
116 mmyth_uicommon_free (mmyth_ui->epg_grid_uicommon);
117 if (mmyth_ui->record_uicommon)
118 mmyth_uicommon_free (mmyth_ui->record_uicommon);
119 if (mmyth_ui->schedule_uicommon)
120 mmyth_uicommon_free (mmyth_ui->schedule_uicommon);
127 mmyth_ui_set_widget (MMythUi * mmyth_ui, MMythUiCommon * new_uicommon)
129 if (new_uicommon == NULL) {
130 g_warning ("MMythUI setting a NULL UI_Common as current display\n");
134 if (mmyth_ui->current_uicommon) {
135 if (mmyth_ui->current_uicommon == mmyth_ui->video_uicommon) {
136 gtk_widget_hide (mmyth_ui->current_uicommon->main_widget);
137 gtk_widget_hide (mmyth_ui->videow);
140 gtk_container_remove (GTK_CONTAINER (mmyth_ui->main_hbox),
141 mmyth_ui->current_uicommon->main_widget);
144 gtk_container_remove (GTK_CONTAINER (mmyth_ui->main_hbox),
145 mmyth_ui->current_uicommon->event_box);
146 gtk_container_remove (GTK_CONTAINER (mmyth_ui->main_hbox),
151 if (new_uicommon->main_widget == mmyth_ui->video_alignment) {
152 //gst_player_video_show (GST_PLAYER_VIDEO(mmyth_ui->videow));
153 gtk_widget_show (mmyth_ui->video_alignment);
154 gtk_widget_show (mmyth_ui->videow);
157 /* FIXME: Fst call is NULL when mmyth_player_init fails */
158 if(mmyth_ui->video_alignment != NULL)
159 gtk_widget_hide (mmyth_ui->video_alignment);
160 /* FIXME: Fst call is NULL when mmyth_player_init fails */
161 if(mmyth_ui->videow != NULL)
162 gtk_widget_hide (mmyth_ui->videow);
164 gtk_box_pack_start (GTK_BOX (mmyth_ui->main_hbox),
165 new_uicommon->main_widget, TRUE, TRUE, 0);
168 if(main_vseparator == NULL) {
169 /* FIXME: should free this variable*/
170 main_vseparator = gtk_vseparator_new();
171 g_object_ref (main_vseparator);
173 gtk_box_pack_start (GTK_BOX (mmyth_ui->main_hbox),
174 main_vseparator, FALSE, FALSE, 0);
175 gtk_widget_show (main_vseparator);
177 gtk_box_pack_end (GTK_BOX (mmyth_ui->main_hbox), new_uicommon->event_box, FALSE,
180 mmyth_ui->current_uicommon = new_uicommon;
184 /* The close callback is the same for all windows*/
186 cb_not_impl_button (GtkButton * button, gpointer user_data)
188 MMythUi *mmyth_ui = (MMythUi *) user_data;
190 GtkWidget *msg_dialog = gtk_message_dialog_new (
191 GTK_WINDOW(mmyth_ui->main_window),
193 GTK_DIALOG_DESTROY_WITH_PARENT,
196 "Feature not implemented");
197 gtk_widget_set_size_request (msg_dialog, 350, 120);
199 gtk_dialog_run (GTK_DIALOG (msg_dialog));
201 gtk_widget_destroy(GTK_WIDGET(msg_dialog));
204 /******************************************************************************
205 * POPUP MENU WIDGET METHODS *
206 *****************************************************************************/
209 cb_menu_item_settings (GtkMenuItem *menuitem,
213 MMythUi *mmyth_ui = (MMythUi*) user_data;
215 if (mmyth_uisettings_run (GTK_WINDOW (mmyth_ui->main_window))) {
216 // If user changes the settings, we restart the context
217 g_debug ("[%s] Restarting mmyth_context to new settings", __FUNCTION__);
218 gmyth_context_initialize();
222 #ifndef MAEMO_PLATFORM
225 detacher (GtkWidget *attach_widget,GtkMenu *menu)
231 do_popup_menu (GtkWidget *my_widget, GdkEventButton *event)
235 int button, event_time;
237 GtkWidget *item_general;
240 popup = gtk_menu_new ();
242 item_general = gtk_image_menu_item_new_with_mnemonic ("Setup");
243 gtk_widget_show (item_general);
244 gtk_container_add (GTK_CONTAINER (popup), item_general);
246 image = gtk_image_new_from_stock ("gtk-edit", GTK_ICON_SIZE_MENU);
247 gtk_widget_show (image);
248 gtk_image_menu_item_set_image (GTK_IMAGE_MENU_ITEM (item_general), image);
250 g_signal_connect (G_OBJECT(item_general), "activate", G_CALLBACK (cb_menu_item_settings), popup_mmyth_ui);
253 button = event->button;
254 event_time = event->time;
257 event_time = gtk_get_current_event_time ();
260 gtk_menu_attach_to_widget (GTK_MENU (popup), my_widget, detacher);
261 gtk_menu_popup (GTK_MENU (popup), NULL, NULL, NULL, NULL,
263 gtk_widget_show_all(popup);
266 /* Respond to a button-press by posting a menu passed in as widget.
268 * Note that the "widget" argument is the menu being posted, NOT
269 * the button that was pressed.
272 button_press_handler (GtkWidget *widget, GdkEvent *event)
275 if (event->type == GDK_BUTTON_PRESS) {
276 GdkEventButton *bevent = (GdkEventButton *) event;
277 /* Ignore double-clicks and triple-clicks */
278 if (bevent->button == 3)
280 do_popup_menu (widget, bevent);
285 /* Tell calling code that we have not handled this event; pass it on. */
290 /******************************************************************************
291 * MAIN APP VIEW METHODS *
292 *****************************************************************************/
295 cb_close_button (GtkButton * button, gpointer user_data)
297 MMythUi *mmyth_ui = (MMythUi *) user_data;
299 mmyth_ui_set_widget (mmyth_ui, mmyth_ui->main_uicommon);
303 cb_watch_tv_button (GtkButton * button, gpointer user_data)
305 MMythUi *mmyth_ui = (MMythUi *) user_data;
306 gboolean res = FALSE;
308 if (!(mmyth_ui->video_uicommon))
309 mmyth_ui->video_uicommon = create_video_view (mmyth_ui);
311 // Creates the tv player that will retrieve the mythtv content, decode and show it
312 mmyth_ui->tvplayer = mmyth_tvplayer_new ();
313 /* choose here if this is a LiveTV session */
314 mmyth_ui->tvplayer->is_livetv = TRUE;
316 res = mmyth_tvplayer_initialize (mmyth_ui->tvplayer);
319 g_warning ("[%s] Could not initialize tvplayer", __FUNCTION__);
321 g_object_unref (mmyth_ui->tvplayer);
322 mmyth_ui->tvplayer = NULL;
324 GtkWidget *dialog = gtk_message_dialog_new (
325 GTK_WINDOW(mmyth_ui->main_window),
326 GTK_DIALOG_DESTROY_WITH_PARENT,
329 "MMyth found errors while starting TV Player, please check "
330 "the GStreamer installation");
332 gtk_dialog_run (GTK_DIALOG (dialog));
333 gtk_widget_destroy (dialog);
337 //res = mmyth_tvplayer_livetv_setup (mmyth_ui->tvplayer);
339 if (mmyth_ui && mmyth_ui->tvplayer && res) {
340 mmyth_tvplayer_set_widget (mmyth_ui->tvplayer, mmyth_ui->videow);
341 mmyth_tvplayer_start_playing (mmyth_ui->tvplayer);
343 // TODO: Show Alert with error description!
344 g_warning ("[%s] MMythUI can't initialize tv_player", __FUNCTION__);
345 g_object_unref (mmyth_ui->tvplayer);
346 mmyth_ui->tvplayer = NULL;
347 // FIXME: Show the exact error that happened
348 GtkWidget *dialog = gtk_message_dialog_new (
349 GTK_WINDOW(mmyth_ui->main_window),
350 GTK_DIALOG_DESTROY_WITH_PARENT,
353 "Error while starting TV Player, please check if the backend"
354 " is running properly and a tv card is available!");
355 gtk_dialog_run (GTK_DIALOG (dialog));
356 gtk_widget_destroy (dialog);
359 mmyth_ui_set_widget (mmyth_ui, mmyth_ui->video_uicommon);
364 cb_epg_button (GtkButton * button, gpointer user_data)
366 MMythUi *mmyth_ui = (MMythUi *) user_data;
368 if (!(mmyth_ui->epg_grid_uicommon))
369 mmyth_ui->epg_grid_uicommon = create_epg_grid_view(mmyth_ui);
371 mmyth_ui_set_widget (mmyth_ui, mmyth_ui->epg_grid_uicommon);
374 static MMythUiCommon *
375 create_main_view (MMythUi * mmyth_ui)
377 MMythUiCommon *ui_common;
378 GtkWidget *main_widget;
381 g_debug ("Creating Main UI Common");
385 image = gtk_image_new_from_file ("../pixmaps/mmyth_logo.png");
387 image = gtk_image_new_from_file ( PIX_DIR "mmyth_logo.png");
390 main_widget = gtk_event_box_new();
392 gtk_container_add (GTK_CONTAINER (main_widget),
396 gtk_widget_show_all (main_widget);
397 g_object_ref (main_widget);
399 ui_common = mmyth_uicommon_new (main_widget,
400 "Watch TV", "EPG", "Recording");
404 g_signal_connect (G_OBJECT (ui_common->button1), "clicked",
405 G_CALLBACK (cb_watch_tv_button), mmyth_ui);
406 g_signal_connect (G_OBJECT (ui_common->button2), "clicked",
407 G_CALLBACK (cb_epg_button), mmyth_ui);
408 g_signal_connect (G_OBJECT (ui_common->button3), "clicked",
409 G_CALLBACK (cb_record_button), mmyth_ui);
415 /******************************************************************************
416 * epg GRID VIEW METHODS *
417 *****************************************************************************/
419 static MMythUiCommon *
420 create_epg_grid_view (MMythUi * mmyth_ui)
422 MMythUiCommon *ui_common;
424 g_debug ("Creating EPG Grid UI Common");
426 GtkWidget *epg_grid_view = GTK_WIDGET (epg_grid_view_new (mmyth_ui));
428 ui_common = mmyth_uicommon_new (epg_grid_view,
433 g_signal_connect (G_OBJECT (ui_common->button1), "clicked",
434 G_CALLBACK (cb_not_impl_button), mmyth_ui);
435 g_signal_connect (G_OBJECT (ui_common->button2), "clicked",
436 G_CALLBACK (cb_record_button), mmyth_ui);
437 g_signal_connect (G_OBJECT (ui_common->button3), "clicked",
438 G_CALLBACK (cb_close_button), mmyth_ui);
442 /******************************************************************************
443 * SCHEDULE VIEW METHODS *
444 ******************************************************************************/
447 cb_save_new_schedule (GtkButton *button, gpointer user_data)
449 MMythUi *mmyth_ui = (MMythUi *) user_data;
451 if (!(mmyth_ui->schedule_uicommon))
452 mmyth_ui->schedule_uicommon = create_schedule_view(mmyth_ui);
454 mmyth_schedulerui_save (mmyth_ui->mmyth_schedulerui);
456 mmyth_recordui_reload_schedule (mmyth_ui->mmyth_recordui);
458 mmyth_ui_set_widget (mmyth_ui, mmyth_ui->record_uicommon);
463 cb_edit_scheduled (GtkTreeView * tree_view, GtkTreePath *path,
464 GtkTreeViewColumn *column, gpointer user_data)
466 MMythUi *mmyth_ui = (MMythUi *) user_data;
467 GtkTreeSelection *selection;
468 GtkTreeModel *list_store;
471 //gint new_row = 0, record_id = 0;
472 ScheduleInfo *schedule_info;
473 GList *schedule_list;
477 //gtk_tree_store_clear(recordui->sch_tree_store);
479 res = gmyth_scheduler_get_schedule_list(mmyth_ui->mmyth_recordui->scheduler, &(schedule_list));
481 g_warning ("[%s] Retrieved NULL list of scheduled data from database", __FUNCTION__);
484 printf("\nX %d", res); fflush(stdout);
487 gtk_tree_view_get_selection(GTK_TREE_VIEW(mmyth_ui->mmyth_recordui->sch_treeview));
489 gtk_tree_selection_get_selected(selection, &list_store, &iter);
490 gtk_tree_model_get(list_store, &iter, 4, &index, -1);
492 mmyth_ui_set_widget (mmyth_ui, mmyth_ui->schedule_uicommon);
494 if (!(mmyth_ui->schedule_uicommon))
495 mmyth_ui->schedule_uicommon = create_schedule_view(mmyth_ui);
497 schedule_list = g_list_nth(schedule_list, atoi(gtk_tree_path_to_string(path)));
498 schedule_info = (ScheduleInfo*) schedule_list->data;
500 printf("\nstarttime: %ld", schedule_info->start_time); fflush(stdout);
503 static MMythUiCommon *
504 create_schedule_view (MMythUi * mmyth_ui)
506 MMythUiCommon *ui_common;
507 GtkWidget *schedule_widget;
509 g_debug ("Creating Schedule UI Common");
511 mmyth_ui->mmyth_schedulerui = mmyth_schedulerui_new ();
512 if (mmyth_ui->mmyth_schedulerui == NULL) {
513 g_warning ("[%s] Error while creating scheduler ui", __FUNCTION__);
517 schedule_widget = mmyth_ui->mmyth_schedulerui->main_widget;
519 gtk_widget_show_all (schedule_widget);
520 g_object_ref (schedule_widget);
522 ui_common = mmyth_uicommon_new (schedule_widget,
527 g_signal_connect (G_OBJECT (ui_common->button1), "clicked",
528 G_CALLBACK (cb_save_new_schedule), mmyth_ui);
529 g_signal_connect (G_OBJECT (ui_common->button2), "clicked",
530 G_CALLBACK (cb_not_impl_button), mmyth_ui);
531 g_signal_connect (G_OBJECT (ui_common->button3), "clicked",
532 G_CALLBACK (cb_record_button), mmyth_ui);
536 /******************************************************************************
537 * RECORD VIEW METHODS *
538 ******************************************************************************/
540 cb_record_button (GtkButton * button, gpointer user_data)
542 MMythUi *mmyth_ui = (MMythUi *) user_data;
544 if (!(mmyth_ui->record_uicommon)) {
545 mmyth_ui->record_uicommon = create_record_view (mmyth_ui);
546 mmyth_ui->schedule_uicommon = create_schedule_view (mmyth_ui);
549 mmyth_recordui_reload_all (mmyth_ui->mmyth_recordui);
551 mmyth_ui_set_widget (mmyth_ui, mmyth_ui->record_uicommon);
556 cb_record_close_button (GtkButton * button, gpointer user_data)
558 MMythUi *mmyth_ui = (MMythUi *) user_data;
560 mmyth_ui_set_widget(mmyth_ui, mmyth_ui->main_uicommon);
562 mmyth_recordui_free(mmyth_ui->mmyth_recordui);
564 if (mmyth_ui->record_uicommon) {
565 gtk_widget_destroy (mmyth_ui->record_uicommon->main_widget);
566 mmyth_uicommon_free(mmyth_ui->record_uicommon);
567 mmyth_ui->record_uicommon = NULL;
570 if (mmyth_ui->schedule_uicommon) {
571 // mmyth_uicommon_free(mmyth_ui->schedule_uicommon);
579 play_selected_recorded (gpointer user_data)
581 MMythUi *mmyth_ui = (MMythUi *) user_data;
582 gboolean res = FALSE;
584 gchar *path = mmyth_recordui_get_selected_recorded (mmyth_ui->mmyth_recordui);
587 // This should never happens. Play button is just activated when
588 // a recording is selected.
589 g_warning ("[%s] Play button pressed while none recorded is selected", __FUNCTION__);
593 if (!(mmyth_ui->video_uicommon))
594 mmyth_ui->video_uicommon = create_video_view (mmyth_ui);
596 // Creates the tv player that will retrieve the mythtv content, decode and show it
597 mmyth_ui->tvplayer = mmyth_tvplayer_new ();
598 g_debug ("[%s] New TV Player created: %d\n", __FUNCTION__, (int) (mmyth_ui->tvplayer));
599 res = mmyth_tvplayer_initialize (mmyth_ui->tvplayer);
601 g_warning ("[%s] Could not initialize tvplayer", __FUNCTION__);
603 g_object_unref (mmyth_ui->tvplayer);
604 mmyth_ui->tvplayer = NULL;
606 GtkWidget *dialog = gtk_message_dialog_new (
607 GTK_WINDOW(mmyth_ui->main_window),
608 GTK_DIALOG_DESTROY_WITH_PARENT,
611 "MMyth found errors while starting TV Player, please check "
612 "the GStreamer installation");
614 gtk_dialog_run (GTK_DIALOG (dialog));
615 gtk_widget_destroy (dialog);
620 res = mmyth_tvplayer_record_setup (mmyth_ui->tvplayer, path);
622 if (mmyth_ui && mmyth_ui->tvplayer && res) {
623 mmyth_tvplayer_set_widget (mmyth_ui->tvplayer, mmyth_ui->videow);
624 mmyth_tvplayer_start_playing (mmyth_ui->tvplayer);
626 // TODO: Show Alert with error description!
627 g_warning ("[%s] MMythUI can't initialize tv_player", __FUNCTION__);
628 g_object_unref (mmyth_ui->tvplayer);
629 mmyth_ui->tvplayer = NULL;
630 // FIXME: Show the exact error that happened
631 GtkWidget *dialog = gtk_message_dialog_new (
632 GTK_WINDOW(mmyth_ui->main_window),
633 GTK_DIALOG_DESTROY_WITH_PARENT,
636 "Error while starting TV Player, please check if the backend"
637 " is running properly and a tv card is available!");
638 gtk_dialog_run (GTK_DIALOG (dialog));
639 gtk_widget_destroy (dialog);
643 mmyth_ui_set_widget (mmyth_ui, mmyth_ui->video_uicommon);
647 cb_play_clicked_recorded (GtkTreeView * tree_view, GtkTreePath *path,
648 GtkTreeViewColumn *column, gpointer user_data)
650 play_selected_recorded (user_data);
654 cb_play_selected (GtkButton * button, gpointer user_data)
656 play_selected_recorded (user_data);
660 cb_schedule_button (GtkButton * button, gpointer user_data)
662 MMythUi *mmyth_ui = (MMythUi *) user_data;
664 mmyth_ui_set_widget (mmyth_ui, mmyth_ui->schedule_uicommon);
668 cb_switch_page (GtkNotebook *notebook, GtkNotebookPage *page,
669 guint page_num, gpointer user_data)
671 MMythUi *mmyth_ui = (MMythUi *) user_data;
672 MMythUiCommon *ui_common;
675 assert (mmyth_ui->record_uicommon);
677 ui_common = mmyth_ui->record_uicommon;
679 if (page_num == 0) { // Switched to Schedule list
680 gtk_button_set_label (GTK_BUTTON (ui_common->button1), "New");
681 g_signal_handlers_disconnect_by_func (
682 G_OBJECT (ui_common->button1), G_CALLBACK (cb_play_selected), mmyth_ui);
683 g_signal_connect (G_OBJECT (ui_common->button1), "clicked",
684 G_CALLBACK (cb_schedule_button), mmyth_ui);
685 } else if (page_num == 1) {
686 gtk_button_set_label (GTK_BUTTON (ui_common->button1), "Play");
687 g_signal_handlers_disconnect_by_func (
688 G_OBJECT (ui_common->button1), G_CALLBACK (cb_schedule_button), mmyth_ui);
689 g_signal_connect (G_OBJECT (ui_common->button1), "clicked",
690 G_CALLBACK (cb_play_selected), mmyth_ui);
695 static MMythUiCommon *
696 create_record_view (MMythUi * mmyth_ui)
698 MMythUiCommon *ui_common;
700 g_debug ("Creating Record UI Common");
702 mmyth_ui->mmyth_recordui = mmyth_recordui_new ();
704 // FIXME: Change MMythRecordUI to a GtkWidget child and avoid this call!
705 gtk_widget_show_all (mmyth_ui->mmyth_recordui->scrolled_window);
707 ui_common = mmyth_uicommon_new (mmyth_ui->mmyth_recordui->scrolled_window, "New", "Delete", "<<Back");
708 g_object_ref (mmyth_ui->mmyth_recordui->scrolled_window);
711 g_signal_connect (G_OBJECT (ui_common->button1), "clicked",
712 G_CALLBACK (cb_schedule_button), mmyth_ui);
713 g_signal_connect (G_OBJECT (ui_common->button2), "clicked",
714 G_CALLBACK (mmyth_recordui_delete_selected), mmyth_ui->mmyth_recordui);
715 g_signal_connect (G_OBJECT (ui_common->button3), "clicked",
716 G_CALLBACK (cb_record_close_button), mmyth_ui);
717 g_signal_connect (G_OBJECT (mmyth_ui->mmyth_recordui->notebook),
718 "switch-page", G_CALLBACK (cb_switch_page), mmyth_ui);
719 g_signal_connect (G_OBJECT (mmyth_ui->mmyth_recordui->rec_treeview),
720 "row-activated", G_CALLBACK (cb_play_clicked_recorded), mmyth_ui);
721 g_signal_connect (G_OBJECT (mmyth_ui->mmyth_recordui->sch_treeview),
722 "row-activated", G_CALLBACK (cb_edit_scheduled), mmyth_ui);
727 /******************************************************************************
728 * GST VIDEO WIDGET METHODS *
729 *****************************************************************************/
732 cb_video_close_button (GtkButton * button, gpointer user_data)
734 MMythUi *mmyth_ui = (MMythUi *) user_data;
736 g_debug ("MMythUI video close button pressed");
738 if (mmyth_ui && mmyth_ui->tvplayer) {
739 mmyth_tvplayer_stop_playing (mmyth_ui->tvplayer);
741 g_object_unref (mmyth_ui->tvplayer);
742 mmyth_ui->tvplayer = NULL;
744 g_warning ("cb_video_close_button called with NULL pointer\n");
747 mmyth_ui_set_widget (mmyth_ui, mmyth_ui->main_uicommon);
751 static MMythUiCommon *
752 create_video_view (MMythUi * mmyth_ui)
755 MMythUiCommon *ui_common;
757 g_debug ("Creating Video UI Common");
759 /* Creates widget to be user by MMythTVPlayer to draw the video */
760 mmyth_ui->videow = gtk_drawing_area_new ();
761 // FIXME: Get the widget size from settings
762 gtk_widget_set_size_request (mmyth_ui->videow, 300, 240);
764 //mmiptv_ui->logo = gdk_pixbuf_new_from_file ("logo.png", NULL);
766 // Creates an alignment to place the video widget inside
767 mmyth_ui->video_alignment = gtk_alignment_new (0.5, 0.5, 1, 1);
768 gtk_widget_hide (mmyth_ui->video_alignment);
770 gtk_container_add (GTK_CONTAINER (mmyth_ui->video_alignment),
773 /* Add the gst video widget to hbox. It should never be removed. */
774 /* FIXME: mmyth_ui->video_alignment == NULL when mmyth_player_init fails */
775 if((mmyth_ui->main_hbox != NULL) && (mmyth_ui->video_alignment != NULL)) {
776 gtk_box_pack_start (GTK_BOX (mmyth_ui->main_hbox),
777 mmyth_ui->video_alignment, TRUE, TRUE, 0);
779 g_warning ("[%s] Error while adding video_alignment to main widget", __FUNCTION__);
782 g_object_ref (mmyth_ui->videow);
783 g_object_ref (mmyth_ui->video_alignment);
785 ui_common = mmyth_uicommon_new (mmyth_ui->video_alignment,
786 " Full\nScreen", "Other\nServices",
790 g_signal_connect (G_OBJECT (ui_common->button1), "clicked",
791 G_CALLBACK (cb_not_impl_button), mmyth_ui);
792 g_signal_connect (G_OBJECT (ui_common->button2), "clicked",
793 G_CALLBACK (cb_not_impl_button), mmyth_ui);
794 g_signal_connect (G_OBJECT (ui_common->button3), "clicked",
795 G_CALLBACK (cb_video_close_button), mmyth_ui);
798 g_debug ("Video UI_Common sucessfull created");
806 mmyth_ui_get_video_widget (MMythUi *mmyth_ui) {
808 if (mmyth_ui && mmyth_ui->videow) {
810 return mmyth_ui->videow;