From afbf9e0b1a4c989af94f860ae49ea765544125c0 Mon Sep 17 00:00:00 2001 From: Anna Schumaker Date: Mon, 22 Aug 2016 12:06:03 -0400 Subject: [PATCH] gui/playlist: Change headers to "Playlists" and "Dynamic" One word labels are always better. I move the "Favorites" and "Hidden" playlists under the "Playlists" header because they're manually configured by the user. Signed-off-by: Anna Schumaker --- gui/playlist.c | 15 ++++++++------- tests/gui/playlist.c | 22 +++++++++++----------- 2 files changed, 19 insertions(+), 18 deletions(-) diff --git a/gui/playlist.c b/gui/playlist.c index 1de4cadc..401ef845 100644 --- a/gui/playlist.c +++ b/gui/playlist.c @@ -350,19 +350,19 @@ void gui_playlist_init() __playlist_set(&parent, "History", "document-open-recent", PL_SYSTEM); __playlist_set_size(&parent, "History"); - /* Add "User Playlists" header. */ + /* Add "Playlists" header and playlists. */ gtk_tree_store_insert(p_store, &parent, NULL, -1); gtk_tree_store_insert(p_store, &parent, NULL, -1); - __playlist_set(&parent, "User Playlists", "emblem-documents", 0); + __playlist_set(&parent, "Playlists", "emblem-documents", 0); + __playlist_add(&parent, "Favorites", "emblem-favorite", PL_SYSTEM); + __playlist_add(&parent, "Hidden", "window-close", PL_SYSTEM); - /* Add "System Playlists" header. */ + /* Add "Dynamic" header. */ gtk_tree_store_insert(p_store, &parent, NULL, -1); gtk_tree_store_insert(p_store, &parent, NULL, -1); - __playlist_set(&parent, "System Playlists", "emblem-system", 0); + __playlist_set(&parent, "Dynamic", "emblem-system", 0); /* Add playlists. */ - __playlist_add(&parent, "Favorites", "emblem-favorite", PL_SYSTEM); - __playlist_add(&parent, "Hidden", "window-close", PL_SYSTEM); __playlist_add(&parent, "Most Played", "go-up", PL_SYSTEM); __playlist_add(&parent, "Least Played", "go-down", PL_SYSTEM); __playlist_add(&parent, "Unplayed", "audio-x-generic", PL_SYSTEM); @@ -448,7 +448,7 @@ void gui_playlist_add_user(struct playlist *playlist) gtk_tree_model_get_iter_first(GTK_TREE_MODEL(p_store), &parent); do { name = __playlist_name(&parent); - match = string_match(name, "User Playlists"); + match = string_match(name, "Playlists"); g_free(name); if (match) @@ -463,6 +463,7 @@ void gui_playlist_add_user(struct playlist *playlist) do { name = __playlist_name(&sibling); match = g_utf8_collate(name, playlist->pl_name) >= 0; + match = match && !(__playlist_type(&sibling) == PL_SYSTEM); g_free(name); if (match) { diff --git a/tests/gui/playlist.c b/tests/gui/playlist.c index 436f8317..eeecf38c 100644 --- a/tests/gui/playlist.c +++ b/tests/gui/playlist.c @@ -67,6 +67,16 @@ static void test_playlist_sidebar() gtk_tree_path_down(path); gtk_tree_selection_select_path(selection, path); g_assert_cmpuint(gtk_tree_selection_count_selected_rows(selection), ==, 1); + g_assert_cmpstr(gui_playlist_cur(), ==, "Favorites"); + + gtk_tree_path_next(path); + gtk_tree_selection_select_path(selection, path); + g_assert_cmpuint(gtk_tree_selection_count_selected_rows(selection), ==, 1); + g_assert_cmpstr(gui_playlist_cur(), ==, "Hidden"); + + gtk_tree_path_next(path); + gtk_tree_selection_select_path(selection, path); + g_assert_cmpuint(gtk_tree_selection_count_selected_rows(selection), ==, 1); g_assert_cmpstr(gui_playlist_cur(), ==, "Test"); gtk_tree_path_up(path); @@ -79,18 +89,8 @@ static void test_playlist_sidebar() gtk_tree_selection_select_path(selection, path); g_assert_cmpuint(gtk_tree_selection_count_selected_rows(selection), ==, 0); - gtk_tree_path_down(path); - gtk_tree_selection_select_path(selection, path); - g_assert_cmpuint(gtk_tree_selection_count_selected_rows(selection), ==, 1); - g_assert_cmpstr(gui_playlist_cur(), ==, "Favorites"); - - gtk_tree_path_next(path); - gtk_tree_selection_select_path(selection, path); - g_assert_cmpuint(gtk_tree_selection_count_selected_rows(selection), ==, 1); - g_assert_cmpstr(gui_playlist_cur(), ==, "Hidden"); - /* Most played and least played are both filtered out */ - gtk_tree_path_next(path); + gtk_tree_path_down(path); gtk_tree_selection_select_path(selection, path); g_assert_cmpuint(gtk_tree_selection_count_selected_rows(selection), ==, 1); g_assert_cmpstr(gui_playlist_cur(), ==, "Unplayed");