comparison src/audacious/main.c @ 4449:19e3f3c5fe7f

introduce function aud_quit(), which is basically mainwin_quit_cb(), but is in main.c now because it is quite much the opposite of main() and should feel at home there.
author mf0102 <0102@gmx.at>
date Sat, 12 Apr 2008 19:24:55 +0200
parents 3dd13b275b4e
children 413d80f7b011
comparison
equal deleted inserted replaced
4448:3dd13b275b4e 4449:19e3f3c5fe7f
696 if (!dir_foreach(aud_paths[BMP_PATH_PLAYLISTS_DIR], load_extra_playlist, 696 if (!dir_foreach(aud_paths[BMP_PATH_PLAYLISTS_DIR], load_extra_playlist,
697 playlist, NULL)) 697 playlist, NULL))
698 g_warning("Could not load extra playlists\n"); 698 g_warning("Could not load extra playlists\n");
699 } 699 }
700 700
701 void
702 aud_quit(void)
703 {
704 GList *playlists = NULL, *playlists_top = NULL;
705
706 playlist_stop_get_info_thread();
707
708 if (options.headless == FALSE)
709 {
710 gtk_widget_hide(equalizerwin);
711 gtk_widget_hide(playlistwin);
712 gtk_widget_hide(mainwin);
713
714 gtk_accel_map_save(aud_paths[BMP_PATH_ACCEL_FILE]);
715 gtk_main_quit();
716
717 cleanup_skins();
718 }
719
720 aud_config_save();
721 plugin_system_cleanup();
722
723 /* free and clear each playlist */
724 playlists = playlist_get_playlists();
725 playlists_top = playlists;
726 while ( playlists != NULL )
727 {
728 playlist_clear((Playlist*)playlists->data);
729 playlist_free((Playlist*)playlists->data);
730 playlists = g_list_next(playlists);
731 }
732 g_list_free( playlists_top );
733
734 g_cond_free(cond_scan);
735 g_mutex_free(mutex_scan);
736
737 exit(EXIT_SUCCESS);
738 }
739
701 gint 740 gint
702 main(gint argc, gchar ** argv) 741 main(gint argc, gchar ** argv)
703 { 742 {
704 /* glib-2.13.0 requires g_thread_init() to be called before all 743 /* glib-2.13.0 requires g_thread_init() to be called before all
705 other GLib functions */ 744 other GLib functions */
844 loop = g_main_loop_new(NULL, TRUE); 883 loop = g_main_loop_new(NULL, TRUE);
845 g_timeout_add(10, aud_headless_iteration, NULL); 884 g_timeout_add(10, aud_headless_iteration, NULL);
846 g_main_loop_run(loop); 885 g_main_loop_run(loop);
847 } 886 }
848 887
849 g_cond_free(cond_scan); 888 aud_quit();
850 g_mutex_free(mutex_scan);
851
852 return EXIT_SUCCESS; 889 return EXIT_SUCCESS;
853 } 890 }