# HG changeset patch # User Jim Seymour # Date 1024361395 0 # Node ID 03daf01a8000db5ce8bd8af7bc3fc87c07f39c05 # Parent a6367446950d6fe66d85053bcff50065021cfbc0 [gaim-migrate @ 3344] Easier ordering of sounds. See patch "[ 560514 ] changable ordering of sounds in prefs" for a more complete explanation. (Thanks, Robert McQueen) committer: Tailor Script diff -r a6367446950d -r 03daf01a8000 src/gaim.h --- a/src/gaim.h Tue Jun 18 00:35:23 2002 +0000 +++ b/src/gaim.h Tue Jun 18 00:49:55 2002 +0000 @@ -297,6 +297,9 @@ #define SND_POUNCE_DEFAULT 9 #define SND_CHAT_NICK 10 #define NUM_SOUNDS 11 +/* these two for the sound_order list in prefs.c */ +#define SND_SEPARATOR -1 +#define SND_END -2 extern char *sound_file[NUM_SOUNDS]; /* global sound struct */ diff -r a6367446950d -r 03daf01a8000 src/prefs.c --- a/src/prefs.c Tue Jun 18 00:35:23 2002 +0000 +++ b/src/prefs.c Tue Jun 18 00:49:55 2002 +0000 @@ -1603,6 +1603,17 @@ GtkWidget *menu; GtkWidget *opt; int i=1, driver=0, j; + /* order that sound options are presented in, SND_SEPARATOR for * + * a seperator. better to do it this way than try and re-order * + * the sound defines 'cause that would mux up the sound prefs in * + * gaimrc. this list is terminated with SND_END. -Robot101 */ + int sound_order[] = { + SND_BUDDY_ARRIVE, SND_BUDDY_LEAVE, SND_SEPARATOR, + SND_FIRST_RECEIVE, SND_RECEIVE, SND_SEND, SND_SEPARATOR, + SND_CHAT_JOIN, SND_CHAT_LEAVE, + SND_CHAT_YOU_SAY, SND_CHAT_SAY, SND_CHAT_NICK, + SND_END + }; parent = prefdialog->parent; gtk_widget_destroy(prefdialog); @@ -1745,19 +1756,17 @@ gtk_container_add(GTK_CONTAINER(frame), vbox); gtk_widget_show(vbox); - for (j=0; j < NUM_SOUNDS; j++) { - /* no entry for sounds without an option */ - if (sounds[j].opt == 0) - continue; - - /* seperators before SND_RECEIVE and SND_CHAT_JOIN */ - if ((j == SND_RECEIVE) || (j == SND_CHAT_JOIN)) { + for (j=0; sound_order[j] != SND_END; j++) { + if (sound_order[j] == SND_SEPARATOR) { sep = gtk_hseparator_new(); gtk_box_pack_start(GTK_BOX(vbox), sep, FALSE, FALSE, 5); gtk_widget_show(sep); + } else { + /* no entry for sounds without an option */ + if (sounds[sound_order[j]].opt == 0) + continue; + sound_entry(vbox, sound_order[j]); } - - sound_entry(vbox, j); } gtk_widget_show(prefdialog); diff -r a6367446950d -r 03daf01a8000 src/sound.c --- a/src/sound.c Tue Jun 18 00:35:23 2002 +0000 +++ b/src/sound.c Tue Jun 18 00:49:55 2002 +0000 @@ -52,12 +52,13 @@ #include "sounds/Receive.h" #include "sounds/RedAlert.h" - gboolean mute_sounds = 0; -/* label and opt are null for the buddy pounce because it's configured * - * per pounce. NULL option means it doesn't get displayed in the sound * - * preferences box */ +/* description, option bit, default sound array, and it's size. * + * if you want it to get displayed in the prefs dialog, it needs * + * to be added to the sound_order array in prefs.c, if not, and * + * it has no option bit, set it to 0. the order here has to match * + * the defines in gaim.h. -Robot101 */ struct sound_struct sounds[NUM_SOUNDS] = { {N_("Buddy logs in"), OPT_SOUND_LOGIN, BuddyArrive, sizeof(BuddyArrive)}, {N_("Buddy logs out"), OPT_SOUND_LOGOUT, BuddyLeave, sizeof(BuddyLeave)}, @@ -68,6 +69,7 @@ {N_("Person leaves chat"), OPT_SOUND_CHAT_PART, BuddyLeave, sizeof(BuddyLeave)}, {N_("You talk in chat"), OPT_SOUND_CHAT_YOU_SAY, Send, sizeof(Send)}, {N_("Others talk in chat"), OPT_SOUND_CHAT_SAY, Receive, sizeof(Receive)}, + /* this isn't a terminator, it's the buddy pounce default sound event ;-) */ {NULL, 0, RedAlert, sizeof(RedAlert)}, {N_("Someone says your name in chat"), OPT_SOUND_CHAT_NICK, Receive, sizeof(Receive)} };