r3294 - in trunk/src/target/OM-2007.2/applications/openmoko-mediaplayer2: . src

abraxa at sita.openmoko.org abraxa at sita.openmoko.org
Sun Oct 28 21:29:34 CET 2007


Author: abraxa
Date: 2007-10-28 21:29:29 +0100 (Sun, 28 Oct 2007)
New Revision: 3294

Modified:
   trunk/src/target/OM-2007.2/applications/openmoko-mediaplayer2/TODO
   trunk/src/target/OM-2007.2/applications/openmoko-mediaplayer2/openmoko-mediaplayer.desktop
   trunk/src/target/OM-2007.2/applications/openmoko-mediaplayer2/src/editor_page.c
   trunk/src/target/OM-2007.2/applications/openmoko-mediaplayer2/src/editor_page.h
   trunk/src/target/OM-2007.2/applications/openmoko-mediaplayer2/src/files_page.c
   trunk/src/target/OM-2007.2/applications/openmoko-mediaplayer2/src/files_page.h
   trunk/src/target/OM-2007.2/applications/openmoko-mediaplayer2/src/guitools.c
   trunk/src/target/OM-2007.2/applications/openmoko-mediaplayer2/src/guitools.h
   trunk/src/target/OM-2007.2/applications/openmoko-mediaplayer2/src/main.c
   trunk/src/target/OM-2007.2/applications/openmoko-mediaplayer2/src/main.h
   trunk/src/target/OM-2007.2/applications/openmoko-mediaplayer2/src/main_page.c
   trunk/src/target/OM-2007.2/applications/openmoko-mediaplayer2/src/main_page.h
   trunk/src/target/OM-2007.2/applications/openmoko-mediaplayer2/src/persistent.c
   trunk/src/target/OM-2007.2/applications/openmoko-mediaplayer2/src/persistent.h
   trunk/src/target/OM-2007.2/applications/openmoko-mediaplayer2/src/playback.c
   trunk/src/target/OM-2007.2/applications/openmoko-mediaplayer2/src/playback.h
   trunk/src/target/OM-2007.2/applications/openmoko-mediaplayer2/src/playlist.c
   trunk/src/target/OM-2007.2/applications/openmoko-mediaplayer2/src/playlist.h
   trunk/src/target/OM-2007.2/applications/openmoko-mediaplayer2/src/playlist_page.c
   trunk/src/target/OM-2007.2/applications/openmoko-mediaplayer2/src/playlist_page.h
Log:
Load playlist after creation and go to track page
Make startup fade-in smoother
Other minor changes and cleanups



Modified: trunk/src/target/OM-2007.2/applications/openmoko-mediaplayer2/TODO
===================================================================
--- trunk/src/target/OM-2007.2/applications/openmoko-mediaplayer2/TODO	2007-10-27 11:42:07 UTC (rev 3293)
+++ trunk/src/target/OM-2007.2/applications/openmoko-mediaplayer2/TODO	2007-10-28 20:29:29 UTC (rev 3294)
@@ -8,7 +8,6 @@
 	Preferences page
 	
 Backend:
-	Use GConf
 	Use GST_MESSAGE_DURATION and use saved value
 	Use GST_MESSAGE_BUFFERING
 	Check for unicode compliance

Modified: trunk/src/target/OM-2007.2/applications/openmoko-mediaplayer2/openmoko-mediaplayer.desktop
===================================================================
--- trunk/src/target/OM-2007.2/applications/openmoko-mediaplayer2/openmoko-mediaplayer.desktop	2007-10-27 11:42:07 UTC (rev 3293)
+++ trunk/src/target/OM-2007.2/applications/openmoko-mediaplayer2/openmoko-mediaplayer.desktop	2007-10-28 20:29:29 UTC (rev 3294)
@@ -1,6 +1,6 @@
 [Desktop Entry]
 Name=Media Player
-Comment=Play media
+Comment=Enjoy music and movies
 Exec=openmoko-mediaplayer
 Icon=openmoko-mediaplayer
 MimeType=audio/x-scpls;audio/mp3;audio/x-mp3;audio/mpeg;audio/x-mpeg;audio/x-wav;application/x-ogg;

Modified: trunk/src/target/OM-2007.2/applications/openmoko-mediaplayer2/src/editor_page.c
===================================================================
--- trunk/src/target/OM-2007.2/applications/openmoko-mediaplayer2/src/editor_page.c	2007-10-27 11:42:07 UTC (rev 3293)
+++ trunk/src/target/OM-2007.2/applications/openmoko-mediaplayer2/src/editor_page.c	2007-10-28 20:29:29 UTC (rev 3294)
@@ -2,7 +2,7 @@
  *  OpenMoko Media Player
  *   http://openmoko.org/
  *
- *  Copyright (C) 2007 by the OpenMoko team
+ *  Copyright (C) 2007 by Soeren Apel (abraxa at dar-clan.de)
  *
  *  This program is free software; you can redistribute it and/or modify
  *  it under the terms of the GNU General Public License as published by

Modified: trunk/src/target/OM-2007.2/applications/openmoko-mediaplayer2/src/editor_page.h
===================================================================
--- trunk/src/target/OM-2007.2/applications/openmoko-mediaplayer2/src/editor_page.h	2007-10-27 11:42:07 UTC (rev 3293)
+++ trunk/src/target/OM-2007.2/applications/openmoko-mediaplayer2/src/editor_page.h	2007-10-28 20:29:29 UTC (rev 3294)
@@ -2,7 +2,7 @@
  *  OpenMoko Media Player
  *   http://openmoko.org/
  *
- *  Copyright (C) 2007 by the OpenMoko team
+ *  Copyright (C) 2007 by Soeren Apel (abraxa at dar-clan.de)
  *
  *  This program is free software; you can redistribute it and/or modify
  *  it under the terms of the GNU General Public License as published by

Modified: trunk/src/target/OM-2007.2/applications/openmoko-mediaplayer2/src/files_page.c
===================================================================
--- trunk/src/target/OM-2007.2/applications/openmoko-mediaplayer2/src/files_page.c	2007-10-27 11:42:07 UTC (rev 3293)
+++ trunk/src/target/OM-2007.2/applications/openmoko-mediaplayer2/src/files_page.c	2007-10-28 20:29:29 UTC (rev 3294)
@@ -2,7 +2,7 @@
  *  OpenMoko Media Player
  *   http://openmoko.org/
  *
- *  Copyright (C) 2007 by the OpenMoko team
+ *  Copyright (C) 2007 by Soeren Apel (abraxa at dar-clan.de)
  *
  *  This program is free software; you can redistribute it and/or modify
  *  it under the terms of the GNU General Public License as published by

Modified: trunk/src/target/OM-2007.2/applications/openmoko-mediaplayer2/src/files_page.h
===================================================================
--- trunk/src/target/OM-2007.2/applications/openmoko-mediaplayer2/src/files_page.h	2007-10-27 11:42:07 UTC (rev 3293)
+++ trunk/src/target/OM-2007.2/applications/openmoko-mediaplayer2/src/files_page.h	2007-10-28 20:29:29 UTC (rev 3294)
@@ -2,7 +2,7 @@
  *  OpenMoko Media Player
  *   http://openmoko.org/
  *
- *  Copyright (C) 2007 by the OpenMoko team
+ *  Copyright (C) 2007 by Soeren Apel (abraxa at dar-clan.de)
  *
  *  This program is free software; you can redistribute it and/or modify
  *  it under the terms of the GNU General Public License as published by

Modified: trunk/src/target/OM-2007.2/applications/openmoko-mediaplayer2/src/guitools.c
===================================================================
--- trunk/src/target/OM-2007.2/applications/openmoko-mediaplayer2/src/guitools.c	2007-10-27 11:42:07 UTC (rev 3293)
+++ trunk/src/target/OM-2007.2/applications/openmoko-mediaplayer2/src/guitools.c	2007-10-28 20:29:29 UTC (rev 3294)
@@ -2,7 +2,7 @@
  *  OpenMoko Media Player
  *   http://openmoko.org/
  *
- *  Copyright (C) 2007 by the OpenMoko team
+ *  Copyright (C) 2007 by Soeren Apel (abraxa at dar-clan.de)
  *
  *  This program is free software; you can redistribute it and/or modify
  *  it under the terms of the GNU General Public License as published by

Modified: trunk/src/target/OM-2007.2/applications/openmoko-mediaplayer2/src/guitools.h
===================================================================
--- trunk/src/target/OM-2007.2/applications/openmoko-mediaplayer2/src/guitools.h	2007-10-27 11:42:07 UTC (rev 3293)
+++ trunk/src/target/OM-2007.2/applications/openmoko-mediaplayer2/src/guitools.h	2007-10-28 20:29:29 UTC (rev 3294)
@@ -2,7 +2,7 @@
  *  OpenMoko Media Player
  *   http://openmoko.org/
  *
- *  Copyright (C) 2007 by the OpenMoko team
+ *  Copyright (C) 2007 by Soeren Apel (abraxa at dar-clan.de)
  *
  *  This program is free software; you can redistribute it and/or modify
  *  it under the terms of the GNU General Public License as published by

Modified: trunk/src/target/OM-2007.2/applications/openmoko-mediaplayer2/src/main.c
===================================================================
--- trunk/src/target/OM-2007.2/applications/openmoko-mediaplayer2/src/main.c	2007-10-27 11:42:07 UTC (rev 3293)
+++ trunk/src/target/OM-2007.2/applications/openmoko-mediaplayer2/src/main.c	2007-10-28 20:29:29 UTC (rev 3294)
@@ -2,7 +2,7 @@
  *  OpenMoko Media Player
  *   http://openmoko.org/
  *
- *  Copyright (C) 2007 by the OpenMoko team
+ *  Copyright (C) 2007 by Soeren Apel (abraxa at dar-clan.de)
  *
  *  This program is free software; you can redistribute it and/or modify
  *  it under the terms of the GNU General Public License as published by
@@ -322,11 +322,11 @@
  * @see omp_notebook_tabs
  */
 void
-omp_tab_show(guint tab_id)
+omp_tab_show(omp_notebook_tab tab)
 {
-	g_return_if_fail(tab_id < OMP_TABS);
+	g_return_if_fail(tab < OMP_TABS);
 
-	gtk_widget_show(GTK_WIDGET(omp_notebook_tabs[tab_id]));
+	gtk_widget_show(GTK_WIDGET(omp_notebook_tabs[tab]));
 }
 
 /**
@@ -335,22 +335,22 @@
  * @see omp_notebook_tabs
  */
 void
-omp_tab_hide(guint tab_id)
+omp_tab_hide(omp_notebook_tab tab)
 {
-	g_return_if_fail(tab_id < OMP_TABS);
+	g_return_if_fail(tab < OMP_TABS);
 
-	gtk_widget_hide(GTK_WIDGET(omp_notebook_tabs[tab_id]));
+	gtk_widget_hide(GTK_WIDGET(omp_notebook_tabs[tab]));
 }
 
 /**
  *
  */
 void
-omp_tab_focus(guint tab_id)
+omp_tab_focus(omp_notebook_tab tab)
 {
-	g_return_if_fail(tab_id < OMP_TABS);
+	g_return_if_fail(tab < OMP_TABS);
 
-	gtk_notebook_set_current_page(GTK_NOTEBOOK(omp_notebook), tab_id);
+	gtk_notebook_set_current_page(GTK_NOTEBOOK(omp_notebook), tab);
 }
 
 /**

Modified: trunk/src/target/OM-2007.2/applications/openmoko-mediaplayer2/src/main.h
===================================================================
--- trunk/src/target/OM-2007.2/applications/openmoko-mediaplayer2/src/main.h	2007-10-27 11:42:07 UTC (rev 3293)
+++ trunk/src/target/OM-2007.2/applications/openmoko-mediaplayer2/src/main.h	2007-10-28 20:29:29 UTC (rev 3294)
@@ -2,7 +2,7 @@
  *  OpenMoko Media Player
  *   http://openmoko.org/
  *
- *  Copyright (C) 2007 by the OpenMoko team
+ *  Copyright (C) 2007 by Soeren Apel (abraxa at dar-clan.de)
  *
  *  This program is free software; you can redistribute it and/or modify
  *  it under the terms of the GNU General Public License as published by
@@ -29,22 +29,22 @@
 
 #include <gtk/gtk.h>
 
-enum omp_notebook_tabs
+typedef enum
 {
 	OMP_TAB_MAIN = 0,
 	OMP_TAB_PLAYLISTS,
 	OMP_TAB_PLAYLIST_EDITOR,
 	OMP_TAB_FILE_CHOOSER,
 	OMP_TABS
-};
+} omp_notebook_tab;
 
 extern GtkWidget *omp_notebook;
 extern GtkWidget *omp_window;
 
 void omp_application_terminate();
 
-void omp_tab_show(guint tab_id);
-void omp_tab_hide(guint tab_id);
-void omp_tab_focus(guint tab_id);
+void omp_tab_show(omp_notebook_tab tab);
+void omp_tab_hide(omp_notebook_tab tab);
+void omp_tab_focus(omp_notebook_tab tab);
 
 #endif

Modified: trunk/src/target/OM-2007.2/applications/openmoko-mediaplayer2/src/main_page.c
===================================================================
--- trunk/src/target/OM-2007.2/applications/openmoko-mediaplayer2/src/main_page.c	2007-10-27 11:42:07 UTC (rev 3293)
+++ trunk/src/target/OM-2007.2/applications/openmoko-mediaplayer2/src/main_page.c	2007-10-28 20:29:29 UTC (rev 3294)
@@ -2,7 +2,7 @@
  *  OpenMoko Media Player
  *   http://openmoko.org/
  *
- *  Copyright (C) 2007 by the OpenMoko team
+ *  Copyright (C) 2007 by Soeren Apel (abraxa at dar-clan.de)
  *
  *  This program is free software; you can redistribute it and/or modify
  *  it under the terms of the GNU General Public License as published by

Modified: trunk/src/target/OM-2007.2/applications/openmoko-mediaplayer2/src/main_page.h
===================================================================
--- trunk/src/target/OM-2007.2/applications/openmoko-mediaplayer2/src/main_page.h	2007-10-27 11:42:07 UTC (rev 3293)
+++ trunk/src/target/OM-2007.2/applications/openmoko-mediaplayer2/src/main_page.h	2007-10-28 20:29:29 UTC (rev 3294)
@@ -2,7 +2,7 @@
  *  OpenMoko Media Player
  *   http://openmoko.org/
  *
- *  Copyright (C) 2007 by the OpenMoko team
+ *  Copyright (C) 2007 by Soeren Apel (abraxa at dar-clan.de)
  *
  *  This program is free software; you can redistribute it and/or modify
  *  it under the terms of the GNU General Public License as published by

Modified: trunk/src/target/OM-2007.2/applications/openmoko-mediaplayer2/src/persistent.c
===================================================================
--- trunk/src/target/OM-2007.2/applications/openmoko-mediaplayer2/src/persistent.c	2007-10-27 11:42:07 UTC (rev 3293)
+++ trunk/src/target/OM-2007.2/applications/openmoko-mediaplayer2/src/persistent.c	2007-10-28 20:29:29 UTC (rev 3294)
@@ -2,7 +2,7 @@
  *  OpenMoko Media Player
  *   http://openmoko.org/
  *
- *  Copyright (C) 2007 by the OpenMoko team
+ *  Copyright (C) 2007 by Soeren Apel (abraxa at dar-clan.de)
  *
  *  This program is free software; you can redistribute it and/or modify
  *  it under the terms of the GNU General Public License as published by

Modified: trunk/src/target/OM-2007.2/applications/openmoko-mediaplayer2/src/persistent.h
===================================================================
--- trunk/src/target/OM-2007.2/applications/openmoko-mediaplayer2/src/persistent.h	2007-10-27 11:42:07 UTC (rev 3293)
+++ trunk/src/target/OM-2007.2/applications/openmoko-mediaplayer2/src/persistent.h	2007-10-28 20:29:29 UTC (rev 3294)
@@ -2,7 +2,7 @@
  *  OpenMoko Media Player
  *   http://openmoko.org/
  *
- *  Copyright (C) 2007 by the OpenMoko team
+ *  Copyright (C) 2007 by Soeren Apel (abraxa at dar-clan.de)
  *
  *  This program is free software; you can redistribute it and/or modify
  *  it under the terms of the GNU General Public License as published by

Modified: trunk/src/target/OM-2007.2/applications/openmoko-mediaplayer2/src/playback.c
===================================================================
--- trunk/src/target/OM-2007.2/applications/openmoko-mediaplayer2/src/playback.c	2007-10-27 11:42:07 UTC (rev 3293)
+++ trunk/src/target/OM-2007.2/applications/openmoko-mediaplayer2/src/playback.c	2007-10-28 20:29:29 UTC (rev 3294)
@@ -2,7 +2,7 @@
  *  OpenMoko Media Player
  *   http://openmoko.org/
  *
- *  Copyright (C) 2007 by the OpenMoko team
+ *  Copyright (C) 2007 by Soeren Apel (abraxa at dar-clan.de)
  *
  *  This program is free software; you can redistribute it and/or modify
  *  it under the terms of the GNU General Public License as published by
@@ -29,11 +29,11 @@
 #include <gst/interfaces/xoverlay.h>
 #include <uriparser/Uri.h>
 
-#include "playback.h"
 #include "guitools.h"
 #include "main.h"
 #include "main_page.h"
 #include "persistent.h"
+#include "playback.h"
 
 /// Our ticket to the gstreamer world
 GstElement *omp_gst_playbin = NULL;
@@ -57,6 +57,9 @@
 /// Holds the volume increment per UI-update timer call
 guint omp_playback_fade_increment = 0;
 
+/// Handle of the fade-in timeout
+guint omp_playback_fade_timeout = 0;
+
 // Some private forward declarations
 static gboolean omp_gst_message_eos(GstBus *bus, GstMessage *message, gpointer data);
 static gboolean omp_gst_message_state_changed(GstBus *bus, GstMessage *message, gpointer data);
@@ -159,10 +162,7 @@
 {
 	GstBus *bus;
 
-	if (!omp_gst_playbin)
-	{
-		return;
-	}
+	if (!omp_gst_playbin) return;
 
 	bus = gst_pipeline_get_bus(GST_PIPELINE(omp_gst_playbin));
 	gst_bus_remove_signal_watch(bus);
@@ -203,9 +203,7 @@
 {
 	// Make sure we are all set
 	if (!omp_gst_playbin)
-	{
 		omp_playback_init();
-	}
 
 	#ifdef DEBUG
 		g_printf("Loading track: %s\n", uri);
@@ -225,24 +223,6 @@
 static gboolean
 omp_playback_ui_timeout_callback(gpointer data)
 {
-	guint volume;
-
-	// Fade in if needed
-	if (omp_playback_fade_final_vol != -1)
-	{
-		volume = omp_playback_get_volume()+omp_playback_fade_increment;
-
-		if (volume > omp_playback_fade_final_vol)
-		{
-			omp_playback_set_volume(omp_playback_fade_final_vol);
-			omp_playback_fade_final_vol = -1;
-
-		} else {
-
-			omp_playback_set_volume(volume);
-		}
-	}
-
 	g_signal_emit_by_name(G_OBJECT(omp_window), OMP_EVENT_PLAYBACK_POSITION_CHANGED);
 	
 	if (omp_playback_ui_timeout_halted)
@@ -256,6 +236,31 @@
 }
 
 /**
+ * This callback raises the volume little by little when we're fading in
+ */
+static gboolean
+omp_playback_fade_timeout_callback(gpointer data)
+{
+	guint volume;
+
+	// Fade in
+	volume = omp_playback_get_volume()+omp_playback_fade_increment;
+
+	if (volume >= omp_playback_fade_final_vol)
+	{
+		omp_playback_set_volume(omp_playback_fade_final_vol);
+		omp_playback_fade_final_vol = -1;
+		omp_playback_fade_timeout = 0;
+		return FALSE;
+
+	} else {
+
+		omp_playback_set_volume(volume);
+		return TRUE;
+	}
+}
+
+/**
  * Starts playback of the current stream
  */
 void
@@ -284,9 +289,11 @@
 	omp_playback_ui_timeout_halted = FALSE;
 
 	if (!omp_playback_ui_timeout)
-	{
 		omp_playback_ui_timeout = g_timeout_add(PLAYBACK_UI_UPDATE_INTERVAL, omp_playback_ui_timeout_callback, NULL);
-	}
+
+	// Do we need to add the fade-in timer as well?
+	if ( (omp_playback_fade_final_vol != -1) && (!omp_playback_fade_timeout) )
+		omp_playback_fade_timeout = g_timeout_add(PLAYBACK_FADE_INTERVAL, omp_playback_fade_timeout_callback, NULL);
 }
 
 /**
@@ -399,10 +406,7 @@
 	GstFormat format = GST_FORMAT_TIME;
 	gint64 length = 0;
 
-	if (!omp_gst_playbin)
-	{
-		return 0;
-	}
+	if (!omp_gst_playbin) return 0;
 
 	gst_element_query_duration(omp_gst_playbin, &format, &length);
 	return (length > 0) ? (length/1000000) : 0;
@@ -413,19 +417,14 @@
  * @param volume Volume in percent (0..100)
  */
 void
-omp_playback_set_volume(guint volume)
+omp_playback_set_volume(guint volume, gboolean update_session)
 {
-	// Sanity check and failure recovery
-	if (volume > 100)
-	{
-		g_warning("Attempted to set invalid volume!\n");
-		volume = 100;
-	}
+	if (volume > 100) volume = 100;
 
 	// Set playbin volume which ranges from 0.0 to 1.0
 	g_object_set(G_OBJECT(omp_gst_playbin), "volume", volume/100.0, NULL);
 
-	// Volume fading shouldn't be visible to the user
+	// Volume fading shouldn't be saved to session and be invisible to the user
 	if (omp_playback_fade_final_vol == -1)
 	{
 		omp_session_set_volume(volume);
@@ -457,8 +456,9 @@
 	omp_playback_set_volume(0);
 
 	omp_playback_fade_increment =
-		omp_playback_fade_final_vol / (omp_session_get_fade_speed()/PLAYBACK_UI_UPDATE_INTERVAL);
+		omp_playback_fade_final_vol / (omp_session_get_fade_speed()/PLAYBACK_FADE_INTERVAL);
 
+	// Make sure the volume actually increases
 	if (omp_playback_fade_increment == 0)
 		omp_playback_fade_increment = 1;
 }

Modified: trunk/src/target/OM-2007.2/applications/openmoko-mediaplayer2/src/playback.h
===================================================================
--- trunk/src/target/OM-2007.2/applications/openmoko-mediaplayer2/src/playback.h	2007-10-27 11:42:07 UTC (rev 3293)
+++ trunk/src/target/OM-2007.2/applications/openmoko-mediaplayer2/src/playback.h	2007-10-28 20:29:29 UTC (rev 3294)
@@ -2,7 +2,7 @@
  *  OpenMoko Media Player
  *   http://openmoko.org/
  *
- *  Copyright (C) 2007 by the OpenMoko team
+ *  Copyright (C) 2007 by Soeren Apel (abraxa at dar-clan.de)
  *
  *  This program is free software; you can redistribute it and/or modify
  *  it under the terms of the GNU General Public License as published by
@@ -44,8 +44,11 @@
 // The UI will be updated at this interval when a track is playing (in ms)
 #define PLAYBACK_UI_UPDATE_INTERVAL 1000
 
+// Time interval at which the fade-in timer will raise the volume (in ms)
+#define PLAYBACK_FADE_INTERVAL 200
 
 
+
 gboolean omp_playback_init();
 void omp_playback_free();
 void omp_playback_save_state();

Modified: trunk/src/target/OM-2007.2/applications/openmoko-mediaplayer2/src/playlist.c
===================================================================
--- trunk/src/target/OM-2007.2/applications/openmoko-mediaplayer2/src/playlist.c	2007-10-27 11:42:07 UTC (rev 3293)
+++ trunk/src/target/OM-2007.2/applications/openmoko-mediaplayer2/src/playlist.c	2007-10-28 20:29:29 UTC (rev 3294)
@@ -2,7 +2,7 @@
  *  OpenMoko Media Player
  *   http://openmoko.org/
  *
- *  Copyright (C) 2007 by the OpenMoko team
+ *  Copyright (C) 2007 by Soeren Apel (abraxa at dar-clan.de)
  *
  *  This program is free software; you can redistribute it and/or modify
  *  it under the terms of the GNU General Public License as published by
@@ -69,9 +69,6 @@
 	guint track_id;
 } omp_track_history_entry;
 
-/// Flag that indicates whether the current track has already been repeated once or not
-gboolean omp_playlist_track_repeated_once = FALSE;
-
 // Forward declarations for internal use
 void omp_playlist_process_eos_event(gpointer instance, gpointer user_data);
 void omp_playlist_process_tag_artist_change(gpointer instance, gchar *artist, gpointer user_data);
@@ -180,8 +177,8 @@
 		{
 			// Reset playlist state and prepare playback
 			omp_playback_reset();
-			omp_playlist_current_track_id	= 0;
-			omp_playlist_current_track		= omp_playlist->tracks;
+			omp_playlist_current_track_id = 0;
+			omp_playlist_current_track    = omp_playlist->tracks;
 			omp_playlist_last_track = NULL;
 
 			if (omp_playlist_current_track)
@@ -199,8 +196,8 @@
 
 	} else {
 
-		omp_playlist_current_track_id	= -1;
-		omp_playlist_current_track		= NULL;
+		omp_playlist_current_track_id = -1;
+		omp_playlist_current_track    = NULL;
 		omp_playlist_last_track = NULL;
 
 		#ifdef DEBUG
@@ -295,8 +292,8 @@
 	{
 		if (track_num == playlist_pos)
 		{
-			omp_playlist_current_track		= track;
-			omp_playlist_current_track_id	= track_num;
+			omp_playlist_current_track    = track;
+			omp_playlist_current_track_id = track_num;
 			position_valid = TRUE;
 		}
 	}
@@ -363,8 +360,8 @@
 	if (omp_track_history)
 	{
 		history_entry = (omp_track_history_entry*)(omp_track_history->data);
-		omp_playlist_current_track		= history_entry->track;
-		omp_playlist_current_track_id	= history_entry->track_id;
+		omp_playlist_current_track    = history_entry->track;
+		omp_playlist_current_track_id = history_entry->track_id;
 		
 		// Delete first entry from the list
 		g_free(history_entry);
@@ -462,8 +459,8 @@
 
 	// Prepare the history entry - if we don't need it we'll just free it again
 	history_entry = g_new(omp_track_history_entry, 1);
-	history_entry->track		= omp_playlist_current_track;
-	history_entry->track_id	= omp_playlist_current_track_id;
+	history_entry->track    = omp_playlist_current_track;
+	history_entry->track_id = omp_playlist_current_track_id;
 
 	// Repeat all: we forward 1 track
 	// Shuffle on: we forward 0 < n < omp_playlist_track_count tracks
@@ -873,21 +870,17 @@
 	if (track_artist)
 	{
 		if (iter->track)
-		{
 			*track_artist = g_strdup(iter->track->creator);
-		} else {
+		else
 			*track_artist = NULL;
-		}
 	}
 
 	if (track_title)
 	{
 		if (iter->track)
-		{
 			*track_title = g_strdup(iter->track->title);
-		} else {
+		else
 			*track_title = NULL;
-		}
 	}
 
 	if (duration)

Modified: trunk/src/target/OM-2007.2/applications/openmoko-mediaplayer2/src/playlist.h
===================================================================
--- trunk/src/target/OM-2007.2/applications/openmoko-mediaplayer2/src/playlist.h	2007-10-27 11:42:07 UTC (rev 3293)
+++ trunk/src/target/OM-2007.2/applications/openmoko-mediaplayer2/src/playlist.h	2007-10-28 20:29:29 UTC (rev 3294)
@@ -2,7 +2,7 @@
  *  OpenMoko Media Player
  *   http://openmoko.org/
  *
- *  Copyright (C) 2007 by the OpenMoko team
+ *  Copyright (C) 2007 by Soeren Apel (abraxa at dar-clan.de)
  *
  *  This program is free software; you can redistribute it and/or modify
  *  it under the terms of the GNU General Public License as published by
@@ -38,6 +38,8 @@
 #define OMP_EVENT_PLAYLIST_TRACK_INFO_CHANGED "playlist_track_info_changed"
 #define OMP_EVENT_PLAYLIST_TRACK_COUNT_CHANGED "playlist_track_count_changed"
 
+
+
 /// Track info data used with the OMP_EVENT_PLAYLIST_TRACK_INFO_CHANGED signal
 typedef struct _omp_track_info
 {
@@ -47,14 +49,14 @@
 } omp_track_info;
 
 /// Modes available for repetitive track playback
-enum omp_repeat_modes
+typedef enum
 {
 	OMP_REPEAT_OFF = 0,     ///< Repeat off
 	OMP_REPEAT_ONCE,        ///< Repeat current track once, then proceed with next track
 	OMP_REPEAT_CURRENT,     ///< Repeat current track forever
 	OMP_REPEAT_ALL,         ///< Repeat entire playlist
-	OMP_REPEAT_COUNT        ///< End-of-list marker for mode iteration
-};
+	OMP_REPEAT_COUNT        ///< End-of-list marker for mode enumeration
+} omp_repeat_mode;
 
 extern omp_spiff_list *omp_playlist;
 extern guint omp_playlist_track_count;
@@ -70,6 +72,8 @@
 	guint track_num;
 } omp_playlist_iter;
 
+
+
 void omp_playlist_init();
 void omp_playlist_free();
 gboolean omp_playlist_load(gchar *playlist_file, gboolean do_state_reset);

Modified: trunk/src/target/OM-2007.2/applications/openmoko-mediaplayer2/src/playlist_page.c
===================================================================
--- trunk/src/target/OM-2007.2/applications/openmoko-mediaplayer2/src/playlist_page.c	2007-10-27 11:42:07 UTC (rev 3293)
+++ trunk/src/target/OM-2007.2/applications/openmoko-mediaplayer2/src/playlist_page.c	2007-10-28 20:29:29 UTC (rev 3294)
@@ -2,7 +2,7 @@
  *  OpenMoko Media Player
  *   http://openmoko.org/
  *
- *  Copyright (C) 2007 by the OpenMoko team
+ *  Copyright (C) 2007 by Soeren Apel (abraxa at dar-clan.de)
  *
  *  This program is free software; you can redistribute it and/or modify
  *  it under the terms of the GNU General Public License as published by
@@ -205,11 +205,17 @@
 	file_name = g_strdup_printf("%s/%s.%s", path, name, OMP_PLAYLIST_FILE_EXTENSION);
 
 	omp_playlist_create(file_name);
+	omp_playlist_load(file_name, TRUE);
 
+	// Show playlist editor because a user obviously wants
+	// to edit a playlist that was just created
+	omp_tab_show(OMP_TAB_PLAYLIST_EDITOR);
+	omp_tab_focus(OMP_TAB_PLAYLIST_EDITOR);
+
 	// Rebuild the list
 	omp_playlist_page_list_populate();
 
-	gtk_entry_set_text(GTK_ENTRY(omp_playlist_page_entry), "");
+	gtk_entry_set_text(GTK_ENTRY(omp_playlist_page_entry), NULL);
 }
 
 /**
@@ -293,7 +299,7 @@
 	list_icon = pixbuf_new_from_file("ico-playlists.png");
 	renderer = gtk_cell_renderer_pixbuf_new();
 	g_object_set(G_OBJECT(renderer), "pixbuf", list_icon, NULL);
-	column = gtk_tree_view_column_new_with_attributes("", renderer, NULL);
+	column = gtk_tree_view_column_new_with_attributes(NULL, renderer, NULL);
 	gtk_tree_view_append_column(GTK_TREE_VIEW(tree_view), column);
 
 	renderer = gtk_cell_renderer_text_new();

Modified: trunk/src/target/OM-2007.2/applications/openmoko-mediaplayer2/src/playlist_page.h
===================================================================
--- trunk/src/target/OM-2007.2/applications/openmoko-mediaplayer2/src/playlist_page.h	2007-10-27 11:42:07 UTC (rev 3293)
+++ trunk/src/target/OM-2007.2/applications/openmoko-mediaplayer2/src/playlist_page.h	2007-10-28 20:29:29 UTC (rev 3294)
@@ -2,7 +2,7 @@
  *  OpenMoko Media Player
  *   http://openmoko.org/
  *
- *  Copyright (C) 2007 by the OpenMoko team
+ *  Copyright (C) 2007 by Soeren Apel (abraxa at dar-clan.de)
  *
  *  This program is free software; you can redistribute it and/or modify
  *  it under the terms of the GNU General Public License as published by





More information about the commitlog mailing list