Send commitlog mailing list submissions to
        [email protected]

To subscribe or unsubscribe via the World Wide Web, visit
        http://lists.openmoko.org/mailman/listinfo/commitlog
or, via email, send a message with subject or body 'help' to
        [EMAIL PROTECTED]

You can reach the person managing the list at
        [EMAIL PROTECTED]

When replying, please edit your Subject line so it is more specific
than "Re: Contents of commitlog digest..."
Today's Topics:

   1. r3294 - in
      trunk/src/target/OM-2007.2/applications/openmoko-mediaplayer2: .
      src ([EMAIL PROTECTED])
   2. r3295 - in
      trunk/src/target/OM-2007.2/panel-plugins/openmoko-panel-usb: .
      src ([EMAIL PROTECTED])
--- Begin Message ---
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 ([EMAIL PROTECTED])
  *
  *  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 ([EMAIL PROTECTED])
  *
  *  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 ([EMAIL PROTECTED])
  *
  *  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 ([EMAIL PROTECTED])
  *
  *  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 ([EMAIL PROTECTED])
  *
  *  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 ([EMAIL PROTECTED])
  *
  *  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 ([EMAIL PROTECTED])
  *
  *  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 ([EMAIL PROTECTED])
  *
  *  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 ([EMAIL PROTECTED])
  *
  *  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 ([EMAIL PROTECTED])
  *
  *  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 ([EMAIL PROTECTED])
  *
  *  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 ([EMAIL PROTECTED])
  *
  *  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 ([EMAIL PROTECTED])
  *
  *  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 ([EMAIL PROTECTED])
  *
  *  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 ([EMAIL PROTECTED])
  *
  *  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 ([EMAIL PROTECTED])
  *
  *  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 ([EMAIL PROTECTED])
  *
  *  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 ([EMAIL PROTECTED])
  *
  *  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




--- End Message ---
--- Begin Message ---
Author: mickey
Date: 2007-10-29 04:43:17 +0100 (Mon, 29 Oct 2007)
New Revision: 3295

Modified:
   trunk/src/target/OM-2007.2/panel-plugins/openmoko-panel-usb/ChangeLog
   trunk/src/target/OM-2007.2/panel-plugins/openmoko-panel-usb/configure.ac
   
trunk/src/target/OM-2007.2/panel-plugins/openmoko-panel-usb/src/openmoko-panel-usb.c
Log:
openmoko-panel-usb: add USB debug code


Modified: trunk/src/target/OM-2007.2/panel-plugins/openmoko-panel-usb/ChangeLog
===================================================================
--- trunk/src/target/OM-2007.2/panel-plugins/openmoko-panel-usb/ChangeLog       
2007-10-28 20:29:29 UTC (rev 3294)
+++ trunk/src/target/OM-2007.2/panel-plugins/openmoko-panel-usb/ChangeLog       
2007-10-29 03:43:17 UTC (rev 3295)
@@ -1,6 +1,13 @@
+2007-10-29     Michael Lauer <[EMAIL PROTECTED]>
+
+       * configure.ac:
+       Depend on libusb
+       * src/openmoko-panel-usb:
+       Add usb debug code.
+
 2007-09-02     Michael Lauer <[EMAIL PROTECTED]>
 
-       * src/openmoko-panel-gps:
+       * src/openmoko-panel-usb:
        Use moko_panel_applet_set_icon to set the icon.
 
 2007-07-30     Michael Lauer <[EMAIL PROTECTED]>

Modified: 
trunk/src/target/OM-2007.2/panel-plugins/openmoko-panel-usb/configure.ac
===================================================================
--- trunk/src/target/OM-2007.2/panel-plugins/openmoko-panel-usb/configure.ac    
2007-10-28 20:29:29 UTC (rev 3294)
+++ trunk/src/target/OM-2007.2/panel-plugins/openmoko-panel-usb/configure.ac    
2007-10-29 03:43:17 UTC (rev 3295)
@@ -11,7 +11,7 @@
 AC_PROG_LIBTOOL
 
 # base deps
-PKG_CHECK_MODULES(OPENMOKO, libmokopanelui2)
+PKG_CHECK_MODULES(OPENMOKO, libmokopanelui2 libusb)
 
 LIBS="$LIBS $OPENMOKO_LIBS"
 CFLAGS="$CFLAGS $OPENMOKO_CFLAGS"

Modified: 
trunk/src/target/OM-2007.2/panel-plugins/openmoko-panel-usb/src/openmoko-panel-usb.c
===================================================================
--- 
trunk/src/target/OM-2007.2/panel-plugins/openmoko-panel-usb/src/openmoko-panel-usb.c
        2007-10-28 20:29:29 UTC (rev 3294)
+++ 
trunk/src/target/OM-2007.2/panel-plugins/openmoko-panel-usb/src/openmoko-panel-usb.c
        2007-10-29 03:43:17 UTC (rev 3295)
@@ -1,6 +1,6 @@
 /*  openmoko-panel-usb.c
  *
- *  Authored by
+ *  Authored by Michael 'Mickey' Lauer <[EMAIL PROTECTED]>
  *  Copyright (C) 2007 OpenMoko Inc.
  *
  *  This program is free software; you can redistribute it and/or modify
@@ -12,14 +12,18 @@
  *  MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
  *  GNU Lesser Public License for more details.
  *
- *  Current Version: $Rev$ ($Date$) [$Author: mickey $]
  */
 #include <libmokopanelui2/moko-panel-applet.h>
 
+#include <sys/types.h>
+#include <linux/limits.h>
+#include <usb.h>
+
 #include <gtk/gtkimage.h>
 #include <time.h>
 
 typedef struct {
+    MokoPanelApplet* mpa;
     int dummy;
 } UsbApplet;
 
@@ -29,6 +33,124 @@
     g_slice_free (UsbApplet, applet);
 }
 
+void print_endpoint(struct usb_endpoint_descriptor *endpoint)
+{
+    printf(" bEndpointAddress: %02xh\n", endpoint->bEndpointAddress);
+    printf(" bmAttributes: %02xh\n", endpoint->bmAttributes);
+    printf(" wMaxPacketSize: %d\n", endpoint->wMaxPacketSize);
+    printf(" bInterval: %d\n", endpoint->bInterval);
+    printf(" bRefresh: %d\n", endpoint->bRefresh);
+    printf(" bSynchAddress: %d\n", endpoint->bSynchAddress);
+}
+
+void print_altsetting(struct usb_interface_descriptor *interface)
+{
+    int i;
+
+    printf(" bInterfaceNumber: %d\n", interface->bInterfaceNumber);
+    printf(" bAlternateSetting: %d\n", interface->bAlternateSetting);
+    printf(" bNumEndpoints: %d\n", interface->bNumEndpoints);
+    printf(" bInterfaceClass: %d\n", interface->bInterfaceClass);
+    printf(" bInterfaceSubClass: %d\n", interface->bInterfaceSubClass);
+    printf(" bInterfaceProtocol: %d\n", interface->bInterfaceProtocol);
+    printf(" iInterface: %d\n", interface->iInterface);
+
+    for (i = 0; i < interface->bNumEndpoints; i++)
+        print_endpoint(&interface->endpoint[i]);
+}
+
+void print_interface(struct usb_interface *interface)
+{
+    int i;
+
+    for (i = 0; i < interface->num_altsetting; i++)
+        print_altsetting(&interface->altsetting[i]);
+}
+
+void print_configuration(struct usb_config_descriptor *config)
+{
+    int i;
+
+    printf(" wTotalLength: %d\n", config->wTotalLength);
+    printf(" bNumInterfaces: %d\n", config->bNumInterfaces);
+    printf(" bConfigurationValue: %d\n", config->bConfigurationValue);
+    printf(" iConfiguration: %d\n", config->iConfiguration);
+    printf(" bmAttributes: %02xh\n", config->bmAttributes);
+    printf(" MaxPower: %d\n", config->MaxPower);
+
+    for (i = 0; i < config->bNumInterfaces; i++)
+        print_interface(&config->interface[i]);
+}
+
+static void usb_applet_dump_usb_status()
+{
+    struct usb_bus *bus;
+    struct usb_device *dev;
+    printf("bus/device idVendor/idProduct\n");
+
+    for (bus = usb_busses; bus; bus = bus->next) {
+        for (dev = bus->devices; dev; dev = dev->next) {
+            int ret, i;
+            char string[256];
+            usb_dev_handle *udev;
+
+            printf("%s/%s %04X/%04X\n", bus->dirname, dev->filename,
+                dev->descriptor.idVendor, dev->descriptor.idProduct);
+
+            udev = usb_open(dev);
+            if (udev) {
+                if (dev->descriptor.iManufacturer) {
+                    ret = usb_get_string_simple(udev, 
dev->descriptor.iManufacturer, string, sizeof(string));
+                    if (ret > 0)
+                        printf("- Manufacturer : %s\n", string);
+                    else
+                        printf("- Unable to fetch manufacturer string\n");
+                }
+
+                if (dev->descriptor.iProduct) {
+                    ret = usb_get_string_simple(udev, 
dev->descriptor.iProduct, string, sizeof(string));
+                    if (ret > 0)
+                        printf("- Product : %s\n", string);
+                    else
+                        printf("- Unable to fetch product string\n");
+                }
+
+                if (dev->descriptor.iSerialNumber) {
+                    ret = usb_get_string_simple(udev, 
dev->descriptor.iSerialNumber, string, sizeof(string));
+                    if (ret > 0)
+                        printf("- Serial Number: %s\n", string);
+                    else
+                        printf("- Unable to fetch serial number string\n");
+                }
+
+                usb_close (udev);
+            }
+
+            if (!dev->config) {
+                printf(" Couldn't retrieve descriptors\n");
+                continue;
+            }
+
+            for (i = 0; i < dev->descriptor.bNumConfigurations; i++)
+                print_configuration(&dev->config[i]);
+        }
+    }
+}
+
+static void usb_applet_update_status( UsbApplet *applet )
+{
+    usb_init();
+    int new_busses = usb_find_busses();
+    g_debug( "usb_applet_update_status: %d new USBes found", new_busses );
+    int new_devices = usb_find_devices();
+    g_debug( "usb_applet_update_status: %d new USB devices found", new_devices 
);
+
+    usb_applet_dump_usb_status();
+
+    moko_panel_applet_set_icon( applet->mpa, PKGDATADIR "/Usb.png" );
+
+}
+
 G_MODULE_EXPORT GtkWidget*
 mb_panel_applet_create(const char* id, GtkOrientation orientation)
 {
@@ -38,9 +160,10 @@
     time_t t;
     struct tm *local_time;
 
-    applet = g_slice_new (UsbApplet);
+    applet = g_slice_new( UsbApplet );
+    applet->mpa = mokoapplet;
 
-    moko_panel_applet_set_icon( mokoapplet, PKGDATADIR "/Usb.png" );
+    usb_applet_update_status( applet );
 
     gtk_widget_show_all( GTK_WIDGET(mokoapplet) );
     return GTK_WIDGET(mokoapplet);




--- End Message ---
_______________________________________________
commitlog mailing list
[email protected]
http://lists.openmoko.org/mailman/listinfo/commitlog

Reply via email to