Code

list_window: remove list_window_state_t
[ncmpc.git] / src / screen_list.c
index 46e6244180756fbc72614626afc4761e2489eb30..31e8adaf1f8cf58f20c1e24cc78b38b4f2eb8fbf 100644 (file)
 
 static const struct
 {
-       int id;
        const char *name;
        const struct screen_functions *functions;
 } screens[] = {
-       { SCREEN_PLAYLIST_ID, "playlist", &screen_playlist },
-       { SCREEN_BROWSE_ID, "browse", &screen_browse },
+       { "playlist", &screen_playlist },
+       { "browse", &screen_browse },
 #ifdef ENABLE_ARTIST_SCREEN
-       { SCREEN_ARTIST_ID, "artist", &screen_artist },
+       { "artist", &screen_artist },
 #endif
-       { SCREEN_HELP_ID, "help", &screen_help },
+       { "help", &screen_help },
 #ifdef ENABLE_SEARCH_SCREEN
-       { SCREEN_SEARCH_ID, "search", &screen_search },
+       { "search", &screen_search },
 #endif
 #ifdef ENABLE_KEYDEF_SCREEN
-       { SCREEN_KEYDEF_ID, "keydef", &screen_keydef },
+       { "keydef", &screen_keydef },
 #endif
 #ifdef ENABLE_LYRICS_SCREEN
-       { SCREEN_LYRICS_ID, "lyrics", &screen_lyrics },
+       { "lyrics", &screen_lyrics },
 #endif
 };
 
@@ -86,50 +85,26 @@ screen_list_resize(unsigned cols, unsigned rows)
        }
 }
 
-int
-screen_get_id_by_index(unsigned i)
-{
-       assert(i < NUM_SCREENS);
-
-       return screens[i].id;
-}
-
 const char *
-screen_get_name(unsigned i)
-{
-       assert(i < NUM_SCREENS);
-
-       return screens[i].name;
-}
-
-int
-screen_get_id(const char *name)
+screen_get_name(const struct screen_functions *sf)
 {
        unsigned i;
 
        for (i = 0; i < NUM_SCREENS; ++i)
-               if (strcmp(name, screens[i].name) == 0)
-                       return screens[i].id;
+               if (screens[i].functions == sf)
+                       return screens[i].name;
 
-       return -1;
+       return NULL;
 }
 
 const struct screen_functions *
-screen_get_functions(unsigned i)
-{
-       assert(i < NUM_SCREENS);
-
-       return screens[i].functions;
-}
-
-int
-lookup_mode(int id)
+screen_lookup_name(const char *name)
 {
        unsigned i;
 
        for (i = 0; i < NUM_SCREENS; ++i)
-               if (screens[i].id == id)
-                       return i;
+               if (strcmp(name, screens[i].name) == 0)
+                       return screens[i].functions;
 
-       return -1;
+       return NULL;
 }