comparison finch/gntsound.c @ 19129:f2c6e23e66a8

Sound prefs now save. Added a few strings to be translated.
author Eric Polino <aluink@pidgin.im>
date Sun, 01 Jul 2007 20:56:17 +0000
parents 2c7114561553
children d5a0b09470ee
comparison
equal deleted inserted replaced
19128:2c7114561553 19129:f2c6e23e66a8
570 } 570 }
571 571
572 static gboolean 572 static gboolean
573 save_cb(GntBindable *data, gpointer *win) 573 save_cb(GntBindable *data, gpointer *win)
574 { 574 {
575 575 purple_prefs_set_string(FINCH_PREFS_ROOT "/sound/method", gnt_combo_box_get_selected_data(GNT_COMBO_BOX(pref_dialog->method)));
576 purple_prefs_set_path(FINCH_PREFS_ROOT "/sound/command", gnt_entry_get_text(GNT_ENTRY(pref_dialog->command)));
577 purple_prefs_set_bool(FINCH_PREFS_ROOT "/sound/conv_focus",gnt_check_box_get_checked(GNT_CHECK_BOX(pref_dialog->conv_focus)));
578 purple_prefs_set_int("/purple/sound/while_status",GPOINTER_TO_INT(gnt_combo_box_get_selected_data(GNT_COMBO_BOX(pref_dialog->while_status))));
579 purple_prefs_set_int(FINCH_PREFS_ROOT "/sound/volume",gnt_slider_get_value(GNT_SLIDER(pref_dialog->volume)));
580
576 gnt_widget_destroy(GNT_WIDGET(win)); 581 gnt_widget_destroy(GNT_WIDGET(win));
577 return TRUE; 582 return TRUE;
578 } 583 }
579 584
580 static gboolean 585 static gboolean
620 gnt_box_set_title(GNT_BOX(win),_("Sound Preferences")); 625 gnt_box_set_title(GNT_BOX(win),_("Sound Preferences"));
621 gnt_box_set_fill(GNT_BOX(win),TRUE); 626 gnt_box_set_fill(GNT_BOX(win),TRUE);
622 gnt_box_set_alignment(GNT_BOX(win),GNT_ALIGN_MID); 627 gnt_box_set_alignment(GNT_BOX(win),GNT_ALIGN_MID);
623 628
624 pref_dialog->method = cmbox = gnt_combo_box_new(); 629 pref_dialog->method = cmbox = gnt_combo_box_new();
630 gnt_tree_set_hash_fns(GNT_TREE(GNT_COMBO_BOX(cmbox)->dropdown), g_str_hash, g_str_equal, NULL);
625 gnt_combo_box_add_data(GNT_COMBO_BOX(cmbox),"automatic",_("Automatic")); 631 gnt_combo_box_add_data(GNT_COMBO_BOX(cmbox),"automatic",_("Automatic"));
626 gnt_combo_box_add_data(GNT_COMBO_BOX(cmbox),"alsa","ALSA"); 632 gnt_combo_box_add_data(GNT_COMBO_BOX(cmbox),"alsa","ALSA");
627 gnt_combo_box_add_data(GNT_COMBO_BOX(cmbox),"esd","ESD"); 633 gnt_combo_box_add_data(GNT_COMBO_BOX(cmbox),"esd","ESD");
628 gnt_combo_box_add_data(GNT_COMBO_BOX(cmbox),"beep",_("Console Beep")); 634 gnt_combo_box_add_data(GNT_COMBO_BOX(cmbox),"beep",_("Console Beep"));
629 gnt_combo_box_add_data(GNT_COMBO_BOX(cmbox),"custom",_("Command")); 635 gnt_combo_box_add_data(GNT_COMBO_BOX(cmbox),"custom",_("Command"));
630 gnt_combo_box_add_data(GNT_COMBO_BOX(cmbox),"nosound",_("No Sound")); 636 gnt_combo_box_add_data(GNT_COMBO_BOX(cmbox),"nosound",_("No Sound"));
631 buf = g_strdup(purple_prefs_get_string(FINCH_PREFS_ROOT "/sound/method")); 637 buf = g_strdup(purple_prefs_get_string(FINCH_PREFS_ROOT "/sound/method"));
638 purple_debug_warning("method","%s",buf);
632 gnt_combo_box_set_selected(GNT_COMBO_BOX(cmbox),buf); 639 gnt_combo_box_set_selected(GNT_COMBO_BOX(cmbox),buf);
633 g_free(buf); 640 g_free(buf);
634 641
635 label = gnt_label_new_with_format(_("Sound Method"),GNT_TEXT_FLAG_BOLD); 642 label = gnt_label_new_with_format(_("Sound Method"),GNT_TEXT_FLAG_BOLD);
636 gnt_box_add_widget(GNT_BOX(win),label); 643 gnt_box_add_widget(GNT_BOX(win),label);
643 650
644 box = gnt_hbox_new(TRUE); 651 box = gnt_hbox_new(TRUE);
645 gnt_box_set_pad(GNT_BOX(box),0); 652 gnt_box_set_pad(GNT_BOX(box),0);
646 gnt_box_set_fill(GNT_BOX(box),FALSE); 653 gnt_box_set_fill(GNT_BOX(box),FALSE);
647 gnt_box_add_widget(GNT_BOX(box),gnt_label_new(_("Sound Command\n(%s for filename)"))); 654 gnt_box_add_widget(GNT_BOX(box),gnt_label_new(_("Sound Command\n(%s for filename)")));
648 pref_dialog->command = entry = gnt_entry_new(purple_prefs_get_string(FINCH_PREFS_ROOT "/sound/method")); 655 pref_dialog->command = entry = gnt_entry_new(purple_prefs_get_path(FINCH_PREFS_ROOT "/sound/command"));
649 gnt_box_add_widget(GNT_BOX(box),entry); 656 gnt_box_add_widget(GNT_BOX(box),entry);
650 gnt_box_add_widget(GNT_BOX(win),box); 657 gnt_box_add_widget(GNT_BOX(win),box);
651 658
652 gnt_box_add_widget(GNT_BOX(win), gnt_line_new(FALSE)); 659 gnt_box_add_widget(GNT_BOX(win), gnt_line_new(FALSE));
653 660
654 gnt_box_add_widget(GNT_BOX(win),gnt_label_new_with_format(_("Sound Options"),GNT_TEXT_FLAG_BOLD)); 661 gnt_box_add_widget(GNT_BOX(win),gnt_label_new_with_format(_("Sound Options"),GNT_TEXT_FLAG_BOLD));
655 pref_dialog->conv_focus = chkbox = gnt_check_box_new("Sounds when conversation has focus"); 662 pref_dialog->conv_focus = chkbox = gnt_check_box_new(_("Sounds when conversation has focus"));
656 gnt_check_box_set_checked(GNT_CHECK_BOX(chkbox),purple_prefs_get_bool(FINCH_PREFS_ROOT "/sound/conv_focus")); 663 gnt_check_box_set_checked(GNT_CHECK_BOX(chkbox),purple_prefs_get_bool(FINCH_PREFS_ROOT "/sound/conv_focus"));
657 gnt_box_add_widget(GNT_BOX(win),chkbox); 664 gnt_box_add_widget(GNT_BOX(win),chkbox);
658 665
659 box = gnt_hbox_new(TRUE); 666 box = gnt_hbox_new(TRUE);
660 gnt_box_set_pad(GNT_BOX(box),0); 667 gnt_box_set_pad(GNT_BOX(box),0);
661 gnt_box_set_fill(GNT_BOX(box),FALSE); 668 gnt_box_set_fill(GNT_BOX(box),FALSE);
662 gnt_box_add_widget(GNT_BOX(box),gnt_label_new("Enable Sounds:")); 669 gnt_box_add_widget(GNT_BOX(box),gnt_label_new("Enable Sounds:"));
663 pref_dialog->while_status = cmbox = gnt_combo_box_new(); 670 pref_dialog->while_status = cmbox = gnt_combo_box_new();
664 gnt_combo_box_add_data(GNT_COMBO_BOX(cmbox),"always","Always"); 671 gnt_combo_box_add_data(GNT_COMBO_BOX(cmbox),GINT_TO_POINTER(3),_("Always"));
665 gnt_combo_box_add_data(GNT_COMBO_BOX(cmbox),"available","Only when available"); 672 gnt_combo_box_add_data(GNT_COMBO_BOX(cmbox),GINT_TO_POINTER(1),_("Only when available"));
666 gnt_combo_box_add_data(GNT_COMBO_BOX(cmbox),"away","Only when not available"); 673 gnt_combo_box_add_data(GNT_COMBO_BOX(cmbox),GINT_TO_POINTER(2),_("Only when not available"));
667 switch(purple_prefs_get_int(FINCH_PREFS_ROOT "/sound/while_status")){ 674 gnt_combo_box_set_selected(GNT_COMBO_BOX(cmbox),GINT_TO_POINTER(purple_prefs_get_int("/purple" "/sound/while_status")));
668 case 1:gnt_combo_box_set_selected(GNT_COMBO_BOX(cmbox),"available");break;
669 case 2:gnt_combo_box_set_selected(GNT_COMBO_BOX(cmbox),"away");break;
670 default:gnt_combo_box_set_selected(GNT_COMBO_BOX(cmbox),"always");break;
671 }
672 gnt_box_add_widget(GNT_BOX(box),cmbox); 675 gnt_box_add_widget(GNT_BOX(box),cmbox);
673 gnt_box_add_widget(GNT_BOX(win),box); 676 gnt_box_add_widget(GNT_BOX(win),box);
674 677
675 box = gnt_hbox_new(TRUE); 678 box = gnt_hbox_new(TRUE);
676 gnt_box_set_pad(GNT_BOX(box),0); 679 gnt_box_set_pad(GNT_BOX(box),0);
677 gnt_box_set_fill(GNT_BOX(box),FALSE); 680 gnt_box_set_fill(GNT_BOX(box),FALSE);
678 gnt_box_add_widget(GNT_BOX(box),gnt_label_new("Volume(0-100):")); 681 gnt_box_add_widget(GNT_BOX(box),gnt_label_new(_("Volume(0-100):")));
679 682
680 pref_dialog->volume = slider = gnt_slider_new(FALSE,100,0); 683 pref_dialog->volume = slider = gnt_slider_new(FALSE,100,0);
681 gnt_slider_set_step(GNT_SLIDER(slider),5); 684 gnt_slider_set_step(GNT_SLIDER(slider),5);
682 label = gnt_label_new(""); 685 label = gnt_label_new("");
683 gnt_slider_reflect_label(GNT_SLIDER(slider),GNT_LABEL(label)); 686 gnt_slider_reflect_label(GNT_SLIDER(slider),GNT_LABEL(label));
694 697
695 box = gnt_hbox_new(TRUE); 698 box = gnt_hbox_new(TRUE);
696 gnt_box_set_pad(GNT_BOX(box),0); 699 gnt_box_set_pad(GNT_BOX(box),0);
697 gnt_box_set_fill(GNT_BOX(box),TRUE); 700 gnt_box_set_fill(GNT_BOX(box),TRUE);
698 button = gnt_button_new("Save"); 701 button = gnt_button_new("Save");
699 g_signal_connect(G_OBJECT(button),"activate",G_CALLBACK(save_cb),NULL); 702 g_signal_connect(G_OBJECT(button),"activate",G_CALLBACK(save_cb),win);
700 gnt_box_add_widget(GNT_BOX(box),button); 703 gnt_box_add_widget(GNT_BOX(box),button);
701 button = gnt_button_new("Cancel"); 704 button = gnt_button_new("Cancel");
702 g_signal_connect(G_OBJECT(button),"activate",G_CALLBACK(cancel_cb),NULL); 705 g_signal_connect(G_OBJECT(button),"activate",G_CALLBACK(cancel_cb),NULL);
703 gnt_box_add_widget(GNT_BOX(box),button); 706 gnt_box_add_widget(GNT_BOX(box),button);
704 gnt_box_add_widget(GNT_BOX(win),box); 707 gnt_box_add_widget(GNT_BOX(win),box);