comparison src/gtkprefs.c @ 10074:2e225cd35615

[gaim-migrate @ 11054] This is some sound related stuff. Add a "No Sounds" sound method for those who like their Gaim to be really really quiet, switched to using the prefs API for mute_sounds, added a Mute Sounds entry to the buddy list tools menu so those without a system tray icon can use this, and kill off old child sound processes (any older than 15 seconds) which should fix bug #1034209. committer: Tailor Script <tailor@pidgin.im>
author Stu Tomlinson <stu@nosnilmot.com>
date Sat, 02 Oct 2004 18:53:19 +0000
parents 83eb12b1f1a1
children 4670b7fd1a89
comparison
equal deleted inserted replaced
10073:06fa76a16ac0 10074:2e225cd35615
78 static GtkTreeIter proto_iter, plugin_iter; 78 static GtkTreeIter proto_iter, plugin_iter;
79 79
80 static guint browser_pref1_id = 0; 80 static guint browser_pref1_id = 0;
81 static guint browser_pref2_id = 0; 81 static guint browser_pref2_id = 0;
82 static guint proxy_pref_id = 0; 82 static guint proxy_pref_id = 0;
83 static guint sound_pref_id = 0; 83 static guint sound_pref1_id = 0;
84 static guint sound_pref2_id = 0;
85 static guint sound_pref3_id = 0;
84 static guint auto_resp_pref_id = 0; 86 static guint auto_resp_pref_id = 0;
85 static guint placement_pref_id = 0; 87 static guint placement_pref_id = 0;
86 88
87 /* 89 /*
88 * PROTOTYPES 90 * PROTOTYPES
381 383
382 /* Unregister callbacks. */ 384 /* Unregister callbacks. */
383 gaim_prefs_disconnect_callback(browser_pref1_id); 385 gaim_prefs_disconnect_callback(browser_pref1_id);
384 gaim_prefs_disconnect_callback(browser_pref2_id); 386 gaim_prefs_disconnect_callback(browser_pref2_id);
385 gaim_prefs_disconnect_callback(proxy_pref_id); 387 gaim_prefs_disconnect_callback(proxy_pref_id);
386 gaim_prefs_disconnect_callback(sound_pref_id); 388 gaim_prefs_disconnect_callback(sound_pref1_id);
389 gaim_prefs_disconnect_callback(sound_pref2_id);
390 gaim_prefs_disconnect_callback(sound_pref3_id);
387 gaim_prefs_disconnect_callback(auto_resp_pref_id); 391 gaim_prefs_disconnect_callback(auto_resp_pref_id);
388 gaim_prefs_disconnect_callback(placement_pref_id); 392 gaim_prefs_disconnect_callback(placement_pref_id);
389 393
390 for (l = gaim_plugins_get_loaded(); l != NULL; l = l->next) { 394 for (l = gaim_plugins_get_loaded(); l != NULL; l = l->next) {
391 plug = l->data; 395 plug = l->data;
1485 gtk_entry_get_text(GTK_ENTRY(entry))); 1489 gtk_entry_get_text(GTK_ENTRY(entry)));
1486 return TRUE; 1490 return TRUE;
1487 } 1491 }
1488 1492
1489 static void 1493 static void
1490 sound_changed_cb(const char *name, GaimPrefType type, gpointer value, 1494 sound_changed1_cb(const char *name, GaimPrefType type, gpointer value,
1491 gpointer data) 1495 gpointer data)
1492 { 1496 {
1493 GtkWidget *hbox = data; 1497 GtkWidget *hbox = data;
1494 const char *method = value; 1498 const char *method = value;
1495 1499
1496 gtk_widget_set_sensitive(hbox, !strcmp(method, "custom")); 1500 gtk_widget_set_sensitive(hbox, !strcmp(method, "custom"));
1501 }
1502
1503 static void
1504 sound_changed2_cb(const char *name, GaimPrefType type, gpointer value,
1505 gpointer data)
1506 {
1507 GtkWidget *vbox = data;
1508 const char *method = value;
1509
1510 gtk_widget_set_sensitive(vbox, strcmp(method, "none"));
1497 } 1511 }
1498 #endif 1512 #endif
1499 1513
1500 1514
1501 static void 1515 static void
1643 ret = gtk_vbox_new(FALSE, 18); 1657 ret = gtk_vbox_new(FALSE, 18);
1644 gtk_container_set_border_width (GTK_CONTAINER (ret), 12); 1658 gtk_container_set_border_width (GTK_CONTAINER (ret), 12);
1645 1659
1646 sg = gtk_size_group_new(GTK_SIZE_GROUP_HORIZONTAL); 1660 sg = gtk_size_group_new(GTK_SIZE_GROUP_HORIZONTAL);
1647 1661
1648 vbox = gaim_gtk_make_frame (ret, _("Sound Options"));
1649 gaim_gtk_prefs_checkbox(_("Sounds when conversation has _focus"),
1650 "/gaim/gtk/sound/conv_focus", vbox);
1651 gaim_gtk_prefs_checkbox(_("_Sounds while away"),
1652 "/core/sound/while_away", vbox);
1653
1654 #ifndef _WIN32 1662 #ifndef _WIN32
1655 vbox = gaim_gtk_make_frame (ret, _("Sound Method")); 1663 vbox = gaim_gtk_make_frame (ret, _("Sound Method"));
1656 dd = gaim_gtk_prefs_dropdown(vbox, _("_Method:"), GAIM_PREF_STRING, 1664 dd = gaim_gtk_prefs_dropdown(vbox, _("_Method:"), GAIM_PREF_STRING,
1657 "/gaim/gtk/sound/method", 1665 "/gaim/gtk/sound/method",
1658 _("Console beep"), "beep", 1666 _("Console beep"), "beep",
1663 #endif 1671 #endif
1664 #ifdef USE_NAS_AUDIO 1672 #ifdef USE_NAS_AUDIO
1665 "NAS", "nas", 1673 "NAS", "nas",
1666 #endif 1674 #endif
1667 _("Command"), "custom", 1675 _("Command"), "custom",
1676 _("No sounds"), "none",
1668 NULL); 1677 NULL);
1669 gtk_size_group_add_widget(sg, dd); 1678 gtk_size_group_add_widget(sg, dd);
1670 gtk_misc_set_alignment(GTK_MISC(dd), 0, 0); 1679 gtk_misc_set_alignment(GTK_MISC(dd), 0, 0);
1671 1680
1672 hbox = gtk_hbox_new(FALSE, 5); 1681 hbox = gtk_hbox_new(FALSE, 5);
1691 G_CALLBACK(sound_cmd_yeah), NULL); 1700 G_CALLBACK(sound_cmd_yeah), NULL);
1692 1701
1693 gtk_widget_set_sensitive(hbox, 1702 gtk_widget_set_sensitive(hbox,
1694 !strcmp(gaim_prefs_get_string("/gaim/gtk/sound/method"), 1703 !strcmp(gaim_prefs_get_string("/gaim/gtk/sound/method"),
1695 "custom")); 1704 "custom"));
1696 sound_pref_id = gaim_prefs_connect_callback("/gaim/gtk/sound/method", 1705 sound_pref1_id = gaim_prefs_connect_callback("/gaim/gtk/sound/method",
1697 sound_changed_cb, hbox); 1706 sound_changed1_cb, hbox);
1698 1707
1699 gaim_set_accessible_label (entry, label); 1708 gaim_set_accessible_label (entry, label);
1700 #endif /* _WIN32 */ 1709 #endif /* _WIN32 */
1710
1711 vbox = gaim_gtk_make_frame (ret, _("Sound Options"));
1712 gaim_gtk_prefs_checkbox(_("Sounds when conversation has _focus"),
1713 "/gaim/gtk/sound/conv_focus", vbox);
1714 gaim_gtk_prefs_checkbox(_("_Sounds while away"),
1715 "/core/sound/while_away", vbox);
1716
1717 gtk_widget_set_sensitive(vbox,
1718 strcmp(gaim_prefs_get_string("/gaim/gtk/sound/method"), "none"));
1719 sound_pref2_id = gaim_prefs_connect_callback("/gaim/gtk/sound/method",
1720 sound_changed2_cb, vbox);
1701 1721
1702 vbox = gaim_gtk_make_frame(ret, _("Sound Events")); 1722 vbox = gaim_gtk_make_frame(ret, _("Sound Events"));
1703 1723
1704 /* The following is an ugly hack to make the frame expand so the 1724 /* The following is an ugly hack to make the frame expand so the
1705 * sound events list is big enough to be usable */ 1725 * sound events list is big enough to be usable */
1786 1806
1787 button = gtk_button_new_with_label(_("Choose...")); 1807 button = gtk_button_new_with_label(_("Choose..."));
1788 g_signal_connect(G_OBJECT(button), "clicked", G_CALLBACK(select_sound), NULL); 1808 g_signal_connect(G_OBJECT(button), "clicked", G_CALLBACK(select_sound), NULL);
1789 gtk_box_pack_start(GTK_BOX(hbox), button, FALSE, FALSE, 1); 1809 gtk_box_pack_start(GTK_BOX(hbox), button, FALSE, FALSE, 1);
1790 gtk_widget_show_all(ret); 1810 gtk_widget_show_all(ret);
1811
1812 gtk_widget_set_sensitive(vbox,
1813 strcmp(gaim_prefs_get_string("/gaim/gtk/sound/method"), "none"));
1814 sound_pref3_id = gaim_prefs_connect_callback("/gaim/gtk/sound/method",
1815 sound_changed2_cb, vbox);
1791 1816
1792 return ret; 1817 return ret;
1793 } 1818 }
1794 1819
1795 GtkWidget *away_page() { 1820 GtkWidget *away_page() {