Mercurial > audlegacy
comparison audacious/ui_playlist.c @ 2095:855bba3f364e trunk
[svn] - update playlist UI
author | nenolod |
---|---|
date | Mon, 11 Dec 2006 05:09:02 -0800 |
parents | 8feb3d69b5be |
children | f18a5b617c34 |
comparison
equal
deleted
inserted
replaced
2094:7ea9a6177232 | 2095:855bba3f364e |
---|---|
337 { | 337 { |
338 gchar *text, *sel_text, *tot_text; | 338 gchar *text, *sel_text, *tot_text; |
339 gulong selection, total; | 339 gulong selection, total; |
340 gboolean selection_more, total_more; | 340 gboolean selection_more, total_more; |
341 | 341 |
342 playlist_get_total_time(&total, &selection, &total_more, &selection_more); | 342 playlist_get_total_time(playlist_get_active(), &total, &selection, &total_more, &selection_more); |
343 | 343 |
344 if (selection > 0 || (selection == 0 && !selection_more)) { | 344 if (selection > 0 || (selection == 0 && !selection_more)) { |
345 if (selection > 3600) | 345 if (selection > 3600) |
346 sel_text = | 346 sel_text = |
347 g_strdup_printf("%lu:%-2.2lu:%-2.2lu%s", selection / 3600, | 347 g_strdup_printf("%lu:%-2.2lu:%-2.2lu%s", selection / 3600, |
377 static void | 377 static void |
378 playlistwin_update_sinfo(void) | 378 playlistwin_update_sinfo(void) |
379 { | 379 { |
380 gchar *posstr, *timestr, *title, *info; | 380 gchar *posstr, *timestr, *title, *info; |
381 gint pos, time; | 381 gint pos, time; |
382 | 382 Playlist *playlist = playlist_get_active(); |
383 pos = playlist_get_position(); | 383 |
384 title = playlist_get_songtitle(pos); | 384 pos = playlist_get_position(playlist); |
385 title = playlist_get_songtitle(playlist, pos); | |
385 | 386 |
386 if (!title) { | 387 if (!title) { |
387 textbox_set_text(playlistwin_sinfo, ""); | 388 textbox_set_text(playlistwin_sinfo, ""); |
388 return; | 389 return; |
389 } | 390 } |
390 | 391 |
391 convert_title_text(title); | 392 convert_title_text(title); |
392 | 393 |
393 time = playlist_get_songtime(pos); | 394 time = playlist_get_songtime(playlist, pos); |
394 | 395 |
395 if (cfg.show_numbers_in_pl) | 396 if (cfg.show_numbers_in_pl) |
396 posstr = g_strdup_printf("%d. ", pos + 1); | 397 posstr = g_strdup_printf("%d. ", pos + 1); |
397 else | 398 else |
398 posstr = g_strdup(""); | 399 posstr = g_strdup(""); |
654 } | 655 } |
655 | 656 |
656 static void | 657 static void |
657 playlistwin_select_all(void) | 658 playlistwin_select_all(void) |
658 { | 659 { |
659 playlist_select_all(TRUE); | 660 Playlist *playlist = playlist_get_active(); |
661 | |
662 playlist_select_all(playlist, TRUE); | |
660 playlistwin_list->pl_prev_selected = 0; | 663 playlistwin_list->pl_prev_selected = 0; |
661 playlistwin_list->pl_prev_min = 0; | 664 playlistwin_list->pl_prev_min = 0; |
662 playlistwin_list->pl_prev_max = playlist_get_length() - 1; | 665 playlistwin_list->pl_prev_max = playlist_get_length(playlist) - 1; |
663 playlistwin_update_list(); | 666 playlistwin_update_list(); |
664 } | 667 } |
665 | 668 |
666 static void | 669 static void |
667 playlistwin_select_none(void) | 670 playlistwin_select_none(void) |
668 { | 671 { |
669 playlist_select_all(FALSE); | 672 playlist_select_all(playlist_get_active(), FALSE); |
670 playlistwin_list->pl_prev_selected = -1; | 673 playlistwin_list->pl_prev_selected = -1; |
671 playlistwin_list->pl_prev_min = -1; | 674 playlistwin_list->pl_prev_min = -1; |
672 playlistwin_update_list(); | 675 playlistwin_update_list(); |
673 } | 676 } |
674 | 677 |
675 static void | 678 static void |
676 playlistwin_inverse_selection(void) | 679 playlistwin_inverse_selection(void) |
677 { | 680 { |
678 playlist_select_invert_all(); | 681 playlist_select_invert_all(playlist_get_active()); |
679 playlistwin_list->pl_prev_selected = -1; | 682 playlistwin_list->pl_prev_selected = -1; |
680 playlistwin_list->pl_prev_min = -1; | 683 playlistwin_list->pl_prev_min = -1; |
681 playlistwin_update_list(); | 684 playlistwin_update_list(); |
682 } | 685 } |
683 | 686 |
791 #endif | 794 #endif |
792 | 795 |
793 static void | 796 static void |
794 playlistwin_fileinfo(void) | 797 playlistwin_fileinfo(void) |
795 { | 798 { |
799 Playlist *playlist = playlist_get_active(); | |
800 | |
796 /* Show the first selected file, or the current file if nothing is | 801 /* Show the first selected file, or the current file if nothing is |
797 * selected */ | 802 * selected */ |
798 GList *list = playlist_get_selected(); | 803 GList *list = playlist_get_selected(playlist); |
799 if (list) { | 804 if (list) { |
800 playlist_fileinfo(GPOINTER_TO_INT(list->data)); | 805 playlist_fileinfo(playlist, GPOINTER_TO_INT(list->data)); |
801 g_list_free(list); | 806 g_list_free(list); |
802 } | 807 } |
803 else | 808 else |
804 playlist_fileinfo_current(); | 809 playlist_fileinfo_current(playlist); |
805 } | 810 } |
806 | 811 |
807 static void | 812 static void |
808 menu_set_item_sensitive(GtkItemFactory * item_factory, | 813 menu_set_item_sensitive(GtkItemFactory * item_factory, |
809 const gchar * path, | 814 const gchar * path, |
815 | 820 |
816 /* FIXME: broken */ | 821 /* FIXME: broken */ |
817 static void | 822 static void |
818 playlistwin_set_sensitive_sortmenu(void) | 823 playlistwin_set_sensitive_sortmenu(void) |
819 { | 824 { |
820 gboolean set = playlist_get_num_selected() > 1; | 825 gboolean set = playlist_get_num_selected(playlist_get_active()) > 1; |
821 menu_set_item_sensitive(plsort_menu, "/Sort Selection/By Title", set); | 826 menu_set_item_sensitive(plsort_menu, "/Sort Selection/By Title", set); |
822 menu_set_item_sensitive(plsort_menu, "/Sort Selection/By Filename", set); | 827 menu_set_item_sensitive(plsort_menu, "/Sort Selection/By Filename", set); |
823 menu_set_item_sensitive(plsort_menu, "/Sort Selection/By Path + Filename", set); | 828 menu_set_item_sensitive(plsort_menu, "/Sort Selection/By Path + Filename", set); |
824 menu_set_item_sensitive(plsort_menu, "/Sort Selection/By Date", set); | 829 menu_set_item_sensitive(plsort_menu, "/Sort Selection/By Date", set); |
825 } | 830 } |
907 | 912 |
908 if (g_file_test(filename, G_FILE_TEST_IS_REGULAR)) | 913 if (g_file_test(filename, G_FILE_TEST_IS_REGULAR)) |
909 if (!show_playlist_overwrite_prompt(GTK_WINDOW(playlistwin), filename)) | 914 if (!show_playlist_overwrite_prompt(GTK_WINDOW(playlistwin), filename)) |
910 return; | 915 return; |
911 | 916 |
912 if (!playlist_save(filename)) | 917 if (!playlist_save(playlist_get_active(), filename)) |
913 show_playlist_save_error(GTK_WINDOW(playlistwin), filename); | 918 show_playlist_save_error(GTK_WINDOW(playlistwin), filename); |
914 } | 919 } |
915 | 920 |
916 #if 0 | 921 #if 0 |
917 static void | 922 static void |
927 #endif | 932 #endif |
928 | 933 |
929 static void | 934 static void |
930 playlistwin_load_playlist(const gchar * filename) | 935 playlistwin_load_playlist(const gchar * filename) |
931 { | 936 { |
937 Playlist *playlist = playlist_get_active(); | |
938 | |
932 g_return_if_fail(filename != NULL); | 939 g_return_if_fail(filename != NULL); |
933 | 940 |
934 str_replace_in(&cfg.playlist_path, g_strdup(filename)); | 941 str_replace_in(&cfg.playlist_path, g_strdup(filename)); |
935 | 942 |
936 playlist_clear(); | 943 playlist_clear(playlist); |
937 mainwin_clear_song_info(); | 944 mainwin_clear_song_info(); |
938 mainwin_set_info_text(); | 945 mainwin_set_info_text(); |
939 | 946 |
940 playlist_load(filename); | 947 playlist_load(playlist, filename); |
941 playlist_set_current_name(filename); | 948 playlist_set_current_name(playlist, filename); |
942 } | 949 } |
943 | 950 |
944 static gchar * | 951 static gchar * |
945 playlist_file_selection_load(const gchar * title, | 952 playlist_file_selection_load(const gchar * title, |
946 const gchar * default_filename) | 953 const gchar * default_filename) |
1320 | 1327 |
1321 static void | 1328 static void |
1322 playlistwin_keypress_up_down_handler(PlayList_List * pl, | 1329 playlistwin_keypress_up_down_handler(PlayList_List * pl, |
1323 gboolean up, guint state) | 1330 gboolean up, guint state) |
1324 { | 1331 { |
1332 Playlist *playlist = playlist_get_active(); | |
1333 | |
1325 if ((state & GDK_MOD1_MASK) && (state & GDK_SHIFT_MASK)) | 1334 if ((state & GDK_MOD1_MASK) && (state & GDK_SHIFT_MASK)) |
1326 return; | 1335 return; |
1327 if (!(state & GDK_MOD1_MASK)) | 1336 if (!(state & GDK_MOD1_MASK)) |
1328 playlist_select_all(FALSE); | 1337 playlist_select_all(playlist, FALSE); |
1329 | 1338 |
1330 if (pl->pl_prev_selected == -1 || | 1339 if (pl->pl_prev_selected == -1 || |
1331 (!playlistwin_item_visible(pl->pl_prev_selected) && | 1340 (!playlistwin_item_visible(pl->pl_prev_selected) && |
1332 !(state & GDK_SHIFT_MASK && pl->pl_prev_min != -1))) { | 1341 !(state & GDK_SHIFT_MASK && pl->pl_prev_min != -1))) { |
1333 pl->pl_prev_selected = pl->pl_first; | 1342 pl->pl_prev_selected = pl->pl_first; |
1337 pl->pl_prev_max = pl->pl_prev_selected; | 1346 pl->pl_prev_max = pl->pl_prev_selected; |
1338 pl->pl_prev_min = pl->pl_prev_selected; | 1347 pl->pl_prev_min = pl->pl_prev_selected; |
1339 } | 1348 } |
1340 pl->pl_prev_max += (up ? -1 : 1); | 1349 pl->pl_prev_max += (up ? -1 : 1); |
1341 pl->pl_prev_max = | 1350 pl->pl_prev_max = |
1342 CLAMP(pl->pl_prev_max, 0, playlist_get_length() - 1); | 1351 CLAMP(pl->pl_prev_max, 0, playlist_get_length(playlist) - 1); |
1343 | 1352 |
1344 pl->pl_first = MIN(pl->pl_first, pl->pl_prev_max); | 1353 pl->pl_first = MIN(pl->pl_first, pl->pl_prev_max); |
1345 pl->pl_first = MAX(pl->pl_first, pl->pl_prev_max - | 1354 pl->pl_first = MAX(pl->pl_first, pl->pl_prev_max - |
1346 pl->pl_num_visible + 1); | 1355 pl->pl_num_visible + 1); |
1347 playlist_select_range(pl->pl_prev_min, pl->pl_prev_max, TRUE); | 1356 playlist_select_range(playlist, pl->pl_prev_min, pl->pl_prev_max, TRUE); |
1348 return; | 1357 return; |
1349 } | 1358 } |
1350 else if (state & GDK_MOD1_MASK) { | 1359 else if (state & GDK_MOD1_MASK) { |
1351 if (up) | 1360 if (up) |
1352 playlist_list_move_up(pl); | 1361 playlist_list_move_up(pl); |
1362 pl->pl_prev_selected--; | 1371 pl->pl_prev_selected--; |
1363 else | 1372 else |
1364 pl->pl_prev_selected++; | 1373 pl->pl_prev_selected++; |
1365 | 1374 |
1366 pl->pl_prev_selected = | 1375 pl->pl_prev_selected = |
1367 CLAMP(pl->pl_prev_selected, 0, playlist_get_length() - 1); | 1376 CLAMP(pl->pl_prev_selected, 0, playlist_get_length(playlist) - 1); |
1368 | 1377 |
1369 if (pl->pl_prev_selected < pl->pl_first) | 1378 if (pl->pl_prev_selected < pl->pl_first) |
1370 pl->pl_first--; | 1379 pl->pl_first--; |
1371 else if (pl->pl_prev_selected >= (pl->pl_first + pl->pl_num_visible)) | 1380 else if (pl->pl_prev_selected >= (pl->pl_first + pl->pl_num_visible)) |
1372 pl->pl_first++; | 1381 pl->pl_first++; |
1373 | 1382 |
1374 playlist_select_range(pl->pl_prev_selected, pl->pl_prev_selected, TRUE); | 1383 playlist_select_range(playlist, pl->pl_prev_selected, pl->pl_prev_selected, TRUE); |
1375 pl->pl_prev_min = -1; | 1384 pl->pl_prev_min = -1; |
1376 | |
1377 } | 1385 } |
1378 | 1386 |
1379 /* FIXME: Handle the keys through menu */ | 1387 /* FIXME: Handle the keys through menu */ |
1380 | 1388 |
1381 static gboolean | 1389 static gboolean |
1382 playlistwin_keypress(GtkWidget * w, GdkEventKey * event, gpointer data) | 1390 playlistwin_keypress(GtkWidget * w, GdkEventKey * event, gpointer data) |
1383 { | 1391 { |
1392 Playlist *playlist = playlist_get_active(); | |
1393 | |
1384 guint keyval; | 1394 guint keyval; |
1385 gboolean refresh = FALSE; | 1395 gboolean refresh = FALSE; |
1386 | 1396 |
1387 if (cfg.playlist_shaded) | 1397 if (cfg.playlist_shaded) |
1388 return FALSE; | 1398 return FALSE; |
1410 playlistwin_list->pl_first = 0; | 1420 playlistwin_list->pl_first = 0; |
1411 refresh = TRUE; | 1421 refresh = TRUE; |
1412 break; | 1422 break; |
1413 case GDK_End: | 1423 case GDK_End: |
1414 playlistwin_list->pl_first = | 1424 playlistwin_list->pl_first = |
1415 playlist_get_length() - playlistwin_list->pl_num_visible; | 1425 playlist_get_length(playlist) - playlistwin_list->pl_num_visible; |
1416 refresh = TRUE; | 1426 refresh = TRUE; |
1417 break; | 1427 break; |
1418 case GDK_Return: | 1428 case GDK_Return: |
1419 if (playlistwin_list->pl_prev_selected > -1 | 1429 if (playlistwin_list->pl_prev_selected > -1 |
1420 && playlistwin_item_visible(playlistwin_list->pl_prev_selected)) { | 1430 && playlistwin_item_visible(playlistwin_list->pl_prev_selected)) { |
1421 playlist_set_position(playlistwin_list->pl_prev_selected); | 1431 playlist_set_position(playlist, playlistwin_list->pl_prev_selected); |
1422 if (!bmp_playback_get_playing()) | 1432 if (!bmp_playback_get_playing()) |
1423 bmp_playback_initiate(); | 1433 bmp_playback_initiate(); |
1424 } | 1434 } |
1425 break; | 1435 break; |
1426 case GDK_3: | 1436 case GDK_3: |
1427 if (event->state & GDK_CONTROL_MASK) | 1437 if (event->state & GDK_CONTROL_MASK) |
1428 playlistwin_fileinfo(); | 1438 playlistwin_fileinfo(); |
1429 break; | 1439 break; |
1430 case GDK_Delete: | 1440 case GDK_Delete: |
1431 if (event->state & GDK_CONTROL_MASK) | 1441 if (event->state & GDK_CONTROL_MASK) |
1432 playlist_delete(TRUE); | 1442 playlist_delete(playlist, TRUE); |
1433 else | 1443 else |
1434 playlist_delete(FALSE); | 1444 playlist_delete(playlist, FALSE); |
1435 break; | 1445 break; |
1436 case GDK_Insert: | 1446 case GDK_Insert: |
1437 if (event->state & GDK_MOD1_MASK) | 1447 if (event->state & GDK_MOD1_MASK) |
1438 mainwin_show_add_url_window(); | 1448 mainwin_show_add_url_window(); |
1439 else | 1449 else |
1440 playlistwin_show_filebrowser(); | 1450 playlistwin_show_filebrowser(); |
1441 break; | 1451 break; |
1442 case GDK_Left: | 1452 case GDK_Left: |
1443 case GDK_KP_Left: | 1453 case GDK_KP_Left: |
1444 case GDK_KP_7: | 1454 case GDK_KP_7: |
1445 if (playlist_get_current_length() != -1) | 1455 if (playlist_get_current_length(playlist) != -1) |
1446 bmp_playback_seek(CLAMP | 1456 bmp_playback_seek(CLAMP |
1447 (bmp_playback_get_time() - 5000, 0, | 1457 (bmp_playback_get_time() - 5000, 0, |
1448 playlist_get_current_length()) / 1000); | 1458 playlist_get_current_length(playlist)) / 1000); |
1449 break; | 1459 break; |
1450 case GDK_Right: | 1460 case GDK_Right: |
1451 case GDK_KP_Right: | 1461 case GDK_KP_Right: |
1452 case GDK_KP_9: | 1462 case GDK_KP_9: |
1453 if (playlist_get_current_length() != -1) | 1463 if (playlist_get_current_length(playlist) != -1) |
1454 bmp_playback_seek(CLAMP | 1464 bmp_playback_seek(CLAMP |
1455 (bmp_playback_get_time() + 5000, 0, | 1465 (bmp_playback_get_time() + 5000, 0, |
1456 playlist_get_current_length()) / 1000); | 1466 playlist_get_current_length(playlist)) / 1000); |
1457 break; | 1467 break; |
1458 case GDK_KP_4: | 1468 case GDK_KP_4: |
1459 playlist_prev(); | 1469 playlist_prev(playlist); |
1460 break; | 1470 break; |
1461 case GDK_KP_6: | 1471 case GDK_KP_6: |
1462 playlist_next(); | 1472 playlist_next(playlist); |
1463 break; | 1473 break; |
1464 | 1474 |
1465 case GDK_Escape: | 1475 case GDK_Escape: |
1466 mainwin_minimize_cb(); | 1476 mainwin_minimize_cb(); |
1467 break; | 1477 break; |
1597 GtkSelectionData * | 1607 GtkSelectionData * |
1598 selection_data, guint info, | 1608 selection_data, guint info, |
1599 guint time, gpointer user_data) | 1609 guint time, gpointer user_data) |
1600 { | 1610 { |
1601 gint pos; | 1611 gint pos; |
1612 Playlist *playlist = playlist_get_active(); | |
1602 | 1613 |
1603 g_return_if_fail(selection_data != NULL); | 1614 g_return_if_fail(selection_data != NULL); |
1604 | 1615 |
1605 if (!selection_data->data) { | 1616 if (!selection_data->data) { |
1606 g_message("Received no DND data!"); | 1617 g_message("Received no DND data!"); |
1609 | 1620 |
1610 if (widget_contains(WIDGET(playlistwin_list), x, y)) { | 1621 if (widget_contains(WIDGET(playlistwin_list), x, y)) { |
1611 pos = (y - WIDGET(playlistwin_list)->y) / | 1622 pos = (y - WIDGET(playlistwin_list)->y) / |
1612 playlistwin_list->pl_fheight + playlistwin_list->pl_first; | 1623 playlistwin_list->pl_fheight + playlistwin_list->pl_first; |
1613 | 1624 |
1614 pos = MIN(pos, playlist_get_length()); | 1625 pos = MIN(pos, playlist_get_length(playlist)); |
1615 playlist_ins_url((gchar *) selection_data->data, pos); | 1626 playlist_ins_url(playlist, (gchar *) selection_data->data, pos); |
1616 } | 1627 } |
1617 else | 1628 else |
1618 playlist_add_url((gchar *) selection_data->data); | 1629 playlist_add_url(playlist, (gchar *) selection_data->data); |
1630 } | |
1631 | |
1632 static void | |
1633 local_playlist_prev(void) | |
1634 { | |
1635 playlist_prev(playlist_get_active()); | |
1636 } | |
1637 | |
1638 static void | |
1639 local_playlist_next(void) | |
1640 { | |
1641 playlist_next(playlist_get_active()); | |
1619 } | 1642 } |
1620 | 1643 |
1621 static void | 1644 static void |
1622 playlistwin_create_widgets(void) | 1645 playlistwin_create_widgets(void) |
1623 { | 1646 { |
1694 | 1717 |
1695 /* rewind button */ | 1718 /* rewind button */ |
1696 playlistwin_srew = | 1719 playlistwin_srew = |
1697 create_sbutton(&playlistwin_wlist, playlistwin_bg, playlistwin_gc, | 1720 create_sbutton(&playlistwin_wlist, playlistwin_bg, playlistwin_gc, |
1698 playlistwin_get_width() - 144, | 1721 playlistwin_get_width() - 144, |
1699 cfg.playlist_height - 16, 8, 7, playlist_prev); | 1722 cfg.playlist_height - 16, 8, 7, local_playlist_prev); |
1700 | 1723 |
1701 /* play button */ | 1724 /* play button */ |
1702 playlistwin_splay = | 1725 playlistwin_splay = |
1703 create_sbutton(&playlistwin_wlist, playlistwin_bg, playlistwin_gc, | 1726 create_sbutton(&playlistwin_wlist, playlistwin_bg, playlistwin_gc, |
1704 playlistwin_get_width() - 138, | 1727 playlistwin_get_width() - 138, |
1718 | 1741 |
1719 /* forward button */ | 1742 /* forward button */ |
1720 playlistwin_sfwd = | 1743 playlistwin_sfwd = |
1721 create_sbutton(&playlistwin_wlist, playlistwin_bg, playlistwin_gc, | 1744 create_sbutton(&playlistwin_wlist, playlistwin_bg, playlistwin_gc, |
1722 playlistwin_get_width() - 109, | 1745 playlistwin_get_width() - 109, |
1723 cfg.playlist_height - 16, 8, 7, playlist_next); | 1746 cfg.playlist_height - 16, 8, 7, local_playlist_next); |
1724 | 1747 |
1725 /* eject button */ | 1748 /* eject button */ |
1726 playlistwin_seject = | 1749 playlistwin_seject = |
1727 create_sbutton(&playlistwin_wlist, playlistwin_bg, playlistwin_gc, | 1750 create_sbutton(&playlistwin_wlist, playlistwin_bg, playlistwin_gc, |
1728 playlistwin_get_width() - 100, | 1751 playlistwin_get_width() - 100, |
1746 selection_received(GtkWidget * widget, | 1769 selection_received(GtkWidget * widget, |
1747 GtkSelectionData * selection_data, gpointer data) | 1770 GtkSelectionData * selection_data, gpointer data) |
1748 { | 1771 { |
1749 if (selection_data->type == GDK_SELECTION_TYPE_STRING && | 1772 if (selection_data->type == GDK_SELECTION_TYPE_STRING && |
1750 selection_data->length > 0) | 1773 selection_data->length > 0) |
1751 playlist_add_url((gchar *) selection_data->data); | 1774 playlist_add_url(playlist_get_active(), (gchar *) selection_data->data); |
1752 } | 1775 } |
1753 | 1776 |
1754 static void | 1777 static void |
1755 playlistwin_create_window(void) | 1778 playlistwin_create_window(void) |
1756 { | 1779 { |
1902 | 1925 |
1903 tbutton_set_toggled(mainwin_pl, TRUE); | 1926 tbutton_set_toggled(mainwin_pl, TRUE); |
1904 cfg.playlist_visible = TRUE; | 1927 cfg.playlist_visible = TRUE; |
1905 | 1928 |
1906 playlistwin_set_toprow(0); | 1929 playlistwin_set_toprow(0); |
1907 playlist_check_pos_current(); | 1930 playlist_check_pos_current(playlist_get_active()); |
1908 | 1931 |
1909 gtk_widget_show(playlistwin); | 1932 gtk_widget_show(playlistwin); |
1910 } | 1933 } |
1911 | 1934 |
1912 void | 1935 void |
1930 static void | 1953 static void |
1931 plsort_menu_callback(gpointer data, | 1954 plsort_menu_callback(gpointer data, |
1932 guint action, | 1955 guint action, |
1933 GtkWidget * widget) | 1956 GtkWidget * widget) |
1934 { | 1957 { |
1958 Playlist *playlist = playlist_get_active(); | |
1959 | |
1935 switch (action) { | 1960 switch (action) { |
1936 case PLAYLISTWIN_SORT_BYPLAYLIST: | 1961 case PLAYLISTWIN_SORT_BYPLAYLIST: |
1937 playlist_sort(PLAYLIST_SORT_PLAYLIST); | 1962 playlist_sort(playlist, PLAYLIST_SORT_PLAYLIST); |
1938 playlistwin_update_list(); | 1963 playlistwin_update_list(); |
1939 break; | 1964 break; |
1940 case PLAYLISTWIN_SORT_BYTRACK: | 1965 case PLAYLISTWIN_SORT_BYTRACK: |
1941 playlist_sort(PLAYLIST_SORT_TRACK); | 1966 playlist_sort(playlist, PLAYLIST_SORT_TRACK); |
1942 playlistwin_update_list(); | 1967 playlistwin_update_list(); |
1943 break; | 1968 break; |
1944 case PLAYLISTWIN_SORT_BYTITLE: | 1969 case PLAYLISTWIN_SORT_BYTITLE: |
1945 playlist_sort(PLAYLIST_SORT_TITLE); | 1970 playlist_sort(playlist, PLAYLIST_SORT_TITLE); |
1946 playlistwin_update_list(); | 1971 playlistwin_update_list(); |
1947 break; | 1972 break; |
1948 case PLAYLISTWIN_SORT_BYARTIST: | 1973 case PLAYLISTWIN_SORT_BYARTIST: |
1949 playlist_sort(PLAYLIST_SORT_ARTIST); | 1974 playlist_sort(playlist, PLAYLIST_SORT_ARTIST); |
1950 playlistwin_update_list(); | 1975 playlistwin_update_list(); |
1951 break; | 1976 break; |
1952 case PLAYLISTWIN_SORT_BYPATH: | 1977 case PLAYLISTWIN_SORT_BYPATH: |
1953 playlist_sort(PLAYLIST_SORT_PATH); | 1978 playlist_sort(playlist, PLAYLIST_SORT_PATH); |
1954 playlistwin_update_list(); | 1979 playlistwin_update_list(); |
1955 break; | 1980 break; |
1956 case PLAYLISTWIN_SORT_BYDATE: | 1981 case PLAYLISTWIN_SORT_BYDATE: |
1957 playlist_sort(PLAYLIST_SORT_DATE); | 1982 playlist_sort(playlist, PLAYLIST_SORT_DATE); |
1958 playlistwin_update_list(); | 1983 playlistwin_update_list(); |
1959 break; | 1984 break; |
1960 case PLAYLISTWIN_SORT_BYFILENAME: | 1985 case PLAYLISTWIN_SORT_BYFILENAME: |
1961 playlist_sort(PLAYLIST_SORT_FILENAME); | 1986 playlist_sort(playlist, PLAYLIST_SORT_FILENAME); |
1962 playlistwin_update_list(); | 1987 playlistwin_update_list(); |
1963 break; | 1988 break; |
1964 case PLAYLISTWIN_SORT_SEL_BYPLAYLIST: | 1989 case PLAYLISTWIN_SORT_SEL_BYPLAYLIST: |
1965 playlist_sort_selected(PLAYLIST_SORT_PLAYLIST); | 1990 playlist_sort_selected(playlist, PLAYLIST_SORT_PLAYLIST); |
1966 playlistwin_update_list(); | 1991 playlistwin_update_list(); |
1967 break; | 1992 break; |
1968 case PLAYLISTWIN_SORT_SEL_BYTRACK: | 1993 case PLAYLISTWIN_SORT_SEL_BYTRACK: |
1969 playlist_sort_selected(PLAYLIST_SORT_TRACK); | 1994 playlist_sort_selected(playlist, PLAYLIST_SORT_TRACK); |
1970 playlistwin_update_list(); | 1995 playlistwin_update_list(); |
1971 break; | 1996 break; |
1972 case PLAYLISTWIN_SORT_SEL_BYTITLE: | 1997 case PLAYLISTWIN_SORT_SEL_BYTITLE: |
1973 playlist_sort_selected(PLAYLIST_SORT_TITLE); | 1998 playlist_sort_selected(playlist, PLAYLIST_SORT_TITLE); |
1974 playlistwin_update_list(); | 1999 playlistwin_update_list(); |
1975 break; | 2000 break; |
1976 case PLAYLISTWIN_SORT_SEL_BYARTIST: | 2001 case PLAYLISTWIN_SORT_SEL_BYARTIST: |
1977 playlist_sort_selected(PLAYLIST_SORT_ARTIST); | 2002 playlist_sort_selected(playlist, PLAYLIST_SORT_ARTIST); |
1978 playlistwin_update_list(); | 2003 playlistwin_update_list(); |
1979 break; | 2004 break; |
1980 case PLAYLISTWIN_SORT_SEL_BYFILENAME: | 2005 case PLAYLISTWIN_SORT_SEL_BYFILENAME: |
1981 playlist_sort_selected(PLAYLIST_SORT_FILENAME); | 2006 playlist_sort_selected(playlist, PLAYLIST_SORT_FILENAME); |
1982 playlistwin_update_list(); | 2007 playlistwin_update_list(); |
1983 break; | 2008 break; |
1984 case PLAYLISTWIN_SORT_SEL_BYPATH: | 2009 case PLAYLISTWIN_SORT_SEL_BYPATH: |
1985 playlist_sort_selected(PLAYLIST_SORT_PATH); | 2010 playlist_sort_selected(playlist, PLAYLIST_SORT_PATH); |
1986 playlistwin_update_list(); | 2011 playlistwin_update_list(); |
1987 break; | 2012 break; |
1988 case PLAYLISTWIN_SORT_SEL_BYDATE: | 2013 case PLAYLISTWIN_SORT_SEL_BYDATE: |
1989 playlist_sort_selected(PLAYLIST_SORT_DATE); | 2014 playlist_sort_selected(playlist, PLAYLIST_SORT_DATE); |
1990 playlistwin_update_list(); | 2015 playlistwin_update_list(); |
1991 break; | 2016 break; |
1992 case PLAYLISTWIN_SORT_REVERSE: | 2017 case PLAYLISTWIN_SORT_REVERSE: |
1993 playlist_reverse(); | 2018 playlist_reverse(playlist); |
1994 playlistwin_update_list(); | 2019 playlistwin_update_list(); |
1995 break; | 2020 break; |
1996 case PLAYLISTWIN_SORT_RANDOMIZE: | 2021 case PLAYLISTWIN_SORT_RANDOMIZE: |
1997 playlist_random(); | 2022 playlist_random(playlist); |
1998 playlistwin_update_list(); | 2023 playlistwin_update_list(); |
1999 break; | 2024 break; |
2000 } | 2025 } |
2001 } | 2026 } |
2002 | 2027 |
2003 static void | 2028 static void |
2004 playlistwin_sub_menu_callback(gpointer data, | 2029 playlistwin_sub_menu_callback(gpointer data, |
2005 guint action, | 2030 guint action, |
2006 GtkWidget * widget) | 2031 GtkWidget * widget) |
2007 { | 2032 { |
2033 Playlist *playlist = playlist_get_active(); | |
2034 | |
2008 switch (action) { | 2035 switch (action) { |
2009 case PLIST_NEW: | 2036 case PLIST_NEW: |
2010 playlist_set_current_name(NULL); | 2037 playlist_set_current_name(playlist, NULL); |
2011 playlist_clear(); | 2038 playlist_clear(playlist); |
2012 mainwin_clear_song_info(); | 2039 mainwin_clear_song_info(); |
2013 mainwin_set_info_text(); | 2040 mainwin_set_info_text(); |
2014 break; | 2041 break; |
2015 case PLIST_SAVE: | 2042 case PLIST_SAVE: |
2016 playlistwin_select_playlist_to_save(playlist_get_current_name()); | 2043 playlistwin_select_playlist_to_save(playlist_get_current_name(playlist)); |
2017 break; | 2044 break; |
2018 case PLIST_DEFAULTSAVE: | 2045 case PLIST_DEFAULTSAVE: |
2019 playlist_save(bmp_paths[BMP_PATH_PLAYLIST_FILE]); | 2046 playlist_save(playlist, bmp_paths[BMP_PATH_PLAYLIST_FILE]); |
2020 break; | 2047 break; |
2021 case PLIST_SAVE_AS: | 2048 case PLIST_SAVE_AS: |
2022 playlistwin_select_playlist_to_save(playlist_get_current_name()); | 2049 playlistwin_select_playlist_to_save(playlist_get_current_name(playlist)); |
2023 break; | 2050 break; |
2024 case PLIST_LOAD: | 2051 case PLIST_LOAD: |
2025 playlistwin_select_playlist_to_load(playlist_get_current_name()); | 2052 playlistwin_select_playlist_to_load(playlist_get_current_name(playlist)); |
2026 break; | 2053 break; |
2027 case SEL_INV: | 2054 case SEL_INV: |
2028 playlistwin_inverse_selection(); | 2055 playlistwin_inverse_selection(); |
2029 break; | 2056 break; |
2030 case SEL_ZERO: | 2057 case SEL_ZERO: |
2032 break; | 2059 break; |
2033 case SEL_ALL: | 2060 case SEL_ALL: |
2034 playlistwin_select_all(); | 2061 playlistwin_select_all(); |
2035 break; | 2062 break; |
2036 case SUB_ALL: | 2063 case SUB_ALL: |
2037 playlist_clear(); | 2064 playlist_clear(playlist); |
2038 mainwin_clear_song_info(); | 2065 mainwin_clear_song_info(); |
2039 mainwin_set_info_text(); | 2066 mainwin_set_info_text(); |
2040 break; | 2067 break; |
2041 case SUB_CROP: | 2068 case SUB_CROP: |
2042 playlist_delete(TRUE); | 2069 playlist_delete(playlist, TRUE); |
2043 break; | 2070 break; |
2044 case SUB_SELECTED: | 2071 case SUB_SELECTED: |
2045 playlist_delete(FALSE); | 2072 playlist_delete(playlist, FALSE); |
2046 break; | 2073 break; |
2047 case SUB_DUPLICATE_BYTITLE: | 2074 case SUB_DUPLICATE_BYTITLE: |
2048 playlist_remove_duplicates(PLAYLIST_DUPS_TITLE); | 2075 playlist_remove_duplicates(playlist, PLAYLIST_DUPS_TITLE); |
2049 break; | 2076 break; |
2050 case SUB_DUPLICATE_BYFILENAME: | 2077 case SUB_DUPLICATE_BYFILENAME: |
2051 playlist_remove_duplicates(PLAYLIST_DUPS_FILENAME); | 2078 playlist_remove_duplicates(playlist, PLAYLIST_DUPS_FILENAME); |
2052 break; | 2079 break; |
2053 case SUB_DUPLICATE_BYPATH: | 2080 case SUB_DUPLICATE_BYPATH: |
2054 playlist_remove_duplicates(PLAYLIST_DUPS_PATH); | 2081 playlist_remove_duplicates(playlist, PLAYLIST_DUPS_PATH); |
2055 break; | 2082 break; |
2056 case PLAYLISTWIN_REMOVE_DEAD_FILES: | 2083 case PLAYLISTWIN_REMOVE_DEAD_FILES: |
2057 playlist_remove_dead_files(); | 2084 playlist_remove_dead_files(playlist); |
2058 break; | 2085 break; |
2059 case PLAYLISTWIN_REFRESH: | 2086 case PLAYLISTWIN_REFRESH: |
2060 playlist_read_info_selection(); | 2087 playlist_read_info_selection(playlist); |
2061 playlistwin_update_list(); | 2088 playlistwin_update_list(); |
2062 break; | 2089 break; |
2063 } | 2090 } |
2064 } | 2091 } |
2065 | 2092 |
2067 playlistwin_popup_menu_callback(gpointer data, | 2094 playlistwin_popup_menu_callback(gpointer data, |
2068 guint action, | 2095 guint action, |
2069 GtkWidget * widget) | 2096 GtkWidget * widget) |
2070 { | 2097 { |
2071 extern GtkWidget *filepopupbutton; | 2098 extern GtkWidget *filepopupbutton; |
2099 Playlist *playlist = playlist_get_active(); | |
2072 | 2100 |
2073 switch (action) { | 2101 switch (action) { |
2074 case ADD_FILES: | 2102 case ADD_FILES: |
2075 playlistwin_show_filebrowser(); | 2103 playlistwin_show_filebrowser(); |
2076 break; | 2104 break; |
2079 break; | 2107 break; |
2080 case MISC_FILEINFO: | 2108 case MISC_FILEINFO: |
2081 playlistwin_fileinfo(); | 2109 playlistwin_fileinfo(); |
2082 break; | 2110 break; |
2083 case SEL_LOOKUP: | 2111 case SEL_LOOKUP: |
2084 playlist_read_info_selection(); | 2112 playlist_read_info_selection(playlist); |
2085 break; | 2113 break; |
2086 case MISC_QUEUE: | 2114 case MISC_QUEUE: |
2087 playlist_queue(); | 2115 playlist_queue(playlist); |
2088 break; | 2116 break; |
2089 case PLIST_CQUEUE: | 2117 case PLIST_CQUEUE: |
2090 playlist_clear_queue(); | 2118 playlist_clear_queue(playlist); |
2091 break; | 2119 break; |
2092 case PLIST_JTT: | 2120 case PLIST_JTT: |
2093 mainwin_jump_to_time(); | 2121 mainwin_jump_to_time(); |
2094 break; | 2122 break; |
2095 case PLIST_JTF: | 2123 case PLIST_JTF: |