--- gimmix-0.5.6.1/src/gimmix-playlist.c 2009-02-07 02:11:49.000000000 +0530 +++ gimmix-0.5.6.1/src/gimmix-playlist.c 2009-07-20 11:29:31.000000000 +0530 @@ -667,11 +667,12 @@ "text", 1, NULL); - dir_store = gtk_list_store_new (4, + dir_store = gtk_list_store_new (5, GDK_TYPE_PIXBUF, /* icon (0) */ G_TYPE_STRING, /* name (1) */ G_TYPE_STRING, /* path (2) */ - G_TYPE_INT); /* type DIR/SONG (3) */ + G_TYPE_INT, /* type DIR/SONG (3) */ + G_TYPE_INT); /* id (4) */ pls_store = gtk_list_store_new (2, GDK_TYPE_PIXBUF, /* icon (0) */ @@ -1190,7 +1191,7 @@ if (data->type == MPD_DATA_TYPE_PLAYLIST) { gtk_list_store_append (pls_liststore, &pls_treeiter); - name = data->playlist; + name = (char*) data->playlist; gtk_list_store_set (pls_liststore, &pls_treeiter, 0, pls_pixbuf, 1, name, @@ -1288,6 +1289,7 @@ -1); g_free (title); } + gtk_list_store_set (dir_store, &dir_iter, 4, data->song->id, -1); } mpd_data_free (data); @@ -1330,31 +1332,43 @@ GList *list; GtkTreeIter iter; gchar *path; - gchar *song_path; gint type = -1; + guint id; model = gtk_tree_view_get_model (GTK_TREE_VIEW(library_treeview)); list = gtk_tree_selection_get_selected_rows (library_selection, &model); gtk_tree_model_get_iter (model, &iter, list->data); - gtk_tree_model_get (model, &iter, 2, &path, 3, &type, -1); + gtk_tree_model_get (model, &iter, 2, &path, 3, &type, 4, &id, -1); if (type == DIR) { g_free (path); return; } - - song_path = g_strdup_printf ("%s/%s", cfg_get_key_value(conf, "music_directory"), path); + #ifdef HAVE_TAGEDITOR + gchar *song_path = g_strdup_printf ("%s/%s", cfg_get_key_value(conf, "music_directory"), path); if (gimmix_tag_editor_populate (song_path)) { gtk_widget_show (tag_editor_window); } else + { gimmix_tag_editor_error (invalid_dir_error); - - g_free (path); + } g_free (song_path); + #else + if (gimmix_tag_editor_populate (mpd_database_get_fileinfo(gmo,path))) + { + gtk_widget_show (tag_editor_window); + } + else + { + gimmix_tag_editor_error (_("An error occurred while trying to get song information. Please try again.")); + } + #endif + g_free (path); + /* free the list */ g_list_foreach (list, (GFunc)gtk_tree_path_free, NULL); @@ -1370,7 +1384,7 @@ GList *list; GtkTreeIter iter; gchar *path; - gchar *song_path; + guint id; model = gtk_tree_view_get_model (GTK_TREE_VIEW(current_playlist_treeview)); if (gtk_tree_selection_count_selected_rows(current_playlist_selection) != 1) @@ -1378,10 +1392,10 @@ list = gtk_tree_selection_get_selected_rows (current_playlist_selection, &model); gtk_tree_model_get_iter (model, &iter, list->data); - gtk_tree_model_get (model, &iter, 1, &path, -1); + gtk_tree_model_get (model, &iter, 1, &path, 2, &id, -1); #ifdef HAVE_TAGEDITOR - song_path = g_strdup_printf ("%s/%s", cfg_get_key_value(conf, "music_directory"), path); + gchar *song_path = g_strdup_printf ("%s/%s", cfg_get_key_value(conf, "music_directory"), path); if (gimmix_tag_editor_populate (song_path)) { gtk_widget_show (tag_editor_window); @@ -1392,7 +1406,7 @@ } g_free (song_path); #else - if (gimmix_tag_editor_populate (mpd_playlist_get_current_song(gmo))) + if (gimmix_tag_editor_populate (mpd_playlist_get_song(gmo,id))) { gtk_widget_show (tag_editor_window); } --- gimmix-0.5.6.1/src/gimmix-tagedit.c 2009-02-07 02:11:49.000000000 +0530 +++ gimmix-0.5.6.1/src/gimmix-tagedit.c 2009-07-20 11:30:33.000000000 +0530 @@ -278,10 +278,22 @@ comment = g_strdup (gtk_entry_get_text (GTK_ENTRY(tag_comment))); genre = gtk_combo_box_get_active_text (GTK_COMBO_BOX(tag_genre)); - taglib_tag_set_title (tag, g_strchomp(title)); - taglib_tag_set_artist (tag, g_strchomp(artist)); - taglib_tag_set_album (tag, g_strchomp(album)); - taglib_tag_set_comment (tag, g_strchomp(comment)); + if (title) + { + taglib_tag_set_title (tag, g_strchomp(title)); + } + if (artist) + { + taglib_tag_set_artist (tag, g_strchomp(artist)); + } + if (album) + { + taglib_tag_set_album (tag, g_strchomp(album)); + } + if (comment) + { + taglib_tag_set_comment (tag, g_strchomp(comment)); + } taglib_tag_set_genre (tag, genre); /* update the mpd database */