[svn r804] Added function to retrieve backend details (total space, free space, etc)
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"
22 * GMyth library includes
25 #ifndef MAEMO_PLATFORM
26 static gint button_press_handler(GtkWidget * widget, GdkEvent * event);
29 static MMythUiCommon *create_main_view(MMythUi * mmyth_ui);
30 static MMythUiCommon *create_video_view(MMythUi * mmyth_ui);
31 static MMythUiCommon *create_epg_grid_view(MMythUi * mmyth_ui);
32 static MMythUiCommon *create_record_view(MMythUi * mmyth_ui);
33 static MMythUiCommon *create_schedule_view(MMythUi * mmyth_ui);
35 static void cb_video_close_button(GtkButton * button,
37 static void cb_record_button(GtkButton * button, gpointer user_data);
38 static void cb_menu_item_settings(GtkMenuItem * menuitem,
42 * main box from button box separator
44 static GtkWidget *main_vseparator = NULL;
46 GdkPixbuf *icon_sports,
52 #ifndef MAEMO_PLATFORM
56 static MMythUi *popup_mmyth_ui;
62 HildonProgram * program,
64 GtkWidget * main_window)
68 mmyth_ui = g_new0(MMythUi, 1);
70 mmyth_ui->backend_info =
71 gmyth_backend_info_new_full("localhost", "mythtv", "mythtv",
74 mmyth_ui->main_window = main_window;
75 mmyth_ui->videow = NULL;
76 mmyth_ui->mmyth_recordui = NULL;
77 mmyth_ui->mmyth_schedulerui = NULL;
80 * Horizontal box that divides the view into control and video area
82 mmyth_ui->main_hbox = gtk_hbox_new(FALSE, 0);
83 gtk_widget_show(mmyth_ui->main_hbox);
84 g_object_ref(mmyth_ui->main_hbox);
86 main_bg_color.red = 65000;
87 main_bg_color.green = 65000;
88 main_bg_color.blue = 65000;
91 #ifndef MAEMO_PLATFORM
95 popup_mmyth_ui = mmyth_ui;
96 g_signal_connect(G_OBJECT(mmyth_ui->main_hbox), "event",
97 G_CALLBACK(button_press_handler),
98 G_OBJECT(mmyth_ui->main_hbox));
100 #else // #ifdef MAEMO
102 mmyth_ui->main_menu = GTK_MENU(gtk_menu_new());
103 hildon_program_set_common_menu(program, mmyth_ui->main_menu);
105 mmyth_ui->menu_setup = gtk_menu_item_new_with_label("Setup");
106 gtk_widget_set_size_request(GTK_WIDGET(mmyth_ui->menu_setup), 150, 40);
107 gtk_menu_append(mmyth_ui->main_menu, mmyth_ui->menu_setup);
109 g_signal_connect(G_OBJECT(mmyth_ui->menu_setup), "activate",
110 G_CALLBACK(cb_menu_item_settings), mmyth_ui);
112 gtk_widget_show_all(GTK_WIDGET(mmyth_ui->main_menu));
115 // Main widget is mmyth_ui->main_hbox
116 mmyth_ui->main_uicommon = create_main_view(mmyth_ui);
118 gtk_container_add(GTK_CONTAINER(mmyth_ui->main_window),
119 mmyth_ui->main_hbox);
121 mmyth_ui_set_widget(mmyth_ui, mmyth_ui->main_uicommon);
127 mmyth_ui_finalize(MMythUi * mmyth_ui)
129 if (mmyth_ui != NULL) {
130 if (mmyth_ui->main_uicommon)
131 mmyth_uicommon_free(mmyth_ui->main_uicommon);
132 if (mmyth_ui->video_uicommon)
133 mmyth_uicommon_free(mmyth_ui->video_uicommon);
134 if (mmyth_ui->epg_grid_uicommon)
135 mmyth_uicommon_free(mmyth_ui->epg_grid_uicommon);
136 if (mmyth_ui->record_uicommon)
137 mmyth_uicommon_free(mmyth_ui->record_uicommon);
138 if (mmyth_ui->schedule_uicommon)
139 mmyth_uicommon_free(mmyth_ui->schedule_uicommon);
146 mmyth_ui_set_widget(MMythUi * mmyth_ui, MMythUiCommon * new_uicommon)
148 if (new_uicommon == NULL) {
149 g_warning("MMythUI setting a NULL UI_Common as current display\n");
153 if (mmyth_ui->current_uicommon) {
154 if (mmyth_ui->current_uicommon == mmyth_ui->video_uicommon) {
155 gtk_widget_hide(mmyth_ui->current_uicommon->main_widget);
156 gtk_widget_hide(mmyth_ui->videow);
158 gtk_container_remove(GTK_CONTAINER(mmyth_ui->main_hbox),
159 mmyth_ui->current_uicommon->main_widget);
162 gtk_container_remove(GTK_CONTAINER(mmyth_ui->main_hbox),
163 mmyth_ui->current_uicommon->event_box);
164 gtk_container_remove(GTK_CONTAINER(mmyth_ui->main_hbox),
169 if (new_uicommon->main_widget == mmyth_ui->video_alignment) {
170 // gst_player_video_show (GST_PLAYER_VIDEO(mmyth_ui->videow));
171 gtk_widget_show(mmyth_ui->video_alignment);
172 gtk_widget_show(mmyth_ui->videow);
175 * FIXME: Fst call is NULL when mmyth_player_init fails
177 if (mmyth_ui->video_alignment != NULL)
178 gtk_widget_hide(mmyth_ui->video_alignment);
180 * FIXME: Fst call is NULL when mmyth_player_init fails
182 if (mmyth_ui->videow != NULL)
183 gtk_widget_hide(mmyth_ui->videow);
185 gtk_box_pack_start(GTK_BOX(mmyth_ui->main_hbox),
186 new_uicommon->main_widget, TRUE, TRUE, 0);
189 if (main_vseparator == NULL) {
191 * FIXME: should free this variable
193 main_vseparator = gtk_vseparator_new();
194 g_object_ref(main_vseparator);
196 gtk_box_pack_start(GTK_BOX(mmyth_ui->main_hbox),
197 main_vseparator, FALSE, FALSE, 0);
198 gtk_widget_show(main_vseparator);
200 gtk_box_pack_end(GTK_BOX(mmyth_ui->main_hbox), new_uicommon->event_box,
203 mmyth_ui->current_uicommon = new_uicommon;
208 * The close callback is the same for all windows
211 cb_not_impl_button(GtkButton * button, gpointer user_data)
213 MMythUi *mmyth_ui = (MMythUi *) user_data;
215 GtkWidget *msg_dialog =
216 gtk_message_dialog_new(GTK_WINDOW(mmyth_ui->main_window),
218 GTK_DIALOG_DESTROY_WITH_PARENT,
221 "Feature not implemented");
222 gtk_widget_set_size_request(msg_dialog, 350, 120);
224 gtk_dialog_run(GTK_DIALOG(msg_dialog));
226 gtk_widget_destroy(GTK_WIDGET(msg_dialog));
229 /******************************************************************************
230 * POPUP MENU WIDGET METHODS *
231 *****************************************************************************/
234 cb_menu_item_settings(GtkMenuItem * menuitem, gpointer user_data)
237 MMythUi *mmyth_ui = (MMythUi *) user_data;
239 if (mmyth_uisettings_run(GTK_WINDOW(mmyth_ui->main_window))) {
240 // If user changes the settings, we restart the context
241 g_debug("[%s] Restarting mmyth_context to new settings",
243 // gmyth_context_initialize();
247 #ifndef MAEMO_PLATFORM
250 detacher(GtkWidget * attach_widget, GtkMenu * menu)
256 do_popup_menu(GtkWidget * my_widget, GdkEventButton * event)
263 GtkWidget *item_general;
266 popup = gtk_menu_new();
268 item_general = gtk_image_menu_item_new_with_mnemonic("Setup");
269 gtk_widget_show(item_general);
270 gtk_container_add(GTK_CONTAINER(popup), item_general);
272 image = gtk_image_new_from_stock("gtk-edit", GTK_ICON_SIZE_MENU);
273 gtk_widget_show(image);
274 gtk_image_menu_item_set_image(GTK_IMAGE_MENU_ITEM(item_general),
277 g_signal_connect(G_OBJECT(item_general), "activate",
278 G_CALLBACK(cb_menu_item_settings), popup_mmyth_ui);
281 button = event->button;
282 event_time = event->time;
285 event_time = gtk_get_current_event_time();
288 gtk_menu_attach_to_widget(GTK_MENU(popup), my_widget, detacher);
289 gtk_menu_popup(GTK_MENU(popup), NULL, NULL, NULL, NULL,
291 gtk_widget_show_all(popup);
295 * Respond to a button-press by posting a menu passed in as widget. Note
296 * that the "widget" argument is the menu being posted, NOT the button
300 button_press_handler(GtkWidget * widget, GdkEvent * event)
303 if (event->type == GDK_BUTTON_PRESS) {
304 GdkEventButton *bevent = (GdkEventButton *) event;
306 * Ignore double-clicks and triple-clicks
308 if (bevent->button == 3) {
309 do_popup_menu(widget, bevent);
315 * Tell calling code that we have not handled this event; pass it on.
321 /******************************************************************************
322 * MAIN APP VIEW METHODS *
323 *****************************************************************************/
326 cb_close_button(GtkButton * button, gpointer user_data)
328 MMythUi *mmyth_ui = (MMythUi *) user_data;
330 mmyth_ui_set_widget(mmyth_ui, mmyth_ui->main_uicommon);
334 cb_watch_tv_button(GtkButton * button, gpointer user_data)
336 MMythUi *mmyth_ui = (MMythUi *) user_data;
337 gboolean res = FALSE;
339 if (!(mmyth_ui->video_uicommon))
340 mmyth_ui->video_uicommon = create_video_view(mmyth_ui);
342 // Creates the tv player that will retrieve the mythtv content, decode
344 mmyth_ui->tvplayer = mmyth_tvplayer_new();
346 * choose here if this is a LiveTV session
348 mmyth_ui->tvplayer->is_livetv = TRUE;
351 mmyth_tvplayer_initialize(mmyth_ui->tvplayer,
352 mmyth_ui->backend_info);
355 g_warning("[%s] Could not initialize tvplayer", __FUNCTION__);
357 g_object_unref(mmyth_ui->tvplayer);
358 mmyth_ui->tvplayer = NULL;
361 gtk_message_dialog_new(GTK_WINDOW(mmyth_ui->main_window),
362 GTK_DIALOG_DESTROY_WITH_PARENT,
365 "MMyth found errors while starting TV Player, please check "
366 "the GStreamer installation");
368 gtk_dialog_run(GTK_DIALOG(dialog));
369 gtk_widget_destroy(dialog);
373 // res = mmyth_tvplayer_livetv_setup (mmyth_ui->tvplayer);
375 if (mmyth_ui && mmyth_ui->tvplayer && res) {
376 mmyth_tvplayer_set_widget(mmyth_ui->tvplayer, mmyth_ui->videow);
377 mmyth_tvplayer_start_playing(mmyth_ui->tvplayer);
379 // TODO: Show Alert with error description!
380 g_warning("[%s] MMythUI can't initialize tv_player", __FUNCTION__);
381 g_object_unref(mmyth_ui->tvplayer);
382 mmyth_ui->tvplayer = NULL;
383 // FIXME: Show the exact error that happened
385 gtk_message_dialog_new(GTK_WINDOW(mmyth_ui->main_window),
386 GTK_DIALOG_DESTROY_WITH_PARENT,
389 "Error while starting TV Player, please check if the backend"
390 " is running properly and a tv card is available!");
391 gtk_dialog_run(GTK_DIALOG(dialog));
392 gtk_widget_destroy(dialog);
395 mmyth_ui_set_widget(mmyth_ui, mmyth_ui->video_uicommon);
400 cb_epg_button(GtkButton * button, gpointer user_data)
402 MMythUi *mmyth_ui = (MMythUi *) user_data;
404 if (!(mmyth_ui->epg_grid_uicommon))
405 mmyth_ui->epg_grid_uicommon = create_epg_grid_view(mmyth_ui);
407 mmyth_ui_set_widget(mmyth_ui, mmyth_ui->epg_grid_uicommon);
410 static MMythUiCommon *
411 create_main_view(MMythUi * mmyth_ui)
413 MMythUiCommon *ui_common;
414 GtkWidget *main_widget;
417 g_debug("Creating Main UI Common");
421 image = gtk_image_new_from_file("../pixmaps/mmyth_logo.png");
423 image = gtk_image_new_from_file(PIX_DIR "mmyth_logo.png");
426 main_widget = gtk_event_box_new();
428 gtk_container_add(GTK_CONTAINER(main_widget), image);
431 gtk_widget_show_all(main_widget);
432 g_object_ref(main_widget);
434 ui_common = mmyth_uicommon_new(main_widget,
435 "Watch TV", "EPG", "Recording");
441 g_signal_connect(G_OBJECT(ui_common->button1), "clicked",
442 G_CALLBACK(cb_watch_tv_button), mmyth_ui);
443 g_signal_connect(G_OBJECT(ui_common->button2), "clicked",
444 G_CALLBACK(cb_epg_button), mmyth_ui);
445 g_signal_connect(G_OBJECT(ui_common->button3), "clicked",
446 G_CALLBACK(cb_record_button), mmyth_ui);
452 /******************************************************************************
453 * epg GRID VIEW METHODS *
454 *****************************************************************************/
456 static MMythUiCommon *
457 create_epg_grid_view(MMythUi * mmyth_ui)
459 MMythUiCommon *ui_common;
461 g_debug("Creating EPG Grid UI Common");
463 GtkWidget *epg_grid_view =
464 GTK_WIDGET(epg_grid_view_new(mmyth_ui));
466 ui_common = mmyth_uicommon_new(epg_grid_view,
467 "Play", "Record", "Close");
472 g_signal_connect(G_OBJECT(ui_common->button1), "clicked",
473 G_CALLBACK(cb_not_impl_button), mmyth_ui);
474 g_signal_connect(G_OBJECT(ui_common->button2), "clicked",
475 G_CALLBACK(cb_record_button), mmyth_ui);
476 g_signal_connect(G_OBJECT(ui_common->button3), "clicked",
477 G_CALLBACK(cb_close_button), mmyth_ui);
481 /******************************************************************************
482 * SCHEDULE VIEW METHODS *
483 ******************************************************************************/
486 cb_save_new_schedule(GtkButton * button, gpointer user_data)
488 MMythUi *mmyth_ui = (MMythUi *) user_data;
490 if (!(mmyth_ui->schedule_uicommon))
491 mmyth_ui->schedule_uicommon = create_schedule_view(mmyth_ui);
493 mmyth_schedulerui_save(mmyth_ui->mmyth_schedulerui);
495 mmyth_recordui_reload_schedule(mmyth_ui->mmyth_recordui);
497 mmyth_ui_set_widget(mmyth_ui, mmyth_ui->record_uicommon);
502 cb_edit_scheduled(GtkTreeView * tree_view, GtkTreePath * path,
503 GtkTreeViewColumn * column, gpointer user_data)
505 MMythUi *mmyth_ui = (MMythUi *) user_data;
506 GtkTreeSelection *selection;
507 GtkTreeModel *list_store;
510 // gint new_row = 0, record_id = 0;
511 ScheduleInfo *schedule_info;
512 GList *schedule_list;
516 // gtk_tree_store_clear(recordui->sch_tree_store);
519 gmyth_scheduler_get_schedule_list(mmyth_ui->mmyth_recordui->
520 scheduler, &(schedule_list));
523 ("[%s] Retrieved NULL list of scheduled data from database",
527 printf("\nX %d", res);
531 gtk_tree_view_get_selection(GTK_TREE_VIEW
532 (mmyth_ui->mmyth_recordui->
535 gtk_tree_selection_get_selected(selection, &list_store, &iter);
536 gtk_tree_model_get(list_store, &iter, 4, &index, -1);
538 mmyth_ui_set_widget(mmyth_ui, mmyth_ui->schedule_uicommon);
540 if (!(mmyth_ui->schedule_uicommon))
541 mmyth_ui->schedule_uicommon = create_schedule_view(mmyth_ui);
544 g_list_nth(schedule_list,
545 g_ascii_strtoull(gtk_tree_path_to_string(path), NULL,
547 schedule_info = (ScheduleInfo *) schedule_list->data;
549 printf("\nstarttime: %ld", schedule_info->start_time->tv_sec);
553 static MMythUiCommon *
554 create_schedule_view(MMythUi * mmyth_ui)
556 MMythUiCommon *ui_common;
557 GtkWidget *schedule_widget;
559 g_debug("Creating Schedule UI Common");
561 mmyth_ui->mmyth_schedulerui =
562 mmyth_schedulerui_new(mmyth_ui->backend_info);
563 if (mmyth_ui->mmyth_schedulerui == NULL) {
564 g_warning("[%s] Error while creating scheduler ui", __FUNCTION__);
568 schedule_widget = mmyth_ui->mmyth_schedulerui->main_widget;
570 gtk_widget_show_all(schedule_widget);
571 g_object_ref(schedule_widget);
573 ui_common = mmyth_uicommon_new(schedule_widget,
574 "Save", "Clear", "Cancel");
579 g_signal_connect(G_OBJECT(ui_common->button1), "clicked",
580 G_CALLBACK(cb_save_new_schedule), mmyth_ui);
581 g_signal_connect(G_OBJECT(ui_common->button2), "clicked",
582 G_CALLBACK(cb_not_impl_button), mmyth_ui);
583 g_signal_connect(G_OBJECT(ui_common->button3), "clicked",
584 G_CALLBACK(cb_record_button), mmyth_ui);
588 /******************************************************************************
589 * RECORD VIEW METHODS *
590 ******************************************************************************/
592 cb_record_button(GtkButton * button, gpointer user_data)
594 MMythUi *mmyth_ui = (MMythUi *) user_data;
596 if (!(mmyth_ui->record_uicommon)) {
597 mmyth_ui->record_uicommon = create_record_view(mmyth_ui);
598 mmyth_ui->schedule_uicommon = create_schedule_view(mmyth_ui);
601 mmyth_recordui_reload_all(mmyth_ui->mmyth_recordui);
603 mmyth_ui_set_widget(mmyth_ui, mmyth_ui->record_uicommon);
608 cb_record_close_button(GtkButton * button, gpointer user_data)
610 MMythUi *mmyth_ui = (MMythUi *) user_data;
612 mmyth_ui_set_widget(mmyth_ui, mmyth_ui->main_uicommon);
614 mmyth_recordui_free(mmyth_ui->mmyth_recordui);
616 if (mmyth_ui->record_uicommon) {
617 gtk_widget_destroy(mmyth_ui->record_uicommon->main_widget);
618 mmyth_uicommon_free(mmyth_ui->record_uicommon);
619 mmyth_ui->record_uicommon = NULL;
622 if (mmyth_ui->schedule_uicommon) {
623 // mmyth_uicommon_free(mmyth_ui->schedule_uicommon);
631 play_selected_recorded(gpointer user_data)
633 MMythUi *mmyth_ui = (MMythUi *) user_data;
634 gboolean res = FALSE;
637 mmyth_recordui_get_selected_recorded(mmyth_ui->mmyth_recordui);
640 // This should never happens. Play button is just activated when
641 // a recording is selected.
643 ("[%s] Play button pressed while none recorded is selected",
648 if (!(mmyth_ui->video_uicommon))
649 mmyth_ui->video_uicommon = create_video_view(mmyth_ui);
651 // Creates the tv player that will retrieve the mythtv content, decode
653 mmyth_ui->tvplayer = mmyth_tvplayer_new();
654 g_debug("[%s] New TV Player created: %d\n", __FUNCTION__,
655 (int) (mmyth_ui->tvplayer));
657 mmyth_tvplayer_initialize(mmyth_ui->tvplayer,
658 mmyth_ui->backend_info);
660 g_warning("[%s] Could not initialize tvplayer", __FUNCTION__);
662 g_object_unref(mmyth_ui->tvplayer);
663 mmyth_ui->tvplayer = NULL;
666 gtk_message_dialog_new(GTK_WINDOW(mmyth_ui->main_window),
667 GTK_DIALOG_DESTROY_WITH_PARENT,
670 "MMyth found errors while starting TV Player, please check "
671 "the GStreamer installation");
673 gtk_dialog_run(GTK_DIALOG(dialog));
674 gtk_widget_destroy(dialog);
679 res = mmyth_tvplayer_record_setup(mmyth_ui->tvplayer, path);
681 if (mmyth_ui && mmyth_ui->tvplayer && res) {
682 mmyth_tvplayer_set_widget(mmyth_ui->tvplayer, mmyth_ui->videow);
683 mmyth_tvplayer_start_playing(mmyth_ui->tvplayer);
685 // TODO: Show Alert with error description!
686 g_warning("[%s] MMythUI can't initialize tv_player", __FUNCTION__);
687 g_object_unref(mmyth_ui->tvplayer);
688 mmyth_ui->tvplayer = NULL;
689 // FIXME: Show the exact error that happened
691 gtk_message_dialog_new(GTK_WINDOW(mmyth_ui->main_window),
692 GTK_DIALOG_DESTROY_WITH_PARENT,
695 "Error while starting TV Player, please check if the backend"
696 " is running properly and a tv card is available!");
697 gtk_dialog_run(GTK_DIALOG(dialog));
698 gtk_widget_destroy(dialog);
702 mmyth_ui_set_widget(mmyth_ui, mmyth_ui->video_uicommon);
706 cb_play_clicked_recorded(GtkTreeView * tree_view, GtkTreePath * path,
707 GtkTreeViewColumn * column, gpointer user_data)
709 play_selected_recorded(user_data);
713 cb_play_selected(GtkButton * button, gpointer user_data)
715 play_selected_recorded(user_data);
719 cb_schedule_button(GtkButton * button, gpointer user_data)
721 MMythUi *mmyth_ui = (MMythUi *) user_data;
723 mmyth_ui_set_widget(mmyth_ui, mmyth_ui->schedule_uicommon);
727 cb_switch_page(GtkNotebook * notebook, GtkNotebookPage * page,
728 guint page_num, gpointer user_data)
730 MMythUi *mmyth_ui = (MMythUi *) user_data;
731 MMythUiCommon *ui_common;
734 assert(mmyth_ui->record_uicommon);
736 ui_common = mmyth_ui->record_uicommon;
738 if (page_num == 0) { // Switched to Schedule list
739 gtk_button_set_label(GTK_BUTTON(ui_common->button1), "New");
740 g_signal_handlers_disconnect_by_func(G_OBJECT(ui_common->button1),
741 G_CALLBACK(cb_play_selected),
743 g_signal_connect(G_OBJECT(ui_common->button1), "clicked",
744 G_CALLBACK(cb_schedule_button), mmyth_ui);
745 } else if (page_num == 1) {
746 gtk_button_set_label(GTK_BUTTON(ui_common->button1), "Play");
747 g_signal_handlers_disconnect_by_func(G_OBJECT(ui_common->button1),
749 (cb_schedule_button),
751 g_signal_connect(G_OBJECT(ui_common->button1), "clicked",
752 G_CALLBACK(cb_play_selected), mmyth_ui);
757 static MMythUiCommon *
758 create_record_view(MMythUi * mmyth_ui)
760 MMythUiCommon *ui_common;
762 g_debug("Creating Record UI Common");
764 mmyth_ui->mmyth_recordui = mmyth_recordui_new(mmyth_ui->backend_info);
766 // FIXME: Change MMythRecordUI to a GtkWidget child and avoid this
768 gtk_widget_show_all(mmyth_ui->mmyth_recordui->scrolled_window);
771 mmyth_uicommon_new(mmyth_ui->mmyth_recordui->scrolled_window,
772 "New", "Delete", "<<Back");
773 g_object_ref(mmyth_ui->mmyth_recordui->scrolled_window);
778 g_signal_connect(G_OBJECT(ui_common->button1), "clicked",
779 G_CALLBACK(cb_schedule_button), mmyth_ui);
780 g_signal_connect(G_OBJECT(ui_common->button2), "clicked",
781 G_CALLBACK(mmyth_recordui_delete_selected),
782 mmyth_ui->mmyth_recordui);
783 g_signal_connect(G_OBJECT(ui_common->button3), "clicked",
784 G_CALLBACK(cb_record_close_button), mmyth_ui);
785 g_signal_connect(G_OBJECT(mmyth_ui->mmyth_recordui->notebook),
786 "switch-page", G_CALLBACK(cb_switch_page), mmyth_ui);
787 g_signal_connect(G_OBJECT(mmyth_ui->mmyth_recordui->rec_treeview),
788 "row-activated", G_CALLBACK(cb_play_clicked_recorded),
790 g_signal_connect(G_OBJECT(mmyth_ui->mmyth_recordui->sch_treeview),
791 "row-activated", G_CALLBACK(cb_edit_scheduled),
797 /******************************************************************************
798 * GST VIDEO WIDGET METHODS *
799 *****************************************************************************/
802 cb_video_close_button(GtkButton * button, gpointer user_data)
804 MMythUi *mmyth_ui = (MMythUi *) user_data;
806 g_debug("MMythUI video close button pressed");
808 if (mmyth_ui && mmyth_ui->tvplayer) {
809 mmyth_tvplayer_stop_playing(mmyth_ui->tvplayer);
811 g_object_unref(mmyth_ui->tvplayer);
812 mmyth_ui->tvplayer = NULL;
814 g_warning("cb_video_close_button called with NULL pointer\n");
817 mmyth_ui_set_widget(mmyth_ui, mmyth_ui->main_uicommon);
821 static MMythUiCommon *
822 create_video_view(MMythUi * mmyth_ui)
825 MMythUiCommon *ui_common;
827 g_debug("Creating Video UI Common");
830 * Creates widget to be user by MMythTVPlayer to draw the video
832 mmyth_ui->videow = gtk_drawing_area_new();
833 // FIXME: Get the widget size from settings
834 gtk_widget_set_size_request(mmyth_ui->videow, 300, 240);
836 // mmiptv_ui->logo = gdk_pixbuf_new_from_file ("logo.png", NULL);
838 // Creates an alignment to place the video widget inside
839 mmyth_ui->video_alignment = gtk_alignment_new(0.5, 0.5, 1, 1);
840 gtk_widget_hide(mmyth_ui->video_alignment);
842 gtk_container_add(GTK_CONTAINER(mmyth_ui->video_alignment),
846 * Add the gst video widget to hbox. It should never be removed.
849 * FIXME: mmyth_ui->video_alignment == NULL when mmyth_player_init
852 if ((mmyth_ui->main_hbox != NULL)
853 && (mmyth_ui->video_alignment != NULL)) {
854 gtk_box_pack_start(GTK_BOX(mmyth_ui->main_hbox),
855 mmyth_ui->video_alignment, TRUE, TRUE, 0);
857 g_warning("[%s] Error while adding video_alignment to main widget",
861 g_object_ref(mmyth_ui->videow);
862 g_object_ref(mmyth_ui->video_alignment);
864 ui_common = mmyth_uicommon_new(mmyth_ui->video_alignment,
865 " Full\nScreen", "Other\nServices",
869 g_signal_connect(G_OBJECT(ui_common->button1), "clicked",
870 G_CALLBACK(cb_not_impl_button), mmyth_ui);
871 g_signal_connect(G_OBJECT(ui_common->button2), "clicked",
872 G_CALLBACK(cb_not_impl_button), mmyth_ui);
873 g_signal_connect(G_OBJECT(ui_common->button3), "clicked",
874 G_CALLBACK(cb_video_close_button), mmyth_ui);
877 g_debug("Video UI_Common sucessfull created");
885 mmyth_ui_get_video_widget(MMythUi * mmyth_ui)
888 if (mmyth_ui && mmyth_ui->videow) {
890 return mmyth_ui->videow;