| 308 purple_prefs_add_path(PIDGIN_PREFS_ROOT "/sound/file/chat_msg_recv", ""); |
310 purple_prefs_add_path(PIDGIN_PREFS_ROOT "/sound/file/chat_msg_recv", ""); |
| 309 purple_prefs_add_bool(PIDGIN_PREFS_ROOT "/sound/enabled/nick_said", FALSE); |
311 purple_prefs_add_bool(PIDGIN_PREFS_ROOT "/sound/enabled/nick_said", FALSE); |
| 310 purple_prefs_add_path(PIDGIN_PREFS_ROOT "/sound/file/nick_said", ""); |
312 purple_prefs_add_path(PIDGIN_PREFS_ROOT "/sound/file/nick_said", ""); |
| 311 purple_prefs_add_bool(PIDGIN_PREFS_ROOT "/sound/enabled/pounce_default", TRUE); |
313 purple_prefs_add_bool(PIDGIN_PREFS_ROOT "/sound/enabled/pounce_default", TRUE); |
| 312 purple_prefs_add_path(PIDGIN_PREFS_ROOT "/sound/file/pounce_default", ""); |
314 purple_prefs_add_path(PIDGIN_PREFS_ROOT "/sound/file/pounce_default", ""); |
| |
315 purple_prefs_add_string(PIDGIN_PREFS_ROOT "/sound/theme", ""); |
| 313 purple_prefs_add_bool(PIDGIN_PREFS_ROOT "/sound/enabled/sent_attention", TRUE); |
316 purple_prefs_add_bool(PIDGIN_PREFS_ROOT "/sound/enabled/sent_attention", TRUE); |
| 314 purple_prefs_add_path(PIDGIN_PREFS_ROOT "/sound/file/sent_attention", ""); |
317 purple_prefs_add_path(PIDGIN_PREFS_ROOT "/sound/file/sent_attention", ""); |
| 315 purple_prefs_add_bool(PIDGIN_PREFS_ROOT "/sound/enabled/got_attention", TRUE); |
318 purple_prefs_add_bool(PIDGIN_PREFS_ROOT "/sound/enabled/got_attention", TRUE); |
| 316 purple_prefs_add_path(PIDGIN_PREFS_ROOT "/sound/file/got_attention", ""); |
319 purple_prefs_add_path(PIDGIN_PREFS_ROOT "/sound/file/got_attention", ""); |
| 317 purple_prefs_add_bool(PIDGIN_PREFS_ROOT "/sound/conv_focus", TRUE); |
320 purple_prefs_add_bool(PIDGIN_PREFS_ROOT "/sound/conv_focus", TRUE); |
| 597 file_pref = g_strdup_printf(PIDGIN_PREFS_ROOT "/sound/file/%s", sounds[event].pref); |
602 file_pref = g_strdup_printf(PIDGIN_PREFS_ROOT "/sound/file/%s", sounds[event].pref); |
| 598 |
603 |
| 599 /* check NULL for sounds that don't have an option, ie buddy pounce */ |
604 /* check NULL for sounds that don't have an option, ie buddy pounce */ |
| 600 if (purple_prefs_get_bool(enable_pref)) { |
605 if (purple_prefs_get_bool(enable_pref)) { |
| 601 char *filename = g_strdup(purple_prefs_get_path(file_pref)); |
606 char *filename = g_strdup(purple_prefs_get_path(file_pref)); |
| 602 if(!filename || !strlen(filename)) { |
607 theme_name = purple_prefs_get_string(PIDGIN_PREFS_ROOT "/sound/theme"); |
| |
608 |
| |
609 if (theme_name && *theme_name && (!filename || !*filename)) { |
| |
610 /* Use theme */ |
| 603 g_free(filename); |
611 g_free(filename); |
| |
612 |
| |
613 theme = PURPLE_SOUND_THEME(purple_theme_manager_find_theme(theme_name, "sound")); |
| |
614 filename = purple_sound_theme_get_file_full(theme, sounds[event].pref); |
| |
615 |
| |
616 if(!g_file_test(filename, G_FILE_TEST_IS_REGULAR)){ /* Use Default sound in this case */ |
| |
617 purple_debug_error("sound", "The file: (%s) %s\n from theme: %s, was not found or wasn't readable\n", |
| |
618 sounds[event].pref, filename, theme_name); |
| |
619 g_free(filename); |
| |
620 } |
| |
621 } |
| |
622 |
| |
623 if (!filename || !strlen(filename)) { /* Use Default sounds */ |
| |
624 g_free(filename); |
| |
625 |
| 604 /* XXX Consider creating a constant for "sounds/purple" to be shared with Finch */ |
626 /* XXX Consider creating a constant for "sounds/purple" to be shared with Finch */ |
| 605 filename = g_build_filename(DATADIR, "sounds", "purple", sounds[event].def, NULL); |
627 filename = g_build_filename(DATADIR, "sounds", "purple", sounds[event].def, NULL); |
| 606 } |
628 } |
| 607 |
629 |
| 608 purple_sound_play_file(filename, NULL); |
630 purple_sound_play_file(filename, NULL); |
| |
631 |
| 609 g_free(filename); |
632 g_free(filename); |
| 610 } |
633 } |
| 611 |
634 |
| 612 g_free(enable_pref); |
635 g_free(enable_pref); |
| 613 g_free(file_pref); |
636 g_free(file_pref); |
| |
637 } |
| |
638 |
| |
639 gboolean |
| |
640 pidgin_sound_is_customized(void) |
| |
641 { |
| |
642 gint i; |
| |
643 gchar *path, *file; |
| |
644 |
| |
645 for (i = 0; i < PURPLE_NUM_SOUNDS; i++) { |
| |
646 path = g_strdup_printf(PIDGIN_PREFS_ROOT "/sound/file/%s", sounds[i].pref); |
| |
647 file = g_strdup(purple_prefs_get_path(path)); |
| |
648 g_free(path); |
| |
649 |
| |
650 if (file && file[0] != '\0'){ |
| |
651 g_free(file); |
| |
652 return TRUE; |
| |
653 } |
| |
654 |
| |
655 g_free(file); |
| |
656 } |
| |
657 |
| |
658 return FALSE; |
| |
659 |
| 614 } |
660 } |
| 615 |
661 |
| 616 static PurpleSoundUiOps sound_ui_ops = |
662 static PurpleSoundUiOps sound_ui_ops = |
| 617 { |
663 { |
| 618 pidgin_sound_init, |
664 pidgin_sound_init, |