From: Eric W. <war...@us...> - 2001-10-23 04:05:54
|
Update of /cvsroot/gaim/gaim/src In directory usw-pr-cvs1:/tmp/cvs-serv14491/src Modified Files: gaim.h gaimrc.c prefs.c sound.c Log Message: run-time Index: gaim.h =================================================================== RCS file: /cvsroot/gaim/gaim/src/gaim.h,v retrieving revision 1.285 retrieving revision 1.286 diff -u -d -r1.285 -r1.286 --- gaim.h 2001/10/19 18:51:33 1.285 +++ gaim.h 2001/10/23 04:05:52 1.286 @@ -272,6 +272,10 @@ #define OPT_SOUND_BEEP 0x00000400 #define OPT_SOUND_CHAT_PART 0x00000800 #define OPT_SOUND_CHAT_YOU_SAY 0x00001000 +#define OPT_SOUND_NORMAL 0x00002000 +#define OPT_SOUND_NAS 0x00004000 +#define OPT_SOUND_ARTSC 0x00008000 +#define OPT_SOUND_ESD 0x00010000 #define BUDDY_ARRIVE 0 #define BUDDY_LEAVE 1 Index: gaimrc.c =================================================================== RCS file: /cvsroot/gaim/gaim/src/gaimrc.c,v retrieving revision 1.86 retrieving revision 1.87 diff -u -d -r1.86 -r1.87 --- gaimrc.c 2001/09/30 19:58:48 1.86 +++ gaimrc.c 2001/10/23 04:05:52 1.87 @@ -1006,12 +1006,18 @@ for (i = 0; i < 7; i++) sound_file[i] = NULL; font_options = 0; + /* Enable all of the sound players that might be available. The first + available one will be used. */ sound_options = OPT_SOUND_LOGIN | OPT_SOUND_LOGOUT | OPT_SOUND_RECV | OPT_SOUND_SEND | - OPT_SOUND_SILENT_SIGNON; + OPT_SOUND_SILENT_SIGNON | + OPT_SOUND_NORMAL | + OPT_SOUND_NAS | + OPT_SOUND_ARTSC | + OPT_SOUND_ESD; report_idle = IDLE_SCREENSAVER; web_browser = BROWSER_NETSCAPE; Index: prefs.c =================================================================== RCS file: /cvsroot/gaim/gaim/src/prefs.c,v retrieving revision 1.187 retrieving revision 1.188 diff -u -d -r1.187 -r1.188 --- prefs.c 2001/10/21 19:01:03 1.187 +++ prefs.c 2001/10/23 04:05:52 1.188 @@ -1483,6 +1483,14 @@ return TRUE; } +static void set_sound_driver(GtkWidget *w, int option) +{ + sound_options &= ~(OPT_SOUND_NORMAL | OPT_SOUND_BEEP | + OPT_SOUND_NAS | OPT_SOUND_ARTSC | OPT_SOUND_ESD); + sound_options |= option; + save_prefs(); +} + static void sound_page() { GtkWidget *parent; @@ -1493,6 +1501,10 @@ GtkWidget *hbox; GtkWidget *vbox2; GtkWidget *sep; + GtkWidget *omenu; + GtkWidget *menu; + GtkWidget *opt; + int i=1, driver=0; parent = prefdialog->parent; gtk_widget_destroy(prefdialog); @@ -1526,13 +1538,81 @@ gtk_widget_show(vbox2); gaim_button(_("No sounds when you log in"), &sound_options, OPT_SOUND_SILENT_SIGNON, vbox2); - gaim_button(_("Sounds while away"), &sound_options, OPT_SOUND_WHEN_AWAY, vbox2); vbox2 = gtk_vbox_new(FALSE, 5); gtk_box_pack_start(GTK_BOX(hbox), vbox2, TRUE, TRUE, 5); gtk_widget_show(vbox2); - gaim_button(_("Beep instead of playing sound"), &sound_options, OPT_SOUND_BEEP, vbox2); + gaim_button(_("Sounds while away"), &sound_options, OPT_SOUND_WHEN_AWAY, vbox2); + + sep = gtk_hseparator_new(); + gtk_box_pack_start(GTK_BOX(vbox), sep, FALSE, FALSE, 0); + gtk_widget_show(sep); + + hbox = gtk_hbox_new(TRUE, 5); + gtk_box_pack_start(GTK_BOX(vbox), hbox, FALSE, FALSE, 5); + gtk_widget_show(hbox); + + label = gtk_label_new(_("Sound Player:")); + gtk_box_pack_start(GTK_BOX(hbox), label, FALSE, FALSE, 5); + gtk_widget_show(label); + + omenu = gtk_option_menu_new(); + menu = gtk_menu_new(); + +#ifdef ESD_SOUND + opt = gtk_menu_item_new_with_label("ESD"); + gtk_signal_connect(GTK_OBJECT(opt), "activate", + GTK_SIGNAL_FUNC(set_sound_driver), + (gpointer)OPT_SOUND_ESD); + gtk_widget_show(opt); + gtk_menu_append(GTK_MENU(menu), opt); + if ((sound_options & OPT_SOUND_ESD) && !driver) driver = i; + i++; +#endif +#ifdef ARTSC_SOUND + opt = gtk_menu_item_new_with_label("ArtsC"); + gtk_signal_connect(GTK_OBJECT(opt), "activate", + GTK_SIGNAL_FUNC(set_sound_driver), + (gpointer)OPT_SOUND_ARTSC); + gtk_widget_show(opt); + gtk_menu_append(GTK_MENU(menu), opt); + if ((sound_options & OPT_SOUND_ARTSC) && !driver) driver = i; + i++; +#endif +#ifdef NAS_SOUND + opt = gtk_menu_item_new_with_label("NAS"); + gtk_signal_connect(GTK_OBJECT(opt), "activate", + GTK_SIGNAL_FUNC(set_sound_driver), + (gpointer)OPT_SOUND_NAS); + gtk_widget_show(opt); + gtk_menu_append(GTK_MENU(menu), opt); + if ((sound_options & OPT_SOUND_NAS) && !driver) driver = i; + i++; +#endif + + opt = gtk_menu_item_new_with_label("Native"); + gtk_signal_connect(GTK_OBJECT(opt), "activate", + GTK_SIGNAL_FUNC(set_sound_driver), + (gpointer)OPT_SOUND_NORMAL); + gtk_widget_show(opt); + gtk_menu_append(GTK_MENU(menu), opt); + if ((sound_options & OPT_SOUND_NORMAL) && !driver) driver = i; + i++; + + opt = gtk_menu_item_new_with_label("Console Beep"); + gtk_signal_connect(GTK_OBJECT(opt), "activate", + GTK_SIGNAL_FUNC(set_sound_driver), + (gpointer)OPT_SOUND_BEEP); + gtk_widget_show(opt); + gtk_menu_append(GTK_MENU(menu), opt); + if ((sound_options & OPT_SOUND_BEEP) && !driver) driver = i; + i++; + + gtk_option_menu_set_menu(GTK_OPTION_MENU(omenu), menu); + gtk_option_menu_set_history(GTK_OPTION_MENU(omenu), driver - 1); + gtk_box_pack_start(GTK_BOX(hbox), omenu, FALSE, FALSE, 5); + gtk_widget_show_all(omenu); sep = gtk_hseparator_new(); gtk_box_pack_start(GTK_BOX(vbox), sep, FALSE, FALSE, 0); Index: sound.c =================================================================== RCS file: /cvsroot/gaim/gaim/src/sound.c,v retrieving revision 1.40 retrieving revision 1.41 diff -u -d -r1.40 -r1.41 --- sound.c 2001/10/10 20:42:19 1.40 +++ sound.c 2001/10/23 04:05:52 1.41 @@ -404,7 +404,7 @@ else if ((ms = strstr(sound_cmd, "%s")) != NULL) { *ms = 0; g_snprintf(command, sizeof(command), "%s\"%s\"%s", sound_cmd, - filename, ms + 2); + filename, ms + 2); } else g_snprintf(command, sizeof(command), sound_cmd); args[0] = "sh"; @@ -415,21 +415,27 @@ _exit(0); } #ifdef ESD_SOUND - if (esd_play_file(NULL, filename, 1)) - _exit(0); + else if (sound_options & OPT_SOUND_ESD) { + if (esd_play_file(NULL, filename, 1)) + _exit(0); + } #endif #ifdef ARTSC_SOUND - if (artsc_play_file(filename)) - _exit(0); + else if (sound_options & OPT_SOUND_ARTSC) { + if (artsc_play_file(filename)) + _exit(0); + } #endif #ifdef NAS_SOUND - if (play_nas_file(filename)) - _exit(0); + else if (sound_options & OPT_SOUND_NAS) { + if (play_nas_file(filename)) + _exit(0); + } #endif - - if (can_play_audio()) { + else if ((sound_options & OPT_SOUND_NORMAL) && + can_play_audio()) { play_audio_file(filename); _exit(0); } @@ -460,32 +466,40 @@ #ifdef ESD_SOUND /* ESD is our player of choice. Are we OK to * go there? */ - if (can_play_esd()) { - if (play_esd(data, size)) - _exit(0); + else if (sound_options & OPT_SOUND_ESD) { + if (can_play_esd()) { + if (play_esd(data, size)) + _exit(0); + } } #endif #ifdef ARTSC_SOUND /* ArtsC is the new second choice. */ - if (can_play_artsc()) { - if (play_artsc(data, size)) - _exit(0); + else if (sound_options & OPT_SOUND_ARTSC) { + if (can_play_artsc()) { + if (play_artsc(data, size)) + _exit(0); + } } #endif #ifdef NAS_SOUND /* NAS is our second choice setup. */ - if (can_play_nas()) { - if (play_nas(data, size)) - _exit(0); + else if (sound_options & OPT_SOUND_NAS) { + if (can_play_nas()) { + if (play_nas(data, size)) + _exit(0); + } } #endif /* Lastly, we can try just plain old /dev/audio */ - if (can_play_audio()) { - play_audio(data, size); - _exit(0); + else if (sound_options & OPT_SOUND_NORMAL) { + if (can_play_audio()) { + play_audio(data, size); + _exit(0); + } } _exit(0); |