# HG changeset patch # User renatofilho # Date 1159455734 -3600 # Node ID 7174e23f76176bd4ee93657b922a8c4b9a5d2f20 # Parent 7c409a042a9ae5590952bb9127916256d5806947 [svn r21] - created maemo-ui; diff -r 7c409a042a9a -r 7174e23f7617 gmyth/src/gmyth_tvplayer.c --- a/gmyth/src/gmyth_tvplayer.c Thu Sep 28 15:57:27 2006 +0100 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 @@ -1,684 +0,0 @@ -/** - * GMyth Library - * - * @file gmyth/gmyth_tvplayer.c - * - * @brief

This component provides playback of the remote A/V using - * GStreamer. - * - * Copyright (C) 2006 INdT - Instituto Nokia de Tecnologia. - * @author Hallyson Luiz de Morais Melo - * - *//* - * - * This program is free software; you can redistribute it and/or modify - * it under the terms of the GNU Lesser General Public License as published by - * the Free Software Foundation; either version 2 of the License, or - * (at your option) any later version. - * - * This program is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU General Public License for more details. - * - * You should have received a copy of the GNU Lesser General Public License - * along with this program; if not, write to the Free Software - * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA - */ - -#include "gmyth_tvplayer.h" - -#include - -#include "gmyth_context.h" -#include "gmyth_remote_util.h" - -typedef struct _GstPlayerWindowStateChange -{ - GstElement *play; - GstState old_state, new_state; - GMythTVPlayer *tvplayer; -} GstPlayerWindowStateChange; - -typedef struct _GstPlayerWindowTagFound -{ - GstElement *play; - GstTagList *taglist; - GMythTVPlayer *tvplayer; -} GstPlayerWindowTagFound; - -/* -static gboolean idle_state (gpointer data); -*/ -static gboolean bus_call (GstBus * bus, GstMessage * msg, gpointer data); - -static void gmyth_tvplayer_class_init (GMythTVPlayerClass *klass); -static void gmyth_tvplayer_init (GMythTVPlayer *object); - -static void gmyth_tvplayer_dispose (GObject *object); -static void gmyth_tvplayer_finalize (GObject *object); - -G_DEFINE_TYPE(GMythTVPlayer, gmyth_tvplayer, G_TYPE_OBJECT) - -static gboolean gmyth_tvplayer_create_pipeline (GMythTVPlayer* tvplayer); -static void new_pad_cb (GstElement *element, - GstPad *pad, gpointer data); - -static gboolean expose_cb (GtkWidget * widget, - GdkEventExpose * event, - gpointer user_data); - -static void -gmyth_tvplayer_class_init (GMythTVPlayerClass *klass) -{ - GObjectClass *gobject_class; - - gobject_class = (GObjectClass *) klass; - - gobject_class->dispose = gmyth_tvplayer_dispose; - gobject_class->finalize = gmyth_tvplayer_finalize; -} - -static void -new_pad_cb (GstElement *element, GstPad *pad, gpointer data) -{ - GMythTVPlayer *tvplayer = GMYTH_TVPLAYER (data); - GstPadLinkReturn ret; - char *s; - - s = gst_caps_to_string (pad->caps); - - if ( s[0] == 'a') { - ret = gst_pad_link (pad, gst_element_get_pad (tvplayer->audioqueue, "sink")); - } else { - ret = gst_pad_link (pad, gst_element_get_pad (tvplayer->videoqueue, "sink")); - } - - g_free(s); -} - -static gboolean -expose_cb (GtkWidget * widget, GdkEventExpose * event, gpointer user_data) -{ - GMythTVPlayer *tvplayer = GMYTH_TVPLAYER (user_data); - - if (tvplayer && tvplayer->videow) { - gst_x_overlay_set_xwindow_id (GST_X_OVERLAY (tvplayer->gst_videosink), - GDK_WINDOW_XWINDOW (widget->window)); - return TRUE; - } - - g_warning ("GMythTVPlayer expose called before setting video window\n"); - - return FALSE; -} - -static void -gmyth_tvplayer_init (GMythTVPlayer *tvplayer) -{ - tvplayer->gst_pipeline = NULL; - tvplayer->gst_source = NULL; - tvplayer->gst_videodec = NULL; - tvplayer->gst_videosink = NULL; - tvplayer->videoqueue = NULL; - tvplayer->audioqueue = NULL; - - /* GTKWidget for rendering the video */ - tvplayer->videow = NULL; - tvplayer->expose_handler = 0; - - tvplayer->backend_hostname = NULL; - tvplayer->backend_port = 0; - tvplayer->local_hostname = NULL; - - tvplayer->remote_encoder = NULL; - tvplayer->tvchain = NULL; - tvplayer->proginfo = NULL; -} - -static void -gmyth_tvplayer_dispose (GObject *object) -{ - - G_OBJECT_CLASS (gmyth_tvplayer_parent_class)->dispose (object); -} - -static void -gmyth_tvplayer_finalize (GObject *object) -{ - g_signal_handlers_destroy (object); - - GMythTVPlayer *tvplayer = GMYTH_TVPLAYER (object); - - g_debug ("[%s] Finalizing tvplayer", __FUNCTION__); - - if (tvplayer->videow != NULL) { - if (g_signal_handler_is_connected (tvplayer->videow, - tvplayer->expose_handler)) { - g_signal_handler_disconnect (tvplayer->videow, - tvplayer->expose_handler); - } - g_object_unref (tvplayer->videow); - } - - if ( tvplayer->remote_encoder != NULL ) - g_object_unref (tvplayer->remote_encoder); - if ( tvplayer->tvchain != NULL ) - g_object_unref (tvplayer->tvchain); - if ( tvplayer->proginfo != NULL ) - g_object_unref (tvplayer->proginfo); - - // Release Gstreamer elements - if ( tvplayer->gst_pipeline != NULL ) - g_object_unref (tvplayer->gst_pipeline); - if ( tvplayer->gst_source != NULL ) - g_object_unref (tvplayer->gst_source); - if ( tvplayer->gst_videodec != NULL ) - g_object_unref (tvplayer->gst_videodec); - if ( tvplayer->gst_videosink != NULL ) - g_object_unref (tvplayer->gst_videosink); - if ( tvplayer->videoqueue != NULL ) - g_object_unref (tvplayer->videoqueue); - if ( tvplayer->audioqueue != NULL ) - g_object_unref (tvplayer->audioqueue); - - G_OBJECT_CLASS (gmyth_tvplayer_parent_class)->finalize (object); -} - -/** Creates a new instance of GMythTVPlayer. - * - * @return a new instance of GMythTVPlayer. - */ -GMythTVPlayer * -gmyth_tvplayer_new () -{ - GMythTVPlayer *tvplayer = - GMYTH_TVPLAYER (g_object_new(GMYTH_TVPLAYER_TYPE, NULL)); - - return tvplayer; -} - -/** Initializes the tv player. - * - * @param tvplayer the object instance. - * @return gboolean TRUE if the pipeline was created - * successfully, FALSE otherwise. - */ -gboolean -gmyth_tvplayer_initialize (GMythTVPlayer *tvplayer) -{ - - if (!gmyth_tvplayer_create_pipeline (tvplayer)) { - g_warning ("[%s] Error while creating pipeline. TV Player not initialized", __FUNCTION__); - return FALSE; - } else { - g_debug ("[%s] GStreamer pipeline created", __FUNCTION__); - } - - return TRUE; -} - -/** Creates the GStreamer pipeline used by the player. - * - * @param tvplayer the object instance. - * @return gboolean TRUE if the pipeline was created - * successfully, FALSE otherwise. - */ -static gboolean -gmyth_tvplayer_create_pipeline (GMythTVPlayer* tvplayer) -{ - GstElement *pipeline; - GstElement *source, *parser; - GstElement *videodec, *videosink; -#ifndef MAEMO_PLATFORM - GstElement *audiodec, *audioconv; -#endif - GstElement *audiosink; - GstElement *videoqueue, *audioqueue; - - g_debug ("GMythTVPlayer: Setting the Gstreamer pipeline\n"); - - pipeline = gst_pipeline_new ("video-player"); - source = gst_element_factory_make ("mythtvsrc", "myth-source"); - parser = gst_element_factory_make ("ffdemux_nuv", "nuv-demux"); - - /* Gstreamer Video elements */ - videoqueue = gst_element_factory_make ("queue", "video-queue"); - videodec = gst_element_factory_make ("ffdec_mpeg4", "video-decoder"); -#ifdef MAEMO_PLATFORM - videosink = gst_element_factory_make ("sdlvideosink", "image-output"); -#else - videosink = gst_element_factory_make ("xvimagesink", "image-output"); -#endif - - /* Gstreamer Audio elements */ - audioqueue = gst_element_factory_make ("queue", "audio-queue"); -#ifdef MAEMO_PLATFORM - audiosink = gst_element_factory_make ("dspmp3sink", "audio-output"); -#else - audiodec = gst_element_factory_make ("ffdec_mp3", "audio-decoder"); - audioconv = gst_element_factory_make ("audioconvert", "audio-converter"); - audiosink = gst_element_factory_make ("alsasink", "audio-output"); -#endif - - if (!(pipeline && source && parser && videodec && videosink) || - !(videoqueue && audioqueue && audiosink)) { - /* FIXME: hanlde the error correctly */ - /* video_alignment is not being created (below) - and is causing problems to the ui */ - - tvplayer->gst_pipeline = NULL; - tvplayer->gst_videodec = NULL; - tvplayer->gst_videosink = NULL; - - g_warning ("GstElement creation error!\n"); - return FALSE; - } - -#ifndef MAEMO_PLATFORM - if (!(audiodec && audioconv)) { - g_warning ("GstElement for audio stream creation error!"); - return FALSE; - } -#endif - - - tvplayer->gst_pipeline = pipeline; - tvplayer->gst_source = source; - tvplayer->gst_videodec = videodec; - tvplayer->gst_videosink = videosink; - g_object_ref (tvplayer->gst_pipeline); - g_object_ref (tvplayer->gst_source); - g_object_ref (tvplayer->gst_videodec); - g_object_ref (tvplayer->gst_videosink); - - tvplayer->videoqueue = videoqueue; - tvplayer->audioqueue = audioqueue; - g_object_ref (tvplayer->videoqueue); - g_object_ref (tvplayer->audioqueue); - - g_object_set (G_OBJECT (videosink), "sync", TRUE, NULL); - g_object_set (G_OBJECT (audiosink), "sync", FALSE, NULL); - - gst_bus_add_watch (gst_pipeline_get_bus (GST_PIPELINE (tvplayer->gst_pipeline)), - bus_call, tvplayer); - - gst_bin_add_many (GST_BIN (pipeline), source, parser, videoqueue, - videodec, videosink, audioqueue, audiodec, audioconv, audiosink, NULL); - - { -// GstCaps *rtpcaps = gst_caps_new_simple ("application/x-rtp", NULL); -// gst_element_link_filtered(source, parser, rtpcaps); - } - - gst_element_link (source, parser); - gst_element_link_many (videoqueue, videodec, videosink, NULL); - gst_element_link_many (audioqueue, audiodec, audioconv, audiosink, NULL); - - g_signal_connect (parser, "pad-added", G_CALLBACK (new_pad_cb), tvplayer); - - return TRUE; -} - -/** Configures the backend and the tv player - * for playing the recorded content A/V. - * - * FIXME: Change filename to program info or other structure about the recorded - * - * @param tvplayer the object instance. - * @param filename the file uri of the recorded content to be played. - * @return TRUE if successfull, FALSE if any error happens. - */ -gboolean -gmyth_tvplayer_record_setup (GMythTVPlayer *tvplayer, gchar *filename) -{ - GMythSettings *msettings = gmyth_context_get_settings(); - - // FIXME: we should receive the uri instead of filename - GString *hostname = gmyth_settings_get_backend_hostname (msettings); - int port = gmyth_settings_get_backend_port(msettings); - - GString *fullpath = g_string_new ("myth://"); - g_string_append_printf (fullpath, "%s:%d/%s", hostname->str, port, filename); - - tvplayer->is_livetv = FALSE; - - g_debug ("[%s] Setting record uri to gstreamer pipeline to %s", __FUNCTION__, fullpath->str); - - g_object_set (G_OBJECT (tvplayer->gst_source), "location", - fullpath->str, NULL); - - return TRUE; -} - -/** Configures the backend and the tv player - * for playing the live tv. - * - * @param tvplayer the object instance. - * @return TRUE if successfull, FALSE if any error happens. - */ -gboolean -gmyth_tvplayer_livetv_setup (GMythTVPlayer *tvplayer) -{ - GMythSettings *msettings = gmyth_context_get_settings (); - gboolean res = TRUE; - - res = gmyth_context_check_connection(); - if (!res) { - g_warning ("[%s] LiveTV can not connect to backend", __FUNCTION__); - res = FALSE; - goto error; - } - - tvplayer->backend_hostname = gmyth_settings_get_backend_hostname(msettings); - tvplayer->backend_port = gmyth_settings_get_backend_port (msettings); - - tvplayer->local_hostname = g_string_new(""); - gmyth_context_get_local_hostname (tvplayer->local_hostname); - - if ( tvplayer->local_hostname == NULL ) { - res = FALSE; - goto error; - } - - // Gets the remote encoder num - tvplayer->remote_encoder = remote_request_next_free_recorder (-1); - - if ( tvplayer->remote_encoder == NULL ) { - g_warning ("[%s] None remote encoder available", __FUNCTION__); - res = FALSE; - goto error; - } - - // Creates livetv chain handler - tvplayer->tvchain = GMYTH_TVCHAIN ( g_object_new(GMYTH_TVCHAIN_TYPE, NULL) ); - gmyth_tvchain_initialize ( tvplayer->tvchain, tvplayer->local_hostname ); - - if ( tvplayer->tvchain == NULL || tvplayer->tvchain->tvchain_id == NULL ) { - res = FALSE; - goto error; - } - - // Init remote encoder. Opens its control socket. - res = gmyth_remote_encoder_setup(tvplayer->remote_encoder); - if ( !res ) { - g_warning ("[%s] Fail while setting remote encoder\n", __FUNCTION__); - res = FALSE; - goto error; - } - // Spawn live tv. Uses the socket to send mythprotocol data to start livetv in the backend (remotelly) - res = gmyth_remote_encoder_spawntv ( tvplayer->remote_encoder, - gmyth_tvchain_get_id(tvplayer->tvchain) ); - if (!res) { - g_warning ("[%s] Fail while spawn tv\n", __FUNCTION__); - res = FALSE; - goto error; - } - - // Reload all TV chain from Mysql database. - gmyth_tvchain_reload_all (tvplayer->tvchain); - - if ( tvplayer->tvchain == NULL ) { - res = FALSE; - goto error; - } - - // Get program info from database using chanid and starttime - tvplayer->proginfo = gmyth_tvchain_get_program_at (tvplayer->tvchain, -1); - if ( tvplayer->proginfo == NULL ) { - g_warning ("[%s] LiveTV not successfully started.\n", __FUNCTION__ ); - res = FALSE; - goto error; - } else { - g_debug ("[%s] MythLiveTV: All requests to backend to start TV were OK.\n", __FUNCTION__ ); - } - - return res; - -error: - if ( tvplayer->backend_hostname != NULL ) { - g_string_free( tvplayer->backend_hostname, TRUE ); - res = FALSE; - } - - if ( tvplayer->local_hostname != NULL ) { - g_string_free( tvplayer->local_hostname, TRUE ); - res = FALSE; - } - - if ( tvplayer->remote_encoder != NULL ) { - g_object_unref (tvplayer->remote_encoder); - tvplayer->remote_encoder = NULL; - } - - if ( tvplayer->tvchain != NULL ) { - g_object_unref (tvplayer->tvchain); - tvplayer->tvchain = NULL; - } - - if ( tvplayer->proginfo != NULL ) { - g_object_unref (tvplayer->proginfo); - tvplayer->proginfo = NULL; - } - - return res; - -} - -/** Sets the GTK video widget for the tv player. - * - * @param tvplayer the object instance. - * @param videow the GTK video window. - * @return TRUE if successfull, FALSE if any error happens. - */ -gboolean -gmyth_tvplayer_set_widget (GMythTVPlayer *tvplayer, GtkWidget *videow) -{ - tvplayer->videow = videow; - g_object_ref (videow); - - g_debug ("[%s] Setting widget for tv player render", __FUNCTION__); - - tvplayer->expose_handler = g_signal_connect (tvplayer->videow, "expose-event", - G_CALLBACK (expose_cb), tvplayer); - - //g_signal_connect(miptv_ui->videow, "size_request", G_CALLBACK(cb_preferred_video_size), miptv_ui); - - return TRUE; -} - -static gboolean -bus_call (GstBus * bus, GstMessage * msg, gpointer data) -{ - //GMythTVPlayer *tvplayer = GMYTH_TVPLAYER ( data ); - //GMainLoop *loop = tvplayer->loop; - - switch (GST_MESSAGE_TYPE (msg)) { - case GST_MESSAGE_EOS: - printf ("End of stream\n"); - //g_idle_add ((GSourceFunc) idle_eos, data); - gst_element_set_state ( GST_ELEMENT (GST_MESSAGE_SRC (msg)), GST_STATE_NULL ); - gst_element_set_locked_state ( GST_ELEMENT (GST_MESSAGE_SRC (msg)), FALSE ); - break; - case GST_MESSAGE_ERROR: - { - gchar *debug; - GError *err; - - gst_message_parse_error (msg, &err, &debug); - g_free (debug); - - printf ("Error: %s\n", err->message); - g_error_free (err); - - //g_main_loop_quit (loop); - } - break; - default: - printf (gst_message_type_get_name (GST_MESSAGE_TYPE (msg))); - printf ("\n"); - break; - } - - return TRUE; -} - - -#if 0 -static gboolean -idle_state (gpointer data) -{ - GstPlayerWindowStateChange *st = data; - - if (st->old_state == GST_STATE_PLAYING) { - if (st->miptv_ui->idle_id != 0) { - g_source_remove (st->miptv_ui->idle_id); - st->miptv_ui->idle_id = 0; - } - } - else if (st->new_state == GST_STATE_PLAYING) { - if (st->miptv_ui->idle_id != 0) - g_source_remove (st->miptv_ui->idle_id); - - st->miptv_ui->idle_id = g_idle_add (cb_iterate, st->miptv_ui); - } - - /* new movie loaded? */ - if (st->old_state == GST_STATE_READY && st->new_state > GST_STATE_READY) { - - /* gboolean have_video = FALSE; */ - - gtk_widget_show (st->miptv_ui->videow); - - gtk_window_resize (GTK_WINDOW (st->miptv_ui->main_window), 1, 1); - - } - - /* discarded movie? */ - if (st->old_state > GST_STATE_READY && st->new_state == GST_STATE_READY) { - - if (st->miptv_ui->tagcache) { - gst_tag_list_free (st->miptv_ui->tagcache); - st->miptv_ui->tagcache = NULL; - } - } - - gst_object_unref (GST_OBJECT (st->play)); - //g_object_unref (G_OBJECT (st->win)); - g_free (st); - - /* once */ - return FALSE; -} - -#endif - -/** Stops playing the current A/V. - * - * FIXME: How to proceed differently between livetv - * and recorded content? - * - * @param tvplayer the object instance. - * @return void - */ -void -gmyth_tvplayer_stop_playing (GMythTVPlayer *tvplayer) -{ - g_debug ("[%s] Setting gstreamer pipeline state to NULL", __FUNCTION__); - - gst_element_set_state (tvplayer->gst_pipeline, GST_STATE_NULL); - - if (tvplayer->is_livetv) { - if (!gmyth_remote_encoder_stop_livetv (tvplayer->remote_encoder)) { - g_warning ("[%s] Error while stoping remote encoder", __FUNCTION__); - } - } -} - -/** Queries if the tvplayer is active playing A/V content. - * - * @param tvplayer the object instance. - * @return TRUE if the tvplayer is active, FALSE otherwise. - */ -gboolean -gmyth_tvplayer_is_playing (GMythTVPlayer *tvplayer) -{ - return (GST_STATE (tvplayer->gst_pipeline) == GST_STATE_PLAYING); -} - -/** Static function that sets the tvplayer state to PLAYING. - * - * @param tvplayer the object instance. - * @return TRUE if the tvplayer is active, FALSE otherwise. - */ -static gboolean -idle_play (gpointer data) -{ - GMythTVPlayer *tvplayer = GMYTH_TVPLAYER (data); - - g_debug ("GMythTVPlayer: Setting pipeline state to PLAYING\n"); - - gst_element_set_state (tvplayer->gst_pipeline, GST_STATE_PLAYING); - - return FALSE; -} - -/** Start playing A/V with the tvplayer attributes. - * - * @param tvplayer the object instance. - */ -void -gmyth_tvplayer_start_playing (GMythTVPlayer *tvplayer) -{ - - // FIXME: Move this to livetv_setup?? - if (tvplayer->is_livetv) { - - #if 0 - if (!tvplayer || !(tvplayer->proginfo) || !(tvplayer->local_hostname) - || !(tvplayer->gst_source)) { - g_warning ("GMythtvPlayer not ready to start playing\n"); - } - - if (!(tvplayer->proginfo->pathname)) { - g_warning ("[%s] Playback url is null, could not play the myth content", __FUNCTION__); - return; - } - - g_debug ("GMythTVPlayer: Start playing %s", tvplayer->proginfo->pathname->str); -#endif - g_object_set (G_OBJECT (tvplayer->gst_source), "mythtv-live", - TRUE, NULL); -#if 0 - if ( tvplayer->tvchain != NULL ) { - GString *str_chainid = gmyth_tvchain_get_id(tvplayer->tvchain); - g_print( "[%s]\tCHAIN ID: %s\n", __FUNCTION__, str_chainid->str ); - - g_object_set (G_OBJECT (tvplayer->gst_source), "mythtv-live-chainid", - g_strdup( str_chainid->str ), NULL); - if ( str_chainid!=NULL) - g_string_free( str_chainid, FALSE ); - } - - if ( tvplayer->remote_encoder != NULL ) - g_object_set (G_OBJECT (tvplayer->gst_source), "mythtv-live-id", - tvplayer->remote_encoder->recorder_num, NULL ); - g_debug ("[%s] Setting location to %s", __FUNCTION__, - tvplayer->proginfo->pathname->str); - - /* Sets the gstreamer properties acording to the service access address */ - g_object_set (G_OBJECT (tvplayer->gst_source), "location", - tvplayer->proginfo->pathname->str, NULL); -#endif - } - - g_object_set (G_OBJECT (tvplayer->gst_source), "mythtv-version", - MYTHTV_VERSION_DEFAULT, NULL); - - g_object_set (G_OBJECT (tvplayer->gst_source), "mythtv-debug", - TRUE, NULL); - - g_idle_add (idle_play, tvplayer); - -} - diff -r 7c409a042a9a -r 7174e23f7617 gmyth/src/gmyth_tvplayer.h --- a/gmyth/src/gmyth_tvplayer.h Thu Sep 28 15:57:27 2006 +0100 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 @@ -1,112 +0,0 @@ -/** - * GMyth Library - * - * @file gmyth/gmyth_tvplayer.h - * - * @brief

This component provides playback of the remote A/V using - * GStreamer. - * - * Copyright (C) 2006 INdT - Instituto Nokia de Tecnologia. - * @author Hallyson Luiz de Morais Melo - * - *//* - * - * This program is free software; you can redistribute it and/or modify - * it under the terms of the GNU Lesser General Public License as published by - * the Free Software Foundation; either version 2 of the License, or - * (at your option) any later version. - * - * This program is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU General Public License for more details. - * - * You should have received a copy of the GNU Lesser General Public License - * along with this program; if not, write to the Free Software - * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA - */ - -#ifndef GMYTH_TVPLAYER_H_ -#define GMYTH_TVPLAYER_H_ - -#include -#include - -/* GStreamer includes */ -#include -#include - -#include "gmyth_remote_encoder.h" -#include "gmyth_tvchain.h" -#include "gmyth_common.h" - -G_BEGIN_DECLS - -#define GMYTH_TVPLAYER_TYPE (gmyth_tvplayer_get_type ()) -#define GMYTH_TVPLAYER(obj) (G_TYPE_CHECK_INSTANCE_CAST ((obj), GMYTH_TVPLAYER_TYPE, GMythTVPlayer)) -#define GMYTH_TVPLAYER_CLASS(klass) (G_TYPE_CHECK_CLASS_CAST ((klass), GMYTH_TVPLAYER_TYPE, GMythTVPlayerClass)) -#define IS_GMYTH_TVPLAYER(obj) (G_TYPE_CHECK_INSTANCE_CAST ((obj), GMYTH_TVPLAYER_TYPE)) -#define IS_GMYTH_TVPLAYER_CLASS(klass) (G_TYPE_CHECK_CLASS_CAST ((klass), GMYTH_TVPLAYER_TYPE)) -#define GMYTH_TVPLAYER_GET_CLASS(obj) (G_TYPE_INSTANCE_GET_CLASS ((obj), GMYTH_TVPLAYER_TYPE, GMythTVPlayerClass)) - - -typedef struct _GMythTVPlayer GMythTVPlayer; -typedef struct _GMythTVPlayerClass GMythTVPlayerClass; - -struct _GMythTVPlayerClass -{ - GObjectClass parent_class; - - /* callbacks */ - /* no one for now */ -}; - -struct _GMythTVPlayer -{ - GObject parent; - - GstElement *gst_pipeline; - GstElement *gst_source; - GstElement *gst_videodec; - GstElement *gst_videosink; - GstElement *videoqueue; - GstElement *audioqueue; - - gulong expose_handler; -// GMainLoop *loop; - - GtkWidget *videow; - - /* Backend connection related variables */ - GString *backend_hostname; - gint backend_port; - GString *local_hostname; - - GMythRemoteEncoder *remote_encoder; - GMythTVChain *tvchain; - GMythProgramInfo *proginfo; - - gboolean is_livetv; -}; - - -GType gmyth_tvplayer_get_type (void); - -GMythTVPlayer* gmyth_tvplayer_new (); -gboolean gmyth_tvplayer_initialize (GMythTVPlayer *tvplayer); - -void gmyth_tvplayer_start_playing (GMythTVPlayer *tvplayer); -void gmyth_tvplayer_stop_playing (GMythTVPlayer *tvplayer); - -gboolean gmyth_tvplayer_set_widget (GMythTVPlayer *tvplayer, - GtkWidget *videow); - -gboolean gmyth_tvplayer_is_playing (GMythTVPlayer *tvplayer); - -gboolean gmyth_tvplayer_record_setup (GMythTVPlayer *tvplayer, - gchar *filename); -gboolean gmyth_tvplayer_livetv_setup (GMythTVPlayer *tvplayer); - -G_END_DECLS - -#endif /*GMYTH_TVPLAYER_H_*/ diff -r 7c409a042a9a -r 7174e23f7617 gmyth/src/mmyth_main.c --- a/gmyth/src/mmyth_main.c Thu Sep 28 15:57:27 2006 +0100 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 @@ -1,103 +0,0 @@ - -#include - -#include "config.h" - -#ifdef MAEMO_PLATFORM -#include "hildon-widgets/hildon-program.h" -#include "hildon-widgets/hildon-window.h" -#endif - -#include "gmyth_remote_encoder.h" -#include "gmyth_settings.h" -#include "gmyth_context.h" -#include "gmyth_tvchain.h" -#include "gmyth_tvplayer.h" -#include "gmyth_remote_util.h" - -#include "mmyth_ui.h" - -static void -cb_destroy (GtkWidget * widget, gpointer data) -{ - MMythUi *mmyth_ui = (MMythUi *) data; - - if (mmyth_ui->tvplayer != NULL) { - if (gmyth_tvplayer_is_playing (mmyth_ui->tvplayer) ) - gmyth_tvplayer_stop_playing (mmyth_ui->tvplayer); - } - - mmyth_ui_finalize (mmyth_ui); - - gtk_main_quit (); -} - -#ifdef NDEBUG -static void -debug_error_func( const gchar*log_domain, GLogLevelFlags log_level, const gchar *message, - gpointer user_data ) - -{ - /* leave this with NO print out messages, once you need to disable debug messages! */ - //g_print ( "[%s] DEBUG messages disabled!\n", __FUNCTION__ ); -} -#endif - -gint -main (gint argc, gchar * argv[]) -{ - GtkWidget *window; - MMythUi *mmyth_ui; -#ifdef MAEMO_PLATFORM - HildonProgram *program = NULL; -#endif - - /* init threads */ - g_thread_init (NULL); - - /* Initializes GTK */ - gtk_init (&argc, &argv); - gst_init (&argc, &argv); -#ifdef NDEBUG - g_log_set_default_handler( debug_error_func, NULL ); -#endif - - /* Init libmmyth context */ - gmyth_context_initialize (); - -#ifndef MAEMO_PLATFORM - /* create the main window */ - window = gtk_window_new (GTK_WINDOW_TOPLEVEL); - gtk_widget_set_size_request (window, MAIN_WINDOW_WIDTH, MAIN_WINDOW_HEIGHT); - gtk_window_set_title (GTK_WINDOW (window), "Mythtv Frontend"); -#else - /* Creating Hildonized main view */ - program = HILDON_PROGRAM(hildon_program_get_instance()); - window = hildon_window_new(); - - //g_signal_connect(G_OBJECT(window), "delete_event", gtk_main_quit, NULL); - - hildon_program_add_window(program, HILDON_WINDOW (window)); - g_set_application_name("Maemo Mythtv"); -#endif - - /* Initializes MMyth Widgets */ -#ifdef MAEMO_PLATFORM - mmyth_ui = mmyth_ui_initialize (program, window); -#else - mmyth_ui = mmyth_ui_initialize (window); -#endif - - //mmyth_ui->loop = g_main_loop_new (NULL, FALSE); - - /* Connect destroy signal handling */ - g_signal_connect (window, "destroy", G_CALLBACK (cb_destroy), mmyth_ui); - - /* Shows main window and start gtk loop */ - gtk_widget_show (window); - - gtk_main (); - - return 0; -} - diff -r 7c409a042a9a -r 7174e23f7617 maemo-ui/pixmaps/Makefile.am --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/maemo-ui/pixmaps/Makefile.am Thu Sep 28 16:02:14 2006 +0100 @@ -0,0 +1,11 @@ +# Adding the application icon +#icondir = $(datadir)/mmyth/pixmaps +#icon_DATA = \ +# mmyth.png + + +# Adding the application resources +pixmapdir = $(pkgdatadir)/pixmaps +pixmap_DATA = mmyth_logo.png + +EXTRA_DIST = $(pixmap_DATA) diff -r 7c409a042a9a -r 7174e23f7617 maemo-ui/pixmaps/Makefile.in --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/maemo-ui/pixmaps/Makefile.in Thu Sep 28 16:02:14 2006 +0100 @@ -0,0 +1,438 @@ +# Makefile.in generated by automake 1.9.6 from Makefile.am. +# @configure_input@ + +# Copyright (C) 1994, 1995, 1996, 1997, 1998, 1999, 2000, 2001, 2002, +# 2003, 2004, 2005 Free Software Foundation, Inc. +# This Makefile.in is free software; the Free Software Foundation +# gives unlimited permission to copy and/or distribute it, +# with or without modifications, as long as this notice is preserved. + +# This program is distributed in the hope that it will be useful, +# but WITHOUT ANY WARRANTY, to the extent permitted by law; without +# even the implied warranty of MERCHANTABILITY or FITNESS FOR A +# PARTICULAR PURPOSE. + +@SET_MAKE@ + +# Adding the application icon +#icondir = $(datadir)/mmyth/pixmaps +#icon_DATA = \ +# mmyth.png + +srcdir = @srcdir@ +top_srcdir = @top_srcdir@ +VPATH = @srcdir@ +pkgdatadir = $(datadir)/@PACKAGE@ +pkglibdir = $(libdir)/@PACKAGE@ +pkgincludedir = $(includedir)/@PACKAGE@ +top_builddir = .. +am__cd = CDPATH="$${ZSH_VERSION+.}$(PATH_SEPARATOR)" && cd +INSTALL = @INSTALL@ +install_sh_DATA = $(install_sh) -c -m 644 +install_sh_PROGRAM = $(install_sh) -c +install_sh_SCRIPT = $(install_sh) -c +INSTALL_HEADER = $(INSTALL_DATA) +transform = $(program_transform_name) +NORMAL_INSTALL = : +PRE_INSTALL = : +POST_INSTALL = : +NORMAL_UNINSTALL = : +PRE_UNINSTALL = : +POST_UNINSTALL = : +build_triplet = @build@ +host_triplet = @host@ +subdir = pixmaps +DIST_COMMON = $(srcdir)/Makefile.am $(srcdir)/Makefile.in +ACLOCAL_M4 = $(top_srcdir)/aclocal.m4 +am__aclocal_m4_deps = $(top_srcdir)/m4/ac_doxygen.m4 \ + $(top_srcdir)/m4/as-version.m4 $(top_srcdir)/configure.ac +am__configure_deps = $(am__aclocal_m4_deps) $(CONFIGURE_DEPENDENCIES) \ + $(ACLOCAL_M4) +mkinstalldirs = $(install_sh) -d +CONFIG_HEADER = $(top_builddir)/config.h +CONFIG_CLEAN_FILES = +SOURCES = +DIST_SOURCES = +am__vpath_adj_setup = srcdirstrip=`echo "$(srcdir)" | sed 's|.|.|g'`; +am__vpath_adj = case $$p in \ + $(srcdir)/*) f=`echo "$$p" | sed "s|^$$srcdirstrip/||"`;; \ + *) f=$$p;; \ + esac; +am__strip_dir = `echo $$p | sed -e 's|^.*/||'`; +am__installdirs = "$(DESTDIR)$(pixmapdir)" +pixmapDATA_INSTALL = $(INSTALL_DATA) +DATA = $(pixmap_DATA) +DISTFILES = $(DIST_COMMON) $(DIST_SOURCES) $(TEXINFOS) $(EXTRA_DIST) +ACLOCAL = @ACLOCAL@ +ACLOCAL_AMFLAGS = @ACLOCAL_AMFLAGS@ +AMDEP_FALSE = @AMDEP_FALSE@ +AMDEP_TRUE = @AMDEP_TRUE@ +AMTAR = @AMTAR@ +AR = @AR@ +AUTOCONF = @AUTOCONF@ +AUTOHEADER = @AUTOHEADER@ +AUTOMAKE = @AUTOMAKE@ +AWK = @AWK@ +CC = @CC@ +CCDEPMODE = @CCDEPMODE@ +CFLAGS = @CFLAGS@ +CPP = @CPP@ +CPPFLAGS = @CPPFLAGS@ +CXX = @CXX@ +CXXCPP = @CXXCPP@ +CXXDEPMODE = @CXXDEPMODE@ +CXXFLAGS = @CXXFLAGS@ +CYGPATH_W = @CYGPATH_W@ +DEFS = @DEFS@ +DEPDIR = @DEPDIR@ +DOXYGEN_PAPER_SIZE = @DOXYGEN_PAPER_SIZE@ +DX_COND_chi_FALSE = @DX_COND_chi_FALSE@ +DX_COND_chi_TRUE = @DX_COND_chi_TRUE@ +DX_COND_chm_FALSE = @DX_COND_chm_FALSE@ +DX_COND_chm_TRUE = @DX_COND_chm_TRUE@ +DX_COND_doc_FALSE = @DX_COND_doc_FALSE@ +DX_COND_doc_TRUE = @DX_COND_doc_TRUE@ +DX_COND_dot_FALSE = @DX_COND_dot_FALSE@ +DX_COND_dot_TRUE = @DX_COND_dot_TRUE@ +DX_COND_html_FALSE = @DX_COND_html_FALSE@ +DX_COND_html_TRUE = @DX_COND_html_TRUE@ +DX_COND_latex_FALSE = @DX_COND_latex_FALSE@ +DX_COND_latex_TRUE = @DX_COND_latex_TRUE@ +DX_COND_man_FALSE = @DX_COND_man_FALSE@ +DX_COND_man_TRUE = @DX_COND_man_TRUE@ +DX_COND_pdf_FALSE = @DX_COND_pdf_FALSE@ +DX_COND_pdf_TRUE = @DX_COND_pdf_TRUE@ +DX_COND_ps_FALSE = @DX_COND_ps_FALSE@ +DX_COND_ps_TRUE = @DX_COND_ps_TRUE@ +DX_COND_rtf_FALSE = @DX_COND_rtf_FALSE@ +DX_COND_rtf_TRUE = @DX_COND_rtf_TRUE@ +DX_COND_xml_FALSE = @DX_COND_xml_FALSE@ +DX_COND_xml_TRUE = @DX_COND_xml_TRUE@ +DX_CONFIG = @DX_CONFIG@ +DX_DOCDIR = @DX_DOCDIR@ +DX_DOT = @DX_DOT@ +DX_DOXYGEN = @DX_DOXYGEN@ +DX_DVIPS = @DX_DVIPS@ +DX_EGREP = @DX_EGREP@ +DX_ENV = @DX_ENV@ +DX_FLAG_chi = @DX_FLAG_chi@ +DX_FLAG_chm = @DX_FLAG_chm@ +DX_FLAG_doc = @DX_FLAG_doc@ +DX_FLAG_dot = @DX_FLAG_dot@ +DX_FLAG_html = @DX_FLAG_html@ +DX_FLAG_man = @DX_FLAG_man@ +DX_FLAG_pdf = @DX_FLAG_pdf@ +DX_FLAG_ps = @DX_FLAG_ps@ +DX_FLAG_rtf = @DX_FLAG_rtf@ +DX_FLAG_xml = @DX_FLAG_xml@ +DX_HHC = @DX_HHC@ +DX_LATEX = @DX_LATEX@ +DX_MAKEINDEX = @DX_MAKEINDEX@ +DX_PDFLATEX = @DX_PDFLATEX@ +DX_PERL = @DX_PERL@ +DX_PROJECT = @DX_PROJECT@ +ECHO = @ECHO@ +ECHO_C = @ECHO_C@ +ECHO_N = @ECHO_N@ +ECHO_T = @ECHO_T@ +EGREP = @EGREP@ +EXEEXT = @EXEEXT@ +F77 = @F77@ +FFLAGS = @FFLAGS@ +GLIB_CFLAGS = @GLIB_CFLAGS@ +GLIB_LIBS = @GLIB_LIBS@ +GMYTH_MAJORMINOR = @GMYTH_MAJORMINOR@ +GMYTH_MAJOR_VERSION = @GMYTH_MAJOR_VERSION@ +GMYTH_MICRO_VERSION = @GMYTH_MICRO_VERSION@ +GMYTH_MINOR_VERSION = @GMYTH_MINOR_VERSION@ +GMYTH_NANO_VERSION = @GMYTH_NANO_VERSION@ +GMYTH_RELEASE = @GMYTH_RELEASE@ +GMYTH_VERSION = @GMYTH_VERSION@ +GOBJECT_CFLAGS = @GOBJECT_CFLAGS@ +GOBJECT_LIBS = @GOBJECT_LIBS@ +GREP = @GREP@ +GSTBASE_CFLAGS = @GSTBASE_CFLAGS@ +GSTBASE_LIBS = @GSTBASE_LIBS@ +GST_CFLAGS = @GST_CFLAGS@ +GST_LIBS = @GST_LIBS@ +GST_MAJORMINOR = @GST_MAJORMINOR@ +GTK_CFLAGS = @GTK_CFLAGS@ +GTK_LIBS = @GTK_LIBS@ +HAVE_PKGCONFIG = @HAVE_PKGCONFIG@ +HILDON_CFLAGS = @HILDON_CFLAGS@ +HILDON_LIBS = @HILDON_LIBS@ +INSTALL_DATA = @INSTALL_DATA@ +INSTALL_PROGRAM = @INSTALL_PROGRAM@ +INSTALL_SCRIPT = @INSTALL_SCRIPT@ +INSTALL_STRIP_PROGRAM = @INSTALL_STRIP_PROGRAM@ +LDFLAGS = @LDFLAGS@ +LIBGMYTH_CFLAGS = @LIBGMYTH_CFLAGS@ +LIBGMYTH_LIBS = @LIBGMYTH_LIBS@ +LIBOBJS = @LIBOBJS@ +LIBS = @LIBS@ +LIBTOOL = @LIBTOOL@ +LIBXML_CFLAGS = @LIBXML_CFLAGS@ +LIBXML_LIBS = @LIBXML_LIBS@ +LN_S = @LN_S@ +LTLIBOBJS = @LTLIBOBJS@ +MAEMO_PLATFORM_FALSE = @MAEMO_PLATFORM_FALSE@ +MAEMO_PLATFORM_TRUE = @MAEMO_PLATFORM_TRUE@ +MAINT = @MAINT@ +MAINTAINER_MODE_FALSE = @MAINTAINER_MODE_FALSE@ +MAINTAINER_MODE_TRUE = @MAINTAINER_MODE_TRUE@ +MAKEINFO = @MAKEINFO@ +MYSQL_CFLAGS = @MYSQL_CFLAGS@ +MYSQL_LIBS = @MYSQL_LIBS@ +NDEBUG_FALSE = @NDEBUG_FALSE@ +NDEBUG_TRUE = @NDEBUG_TRUE@ +OBJEXT = @OBJEXT@ +PACKAGE = @PACKAGE@ +PACKAGE_BUGREPORT = @PACKAGE_BUGREPORT@ +PACKAGE_NAME = @PACKAGE_NAME@ +PACKAGE_STRING = @PACKAGE_STRING@ +PACKAGE_TARNAME = @PACKAGE_TARNAME@ +PACKAGE_VERSION = @PACKAGE_VERSION@ +PATH_SEPARATOR = @PATH_SEPARATOR@ +PKG_CONFIG = @PKG_CONFIG@ +RANLIB = @RANLIB@ +SET_MAKE = @SET_MAKE@ +SHELL = @SHELL@ +STRIP = @STRIP@ +VERSION = @VERSION@ +WITH_GTK_FALSE = @WITH_GTK_FALSE@ +WITH_GTK_TRUE = @WITH_GTK_TRUE@ +ac_ct_CC = @ac_ct_CC@ +ac_ct_CXX = @ac_ct_CXX@ +ac_ct_F77 = @ac_ct_F77@ +am__fastdepCC_FALSE = @am__fastdepCC_FALSE@ +am__fastdepCC_TRUE = @am__fastdepCC_TRUE@ +am__fastdepCXX_FALSE = @am__fastdepCXX_FALSE@ +am__fastdepCXX_TRUE = @am__fastdepCXX_TRUE@ +am__include = @am__include@ +am__leading_dot = @am__leading_dot@ +am__quote = @am__quote@ +am__tar = @am__tar@ +am__untar = @am__untar@ +bindir = @bindir@ +build = @build@ +build_alias = @build_alias@ +build_cpu = @build_cpu@ +build_os = @build_os@ +build_vendor = @build_vendor@ +datadir = @datadir@ +datarootdir = @datarootdir@ +docdir = @docdir@ +dvidir = @dvidir@ +exec_prefix = @exec_prefix@ +host = @host@ +host_alias = @host_alias@ +host_cpu = @host_cpu@ +host_os = @host_os@ +host_vendor = @host_vendor@ +htmldir = @htmldir@ +includedir = @includedir@ +infodir = @infodir@ +install_sh = @install_sh@ +libdir = @libdir@ +libexecdir = @libexecdir@ +localedir = @localedir@ +localstatedir = @localstatedir@ +mandir = @mandir@ +mkdir_p = @mkdir_p@ +oldincludedir = @oldincludedir@ +pdfdir = @pdfdir@ +prefix = @prefix@ +program_transform_name = @program_transform_name@ +psdir = @psdir@ +sbindir = @sbindir@ +sharedstatedir = @sharedstatedir@ +sysconfdir = @sysconfdir@ +target_alias = @target_alias@ + +# Adding the application resources +pixmapdir = $(pkgdatadir)/pixmaps +pixmap_DATA = mmyth_logo.png +EXTRA_DIST = $(pixmap_DATA) +all: all-am + +.SUFFIXES: +$(srcdir)/Makefile.in: @MAINTAINER_MODE_TRUE@ $(srcdir)/Makefile.am $(am__configure_deps) + @for dep in $?; do \ + case '$(am__configure_deps)' in \ + *$$dep*) \ + cd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh \ + && exit 0; \ + exit 1;; \ + esac; \ + done; \ + echo ' cd $(top_srcdir) && $(AUTOMAKE) --gnu pixmaps/Makefile'; \ + cd $(top_srcdir) && \ + $(AUTOMAKE) --gnu pixmaps/Makefile +.PRECIOUS: Makefile +Makefile: $(srcdir)/Makefile.in $(top_builddir)/config.status + @case '$?' in \ + *config.status*) \ + cd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh;; \ + *) \ + echo ' cd $(top_builddir) && $(SHELL) ./config.status $(subdir)/$@ $(am__depfiles_maybe)'; \ + cd $(top_builddir) && $(SHELL) ./config.status $(subdir)/$@ $(am__depfiles_maybe);; \ + esac; + +$(top_builddir)/config.status: $(top_srcdir)/configure $(CONFIG_STATUS_DEPENDENCIES) + cd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh + +$(top_srcdir)/configure: @MAINTAINER_MODE_TRUE@ $(am__configure_deps) + cd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh +$(ACLOCAL_M4): @MAINTAINER_MODE_TRUE@ $(am__aclocal_m4_deps) + cd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh + +mostlyclean-libtool: + -rm -f *.lo + +clean-libtool: + -rm -rf .libs _libs + +distclean-libtool: + -rm -f libtool +uninstall-info-am: +install-pixmapDATA: $(pixmap_DATA) + @$(NORMAL_INSTALL) + test -z "$(pixmapdir)" || $(mkdir_p) "$(DESTDIR)$(pixmapdir)" + @list='$(pixmap_DATA)'; for p in $$list; do \ + if test -f "$$p"; then d=; else d="$(srcdir)/"; fi; \ + f=$(am__strip_dir) \ + echo " $(pixmapDATA_INSTALL) '$$d$$p' '$(DESTDIR)$(pixmapdir)/$$f'"; \ + $(pixmapDATA_INSTALL) "$$d$$p" "$(DESTDIR)$(pixmapdir)/$$f"; \ + done + +uninstall-pixmapDATA: + @$(NORMAL_UNINSTALL) + @list='$(pixmap_DATA)'; for p in $$list; do \ + f=$(am__strip_dir) \ + echo " rm -f '$(DESTDIR)$(pixmapdir)/$$f'"; \ + rm -f "$(DESTDIR)$(pixmapdir)/$$f"; \ + done +tags: TAGS +TAGS: + +ctags: CTAGS +CTAGS: + + +distdir: $(DISTFILES) + @srcdirstrip=`echo "$(srcdir)" | sed 's|.|.|g'`; \ + topsrcdirstrip=`echo "$(top_srcdir)" | sed 's|.|.|g'`; \ + list='$(DISTFILES)'; for file in $$list; do \ + case $$file in \ + $(srcdir)/*) file=`echo "$$file" | sed "s|^$$srcdirstrip/||"`;; \ + $(top_srcdir)/*) file=`echo "$$file" | sed "s|^$$topsrcdirstrip/|$(top_builddir)/|"`;; \ + esac; \ + if test -f $$file || test -d $$file; then d=.; else d=$(srcdir); fi; \ + dir=`echo "$$file" | sed -e 's,/[^/]*$$,,'`; \ + if test "$$dir" != "$$file" && test "$$dir" != "."; then \ + dir="/$$dir"; \ + $(mkdir_p) "$(distdir)$$dir"; \ + else \ + dir=''; \ + fi; \ + if test -d $$d/$$file; then \ + if test -d $(srcdir)/$$file && test $$d != $(srcdir); then \ + cp -pR $(srcdir)/$$file $(distdir)$$dir || exit 1; \ + fi; \ + cp -pR $$d/$$file $(distdir)$$dir || exit 1; \ + else \ + test -f $(distdir)/$$file \ + || cp -p $$d/$$file $(distdir)/$$file \ + || exit 1; \ + fi; \ + done +check-am: all-am +check: check-am +all-am: Makefile $(DATA) +installdirs: + for dir in "$(DESTDIR)$(pixmapdir)"; do \ + test -z "$$dir" || $(mkdir_p) "$$dir"; \ + done +install: install-am +install-exec: install-exec-am +install-data: install-data-am +uninstall: uninstall-am + +install-am: all-am + @$(MAKE) $(AM_MAKEFLAGS) install-exec-am install-data-am + +installcheck: installcheck-am +install-strip: + $(MAKE) $(AM_MAKEFLAGS) INSTALL_PROGRAM="$(INSTALL_STRIP_PROGRAM)" \ + install_sh_PROGRAM="$(INSTALL_STRIP_PROGRAM)" INSTALL_STRIP_FLAG=-s \ + `test -z '$(STRIP)' || \ + echo "INSTALL_PROGRAM_ENV=STRIPPROG='$(STRIP)'"` install +mostlyclean-generic: + +clean-generic: + +distclean-generic: + -test -z "$(CONFIG_CLEAN_FILES)" || rm -f $(CONFIG_CLEAN_FILES) + +maintainer-clean-generic: + @echo "This command is intended for maintainers to use" + @echo "it deletes files that may require special tools to rebuild." +clean: clean-am + +clean-am: clean-generic clean-libtool mostlyclean-am + +distclean: distclean-am + -rm -f Makefile +distclean-am: clean-am distclean-generic distclean-libtool + +dvi: dvi-am + +dvi-am: + +html: html-am + +info: info-am + +info-am: + +install-data-am: install-pixmapDATA + +install-exec-am: + +install-info: install-info-am + +install-man: + +installcheck-am: + +maintainer-clean: maintainer-clean-am + -rm -f Makefile +maintainer-clean-am: distclean-am maintainer-clean-generic + +mostlyclean: mostlyclean-am + +mostlyclean-am: mostlyclean-generic mostlyclean-libtool + +pdf: pdf-am + +pdf-am: + +ps: ps-am + +ps-am: + +uninstall-am: uninstall-info-am uninstall-pixmapDATA + +.PHONY: all all-am check check-am clean clean-generic clean-libtool \ + distclean distclean-generic distclean-libtool distdir dvi \ + dvi-am html html-am info info-am install install-am \ + install-data install-data-am install-exec install-exec-am \ + install-info install-info-am install-man install-pixmapDATA \ + install-strip installcheck installcheck-am installdirs \ + maintainer-clean maintainer-clean-generic mostlyclean \ + mostlyclean-generic mostlyclean-libtool pdf pdf-am ps ps-am \ + uninstall uninstall-am uninstall-info-am uninstall-pixmapDATA + +# Tell versions [3.59,3.63) of GNU make to not export all variables. +# Otherwise a system limit (for SysV at least) may be exceeded. +.NOEXPORT: diff -r 7c409a042a9a -r 7174e23f7617 maemo-ui/pixmaps/mmyth_logo.png Binary file maemo-ui/pixmaps/mmyth_logo.png has changed diff -r 7c409a042a9a -r 7174e23f7617 maemo-ui/src/Makefile.am --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/maemo-ui/src/Makefile.am Thu Sep 28 16:02:14 2006 +0100 @@ -0,0 +1,28 @@ +bin_PROGRAMS = mmyth + +mmyth_SOURCES = \ + mmyth_main.c \ + mmyth_ui.c \ + mmyth_uicommon.c \ + mmyth_epg_grid_view.c \ + mmyth_epg_grid_widget.c \ + mmyth_recordui.c \ + mmyth_uisettings.c \ + mmyth_schedulerui.c \ + mmyth_tvplayer.c + +mmyth_CFLAGS = \ + $(GTK_CFLAGS) \ + $(GLIB_CFLAGS) \ + $(GST_CFLAGS) \ + $(MYSQL_CFLAGS) \ + $(LIBGMYTH_CFLAGS) \ + -I$(top_srcdir)/src \ + -DDATA_DIR=\""$(pkgdatadir)"\" \ + -DPIX_DIR=\""$(pkgdatadir)/pixmaps/"\" \ + -DICON_DIR=\""$(datadir)/pixmaps/"\" \ + -g3 -O0 + +mmyth_LDADD = \ + $(LIBGMYTH_LIBS) + diff -r 7c409a042a9a -r 7174e23f7617 maemo-ui/src/Makefile.in --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/maemo-ui/src/Makefile.in Thu Sep 28 16:02:14 2006 +0100 @@ -0,0 +1,699 @@ +# Makefile.in generated by automake 1.9.6 from Makefile.am. +# @configure_input@ + +# Copyright (C) 1994, 1995, 1996, 1997, 1998, 1999, 2000, 2001, 2002, +# 2003, 2004, 2005 Free Software Foundation, Inc. +# This Makefile.in is free software; the Free Software Foundation +# gives unlimited permission to copy and/or distribute it, +# with or without modifications, as long as this notice is preserved. + +# This program is distributed in the hope that it will be useful, +# but WITHOUT ANY WARRANTY, to the extent permitted by law; without +# even the implied warranty of MERCHANTABILITY or FITNESS FOR A +# PARTICULAR PURPOSE. + +@SET_MAKE@ + +srcdir = @srcdir@ +top_srcdir = @top_srcdir@ +VPATH = @srcdir@ +pkgdatadir = $(datadir)/@PACKAGE@ +pkglibdir = $(libdir)/@PACKAGE@ +pkgincludedir = $(includedir)/@PACKAGE@ +top_builddir = .. +am__cd = CDPATH="$${ZSH_VERSION+.}$(PATH_SEPARATOR)" && cd +INSTALL = @INSTALL@ +install_sh_DATA = $(install_sh) -c -m 644 +install_sh_PROGRAM = $(install_sh) -c +install_sh_SCRIPT = $(install_sh) -c +INSTALL_HEADER = $(INSTALL_DATA) +transform = $(program_transform_name) +NORMAL_INSTALL = : +PRE_INSTALL = : +POST_INSTALL = : +NORMAL_UNINSTALL = : +PRE_UNINSTALL = : +POST_UNINSTALL = : +build_triplet = @build@ +host_triplet = @host@ +bin_PROGRAMS = mmyth$(EXEEXT) +subdir = src +DIST_COMMON = $(srcdir)/Makefile.am $(srcdir)/Makefile.in +ACLOCAL_M4 = $(top_srcdir)/aclocal.m4 +am__aclocal_m4_deps = $(top_srcdir)/m4/ac_doxygen.m4 \ + $(top_srcdir)/m4/as-version.m4 $(top_srcdir)/configure.ac +am__configure_deps = $(am__aclocal_m4_deps) $(CONFIGURE_DEPENDENCIES) \ + $(ACLOCAL_M4) +mkinstalldirs = $(install_sh) -d +CONFIG_HEADER = $(top_builddir)/config.h +CONFIG_CLEAN_FILES = +am__installdirs = "$(DESTDIR)$(bindir)" +binPROGRAMS_INSTALL = $(INSTALL_PROGRAM) +PROGRAMS = $(bin_PROGRAMS) +am_mmyth_OBJECTS = mmyth-mmyth_main.$(OBJEXT) mmyth-mmyth_ui.$(OBJEXT) \ + mmyth-mmyth_uicommon.$(OBJEXT) \ + mmyth-mmyth_epg_grid_view.$(OBJEXT) \ + mmyth-mmyth_epg_grid_widget.$(OBJEXT) \ + mmyth-mmyth_recordui.$(OBJEXT) \ + mmyth-mmyth_uisettings.$(OBJEXT) \ + mmyth-mmyth_schedulerui.$(OBJEXT) \ + mmyth-mmyth_tvplayer.$(OBJEXT) +mmyth_OBJECTS = $(am_mmyth_OBJECTS) +am__DEPENDENCIES_1 = +mmyth_DEPENDENCIES = $(am__DEPENDENCIES_1) +DEFAULT_INCLUDES = -I. -I$(srcdir) -I$(top_builddir) +depcomp = $(SHELL) $(top_srcdir)/depcomp +am__depfiles_maybe = depfiles +COMPILE = $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) \ + $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS) +LTCOMPILE = $(LIBTOOL) --tag=CC --mode=compile $(CC) $(DEFS) \ + $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) \ + $(AM_CFLAGS) $(CFLAGS) +CCLD = $(CC) +LINK = $(LIBTOOL) --tag=CC --mode=link $(CCLD) $(AM_CFLAGS) $(CFLAGS) \ + $(AM_LDFLAGS) $(LDFLAGS) -o $@ +SOURCES = $(mmyth_SOURCES) +DIST_SOURCES = $(mmyth_SOURCES) +ETAGS = etags +CTAGS = ctags +DISTFILES = $(DIST_COMMON) $(DIST_SOURCES) $(TEXINFOS) $(EXTRA_DIST) +ACLOCAL = @ACLOCAL@ +ACLOCAL_AMFLAGS = @ACLOCAL_AMFLAGS@ +AMDEP_FALSE = @AMDEP_FALSE@ +AMDEP_TRUE = @AMDEP_TRUE@ +AMTAR = @AMTAR@ +AR = @AR@ +AUTOCONF = @AUTOCONF@ +AUTOHEADER = @AUTOHEADER@ +AUTOMAKE = @AUTOMAKE@ +AWK = @AWK@ +CC = @CC@ +CCDEPMODE = @CCDEPMODE@ +CFLAGS = @CFLAGS@ +CPP = @CPP@ +CPPFLAGS = @CPPFLAGS@ +CXX = @CXX@ +CXXCPP = @CXXCPP@ +CXXDEPMODE = @CXXDEPMODE@ +CXXFLAGS = @CXXFLAGS@ +CYGPATH_W = @CYGPATH_W@ +DEFS = @DEFS@ +DEPDIR = @DEPDIR@ +DOXYGEN_PAPER_SIZE = @DOXYGEN_PAPER_SIZE@ +DX_COND_chi_FALSE = @DX_COND_chi_FALSE@ +DX_COND_chi_TRUE = @DX_COND_chi_TRUE@ +DX_COND_chm_FALSE = @DX_COND_chm_FALSE@ +DX_COND_chm_TRUE = @DX_COND_chm_TRUE@ +DX_COND_doc_FALSE = @DX_COND_doc_FALSE@ +DX_COND_doc_TRUE = @DX_COND_doc_TRUE@ +DX_COND_dot_FALSE = @DX_COND_dot_FALSE@ +DX_COND_dot_TRUE = @DX_COND_dot_TRUE@ +DX_COND_html_FALSE = @DX_COND_html_FALSE@ +DX_COND_html_TRUE = @DX_COND_html_TRUE@ +DX_COND_latex_FALSE = @DX_COND_latex_FALSE@ +DX_COND_latex_TRUE = @DX_COND_latex_TRUE@ +DX_COND_man_FALSE = @DX_COND_man_FALSE@ +DX_COND_man_TRUE = @DX_COND_man_TRUE@ +DX_COND_pdf_FALSE = @DX_COND_pdf_FALSE@ +DX_COND_pdf_TRUE = @DX_COND_pdf_TRUE@ +DX_COND_ps_FALSE = @DX_COND_ps_FALSE@ +DX_COND_ps_TRUE = @DX_COND_ps_TRUE@ +DX_COND_rtf_FALSE = @DX_COND_rtf_FALSE@ +DX_COND_rtf_TRUE = @DX_COND_rtf_TRUE@ +DX_COND_xml_FALSE = @DX_COND_xml_FALSE@ +DX_COND_xml_TRUE = @DX_COND_xml_TRUE@ +DX_CONFIG = @DX_CONFIG@ +DX_DOCDIR = @DX_DOCDIR@ +DX_DOT = @DX_DOT@ +DX_DOXYGEN = @DX_DOXYGEN@ +DX_DVIPS = @DX_DVIPS@ +DX_EGREP = @DX_EGREP@ +DX_ENV = @DX_ENV@ +DX_FLAG_chi = @DX_FLAG_chi@ +DX_FLAG_chm = @DX_FLAG_chm@ +DX_FLAG_doc = @DX_FLAG_doc@ +DX_FLAG_dot = @DX_FLAG_dot@ +DX_FLAG_html = @DX_FLAG_html@ +DX_FLAG_man = @DX_FLAG_man@ +DX_FLAG_pdf = @DX_FLAG_pdf@ +DX_FLAG_ps = @DX_FLAG_ps@ +DX_FLAG_rtf = @DX_FLAG_rtf@ +DX_FLAG_xml = @DX_FLAG_xml@ +DX_HHC = @DX_HHC@ +DX_LATEX = @DX_LATEX@ +DX_MAKEINDEX = @DX_MAKEINDEX@ +DX_PDFLATEX = @DX_PDFLATEX@ +DX_PERL = @DX_PERL@ +DX_PROJECT = @DX_PROJECT@ +ECHO = @ECHO@ +ECHO_C = @ECHO_C@ +ECHO_N = @ECHO_N@ +ECHO_T = @ECHO_T@ +EGREP = @EGREP@ +EXEEXT = @EXEEXT@ +F77 = @F77@ +FFLAGS = @FFLAGS@ +GLIB_CFLAGS = @GLIB_CFLAGS@ +GLIB_LIBS = @GLIB_LIBS@ +GMYTH_MAJORMINOR = @GMYTH_MAJORMINOR@ +GMYTH_MAJOR_VERSION = @GMYTH_MAJOR_VERSION@ +GMYTH_MICRO_VERSION = @GMYTH_MICRO_VERSION@ +GMYTH_MINOR_VERSION = @GMYTH_MINOR_VERSION@ +GMYTH_NANO_VERSION = @GMYTH_NANO_VERSION@ +GMYTH_RELEASE = @GMYTH_RELEASE@ +GMYTH_VERSION = @GMYTH_VERSION@ +GOBJECT_CFLAGS = @GOBJECT_CFLAGS@ +GOBJECT_LIBS = @GOBJECT_LIBS@ +GREP = @GREP@ +GSTBASE_CFLAGS = @GSTBASE_CFLAGS@ +GSTBASE_LIBS = @GSTBASE_LIBS@ +GST_CFLAGS = @GST_CFLAGS@ +GST_LIBS = @GST_LIBS@ +GST_MAJORMINOR = @GST_MAJORMINOR@ +GTK_CFLAGS = @GTK_CFLAGS@ +GTK_LIBS = @GTK_LIBS@ +HAVE_PKGCONFIG = @HAVE_PKGCONFIG@ +HILDON_CFLAGS = @HILDON_CFLAGS@ +HILDON_LIBS = @HILDON_LIBS@ +INSTALL_DATA = @INSTALL_DATA@ +INSTALL_PROGRAM = @INSTALL_PROGRAM@ +INSTALL_SCRIPT = @INSTALL_SCRIPT@ +INSTALL_STRIP_PROGRAM = @INSTALL_STRIP_PROGRAM@ +LDFLAGS = @LDFLAGS@ +LIBGMYTH_CFLAGS = @LIBGMYTH_CFLAGS@ +LIBGMYTH_LIBS = @LIBGMYTH_LIBS@ +LIBOBJS = @LIBOBJS@ +LIBS = @LIBS@ +LIBTOOL = @LIBTOOL@ +LIBXML_CFLAGS = @LIBXML_CFLAGS@ +LIBXML_LIBS = @LIBXML_LIBS@ +LN_S = @LN_S@ +LTLIBOBJS = @LTLIBOBJS@ +MAEMO_PLATFORM_FALSE = @MAEMO_PLATFORM_FALSE@ +MAEMO_PLATFORM_TRUE = @MAEMO_PLATFORM_TRUE@ +MAINT = @MAINT@ +MAINTAINER_MODE_FALSE = @MAINTAINER_MODE_FALSE@ +MAINTAINER_MODE_TRUE = @MAINTAINER_MODE_TRUE@ +MAKEINFO = @MAKEINFO@ +MYSQL_CFLAGS = @MYSQL_CFLAGS@ +MYSQL_LIBS = @MYSQL_LIBS@ +NDEBUG_FALSE = @NDEBUG_FALSE@ +NDEBUG_TRUE = @NDEBUG_TRUE@ +OBJEXT = @OBJEXT@ +PACKAGE = @PACKAGE@ +PACKAGE_BUGREPORT = @PACKAGE_BUGREPORT@ +PACKAGE_NAME = @PACKAGE_NAME@ +PACKAGE_STRING = @PACKAGE_STRING@ +PACKAGE_TARNAME = @PACKAGE_TARNAME@ +PACKAGE_VERSION = @PACKAGE_VERSION@ +PATH_SEPARATOR = @PATH_SEPARATOR@ +PKG_CONFIG = @PKG_CONFIG@ +RANLIB = @RANLIB@ +SET_MAKE = @SET_MAKE@ +SHELL = @SHELL@ +STRIP = @STRIP@ +VERSION = @VERSION@ +WITH_GTK_FALSE = @WITH_GTK_FALSE@ +WITH_GTK_TRUE = @WITH_GTK_TRUE@ +ac_ct_CC = @ac_ct_CC@ +ac_ct_CXX = @ac_ct_CXX@ +ac_ct_F77 = @ac_ct_F77@ +am__fastdepCC_FALSE = @am__fastdepCC_FALSE@ +am__fastdepCC_TRUE = @am__fastdepCC_TRUE@ +am__fastdepCXX_FALSE = @am__fastdepCXX_FALSE@ +am__fastdepCXX_TRUE = @am__fastdepCXX_TRUE@ +am__include = @am__include@ +am__leading_dot = @am__leading_dot@ +am__quote = @am__quote@ +am__tar = @am__tar@ +am__untar = @am__untar@ +bindir = @bindir@ +build = @build@ +build_alias = @build_alias@ +build_cpu = @build_cpu@ +build_os = @build_os@ +build_vendor = @build_vendor@ +datadir = @datadir@ +datarootdir = @datarootdir@ +docdir = @docdir@ +dvidir = @dvidir@ +exec_prefix = @exec_prefix@ +host = @host@ +host_alias = @host_alias@ +host_cpu = @host_cpu@ +host_os = @host_os@ +host_vendor = @host_vendor@ +htmldir = @htmldir@ +includedir = @includedir@ +infodir = @infodir@ +install_sh = @install_sh@ +libdir = @libdir@ +libexecdir = @libexecdir@ +localedir = @localedir@ +localstatedir = @localstatedir@ +mandir = @mandir@ +mkdir_p = @mkdir_p@ +oldincludedir = @oldincludedir@ +pdfdir = @pdfdir@ +prefix = @prefix@ +program_transform_name = @program_transform_name@ +psdir = @psdir@ +sbindir = @sbindir@ +sharedstatedir = @sharedstatedir@ +sysconfdir = @sysconfdir@ +target_alias = @target_alias@ +mmyth_SOURCES = \ + mmyth_main.c \ + mmyth_ui.c \ + mmyth_uicommon.c \ + mmyth_epg_grid_view.c \ + mmyth_epg_grid_widget.c \ + mmyth_recordui.c \ + mmyth_uisettings.c \ + mmyth_schedulerui.c \ + mmyth_tvplayer.c + +mmyth_CFLAGS = \ + $(GTK_CFLAGS) \ + $(GLIB_CFLAGS) \ + $(GST_CFLAGS) \ + $(MYSQL_CFLAGS) \ + $(LIBGMYTH_CFLAGS) \ + -I$(top_srcdir)/src \ + -DDATA_DIR=\""$(pkgdatadir)"\" \ + -DPIX_DIR=\""$(pkgdatadir)/pixmaps/"\" \ + -DICON_DIR=\""$(datadir)/pixmaps/"\" \ + -g3 -O0 + +mmyth_LDADD = \ + $(LIBGMYTH_LIBS) + +all: all-am + +.SUFFIXES: +.SUFFIXES: .c .lo .o .obj +$(srcdir)/Makefile.in: @MAINTAINER_MODE_TRUE@ $(srcdir)/Makefile.am $(am__configure_deps) + @for dep in $?; do \ + case '$(am__configure_deps)' in \ + *$$dep*) \ + cd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh \ + && exit 0; \ + exit 1;; \ + esac; \ + done; \ + echo ' cd $(top_srcdir) && $(AUTOMAKE) --gnu src/Makefile'; \ + cd $(top_srcdir) && \ + $(AUTOMAKE) --gnu src/Makefile +.PRECIOUS: Makefile +Makefile: $(srcdir)/Makefile.in $(top_builddir)/config.status + @case '$?' in \ + *config.status*) \ + cd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh;; \ + *) \ + echo ' cd $(top_builddir) && $(SHELL) ./config.status $(subdir)/$@ $(am__depfiles_maybe)'; \ + cd $(top_builddir) && $(SHELL) ./config.status $(subdir)/$@ $(am__depfiles_maybe);; \ + esac; + +$(top_builddir)/config.status: $(top_srcdir)/configure $(CONFIG_STATUS_DEPENDENCIES) + cd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh + +$(top_srcdir)/configure: @MAINTAINER_MODE_TRUE@ $(am__configure_deps) + cd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh +$(ACLOCAL_M4): @MAINTAINER_MODE_TRUE@ $(am__aclocal_m4_deps) + cd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh +install-binPROGRAMS: $(bin_PROGRAMS) + @$(NORMAL_INSTALL) + test -z "$(bindir)" || $(mkdir_p) "$(DESTDIR)$(bindir)" + @list='$(bin_PROGRAMS)'; for p in $$list; do \ + p1=`echo $$p|sed 's/$(EXEEXT)$$//'`; \ + if test -f $$p \ + || test -f $$p1 \ + ; then \ + f=`echo "$$p1" | sed 's,^.*/,,;$(transform);s/$$/$(EXEEXT)/'`; \ + echo " $(INSTALL_PROGRAM_ENV) $(LIBTOOL) --mode=install $(binPROGRAMS_INSTALL) '$$p' '$(DESTDIR)$(bindir)/$$f'"; \ + $(INSTALL_PROGRAM_ENV) $(LIBTOOL) --mode=install $(binPROGRAMS_INSTALL) "$$p" "$(DESTDIR)$(bindir)/$$f" || exit 1; \ + else :; fi; \ + done + +uninstall-binPROGRAMS: + @$(NORMAL_UNINSTALL) + @list='$(bin_PROGRAMS)'; for p in $$list; do \ + f=`echo "$$p" | sed 's,^.*/,,;s/$(EXEEXT)$$//;$(transform);s/$$/$(EXEEXT)/'`; \ + echo " rm -f '$(DESTDIR)$(bindir)/$$f'"; \ + rm -f "$(DESTDIR)$(bindir)/$$f"; \ + done + +clean-binPROGRAMS: + @list='$(bin_PROGRAMS)'; for p in $$list; do \ + f=`echo $$p|sed 's/$(EXEEXT)$$//'`; \ + echo " rm -f $$p $$f"; \ + rm -f $$p $$f ; \ + done +mmyth$(EXEEXT): $(mmyth_OBJECTS) $(mmyth_DEPENDENCIES) + @rm -f mmyth$(EXEEXT) + $(LINK) $(mmyth_LDFLAGS) $(mmyth_OBJECTS) $(mmyth_LDADD) $(LIBS) + +mostlyclean-compile: + -rm -f *.$(OBJEXT) + +distclean-compile: + -rm -f *.tab.c + +@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/mmyth-mmyth_epg_grid_view.Po@am__quote@ +@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/mmyth-mmyth_epg_grid_widget.Po@am__quote@ +@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/mmyth-mmyth_main.Po@am__quote@ +@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/mmyth-mmyth_recordui.Po@am__quote@ +@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/mmyth-mmyth_schedulerui.Po@am__quote@ +@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/mmyth-mmyth_tvplayer.Po@am__quote@ +@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/mmyth-mmyth_ui.Po@am__quote@ +@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/mmyth-mmyth_uicommon.Po@am__quote@ +@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/mmyth-mmyth_uisettings.Po@am__quote@ + +.c.o: +@am__fastdepCC_TRUE@ if $(COMPILE) -MT $@ -MD -MP -MF "$(DEPDIR)/$*.Tpo" -c -o $@ $<; \ +@am__fastdepCC_TRUE@ then mv -f "$(DEPDIR)/$*.Tpo" "$(DEPDIR)/$*.Po"; else rm -f "$(DEPDIR)/$*.Tpo"; exit 1; fi +@AMDEP_TRUE@@am__fastdepCC_FALSE@ source='$<' object='$@' libtool=no @AMDEPBACKSLASH@ +@AMDEP_TRUE@@am__fastdepCC_FALSE@ DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@ +@am__fastdepCC_FALSE@ $(COMPILE) -c $< + +.c.obj: +@am__fastdepCC_TRUE@ if $(COMPILE) -MT $@ -MD -MP -MF "$(DEPDIR)/$*.Tpo" -c -o $@ `$(CYGPATH_W) '$<'`; \ +@am__fastdepCC_TRUE@ then mv -f "$(DEPDIR)/$*.Tpo" "$(DEPDIR)/$*.Po"; else rm -f "$(DEPDIR)/$*.Tpo"; exit 1; fi +@AMDEP_TRUE@@am__fastdepCC_FALSE@ source='$<' object='$@' libtool=no @AMDEPBACKSLASH@ +@AMDEP_TRUE@@am__fastdepCC_FALSE@ DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@ +@am__fastdepCC_FALSE@ $(COMPILE) -c `$(CYGPATH_W) '$<'` + +.c.lo: +@am__fastdepCC_TRUE@ if $(LTCOMPILE) -MT $@ -MD -MP -MF "$(DEPDIR)/$*.Tpo" -c -o $@ $<; \ +@am__fastdepCC_TRUE@ then mv -f "$(DEPDIR)/$*.Tpo" "$(DEPDIR)/$*.Plo"; else rm -f "$(DEPDIR)/$*.Tpo"; exit 1; fi +@AMDEP_TRUE@@am__fastdepCC_FALSE@ source='$<' object='$@' libtool=yes @AMDEPBACKSLASH@ +@AMDEP_TRUE@@am__fastdepCC_FALSE@ DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@ +@am__fastdepCC_FALSE@ $(LTCOMPILE) -c -o $@ $< + +mmyth-mmyth_main.o: mmyth_main.c +@am__fastdepCC_TRUE@ if $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(mmyth_CFLAGS) $(CFLAGS) -MT mmyth-mmyth_main.o -MD -MP -MF "$(DEPDIR)/mmyth-mmyth_main.Tpo" -c -o mmyth-mmyth_main.o `test -f 'mmyth_main.c' || echo '$(srcdir)/'`mmyth_main.c; \ +@am__fastdepCC_TRUE@ then mv -f "$(DEPDIR)/mmyth-mmyth_main.Tpo" "$(DEPDIR)/mmyth-mmyth_main.Po"; else rm -f "$(DEPDIR)/mmyth-mmyth_main.Tpo"; exit 1; fi +@AMDEP_TRUE@@am__fastdepCC_FALSE@ source='mmyth_main.c' object='mmyth-mmyth_main.o' libtool=no @AMDEPBACKSLASH@ +@AMDEP_TRUE@@am__fastdepCC_FALSE@ DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@ +@am__fastdepCC_FALSE@ $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(mmyth_CFLAGS) $(CFLAGS) -c -o mmyth-mmyth_main.o `test -f 'mmyth_main.c' || echo '$(srcdir)/'`mmyth_main.c + +mmyth-mmyth_main.obj: mmyth_main.c +@am__fastdepCC_TRUE@ if $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(mmyth_CFLAGS) $(CFLAGS) -MT mmyth-mmyth_main.obj -MD -MP -MF "$(DEPDIR)/mmyth-mmyth_main.Tpo" -c -o mmyth-mmyth_main.obj `if test -f 'mmyth_main.c'; then $(CYGPATH_W) 'mmyth_main.c'; else $(CYGPATH_W) '$(srcdir)/mmyth_main.c'; fi`; \ +@am__fastdepCC_TRUE@ then mv -f "$(DEPDIR)/mmyth-mmyth_main.Tpo" "$(DEPDIR)/mmyth-mmyth_main.Po"; else rm -f "$(DEPDIR)/mmyth-mmyth_main.Tpo"; exit 1; fi +@AMDEP_TRUE@@am__fastdepCC_FALSE@ source='mmyth_main.c' object='mmyth-mmyth_main.obj' libtool=no @AMDEPBACKSLASH@ +@AMDEP_TRUE@@am__fastdepCC_FALSE@ DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@ +@am__fastdepCC_FALSE@ $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(mmyth_CFLAGS) $(CFLAGS) -c -o mmyth-mmyth_main.obj `if test -f 'mmyth_main.c'; then $(CYGPATH_W) 'mmyth_main.c'; else $(CYGPATH_W) '$(srcdir)/mmyth_main.c'; fi` + +mmyth-mmyth_ui.o: mmyth_ui.c +@am__fastdepCC_TRUE@ if $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(mmyth_CFLAGS) $(CFLAGS) -MT mmyth-mmyth_ui.o -MD -MP -MF "$(DEPDIR)/mmyth-mmyth_ui.Tpo" -c -o mmyth-mmyth_ui.o `test -f 'mmyth_ui.c' || echo '$(srcdir)/'`mmyth_ui.c; \ +@am__fastdepCC_TRUE@ then mv -f "$(DEPDIR)/mmyth-mmyth_ui.Tpo" "$(DEPDIR)/mmyth-mmyth_ui.Po"; else rm -f "$(DEPDIR)/mmyth-mmyth_ui.Tpo"; exit 1; fi +@AMDEP_TRUE@@am__fastdepCC_FALSE@ source='mmyth_ui.c' object='mmyth-mmyth_ui.o' libtool=no @AMDEPBACKSLASH@ +@AMDEP_TRUE@@am__fastdepCC_FALSE@ DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@ +@am__fastdepCC_FALSE@ $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(mmyth_CFLAGS) $(CFLAGS) -c -o mmyth-mmyth_ui.o `test -f 'mmyth_ui.c' || echo '$(srcdir)/'`mmyth_ui.c + +mmyth-mmyth_ui.obj: mmyth_ui.c +@am__fastdepCC_TRUE@ if $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(mmyth_CFLAGS) $(CFLAGS) -MT mmyth-mmyth_ui.obj -MD -MP -MF "$(DEPDIR)/mmyth-mmyth_ui.Tpo" -c -o mmyth-mmyth_ui.obj `if test -f 'mmyth_ui.c'; then $(CYGPATH_W) 'mmyth_ui.c'; else $(CYGPATH_W) '$(srcdir)/mmyth_ui.c'; fi`; \ +@am__fastdepCC_TRUE@ then mv -f "$(DEPDIR)/mmyth-mmyth_ui.Tpo" "$(DEPDIR)/mmyth-mmyth_ui.Po"; else rm -f "$(DEPDIR)/mmyth-mmyth_ui.Tpo"; exit 1; fi +@AMDEP_TRUE@@am__fastdepCC_FALSE@ source='mmyth_ui.c' object='mmyth-mmyth_ui.obj' libtool=no @AMDEPBACKSLASH@ +@AMDEP_TRUE@@am__fastdepCC_FALSE@ DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@ +@am__fastdepCC_FALSE@ $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(mmyth_CFLAGS) $(CFLAGS) -c -o mmyth-mmyth_ui.obj `if test -f 'mmyth_ui.c'; then $(CYGPATH_W) 'mmyth_ui.c'; else $(CYGPATH_W) '$(srcdir)/mmyth_ui.c'; fi` + +mmyth-mmyth_uicommon.o: mmyth_uicommon.c +@am__fastdepCC_TRUE@ if $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(mmyth_CFLAGS) $(CFLAGS) -MT mmyth-mmyth_uicommon.o -MD -MP -MF "$(DEPDIR)/mmyth-mmyth_uicommon.Tpo" -c -o mmyth-mmyth_uicommon.o `test -f 'mmyth_uicommon.c' || echo '$(srcdir)/'`mmyth_uicommon.c; \ +@am__fastdepCC_TRUE@ then mv -f "$(DEPDIR)/mmyth-mmyth_uicommon.Tpo" "$(DEPDIR)/mmyth-mmyth_uicommon.Po"; else rm -f "$(DEPDIR)/mmyth-mmyth_uicommon.Tpo"; exit 1; fi +@AMDEP_TRUE@@am__fastdepCC_FALSE@ source='mmyth_uicommon.c' object='mmyth-mmyth_uicommon.o' libtool=no @AMDEPBACKSLASH@ +@AMDEP_TRUE@@am__fastdepCC_FALSE@ DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@ +@am__fastdepCC_FALSE@ $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(mmyth_CFLAGS) $(CFLAGS) -c -o mmyth-mmyth_uicommon.o `test -f 'mmyth_uicommon.c' || echo '$(srcdir)/'`mmyth_uicommon.c + +mmyth-mmyth_uicommon.obj: mmyth_uicommon.c +@am__fastdepCC_TRUE@ if $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(mmyth_CFLAGS) $(CFLAGS) -MT mmyth-mmyth_uicommon.obj -MD -MP -MF "$(DEPDIR)/mmyth-mmyth_uicommon.Tpo" -c -o mmyth-mmyth_uicommon.obj `if test -f 'mmyth_uicommon.c'; then $(CYGPATH_W) 'mmyth_uicommon.c'; else $(CYGPATH_W) '$(srcdir)/mmyth_uicommon.c'; fi`; \ +@am__fastdepCC_TRUE@ then mv -f "$(DEPDIR)/mmyth-mmyth_uicommon.Tpo" "$(DEPDIR)/mmyth-mmyth_uicommon.Po"; else rm -f "$(DEPDIR)/mmyth-mmyth_uicommon.Tpo"; exit 1; fi +@AMDEP_TRUE@@am__fastdepCC_FALSE@ source='mmyth_uicommon.c' object='mmyth-mmyth_uicommon.obj' libtool=no @AMDEPBACKSLASH@ +@AMDEP_TRUE@@am__fastdepCC_FALSE@ DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@ +@am__fastdepCC_FALSE@ $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(mmyth_CFLAGS) $(CFLAGS) -c -o mmyth-mmyth_uicommon.obj `if test -f 'mmyth_uicommon.c'; then $(CYGPATH_W) 'mmyth_uicommon.c'; else $(CYGPATH_W) '$(srcdir)/mmyth_uicommon.c'; fi` + +mmyth-mmyth_epg_grid_view.o: mmyth_epg_grid_view.c +@am__fastdepCC_TRUE@ if $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(mmyth_CFLAGS) $(CFLAGS) -MT mmyth-mmyth_epg_grid_view.o -MD -MP -MF "$(DEPDIR)/mmyth-mmyth_epg_grid_view.Tpo" -c -o mmyth-mmyth_epg_grid_view.o `test -f 'mmyth_epg_grid_view.c' || echo '$(srcdir)/'`mmyth_epg_grid_view.c; \ +@am__fastdepCC_TRUE@ then mv -f "$(DEPDIR)/mmyth-mmyth_epg_grid_view.Tpo" "$(DEPDIR)/mmyth-mmyth_epg_grid_view.Po"; else rm -f "$(DEPDIR)/mmyth-mmyth_epg_grid_view.Tpo"; exit 1; fi +@AMDEP_TRUE@@am__fastdepCC_FALSE@ source='mmyth_epg_grid_view.c' object='mmyth-mmyth_epg_grid_view.o' libtool=no @AMDEPBACKSLASH@ +@AMDEP_TRUE@@am__fastdepCC_FALSE@ DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@ +@am__fastdepCC_FALSE@ $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(mmyth_CFLAGS) $(CFLAGS) -c -o mmyth-mmyth_epg_grid_view.o `test -f 'mmyth_epg_grid_view.c' || echo '$(srcdir)/'`mmyth_epg_grid_view.c + +mmyth-mmyth_epg_grid_view.obj: mmyth_epg_grid_view.c +@am__fastdepCC_TRUE@ if $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(mmyth_CFLAGS) $(CFLAGS) -MT mmyth-mmyth_epg_grid_view.obj -MD -MP -MF "$(DEPDIR)/mmyth-mmyth_epg_grid_view.Tpo" -c -o mmyth-mmyth_epg_grid_view.obj `if test -f 'mmyth_epg_grid_view.c'; then $(CYGPATH_W) 'mmyth_epg_grid_view.c'; else $(CYGPATH_W) '$(srcdir)/mmyth_epg_grid_view.c'; fi`; \ +@am__fastdepCC_TRUE@ then mv -f "$(DEPDIR)/mmyth-mmyth_epg_grid_view.Tpo" "$(DEPDIR)/mmyth-mmyth_epg_grid_view.Po"; else rm -f "$(DEPDIR)/mmyth-mmyth_epg_grid_view.Tpo"; exit 1; fi +@AMDEP_TRUE@@am__fastdepCC_FALSE@ source='mmyth_epg_grid_view.c' object='mmyth-mmyth_epg_grid_view.obj' libtool=no @AMDEPBACKSLASH@ +@AMDEP_TRUE@@am__fastdepCC_FALSE@ DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@ +@am__fastdepCC_FALSE@ $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(mmyth_CFLAGS) $(CFLAGS) -c -o mmyth-mmyth_epg_grid_view.obj `if test -f 'mmyth_epg_grid_view.c'; then $(CYGPATH_W) 'mmyth_epg_grid_view.c'; else $(CYGPATH_W) '$(srcdir)/mmyth_epg_grid_view.c'; fi` + +mmyth-mmyth_epg_grid_widget.o: mmyth_epg_grid_widget.c +@am__fastdepCC_TRUE@ if $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(mmyth_CFLAGS) $(CFLAGS) -MT mmyth-mmyth_epg_grid_widget.o -MD -MP -MF "$(DEPDIR)/mmyth-mmyth_epg_grid_widget.Tpo" -c -o mmyth-mmyth_epg_grid_widget.o `test -f 'mmyth_epg_grid_widget.c' || echo '$(srcdir)/'`mmyth_epg_grid_widget.c; \ +@am__fastdepCC_TRUE@ then mv -f "$(DEPDIR)/mmyth-mmyth_epg_grid_widget.Tpo" "$(DEPDIR)/mmyth-mmyth_epg_grid_widget.Po"; else rm -f "$(DEPDIR)/mmyth-mmyth_epg_grid_widget.Tpo"; exit 1; fi +@AMDEP_TRUE@@am__fastdepCC_FALSE@ source='mmyth_epg_grid_widget.c' object='mmyth-mmyth_epg_grid_widget.o' libtool=no @AMDEPBACKSLASH@ +@AMDEP_TRUE@@am__fastdepCC_FALSE@ DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@ +@am__fastdepCC_FALSE@ $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(mmyth_CFLAGS) $(CFLAGS) -c -o mmyth-mmyth_epg_grid_widget.o `test -f 'mmyth_epg_grid_widget.c' || echo '$(srcdir)/'`mmyth_epg_grid_widget.c + +mmyth-mmyth_epg_grid_widget.obj: mmyth_epg_grid_widget.c +@am__fastdepCC_TRUE@ if $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(mmyth_CFLAGS) $(CFLAGS) -MT mmyth-mmyth_epg_grid_widget.obj -MD -MP -MF "$(DEPDIR)/mmyth-mmyth_epg_grid_widget.Tpo" -c -o mmyth-mmyth_epg_grid_widget.obj `if test -f 'mmyth_epg_grid_widget.c'; then $(CYGPATH_W) 'mmyth_epg_grid_widget.c'; else $(CYGPATH_W) '$(srcdir)/mmyth_epg_grid_widget.c'; fi`; \ +@am__fastdepCC_TRUE@ then mv -f "$(DEPDIR)/mmyth-mmyth_epg_grid_widget.Tpo" "$(DEPDIR)/mmyth-mmyth_epg_grid_widget.Po"; else rm -f "$(DEPDIR)/mmyth-mmyth_epg_grid_widget.Tpo"; exit 1; fi +@AMDEP_TRUE@@am__fastdepCC_FALSE@ source='mmyth_epg_grid_widget.c' object='mmyth-mmyth_epg_grid_widget.obj' libtool=no @AMDEPBACKSLASH@ +@AMDEP_TRUE@@am__fastdepCC_FALSE@ DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@ +@am__fastdepCC_FALSE@ $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(mmyth_CFLAGS) $(CFLAGS) -c -o mmyth-mmyth_epg_grid_widget.obj `if test -f 'mmyth_epg_grid_widget.c'; then $(CYGPATH_W) 'mmyth_epg_grid_widget.c'; else $(CYGPATH_W) '$(srcdir)/mmyth_epg_grid_widget.c'; fi` + +mmyth-mmyth_recordui.o: mmyth_recordui.c +@am__fastdepCC_TRUE@ if $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(mmyth_CFLAGS) $(CFLAGS) -MT mmyth-mmyth_recordui.o -MD -MP -MF "$(DEPDIR)/mmyth-mmyth_recordui.Tpo" -c -o mmyth-mmyth_recordui.o `test -f 'mmyth_recordui.c' || echo '$(srcdir)/'`mmyth_recordui.c; \ +@am__fastdepCC_TRUE@ then mv -f "$(DEPDIR)/mmyth-mmyth_recordui.Tpo" "$(DEPDIR)/mmyth-mmyth_recordui.Po"; else rm -f "$(DEPDIR)/mmyth-mmyth_recordui.Tpo"; exit 1; fi +@AMDEP_TRUE@@am__fastdepCC_FALSE@ source='mmyth_recordui.c' object='mmyth-mmyth_recordui.o' libtool=no @AMDEPBACKSLASH@ +@AMDEP_TRUE@@am__fastdepCC_FALSE@ DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@ +@am__fastdepCC_FALSE@ $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(mmyth_CFLAGS) $(CFLAGS) -c -o mmyth-mmyth_recordui.o `test -f 'mmyth_recordui.c' || echo '$(srcdir)/'`mmyth_recordui.c + +mmyth-mmyth_recordui.obj: mmyth_recordui.c +@am__fastdepCC_TRUE@ if $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(mmyth_CFLAGS) $(CFLAGS) -MT mmyth-mmyth_recordui.obj -MD -MP -MF "$(DEPDIR)/mmyth-mmyth_recordui.Tpo" -c -o mmyth-mmyth_recordui.obj `if test -f 'mmyth_recordui.c'; then $(CYGPATH_W) 'mmyth_recordui.c'; else $(CYGPATH_W) '$(srcdir)/mmyth_recordui.c'; fi`; \ +@am__fastdepCC_TRUE@ then mv -f "$(DEPDIR)/mmyth-mmyth_recordui.Tpo" "$(DEPDIR)/mmyth-mmyth_recordui.Po"; else rm -f "$(DEPDIR)/mmyth-mmyth_recordui.Tpo"; exit 1; fi +@AMDEP_TRUE@@am__fastdepCC_FALSE@ source='mmyth_recordui.c' object='mmyth-mmyth_recordui.obj' libtool=no @AMDEPBACKSLASH@ +@AMDEP_TRUE@@am__fastdepCC_FALSE@ DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@ +@am__fastdepCC_FALSE@ $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(mmyth_CFLAGS) $(CFLAGS) -c -o mmyth-mmyth_recordui.obj `if test -f 'mmyth_recordui.c'; then $(CYGPATH_W) 'mmyth_recordui.c'; else $(CYGPATH_W) '$(srcdir)/mmyth_recordui.c'; fi` + +mmyth-mmyth_uisettings.o: mmyth_uisettings.c +@am__fastdepCC_TRUE@ if $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(mmyth_CFLAGS) $(CFLAGS) -MT mmyth-mmyth_uisettings.o -MD -MP -MF "$(DEPDIR)/mmyth-mmyth_uisettings.Tpo" -c -o mmyth-mmyth_uisettings.o `test -f 'mmyth_uisettings.c' || echo '$(srcdir)/'`mmyth_uisettings.c; \ +@am__fastdepCC_TRUE@ then mv -f "$(DEPDIR)/mmyth-mmyth_uisettings.Tpo" "$(DEPDIR)/mmyth-mmyth_uisettings.Po"; else rm -f "$(DEPDIR)/mmyth-mmyth_uisettings.Tpo"; exit 1; fi +@AMDEP_TRUE@@am__fastdepCC_FALSE@ source='mmyth_uisettings.c' object='mmyth-mmyth_uisettings.o' libtool=no @AMDEPBACKSLASH@ +@AMDEP_TRUE@@am__fastdepCC_FALSE@ DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@ +@am__fastdepCC_FALSE@ $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(mmyth_CFLAGS) $(CFLAGS) -c -o mmyth-mmyth_uisettings.o `test -f 'mmyth_uisettings.c' || echo '$(srcdir)/'`mmyth_uisettings.c + +mmyth-mmyth_uisettings.obj: mmyth_uisettings.c +@am__fastdepCC_TRUE@ if $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(mmyth_CFLAGS) $(CFLAGS) -MT mmyth-mmyth_uisettings.obj -MD -MP -MF "$(DEPDIR)/mmyth-mmyth_uisettings.Tpo" -c -o mmyth-mmyth_uisettings.obj `if test -f 'mmyth_uisettings.c'; then $(CYGPATH_W) 'mmyth_uisettings.c'; else $(CYGPATH_W) '$(srcdir)/mmyth_uisettings.c'; fi`; \ +@am__fastdepCC_TRUE@ then mv -f "$(DEPDIR)/mmyth-mmyth_uisettings.Tpo" "$(DEPDIR)/mmyth-mmyth_uisettings.Po"; else rm -f "$(DEPDIR)/mmyth-mmyth_uisettings.Tpo"; exit 1; fi +@AMDEP_TRUE@@am__fastdepCC_FALSE@ source='mmyth_uisettings.c' object='mmyth-mmyth_uisettings.obj' libtool=no @AMDEPBACKSLASH@ +@AMDEP_TRUE@@am__fastdepCC_FALSE@ DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@ +@am__fastdepCC_FALSE@ $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(mmyth_CFLAGS) $(CFLAGS) -c -o mmyth-mmyth_uisettings.obj `if test -f 'mmyth_uisettings.c'; then $(CYGPATH_W) 'mmyth_uisettings.c'; else $(CYGPATH_W) '$(srcdir)/mmyth_uisettings.c'; fi` + +mmyth-mmyth_schedulerui.o: mmyth_schedulerui.c +@am__fastdepCC_TRUE@ if $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(mmyth_CFLAGS) $(CFLAGS) -MT mmyth-mmyth_schedulerui.o -MD -MP -MF "$(DEPDIR)/mmyth-mmyth_schedulerui.Tpo" -c -o mmyth-mmyth_schedulerui.o `test -f 'mmyth_schedulerui.c' || echo '$(srcdir)/'`mmyth_schedulerui.c; \ +@am__fastdepCC_TRUE@ then mv -f "$(DEPDIR)/mmyth-mmyth_schedulerui.Tpo" "$(DEPDIR)/mmyth-mmyth_schedulerui.Po"; else rm -f "$(DEPDIR)/mmyth-mmyth_schedulerui.Tpo"; exit 1; fi +@AMDEP_TRUE@@am__fastdepCC_FALSE@ source='mmyth_schedulerui.c' object='mmyth-mmyth_schedulerui.o' libtool=no @AMDEPBACKSLASH@ +@AMDEP_TRUE@@am__fastdepCC_FALSE@ DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@ +@am__fastdepCC_FALSE@ $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(mmyth_CFLAGS) $(CFLAGS) -c -o mmyth-mmyth_schedulerui.o `test -f 'mmyth_schedulerui.c' || echo '$(srcdir)/'`mmyth_schedulerui.c + +mmyth-mmyth_schedulerui.obj: mmyth_schedulerui.c +@am__fastdepCC_TRUE@ if $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(mmyth_CFLAGS) $(CFLAGS) -MT mmyth-mmyth_schedulerui.obj -MD -MP -MF "$(DEPDIR)/mmyth-mmyth_schedulerui.Tpo" -c -o mmyth-mmyth_schedulerui.obj `if test -f 'mmyth_schedulerui.c'; then $(CYGPATH_W) 'mmyth_schedulerui.c'; else $(CYGPATH_W) '$(srcdir)/mmyth_schedulerui.c'; fi`; \ +@am__fastdepCC_TRUE@ then mv -f "$(DEPDIR)/mmyth-mmyth_schedulerui.Tpo" "$(DEPDIR)/mmyth-mmyth_schedulerui.Po"; else rm -f "$(DEPDIR)/mmyth-mmyth_schedulerui.Tpo"; exit 1; fi +@AMDEP_TRUE@@am__fastdepCC_FALSE@ source='mmyth_schedulerui.c' object='mmyth-mmyth_schedulerui.obj' libtool=no @AMDEPBACKSLASH@ +@AMDEP_TRUE@@am__fastdepCC_FALSE@ DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@ +@am__fastdepCC_FALSE@ $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(mmyth_CFLAGS) $(CFLAGS) -c -o mmyth-mmyth_schedulerui.obj `if test -f 'mmyth_schedulerui.c'; then $(CYGPATH_W) 'mmyth_schedulerui.c'; else $(CYGPATH_W) '$(srcdir)/mmyth_schedulerui.c'; fi` + +mmyth-mmyth_tvplayer.o: mmyth_tvplayer.c +@am__fastdepCC_TRUE@ if $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(mmyth_CFLAGS) $(CFLAGS) -MT mmyth-mmyth_tvplayer.o -MD -MP -MF "$(DEPDIR)/mmyth-mmyth_tvplayer.Tpo" -c -o mmyth-mmyth_tvplayer.o `test -f 'mmyth_tvplayer.c' || echo '$(srcdir)/'`mmyth_tvplayer.c; \ +@am__fastdepCC_TRUE@ then mv -f "$(DEPDIR)/mmyth-mmyth_tvplayer.Tpo" "$(DEPDIR)/mmyth-mmyth_tvplayer.Po"; else rm -f "$(DEPDIR)/mmyth-mmyth_tvplayer.Tpo"; exit 1; fi +@AMDEP_TRUE@@am__fastdepCC_FALSE@ source='mmyth_tvplayer.c' object='mmyth-mmyth_tvplayer.o' libtool=no @AMDEPBACKSLASH@ +@AMDEP_TRUE@@am__fastdepCC_FALSE@ DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@ +@am__fastdepCC_FALSE@ $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(mmyth_CFLAGS) $(CFLAGS) -c -o mmyth-mmyth_tvplayer.o `test -f 'mmyth_tvplayer.c' || echo '$(srcdir)/'`mmyth_tvplayer.c + +mmyth-mmyth_tvplayer.obj: mmyth_tvplayer.c +@am__fastdepCC_TRUE@ if $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(mmyth_CFLAGS) $(CFLAGS) -MT mmyth-mmyth_tvplayer.obj -MD -MP -MF "$(DEPDIR)/mmyth-mmyth_tvplayer.Tpo" -c -o mmyth-mmyth_tvplayer.obj `if test -f 'mmyth_tvplayer.c'; then $(CYGPATH_W) 'mmyth_tvplayer.c'; else $(CYGPATH_W) '$(srcdir)/mmyth_tvplayer.c'; fi`; \ +@am__fastdepCC_TRUE@ then mv -f "$(DEPDIR)/mmyth-mmyth_tvplayer.Tpo" "$(DEPDIR)/mmyth-mmyth_tvplayer.Po"; else rm -f "$(DEPDIR)/mmyth-mmyth_tvplayer.Tpo"; exit 1; fi +@AMDEP_TRUE@@am__fastdepCC_FALSE@ source='mmyth_tvplayer.c' object='mmyth-mmyth_tvplayer.obj' libtool=no @AMDEPBACKSLASH@ +@AMDEP_TRUE@@am__fastdepCC_FALSE@ DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@ +@am__fastdepCC_FALSE@ $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(mmyth_CFLAGS) $(CFLAGS) -c -o mmyth-mmyth_tvplayer.obj `if test -f 'mmyth_tvplayer.c'; then $(CYGPATH_W) 'mmyth_tvplayer.c'; else $(CYGPATH_W) '$(srcdir)/mmyth_tvplayer.c'; fi` + +mostlyclean-libtool: + -rm -f *.lo + +clean-libtool: + -rm -rf .libs _libs + +distclean-libtool: + -rm -f libtool +uninstall-info-am: + +ID: $(HEADERS) $(SOURCES) $(LISP) $(TAGS_FILES) + list='$(SOURCES) $(HEADERS) $(LISP) $(TAGS_FILES)'; \ + unique=`for i in $$list; do \ + if test -f "$$i"; then echo $$i; else echo $(srcdir)/$$i; fi; \ + done | \ + $(AWK) ' { files[$$0] = 1; } \ + END { for (i in files) print i; }'`; \ + mkid -fID $$unique +tags: TAGS + +TAGS: $(HEADERS) $(SOURCES) $(TAGS_DEPENDENCIES) \ + $(TAGS_FILES) $(LISP) + tags=; \ + here=`pwd`; \ + list='$(SOURCES) $(HEADERS) $(LISP) $(TAGS_FILES)'; \ + unique=`for i in $$list; do \ + if test -f "$$i"; then echo $$i; else echo $(srcdir)/$$i; fi; \ + done | \ + $(AWK) ' { files[$$0] = 1; } \ + END { for (i in files) print i; }'`; \ + if test -z "$(ETAGS_ARGS)$$tags$$unique"; then :; else \ + test -n "$$unique" || unique=$$empty_fix; \ + $(ETAGS) $(ETAGSFLAGS) $(AM_ETAGSFLAGS) $(ETAGS_ARGS) \ + $$tags $$unique; \ + fi +ctags: CTAGS +CTAGS: $(HEADERS) $(SOURCES) $(TAGS_DEPENDENCIES) \ + $(TAGS_FILES) $(LISP) + tags=; \ + here=`pwd`; \ + list='$(SOURCES) $(HEADERS) $(LISP) $(TAGS_FILES)'; \ + unique=`for i in $$list; do \ + if test -f "$$i"; then echo $$i; else echo $(srcdir)/$$i; fi; \ + done | \ + $(AWK) ' { files[$$0] = 1; } \ + END { for (i in files) print i; }'`; \ + test -z "$(CTAGS_ARGS)$$tags$$unique" \ + || $(CTAGS) $(CTAGSFLAGS) $(AM_CTAGSFLAGS) $(CTAGS_ARGS) \ + $$tags $$unique + +GTAGS: + here=`$(am__cd) $(top_builddir) && pwd` \ + && cd $(top_srcdir) \ + && gtags -i $(GTAGS_ARGS) $$here + +distclean-tags: + -rm -f TAGS ID GTAGS GRTAGS GSYMS GPATH tags + +distdir: $(DISTFILES) + @srcdirstrip=`echo "$(srcdir)" | sed 's|.|.|g'`; \ + topsrcdirstrip=`echo "$(top_srcdir)" | sed 's|.|.|g'`; \ + list='$(DISTFILES)'; for file in $$list; do \ + case $$file in \ + $(srcdir)/*) file=`echo "$$file" | sed "s|^$$srcdirstrip/||"`;; \ + $(top_srcdir)/*) file=`echo "$$file" | sed "s|^$$topsrcdirstrip/|$(top_builddir)/|"`;; \ + esac; \ + if test -f $$file || test -d $$file; then d=.; else d=$(srcdir); fi; \ + dir=`echo "$$file" | sed -e 's,/[^/]*$$,,'`; \ + if test "$$dir" != "$$file" && test "$$dir" != "."; then \ + dir="/$$dir"; \ + $(mkdir_p) "$(distdir)$$dir"; \ + else \ + dir=''; \ + fi; \ + if test -d $$d/$$file; then \ + if test -d $(srcdir)/$$file && test $$d != $(srcdir); then \ + cp -pR $(srcdir)/$$file $(distdir)$$dir || exit 1; \ + fi; \ + cp -pR $$d/$$file $(distdir)$$dir || exit 1; \ + else \ + test -f $(distdir)/$$file \ + || cp -p $$d/$$file $(distdir)/$$file \ + || exit 1; \ + fi; \ + done +check-am: all-am +check: check-am +all-am: Makefile $(PROGRAMS) +installdirs: + for dir in "$(DESTDIR)$(bindir)"; do \ + test -z "$$dir" || $(mkdir_p) "$$dir"; \ + done +install: install-am +install-exec: install-exec-am +install-data: install-data-am +uninstall: uninstall-am + +install-am: all-am + @$(MAKE) $(AM_MAKEFLAGS) install-exec-am install-data-am + +installcheck: installcheck-am +install-strip: + $(MAKE) $(AM_MAKEFLAGS) INSTALL_PROGRAM="$(INSTALL_STRIP_PROGRAM)" \ + install_sh_PROGRAM="$(INSTALL_STRIP_PROGRAM)" INSTALL_STRIP_FLAG=-s \ + `test -z '$(STRIP)' || \ + echo "INSTALL_PROGRAM_ENV=STRIPPROG='$(STRIP)'"` install +mostlyclean-generic: + +clean-generic: + +distclean-generic: + -test -z "$(CONFIG_CLEAN_FILES)" || rm -f $(CONFIG_CLEAN_FILES) + +maintainer-clean-generic: + @echo "This command is intended for maintainers to use" + @echo "it deletes files that may require special tools to rebuild." +clean: clean-am + +clean-am: clean-binPROGRAMS clean-generic clean-libtool mostlyclean-am + +distclean: distclean-am + -rm -rf ./$(DEPDIR) + -rm -f Makefile +distclean-am: clean-am distclean-compile distclean-generic \ + distclean-libtool distclean-tags + +dvi: dvi-am + +dvi-am: + +html: html-am + +info: info-am + +info-am: + +install-data-am: + +install-exec-am: install-binPROGRAMS + +install-info: install-info-am + +install-man: + +installcheck-am: + +maintainer-clean: maintainer-clean-am + -rm -rf ./$(DEPDIR) + -rm -f Makefile +maintainer-clean-am: distclean-am maintainer-clean-generic + +mostlyclean: mostlyclean-am + +mostlyclean-am: mostlyclean-compile mostlyclean-generic \ + mostlyclean-libtool + +pdf: pdf-am + +pdf-am: + +ps: ps-am + +ps-am: + +uninstall-am: uninstall-binPROGRAMS uninstall-info-am + +.PHONY: CTAGS GTAGS all all-am check check-am clean clean-binPROGRAMS \ + clean-generic clean-libtool ctags distclean distclean-compile \ + distclean-generic distclean-libtool distclean-tags distdir dvi \ + dvi-am html html-am info info-am install install-am \ + install-binPROGRAMS install-data install-data-am install-exec \ + install-exec-am install-info install-info-am install-man \ + install-strip installcheck installcheck-am installdirs \ + maintainer-clean maintainer-clean-generic mostlyclean \ + mostlyclean-compile mostlyclean-generic mostlyclean-libtool \ + pdf pdf-am ps ps-am tags uninstall uninstall-am \ + uninstall-binPROGRAMS uninstall-info-am + +# Tell versions [3.59,3.63) of GNU make to not export all variables. +# Otherwise a system limit (for SysV at least) may be exceeded. +.NOEXPORT: diff -r 7c409a042a9a -r 7174e23f7617 maemo-ui/src/mmyth_epg_grid_view.c --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/maemo-ui/src/mmyth_epg_grid_view.c Thu Sep 28 16:02:14 2006 +0100 @@ -0,0 +1,213 @@ +#include +#include +#include +#include +#include + +#include "mmyth_epg_grid_view.h" +#include "mmyth_epg_grid_widget.h" + +/* Service genre */ +#define GENRE_MIN 0 +#define GENRE_MAX 10 +#define GENRE_UNDEFINED 0 +#define GENRE_MOVIE 1 +#define GENRE_NEWS 2 +#define GENRE_SHOW 3 +#define GENRE_SPORTS 4 +#define GENRE_CHILDREN 5 +#define GENRE_MUSIC 6 +#define GENRE_CULTURE 7 +#define GENRE_SOCIAL 8 +#define GENRE_EDUCATION 9 +#define GENRE_LEISURE 10 + +#define NRO_HOURS 3 + +/* Function prototypes*/ +static void update_service_details(MMythEpgGridWidget *object, + gpointer arg1, gpointer user_data); +static gboolean key_press_epg_grid_view(GtkWidget * widget, + GdkEventKey * event, + gpointer user_data); + +static GtkWidget *mmyth_epg_grid_widget = NULL; + +/* is a GtkEventBox */ +static GtkWidget *program_details_area = NULL; +static GtkWidget *details_main_hbox = NULL; +static GtkWidget *details_vbox = NULL; +static GtkWidget *details_logo_vbox = NULL; + +/* update signal callback from MMythEpgGridWidget */ +static void +update_service_details(MMythEpgGridWidget *object, gpointer arg1, gpointer user_data) +{ + g_return_if_fail(arg1 != NULL); + + EpgGridItem *epg_grid_item = (EpgGridItem *) arg1; + + gchar sel_prog_desc[100] = ""; + gchar time_buffer[50]; + + /* FIXME: get first content from content_list*/ + GMythProgramInfo *proginfo = (GMythProgramInfo *) epg_grid_item->proginfo; + + if(proginfo) { + GString *prog_name = proginfo->title; + GString *service_name = proginfo->chanid; + + if(details_vbox != NULL) + gtk_container_remove (GTK_CONTAINER (details_main_hbox), details_vbox); + + /* update service description */ + strcat(sel_prog_desc, service_name->str); + strcat(sel_prog_desc, ""); + + GtkWidget *fst_line_lbl = gtk_label_new(NULL); + gtk_misc_set_alignment (GTK_MISC(fst_line_lbl), 0.0, 0.0); + gtk_label_set_markup(GTK_LABEL(fst_line_lbl), sel_prog_desc); + + /* freeing char[] */ + sel_prog_desc[0] = 0; + strcat(sel_prog_desc, "\t"); + strcat(sel_prog_desc, prog_name->str); + + struct tm loctime_start, loctime_end; + + // Convert it to local time representation. + /* FIXME: conversion from time to localtime is different + in different machines */ + long int schedule_start_time = proginfo->startts; + long int schedule_end_time = proginfo->endts; + + if (localtime_r(&schedule_start_time, &loctime_start) == NULL) { + g_warning ("localtime_r error in mmyth_epg_grid_view!\n"); + } + + #if 0 + fprintf (stderr, asctime (loctime_start)); + #endif + + strftime (time_buffer, 100, " %H:%M - ", &loctime_start); + strcat(sel_prog_desc, time_buffer ); + + if (localtime_r(&schedule_end_time, &loctime_end) == NULL) { + g_warning ("localtime_r error in mmyth_epg_grid_view!\n"); + } + + #if 0 + fprintf (stderr, asctime (loctime_end)); + #endif + + strftime (time_buffer, 100, "%H:%M\n", &loctime_end); + strcat(sel_prog_desc, time_buffer ); + + GtkWidget *snd_line_lbl = gtk_label_new(NULL); + gtk_misc_set_alignment (GTK_MISC(snd_line_lbl), 0.0, 0.0); + gtk_label_set_markup(GTK_LABEL(snd_line_lbl), sel_prog_desc); + + // add the current selected program description to the label + details_vbox = gtk_vbox_new(FALSE, 0); + GtkWidget *fst_line_hbox = gtk_hbox_new(FALSE, 0); + + gtk_box_pack_start (GTK_BOX (fst_line_hbox), + fst_line_lbl, FALSE, FALSE, 6); + gtk_box_pack_start (GTK_BOX (details_vbox), + fst_line_hbox, FALSE, FALSE, 0); + gtk_box_pack_start (GTK_BOX (details_vbox), + snd_line_lbl, FALSE, FALSE, 0); + gtk_box_pack_start (GTK_BOX (details_main_hbox), + details_vbox, FALSE, FALSE, 0); + + gtk_widget_show_all(details_main_hbox); + } +} + +/* Callback for hardware keys */ +static gboolean +key_press_epg_grid_view(GtkWidget * widget, + GdkEventKey * event, gpointer user_data) +{ + MMythEpgGridWidget *mmyth_epg_grid_widget = (MMythEpgGridWidget *) user_data; + + return mmyth_epg_grid_widget_key_press(mmyth_epg_grid_widget, widget, event); +} + +GtkWidget * +epg_grid_view_new (MMythUi* mmyth_ui) +{ + GtkWidget *scrolled_window; + scrolled_window = gtk_scrolled_window_new (NULL, NULL); + gtk_scrolled_window_set_policy (GTK_SCROLLED_WINDOW (scrolled_window), + GTK_POLICY_NEVER, GTK_POLICY_AUTOMATIC); + + gtk_widget_modify_bg(scrolled_window, GTK_STATE_NORMAL, &main_bg_color); + + GtkWidget *main_vbox = gtk_vbox_new (FALSE, 0); + //gtk_container_set_border_width(main_vbox, 4); + + GtkWidget *details_event_box = gtk_event_box_new(); + gtk_widget_modify_bg(details_event_box, GTK_STATE_NORMAL, &main_bg_color); + + program_details_area = gtk_vbox_new (FALSE, 0); + gtk_container_add (GTK_CONTAINER (details_event_box), + program_details_area); + gtk_container_set_border_width(GTK_CONTAINER (program_details_area), 4); + + details_main_hbox = gtk_hbox_new (FALSE, 10); + + gtk_box_pack_start (GTK_BOX (program_details_area), + details_main_hbox, FALSE, FALSE, 0); + + details_logo_vbox = gtk_vbox_new (FALSE, 0); + + GtkWidget *details_desc_vbox = gtk_vbox_new (FALSE, 0); + + gtk_box_pack_start (GTK_BOX (details_main_hbox), + details_desc_vbox, FALSE, FALSE, 0); + gtk_box_pack_start (GTK_BOX (details_main_hbox), + details_logo_vbox, FALSE, FALSE, 0); + + gtk_widget_set_size_request (program_details_area, -1, 120); + + mmyth_epg_grid_widget = mmyth_epg_grid_widget_new(); + g_signal_connect(mmyth_epg_grid_widget, "selection_updated", + G_CALLBACK (update_service_details), NULL); + + /* select by default the first service */ + /* depends on mount services */ + if (MMYTH_EPG_GRID_WIDGET(mmyth_epg_grid_widget)->epg_view_model) { + GList *fst_service = (GList *) + MMYTH_EPG_GRID_WIDGET(mmyth_epg_grid_widget)->epg_view_model->data; + mmyth_epg_grid_widget_update_service(MMYTH_EPG_GRID_WIDGET(mmyth_epg_grid_widget), + fst_service); + } + + gtk_box_pack_start (GTK_BOX (main_vbox), + details_event_box, FALSE, FALSE, 0); + gtk_box_pack_start (GTK_BOX (main_vbox), + gtk_hseparator_new(), FALSE, FALSE, 0); + gtk_box_pack_start (GTK_BOX (main_vbox), + mmyth_epg_grid_widget, FALSE, FALSE, 0); + + gtk_scrolled_window_add_with_viewport (GTK_SCROLLED_WINDOW (scrolled_window), + main_vbox); + + /* Add hardware button listener to application */ + g_signal_connect(mmyth_ui->main_window, "key_press_event", + G_CALLBACK (key_press_epg_grid_view), mmyth_epg_grid_widget); + + gtk_widget_show_all (scrolled_window); + + return scrolled_window; +} + +/* +DVBHScheduleEvent * +mmyth_epg_grid_view_get_selected_schedule() +{ + return mmyth_epg_grid_get_selected_schedule + (MMYTH_EPG_GRID_WIDGET(mmyth_epg_grid_widget)); +} +*/ diff -r 7c409a042a9a -r 7174e23f7617 maemo-ui/src/mmyth_epg_grid_view.h --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/maemo-ui/src/mmyth_epg_grid_view.h Thu Sep 28 16:02:14 2006 +0100 @@ -0,0 +1,8 @@ +#ifndef MMYTH_ESG_GRID_VIEW_H_ +#define MMYTH_ESG_GRID_VIEW_H_ + +#include "mmyth_ui.h" + +GtkWidget *epg_grid_view_new(MMythUi * mmyth_ui); + +#endif /* MMYTH_ESG_GRID_VIEW_H_ */ diff -r 7c409a042a9a -r 7174e23f7617 maemo-ui/src/mmyth_epg_grid_widget.c --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/maemo-ui/src/mmyth_epg_grid_widget.c Thu Sep 28 16:02:14 2006 +0100 @@ -0,0 +1,622 @@ +#include +#include +#include + +#include "mmyth_uicommon.h" +#include "mmyth_epg_grid_widget.h" + +#include "gmyth_util.h" +#include "gmyth_epg.h" + +#define PIXELS_HOUR 105 +#define PROGRAM_SEPARATION 2 + +enum { + SELECTION_UPDATED_SIGNAL, + LAST_SIGNAL +}; + +struct _MMythEpgGridWidgetPrivate { + /* private widget components */ + GtkWidget *epg_channels_vbox; + GtkWidget *epg_programs_vbox; + + GHashTable *service_model_hash; + + /* guidegrid attributes */ + gboolean show_favorites; + gint current_start_channel_id; + + time_t current_start_time; + time_t current_end_time; + + guint selected_channel_index; + + /* GList of ProgramInfo for each Channel */ + GList * program_list[MAX_DISPLAY_CHANS]; + GList * channel_list; + + GMythEPG *mmyth_epg; + + gint DISPLAY_CHANS; +}; + +static void mmyth_epg_grid_widget_class_init (MMythEpgGridWidgetClass *klass); +static void mmyth_epg_grid_widget_init (MMythEpgGridWidget *object); +static void mmyth_epg_grid_widget_private_init (MMythEpgGridWidgetPrivate *private); +static void mmyth_epg_grid_widget_mount_services (MMythEpgGridWidget *object, + int start_time, int end_time); +static void mmyth_epg_grid_widget_mount_header (MMythEpgGridWidget *object); +static void mmyth_epg_grid_widget_clicked (GtkWidget* widget, + GdkEventExpose *event, + gpointer data); +static GtkWidget *create_event_box_lbl (gchar *str, int width, + const GdkColor *bg_color, + const GdkColor *fg_color); + +static void mmyth_epg_grid_widget_fill_programinfos(MMythEpgGridWidgetPrivate *private); +static void mmyth_epg_grid_widget_fill_program_row_infos( + MMythEpgGridWidgetPrivate *private, + unsigned int chanNum, unsigned int row); + +static gint mmyth_epg_grid_widget_signals[LAST_SIGNAL] = { 0 }; + +G_DEFINE_TYPE(MMythEpgGridWidget, mmyth_epg_grid_widget, GTK_TYPE_EVENT_BOX) + +static void +mmyth_epg_grid_widget_class_init (MMythEpgGridWidgetClass *klass) +{ + g_type_class_add_private (klass, sizeof (MMythEpgGridWidgetPrivate)); + + mmyth_epg_grid_widget_signals[SELECTION_UPDATED_SIGNAL] = g_signal_new ( + "selection_updated", + G_TYPE_FROM_CLASS(klass), + G_SIGNAL_RUN_FIRST, + 0, + NULL, + NULL, + g_cclosure_marshal_VOID__POINTER, + G_TYPE_NONE, + 1, + G_TYPE_POINTER); +} + +static void +mmyth_epg_grid_widget_private_init (MMythEpgGridWidgetPrivate *private) +{ + time_t cur_time; + + g_return_if_fail(private != NULL); + + private->epg_channels_vbox = NULL; + private->epg_programs_vbox = NULL; + private->service_model_hash = NULL; + + private->show_favorites = FALSE; + private->current_start_channel_id = -1; + + /* Selected the first diplayable channel initially */ + private->selected_channel_index = 0; + + /* TODO fix the current start/end time */ + private->current_start_time = time(&cur_time); + private->current_end_time = time(&cur_time) + 10800; + + private->DISPLAY_CHANS = MAX_DISPLAY_CHANS; + + // TODO: Close the epg and unref it in dispose call + private->mmyth_epg = gmyth_epg_new (); + if (!gmyth_epg_connect (private->mmyth_epg)) { + g_warning ("[%s] Could not connect mysql handler to db", __FUNCTION__); + g_object_unref (private->mmyth_epg); + private->mmyth_epg = NULL; + } +} + +static void +mmyth_epg_grid_widget_init (MMythEpgGridWidget *mmyth_epg_grid_widget) +{ + MMythEpgGridWidgetPrivate *private = + MMYTH_EPG_GRID_WIDGET_GET_PRIVATE(mmyth_epg_grid_widget); + + /* init private fields */ + mmyth_epg_grid_widget_private_init(private); + + mmyth_epg_grid_widget->epg_view_model = NULL; + mmyth_epg_grid_widget->selected_grid_item = NULL; + + GtkWidget *epg_event_box = GTK_WIDGET(mmyth_epg_grid_widget); + gtk_widget_modify_bg(epg_event_box, GTK_STATE_NORMAL, &main_bg_color); + gtk_widget_set_size_request (epg_event_box, 0, 125); + + GtkWidget *epg_main_hbox = gtk_hbox_new (FALSE, 10); + gtk_container_set_border_width(GTK_CONTAINER (epg_main_hbox), 10); + + gtk_container_add (GTK_CONTAINER (epg_event_box), + epg_main_hbox); + + /* channels vbox */ + GtkWidget *epg_channels_vbox = gtk_vbox_new (FALSE, 3); + private->epg_channels_vbox = epg_channels_vbox; + + /* programs vbox */ + GtkWidget *epg_programs_vbox = gtk_vbox_new (FALSE, 3); + private->epg_programs_vbox = epg_programs_vbox; + + /* packing start */ + gtk_box_pack_start (GTK_BOX (epg_main_hbox), + epg_channels_vbox, FALSE, FALSE, 0); + gtk_box_pack_start (GTK_BOX (epg_main_hbox), + epg_programs_vbox, FALSE, FALSE, 0); + + /* table header (first line) */ + mmyth_epg_grid_widget_mount_header(mmyth_epg_grid_widget); + + /* service programs */ + /* mount service programs with current time */ + mmyth_epg_grid_widget_mount_services(mmyth_epg_grid_widget, + private->current_start_time, + private->current_end_time); +} + +GtkWidget* +mmyth_epg_grid_widget_new () +{ + return GTK_WIDGET ( gtk_type_new (mmyth_epg_grid_widget_get_type ())); +} + +static void +mmyth_epg_grid_widget_mount_services(MMythEpgGridWidget *mmyth_epg_grid_widget, + int start_time, int end_time) +{ + GList *proglist; + GList *channel_list = NULL; + GMythChannelInfo *channel_info; + + int chanid; + MMythEpgGridWidgetPrivate *private = + MMYTH_EPG_GRID_WIDGET_GET_PRIVATE(mmyth_epg_grid_widget); + + // update view_model + /* FIXME shallow free or recursive? */ + if(mmyth_epg_grid_widget->epg_view_model != NULL) { + g_list_free(mmyth_epg_grid_widget->epg_view_model); + mmyth_epg_grid_widget->epg_view_model = NULL; + } + + if(private->service_model_hash != NULL) { + g_hash_table_destroy(private->service_model_hash); + } + + private->service_model_hash = g_hash_table_new(NULL, NULL); + + /* fill program infos from db */ + mmyth_epg_grid_widget_fill_programinfos(private); + + channel_list = private->channel_list; + + /* for each channel get_programs() */ + for (chanid=0; channel_list && + chanid < private->DISPLAY_CHANS; chanid++) { + proglist = (GList *) private->program_list[chanid]; + + channel_info = (GMythChannelInfo *) channel_list->data; + channel_list = g_list_next(channel_list); + + /* Service Title*/ + GString *name = NULL; + if (channel_info->channel_name) + name = g_string_new (channel_info->channel_name->str); + + GdkColor title_bg_color; + title_bg_color.red = 5000; + title_bg_color.green = 9000; + title_bg_color.blue = 40000; + + GdkColor title_fg_color; + title_fg_color.red = 60000; + title_fg_color.green = 60000; + title_fg_color.blue = 60000; + + GtkWidget *event_box_channel = create_event_box_lbl( + name->str, 90, + &title_bg_color, + &title_fg_color); + + gtk_box_pack_start (GTK_BOX (private->epg_channels_vbox), + event_box_channel, FALSE, FALSE, 0); + + GtkWidget *epg_line_hbox = gtk_hbox_new (FALSE, 0); + + GdkColor bg_color; + bg_color.red = 5000; + bg_color.green = 30000; + bg_color.blue = 60000; + + GdkColor fg_color; + fg_color.red = 60000; + fg_color.green = 60000; + fg_color.blue = 60000; + + /* Content parsing */ + GList *epg_grid_list = NULL; + + GMythProgramInfo *proginfo; + int pixel_count = 0; + for (; proglist; proglist = proglist->next) { + proginfo = (GMythProgramInfo *) proglist->data; + + GString *content_name = proginfo->title; + + int initial_time, last_time, duration; + + int schedule_start_time = proginfo->startts; + int schedule_end_time = proginfo->endts; + + initial_time = + (schedule_start_time < start_time) ? start_time : schedule_start_time; + last_time = (schedule_end_time > end_time) ? end_time : schedule_end_time; + duration = last_time - initial_time; + + // Verify program time + #if 0 + g_debug ("ServiceID: %d, ScheduleID: %d\n", service->id, schedule->id); + fprintf (stderr, "program time\nfrom = %d, to = %d\n", + schedule->validFrom, schedule->validTo); + + struct tm loctime; + + /* Convert it to local time representation. */ + if (localtime_r((time_t *)&schedule->validFrom, &loctime) == NULL) { + g_warning ("localtime_r error in mmyth_epg_grid_widget!\n"); + return NULL; + } + fprintf (stderr, asctime (&loctime)); + + if (localtime_r((time_t *)&schedule->validTo, &loctime) == NULL) { + g_warning ("localtime_r error in mmyth_epg_grid_widget!\n"); + return NULL; + } + fprintf (stderr, asctime (&loctime)); + #endif + + /* fprintf(stderr, "duration = %d\n", duration); */ + double duration_hour = duration / (double) 3600.0; + /* fprintf(stderr, "duration_hour = %lf\n", duration_hour); */ + + int size = PIXELS_HOUR * duration_hour; + + /* complete hour */ + /* FIXME: UGLY WRONG HACK TO ALIGN PROGRAM TIME!!!*/ + if(last_time%3600 != 0) { + size -= PROGRAM_SEPARATION; + } + if(initial_time%3600 != 0) { + size -= PROGRAM_SEPARATION; + } + + pixel_count += size + PROGRAM_SEPARATION; + GtkWidget *event_box = create_event_box_lbl(content_name->str, + size, &bg_color, + &fg_color); + gtk_widget_add_events(event_box, + GDK_BUTTON_PRESS_MASK | GDK_BUTTON_RELEASE_MASK); + + /* create EpgGridItem */ + EpgGridItem *epg_grid_item = g_new(EpgGridItem, 1); + epg_grid_item->proginfo = proginfo; + epg_grid_item->event_box = event_box; + epg_grid_item->object = mmyth_epg_grid_widget; + + epg_grid_list = g_list_prepend(epg_grid_list, (gpointer) epg_grid_item); + + gtk_box_pack_start (GTK_BOX (epg_line_hbox), + event_box, FALSE, FALSE, PROGRAM_SEPARATION); + + g_signal_connect (G_OBJECT (event_box), "button-press-event", + G_CALLBACK (mmyth_epg_grid_widget_clicked), + (gpointer*) epg_grid_list); + } +#if 0 + printf("chaind = %d!!!!" chanid);fflush(stdout); +#endif + + if(!epg_grid_list) { + /* No programs for current channel */ + /* FIXME: size HARDCODED */ + GtkWidget *event_box = create_event_box_lbl("No program list available", + PIXELS_HOUR * 3, &bg_color, + &fg_color); + gtk_widget_add_events(event_box, + GDK_BUTTON_PRESS_MASK | GDK_BUTTON_RELEASE_MASK); + + /* create EpgGridItem */ + EpgGridItem *epg_grid_item = g_new(EpgGridItem, 1); + epg_grid_item->proginfo = NULL; + epg_grid_item->event_box = event_box; + epg_grid_item->object = mmyth_epg_grid_widget; + + epg_grid_list = g_list_prepend(epg_grid_list, (gpointer) epg_grid_item); + + gtk_box_pack_start (GTK_BOX (epg_line_hbox), + event_box, FALSE, FALSE, PROGRAM_SEPARATION); + + g_signal_connect (G_OBJECT (event_box), "button-press-event", + G_CALLBACK (mmyth_epg_grid_widget_clicked), + (gpointer*) epg_grid_list); + } + + epg_grid_list = g_list_reverse(epg_grid_list); + mmyth_epg_grid_widget->epg_view_model = + g_list_append(mmyth_epg_grid_widget->epg_view_model, epg_grid_list); + + gtk_box_pack_start (GTK_BOX (private->epg_programs_vbox), + epg_line_hbox, FALSE, FALSE, 0); + } +} + +static void +mmyth_epg_grid_widget_mount_header(MMythEpgGridWidget *mmyth_epg_grid_widget) +{ + MMythEpgGridWidgetPrivate *private = + MMYTH_EPG_GRID_WIDGET_GET_PRIVATE(mmyth_epg_grid_widget); + + struct tm hour_tm; + const gchar name_title[] = "Today"; + GtkWidget * lbl_title = gtk_label_new(name_title); + + gtk_misc_set_alignment (GTK_MISC(lbl_title), 0.0, 0.5); + + gtk_box_pack_start (GTK_BOX (private->epg_channels_vbox), + lbl_title, FALSE, FALSE, 0); + + /* hours title line */ + GtkWidget *epg_programs_hours_hbox = gtk_hbox_new (TRUE, 0); + + if (localtime_r((time_t *)&private->current_start_time, &hour_tm) == NULL) { + g_warning ("localtime_r error in mmyth_epg_grid_widget!\n"); + return NULL; + } + + if (hour_tm.tm_min>30) { + hour_tm.tm_min = 30; + } else if (hour_tm.tm_min>0) { + hour_tm.tm_min = 0; + } + + gchar hour1_str[10]; + strftime(hour1_str, 8, "%H:%M", &hour_tm); + GtkWidget * lbl_hour1 = gtk_label_new(hour1_str); + gtk_misc_set_alignment (GTK_MISC(lbl_hour1), 0.0, 0.5); + + hour_tm.tm_hour++; + gchar hour2_str[10]; + strftime(hour2_str, 8, "%H:%M", &hour_tm); + GtkWidget * lbl_hour2 = gtk_label_new(hour2_str); + gtk_misc_set_alignment (GTK_MISC(lbl_hour2), 0.0, 0.5); + + hour_tm.tm_hour++; + gchar hour3_str[10]; + strftime(hour3_str, 8, "%H:%M", &hour_tm); + GtkWidget * lbl_hour3 = gtk_label_new(hour3_str); + gtk_misc_set_alignment (GTK_MISC(lbl_hour3), 0.0, 0.5); + + gtk_box_pack_start (GTK_BOX (epg_programs_hours_hbox), + lbl_hour1, TRUE, TRUE, 0); + gtk_box_pack_start (GTK_BOX (epg_programs_hours_hbox), + lbl_hour2, TRUE, TRUE, 0); + gtk_box_pack_start (GTK_BOX (epg_programs_hours_hbox), + lbl_hour3, TRUE, TRUE, 0); + + gtk_box_pack_start (GTK_BOX (private->epg_programs_vbox), + epg_programs_hours_hbox, FALSE, FALSE, 0); +} + +/****************************************************************************** + * INTERNAL CALLBACKS FOR STATE CHANGE * + *****************************************************************************/ +static void +mmyth_epg_grid_widget_deselect_service(MMythEpgGridWidget *mmyth_epg_grid_widget) +{ + EpgGridItem *epg_grid_item; + + /* deselect*/ + if(mmyth_epg_grid_widget->selected_grid_item != NULL) { + epg_grid_item = + (EpgGridItem*) mmyth_epg_grid_widget->selected_grid_item->data; + gtk_widget_set_state(GTK_WIDGET(epg_grid_item->event_box), GTK_STATE_NORMAL); + } +} + +static void +mmyth_epg_grid_widget_clicked (GtkWidget* widget, + GdkEventExpose *event, gpointer data) +{ + g_return_if_fail(data != NULL); + + GList *epg_grid_item_list = (GList *) data; + EpgGridItem *epg_grid_item = (EpgGridItem *) epg_grid_item_list->data; + + /* update the selected service */ + mmyth_epg_grid_widget_update_service( epg_grid_item->object, (GList*) data ); +} + +void +mmyth_epg_grid_widget_update_service(MMythEpgGridWidget * object, + GList *selected_grid_list) +{ + g_return_if_fail(object != NULL); + g_return_if_fail(selected_grid_list != NULL); + + EpgGridItem *epg_grid_item = (EpgGridItem *) selected_grid_list->data; + + mmyth_epg_grid_widget_deselect_service(epg_grid_item->object); + + /* updating current selected schedule_item and schedule_list*/ + object->selected_grid_item = selected_grid_list; + + /* set state of the event box */ + gtk_widget_set_state(GTK_WIDGET(epg_grid_item->event_box), GTK_STATE_SELECTED); + /* emit update signal for listeners */ + g_signal_emit(object, + mmyth_epg_grid_widget_signals[SELECTION_UPDATED_SIGNAL], + 0, + (gpointer) epg_grid_item); +} + +static GtkWidget * +create_event_box_lbl(gchar *str, int width, const GdkColor *bg_color, + const GdkColor *fg_color) +{ + GtkWidget *event_box = gtk_event_box_new(); + GtkWidget *lbl = gtk_label_new(str); + gtk_label_set_ellipsize(GTK_LABEL(lbl), PANGO_ELLIPSIZE_END); + + gtk_widget_modify_bg(event_box, GTK_STATE_NORMAL, bg_color); + gtk_widget_modify_fg(lbl, GTK_STATE_NORMAL, fg_color); + + /* selected colors are const*/ + GdkColor selected_bg_color; + selected_bg_color.red = 100; + selected_bg_color.green = 40000; + selected_bg_color.blue = 100; + + GdkColor selected_fg_color; + selected_fg_color.red = 100; + selected_fg_color.green = 100; + selected_fg_color.blue = 100; + + gtk_widget_modify_bg(event_box, GTK_STATE_SELECTED, &selected_bg_color); + gtk_widget_modify_fg(lbl, GTK_STATE_SELECTED, &selected_fg_color); + + gtk_misc_set_alignment (GTK_MISC(lbl), 0.0, 0.5); + gtk_container_add (GTK_CONTAINER (event_box), + lbl); + gtk_widget_set_size_request(event_box, width, -1); + + return event_box; +} + +/****************************************************************************** + * METHODS * + *****************************************************************************/ + +/* Callback for hardware keys */ +gboolean +mmyth_epg_grid_widget_key_press (MMythEpgGridWidget * object, + GtkWidget * widget, GdkEventKey * event) +{ + MMythEpgGridWidgetPrivate *private = + MMYTH_EPG_GRID_WIDGET_GET_PRIVATE(object); + + EpgGridItem *epg_grid_item; + GList *tmp; + + /* List of selected_grid_item */ + GList *selected_view_model; + + gint channel_index; + + if(object->selected_grid_item == NULL) { + g_warning ("No program selected"); + return FALSE; + } + + epg_grid_item = (EpgGridItem*) object->selected_grid_item->data; + + channel_index = private->selected_channel_index; + + switch (event->keyval) { + case GDK_Up: + selected_view_model = g_list_nth( object->epg_view_model, channel_index - 1 ); + if(selected_view_model != NULL) { + private->selected_channel_index = channel_index - 1; + tmp = (GList *) selected_view_model->data; + /* TODO: select a better centralized item + currently is picking the 1st or last item */ + if(g_list_next(object->selected_grid_item) == NULL && + g_list_previous(object->selected_grid_item) != NULL) { + /* in this case the new selected will be the last */ + tmp = g_list_last(tmp); + } + + /* update the selected service */ + mmyth_epg_grid_widget_update_service( object, tmp ); + } + return TRUE; + case GDK_Down: + selected_view_model = g_list_nth( object->epg_view_model, channel_index + 1 ); + if(selected_view_model != NULL) { + private->selected_channel_index = channel_index + 1; + tmp = (GList *) selected_view_model->data; + /* TODO: select a better centralized item + currently is picking the 1st or last item */ + if(g_list_next(object->selected_grid_item) == NULL && + g_list_previous(object->selected_grid_item) != NULL) { + /* in this case the new selected will be the last */ + tmp = g_list_last(tmp); + } + + /* update the selected service */ + mmyth_epg_grid_widget_update_service( object, tmp ); + } + return TRUE; + case GDK_Left: + tmp = g_list_previous( object->selected_grid_item ); + if(tmp != NULL) { + /* update the selected service */ + mmyth_epg_grid_widget_update_service( object, tmp ); + } + return TRUE; + case GDK_Right: + tmp = g_list_next( object->selected_grid_item ); + if(tmp != NULL) { + /* update the selected service */ + mmyth_epg_grid_widget_update_service( object, tmp ); + } + return TRUE; + default: + return TRUE; + } + + return FALSE; +} + +static void +mmyth_epg_grid_widget_fill_programinfos (MMythEpgGridWidgetPrivate *private) +{ + GList *channels_list = NULL; + int y; + + if ((private->mmyth_epg != NULL) && + (gmyth_epg_get_channel_list (private->mmyth_epg, &channels_list) < 0 )) { + private->channel_list = NULL; + return; + } + + private->channel_list = channels_list; + + for (y = 0; y < private->DISPLAY_CHANS && channels_list; y++) { + GMythChannelInfo *channel_info = (GMythChannelInfo *) channels_list->data; + + mmyth_epg_grid_widget_fill_program_row_infos( + private, channel_info->channel_ID, y); + + channels_list = g_list_next (channels_list); + } +} + +static void +mmyth_epg_grid_widget_fill_program_row_infos(MMythEpgGridWidgetPrivate *private, + guint chanNum, guint row) +{ + gint res = gmyth_epg_get_program_list (private->mmyth_epg, + &(private->program_list[row]), + chanNum, private->current_start_time, + private->current_end_time); + + if (res < 0) { + g_warning ("[%s] Error while retrieving epg programs", __FUNCTION__); + } +} + diff -r 7c409a042a9a -r 7174e23f7617 maemo-ui/src/mmyth_epg_grid_widget.h --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/maemo-ui/src/mmyth_epg_grid_widget.h Thu Sep 28 16:02:14 2006 +0100 @@ -0,0 +1,74 @@ +#ifndef __MMYTH_EPG_GRID_WIDGET_H__ +#define __MMYTH_EPG_GRID_WIDGET_H__ + +#include +#include +#include +#include + +#include "gmyth_common.h" + +#define MAX_DISPLAY_CHANS 4 + +G_BEGIN_DECLS + +#define MMYTH_EPG_GRID_WIDGET_TYPE (mmyth_epg_grid_widget_get_type ()) +#define MMYTH_EPG_GRID_WIDGET(obj) (GTK_CHECK_CAST ((obj), MMYTH_EPG_GRID_WIDGET_TYPE, MMythEpgGridWidget)) +#define MMYTH_EPG_GRID_WIDGET_CLASS(klass) (GTK_CHECK_CLASS_CAST ((klass), MMYTH_EPG_GRID_WIDGET_TYPE, MMythEpgGridWidgetClass)) +#define IS_MMYTH_EPG_GRID_WIDGET(obj) (GTK_CHECK_TYPE ((obj), MMYTH_EPG_GRID_WIDGET_TYPE)) +#define IS_MMYTH_EPG_GRID_WIDGET_CLASS(klass) (GTK_CHECK_CLASS_TYPE ((klass), MMYTH_EPG_GRID_WIDGET_TYPE)) +#define MMYTH_EPG_GRID_WIDGET_GET_CLASS(obj) (G_TYPE_INSTANCE_GET_CLASS ((obj), MMYTH_EPG_GRID_WIDGET_TYPE, MMythEpgGridWidgetClass)) +#define MMYTH_EPG_GRID_WIDGET_GET_PRIVATE(obj) (G_TYPE_INSTANCE_GET_PRIVATE ((obj), MMYTH_EPG_GRID_WIDGET_TYPE, MMythEpgGridWidgetPrivate)) + + +typedef struct _MMythEpgGridWidget MMythEpgGridWidget; +typedef struct _MMythEpgGridWidgetClass MMythEpgGridWidgetClass; +typedef struct _MMythEpgGridWidgetPrivate MMythEpgGridWidgetPrivate; + +struct _MMythEpgGridWidgetClass +{ + GtkEventBoxClass parent_class; + + /* callbacks */ + /* no one for now */ +}; + +struct _MMythEpgGridWidget +{ + GtkEventBox event_box; + + /* Selected Widgets Logic*/ + /* List os Service Model in the current view + * the data of this list are GList for the programs + * of each service */ + GList *epg_view_model; + + /* Selected Schedule Item*/ + GList *selected_grid_item; +}; + + +GType mmyth_epg_grid_widget_get_type (void); +GtkWidget* mmyth_epg_grid_widget_new (void); +/*DVBHScheduleEvent* mmyth_epg_grid_get_selected_schedule (MMythEpgGridWidget * object);*/ +void mmyth_epg_grid_widget_update_service (MMythEpgGridWidget * object, + GList *epg_grid_item_node); +gboolean mmyth_epg_grid_widget_key_press (MMythEpgGridWidget * object, + GtkWidget * widget, + GdkEventKey * event); + +typedef struct _EpgGridItem EpgGridItem; + +/* FIXME: auxiliary struct */ +struct _EpgGridItem { + + GMythProgramInfo *proginfo; + GtkWidget *event_box; + + /* for callback purposes */ + MMythEpgGridWidget *object; +}; + +G_END_DECLS + +#endif /* __MMYTH_EPG_GRID_WIDGET_H__ */ diff -r 7c409a042a9a -r 7174e23f7617 maemo-ui/src/mmyth_main.c --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/maemo-ui/src/mmyth_main.c Thu Sep 28 16:02:14 2006 +0100 @@ -0,0 +1,104 @@ + +#include + +#include "config.h" + +#ifdef MAEMO_PLATFORM +#include "hildon-widgets/hildon-program.h" +#include "hildon-widgets/hildon-window.h" +#endif + + +#include "gmyth_remote_encoder.h" +#include "gmyth_settings.h" +#include "gmyth_context.h" +#include "gmyth_tvchain.h" +#include "gmyth_remote_util.h" + +#include "mmyth_ui.h" +#include "mmyth_tvplayer.h" + +static void +cb_destroy (GtkWidget * widget, gpointer data) +{ + MMythUi *mmyth_ui = (MMythUi *) data; + + if (mmyth_ui->tvplayer != NULL) { + if (mmyth_tvplayer_is_playing (mmyth_ui->tvplayer) ) + mmyth_tvplayer_stop_playing (mmyth_ui->tvplayer); + } + + mmyth_ui_finalize (mmyth_ui); + + gtk_main_quit (); +} + +#ifdef NDEBUG +static void +debug_error_func( const gchar*log_domain, GLogLevelFlags log_level, const gchar *message, + gpointer user_data ) + +{ + /* leave this with NO print out messages, once you need to disable debug messages! */ + //g_print ( "[%s] DEBUG messages disabled!\n", __FUNCTION__ ); +} +#endif + +gint +main (gint argc, gchar * argv[]) +{ + GtkWidget *window; + MMythUi *mmyth_ui; +#ifdef MAEMO_PLATFORM + HildonProgram *program = NULL; +#endif + + /* init threads */ + g_thread_init (NULL); + + /* Initializes GTK */ + gtk_init (&argc, &argv); + gst_init (&argc, &argv); +#ifdef NDEBUG + g_log_set_default_handler( debug_error_func, NULL ); +#endif + + /* Init libmmyth context */ + gmyth_context_initialize (); + +#ifndef MAEMO_PLATFORM + /* create the main window */ + window = gtk_window_new (GTK_WINDOW_TOPLEVEL); + gtk_widget_set_size_request (window, MAIN_WINDOW_WIDTH, MAIN_WINDOW_HEIGHT); + gtk_window_set_title (GTK_WINDOW (window), "Mythtv Frontend"); +#else + /* Creating Hildonized main view */ + program = HILDON_PROGRAM(hildon_program_get_instance()); + window = hildon_window_new(); + + //g_signal_connect(G_OBJECT(window), "delete_event", gtk_main_quit, NULL); + + hildon_program_add_window(program, HILDON_WINDOW (window)); + g_set_application_name("Maemo Mythtv"); +#endif + + /* Initializes MMyth Widgets */ +#ifdef MAEMO_PLATFORM + mmyth_ui = mmyth_ui_initialize (program, window); +#else + mmyth_ui = mmyth_ui_initialize (window); +#endif + + //mmyth_ui->loop = g_main_loop_new (NULL, FALSE); + + /* Connect destroy signal handling */ + g_signal_connect (window, "destroy", G_CALLBACK (cb_destroy), mmyth_ui); + + /* Shows main window and start gtk loop */ + gtk_widget_show (window); + + gtk_main (); + + return 0; +} + diff -r 7c409a042a9a -r 7174e23f7617 maemo-ui/src/mmyth_recordui.c --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/maemo-ui/src/mmyth_recordui.c Thu Sep 28 16:02:14 2006 +0100 @@ -0,0 +1,332 @@ +#include +#include +#include +#include +#include +#include +#include +#include + +#include "mmyth_ui.h" +#include "mmyth_recordui.h" + +/* GMyth library includes */ +#include "gmyth_scheduler.h" +#include "gmyth_util.h" + +enum { + START_DATE_COLUMN = 0, + TITLE_COLUMN, + CHAN_ID_COLUMN, + END_TIME_COLUMN, + RECORD_ID_COLUMN, + BASENAME_COLUMN, + N_COLUMNS +}; + +gboolean +mmyth_recordui_reload_all (MMythRecordUI *recordui) +{ + gboolean res = FALSE; + + res = mmyth_recordui_reload_schedule (recordui); + + res = res & mmyth_recordui_reload_record (recordui); + + + if (!res) + g_warning ("[%s] Error while reloading schedule and recording content", __FUNCTION__); + + return res; +} + +gboolean +mmyth_recordui_reload_schedule (MMythRecordUI *recordui) +{ + gint new_row = 0; + ScheduleInfo *schedule_info; + GList *schedule_list; + GtkTreeIter iter; + GString *start_date_time = NULL; + GString *end_date_time = NULL; + GString *str_aux = g_string_new(""); + gint res; + + gtk_tree_store_clear(recordui->sch_tree_store); + + res = gmyth_scheduler_get_schedule_list(recordui->scheduler, &(schedule_list)); + if (res < 0) { + g_warning ("[%s] Retrieved NULL list of scheduled data from database", + __FUNCTION__); + return FALSE; + } + + for ( ; schedule_list; schedule_list = schedule_list->next) { + schedule_info = (ScheduleInfo*) schedule_list->data; + + gtk_tree_store_insert(recordui->sch_tree_store, &iter, NULL, new_row++); + + start_date_time = gmyth_util_time_to_string(schedule_info->start_time); + end_date_time = gmyth_util_time_to_string(schedule_info->end_time); + + g_string_printf(str_aux, "%d", schedule_info->channel_id); + + gtk_tree_store_set(recordui->sch_tree_store, &iter, + START_DATE_COLUMN, start_date_time->str, + TITLE_COLUMN, schedule_info->title->str, + CHAN_ID_COLUMN, str_aux->str, + END_TIME_COLUMN, end_date_time->str, //It doesn't appear + RECORD_ID_COLUMN, schedule_info->record_id, + -1); //the last line is a hidden item to be used in searching tasks + } + + g_debug ("[%s] %d lines added to schedule list UI", __FUNCTION__, new_row); + + /* free allocated memory */ + if(!start_date_time) + g_string_free(start_date_time, FALSE); + if(!end_date_time) + g_string_free(end_date_time, FALSE); + g_string_free(str_aux, FALSE); + + return TRUE; +} + +gboolean +mmyth_recordui_reload_record (MMythRecordUI *recordui) +{ + gint new_row = 0; + RecordedInfo *recorded_info; + GList *record_list = NULL; + GtkTreeIter iter; + GString *start_date_time = NULL; + GString *end_date_time = NULL; + GString *str_aux = g_string_new(""); + gint res; + + gtk_tree_store_clear(recordui->rec_tree_store); + + res = gmyth_scheduler_get_recorded_list(recordui->scheduler, &record_list); + if (res < 0) { + g_warning ("[%s] Retrieved NULL list of recorded data from database", __FUNCTION__); + return FALSE; + } + + for (; record_list; record_list = record_list->next) { + recorded_info = (RecordedInfo*) record_list->data; + + gtk_tree_store_insert(recordui->rec_tree_store, &iter, NULL, new_row++); + + start_date_time = gmyth_util_time_to_string(recorded_info->start_time); + end_date_time = gmyth_util_time_to_string(recorded_info->end_time); + + g_string_printf(str_aux, "%d", recorded_info->channel_id); + + gtk_tree_store_set(recordui->rec_tree_store, &iter, + START_DATE_COLUMN, start_date_time->str, + TITLE_COLUMN, recorded_info->title->str, + CHAN_ID_COLUMN, str_aux->str, + END_TIME_COLUMN, end_date_time->str, //It doesn't appear + RECORD_ID_COLUMN, recorded_info->record_id, + BASENAME_COLUMN, recorded_info->basename->str, -1); + //the last line is a hidden item to be used in searching tasks + } + + g_debug ("[%s] %d lines added to record list UI", __FUNCTION__, new_row); + + return TRUE; +} + + +MMythRecordUI* +mmyth_recordui_new(void) +{ + MMythRecordUI *recordui = g_new0 (MMythRecordUI, 1); + + recordui->scrolled_window = gtk_scrolled_window_new (NULL, NULL); + gtk_scrolled_window_set_policy (GTK_SCROLLED_WINDOW (recordui->scrolled_window), + GTK_POLICY_AUTOMATIC, GTK_POLICY_AUTOMATIC); + + recordui->viewport = gtk_viewport_new (NULL, NULL); + gtk_container_add (GTK_CONTAINER (recordui->scrolled_window), recordui->viewport); + + recordui->notebook = gtk_notebook_new (); + gtk_container_set_border_width (GTK_CONTAINER (recordui->notebook), 1); + gtk_notebook_set_scrollable (GTK_NOTEBOOK (recordui->notebook), TRUE); + gtk_notebook_popup_enable (GTK_NOTEBOOK (recordui->notebook)); + gtk_container_add (GTK_CONTAINER (recordui->viewport), recordui->notebook); + gtk_notebook_popup_disable(GTK_NOTEBOOK (recordui->notebook)); + + /* Schedule tab */ + recordui->sch_scrolled_window = gtk_scrolled_window_new (NULL, NULL); + gtk_container_add (GTK_CONTAINER (recordui->notebook), recordui->sch_scrolled_window); + gtk_scrolled_window_set_policy (GTK_SCROLLED_WINDOW (recordui->sch_scrolled_window), + GTK_POLICY_AUTOMATIC, GTK_POLICY_AUTOMATIC); + gtk_scrolled_window_set_shadow_type (GTK_SCROLLED_WINDOW (recordui->sch_scrolled_window), + GTK_SHADOW_IN); + + /* The basename column in the sched_tree_store is not being used*/ + recordui->sch_tree_store = + gtk_tree_store_new (N_COLUMNS, G_TYPE_STRING, G_TYPE_STRING, + G_TYPE_STRING, G_TYPE_STRING, G_TYPE_INT, G_TYPE_STRING ); + + recordui->sch_treeview = + gtk_tree_view_new_with_model(GTK_TREE_MODEL(recordui->sch_tree_store)); + gtk_container_add (GTK_CONTAINER (recordui->sch_scrolled_window), + recordui->sch_treeview); + recordui->sch_renderer = gtk_cell_renderer_text_new(); + //g_object_set(G_OBJECT(renderer1), "foreground", "green", "background", "black", NULL); + recordui->sch_column1 = + gtk_tree_view_column_new_with_attributes("Start time", recordui->sch_renderer, + "text", START_DATE_COLUMN, NULL); + gtk_tree_view_append_column(GTK_TREE_VIEW(recordui->sch_treeview), + recordui->sch_column1); + recordui->sch_column2 = + gtk_tree_view_column_new_with_attributes("Title", recordui->sch_renderer, + "text", TITLE_COLUMN, NULL); + gtk_tree_view_append_column(GTK_TREE_VIEW(recordui->sch_treeview), + recordui->sch_column2); + recordui->sch_column3 = + gtk_tree_view_column_new_with_attributes("Channel", recordui->sch_renderer, + "text", CHAN_ID_COLUMN, NULL); + gtk_tree_view_append_column(GTK_TREE_VIEW(recordui->sch_treeview), + recordui->sch_column3); + gtk_tree_view_column_set_resizable(recordui->sch_column1, TRUE); + gtk_tree_view_column_set_resizable(recordui->sch_column2, TRUE); + gtk_tree_view_column_set_resizable(recordui->sch_column3, TRUE); + gtk_tree_view_column_set_reorderable(recordui->sch_column1, TRUE); + gtk_tree_view_column_set_reorderable(recordui->sch_column2, TRUE); + gtk_tree_view_column_set_reorderable(recordui->sch_column3, TRUE); +// recordui->sch_column4 = +// gtk_tree_view_column_new_with_attributes("", recordui->sch_renderer, "text", END_TIME_COLUMN, NULL); +// gtk_tree_view_append_column(GTK_TREE_VIEW(recordui->sch_treeview), +// recordui->sch_column4); + + recordui->sch_label = gtk_label_new (("Schedule")); + gtk_notebook_set_tab_label (GTK_NOTEBOOK (recordui->notebook), + gtk_notebook_get_nth_page ( + GTK_NOTEBOOK (recordui->notebook), 0), + recordui->sch_label); + + // Record items tab + // g_object_set(G_OBJECT(renderer2), "foreground", "blue", NULL); + recordui->rec_scrolled_window = gtk_scrolled_window_new (NULL, NULL); + gtk_container_add (GTK_CONTAINER (recordui->notebook), + recordui->rec_scrolled_window); + gtk_scrolled_window_set_policy (GTK_SCROLLED_WINDOW (recordui->rec_scrolled_window), + GTK_POLICY_AUTOMATIC, GTK_POLICY_AUTOMATIC); + gtk_scrolled_window_set_shadow_type (GTK_SCROLLED_WINDOW (recordui->rec_scrolled_window), + GTK_SHADOW_IN); + + recordui->rec_tree_store = + gtk_tree_store_new (N_COLUMNS, G_TYPE_STRING, G_TYPE_STRING, + G_TYPE_STRING, G_TYPE_STRING, G_TYPE_INT, G_TYPE_STRING); + recordui->rec_treeview = + gtk_tree_view_new_with_model(GTK_TREE_MODEL(recordui->rec_tree_store)); + gtk_container_add (GTK_CONTAINER (recordui->rec_scrolled_window), + recordui->rec_treeview); + recordui->rec_renderer = gtk_cell_renderer_text_new(); + //g_object_set(G_OBJECT(renderer1), "foreground", "green", "background", "black", NULL); + + recordui->rec_column1 = + gtk_tree_view_column_new_with_attributes("Start time", recordui->rec_renderer, + "text", START_DATE_COLUMN, NULL); + gtk_tree_view_append_column(GTK_TREE_VIEW(recordui->rec_treeview), + recordui->rec_column1); + recordui->rec_column2 = + gtk_tree_view_column_new_with_attributes("Title", recordui->rec_renderer, + "text", TITLE_COLUMN, NULL); + gtk_tree_view_append_column(GTK_TREE_VIEW(recordui->rec_treeview), + recordui->rec_column2); + recordui->rec_column3 = + gtk_tree_view_column_new_with_attributes("Channel", recordui->rec_renderer, + "text", CHAN_ID_COLUMN, NULL); + gtk_tree_view_append_column(GTK_TREE_VIEW(recordui->rec_treeview), + recordui->rec_column3); + gtk_tree_view_column_set_resizable(recordui->rec_column1, TRUE); + gtk_tree_view_column_set_resizable(recordui->rec_column2, TRUE); + gtk_tree_view_column_set_resizable(recordui->rec_column3, TRUE); + gtk_tree_view_column_set_reorderable(recordui->rec_column1, TRUE); + gtk_tree_view_column_set_reorderable(recordui->rec_column2, TRUE); + gtk_tree_view_column_set_reorderable(recordui->rec_column3, TRUE); +// recordui->rec_column4 = gtk_tree_view_column_new_with_attributes("", recordui->rec_renderer, "text", END_TIME_COLUMN, NULL); +// gtk_tree_view_append_column(GTK_TREE_VIEW(recordui->rec_treeview), recordui->rec_column4); + + recordui->rec_label = gtk_label_new (("Recorded")); + gtk_notebook_set_tab_label (GTK_NOTEBOOK (recordui->notebook), + gtk_notebook_get_nth_page ( + GTK_NOTEBOOK (recordui->notebook), 1), + recordui->rec_label); + + // Gets the mmyth scheduler manager + recordui->scheduler = gmyth_scheduler_new (); + + /* init connection to the backend */ + gmyth_scheduler_connect (recordui->scheduler); + + return recordui; +} + +void +mmyth_recordui_free (MMythRecordUI *recordui) +{ + // FIXME: Release memory here! + /* close connection to the backend */ + gmyth_scheduler_disconnect (recordui->scheduler); +} + +void +mmyth_recordui_delete_selected (GtkButton *button, MMythRecordUI *recordui) +{ + GtkTreeSelection *selection; + GtkTreeModel *list_store; + GtkTreeIter iter; + int index; + int curr_page = 0; + + curr_page = gtk_notebook_get_current_page(GTK_NOTEBOOK(recordui->notebook)); + + if ( curr_page == 0) { + selection = gtk_tree_view_get_selection(GTK_TREE_VIEW(recordui->sch_treeview)); + if (selection != NULL) { + gtk_tree_selection_get_selected(selection, &list_store, &iter); + gtk_tree_model_get(list_store, &iter, RECORD_ID_COLUMN, &index, -1); + gmyth_scheduler_delete_schedule(recordui->scheduler, index); + mmyth_recordui_reload_schedule (recordui); + return; + } + + } else if (curr_page == 1) { + selection = gtk_tree_view_get_selection(GTK_TREE_VIEW(recordui->rec_treeview)); + if (selection != NULL) { + gtk_tree_selection_get_selected(selection, &list_store, &iter); + gtk_tree_model_get(list_store, &iter, RECORD_ID_COLUMN, &index, -1); + gmyth_scheduler_delete_recorded(recordui->scheduler, index); + mmyth_recordui_reload_record (recordui); + return; + } + } + + g_warning ("[%s] None element was removed from the list", __FUNCTION__); +} + +/* FIXME: change this function name, it is returning the + * basename_column that represents the nuv filename of + * the recorded content */ +gchar* +mmyth_recordui_get_selected_recorded (MMythRecordUI *recordui) +{ + GtkTreeSelection *selection = NULL; + GtkTreeModel *list_store = NULL; + GtkTreeIter iter; + gchar *path = NULL; + + /* returning nuv filename, basename_column */ + selection = gtk_tree_view_get_selection(GTK_TREE_VIEW(recordui->rec_treeview)); + if (gtk_tree_selection_get_selected (selection, &list_store, &iter)) { + gtk_tree_model_get(list_store, &iter, BASENAME_COLUMN, &path, -1); + } + + // FIXME: MOVE THIS TO OTHER PLACE + return path; +} diff -r 7c409a042a9a -r 7174e23f7617 maemo-ui/src/mmyth_recordui.h --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/maemo-ui/src/mmyth_recordui.h Thu Sep 28 16:02:14 2006 +0100 @@ -0,0 +1,48 @@ +#ifndef MMYTH_RECORD_H_ +#define MMYTH_RECORD_H_ + +#include "gmyth_scheduler.h" + +typedef struct _MMythRecordUI +{ + GtkWidget *scrolled_window; + GtkWidget *viewport; + GtkWidget *notebook; + + GtkWidget *rec_scrolled_window; + GtkWidget *sch_scrolled_window; + GtkWidget *rec_treeview; + GtkWidget *sch_treeview; + GtkWidget *rec_label; + GtkWidget *sch_label; + + GtkTreeViewColumn *rec_column1; + GtkTreeViewColumn *rec_column2; + GtkTreeViewColumn *rec_column3; + GtkTreeViewColumn *rec_column4; + GtkTreeViewColumn *sch_column1; + GtkTreeViewColumn *sch_column2; + GtkTreeViewColumn *sch_column3; + GtkTreeViewColumn *sch_column4; + + GtkCellRenderer *rec_renderer; + GtkCellRenderer *sch_renderer; + + GtkTreeStore *sch_tree_store; + GtkTreeStore *rec_tree_store; + + GMythScheduler *scheduler; + +} MMythRecordUI; + +MMythRecordUI* mmyth_recordui_new(void); +void mmyth_recordui_free (MMythRecordUI *recordui); + +void mmyth_recordui_delete_selected (GtkButton *button, MMythRecordUI *recordui); +gboolean mmyth_recordui_reload_all (MMythRecordUI *recordui); +gboolean mmyth_recordui_reload_schedule (MMythRecordUI *recordui); +gboolean mmyth_recordui_reload_record (MMythRecordUI *recordui); + +gchar* mmyth_recordui_get_selected_recorded (MMythRecordUI *recordui); + +#endif /*MMYTH_RECORD_H_*/ diff -r 7c409a042a9a -r 7174e23f7617 maemo-ui/src/mmyth_schedulerui.c --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/maemo-ui/src/mmyth_schedulerui.c Thu Sep 28 16:02:14 2006 +0100 @@ -0,0 +1,368 @@ +#include +#include +#include +#include +#include +#include +#include +#include + +#include "mmyth_ui.h" +#include "mmyth_uicommon.h" +#include "mmyth_recordui.h" +#include "mmyth_schedulerui.h" + +/* GMyth library includes */ +#include "gmyth_scheduler.h" +#include "gmyth_common.h" +#include "gmyth_epg.h" + +static void run_calendar_dialog (GtkButton *button, gpointer data); + +static void add_channel_field (MMythSchedulerUI *scheduler_ui, GtkWidget *vbox); +static void add_time_field (MMythSchedulerUI *scheduler_ui, GtkWidget *vbox); +static void add_date_field (MMythSchedulerUI *scheduler_ui, GtkWidget *vbox); +static void add_duration_field (MMythSchedulerUI *scheduler_ui, GtkWidget *vbox); +static void add_frequency_field (MMythSchedulerUI *scheduler_ui, GtkWidget *vbox); +static void add_title_field (MMythSchedulerUI *scheduler_ui, GtkWidget *vbox); + +MMythSchedulerUI* +mmyth_schedulerui_new (void) +{ + GtkWidget *scrolledwindow; + GtkWidget *viewport; + GtkWidget *head_hbox; + GtkWidget *fields_vbox; + GtkWidget *hseparator; + GtkWidget *label; + + MMythSchedulerUI *scheduler_ui = g_new0 (MMythSchedulerUI, 1); + + scrolledwindow = gtk_scrolled_window_new (NULL, NULL); + scheduler_ui->main_widget = scrolledwindow; + gtk_scrolled_window_set_policy (GTK_SCROLLED_WINDOW (scrolledwindow), + GTK_POLICY_AUTOMATIC, GTK_POLICY_AUTOMATIC); + + //Is this needed? + viewport = gtk_viewport_new (NULL, NULL); + gtk_container_add (GTK_CONTAINER (scrolledwindow), viewport); + + //Is this needed? + head_hbox = gtk_hbox_new (FALSE, 0); + gtk_container_add (GTK_CONTAINER (viewport), head_hbox); + + fields_vbox = gtk_vbox_new (FALSE, 0); + gtk_box_pack_start (GTK_BOX (head_hbox), fields_vbox, TRUE, TRUE, 0); + gtk_container_set_border_width (GTK_CONTAINER (fields_vbox), 10); + + label = gtk_label_new_with_mnemonic (("Manual Schedule Recording")); + gtk_box_pack_start (GTK_BOX (fields_vbox), label, FALSE, FALSE, 0); + gtk_misc_set_alignment (GTK_MISC (label), 0, 0.5); + + hseparator = gtk_hseparator_new (); + gtk_box_pack_start (GTK_BOX (fields_vbox), hseparator, FALSE, TRUE, 0); + + add_channel_field (scheduler_ui, fields_vbox); + add_time_field (scheduler_ui, fields_vbox); + add_date_field (scheduler_ui, fields_vbox); + add_duration_field (scheduler_ui, fields_vbox); + add_frequency_field (scheduler_ui, fields_vbox); + add_title_field (scheduler_ui, fields_vbox); + + return scheduler_ui; +} + +static void +set_date_from_calendar (GtkCalendar *calendar, gpointer data) +{ + char sched_date[24]; + + MMythSchedulerUI *scheduler_ui = (MMythSchedulerUI*) data; + + // FIXME: Change this, save another value instead of month_temp, day_temp, ... + gtk_calendar_get_date(GTK_CALENDAR(calendar), + &(scheduler_ui->year_temp), &(scheduler_ui->month_temp), &(scheduler_ui->day_temp)); + + sched_date[23]='\0'; + g_sprintf(sched_date, "%04d %02d %02d (yyyy mm dd)", + scheduler_ui->year_temp, scheduler_ui->month_temp+1, scheduler_ui->day_temp); + + gtk_button_set_label(GTK_BUTTON(scheduler_ui->date_button), sched_date); + + gtk_widget_destroy(scheduler_ui->calendar_dialog); + scheduler_ui->calendar_dialog = NULL; + scheduler_ui->calendar = NULL; +} + +//calendar +static void +run_calendar_dialog (GtkButton *button, gpointer data) +{ + + GtkWidget *dialog_vbox; + MMythSchedulerUI *scheduler_ui = (MMythSchedulerUI*) data; + + // calendar_dialog and calendar are been released at set_date_from_calendar () + scheduler_ui->calendar_dialog = gtk_dialog_new (); + gtk_container_set_border_width (GTK_CONTAINER (scheduler_ui->calendar_dialog), 1); + gtk_window_set_title (GTK_WINDOW (scheduler_ui->calendar_dialog), "Select starting date"); + gtk_window_set_position (GTK_WINDOW (scheduler_ui->calendar_dialog), GTK_WIN_POS_CENTER); + gtk_window_set_decorated (GTK_WINDOW (scheduler_ui->calendar_dialog), FALSE); + + dialog_vbox = GTK_DIALOG (scheduler_ui->calendar_dialog)->vbox; + + scheduler_ui->calendar = gtk_calendar_new (); + + gtk_box_pack_start (GTK_BOX (dialog_vbox), scheduler_ui->calendar, TRUE, TRUE, 0); + gtk_calendar_display_options (GTK_CALENDAR (scheduler_ui->calendar), + GTK_CALENDAR_SHOW_HEADING | GTK_CALENDAR_SHOW_DAY_NAMES); + + gtk_widget_show_all (scheduler_ui->calendar_dialog); + + g_signal_connect (G_OBJECT (scheduler_ui->calendar), "day-selected-double-click", + G_CALLBACK (set_date_from_calendar), data); +} + + +gboolean +mmyth_schedulerui_save (MMythSchedulerUI *scheduler_ui) +{ + GMythScheduler *scheduler; + ScheduleInfo *schedule_info; + GMythChannelInfo *channel_info; + + GList *clist; + gint index, duration; + gint frequency; + struct tm start_tm; + + schedule_info = g_new0(ScheduleInfo, 1); + if(schedule_info == NULL) { + g_warning ("Error allocating memory"); + return FALSE; + } + + clist = scheduler_ui->channel_list; + + index = gtk_combo_box_get_active(GTK_COMBO_BOX(scheduler_ui->channel_combobox)); + + if (clist != NULL) + clist = g_list_nth(clist, index); + + if (clist) { + g_debug ("[%s] New schedule: %d", __FUNCTION__, index); + } else { + g_warning ("[%s] Error when adding new schedule", __FUNCTION__); + return FALSE; + } + + channel_info = clist->data; + + /* initialize schedule_info */ + schedule_info->channel_id = channel_info->channel_ID; + + start_tm.tm_hour = + (int)gtk_spin_button_get_value(GTK_SPIN_BUTTON(scheduler_ui->hour_spinbutton)); + start_tm.tm_min = + (int)gtk_spin_button_get_value(GTK_SPIN_BUTTON(scheduler_ui->min_spinbutton)); + start_tm.tm_sec = 0; + + start_tm.tm_mday = (gint)scheduler_ui->day_temp; + start_tm.tm_mon = (gint)scheduler_ui->month_temp; + start_tm.tm_year = (gint)scheduler_ui->year_temp - 1900; //years since 1900 + + schedule_info->start_time = timelocal(&start_tm); + if (schedule_info->start_time == (time_t)(-1)) { + g_warning ("timelocal error!\n"); + return FALSE; + } + + duration = (gint) gtk_spin_button_get_value( + GTK_SPIN_BUTTON(scheduler_ui->duration_spinbutton)); + schedule_info->end_time = schedule_info->start_time + (duration*60); + + /* TODO: frequency is not implemented yet */ + frequency = gtk_combo_box_get_active(GTK_COMBO_BOX(scheduler_ui->freq_combobox)); + + schedule_info->title = g_string_new(""); + g_string_printf(schedule_info->title, "%s", + gtk_entry_get_text(GTK_ENTRY(scheduler_ui->title_entry))); + + /* FIXME: Architecture change to reuse the scheduler created in the recordui! */ + scheduler = gmyth_scheduler_new (); + + gmyth_scheduler_connect(scheduler); + + /* FIXME: set record_id = -1 to add a new schedule */ + schedule_info->record_id = -1; + gmyth_scheduler_add_schedule (scheduler, schedule_info); + + gmyth_scheduler_disconnect(scheduler); + + /* free allocated memory */ + g_object_unref (scheduler); + g_free (schedule_info); + + return TRUE; +} + +static GtkWidget* +add_line (GtkWidget *vbox, const gchar *str) +{ + GtkWidget *label; + GtkWidget *hbox = gtk_hbox_new (FALSE, 0); + + gtk_box_pack_start (GTK_BOX (vbox), hbox, FALSE, FALSE, 0); + gtk_container_set_border_width (GTK_CONTAINER (hbox), 3); + + label = gtk_label_new (str); + gtk_box_pack_start (GTK_BOX (hbox), label, FALSE, FALSE, 0); + gtk_misc_set_alignment (GTK_MISC (label), 0, 0.5); + + return hbox; +} + +static void +add_channel_field (MMythSchedulerUI *scheduler_ui, GtkWidget *vbox) +{ + GtkWidget *combobox; + + GtkWidget *hbox = add_line (vbox, "Channel: "); + + combobox = gtk_combo_box_new_text (); + + scheduler_ui->channel_combobox = combobox; + gtk_box_pack_start (GTK_BOX (hbox), combobox, FALSE, FALSE, 0); + + GMythEPG *mmyth_epg = gmyth_epg_new (); + if (!gmyth_epg_connect (mmyth_epg)) { + // FIXME: Without this list the scheduler UI should not be shown! + g_warning ("[%s] Error when getting list of channels", __FUNCTION__); + } + + if (gmyth_epg_get_channel_list (mmyth_epg, &(scheduler_ui->channel_list)) < 0) { + g_debug ("[%s] Error while trying to retrieve channel list", __FUNCTION__); + } else { + GList *clist = scheduler_ui->channel_list; + GMythChannelInfo *channel_info; + + while (clist != NULL) { + channel_info = clist->data; + clist = clist->next; + gtk_combo_box_append_text (GTK_COMBO_BOX (scheduler_ui->channel_combobox), + (channel_info->channel_name->str)); + } + + gtk_combo_box_set_active(GTK_COMBO_BOX (scheduler_ui->channel_combobox), 0); + } +} + +static void +add_time_field (MMythSchedulerUI *scheduler_ui, GtkWidget *vbox) +{ + GtkWidget *label; + GtkObject *spinbutton_adj; + GtkWidget *hbox = add_line (vbox, "Time: "); + + time_t real_time; + struct tm sched_time; + + time(&real_time); + + if (localtime_r((time_t *)&real_time, &sched_time) == NULL) { + g_warning ("localtime_r error in mmyth_epg_grid_view!\n"); + return NULL; + } + + if (sched_time.tm_min>30){ + sched_time.tm_hour = sched_time.tm_hour+1; + sched_time.tm_min = 0; + } else if (sched_time.tm_min>0) { + sched_time.tm_min = 30; + } + + scheduler_ui->year_temp = (guint)sched_time.tm_year + 1900; + scheduler_ui->month_temp = (guint)sched_time.tm_mon; + scheduler_ui->day_temp = (guint)sched_time.tm_mday; + + //hour entry + spinbutton_adj = gtk_adjustment_new (sched_time.tm_hour, 00, 23, 1, 10, 10); + scheduler_ui->hour_spinbutton = gtk_spin_button_new (GTK_ADJUSTMENT (spinbutton_adj), 1, 0); + gtk_box_pack_start (GTK_BOX (hbox), scheduler_ui->hour_spinbutton, FALSE, FALSE, 0); + + label = gtk_label_new ((" : ")); + gtk_box_pack_start (GTK_BOX (hbox), label, FALSE, FALSE, 0); + gtk_label_set_justify (GTK_LABEL (label), GTK_JUSTIFY_RIGHT); + gtk_misc_set_alignment (GTK_MISC (label), 0, 0.5); + + //minute entry + spinbutton_adj = gtk_adjustment_new (sched_time.tm_min, 0, 59, 1, 10, 10); + scheduler_ui->min_spinbutton = gtk_spin_button_new (GTK_ADJUSTMENT (spinbutton_adj), 1, 0); + gtk_box_pack_start (GTK_BOX (hbox), scheduler_ui->min_spinbutton, FALSE, FALSE, 0); + + label = gtk_label_new ((" (hh:mm)")); + + gtk_box_pack_start (GTK_BOX (hbox), label, FALSE, FALSE, 0); + +} + +static void +add_date_field (MMythSchedulerUI *scheduler_ui, GtkWidget *vbox) +{ + char sched_date[24]; + GtkWidget *hbox = add_line (vbox, "Date: "); + + //sched_date = ctime(&real_time); + g_sprintf (sched_date, "%04d %02d %02d (yyyy mm dd)", scheduler_ui->year_temp, scheduler_ui->month_temp+1, scheduler_ui->day_temp); + sched_date[23]='\0'; + + scheduler_ui->date_button = gtk_button_new_with_label (sched_date); + gtk_box_pack_start (GTK_BOX (hbox), scheduler_ui->date_button, FALSE, FALSE, 0); + gtk_button_set_relief (GTK_BUTTON (scheduler_ui->date_button), GTK_RELIEF_NONE); + + g_signal_connect (G_OBJECT (scheduler_ui->date_button), "clicked", + G_CALLBACK (run_calendar_dialog), scheduler_ui); + +} + +static void +add_duration_field (MMythSchedulerUI *scheduler_ui, GtkWidget *vbox) +{ + GtkWidget *hbox = add_line (vbox, "Duration: "); + GtkWidget *label; + GtkObject *spinbutton_adj; + + spinbutton_adj = gtk_adjustment_new (60, 5, 360, 5, 60, 60); + scheduler_ui->duration_spinbutton = gtk_spin_button_new (GTK_ADJUSTMENT (spinbutton_adj), 1, 0); + gtk_box_pack_start (GTK_BOX (hbox), scheduler_ui->duration_spinbutton, FALSE, TRUE, 0); + gtk_spin_button_set_numeric (GTK_SPIN_BUTTON (scheduler_ui->duration_spinbutton), TRUE); + + label = gtk_label_new ((" (minutes) ")); + gtk_box_pack_start (GTK_BOX (hbox), label, FALSE, FALSE, 0); +} + +static void +add_frequency_field (MMythSchedulerUI *scheduler_ui, GtkWidget *vbox) +{ + + GtkWidget *hbox = add_line (vbox, "Frequency: "); + + scheduler_ui->freq_combobox = gtk_combo_box_new_text (); + gtk_box_pack_start (GTK_BOX (hbox), scheduler_ui->freq_combobox, FALSE, FALSE, 0); + gtk_combo_box_append_text (GTK_COMBO_BOX (scheduler_ui->freq_combobox), ("Only this day ")); + gtk_combo_box_append_text (GTK_COMBO_BOX (scheduler_ui->freq_combobox), ("Daily ")); + gtk_combo_box_append_text (GTK_COMBO_BOX (scheduler_ui->freq_combobox), ("Weekly ")); + gtk_combo_box_set_active(GTK_COMBO_BOX (scheduler_ui->freq_combobox), 0); + +} + +static void +add_title_field (MMythSchedulerUI *scheduler_ui, GtkWidget *vbox) +{ + GtkWidget *hbox = add_line (vbox, "Title: "); + + scheduler_ui->title_entry = gtk_entry_new (); + gtk_box_pack_start (GTK_BOX (hbox), scheduler_ui->title_entry, FALSE, FALSE, 0); + gtk_entry_set_text (GTK_ENTRY (scheduler_ui->title_entry), "(Optional)"); + +} diff -r 7c409a042a9a -r 7174e23f7617 maemo-ui/src/mmyth_schedulerui.h --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/maemo-ui/src/mmyth_schedulerui.h Thu Sep 28 16:02:14 2006 +0100 @@ -0,0 +1,45 @@ +#ifndef MMYTH_SCHEDULERECORDING_H_ +#define MMYTH_SCHEDULERECORDING_H_ + +#include + +typedef struct _MMythSchedulerUI { + + GList *channel_list; + + GtkWidget *main_widget; + + GtkWidget *channel_combobox; + GtkWidget *freq_combobox; + GtkWidget *hour_spinbutton; + GtkWidget *min_spinbutton; + GtkWidget *duration_spinbutton; + GtkWidget *title_entry; + GtkWidget *date_button; + + GtkWidget *calendar_dialog; + GtkWidget *calendar; + + guint year_temp, month_temp, day_temp; +} MMythSchedulerUI; + +typedef struct { + long int channel_id; + + struct tm start_tm; + + int duration; + int frequency; + + GString *title; + +} ScheduleEntry; + +MMythSchedulerUI* mmyth_schedulerui_new (void); + +gboolean mmyth_schedulerui_save (MMythSchedulerUI *scheduler_ui); + +void mmyth_schedulerui_cb_schedule_button (GtkButton * button, gpointer user_data); + + +#endif /*MMYTH_SCHEDULERECORDING_H_*/ diff -r 7c409a042a9a -r 7174e23f7617 maemo-ui/src/mmyth_tvplayer.c --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/maemo-ui/src/mmyth_tvplayer.c Thu Sep 28 16:02:14 2006 +0100 @@ -0,0 +1,684 @@ +/** + * GMyth Library + * + * @file gmyth/mmyth_tvplayer.c + * + * @brief

This component provides playback of the remote A/V using + * GStreamer. + * + * Copyright (C) 2006 INdT - Instituto Nokia de Tecnologia. + * @author Hallyson Luiz de Morais Melo + * + *//* + * + * This program is free software; you can redistribute it and/or modify + * it under the terms of the GNU Lesser General Public License as published by + * the Free Software Foundation; either version 2 of the License, or + * (at your option) any later version. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU Lesser General Public License + * along with this program; if not, write to the Free Software + * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA + */ + +#include "mmyth_tvplayer.h" + +#include + +#include "gmyth_context.h" +#include "gmyth_remote_util.h" + +typedef struct _GstPlayerWindowStateChange +{ + GstElement *play; + GstState old_state, new_state; + MMythTVPlayer *tvplayer; +} GstPlayerWindowStateChange; + +typedef struct _GstPlayerWindowTagFound +{ + GstElement *play; + GstTagList *taglist; + MMythTVPlayer *tvplayer; +} GstPlayerWindowTagFound; + +/* +static gboolean idle_state (gpointer data); +*/ +static gboolean bus_call (GstBus * bus, GstMessage * msg, gpointer data); + +static void mmyth_tvplayer_class_init (MMythTVPlayerClass *klass); +static void mmyth_tvplayer_init (MMythTVPlayer *object); + +static void mmyth_tvplayer_dispose (GObject *object); +static void mmyth_tvplayer_finalize (GObject *object); + +G_DEFINE_TYPE(MMythTVPlayer, mmyth_tvplayer, G_TYPE_OBJECT) + +static gboolean mmyth_tvplayer_create_pipeline (MMythTVPlayer* tvplayer); +static void new_pad_cb (GstElement *element, + GstPad *pad, gpointer data); + +static gboolean expose_cb (GtkWidget * widget, + GdkEventExpose * event, + gpointer user_data); + +static void +mmyth_tvplayer_class_init (MMythTVPlayerClass *klass) +{ + GObjectClass *gobject_class; + + gobject_class = (GObjectClass *) klass; + + gobject_class->dispose = mmyth_tvplayer_dispose; + gobject_class->finalize = mmyth_tvplayer_finalize; +} + +static void +new_pad_cb (GstElement *element, GstPad *pad, gpointer data) +{ + MMythTVPlayer *tvplayer = MMYTH_TVPLAYER (data); + GstPadLinkReturn ret; + char *s; + + s = gst_caps_to_string (pad->caps); + + if ( s[0] == 'a') { + ret = gst_pad_link (pad, gst_element_get_pad (tvplayer->audioqueue, "sink")); + } else { + ret = gst_pad_link (pad, gst_element_get_pad (tvplayer->videoqueue, "sink")); + } + + g_free(s); +} + +static gboolean +expose_cb (GtkWidget * widget, GdkEventExpose * event, gpointer user_data) +{ + MMythTVPlayer *tvplayer = MMYTH_TVPLAYER (user_data); + + if (tvplayer && tvplayer->videow) { + gst_x_overlay_set_xwindow_id (GST_X_OVERLAY (tvplayer->gst_videosink), + GDK_WINDOW_XWINDOW (widget->window)); + return TRUE; + } + + g_warning ("MMythTVPlayer expose called before setting video window\n"); + + return FALSE; +} + +static void +mmyth_tvplayer_init (MMythTVPlayer *tvplayer) +{ + tvplayer->gst_pipeline = NULL; + tvplayer->gst_source = NULL; + tvplayer->gst_videodec = NULL; + tvplayer->gst_videosink = NULL; + tvplayer->videoqueue = NULL; + tvplayer->audioqueue = NULL; + + /* GTKWidget for rendering the video */ + tvplayer->videow = NULL; + tvplayer->expose_handler = 0; + + tvplayer->backend_hostname = NULL; + tvplayer->backend_port = 0; + tvplayer->local_hostname = NULL; + + tvplayer->remote_encoder = NULL; + tvplayer->tvchain = NULL; + tvplayer->proginfo = NULL; +} + +static void +mmyth_tvplayer_dispose (GObject *object) +{ + + G_OBJECT_CLASS (mmyth_tvplayer_parent_class)->dispose (object); +} + +static void +mmyth_tvplayer_finalize (GObject *object) +{ + g_signal_handlers_destroy (object); + + MMythTVPlayer *tvplayer = MMYTH_TVPLAYER (object); + + g_debug ("[%s] Finalizing tvplayer", __FUNCTION__); + + if (tvplayer->videow != NULL) { + if (g_signal_handler_is_connected (tvplayer->videow, + tvplayer->expose_handler)) { + g_signal_handler_disconnect (tvplayer->videow, + tvplayer->expose_handler); + } + g_object_unref (tvplayer->videow); + } + + if ( tvplayer->remote_encoder != NULL ) + g_object_unref (tvplayer->remote_encoder); + if ( tvplayer->tvchain != NULL ) + g_object_unref (tvplayer->tvchain); + if ( tvplayer->proginfo != NULL ) + g_object_unref (tvplayer->proginfo); + + // Release Gstreamer elements + if ( tvplayer->gst_pipeline != NULL ) + g_object_unref (tvplayer->gst_pipeline); + if ( tvplayer->gst_source != NULL ) + g_object_unref (tvplayer->gst_source); + if ( tvplayer->gst_videodec != NULL ) + g_object_unref (tvplayer->gst_videodec); + if ( tvplayer->gst_videosink != NULL ) + g_object_unref (tvplayer->gst_videosink); + if ( tvplayer->videoqueue != NULL ) + g_object_unref (tvplayer->videoqueue); + if ( tvplayer->audioqueue != NULL ) + g_object_unref (tvplayer->audioqueue); + + G_OBJECT_CLASS (mmyth_tvplayer_parent_class)->finalize (object); +} + +/** Creates a new instance of MMythTVPlayer. + * + * @return a new instance of MMythTVPlayer. + */ +MMythTVPlayer * +mmyth_tvplayer_new () +{ + MMythTVPlayer *tvplayer = + MMYTH_TVPLAYER (g_object_new(MMYTH_TVPLAYER_TYPE, NULL)); + + return tvplayer; +} + +/** Initializes the tv player. + * + * @param tvplayer the object instance. + * @return gboolean TRUE if the pipeline was created + * successfully, FALSE otherwise. + */ +gboolean +mmyth_tvplayer_initialize (MMythTVPlayer *tvplayer) +{ + + if (!mmyth_tvplayer_create_pipeline (tvplayer)) { + g_warning ("[%s] Error while creating pipeline. TV Player not initialized", __FUNCTION__); + return FALSE; + } else { + g_debug ("[%s] GStreamer pipeline created", __FUNCTION__); + } + + return TRUE; +} + +/** Creates the GStreamer pipeline used by the player. + * + * @param tvplayer the object instance. + * @return gboolean TRUE if the pipeline was created + * successfully, FALSE otherwise. + */ +static gboolean +mmyth_tvplayer_create_pipeline (MMythTVPlayer* tvplayer) +{ + GstElement *pipeline; + GstElement *source, *parser; + GstElement *videodec, *videosink; +#ifndef MAEMO_PLATFORM + GstElement *audiodec, *audioconv; +#endif + GstElement *audiosink; + GstElement *videoqueue, *audioqueue; + + g_debug ("MMythTVPlayer: Setting the Gstreamer pipeline\n"); + + pipeline = gst_pipeline_new ("video-player"); + source = gst_element_factory_make ("mythtvsrc", "myth-source"); + parser = gst_element_factory_make ("ffdemux_nuv", "nuv-demux"); + + /* Gstreamer Video elements */ + videoqueue = gst_element_factory_make ("queue", "video-queue"); + videodec = gst_element_factory_make ("ffdec_mpeg4", "video-decoder"); +#ifdef MAEMO_PLATFORM + videosink = gst_element_factory_make ("sdlvideosink", "image-output"); +#else + videosink = gst_element_factory_make ("xvimagesink", "image-output"); +#endif + + /* Gstreamer Audio elements */ + audioqueue = gst_element_factory_make ("queue", "audio-queue"); +#ifdef MAEMO_PLATFORM + audiosink = gst_element_factory_make ("dspmp3sink", "audio-output"); +#else + audiodec = gst_element_factory_make ("ffdec_mp3", "audio-decoder"); + audioconv = gst_element_factory_make ("audioconvert", "audio-converter"); + audiosink = gst_element_factory_make ("alsasink", "audio-output"); +#endif + + if (!(pipeline && source && parser && videodec && videosink) || + !(videoqueue && audioqueue && audiosink)) { + /* FIXME: hanlde the error correctly */ + /* video_alignment is not being created (below) + and is causing problems to the ui */ + + tvplayer->gst_pipeline = NULL; + tvplayer->gst_videodec = NULL; + tvplayer->gst_videosink = NULL; + + g_warning ("GstElement creation error!\n"); + return FALSE; + } + +#ifndef MAEMO_PLATFORM + if (!(audiodec && audioconv)) { + g_warning ("GstElement for audio stream creation error!"); + return FALSE; + } +#endif + + + tvplayer->gst_pipeline = pipeline; + tvplayer->gst_source = source; + tvplayer->gst_videodec = videodec; + tvplayer->gst_videosink = videosink; + g_object_ref (tvplayer->gst_pipeline); + g_object_ref (tvplayer->gst_source); + g_object_ref (tvplayer->gst_videodec); + g_object_ref (tvplayer->gst_videosink); + + tvplayer->videoqueue = videoqueue; + tvplayer->audioqueue = audioqueue; + g_object_ref (tvplayer->videoqueue); + g_object_ref (tvplayer->audioqueue); + + g_object_set (G_OBJECT (videosink), "sync", TRUE, NULL); + g_object_set (G_OBJECT (audiosink), "sync", FALSE, NULL); + + gst_bus_add_watch (gst_pipeline_get_bus (GST_PIPELINE (tvplayer->gst_pipeline)), + bus_call, tvplayer); + + gst_bin_add_many (GST_BIN (pipeline), source, parser, videoqueue, + videodec, videosink, audioqueue, audiodec, audioconv, audiosink, NULL); + + { +// GstCaps *rtpcaps = gst_caps_new_simple ("application/x-rtp", NULL); +// gst_element_link_filtered(source, parser, rtpcaps); + } + + gst_element_link (source, parser); + gst_element_link_many (videoqueue, videodec, videosink, NULL); + gst_element_link_many (audioqueue, audiodec, audioconv, audiosink, NULL); + + g_signal_connect (parser, "pad-added", G_CALLBACK (new_pad_cb), tvplayer); + + return TRUE; +} + +/** Configures the backend and the tv player + * for playing the recorded content A/V. + * + * FIXME: Change filename to program info or other structure about the recorded + * + * @param tvplayer the object instance. + * @param filename the file uri of the recorded content to be played. + * @return TRUE if successfull, FALSE if any error happens. + */ +gboolean +mmyth_tvplayer_record_setup (MMythTVPlayer *tvplayer, gchar *filename) +{ + GMythSettings *msettings = gmyth_context_get_settings(); + + // FIXME: we should receive the uri instead of filename + GString *hostname = gmyth_settings_get_backend_hostname (msettings); + int port = gmyth_settings_get_backend_port(msettings); + + GString *fullpath = g_string_new ("myth://"); + g_string_append_printf (fullpath, "%s:%d/%s", hostname->str, port, filename); + + tvplayer->is_livetv = FALSE; + + g_debug ("[%s] Setting record uri to gstreamer pipeline to %s", __FUNCTION__, fullpath->str); + + g_object_set (G_OBJECT (tvplayer->gst_source), "location", + fullpath->str, NULL); + + return TRUE; +} + +/** Configures the backend and the tv player + * for playing the live tv. + * + * @param tvplayer the object instance. + * @return TRUE if successfull, FALSE if any error happens. + */ +gboolean +mmyth_tvplayer_livetv_setup (MMythTVPlayer *tvplayer) +{ + GMythSettings *msettings = gmyth_context_get_settings (); + gboolean res = TRUE; + + res = gmyth_context_check_connection(); + if (!res) { + g_warning ("[%s] LiveTV can not connect to backend", __FUNCTION__); + res = FALSE; + goto error; + } + + tvplayer->backend_hostname = gmyth_settings_get_backend_hostname(msettings); + tvplayer->backend_port = gmyth_settings_get_backend_port (msettings); + + tvplayer->local_hostname = g_string_new(""); + gmyth_context_get_local_hostname (tvplayer->local_hostname); + + if ( tvplayer->local_hostname == NULL ) { + res = FALSE; + goto error; + } + + // Gets the remote encoder num + tvplayer->remote_encoder = remote_request_next_free_recorder (-1); + + if ( tvplayer->remote_encoder == NULL ) { + g_warning ("[%s] None remote encoder available", __FUNCTION__); + res = FALSE; + goto error; + } + + // Creates livetv chain handler + tvplayer->tvchain = GMYTH_TVCHAIN ( g_object_new(GMYTH_TVCHAIN_TYPE, NULL) ); + gmyth_tvchain_initialize ( tvplayer->tvchain, tvplayer->local_hostname ); + + if ( tvplayer->tvchain == NULL || tvplayer->tvchain->tvchain_id == NULL ) { + res = FALSE; + goto error; + } + + // Init remote encoder. Opens its control socket. + res = gmyth_remote_encoder_setup(tvplayer->remote_encoder); + if ( !res ) { + g_warning ("[%s] Fail while setting remote encoder\n", __FUNCTION__); + res = FALSE; + goto error; + } + // Spawn live tv. Uses the socket to send mythprotocol data to start livetv in the backend (remotelly) + res = gmyth_remote_encoder_spawntv ( tvplayer->remote_encoder, + gmyth_tvchain_get_id(tvplayer->tvchain) ); + if (!res) { + g_warning ("[%s] Fail while spawn tv\n", __FUNCTION__); + res = FALSE; + goto error; + } + + // Reload all TV chain from Mysql database. + gmyth_tvchain_reload_all (tvplayer->tvchain); + + if ( tvplayer->tvchain == NULL ) { + res = FALSE; + goto error; + } + + // Get program info from database using chanid and starttime + tvplayer->proginfo = gmyth_tvchain_get_program_at (tvplayer->tvchain, -1); + if ( tvplayer->proginfo == NULL ) { + g_warning ("[%s] LiveTV not successfully started.\n", __FUNCTION__ ); + res = FALSE; + goto error; + } else { + g_debug ("[%s] MythLiveTV: All requests to backend to start TV were OK.\n", __FUNCTION__ ); + } + + return res; + +error: + if ( tvplayer->backend_hostname != NULL ) { + g_string_free( tvplayer->backend_hostname, TRUE ); + res = FALSE; + } + + if ( tvplayer->local_hostname != NULL ) { + g_string_free( tvplayer->local_hostname, TRUE ); + res = FALSE; + } + + if ( tvplayer->remote_encoder != NULL ) { + g_object_unref (tvplayer->remote_encoder); + tvplayer->remote_encoder = NULL; + } + + if ( tvplayer->tvchain != NULL ) { + g_object_unref (tvplayer->tvchain); + tvplayer->tvchain = NULL; + } + + if ( tvplayer->proginfo != NULL ) { + g_object_unref (tvplayer->proginfo); + tvplayer->proginfo = NULL; + } + + return res; + +} + +/** Sets the GTK video widget for the tv player. + * + * @param tvplayer the object instance. + * @param videow the GTK video window. + * @return TRUE if successfull, FALSE if any error happens. + */ +gboolean +mmyth_tvplayer_set_widget (MMythTVPlayer *tvplayer, GtkWidget *videow) +{ + tvplayer->videow = videow; + g_object_ref (videow); + + g_debug ("[%s] Setting widget for tv player render", __FUNCTION__); + + tvplayer->expose_handler = g_signal_connect (tvplayer->videow, "expose-event", + G_CALLBACK (expose_cb), tvplayer); + + //g_signal_connect(miptv_ui->videow, "size_request", G_CALLBACK(cb_preferred_video_size), miptv_ui); + + return TRUE; +} + +static gboolean +bus_call (GstBus * bus, GstMessage * msg, gpointer data) +{ + //MMythTVPlayer *tvplayer = MMYTH_TVPLAYER ( data ); + //GMainLoop *loop = tvplayer->loop; + + switch (GST_MESSAGE_TYPE (msg)) { + case GST_MESSAGE_EOS: + printf ("End of stream\n"); + //g_idle_add ((GSourceFunc) idle_eos, data); + gst_element_set_state ( GST_ELEMENT (GST_MESSAGE_SRC (msg)), GST_STATE_NULL ); + gst_element_set_locked_state ( GST_ELEMENT (GST_MESSAGE_SRC (msg)), FALSE ); + break; + case GST_MESSAGE_ERROR: + { + gchar *debug; + GError *err; + + gst_message_parse_error (msg, &err, &debug); + g_free (debug); + + printf ("Error: %s\n", err->message); + g_error_free (err); + + //g_main_loop_quit (loop); + } + break; + default: + printf (gst_message_type_get_name (GST_MESSAGE_TYPE (msg))); + printf ("\n"); + break; + } + + return TRUE; +} + + +#if 0 +static gboolean +idle_state (gpointer data) +{ + GstPlayerWindowStateChange *st = data; + + if (st->old_state == GST_STATE_PLAYING) { + if (st->miptv_ui->idle_id != 0) { + g_source_remove (st->miptv_ui->idle_id); + st->miptv_ui->idle_id = 0; + } + } + else if (st->new_state == GST_STATE_PLAYING) { + if (st->miptv_ui->idle_id != 0) + g_source_remove (st->miptv_ui->idle_id); + + st->miptv_ui->idle_id = g_idle_add (cb_iterate, st->miptv_ui); + } + + /* new movie loaded? */ + if (st->old_state == GST_STATE_READY && st->new_state > GST_STATE_READY) { + + /* gboolean have_video = FALSE; */ + + gtk_widget_show (st->miptv_ui->videow); + + gtk_window_resize (GTK_WINDOW (st->miptv_ui->main_window), 1, 1); + + } + + /* discarded movie? */ + if (st->old_state > GST_STATE_READY && st->new_state == GST_STATE_READY) { + + if (st->miptv_ui->tagcache) { + gst_tag_list_free (st->miptv_ui->tagcache); + st->miptv_ui->tagcache = NULL; + } + } + + gst_object_unref (GST_OBJECT (st->play)); + //g_object_unref (G_OBJECT (st->win)); + g_free (st); + + /* once */ + return FALSE; +} + +#endif + +/** Stops playing the current A/V. + * + * FIXME: How to proceed differently between livetv + * and recorded content? + * + * @param tvplayer the object instance. + * @return void + */ +void +mmyth_tvplayer_stop_playing (MMythTVPlayer *tvplayer) +{ + g_debug ("[%s] Setting gstreamer pipeline state to NULL", __FUNCTION__); + + gst_element_set_state (tvplayer->gst_pipeline, GST_STATE_NULL); + + if (tvplayer->is_livetv) { + if (!gmyth_remote_encoder_stop_livetv (tvplayer->remote_encoder)) { + g_warning ("[%s] Error while stoping remote encoder", __FUNCTION__); + } + } +} + +/** Queries if the tvplayer is active playing A/V content. + * + * @param tvplayer the object instance. + * @return TRUE if the tvplayer is active, FALSE otherwise. + */ +gboolean +mmyth_tvplayer_is_playing (MMythTVPlayer *tvplayer) +{ + return (GST_STATE (tvplayer->gst_pipeline) == GST_STATE_PLAYING); +} + +/** Static function that sets the tvplayer state to PLAYING. + * + * @param tvplayer the object instance. + * @return TRUE if the tvplayer is active, FALSE otherwise. + */ +static gboolean +idle_play (gpointer data) +{ + MMythTVPlayer *tvplayer = MMYTH_TVPLAYER (data); + + g_debug ("MMythTVPlayer: Setting pipeline state to PLAYING\n"); + + gst_element_set_state (tvplayer->gst_pipeline, GST_STATE_PLAYING); + + return FALSE; +} + +/** Start playing A/V with the tvplayer attributes. + * + * @param tvplayer the object instance. + */ +void +mmyth_tvplayer_start_playing (MMythTVPlayer *tvplayer) +{ + + // FIXME: Move this to livetv_setup?? + if (tvplayer->is_livetv) { + + #if 0 + if (!tvplayer || !(tvplayer->proginfo) || !(tvplayer->local_hostname) + || !(tvplayer->gst_source)) { + g_warning ("GMythtvPlayer not ready to start playing\n"); + } + + if (!(tvplayer->proginfo->pathname)) { + g_warning ("[%s] Playback url is null, could not play the myth content", __FUNCTION__); + return; + } + + g_debug ("MMythTVPlayer: Start playing %s", tvplayer->proginfo->pathname->str); +#endif + g_object_set (G_OBJECT (tvplayer->gst_source), "mythtv-live", + TRUE, NULL); +#if 0 + if ( tvplayer->tvchain != NULL ) { + GString *str_chainid = gmyth_tvchain_get_id(tvplayer->tvchain); + g_print( "[%s]\tCHAIN ID: %s\n", __FUNCTION__, str_chainid->str ); + + g_object_set (G_OBJECT (tvplayer->gst_source), "mythtv-live-chainid", + g_strdup( str_chainid->str ), NULL); + if ( str_chainid!=NULL) + g_string_free( str_chainid, FALSE ); + } + + if ( tvplayer->remote_encoder != NULL ) + g_object_set (G_OBJECT (tvplayer->gst_source), "mythtv-live-id", + tvplayer->remote_encoder->recorder_num, NULL ); + g_debug ("[%s] Setting location to %s", __FUNCTION__, + tvplayer->proginfo->pathname->str); + + /* Sets the gstreamer properties acording to the service access address */ + g_object_set (G_OBJECT (tvplayer->gst_source), "location", + tvplayer->proginfo->pathname->str, NULL); +#endif + } + + g_object_set (G_OBJECT (tvplayer->gst_source), "mythtv-version", + MYTHTV_VERSION_DEFAULT, NULL); + + g_object_set (G_OBJECT (tvplayer->gst_source), "mythtv-debug", + TRUE, NULL); + + g_idle_add (idle_play, tvplayer); + +} + diff -r 7c409a042a9a -r 7174e23f7617 maemo-ui/src/mmyth_tvplayer.h --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/maemo-ui/src/mmyth_tvplayer.h Thu Sep 28 16:02:14 2006 +0100 @@ -0,0 +1,112 @@ +/** + * GMyth Library + * + * @file gmyth/mmyth_tvplayer.h + * + * @brief

This component provides playback of the remote A/V using + * GStreamer. + * + * Copyright (C) 2006 INdT - Instituto Nokia de Tecnologia. + * @author Hallyson Luiz de Morais Melo + * + *//* + * + * This program is free software; you can redistribute it and/or modify + * it under the terms of the GNU Lesser General Public License as published by + * the Free Software Foundation; either version 2 of the License, or + * (at your option) any later version. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU Lesser General Public License + * along with this program; if not, write to the Free Software + * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA + */ + +#ifndef MMYTH_TVPLAYER_H_ +#define MMYTH_TVPLAYER_H_ + +#include +#include + +/* GStreamer includes */ +#include +#include + +#include "gmyth_remote_encoder.h" +#include "gmyth_tvchain.h" +#include "gmyth_common.h" + +G_BEGIN_DECLS + +#define MMYTH_TVPLAYER_TYPE (mmyth_tvplayer_get_type ()) +#define MMYTH_TVPLAYER(obj) (G_TYPE_CHECK_INSTANCE_CAST ((obj), MMYTH_TVPLAYER_TYPE, MMythTVPlayer)) +#define MMYTH_TVPLAYER_CLASS(klass) (G_TYPE_CHECK_CLASS_CAST ((klass), MMYTH_TVPLAYER_TYPE, MMythTVPlayerClass)) +#define IS_MMYTH_TVPLAYER(obj) (G_TYPE_CHECK_INSTANCE_CAST ((obj), MMYTH_TVPLAYER_TYPE)) +#define IS_MMYTH_TVPLAYER_CLASS(klass) (G_TYPE_CHECK_CLASS_CAST ((klass), MMYTH_TVPLAYER_TYPE)) +#define MMYTH_TVPLAYER_GET_CLASS(obj) (G_TYPE_INSTANCE_GET_CLASS ((obj), MMYTH_TVPLAYER_TYPE, MMythTVPlayerClass)) + + +typedef struct _MMythTVPlayer MMythTVPlayer; +typedef struct _MMythTVPlayerClass MMythTVPlayerClass; + +struct _MMythTVPlayerClass +{ + GObjectClass parent_class; + + /* callbacks */ + /* no one for now */ +}; + +struct _MMythTVPlayer +{ + GObject parent; + + GstElement *gst_pipeline; + GstElement *gst_source; + GstElement *gst_videodec; + GstElement *gst_videosink; + GstElement *videoqueue; + GstElement *audioqueue; + + gulong expose_handler; +// GMainLoop *loop; + + GtkWidget *videow; + + /* Backend connection related variables */ + GString *backend_hostname; + gint backend_port; + GString *local_hostname; + + GMythRemoteEncoder *remote_encoder; + GMythTVChain *tvchain; + GMythProgramInfo *proginfo; + + gboolean is_livetv; +}; + + +GType mmyth_tvplayer_get_type (void); + +MMythTVPlayer* mmyth_tvplayer_new (); +gboolean mmyth_tvplayer_initialize (MMythTVPlayer *tvplayer); + +void mmyth_tvplayer_start_playing (MMythTVPlayer *tvplayer); +void mmyth_tvplayer_stop_playing (MMythTVPlayer *tvplayer); + +gboolean mmyth_tvplayer_set_widget (MMythTVPlayer *tvplayer, + GtkWidget *videow); + +gboolean mmyth_tvplayer_is_playing (MMythTVPlayer *tvplayer); + +gboolean mmyth_tvplayer_record_setup (MMythTVPlayer *tvplayer, + gchar *filename); +gboolean mmyth_tvplayer_livetv_setup (MMythTVPlayer *tvplayer); + +G_END_DECLS + +#endif /*MMYTH_TVPLAYER_H_*/ diff -r 7c409a042a9a -r 7174e23f7617 maemo-ui/src/mmyth_ui.c --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/maemo-ui/src/mmyth_ui.c Thu Sep 28 16:02:14 2006 +0100 @@ -0,0 +1,814 @@ + +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include + +#include "mmyth_ui.h" +#include "mmyth_uicommon.h" +#include "mmyth_schedulerui.h" +#include "mmyth_recordui.h" +#include "mmyth_uisettings.h" +#include "mmyth_epg_grid_view.h" +#include "mmyth_tvplayer.h" + +/* GMyth library includes */ +#include "gmyth_context.h" + +#ifndef MAEMO_PLATFORM +static gint button_press_handler (GtkWidget *widget, GdkEvent *event); +#endif + +static MMythUiCommon *create_main_view (MMythUi * mmyth_ui); +static MMythUiCommon *create_video_view (MMythUi * mmyth_ui); +static MMythUiCommon *create_epg_grid_view (MMythUi * mmyth_ui); +static MMythUiCommon *create_record_view (MMythUi * mmyth_ui); +static MMythUiCommon *create_schedule_view (MMythUi * mmyth_ui); + +static void cb_video_close_button (GtkButton * button, gpointer user_data); +static void cb_record_button (GtkButton * button, gpointer user_data); +static void cb_menu_item_settings (GtkMenuItem *menuitem, gpointer user_data); + +/* main box from button box separator*/ +static GtkWidget *main_vseparator = NULL; + +GdkPixbuf *icon_sports, *icon_news, + *icon_movies, *icon_shows, *icon_default; + +#ifndef MAEMO_PLATFORM +/* FIXME: */ +static MMythUi *popup_mmyth_ui; +#endif + +MMythUi * +mmyth_ui_initialize ( +#ifdef MAEMO_PLATFORM + HildonProgram *program, +#endif + GtkWidget * main_window) +{ + MMythUi *mmyth_ui; + + mmyth_ui = g_new0 (MMythUi, 1); + + mmyth_ui->main_window = main_window; + mmyth_ui->videow = NULL; + mmyth_ui->mmyth_recordui = NULL; + mmyth_ui->mmyth_schedulerui = NULL; + + /* Horizontal box that divides the view into control and video area */ + mmyth_ui->main_hbox = gtk_hbox_new (FALSE, 0); + gtk_widget_show (mmyth_ui->main_hbox); + g_object_ref (mmyth_ui->main_hbox); + + main_bg_color.red = 65000; + main_bg_color.green = 65000; + main_bg_color.blue = 65000; + + +#ifndef MAEMO_PLATFORM + /* Popup menu */ + popup_mmyth_ui = mmyth_ui; + g_signal_connect (G_OBJECT (mmyth_ui->main_hbox), "event", + G_CALLBACK (button_press_handler), + G_OBJECT (mmyth_ui->main_hbox)); + +#else // #ifdef MAEMO + + mmyth_ui->main_menu = GTK_MENU(gtk_menu_new()); + hildon_program_set_common_menu(program, mmyth_ui->main_menu); + + mmyth_ui->menu_setup = gtk_menu_item_new_with_label("Setup"); + gtk_widget_set_size_request (GTK_WIDGET (mmyth_ui->menu_setup), 150, 40); + gtk_menu_append(mmyth_ui->main_menu, mmyth_ui->menu_setup); + + g_signal_connect(G_OBJECT(mmyth_ui->menu_setup), "activate", G_CALLBACK(cb_menu_item_settings), mmyth_ui); + + gtk_widget_show_all (GTK_WIDGET (mmyth_ui->main_menu)); +#endif + + // Main widget is mmyth_ui->main_hbox + mmyth_ui->main_uicommon = create_main_view (mmyth_ui); + + gtk_container_add (GTK_CONTAINER (mmyth_ui->main_window), + mmyth_ui->main_hbox); + + mmyth_ui_set_widget (mmyth_ui, mmyth_ui->main_uicommon); + + return mmyth_ui; +} + +void +mmyth_ui_finalize (MMythUi * mmyth_ui) +{ + if (mmyth_ui != NULL) { + if (mmyth_ui->main_uicommon) + mmyth_uicommon_free (mmyth_ui->main_uicommon); + if (mmyth_ui->video_uicommon) + mmyth_uicommon_free (mmyth_ui->video_uicommon); + if (mmyth_ui->epg_grid_uicommon) + mmyth_uicommon_free (mmyth_ui->epg_grid_uicommon); + if (mmyth_ui->record_uicommon) + mmyth_uicommon_free (mmyth_ui->record_uicommon); + if (mmyth_ui->schedule_uicommon) + mmyth_uicommon_free (mmyth_ui->schedule_uicommon); + + g_free (mmyth_ui); + } +} + +void +mmyth_ui_set_widget (MMythUi * mmyth_ui, MMythUiCommon * new_uicommon) +{ + if (new_uicommon == NULL) { + g_warning ("MMythUI setting a NULL UI_Common as current display\n"); + return; + } + + if (mmyth_ui->current_uicommon) { + if (mmyth_ui->current_uicommon == mmyth_ui->video_uicommon) { + gtk_widget_hide (mmyth_ui->current_uicommon->main_widget); + gtk_widget_hide (mmyth_ui->videow); + } + else { + gtk_container_remove (GTK_CONTAINER (mmyth_ui->main_hbox), + mmyth_ui->current_uicommon->main_widget); + } + + gtk_container_remove (GTK_CONTAINER (mmyth_ui->main_hbox), + mmyth_ui->current_uicommon->event_box); + gtk_container_remove (GTK_CONTAINER (mmyth_ui->main_hbox), + main_vseparator); + + } + + if (new_uicommon->main_widget == mmyth_ui->video_alignment) { + //gst_player_video_show (GST_PLAYER_VIDEO(mmyth_ui->videow)); + gtk_widget_show (mmyth_ui->video_alignment); + gtk_widget_show (mmyth_ui->videow); + } + else { + /* FIXME: Fst call is NULL when mmyth_player_init fails */ + if(mmyth_ui->video_alignment != NULL) + gtk_widget_hide (mmyth_ui->video_alignment); + /* FIXME: Fst call is NULL when mmyth_player_init fails */ + if(mmyth_ui->videow != NULL) + gtk_widget_hide (mmyth_ui->videow); + + gtk_box_pack_start (GTK_BOX (mmyth_ui->main_hbox), + new_uicommon->main_widget, TRUE, TRUE, 0); + } + + if(main_vseparator == NULL) { + /* FIXME: should free this variable*/ + main_vseparator = gtk_vseparator_new(); + g_object_ref (main_vseparator); + } + gtk_box_pack_start (GTK_BOX (mmyth_ui->main_hbox), + main_vseparator, FALSE, FALSE, 0); + gtk_widget_show (main_vseparator); + + gtk_box_pack_end (GTK_BOX (mmyth_ui->main_hbox), new_uicommon->event_box, FALSE, + FALSE, 0); + + mmyth_ui->current_uicommon = new_uicommon; + +} + +/* The close callback is the same for all windows*/ +static void +cb_not_impl_button (GtkButton * button, gpointer user_data) +{ + MMythUi *mmyth_ui = (MMythUi *) user_data; + + GtkWidget *msg_dialog = gtk_message_dialog_new ( + GTK_WINDOW(mmyth_ui->main_window), + GTK_DIALOG_MODAL | + GTK_DIALOG_DESTROY_WITH_PARENT, + GTK_MESSAGE_INFO, + GTK_BUTTONS_OK, + "Feature not implemented"); + gtk_widget_set_size_request (msg_dialog, 350, 120); + + gtk_dialog_run (GTK_DIALOG (msg_dialog)); + + gtk_widget_destroy(GTK_WIDGET(msg_dialog)); +} + +/****************************************************************************** + * POPUP MENU WIDGET METHODS * + *****************************************************************************/ + +static void +cb_menu_item_settings (GtkMenuItem *menuitem, + gpointer user_data) +{ + + MMythUi *mmyth_ui = (MMythUi*) user_data; + + if (mmyth_uisettings_run (GTK_WINDOW (mmyth_ui->main_window))) { + // If user changes the settings, we restart the context + g_debug ("[%s] Restarting mmyth_context to new settings", __FUNCTION__); + gmyth_context_initialize(); + } +} + +#ifndef MAEMO_PLATFORM + +static void +detacher (GtkWidget *attach_widget,GtkMenu *menu) +{ + +} + +static void +do_popup_menu (GtkWidget *my_widget, GdkEventButton *event) +{ + GtkWidget *popup; + + int button, event_time; + + GtkWidget *item_general; + GtkWidget *image; + + popup = gtk_menu_new (); + + item_general = gtk_image_menu_item_new_with_mnemonic ("Setup"); + gtk_widget_show (item_general); + gtk_container_add (GTK_CONTAINER (popup), item_general); + + image = gtk_image_new_from_stock ("gtk-edit", GTK_ICON_SIZE_MENU); + gtk_widget_show (image); + gtk_image_menu_item_set_image (GTK_IMAGE_MENU_ITEM (item_general), image); + + g_signal_connect (G_OBJECT(item_general), "activate", G_CALLBACK (cb_menu_item_settings), popup_mmyth_ui); + + if (event) { + button = event->button; + event_time = event->time; + } else { + button = 0; + event_time = gtk_get_current_event_time (); + } + + gtk_menu_attach_to_widget (GTK_MENU (popup), my_widget, detacher); + gtk_menu_popup (GTK_MENU (popup), NULL, NULL, NULL, NULL, + button, event_time); + gtk_widget_show_all(popup); +} + +/* Respond to a button-press by posting a menu passed in as widget. + * + * Note that the "widget" argument is the menu being posted, NOT + * the button that was pressed. + */ +static gint +button_press_handler (GtkWidget *widget, GdkEvent *event) +{ + + if (event->type == GDK_BUTTON_PRESS) { + GdkEventButton *bevent = (GdkEventButton *) event; + /* Ignore double-clicks and triple-clicks */ + if (bevent->button == 3) + { + do_popup_menu (widget, bevent); + return TRUE; + } + } + + /* Tell calling code that we have not handled this event; pass it on. */ + return FALSE; +} +#endif + +/****************************************************************************** + * MAIN APP VIEW METHODS * + *****************************************************************************/ + +static void +cb_close_button (GtkButton * button, gpointer user_data) +{ + MMythUi *mmyth_ui = (MMythUi *) user_data; + + mmyth_ui_set_widget (mmyth_ui, mmyth_ui->main_uicommon); +} + +static void +cb_watch_tv_button (GtkButton * button, gpointer user_data) +{ + MMythUi *mmyth_ui = (MMythUi *) user_data; + gboolean res = FALSE; + + if (!(mmyth_ui->video_uicommon)) + mmyth_ui->video_uicommon = create_video_view (mmyth_ui); + + // Creates the tv player that will retrieve the mythtv content, decode and show it + mmyth_ui->tvplayer = mmyth_tvplayer_new (); + /* choose here if this is a LiveTV session */ + mmyth_ui->tvplayer->is_livetv = TRUE; + + res = mmyth_tvplayer_initialize (mmyth_ui->tvplayer); + + if (!res) { + g_warning ("[%s] Could not initialize tvplayer", __FUNCTION__); + + g_object_unref (mmyth_ui->tvplayer); + mmyth_ui->tvplayer = NULL; + + GtkWidget *dialog = gtk_message_dialog_new ( + GTK_WINDOW(mmyth_ui->main_window), + GTK_DIALOG_DESTROY_WITH_PARENT, + GTK_MESSAGE_ERROR, + GTK_BUTTONS_CLOSE, + "MMyth found errors while starting TV Player, please check " + "the GStreamer installation"); + + gtk_dialog_run (GTK_DIALOG (dialog)); + gtk_widget_destroy (dialog); + + return; + } + //res = mmyth_tvplayer_livetv_setup (mmyth_ui->tvplayer); + // + if (mmyth_ui && mmyth_ui->tvplayer && res) { + mmyth_tvplayer_set_widget (mmyth_ui->tvplayer, mmyth_ui->videow); + mmyth_tvplayer_start_playing (mmyth_ui->tvplayer); + } else { + // TODO: Show Alert with error description! + g_warning ("[%s] MMythUI can't initialize tv_player", __FUNCTION__); + g_object_unref (mmyth_ui->tvplayer); + mmyth_ui->tvplayer = NULL; + // FIXME: Show the exact error that happened + GtkWidget *dialog = gtk_message_dialog_new ( + GTK_WINDOW(mmyth_ui->main_window), + GTK_DIALOG_DESTROY_WITH_PARENT, + GTK_MESSAGE_ERROR, + GTK_BUTTONS_CLOSE, + "Error while starting TV Player, please check if the backend" + " is running properly and a tv card is available!"); + gtk_dialog_run (GTK_DIALOG (dialog)); + gtk_widget_destroy (dialog); + return; + } + mmyth_ui_set_widget (mmyth_ui, mmyth_ui->video_uicommon); + +} + +static void +cb_epg_button (GtkButton * button, gpointer user_data) +{ + MMythUi *mmyth_ui = (MMythUi *) user_data; + + if (!(mmyth_ui->epg_grid_uicommon)) + mmyth_ui->epg_grid_uicommon = create_epg_grid_view(mmyth_ui); + + mmyth_ui_set_widget (mmyth_ui, mmyth_ui->epg_grid_uicommon); +} + +static MMythUiCommon * +create_main_view (MMythUi * mmyth_ui) +{ + MMythUiCommon *ui_common; + GtkWidget *main_widget; + GtkWidget *image; + + g_debug ("Creating Main UI Common"); + + // FIXME: file path +#ifdef MMYTH_DEV + image = gtk_image_new_from_file ("../pixmaps/mmyth_logo.png"); +#else + image = gtk_image_new_from_file ( PIX_DIR "mmyth_logo.png"); +#endif + + main_widget = gtk_event_box_new(); + + gtk_container_add (GTK_CONTAINER (main_widget), + image); + + + gtk_widget_show_all (main_widget); + g_object_ref (main_widget); + + ui_common = mmyth_uicommon_new (main_widget, + "Watch TV", "EPG", "Recording"); + + /* Button signals */ + // FIXME + g_signal_connect (G_OBJECT (ui_common->button1), "clicked", + G_CALLBACK (cb_watch_tv_button), mmyth_ui); + g_signal_connect (G_OBJECT (ui_common->button2), "clicked", + G_CALLBACK (cb_epg_button), mmyth_ui); + g_signal_connect (G_OBJECT (ui_common->button3), "clicked", + G_CALLBACK (cb_record_button), mmyth_ui); + + return ui_common; + +} + +/****************************************************************************** + * epg GRID VIEW METHODS * + *****************************************************************************/ + +static MMythUiCommon * +create_epg_grid_view (MMythUi * mmyth_ui) +{ + MMythUiCommon *ui_common; + + g_debug ("Creating EPG Grid UI Common"); + + GtkWidget *epg_grid_view = GTK_WIDGET (epg_grid_view_new (mmyth_ui)); + + ui_common = mmyth_uicommon_new (epg_grid_view, + "Play", "Record", + "Close"); + + /* Button signals */ + g_signal_connect (G_OBJECT (ui_common->button1), "clicked", + G_CALLBACK (cb_not_impl_button), mmyth_ui); + g_signal_connect (G_OBJECT (ui_common->button2), "clicked", + G_CALLBACK (cb_record_button), mmyth_ui); + g_signal_connect (G_OBJECT (ui_common->button3), "clicked", + G_CALLBACK (cb_close_button), mmyth_ui); + + return ui_common; +} +/****************************************************************************** + * SCHEDULE VIEW METHODS * + ******************************************************************************/ + +static void +cb_save_new_schedule (GtkButton *button, gpointer user_data) +{ + MMythUi *mmyth_ui = (MMythUi *) user_data; + + if (!(mmyth_ui->schedule_uicommon)) + mmyth_ui->schedule_uicommon = create_schedule_view(mmyth_ui); + + mmyth_schedulerui_save (mmyth_ui->mmyth_schedulerui); + + mmyth_recordui_reload_schedule (mmyth_ui->mmyth_recordui); + + mmyth_ui_set_widget (mmyth_ui, mmyth_ui->record_uicommon); + +} + +static void +cb_edit_scheduled (GtkTreeView * tree_view, GtkTreePath *path, + GtkTreeViewColumn *column, gpointer user_data) +{ + MMythUi *mmyth_ui = (MMythUi *) user_data; + GtkTreeSelection *selection; + GtkTreeModel *list_store; + GtkTreeIter iter; + int index; + //gint new_row = 0, record_id = 0; + ScheduleInfo *schedule_info; + GList *schedule_list; + //GtkTreeIter iter; + gint res; + + //gtk_tree_store_clear(recordui->sch_tree_store); + + res = gmyth_scheduler_get_schedule_list(mmyth_ui->mmyth_recordui->scheduler, &(schedule_list)); + if (res < 0) { + g_warning ("[%s] Retrieved NULL list of scheduled data from database", __FUNCTION__); + //return FALSE; + } + printf("\nX %d", res); fflush(stdout); + + selection = + gtk_tree_view_get_selection(GTK_TREE_VIEW(mmyth_ui->mmyth_recordui->sch_treeview)); + + gtk_tree_selection_get_selected(selection, &list_store, &iter); + gtk_tree_model_get(list_store, &iter, 4, &index, -1); + + mmyth_ui_set_widget (mmyth_ui, mmyth_ui->schedule_uicommon); + + if (!(mmyth_ui->schedule_uicommon)) + mmyth_ui->schedule_uicommon = create_schedule_view(mmyth_ui); + + schedule_list = g_list_nth(schedule_list, atoi(gtk_tree_path_to_string(path))); + schedule_info = (ScheduleInfo*) schedule_list->data; + + printf("\nstarttime: %ld", schedule_info->start_time); fflush(stdout); +} + +static MMythUiCommon * +create_schedule_view (MMythUi * mmyth_ui) +{ + MMythUiCommon *ui_common; + GtkWidget *schedule_widget; + + g_debug ("Creating Schedule UI Common"); + + mmyth_ui->mmyth_schedulerui = mmyth_schedulerui_new (); + if (mmyth_ui->mmyth_schedulerui == NULL) { + g_warning ("[%s] Error while creating scheduler ui", __FUNCTION__); + return NULL; + } + + schedule_widget = mmyth_ui->mmyth_schedulerui->main_widget; + + gtk_widget_show_all (schedule_widget); + g_object_ref (schedule_widget); + + ui_common = mmyth_uicommon_new (schedule_widget, + "Save", "Clear", + "Cancel"); + + /* Button signals */ + g_signal_connect (G_OBJECT (ui_common->button1), "clicked", + G_CALLBACK (cb_save_new_schedule), mmyth_ui); + g_signal_connect (G_OBJECT (ui_common->button2), "clicked", + G_CALLBACK (cb_not_impl_button), mmyth_ui); + g_signal_connect (G_OBJECT (ui_common->button3), "clicked", + G_CALLBACK (cb_record_button), mmyth_ui); + + return ui_common; +} +/****************************************************************************** + * RECORD VIEW METHODS * + ******************************************************************************/ +static void +cb_record_button (GtkButton * button, gpointer user_data) +{ + MMythUi *mmyth_ui = (MMythUi *) user_data; + + if (!(mmyth_ui->record_uicommon)) { + mmyth_ui->record_uicommon = create_record_view (mmyth_ui); + mmyth_ui->schedule_uicommon = create_schedule_view (mmyth_ui); + } + + mmyth_recordui_reload_all (mmyth_ui->mmyth_recordui); + + mmyth_ui_set_widget (mmyth_ui, mmyth_ui->record_uicommon); + +} + +static void +cb_record_close_button (GtkButton * button, gpointer user_data) +{ + MMythUi *mmyth_ui = (MMythUi *) user_data; + + mmyth_ui_set_widget(mmyth_ui, mmyth_ui->main_uicommon); + + mmyth_recordui_free(mmyth_ui->mmyth_recordui); + + if (mmyth_ui->record_uicommon) { + gtk_widget_destroy (mmyth_ui->record_uicommon->main_widget); + mmyth_uicommon_free(mmyth_ui->record_uicommon); + mmyth_ui->record_uicommon = NULL; + } + + if (mmyth_ui->schedule_uicommon) { + // mmyth_uicommon_free(mmyth_ui->schedule_uicommon); + } +} + + + + +static void +play_selected_recorded (gpointer user_data) +{ + MMythUi *mmyth_ui = (MMythUi *) user_data; + gboolean res = FALSE; + + gchar *path = mmyth_recordui_get_selected_recorded (mmyth_ui->mmyth_recordui); + + if (path == NULL) { + // This should never happens. Play button is just activated when + // a recording is selected. + g_warning ("[%s] Play button pressed while none recorded is selected", __FUNCTION__); + return; + } + + if (!(mmyth_ui->video_uicommon)) + mmyth_ui->video_uicommon = create_video_view (mmyth_ui); + + // Creates the tv player that will retrieve the mythtv content, decode and show it + mmyth_ui->tvplayer = mmyth_tvplayer_new (); + g_debug ("[%s] New TV Player created: %d\n", __FUNCTION__, (int) (mmyth_ui->tvplayer)); + res = mmyth_tvplayer_initialize (mmyth_ui->tvplayer); + if (!res) { + g_warning ("[%s] Could not initialize tvplayer", __FUNCTION__); + + g_object_unref (mmyth_ui->tvplayer); + mmyth_ui->tvplayer = NULL; + + GtkWidget *dialog = gtk_message_dialog_new ( + GTK_WINDOW(mmyth_ui->main_window), + GTK_DIALOG_DESTROY_WITH_PARENT, + GTK_MESSAGE_ERROR, + GTK_BUTTONS_CLOSE, + "MMyth found errors while starting TV Player, please check " + "the GStreamer installation"); + + gtk_dialog_run (GTK_DIALOG (dialog)); + gtk_widget_destroy (dialog); + + return; + } + + res = mmyth_tvplayer_record_setup (mmyth_ui->tvplayer, path); + + if (mmyth_ui && mmyth_ui->tvplayer && res) { + mmyth_tvplayer_set_widget (mmyth_ui->tvplayer, mmyth_ui->videow); + mmyth_tvplayer_start_playing (mmyth_ui->tvplayer); + } else { + // TODO: Show Alert with error description! + g_warning ("[%s] MMythUI can't initialize tv_player", __FUNCTION__); + g_object_unref (mmyth_ui->tvplayer); + mmyth_ui->tvplayer = NULL; + // FIXME: Show the exact error that happened + GtkWidget *dialog = gtk_message_dialog_new ( + GTK_WINDOW(mmyth_ui->main_window), + GTK_DIALOG_DESTROY_WITH_PARENT, + GTK_MESSAGE_ERROR, + GTK_BUTTONS_CLOSE, + "Error while starting TV Player, please check if the backend" + " is running properly and a tv card is available!"); + gtk_dialog_run (GTK_DIALOG (dialog)); + gtk_widget_destroy (dialog); + return; + } + + mmyth_ui_set_widget (mmyth_ui, mmyth_ui->video_uicommon); +} + +static void +cb_play_clicked_recorded (GtkTreeView * tree_view, GtkTreePath *path, + GtkTreeViewColumn *column, gpointer user_data) +{ + play_selected_recorded (user_data); +} + +static void +cb_play_selected (GtkButton * button, gpointer user_data) +{ + play_selected_recorded (user_data); +} + +static void +cb_schedule_button (GtkButton * button, gpointer user_data) +{ + MMythUi *mmyth_ui = (MMythUi *) user_data; + + mmyth_ui_set_widget (mmyth_ui, mmyth_ui->schedule_uicommon); +} + +void +cb_switch_page (GtkNotebook *notebook, GtkNotebookPage *page, + guint page_num, gpointer user_data) +{ + MMythUi *mmyth_ui = (MMythUi *) user_data; + MMythUiCommon *ui_common; + + assert (mmyth_ui); + assert (mmyth_ui->record_uicommon); + + ui_common = mmyth_ui->record_uicommon; + + if (page_num == 0) { // Switched to Schedule list + gtk_button_set_label (GTK_BUTTON (ui_common->button1), "New"); + g_signal_handlers_disconnect_by_func ( + G_OBJECT (ui_common->button1), G_CALLBACK (cb_play_selected), mmyth_ui); + g_signal_connect (G_OBJECT (ui_common->button1), "clicked", + G_CALLBACK (cb_schedule_button), mmyth_ui); + } else if (page_num == 1) { + gtk_button_set_label (GTK_BUTTON (ui_common->button1), "Play"); + g_signal_handlers_disconnect_by_func ( + G_OBJECT (ui_common->button1), G_CALLBACK (cb_schedule_button), mmyth_ui); + g_signal_connect (G_OBJECT (ui_common->button1), "clicked", + G_CALLBACK (cb_play_selected), mmyth_ui); + } +} + + +static MMythUiCommon * +create_record_view (MMythUi * mmyth_ui) +{ + MMythUiCommon *ui_common; + + g_debug ("Creating Record UI Common"); + + mmyth_ui->mmyth_recordui = mmyth_recordui_new (); + + // FIXME: Change MMythRecordUI to a GtkWidget child and avoid this call! + gtk_widget_show_all (mmyth_ui->mmyth_recordui->scrolled_window); + + ui_common = mmyth_uicommon_new (mmyth_ui->mmyth_recordui->scrolled_window, "New", "Delete", "<mmyth_recordui->scrolled_window); + + /* Button signals */ + g_signal_connect (G_OBJECT (ui_common->button1), "clicked", + G_CALLBACK (cb_schedule_button), mmyth_ui); + g_signal_connect (G_OBJECT (ui_common->button2), "clicked", + G_CALLBACK (mmyth_recordui_delete_selected), mmyth_ui->mmyth_recordui); + g_signal_connect (G_OBJECT (ui_common->button3), "clicked", + G_CALLBACK (cb_record_close_button), mmyth_ui); + g_signal_connect (G_OBJECT (mmyth_ui->mmyth_recordui->notebook), + "switch-page", G_CALLBACK (cb_switch_page), mmyth_ui); + g_signal_connect (G_OBJECT (mmyth_ui->mmyth_recordui->rec_treeview), + "row-activated", G_CALLBACK (cb_play_clicked_recorded), mmyth_ui); + g_signal_connect (G_OBJECT (mmyth_ui->mmyth_recordui->sch_treeview), + "row-activated", G_CALLBACK (cb_edit_scheduled), mmyth_ui); + return ui_common; +} + + +/****************************************************************************** + * GST VIDEO WIDGET METHODS * + *****************************************************************************/ + +static void +cb_video_close_button (GtkButton * button, gpointer user_data) +{ + MMythUi *mmyth_ui = (MMythUi *) user_data; + + g_debug ("MMythUI video close button pressed"); + + if (mmyth_ui && mmyth_ui->tvplayer) { + mmyth_tvplayer_stop_playing (mmyth_ui->tvplayer); + + g_object_unref (mmyth_ui->tvplayer); + mmyth_ui->tvplayer = NULL; + } else { + g_warning ("cb_video_close_button called with NULL pointer\n"); + } + + mmyth_ui_set_widget (mmyth_ui, mmyth_ui->main_uicommon); +} + + +static MMythUiCommon * +create_video_view (MMythUi * mmyth_ui) +{ + + MMythUiCommon *ui_common; + + g_debug ("Creating Video UI Common"); + + /* Creates widget to be user by MMythTVPlayer to draw the video */ + mmyth_ui->videow = gtk_drawing_area_new (); + // FIXME: Get the widget size from settings + gtk_widget_set_size_request (mmyth_ui->videow, 300, 240); + + //mmiptv_ui->logo = gdk_pixbuf_new_from_file ("logo.png", NULL); + + // Creates an alignment to place the video widget inside + mmyth_ui->video_alignment = gtk_alignment_new (0.5, 0.5, 1, 1); + gtk_widget_hide (mmyth_ui->video_alignment); + + gtk_container_add (GTK_CONTAINER (mmyth_ui->video_alignment), + mmyth_ui->videow); + + /* Add the gst video widget to hbox. It should never be removed. */ + /* FIXME: mmyth_ui->video_alignment == NULL when mmyth_player_init fails */ + if((mmyth_ui->main_hbox != NULL) && (mmyth_ui->video_alignment != NULL)) { + gtk_box_pack_start (GTK_BOX (mmyth_ui->main_hbox), + mmyth_ui->video_alignment, TRUE, TRUE, 0); + } else { + g_warning ("[%s] Error while adding video_alignment to main widget", __FUNCTION__); + } + + g_object_ref (mmyth_ui->videow); + g_object_ref (mmyth_ui->video_alignment); + + ui_common = mmyth_uicommon_new (mmyth_ui->video_alignment, + " Full\nScreen", "Other\nServices", + "Close"); + + + g_signal_connect (G_OBJECT (ui_common->button1), "clicked", + G_CALLBACK (cb_not_impl_button), mmyth_ui); + g_signal_connect (G_OBJECT (ui_common->button2), "clicked", + G_CALLBACK (cb_not_impl_button), mmyth_ui); + g_signal_connect (G_OBJECT (ui_common->button3), "clicked", + G_CALLBACK (cb_video_close_button), mmyth_ui); + + if (ui_common) + g_debug ("Video UI_Common sucessfull created"); + + return ui_common; +} + + + +GtkWidget* +mmyth_ui_get_video_widget (MMythUi *mmyth_ui) { + + if (mmyth_ui && mmyth_ui->videow) { + + return mmyth_ui->videow; + } + + return NULL; +} diff -r 7c409a042a9a -r 7174e23f7617 maemo-ui/src/mmyth_ui.h --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/maemo-ui/src/mmyth_ui.h Thu Sep 28 16:02:14 2006 +0100 @@ -0,0 +1,73 @@ +#ifndef MMYTH_UI_H_ +#define MMYTH_UI_H_ + +#include +#include + +#include "config.h" + +#ifdef MAEMO_PLATFORM +#include "hildon-widgets/hildon-program.h" +#include "hildon-widgets/hildon-window.h" +#endif + +#include "mmyth_uicommon.h" +#include "mmyth_recordui.h" +#include "mmyth_schedulerui.h" +#include "mmyth_tvplayer.h" + +typedef struct _MMythUi +{ + + /* The main application window */ + GtkWidget *main_window; + MMythUiCommon *current_uicommon; + + /* Main widget components */ + GtkWidget *main_hbox; + GtkWidget *video_alignment; + GdkPixbuf *logo; + + /* Main widgets grouping */ + MMythUiCommon *main_uicommon; + MMythUiCommon *video_uicommon; + MMythUiCommon *epg_grid_uicommon; + MMythUiCommon *record_uicommon; + MMythUiCommon *schedule_uicommon; + + GtkWidget *videow; + int idle_id; + //GstTagList *tagcache; + + MMythRecordUI *mmyth_recordui; + MMythSchedulerUI *mmyth_schedulerui; + +#ifdef MAEMO_PLATFORM + HildonProgram *program; + GtkMenu *main_menu; + GtkWidget *menu_setup; +#endif + + MMythTVPlayer *tvplayer; + +} MMythUi; + +GdkPixbuf *icon_sports, *icon_news, *icon_movies, *icon_shows; +GdkColor main_bg_color; + +void mmyth_set_main_widget (MMythUi * mmyth_ui, MMythUiCommon * new_ui); +//void mmyth_play_selected(GtkButton * button, gpointer user_data); + +#ifdef MAEMO_PLATFORM +MMythUi *mmyth_ui_initialize (HildonProgram *program, GtkWidget * main_window); +#else +MMythUi *mmyth_ui_initialize (GtkWidget * main_window); +#endif + +void mmyth_ui_finalize (MMythUi * mmyth_ui); + +void mmyth_ui_set_widget (MMythUi * mmyth_ui, MMythUiCommon * new_uicommon); + +GtkWidget* mmyth_ui_get_video_widget (MMythUi *mmyth_ui); + +#endif /* MMYTH_UI_H_ */ diff -r 7c409a042a9a -r 7174e23f7617 maemo-ui/src/mmyth_uicommon.c --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/maemo-ui/src/mmyth_uicommon.c Thu Sep 28 16:02:14 2006 +0100 @@ -0,0 +1,134 @@ + +#include +#include +#include + +#include "mmyth_uicommon.h" +#include "mmyth_ui.h" + +static void +refresh_time_on_screen (GtkWidget *label) +{ + time_t real_time; + struct tm sched_time; + GString *time_showed; + + time_showed = g_string_new(""); + time(&real_time); + + if (localtime_r((time_t *)&real_time, &sched_time) == NULL) { + g_error ("localtime_r error in mmyth_epg_grid_view!\n"); + return NULL; + } + + g_string_printf(time_showed, "%d:%02d:%02d", + sched_time.tm_hour, + sched_time.tm_min, + sched_time.tm_sec); + + gtk_label_set_text (GTK_LABEL(label), time_showed->str); +} + +MMythUiCommon * +mmyth_uicommon_new (GtkWidget * main_widget, const gchar * label1, + const gchar * label2, const gchar * label3) +{ + + MMythUiCommon *ui_common = g_new0 (MMythUiCommon, 1); + + if (!main_widget) { + g_warning ("MMythUICommon created with a NULL main widget\n"); + } + + ui_common->main_widget = main_widget; + + ui_common->event_box = gtk_event_box_new(); + + /* Vertical box that divides the control area into two (buttons + clock) */ + ui_common->vbox = gtk_vbox_new (FALSE, 0); /* spacing */ + gtk_container_set_border_width(GTK_CONTAINER (ui_common->vbox), 4); + + gtk_container_add (GTK_CONTAINER (ui_common->event_box), + ui_common->vbox); + gtk_widget_modify_bg(ui_common->event_box, GTK_STATE_NORMAL, &main_bg_color); + + /* Vertical box that divides the control area into four */ + ui_common->button_vbox = gtk_vbox_new (TRUE, 0); /* spacing */ + + gtk_container_set_border_width (GTK_CONTAINER (ui_common->button_vbox), 0); + + /* The button 1 */ + ui_common->button1 = gtk_button_new_with_label (label1); + gtk_widget_modify_bg(ui_common->button1, GTK_STATE_NORMAL, &main_bg_color); + gtk_widget_set_size_request (ui_common->button1, BUTTON_WIDTH, + BUTTON_HEIGHT); + + /* The button 2 */ + ui_common->button2 = gtk_button_new_with_label (label2); + gtk_widget_modify_bg(ui_common->button2, GTK_STATE_NORMAL, &main_bg_color); + gtk_widget_set_size_request (ui_common->button2, BUTTON_WIDTH, + BUTTON_HEIGHT); + + /* The button 3 */ + ui_common->button3 = gtk_button_new_with_label (label3); + gtk_widget_modify_bg(ui_common->button3, GTK_STATE_NORMAL, &main_bg_color); + gtk_widget_set_size_request (ui_common->button3, BUTTON_WIDTH, + BUTTON_HEIGHT); + + /* The clock label */ + ui_common->label = gtk_label_new ("Starting..."); + gtk_widget_show (ui_common->label); + ui_common->source_id = g_timeout_add(500, (GSourceFunc) refresh_time_on_screen, ui_common->label); + + /* Packing components */ + gtk_box_pack_start (GTK_BOX (ui_common->vbox), + ui_common->button_vbox, TRUE, TRUE, 0); + + gtk_box_pack_start (GTK_BOX (ui_common->vbox), + ui_common->label, FALSE, FALSE, 0); + + gtk_box_pack_start (GTK_BOX (ui_common->button_vbox), + ui_common->button1, FALSE, FALSE, 0); + + gtk_box_pack_start (GTK_BOX (ui_common->button_vbox), + ui_common->button2, FALSE, FALSE, 0); + + gtk_box_pack_start (GTK_BOX (ui_common->button_vbox), + ui_common->button3, FALSE, FALSE, 0); + + gtk_widget_show_all (ui_common->event_box); + + /* FIXME: mmyth_ui->video_alignment == NULL when mmyth_player_init fails */ + if(ui_common->main_widget != NULL) + g_object_ref (ui_common->main_widget); + + g_object_ref (ui_common->vbox); + g_object_ref (ui_common->button_vbox); + g_object_ref (ui_common->label); + g_object_ref (ui_common->button1); + g_object_ref (ui_common->button2); + g_object_ref (ui_common->button3); + g_object_ref (ui_common->event_box); + return ui_common; +} + +void +mmyth_uicommon_free (MMythUiCommon *ui_common) +{ + g_debug ("[%s] Clean uicommon used memory", __FUNCTION__); + + g_source_remove (ui_common->source_id); + + g_object_unref (ui_common->main_widget); + g_object_unref (ui_common->vbox); + g_object_unref (ui_common->button_vbox); + g_object_unref (ui_common->label); + g_object_unref (ui_common->button1); + g_object_unref (ui_common->button2); + g_object_unref (ui_common->button3); + g_object_unref (ui_common->event_box); + + g_free (ui_common); +} + + diff -r 7c409a042a9a -r 7174e23f7617 maemo-ui/src/mmyth_uicommon.h --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/maemo-ui/src/mmyth_uicommon.h Thu Sep 28 16:02:14 2006 +0100 @@ -0,0 +1,51 @@ +#ifndef MMYTH_UICOMMON_H_ +#define MMYTH_UICOMMON_H_ + +#include "config.h" + +#include +#include + +#ifndef MAEMO_PLATFORM +#define BUTTON_HEIGHT 50 +#define BUTTON_WIDTH 100 +#else +#define BUTTON_HEIGHT 80 +#define BUTTON_WIDTH 150 +#endif + +#define MAIN_WINDOW_WIDTH 550 +#define MAIN_WINDOW_HEIGHT 250 + +#define CHANNELS_DIALOG_WIDTH 300 +#define CHANNELS_DIALOG_HEIGHT 200 + +#define SETTINGS_DIALOG_WIDTH 300 +#define SETTINGS_DIALOG_HEIGHT 120 + +extern GdkColor main_bg_color; + +typedef struct _MMythUiCommon +{ + GtkWidget *main_widget; + + /* event box to set the background color*/ + GtkWidget *event_box; + + GtkWidget *vbox; + GtkWidget *button_vbox; + GtkWidget *label; + + GtkWidget *button1; + GtkWidget *button2; + GtkWidget *button3; + + gint source_id; +} MMythUiCommon; + +MMythUiCommon *mmyth_uicommon_new (GtkWidget * main_widget, + const gchar * label1, const gchar * label2, + const gchar * label3); +void mmyth_uicommon_free (MMythUiCommon *ui_common); + +#endif /* MMYTH_UICOMMON_H_ */ diff -r 7c409a042a9a -r 7174e23f7617 maemo-ui/src/mmyth_uisettings.c --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/maemo-ui/src/mmyth_uisettings.c Thu Sep 28 16:02:14 2006 +0100 @@ -0,0 +1,169 @@ +#include +#include +#include +#include +#include +#include +#include +#include + +#include "mmyth_uisettings.h" + +#include "gmyth_context.h" + +static GtkWidget *settings_dialog; +static GtkWidget *entry_hostname; +static GtkWidget *entry_dbname; +static GtkWidget *entry_username; +static GtkWidget *entry_passwd; +static GtkWidget *entry_port; + +static void settings_dialog_update_data (void); +static GtkWidget* add_entry_to_table (GtkWidget *table, GString *init_str, + guint pos_left, guint pos_right, guint pos_top, guint pos_bottom); +static GtkWidget* add_label_to_table (GtkWidget *table, const gchar *str, + guint pos_left, guint pos_right, guint pos_top, guint pos_bottom); + + +gboolean +mmyth_uisettings_run (GtkWindow *main_window) +{ + + GtkWidget *settings_table; + GtkWidget *label_hostname, *label_dbname; + GtkWidget *label_username, *label_passwd, *label_port; + + GMythSettings *msettings = gmyth_context_get_settings(); + + settings_dialog = gtk_dialog_new_with_buttons ("Settings", + main_window, + GTK_DIALOG_DESTROY_WITH_PARENT, + GTK_STOCK_OK, + GTK_RESPONSE_ACCEPT, + GTK_STOCK_CANCEL, + GTK_RESPONSE_REJECT, + NULL); + + gtk_widget_set_size_request (settings_dialog, 400, 244); + +/* scrolledwindow1 = gtk_scrolled_window_new (NULL, NULL); + gtk_widget_show (scrolledwindow1); + gtk_container_add (GTK_CONTAINER (window1), scrolledwindow1); + gtk_scrolled_window_set_policy (GTK_SCROLLED_WINDOW (scrolledwindow1), GTK_POLICY_AUTOMATIC, GTK_POLICY_NEVER); + + viewport1 = gtk_viewport_new (NULL, NULL); + gtk_widget_show (viewport1); + gtk_container_add (GTK_CONTAINER (scrolledwindow1), viewport1); + gtk_viewport_set_shadow_type (GTK_VIEWPORT (viewport1), GTK_SHADOW_NONE); +*/ + + // Creates the table and attach it to the settings dialog + settings_table = gtk_table_new (5, 2, FALSE); + gtk_widget_show (settings_table); + gtk_box_pack_start (GTK_BOX (GTK_DIALOG(settings_dialog)->vbox), settings_table, FALSE, TRUE, 0); + gtk_container_set_border_width (GTK_CONTAINER (settings_table), 3); + gtk_table_set_row_spacings (GTK_TABLE (settings_table), 5); + gtk_table_set_col_spacings (GTK_TABLE (settings_table), 10); + + label_hostname = add_label_to_table (settings_table, "Host Name:", 0, 1, 0, 1); + label_dbname = add_label_to_table (settings_table, "Database Name:", 0, 1, 1, 2); + label_username = add_label_to_table (settings_table, "Username:", 0, 1, 2, 3); + label_passwd = add_label_to_table (settings_table, "Password:", 0, 1, 3, 4); + label_port = add_label_to_table (settings_table, "Server port:", 0, 1, 4, 5); + + entry_hostname = add_entry_to_table (settings_table, + gmyth_settings_get_backend_hostname (msettings), + 1, 2, 0, 1); + entry_dbname = add_entry_to_table (settings_table, + gmyth_settings_get_dbname (msettings), + 1, 2, 1, 2 ); + entry_username = add_entry_to_table (settings_table, + gmyth_settings_get_username (msettings), + 1, 2, 2, 3 ); + entry_passwd = add_entry_to_table (settings_table, + gmyth_settings_get_password (msettings), + 1, 2, 3, 4 ); + + GString *str_port = g_string_new (""); + g_string_printf (str_port, "%d", + gmyth_settings_get_backend_port (msettings)); + entry_port = add_entry_to_table (settings_table, str_port, + 1, 2, 4, 5 ); + g_string_free (str_port, TRUE); + + if (gtk_dialog_run (GTK_DIALOG (settings_dialog)) == GTK_RESPONSE_ACCEPT) { + settings_dialog_update_data (); + gtk_widget_destroy (settings_dialog); + return TRUE; + } + + gtk_widget_destroy (settings_dialog); + + return FALSE; + +} + +static GtkWidget* +add_label_to_table (GtkWidget *table, const gchar *str, guint pos_left, guint pos_right, + guint pos_top, guint pos_bottom ) +{ + GtkWidget *tmp_label = gtk_label_new (str); + + gtk_widget_show (tmp_label); + gtk_table_attach (GTK_TABLE (table), tmp_label, + pos_left, pos_right, pos_top, pos_bottom, + (GtkAttachOptions) (GTK_FILL), + (GtkAttachOptions) (0), 0, 0); + gtk_misc_set_alignment (GTK_MISC (tmp_label), 0, 0.5); + + return tmp_label; +} + +static GtkWidget* +add_entry_to_table (GtkWidget *table, GString *init_str, guint pos_left, guint pos_right, + guint pos_top, guint pos_bottom) +{ + GtkWidget *tmp_entry = gtk_entry_new (); + gtk_widget_show (tmp_entry); + gtk_table_attach (GTK_TABLE (table), tmp_entry, + pos_left, pos_right, pos_top, pos_bottom, + (GtkAttachOptions) (GTK_EXPAND | GTK_FILL), + (GtkAttachOptions) (0), 0, 0); + if (init_str) + gtk_entry_set_text (GTK_ENTRY (tmp_entry), (init_str->str)); + + //gtk_entry_set_invisible_char (GTK_ENTRY (entry_port), 9679); + + return tmp_entry; +} + +static void +settings_dialog_update_data (void) +{ + GString *tmp_entry_text; + GMythSettings *msettings = gmyth_context_get_settings(); + + if (!msettings) { + g_warning ("[%s] Could not get GMythSettings instance from context\n", __FUNCTION__); + return; + } + + tmp_entry_text = g_string_new(""); + g_string_printf(tmp_entry_text, "%s", gtk_entry_get_text( GTK_ENTRY(entry_hostname))); + gmyth_settings_set_backend_hostname(msettings, tmp_entry_text); + + g_string_printf(tmp_entry_text, "%s", gtk_entry_get_text( GTK_ENTRY(entry_dbname))); + gmyth_settings_set_dbname(msettings, tmp_entry_text); + + g_string_printf(tmp_entry_text, "%s", gtk_entry_get_text( GTK_ENTRY(entry_username))); + gmyth_settings_set_username(msettings, tmp_entry_text); + + g_string_printf(tmp_entry_text, "%s", gtk_entry_get_text( GTK_ENTRY(entry_passwd))); + gmyth_settings_set_password(msettings, tmp_entry_text); + + g_string_printf(tmp_entry_text, "%s", gtk_entry_get_text( GTK_ENTRY(entry_port))); + gmyth_settings_set_backend_port(msettings, atoi(tmp_entry_text->str)); + + gmyth_settings_save (msettings); + +} diff -r 7c409a042a9a -r 7174e23f7617 maemo-ui/src/mmyth_uisettings.h --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/maemo-ui/src/mmyth_uisettings.h Thu Sep 28 16:02:14 2006 +0100 @@ -0,0 +1,6 @@ +#ifndef MMYTH_SETTINGS_H_ +#define MMYTH_SETTINGS_H_ + +gboolean mmyth_uisettings_run (GtkWindow *main_window); + +#endif /*MMYTH_SETTINGS_H_*/ diff -r 7c409a042a9a -r 7174e23f7617 maemo-ui/src/mmyth_videoplayer.c --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/maemo-ui/src/mmyth_videoplayer.c Thu Sep 28 16:02:14 2006 +0100 @@ -0,0 +1,369 @@ + +#include +#include +#include +#include +#include + +#include "mmyth_ui.h" +#include "mmyth_videoplayer.h" +#include "mmyth_sdpreader.h" + +#include "esg_database.h" + +#include "ipd_demux.h" +#include "ipd_network.h" + +#ifdef INDT_IP_DECAPSULATOR +#include +#include +#endif + +/* Global flag/semaphore to control IP decapsulator threads */ +gboolean state_keep_running = 0; + + +typedef struct _GstPlayerWindowStateChange +{ + GstElement *play; + GstState old_state, new_state; + MMythUi *mmyth_ui; +} GstPlayerWindowStateChange; + +typedef struct _GstPlayerWindowTagFound +{ + GstElement *play; + GstTagList *taglist; + MMythUi *mmyth_ui; +} GstPlayerWindowTagFound; + + +GstElement *gst_pipeline, *gst_decoder, *gst_videosink; + +static gboolean idle_state (gpointer data); + +static gboolean +bus_call (GstBus * bus, GstMessage * msg, gpointer data) +{ + MMythUi *mmyth_ui = (MMythUi *) data; + GMainLoop *loop = mmyth_ui->loop; + + switch (GST_MESSAGE_TYPE (msg)) { + case GST_MESSAGE_EOS: + + if (mmyth_ui->idle_id != 0) { + g_source_remove (mmyth_ui->idle_id); + mmyth_ui->idle_id = 0; + } + + //g_idle_add ((GSourceFunc) idle_eos, data); + gst_element_set_state (GST_ELEMENT (GST_MESSAGE_SRC (msg)), + GST_STATE_READY); + break; + case GST_MESSAGE_ERROR:{ + gchar *debug; + GError *err; + + gst_message_parse_error (msg, &err, &debug); + g_free (debug); + + printf ("Error: %s\n", err->message); + g_error_free (err); + + g_main_loop_quit (loop); + } + break; + case GST_MESSAGE_STATE_CHANGED:{ + GstState oldstate; + GstState newstate; + GstState pending; + GstPlayerWindowStateChange *st = + g_new (GstPlayerWindowStateChange, 1); + + gst_message_parse_state_changed (msg, + &oldstate, + &newstate, &pending); + + st->play = mmyth_ui->play; + gst_object_ref (GST_OBJECT (mmyth_ui->play)); + st->old_state = oldstate; + st->new_state = newstate; + + st->mmyth_ui = mmyth_ui; + + /* State debug messages */ + printf ("oldstate = %s, newstate = %s, pendingstate = %s\n", + gst_element_state_get_name (oldstate), + gst_element_state_get_name (newstate), + gst_element_state_get_name (pending)); + + g_idle_add ((GSourceFunc) idle_state, st); + + } + break; + default: + printf (gst_message_type_get_name (GST_MESSAGE_TYPE (msg))); + printf ("\n"); + break; + } + + return TRUE; +} + + +static gboolean +cb_iterate (gpointer data) +{ + MMythUi *mmyth_ui = (MMythUi *) data; + //gboolean res; + + g_main_loop_run (mmyth_ui->loop); +/* + if (!GST_FLAG_IS_SET (mmyth_ui->play, GST_BIN_SELF_SCHEDULABLE)) { + res = gst_bin_iterate (GST_BIN (mmyth_ui->play)); + } else { + g_usleep (100); + res = (gst_element_get_state (mmyth_ui->play) == GST_STATE_PLAYING); + } + + if (!res) + mmyth_ui->idle_id = 0; + + return res; +*/ + return FALSE; + +} + +static gboolean +idle_state (gpointer data) +{ + GstPlayerWindowStateChange *st = data; + + if (st->old_state == GST_STATE_PLAYING) { + if (st->mmyth_ui->idle_id != 0) { + g_source_remove (st->mmyth_ui->idle_id); + st->mmyth_ui->idle_id = 0; + } + } + else if (st->new_state == GST_STATE_PLAYING) { + if (st->mmyth_ui->idle_id != 0) + g_source_remove (st->mmyth_ui->idle_id); + + st->mmyth_ui->idle_id = g_idle_add (cb_iterate, st->mmyth_ui); + } + + /* new movie loaded? */ + if (st->old_state == GST_STATE_READY && st->new_state > GST_STATE_READY) { + + /* gboolean have_video = FALSE; */ + + gtk_widget_show (st->mmyth_ui->videow); + + gtk_window_resize (GTK_WINDOW (st->mmyth_ui->main_window), 1, 1); + + } + + /* discarded movie? */ + if (st->old_state > GST_STATE_READY && st->new_state == GST_STATE_READY) { + + if (st->mmyth_ui->tagcache) { + gst_tag_list_free (st->mmyth_ui->tagcache); + st->mmyth_ui->tagcache = NULL; + } + } + + gst_object_unref (GST_OBJECT (st->play)); + //g_object_unref (G_OBJECT (st->win)); + g_free (st); + + /* once */ + return FALSE; +} + + + +static gboolean +expose (GtkWidget * widget, GdkEventExpose * event, gpointer user_data) +{ + MMythUi *mmyth_ui = (MMythUi *) user_data; + + gst_x_overlay_set_xwindow_id (GST_X_OVERLAY (mmyth_ui->videosink), + GDK_WINDOW_XWINDOW (mmyth_ui->videow-> + window)); + return TRUE; +} + + +void +mmyth_player_init (MMythUi * mmyth_ui) +{ + GstElement *play; + GstElement *source, *parser, *decoder, *videosink; + + play = gst_pipeline_new ("video-player"); + source = gst_element_factory_make ("udpsrc", "file-source"); + parser = gst_element_factory_make ("rtph263pdepay", "rtp-demux"); + decoder = gst_element_factory_make ("ffdec_h263", "mpeg-decoder"); + videosink = gst_element_factory_make ("xvimagesink", "image-output"); + gst_pipeline = play; + gst_decoder = decoder; + gst_videosink = videosink; + + if (!(gst_pipeline && source && parser && decoder && videosink)) { + /* FIXME: hanlde the error correctly */ + /* video_alignment is not being created (below) + and is causing problems to the ui */ + g_print ("GstElement creation error!\n"); + return; + } + + g_object_set (G_OBJECT (videosink), "sync", FALSE, NULL); + + gst_bus_add_watch (gst_pipeline_get_bus (GST_PIPELINE (gst_pipeline)), + bus_call, mmyth_ui); + + gst_bin_add_many (GST_BIN (gst_pipeline), source, parser, decoder, + videosink, NULL); + + { + GstCaps *rtpcaps = gst_caps_new_simple ("application/x-rtp", NULL); + gst_element_link_filtered(source, parser, rtpcaps); + } + + gst_element_link_many (/*source,*/ parser, decoder, videosink, NULL); + + /* actual window */ + mmyth_ui->play = play; + mmyth_ui->videosink = videosink; + mmyth_ui->udpsource = source; + + g_object_ref (mmyth_ui->play); + g_object_ref (mmyth_ui->videosink); + + /* video widget */ + //mmyth_ui->videow = gst_player_video_new (videosink, play); + mmyth_ui->videow = gtk_drawing_area_new (); + gtk_widget_set_size_request (mmyth_ui->videow, 300, 240); + + mmyth_ui->logo = gdk_pixbuf_new_from_file ("logo.png", NULL); + + + mmyth_ui->video_alignment = gtk_alignment_new (0.5, 0.5, 0, 0); + gtk_widget_hide (mmyth_ui->video_alignment); + + gtk_container_add (GTK_CONTAINER (mmyth_ui->video_alignment), + mmyth_ui->videow); + + g_signal_connect (mmyth_ui->videow, "expose-event", G_CALLBACK (expose), + mmyth_ui); + //g_signal_connect(mmyth_ui->videow, "size_request", G_CALLBACK(cb_preferred_video_size), mmyth_ui); + + + g_object_ref (mmyth_ui->videow); + g_object_ref (mmyth_ui->video_alignment); + + //gnome_app_set_contents (app, videow); + //gtk_widget_show (mmyth_ui->videow); + +//fail: +// gst_object_unref (GST_OBJECT (play)); +// return NULL; + +} + +void +mmyth_player_stop (MMythUi * mmyth_ui) +{ + gst_element_set_state (mmyth_ui->play, GST_STATE_NULL); + + if(mmyth_ui->videow != NULL) + gtk_widget_hide (mmyth_ui->videow); + + /* Disable IP Decapsulator playing threads */ + state_keep_running = FALSE; + +} + +static gboolean +idle_play (gpointer data) +{ + MMythUi *mmyth_ui = (MMythUi *) data; + + sleep (2); + + gst_element_set_state (mmyth_ui->play, GST_STATE_PLAYING); + + return FALSE; +} + + +/* Run IP decapsulator play function in a new thread. The thread is finished setting the + * semaphore "state_keep_running" to FALSE*/ +gpointer +run_ipd(gpointer data) +{ + GString *ip_addr = (GString*) data; + + state_keep_running = TRUE; + + printf("Inside thread\n"); + + ipd_mpe_play_section (ip_addr->str, &state_keep_running); + + return 0; +} + +void +mmyth_play_channel (MMythUi * mmyth_ui, gint service_number) +{ + ESGDatabase *esg_db; + DVBHService *service; + SDPData sdp_data; + GString *service_ip_addr; + + /* First verifies if there is a tuned network */ + if ( !ipd_network_is_tuned() ) { + /* FIXME: show alert and handle this error */ + g_warning ("Play not possible, network not tuned"); + return; + } + + esg_db = esg_database_get_instance(); + /* Gets the service structure */ + service = (DVBHService *) esg_database_get_service_from_number + (esg_db, service_number); + + /* Verifies if sdp fragment exists to this service */ + if ( service->sdp_file == NULL ) { + /* FIXME: Implement error handling */ + g_warning ("SDP fragment not available to access service"); + return; + } + + /* Parses the sdp to get ipv6 address and port */ + mmyth_sdp_parse_file (service->sdp_file->str, &sdp_data); + + /* Sets the gstreamer properties acording to the service access address */ + /* FIXME: Develop sdp_bin in gstreamer to give sdp file as pipeline config */ + g_object_set (G_OBJECT (mmyth_ui->udpsource), "multicast_group", + sdp_data.ip_addr->str, NULL); + g_object_set (G_OBJECT (mmyth_ui->udpsource), "port", sdp_data.video_port, NULL); + + /* Shows the video widget on screen */ + mmyth_ui_set_widget (mmyth_ui, mmyth_ui->video_uicommon); + + gtk_widget_show (mmyth_ui->videow); + gtk_widget_queue_draw (mmyth_ui->videow); + +#ifdef INDT_IP_DECAPSULATOR + /* Will be dealocated in run_ipd */ + service_ip_addr = g_string_new (sdp_data.ip_addr->str); + + /* Requests the IP decapsulator to play the channel stream*/ + g_thread_create (run_ipd, (gpointer) service_ip_addr, FALSE, NULL); +#endif + + //gst_element_set_state (mmyth_ui->play, GST_STATE_PLAYING); + g_idle_add (idle_play, mmyth_ui); +} diff -r 7c409a042a9a -r 7174e23f7617 maemo-ui/src/mmyth_videoplayer.h --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/maemo-ui/src/mmyth_videoplayer.h Thu Sep 28 16:02:14 2006 +0100 @@ -0,0 +1,12 @@ +#ifndef MMYTH_VIDEOPLAYER_H_ +#define MMYTH_VIDEOPLAYER_H_ + +#include "mmyth_ui.h" + +void mmyth_player_init (MMythUi * mmyth_ui); +void mmyth_player_stop (MMythUi * mmyth_ui); + +void mmyth_play_channel (MMythUi * mmyth_ui, gint service_id); + + +#endif /* MMYTH_VIDEOPLAYER_H_ */ diff -r 7c409a042a9a -r 7174e23f7617 maemo-ui/src/svn-commit.tmp --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/maemo-ui/src/svn-commit.tmp Thu Sep 28 16:02:14 2006 +0100 @@ -0,0 +1,10 @@ + +--This line, and those below, will be ignored-- + +A . +M mmyth_ui.h +A mmyth_main.c +A mmyth_tvplayer.c +M Makefile.am +A mmyth_tvplayer.h +M mmyth_ui.c