[xiph-commits] r11087 - in trunk/maemo/OggPlay: . src

mgrimme at svn.xiph.org mgrimme at svn.xiph.org
Sun Apr 2 14:04:01 PDT 2006


Author: mgrimme
Date: 2006-04-02 14:03:54 -0700 (Sun, 02 Apr 2006)
New Revision: 11087

Modified:
   trunk/maemo/OggPlay/ChangeLog
   trunk/maemo/OggPlay/TODO
   trunk/maemo/OggPlay/configure.ac
   trunk/maemo/OggPlay/src/main.c
   trunk/maemo/OggPlay/src/playlist.c
   trunk/maemo/OggPlay/src/playlist.h
   trunk/maemo/OggPlay/src/playlistwidget.c
   trunk/maemo/OggPlay/src/playlistwidget.h
Log:
release 0.30

Modified: trunk/maemo/OggPlay/ChangeLog
===================================================================
--- trunk/maemo/OggPlay/ChangeLog	2006-04-02 17:39:07 UTC (rev 11086)
+++ trunk/maemo/OggPlay/ChangeLog	2006-04-02 21:03:54 UTC (rev 11087)
@@ -1,5 +1,7 @@
 2006-04-02  Martin Grimme  <martin.grimme at lintegra.de>
 
+	* src/playlistwidget.c: Print the current title in bold face.
+
 	* src/main.c: Start playing when loading the first title into the
 	playlist.
 

Modified: trunk/maemo/OggPlay/TODO
===================================================================
--- trunk/maemo/OggPlay/TODO	2006-04-02 17:39:07 UTC (rev 11086)
+++ trunk/maemo/OggPlay/TODO	2006-04-02 21:03:54 UTC (rev 11087)
@@ -1,11 +1,11 @@
-- add playlist support
+- make playlist editable
 
+- load / save playlists
+
 - implement an additional backend so that MP3 and other formats can be played
   as well (this has to use the libraries already present on the Nokia 770 as
   Xiph.org does not allow including proprietary codecs)
 
-- integrate well with the maemo look'n feel
-
 - Lyrics lookup in the internet
 
 - Cover art lookup in the internet

Modified: trunk/maemo/OggPlay/configure.ac
===================================================================
--- trunk/maemo/OggPlay/configure.ac	2006-04-02 17:39:07 UTC (rev 11086)
+++ trunk/maemo/OggPlay/configure.ac	2006-04-02 21:03:54 UTC (rev 11087)
@@ -1,5 +1,5 @@
 AC_INIT(Makefile.am)
-AM_INIT_AUTOMAKE(OggPlay, 0.20)
+AM_INIT_AUTOMAKE(OggPlay, 0.30)
 
 AC_PROG_CPP
 AC_PROG_INSTALL

Modified: trunk/maemo/OggPlay/src/main.c
===================================================================
--- trunk/maemo/OggPlay/src/main.c	2006-04-02 17:39:07 UTC (rev 11086)
+++ trunk/maemo/OggPlay/src/main.c	2006-04-02 21:03:54 UTC (rev 11087)
@@ -176,13 +176,16 @@
 	GSList *filenames) {
 
   GSList *iter;
+  gboolean do_play = FALSE;
 
+  if (playlist_get_length(appdata->playlist) == 0)
+    do_play = TRUE;
+
   for (iter = filenames; iter != NULL; iter = iter->next) {
     playlist_append(appdata->playlist, (char *) iter->data);
   }
 
-  if (playlist_get_length(appdata->playlist) == 1)
-    playlist_jump_to(appdata->playlist, 0);
+  if (do_play) playlist_jump_to(appdata->playlist, 0);
 
 }
 

Modified: trunk/maemo/OggPlay/src/playlist.c
===================================================================
--- trunk/maemo/OggPlay/src/playlist.c	2006-04-02 17:39:07 UTC (rev 11086)
+++ trunk/maemo/OggPlay/src/playlist.c	2006-04-02 21:03:54 UTC (rev 11087)
@@ -58,7 +58,7 @@
   if (pl->list->len > 0) {
     g_ptr_array_foreach (pl->list, g_free, NULL);
     g_ptr_array_remove_range(pl->list, 0, pl->list->len);
-    (pl->change_cb)(pl->change_cb_data);
+    (pl->change_cb)(pl->change_cb_data, TRUE);
   }
 
 }
@@ -69,7 +69,7 @@
 		const char *uri) {
 
   g_ptr_array_add(pl->list, g_strdup(uri));
-  (pl->change_cb)(pl->change_cb_data);
+  (pl->change_cb)(pl->change_cb_data, TRUE);
 
 }
 
@@ -84,6 +84,7 @@
   pl->position = MAX(0, pl->position - 1);  
   uri = g_ptr_array_index(pl->list, pl->position);
   (pl->play_cb)(pl->play_cb_data, uri);
+  (pl->change_cb)(pl->change_cb_data, FALSE);
 
 }
 
@@ -98,13 +99,14 @@
   if (pl->position == pl->list->len - 1) {
 
     (pl->play_cb)(pl->play_cb_data, NULL);
+    (pl->change_cb)(pl->change_cb_data, FALSE);
 
   } else {
 
     pl->position = MIN(pl->list->len - 1, pl->position + 1);
     uri = g_ptr_array_index(pl->list, pl->position);
     (pl->play_cb)(pl->play_cb_data, uri);
-
+    (pl->change_cb)(pl->change_cb_data, FALSE);
   }
 
 }
@@ -120,6 +122,7 @@
     pl->position = index;
     uri = g_ptr_array_index(pl->list, pl->position);
     (pl->play_cb)(pl->play_cb_data, uri);
+    (pl->change_cb)(pl->change_cb_data, FALSE);
   }
     
 }

Modified: trunk/maemo/OggPlay/src/playlist.h
===================================================================
--- trunk/maemo/OggPlay/src/playlist.h	2006-04-02 17:39:07 UTC (rev 11086)
+++ trunk/maemo/OggPlay/src/playlist.h	2006-04-02 21:03:54 UTC (rev 11087)
@@ -23,7 +23,7 @@
 
 
 #define PLAY_CB    void (*play_cb)    (void *userdata, const char *uri)
-#define CHANGE_CB    void (*change_cb)    (void *userdata)
+#define CHANGE_CB    void (*change_cb)    (void *userdata, gboolean renew)
 
 
 struct _Playlist {

Modified: trunk/maemo/OggPlay/src/playlistwidget.c
===================================================================
--- trunk/maemo/OggPlay/src/playlistwidget.c	2006-04-02 17:39:07 UTC (rev 11086)
+++ trunk/maemo/OggPlay/src/playlistwidget.c	2006-04-02 21:03:54 UTC (rev 11087)
@@ -21,54 +21,66 @@
 #include "playlistwidget.h"
 
 
-static gboolean
-doubleclick_cb(GtkWidget *src,
-	       GdkEventMotion *event,
-	       PLWidget *plw) {
+static void
+click_cb(GtkTreeView *treeview,
+	 GtkTreePath *path,
+	 GtkTreeViewColumn *column,
+	 PLWidget *plw) {
 
-  GtkTreeSelection *selection;
-  GList *rows;
   gint *indices;
 
-  if (event->type == GDK_2BUTTON_PRESS) {
 
-    selection = gtk_tree_view_get_selection(plw->treeview);
-    rows = gtk_tree_selection_get_selected_rows(selection, NULL);
-    indices = gtk_tree_path_get_indices(rows->data);
-    if (indices) {
-      playlist_jump_to(plw->playlist, indices[0]);
-    }
-    
-    g_list_foreach(rows, gtk_tree_path_free, NULL);
-    g_list_free(rows);
-
+  indices = gtk_tree_path_get_indices(path);
+  if (indices) {
+    playlist_jump_to(plw->playlist, indices[0]);
   }
-
-  return FALSE;
-
+  
 }
 
 
 static void
-change_cb(PLWidget *plw) {
+change_cb(PLWidget *plw, gboolean renew) {
 
   GPtrArray *list = plw->playlist->list;
+  int position = plw->playlist->position;
   GtkTreeIter iter;
-  char *item;
+  GtkTreePath *treepath;
+  char *item, *tmpitem;
   int i;
-  
-  gtk_list_store_clear(plw->liststore);
 
-  /* did I mention that the API sucks..? ;) */
-  for (i = 0; i < list->len; i++) {
+  if (renew) {
+    gtk_list_store_clear(plw->liststore);
 
-    item = g_path_get_basename(g_ptr_array_index(list, i));
-    gtk_list_store_append(plw->liststore, &iter);
-    gtk_list_store_set(plw->liststore, &iter, 1, item, -1);
-    g_free(item);
-
+    /* did I mention that the API sucks..? ;) */
+    for (i = 0; i < list->len; i++) {
+      
+      item = g_path_get_basename(g_ptr_array_index(list, i));
+      gtk_list_store_append(plw->liststore, &iter);
+      gtk_list_store_set(plw->liststore, &iter, 1, item, -1);
+      g_free(item);
+      
+    }
   }
 
+  item = g_path_get_basename(g_ptr_array_index(list,
+					       plw->current_selection));
+  treepath = gtk_tree_path_new_from_indices(plw->current_selection, -1);
+  gtk_tree_model_get_iter(plw->liststore, &iter, treepath);
+  gtk_list_store_set(plw->liststore, &iter, 1, item, -1);
+  gtk_tree_path_free(treepath);
+  g_free(item);
+
+  
+  tmpitem = g_path_get_basename(g_ptr_array_index(list, position));
+  item = g_strconcat("<b>", tmpitem, "</b>", NULL);
+  g_free(tmpitem);
+  treepath = gtk_tree_path_new_from_indices(position, -1);
+  gtk_tree_model_get_iter(plw->liststore, &iter, treepath);
+  gtk_list_store_set(plw->liststore, &iter, 1, item, -1);
+  gtk_tree_path_free(treepath);
+  g_free(item);
+  plw->current_selection = position;
+
 }
 
 
@@ -88,6 +100,7 @@
 
   plw->liststore = gtk_list_store_new(2, GDK_TYPE_PIXBUF, G_TYPE_STRING);
   plw->treeview = gtk_tree_view_new_with_model(GTK_TREE_MODEL(plw->liststore));
+  plw->current_selection = 0;
 
   /* column 1: image */
   crender1 = gtk_cell_renderer_pixbuf_new();
@@ -100,13 +113,12 @@
   g_value_init(&fontsize, G_TYPE_DOUBLE);
   g_value_set_double(&fontsize, 14.0);
   g_object_set_property(G_OBJECT(crender2), "size-points", &fontsize);
-  col2 = gtk_tree_view_column_new_with_attributes("", crender2, "text", 1, 
+  col2 = gtk_tree_view_column_new_with_attributes("", crender2, "markup", 1, 
 						  NULL);
   gtk_tree_view_append_column(plw->treeview, col2);
 
-  /* handle double clicks */
-  g_signal_connect(G_OBJECT(plw->treeview), "button-press-event",
-		   G_CALLBACK(doubleclick_cb), plw);
+  g_signal_connect(G_OBJECT(plw->treeview), "row-activated",
+		   G_CALLBACK(click_cb), plw);
 
   return plw;
 

Modified: trunk/maemo/OggPlay/src/playlistwidget.h
===================================================================
--- trunk/maemo/OggPlay/src/playlistwidget.h	2006-04-02 17:39:07 UTC (rev 11086)
+++ trunk/maemo/OggPlay/src/playlistwidget.h	2006-04-02 21:03:54 UTC (rev 11087)
@@ -41,6 +41,7 @@
   GtkWidget *treeview;
 
   Playlist *playlist;
+  int current_selection;
 
 };
 typedef struct _PLWidget PLWidget;



More information about the commits mailing list