From: <jc...@us...> - 2006-06-27 16:33:40
|
Update of /cvsroot/gtkpod/gtkpod/src In directory sc8-pr-cvs2.sourceforge.net:/tmp/cvs-serv3759/src Modified Files: display_playlists.c misc.c Log Message: * src/display_playlist (pm_remove_playlist): if entire itdb is removed, clear display (filter tabs, playlist view) first to avoid segfaults when non-existent tracks are accessed for display updates. Index: display_playlists.c =================================================================== RCS file: /cvsroot/gtkpod/gtkpod/src/display_playlists.c,v retrieving revision 1.91 retrieving revision 1.92 diff -u -d -r1.91 -r1.92 --- display_playlists.c 24 Jun 2006 15:39:22 -0000 1.91 +++ display_playlists.c 27 Jun 2006 16:29:43 -0000 1.92 @@ -1,4 +1,4 @@ -/* Time-stamp: <2006-06-25 00:25:34 jcs> +/* Time-stamp: <2006-06-28 01:25:27 jcs> | | Copyright (C) 2002-2005 Jorg Schuler <jcsjcs at users sourceforge net> | Part of the gtkpod project. @@ -1145,16 +1145,12 @@ } -/* Remove "playlist" from the display model. - "select": TRUE: a new playlist is selected - FALSE: no selection is taking place - (useful when quitting program) */ -void pm_remove_playlist (Playlist *playlist, gboolean select) -{ - gboolean pm_delete_playlist_fe (GtkTreeModel *model, - GtkTreePath *path, - GtkTreeIter *iter, - gpointer data) + + /* former inline function: used by pm_remove_playlist() */ + static gboolean pm_delete_playlist_fe (GtkTreeModel *model, + GtkTreePath *path, + GtkTreeIter *iter, + gpointer data) { Playlist *playlist=NULL; @@ -1165,6 +1161,13 @@ } return FALSE; } + +/* Remove "playlist" from the display model. + "select": TRUE: a new playlist is selected + FALSE: no selection is taking place + (useful when quitting program) */ +void pm_remove_playlist (Playlist *playlist, gboolean select) +{ GtkTreeModel *model; gboolean have_iter = FALSE; GtkTreeIter i; @@ -1173,11 +1176,21 @@ g_return_if_fail (playlist); model = gtk_tree_view_get_model (playlist_treeview); g_return_if_fail (model); - + ts = gtk_tree_view_get_selection (playlist_treeview); + + if (itdb_playlist_is_mpl (playlist) && current_playlist && + (playlist->itdb == current_playlist->itdb)) + { /* We are about to remove the entire itdb (playlist is MPL) and + * a playlist of this itdb is selected --> clear display + * (pm_unselect_playlist probably works as well, but the + * unselect won't be done until later (callback)) */ + st_init (-1, 0); + current_playlist = NULL; + } + if (select && (current_playlist == playlist)) - { - /* We are about to delete the currently selected + { /* We are about to delete the currently selected playlist. Try to select the next. */ if (gtk_tree_selection_get_selected (ts, NULL, &i)) { @@ -1197,6 +1210,7 @@ gtk_tree_path_free (path); } } + /* find the pl and delete it */ gtk_tree_model_foreach (model, pm_delete_playlist_fe, playlist); /* select our new iter !!! */ @@ -1235,14 +1249,11 @@ } - -/* Select specified playlist */ -void pm_select_playlist (Playlist *playlist) -{ - gboolean pm_select_playlist_fe (GtkTreeModel *model, - GtkTreePath *path, - GtkTreeIter *iter, - gpointer data) + /* former inline function: used by pm_select_playlist */ + static gboolean pm_select_playlist_fe (GtkTreeModel *model, + GtkTreePath *path, + GtkTreeIter *iter, + gpointer data) { Playlist *playlist=NULL; @@ -1257,6 +1268,10 @@ } return FALSE; } + +/* Select specified playlist */ +void pm_select_playlist (Playlist *playlist) +{ GtkTreeModel *model; g_return_if_fail (playlist_treeview); @@ -1270,13 +1285,11 @@ } -/* Unselect specified playlist */ -void pm_unselect_playlist (Playlist *playlist) -{ - gboolean pm_unselect_playlist_fe (GtkTreeModel *model, - GtkTreePath *path, - GtkTreeIter *iter, - gpointer data) + /* former inline function: used by pm_unselect_playlist */ + static gboolean pm_unselect_playlist_fe (GtkTreeModel *model, + GtkTreePath *path, + GtkTreeIter *iter, + gpointer data) { Playlist *playlist=NULL; @@ -1291,6 +1304,10 @@ } return FALSE; } + +/* Unselect specified playlist */ +void pm_unselect_playlist (Playlist *playlist) +{ GtkTreeModel *model; g_return_if_fail (playlist_treeview); Index: misc.c =================================================================== RCS file: /cvsroot/gtkpod/gtkpod/src/misc.c,v retrieving revision 1.212 retrieving revision 1.213 diff -u -d -r1.212 -r1.213 --- misc.c 27 Jun 2006 03:55:00 -0000 1.212 +++ misc.c 27 Jun 2006 16:30:02 -0000 1.213 @@ -1,5 +1,5 @@ /* -*- coding: utf-8; -*- -| Time-stamp: <2006-06-25 15:20:33 jcs> +| Time-stamp: <2006-06-28 01:21:08 jcs> | | Copyright (C) 2002-2005 Jorg Schuler <jcsjcs at users sourceforge net> | Part of the gtkpod project. @@ -143,8 +143,8 @@ Christoph Kunz: address compatibility issues when writing id3v2.4 type mp3 tags\n"), "\n", _("\ -James Liggett:\n replacement of old GTK file selection dialogs with new GTK filechooser dialogs\n"), - _("\ +James Liggett:\n\ + replacement of old GTK file selection dialogs with new GTK filechooser dialogs\n\ refactored user preferences system.\n"), "\n", _("\ |