Mercurial > pidgin
comparison src/gtkprefs.c @ 9108:6a17b7e2e3b2
[gaim-migrate @ 9885]
I did some more prefslashing. Test, discuss. I'll stay up for a bit.
If nobody objects, let's tag and release.
committer: Tailor Script <tailor@pidgin.im>
author | Sean Egan <seanegan@gmail.com> |
---|---|
date | Fri, 28 May 2004 05:53:34 +0000 |
parents | 96bfa9bd110f |
children | 78189aad1457 |
comparison
equal
deleted
inserted
replaced
9107:f0be63d6d192 | 9108:6a17b7e2e3b2 |
---|---|
941 conversation_placement_cb(const char *name, GaimPrefType type, gpointer value, | 941 conversation_placement_cb(const char *name, GaimPrefType type, gpointer value, |
942 gpointer data) | 942 gpointer data) |
943 { | 943 { |
944 const char *placement = value; | 944 const char *placement = value; |
945 | 945 |
946 if (strcmp(placement, "number")) | 946 if (strcmp(placement, "new")) |
947 gtk_widget_set_sensitive(GTK_WIDGET(data), FALSE); | 947 gtk_widget_set_sensitive(GTK_WIDGET(data), FALSE); |
948 else | 948 else |
949 gtk_widget_set_sensitive(GTK_WIDGET(data), TRUE); | 949 gtk_widget_set_sensitive(GTK_WIDGET(data), TRUE); |
950 } | 950 } |
951 | 951 |
970 GAIM_PREF_STRING, "/gaim/gtk/conversations/placement", names); | 970 GAIM_PREF_STRING, "/gaim/gtk/conversations/placement", names); |
971 g_list_free(names); | 971 g_list_free(names); |
972 | 972 |
973 gtk_misc_set_alignment(GTK_MISC(label), 0, 0); | 973 gtk_misc_set_alignment(GTK_MISC(label), 0, 0); |
974 gtk_size_group_add_widget(sg, label); | 974 gtk_size_group_add_widget(sg, label); |
975 | 975 #if 1 /* PREFSLASH04 */ |
976 label = gaim_gtk_prefs_labeled_spin_button(vbox, _("Number of conversations per window"), | 976 label = gaim_gtk_prefs_dropdown(vbox, _("Show _buttons as:"), GAIM_PREF_INT, |
977 "/gaim/gtk/conversations/button_type", | |
978 _("Pictures"), GAIM_BUTTON_IMAGE, | |
979 _("Text"), GAIM_BUTTON_TEXT, | |
980 _("Pictures and text"), GAIM_BUTTON_TEXT_IMAGE, | |
981 _("None"), GAIM_BUTTON_NONE, | |
982 NULL); | |
983 | |
984 gtk_size_group_add_widget(sg, label); | |
985 gtk_misc_set_alignment(GTK_MISC(label), 0, 0); | |
986 #endif /* PREFSLASH04 */ | |
987 | |
988 #if 0 /* I don't like this */ | |
989 label = gaim_gtk_prefs_labeled_spin_button(vbox, _("Number of conversations per window"), | |
977 "/gaim/gtk/conversations/placement_number", | 990 "/gaim/gtk/conversations/placement_number", |
978 1, 50, sg); | 991 1, 50, sg); |
979 | |
980 if (strcmp("number", | 992 if (strcmp("number", |
981 gaim_prefs_get_string("/gaim/gtk/conversations/placement"))) | 993 gaim_prefs_get_string("/gaim/gtk/conversations/placement"))) |
982 gtk_widget_set_sensitive(label, FALSE); | 994 gtk_widget_set_sensitive(label, FALSE); |
983 else | 995 else |
984 gtk_widget_set_sensitive(label, TRUE); | 996 gtk_widget_set_sensitive(label, TRUE); |
997 #endif /* I think it should be a plugin */ | |
998 | |
999 gaim_gtk_prefs_checkbox(_("Show _formatting toolbar"), | |
1000 "/gaim/gtk/conversations/show_formatting_toolbar", vbox); | |
1001 | |
1002 gaim_gtk_prefs_checkbox(_("Show a_liases in tabs/titles"), | |
1003 "/core/conversations/use_alias_for_title", vbox); | |
1004 | |
1005 gaim_gtk_prefs_checkbox(_("_Raise window on events"), | |
1006 "/gaim/gtk/conversations/raise_on_events", vbox); | |
1007 | |
1008 /* XXX This caption totally sucks but I can't break the string freeze. */ | |
1009 gaim_gtk_prefs_checkbox(_("Co_lorize screen names"), | |
1010 "/gaim/gtk/conversations/chat/color_nicks", vbox); | |
1011 gaim_gtk_prefs_checkbox(_("Show buddy _icons"), | |
1012 "/gaim/gtk/conversations/im/show_buddy_icons", vbox); | |
1013 gaim_gtk_prefs_checkbox(_("Enable buddy icon a_nimation"), | |
1014 "/gaim/gtk/conversations/im/animate_buddy_icons", vbox); | |
1015 gaim_gtk_prefs_checkbox(_("Notify buddies that you are _typing to them"), | |
1016 "/core/conversations/im/send_typing", vbox); | |
1017 | |
1018 vbox = gaim_gtk_make_frame (ret, _("Tab Options")); | |
1019 | |
1020 tabs_checkbox = gaim_gtk_prefs_checkbox(_("Show IMs and chats in _tabbed windows"), | |
1021 "/gaim/gtk/conversations/tabs", vbox); | |
1022 if (strcmp(gaim_prefs_get_string("/gaim/gtk/conversations/placement"), "new")) | |
1023 gtk_widget_set_sensitive(tabs_checkbox, FALSE); | |
1024 | |
1025 #if 0 /* Overzealous last-minute prefslashing */ | |
1026 same_checkbox = gaim_gtk_prefs_checkbox(_("Show IMs and chats in _same tabbed window"), | |
1027 "/core/conversations/combine_chat_im", vbox); | |
1028 if (!gaim_prefs_get_bool("/gaim/gtk/conversations/tabs")) { | |
1029 gtk_widget_set_sensitive(GTK_WIDGET(same_checkbox), FALSE); | |
1030 } | |
1031 #endif | |
985 | 1032 |
986 placement_pref_id = gaim_prefs_connect_callback("/gaim/gtk/conversations/placement", | 1033 placement_pref_id = gaim_prefs_connect_callback("/gaim/gtk/conversations/placement", |
987 conversation_placement_cb, | 1034 conversation_placement_cb, |
988 label); | 1035 tabs_checkbox); |
989 | |
990 gaim_gtk_prefs_checkbox(_("Show _formatting toolbar"), | |
991 "/gaim/gtk/conversations/show_formatting_toolbar", vbox); | |
992 | |
993 gaim_gtk_prefs_checkbox(_("Show a_liases in tabs/titles"), | |
994 "/core/conversations/use_alias_for_title", vbox); | |
995 | |
996 vbox = gaim_gtk_make_frame (ret, _("Tab Options")); | |
997 | |
998 tabs_checkbox = gaim_gtk_prefs_checkbox(_("Show IMs and chats in _tabbed windows"), | |
999 "/gaim/gtk/conversations/tabs", vbox); | |
1000 | |
1001 same_checkbox = gaim_gtk_prefs_checkbox(_("Show IMs and chats in _same tabbed window"), | |
1002 "/core/conversations/combine_chat_im", vbox); | |
1003 | |
1004 if (!gaim_prefs_get_bool("/gaim/gtk/conversations/tabs")) { | |
1005 gtk_widget_set_sensitive(GTK_WIDGET(same_checkbox), FALSE); | |
1006 } | |
1007 | 1036 |
1008 g_signal_connect(G_OBJECT(tabs_checkbox), "clicked", | 1037 g_signal_connect(G_OBJECT(tabs_checkbox), "clicked", |
1009 G_CALLBACK(gaim_gtk_toggle_sensitive), same_checkbox); | 1038 G_CALLBACK(gaim_gtk_toggle_sensitive), same_checkbox); |
1010 | 1039 |
1011 close_checkbox = gaim_gtk_prefs_checkbox(_("Show _close button on tabs"), | 1040 close_checkbox = gaim_gtk_prefs_checkbox(_("Show _close button on tabs"), |
1012 "/gaim/gtk/conversations/close_on_tabs", | 1041 "/gaim/gtk/conversations/close_on_tabs", |
1013 vbox); | 1042 vbox); |
1014 | 1043 |
1044 gtk_widget_show_all(ret); | 1073 gtk_widget_show_all(ret); |
1045 | 1074 |
1046 return ret; | 1075 return ret; |
1047 } | 1076 } |
1048 | 1077 |
1049 GtkWidget *im_page() { | |
1050 GtkWidget *ret; | |
1051 GtkWidget *vbox; | |
1052 #if 1 /* PREFSLASH04 */ | |
1053 GtkWidget *widge; | |
1054 #endif /* PREFSLASH04 */ | |
1055 GtkSizeGroup *sg; | |
1056 | |
1057 ret = gtk_vbox_new(FALSE, 18); | |
1058 gtk_container_set_border_width (GTK_CONTAINER (ret), 12); | |
1059 | |
1060 sg = gtk_size_group_new(GTK_SIZE_GROUP_HORIZONTAL); | |
1061 | |
1062 vbox = gaim_gtk_make_frame (ret, _("Window")); | |
1063 #if 1 /* PREFSLASH04 */ | |
1064 widge = gaim_gtk_prefs_dropdown(vbox, _("Show _buttons as:"), GAIM_PREF_INT, | |
1065 "/gaim/gtk/conversations/im/button_type", | |
1066 _("Pictures"), GAIM_BUTTON_IMAGE, | |
1067 _("Text"), GAIM_BUTTON_TEXT, | |
1068 _("Pictures and text"), GAIM_BUTTON_TEXT_IMAGE, | |
1069 _("None"), GAIM_BUTTON_NONE, | |
1070 NULL); | |
1071 | |
1072 gtk_size_group_add_widget(sg, widge); | |
1073 gtk_misc_set_alignment(GTK_MISC(widge), 0, 0); | |
1074 #endif /* PREFSLASH04 */ | |
1075 gaim_gtk_prefs_checkbox(_("_Raise window on events"), | |
1076 "/gaim/gtk/conversations/im/raise_on_events", vbox); | |
1077 gtk_widget_show (vbox); | |
1078 vbox = gaim_gtk_make_frame (ret, _("Buddy Icons")); | |
1079 gaim_gtk_prefs_checkbox(_("Show buddy _icons"), | |
1080 "/gaim/gtk/conversations/im/show_buddy_icons", vbox); | |
1081 gaim_gtk_prefs_checkbox(_("Enable buddy icon a_nimation"), | |
1082 "/gaim/gtk/conversations/im/animate_buddy_icons", vbox); | |
1083 | |
1084 vbox = gaim_gtk_make_frame (ret, _("Typing Notification")); | |
1085 gaim_gtk_prefs_checkbox(_("Notify buddies that you are _typing to them"), | |
1086 "/core/conversations/im/send_typing", vbox); | |
1087 | |
1088 gtk_widget_show_all(ret); | |
1089 return ret; | |
1090 } | |
1091 | |
1092 GtkWidget *chat_page() { | |
1093 GtkWidget *ret; | |
1094 GtkWidget *vbox; | |
1095 #if 1 /* PREFSLASH04 */ | |
1096 GtkWidget *dd; | |
1097 #endif /* PREFSLASH04 */ | |
1098 GtkSizeGroup *sg; | |
1099 | |
1100 ret = gtk_vbox_new(FALSE, 18); | |
1101 gtk_container_set_border_width (GTK_CONTAINER (ret), 12); | |
1102 | |
1103 sg = gtk_size_group_new (GTK_SIZE_GROUP_HORIZONTAL); | |
1104 vbox = gaim_gtk_make_frame (ret, _("Window")); | |
1105 #if 1 /* PREFSLASH04 */ | |
1106 dd = gaim_gtk_prefs_dropdown(vbox, _("Show _buttons as:"), GAIM_PREF_INT, | |
1107 "/gaim/gtk/conversations/chat/button_type", | |
1108 _("Pictures"), GAIM_BUTTON_IMAGE, | |
1109 _("Text"), GAIM_BUTTON_TEXT, | |
1110 _("Pictures and text"), GAIM_BUTTON_TEXT_IMAGE, | |
1111 _("None"), GAIM_BUTTON_NONE, | |
1112 NULL); | |
1113 | |
1114 gtk_size_group_add_widget(sg, dd); | |
1115 gtk_misc_set_alignment(GTK_MISC(dd), 0, 0); | |
1116 #endif /* PREFSLASH04 */ | |
1117 gaim_gtk_prefs_checkbox(_("_Raise window on events"), | |
1118 "/gaim/gtk/conversations/chat/raise_on_events", vbox); | |
1119 vbox = gaim_gtk_make_frame (ret, _("Display")); | |
1120 gaim_gtk_prefs_checkbox(_("Co_lorize screen names"), | |
1121 "/gaim/gtk/conversations/chat/color_nicks", vbox); | |
1122 | |
1123 gtk_widget_show_all(ret); | |
1124 return ret; | |
1125 } | |
1126 | |
1127 static void network_ip_changed(GtkEntry *entry, gpointer data) | 1078 static void network_ip_changed(GtkEntry *entry, gpointer data) |
1128 { | 1079 { |
1129 gaim_network_set_public_ip(gtk_entry_get_text(entry)); | 1080 gaim_network_set_public_ip(gtk_entry_get_text(entry)); |
1130 } | |
1131 | |
1132 GtkWidget *network_page() { | |
1133 GtkWidget *ret; | |
1134 GtkWidget *vbox, *entry; | |
1135 GtkWidget *table, *label, *auto_ip_checkbox, *ports_checkbox, *spin_button; | |
1136 GtkSizeGroup *sg; | |
1137 | |
1138 ret = gtk_vbox_new(FALSE, 18); | |
1139 gtk_container_set_border_width (GTK_CONTAINER (ret), 12); | |
1140 | |
1141 vbox = gaim_gtk_make_frame (ret, _("IP Address")); | |
1142 | |
1143 auto_ip_checkbox = gaim_gtk_prefs_checkbox(_("_Autodetect IP Address"), | |
1144 "/core/network/auto_ip", vbox); | |
1145 | |
1146 table = gtk_table_new(2, 1, FALSE); | |
1147 gtk_container_set_border_width(GTK_CONTAINER(table), 5); | |
1148 gtk_table_set_col_spacings(GTK_TABLE(table), 5); | |
1149 gtk_table_set_row_spacings(GTK_TABLE(table), 10); | |
1150 gtk_container_add(GTK_CONTAINER(vbox), table); | |
1151 | |
1152 label = gtk_label_new_with_mnemonic(_("Public _IP:")); | |
1153 gtk_misc_set_alignment(GTK_MISC(label), 1.0, 0.5); | |
1154 gtk_table_attach(GTK_TABLE(table), label, 0, 1, 0, 1, GTK_FILL, 0, 0, 0); | |
1155 | |
1156 entry = gtk_entry_new(); | |
1157 gtk_label_set_mnemonic_widget(GTK_LABEL(label), entry); | |
1158 gtk_table_attach(GTK_TABLE(table), entry, 1, 2, 0, 1, GTK_FILL, 0, 0, 0); | |
1159 g_signal_connect(G_OBJECT(entry), "changed", | |
1160 G_CALLBACK(network_ip_changed), NULL); | |
1161 | |
1162 if (gaim_network_get_public_ip() != NULL) | |
1163 gtk_entry_set_text(GTK_ENTRY(entry), | |
1164 gaim_network_get_public_ip()); | |
1165 | |
1166 gaim_set_accessible_label (entry, label); | |
1167 | |
1168 | |
1169 if (gaim_prefs_get_bool("/core/network/auto_ip")) { | |
1170 gtk_widget_set_sensitive(GTK_WIDGET(table), FALSE); | |
1171 } | |
1172 | |
1173 g_signal_connect(G_OBJECT(auto_ip_checkbox), "clicked", | |
1174 G_CALLBACK(gaim_gtk_toggle_sensitive), table); | |
1175 | |
1176 vbox = gaim_gtk_make_frame (ret, _("Ports")); | |
1177 sg = gtk_size_group_new(GTK_SIZE_GROUP_HORIZONTAL); | |
1178 | |
1179 ports_checkbox = gaim_gtk_prefs_checkbox(_("_Manually specify range of ports to listen on"), | |
1180 "/core/network/ports_range_use", vbox); | |
1181 | |
1182 spin_button = gaim_gtk_prefs_labeled_spin_button(vbox, _("_Start Port:"), | |
1183 "/core/network/ports_range_start", 0, 65535, sg); | |
1184 if (!gaim_prefs_get_bool("/core/network/ports_range_use")) | |
1185 gtk_widget_set_sensitive(GTK_WIDGET(spin_button), FALSE); | |
1186 g_signal_connect(G_OBJECT(ports_checkbox), "clicked", | |
1187 G_CALLBACK(gaim_gtk_toggle_sensitive), spin_button); | |
1188 | |
1189 spin_button = gaim_gtk_prefs_labeled_spin_button(vbox, _("_End Port:"), | |
1190 "/core/network/ports_range_end", 0, 65535, sg); | |
1191 if (!gaim_prefs_get_bool("/core/network/ports_range_use")) | |
1192 gtk_widget_set_sensitive(GTK_WIDGET(spin_button), FALSE); | |
1193 g_signal_connect(G_OBJECT(ports_checkbox), "clicked", | |
1194 G_CALLBACK(gaim_gtk_toggle_sensitive), spin_button); | |
1195 | |
1196 gtk_widget_show_all(ret); | |
1197 return ret; | |
1198 } | 1081 } |
1199 | 1082 |
1200 static void | 1083 static void |
1201 proxy_changed_cb(const char *name, GaimPrefType type, gpointer value, | 1084 proxy_changed_cb(const char *name, GaimPrefType type, gpointer value, |
1202 gpointer data) | 1085 gpointer data) |
1220 gaim_prefs_set_string("/core/proxy/username", gtk_entry_get_text(entry)); | 1103 gaim_prefs_set_string("/core/proxy/username", gtk_entry_get_text(entry)); |
1221 else if (entrynum == PROXYPASS) | 1104 else if (entrynum == PROXYPASS) |
1222 gaim_prefs_set_string("/core/proxy/password", gtk_entry_get_text(entry)); | 1105 gaim_prefs_set_string("/core/proxy/password", gtk_entry_get_text(entry)); |
1223 } | 1106 } |
1224 | 1107 |
1225 GtkWidget *proxy_page() { | 1108 GtkWidget *network_page() { |
1226 GtkWidget *ret; | 1109 GtkWidget *ret; |
1227 GtkWidget *vbox; | 1110 GtkWidget *vbox, *hbox, *entry; |
1228 GtkWidget *entry; | 1111 GtkWidget *table, *label, *auto_ip_checkbox, *ports_checkbox, *spin_button; |
1229 GtkWidget *label; | 1112 GtkSizeGroup *sg; |
1230 GtkWidget *hbox; | |
1231 GtkWidget *table; | |
1232 GaimProxyInfo *proxy_info; | 1113 GaimProxyInfo *proxy_info; |
1233 | 1114 |
1234 ret = gtk_vbox_new(FALSE, 18); | 1115 ret = gtk_vbox_new(FALSE, 18); |
1235 gtk_container_set_border_width (GTK_CONTAINER (ret), 12); | 1116 gtk_container_set_border_width (GTK_CONTAINER (ret), 12); |
1236 | 1117 |
1237 vbox = gaim_gtk_make_frame (ret, _("Proxy Type")); | 1118 vbox = gaim_gtk_make_frame (ret, _("IP Address")); |
1238 gaim_gtk_prefs_dropdown(vbox, _("Proxy _type:"), GAIM_PREF_STRING, | 1119 |
1239 "/core/proxy/type", | 1120 auto_ip_checkbox = gaim_gtk_prefs_checkbox(_("_Autodetect IP Address"), |
1240 _("No proxy"), "none", | 1121 "/core/network/auto_ip", vbox); |
1241 "SOCKS 4", "socks4", | 1122 |
1242 "SOCKS 5", "socks5", | 1123 table = gtk_table_new(2, 1, FALSE); |
1243 "HTTP", "http", | |
1244 _("Use Environmental Settings"), "envvar", | |
1245 NULL); | |
1246 | |
1247 vbox = gaim_gtk_make_frame(ret, _("Proxy Server")); | |
1248 prefs_proxy_frame = vbox; | |
1249 | |
1250 proxy_info = gaim_global_proxy_get_info(); | |
1251 | |
1252 if (proxy_info == NULL || | |
1253 gaim_proxy_info_get_type(proxy_info) == GAIM_PROXY_NONE || | |
1254 gaim_proxy_info_get_type(proxy_info) == GAIM_PROXY_USE_ENVVAR) { | |
1255 | |
1256 gtk_widget_set_sensitive(GTK_WIDGET(prefs_proxy_frame), FALSE); | |
1257 } | |
1258 proxy_pref_id = gaim_prefs_connect_callback("/core/proxy/type", | |
1259 proxy_changed_cb, prefs_proxy_frame); | |
1260 | |
1261 table = gtk_table_new(2, 4, FALSE); | |
1262 gtk_container_set_border_width(GTK_CONTAINER(table), 5); | 1124 gtk_container_set_border_width(GTK_CONTAINER(table), 5); |
1263 gtk_table_set_col_spacings(GTK_TABLE(table), 5); | 1125 gtk_table_set_col_spacings(GTK_TABLE(table), 5); |
1264 gtk_table_set_row_spacings(GTK_TABLE(table), 10); | 1126 gtk_table_set_row_spacings(GTK_TABLE(table), 10); |
1265 gtk_container_add(GTK_CONTAINER(vbox), table); | 1127 gtk_container_add(GTK_CONTAINER(vbox), table); |
1128 | |
1129 label = gtk_label_new_with_mnemonic(_("Public _IP:")); | |
1130 gtk_misc_set_alignment(GTK_MISC(label), 1.0, 0.5); | |
1131 gtk_table_attach(GTK_TABLE(table), label, 0, 1, 0, 1, GTK_FILL, 0, 0, 0); | |
1132 | |
1133 entry = gtk_entry_new(); | |
1134 gtk_label_set_mnemonic_widget(GTK_LABEL(label), entry); | |
1135 gtk_table_attach(GTK_TABLE(table), entry, 1, 2, 0, 1, GTK_FILL, 0, 0, 0); | |
1136 g_signal_connect(G_OBJECT(entry), "changed", | |
1137 G_CALLBACK(network_ip_changed), NULL); | |
1138 | |
1139 if (gaim_network_get_public_ip() != NULL) | |
1140 gtk_entry_set_text(GTK_ENTRY(entry), | |
1141 gaim_network_get_public_ip()); | |
1142 | |
1143 gaim_set_accessible_label (entry, label); | |
1144 | |
1145 | |
1146 if (gaim_prefs_get_bool("/core/network/auto_ip")) { | |
1147 gtk_widget_set_sensitive(GTK_WIDGET(table), FALSE); | |
1148 } | |
1149 | |
1150 g_signal_connect(G_OBJECT(auto_ip_checkbox), "clicked", | |
1151 G_CALLBACK(gaim_gtk_toggle_sensitive), table); | |
1152 | |
1153 vbox = gaim_gtk_make_frame (ret, _("Ports")); | |
1154 sg = gtk_size_group_new(GTK_SIZE_GROUP_HORIZONTAL); | |
1155 | |
1156 ports_checkbox = gaim_gtk_prefs_checkbox(_("_Manually specify range of ports to listen on"), | |
1157 "/core/network/ports_range_use", vbox); | |
1158 | |
1159 spin_button = gaim_gtk_prefs_labeled_spin_button(vbox, _("_Start Port:"), | |
1160 "/core/network/ports_range_start", 0, 65535, sg); | |
1161 if (!gaim_prefs_get_bool("/core/network/ports_range_use")) | |
1162 gtk_widget_set_sensitive(GTK_WIDGET(spin_button), FALSE); | |
1163 g_signal_connect(G_OBJECT(ports_checkbox), "clicked", | |
1164 G_CALLBACK(gaim_gtk_toggle_sensitive), spin_button); | |
1165 | |
1166 spin_button = gaim_gtk_prefs_labeled_spin_button(vbox, _("_End Port:"), | |
1167 "/core/network/ports_range_end", 0, 65535, sg); | |
1168 if (!gaim_prefs_get_bool("/core/network/ports_range_use")) | |
1169 gtk_widget_set_sensitive(GTK_WIDGET(spin_button), FALSE); | |
1170 g_signal_connect(G_OBJECT(ports_checkbox), "clicked", | |
1171 G_CALLBACK(gaim_gtk_toggle_sensitive), spin_button); | |
1172 | |
1173 vbox = gaim_gtk_make_frame(ret, _("Proxy Server")); | |
1174 prefs_proxy_frame = gtk_vbox_new(FALSE, 0); | |
1175 gaim_gtk_prefs_dropdown(vbox, _("Proxy _type:"), GAIM_PREF_STRING, | |
1176 "/core/proxy/type", | |
1177 _("No proxy"), "none", | |
1178 "SOCKS 4", "socks4", | |
1179 "SOCKS 5", "socks5", | |
1180 "HTTP", "http", | |
1181 _("Use Environmental Settings"), "envvar", | |
1182 NULL); | |
1183 gtk_box_pack_start(GTK_BOX(vbox), prefs_proxy_frame, 0, 0, 0); | |
1184 proxy_info = gaim_global_proxy_get_info(); | |
1185 | |
1186 if (proxy_info == NULL || | |
1187 gaim_proxy_info_get_type(proxy_info) == GAIM_PROXY_NONE || | |
1188 gaim_proxy_info_get_type(proxy_info) == GAIM_PROXY_USE_ENVVAR) { | |
1189 | |
1190 gtk_widget_set_sensitive(GTK_WIDGET(prefs_proxy_frame), FALSE); | |
1191 } | |
1192 proxy_pref_id = gaim_prefs_connect_callback("/core/proxy/type", | |
1193 proxy_changed_cb, prefs_proxy_frame); | |
1194 | |
1195 table = gtk_table_new(4, 2, FALSE); | |
1196 gtk_container_set_border_width(GTK_CONTAINER(table), 5); | |
1197 gtk_table_set_col_spacings(GTK_TABLE(table), 5); | |
1198 gtk_table_set_row_spacings(GTK_TABLE(table), 10); | |
1199 gtk_container_add(GTK_CONTAINER(prefs_proxy_frame), table); | |
1266 | 1200 |
1267 | 1201 |
1268 label = gtk_label_new_with_mnemonic(_("_Host:")); | 1202 label = gtk_label_new_with_mnemonic(_("_Host:")); |
1269 gtk_misc_set_alignment(GTK_MISC(label), 1.0, 0.5); | 1203 gtk_misc_set_alignment(GTK_MISC(label), 1.0, 0.5); |
1270 gtk_table_attach(GTK_TABLE(table), label, 0, 1, 0, 1, GTK_FILL, 0, 0, 0); | 1204 gtk_table_attach(GTK_TABLE(table), label, 0, 1, 0, 1, GTK_FILL, 0, 0, 0); |
1283 gtk_box_pack_start(GTK_BOX(vbox), hbox, FALSE, FALSE, 0); | 1217 gtk_box_pack_start(GTK_BOX(vbox), hbox, FALSE, FALSE, 0); |
1284 gaim_set_accessible_label (entry, label); | 1218 gaim_set_accessible_label (entry, label); |
1285 | 1219 |
1286 label = gtk_label_new_with_mnemonic(_("_Port:")); | 1220 label = gtk_label_new_with_mnemonic(_("_Port:")); |
1287 gtk_misc_set_alignment(GTK_MISC(label), 1.0, 0.5); | 1221 gtk_misc_set_alignment(GTK_MISC(label), 1.0, 0.5); |
1222 gtk_table_attach(GTK_TABLE(table), label, 2, 3, 0, 1, GTK_FILL, 0, 0, 0); | |
1223 | |
1224 entry = gtk_entry_new(); | |
1225 gtk_label_set_mnemonic_widget(GTK_LABEL(label), entry); | |
1226 gtk_table_attach(GTK_TABLE(table), entry, 3, 4, 0, 1, GTK_FILL, 0, 0, 0); | |
1227 g_signal_connect(G_OBJECT(entry), "changed", | |
1228 G_CALLBACK(proxy_print_option), (void *)PROXYPORT); | |
1229 | |
1230 if (proxy_info != NULL && gaim_proxy_info_get_port(proxy_info) != 0) { | |
1231 char buf[128]; | |
1232 g_snprintf(buf, sizeof(buf), "%d", | |
1233 gaim_proxy_info_get_port(proxy_info)); | |
1234 | |
1235 gtk_entry_set_text(GTK_ENTRY(entry), buf); | |
1236 } | |
1237 gaim_set_accessible_label (entry, label); | |
1238 | |
1239 label = gtk_label_new_with_mnemonic(_("_User:")); | |
1240 gtk_misc_set_alignment(GTK_MISC(label), 1.0, 0.5); | |
1288 gtk_table_attach(GTK_TABLE(table), label, 0, 1, 1, 2, GTK_FILL, 0, 0, 0); | 1241 gtk_table_attach(GTK_TABLE(table), label, 0, 1, 1, 2, GTK_FILL, 0, 0, 0); |
1289 | 1242 |
1290 entry = gtk_entry_new(); | 1243 entry = gtk_entry_new(); |
1291 gtk_label_set_mnemonic_widget(GTK_LABEL(label), entry); | 1244 gtk_label_set_mnemonic_widget(GTK_LABEL(label), entry); |
1292 gtk_table_attach(GTK_TABLE(table), entry, 1, 2, 1, 2, GTK_FILL, 0, 0, 0); | 1245 gtk_table_attach(GTK_TABLE(table), entry, 1, 2, 1, 2, GTK_FILL, 0, 0, 0); |
1293 g_signal_connect(G_OBJECT(entry), "changed", | 1246 g_signal_connect(G_OBJECT(entry), "changed", |
1294 G_CALLBACK(proxy_print_option), (void *)PROXYPORT); | |
1295 | |
1296 if (proxy_info != NULL && gaim_proxy_info_get_port(proxy_info) != 0) { | |
1297 char buf[128]; | |
1298 g_snprintf(buf, sizeof(buf), "%d", | |
1299 gaim_proxy_info_get_port(proxy_info)); | |
1300 | |
1301 gtk_entry_set_text(GTK_ENTRY(entry), buf); | |
1302 } | |
1303 gaim_set_accessible_label (entry, label); | |
1304 | |
1305 label = gtk_label_new_with_mnemonic(_("_User:")); | |
1306 gtk_misc_set_alignment(GTK_MISC(label), 1.0, 0.5); | |
1307 gtk_table_attach(GTK_TABLE(table), label, 0, 1, 2, 3, GTK_FILL, 0, 0, 0); | |
1308 | |
1309 entry = gtk_entry_new(); | |
1310 gtk_label_set_mnemonic_widget(GTK_LABEL(label), entry); | |
1311 gtk_table_attach(GTK_TABLE(table), entry, 1, 2, 2, 3, GTK_FILL, 0, 0, 0); | |
1312 g_signal_connect(G_OBJECT(entry), "changed", | |
1313 G_CALLBACK(proxy_print_option), (void *)PROXYUSER); | 1247 G_CALLBACK(proxy_print_option), (void *)PROXYUSER); |
1314 | 1248 |
1315 if (proxy_info != NULL && gaim_proxy_info_get_username(proxy_info) != NULL) | 1249 if (proxy_info != NULL && gaim_proxy_info_get_username(proxy_info) != NULL) |
1316 gtk_entry_set_text(GTK_ENTRY(entry), | 1250 gtk_entry_set_text(GTK_ENTRY(entry), |
1317 gaim_proxy_info_get_username(proxy_info)); | 1251 gaim_proxy_info_get_username(proxy_info)); |
1320 gtk_box_pack_start(GTK_BOX(vbox), hbox, FALSE, FALSE, 0); | 1254 gtk_box_pack_start(GTK_BOX(vbox), hbox, FALSE, FALSE, 0); |
1321 gaim_set_accessible_label (entry, label); | 1255 gaim_set_accessible_label (entry, label); |
1322 | 1256 |
1323 label = gtk_label_new_with_mnemonic(_("Pa_ssword:")); | 1257 label = gtk_label_new_with_mnemonic(_("Pa_ssword:")); |
1324 gtk_misc_set_alignment(GTK_MISC(label), 1.0, 0.5); | 1258 gtk_misc_set_alignment(GTK_MISC(label), 1.0, 0.5); |
1325 gtk_table_attach(GTK_TABLE(table), label, 0, 1, 3, 4, GTK_FILL, 0, 0, 0); | 1259 gtk_table_attach(GTK_TABLE(table), label, 2, 3, 1, 2, GTK_FILL, 0, 0, 0); |
1326 | 1260 |
1327 entry = gtk_entry_new(); | 1261 entry = gtk_entry_new(); |
1328 gtk_label_set_mnemonic_widget(GTK_LABEL(label), entry); | 1262 gtk_label_set_mnemonic_widget(GTK_LABEL(label), entry); |
1329 gtk_table_attach(GTK_TABLE(table), entry, 1, 2, 3, 4, GTK_FILL , 0, 0, 0); | 1263 gtk_table_attach(GTK_TABLE(table), entry, 3, 4, 1, 2, GTK_FILL , 0, 0, 0); |
1330 gtk_entry_set_visibility(GTK_ENTRY(entry), FALSE); | 1264 gtk_entry_set_visibility(GTK_ENTRY(entry), FALSE); |
1331 g_signal_connect(G_OBJECT(entry), "changed", | 1265 g_signal_connect(G_OBJECT(entry), "changed", |
1332 G_CALLBACK(proxy_print_option), (void *)PROXYPASS); | 1266 G_CALLBACK(proxy_print_option), (void *)PROXYPASS); |
1333 | 1267 |
1334 if (proxy_info != NULL && gaim_proxy_info_get_password(proxy_info) != NULL) | 1268 if (proxy_info != NULL && gaim_proxy_info_get_password(proxy_info) != NULL) |
1553 | 1487 |
1554 gtk_widget_set_sensitive(hbox, !strcmp(method, "custom")); | 1488 gtk_widget_set_sensitive(hbox, !strcmp(method, "custom")); |
1555 } | 1489 } |
1556 #endif | 1490 #endif |
1557 | 1491 |
1492 | |
1493 static void | |
1494 event_toggled(GtkCellRendererToggle *cell, gchar *pth, gpointer data) | |
1495 { | |
1496 GtkTreeModel *model = (GtkTreeModel *)data; | |
1497 GtkTreeIter iter; | |
1498 GtkTreePath *path = gtk_tree_path_new_from_string(pth); | |
1499 const char *pref; | |
1500 | |
1501 gtk_tree_model_get_iter (model, &iter, path); | |
1502 gtk_tree_model_get (model, &iter, | |
1503 2, &pref, | |
1504 -1); | |
1505 | |
1506 gaim_prefs_set_bool(pref, !gtk_cell_renderer_toggle_get_active(cell)); | |
1507 | |
1508 gtk_list_store_set(GTK_LIST_STORE (model), &iter, | |
1509 0, !gtk_cell_renderer_toggle_get_active(cell), | |
1510 -1); | |
1511 | |
1512 gtk_tree_path_free(path); | |
1513 } | |
1514 | |
1515 static void | |
1516 test_sound(GtkWidget *button, gpointer i_am_NULL) | |
1517 { | |
1518 char *pref; | |
1519 gboolean temp_value1, temp_value2; | |
1520 | |
1521 pref = g_strdup_printf("/gaim/gtk/sound/enabled/%s", | |
1522 gaim_gtk_sound_get_event_option(sound_row_sel)); | |
1523 | |
1524 temp_value1 = gaim_prefs_get_bool("/core/sound/while_away"); | |
1525 temp_value2 = gaim_prefs_get_bool(pref); | |
1526 | |
1527 if (!temp_value1) gaim_prefs_set_bool("/core/sound/while_away", TRUE); | |
1528 if (!temp_value2) gaim_prefs_set_bool(pref, TRUE); | |
1529 | |
1530 gaim_sound_play_event(sound_row_sel); | |
1531 | |
1532 if (!temp_value1) gaim_prefs_set_bool("/core/sound/while_away", FALSE); | |
1533 if (!temp_value2) gaim_prefs_set_bool(pref, FALSE); | |
1534 | |
1535 g_free(pref); | |
1536 } | |
1537 | |
1538 static void | |
1539 reset_sound(GtkWidget *button, gpointer i_am_also_NULL) | |
1540 { | |
1541 char *pref = g_strdup_printf("/gaim/gtk/sound/file/%s", | |
1542 gaim_gtk_sound_get_event_option(sound_row_sel)); | |
1543 | |
1544 /* This just resets a sound file back to default */ | |
1545 gaim_prefs_set_string(pref, ""); | |
1546 g_free(pref); | |
1547 | |
1548 gtk_entry_set_text(GTK_ENTRY(sound_entry), "(default)"); | |
1549 } | |
1550 | |
1551 void close_sounddialog(GtkWidget *w, GtkWidget *w2) | |
1552 { | |
1553 | |
1554 GtkWidget *dest; | |
1555 | |
1556 if (!GTK_IS_WIDGET(w2)) | |
1557 dest = w; | |
1558 else | |
1559 dest = w2; | |
1560 | |
1561 sounddialog = NULL; | |
1562 | |
1563 gtk_widget_destroy(dest); | |
1564 } | |
1565 | |
1566 void do_select_sound(GtkWidget *w, gpointer data) | |
1567 { | |
1568 const char *file; | |
1569 char *pref; | |
1570 int snd; | |
1571 | |
1572 file = gtk_file_selection_get_filename(GTK_FILE_SELECTION(sounddialog)); | |
1573 snd = GPOINTER_TO_INT(data); | |
1574 | |
1575 /* If they type in a directory, change there */ | |
1576 if (gaim_gtk_check_if_dir(file, GTK_FILE_SELECTION(sounddialog))) | |
1577 return; | |
1578 | |
1579 /* Set it -- and forget it */ | |
1580 pref = g_strdup_printf("/gaim/gtk/sound/file/%s", | |
1581 gaim_gtk_sound_get_event_option(snd)); | |
1582 gaim_prefs_set_string(pref, file); | |
1583 g_free(pref); | |
1584 | |
1585 /* Set our text entry */ | |
1586 gtk_entry_set_text(GTK_ENTRY(sound_entry), file); | |
1587 | |
1588 /* Close the window! It's getting cold in here! */ | |
1589 close_sounddialog(NULL, sounddialog); | |
1590 | |
1591 if (last_sound_dir) | |
1592 g_free(last_sound_dir); | |
1593 last_sound_dir = g_path_get_dirname(file); | |
1594 } | |
1595 | |
1596 static void sel_sound(GtkWidget *button, gpointer being_NULL_is_fun) | |
1597 { | |
1598 char *buf = g_malloc(BUF_LEN); | |
1599 | |
1600 if (!sounddialog) { | |
1601 sounddialog = gtk_file_selection_new(_("Sound Selection")); | |
1602 | |
1603 gtk_file_selection_hide_fileop_buttons(GTK_FILE_SELECTION(sounddialog)); | |
1604 | |
1605 g_snprintf(buf, BUF_LEN - 1, "%s" G_DIR_SEPARATOR_S, last_sound_dir ? last_sound_dir : gaim_home_dir()); | |
1606 | |
1607 gtk_file_selection_set_filename(GTK_FILE_SELECTION(sounddialog), buf); | |
1608 | |
1609 g_signal_connect(G_OBJECT(sounddialog), "destroy", | |
1610 G_CALLBACK(close_sounddialog), sounddialog); | |
1611 | |
1612 g_signal_connect(G_OBJECT(GTK_FILE_SELECTION(sounddialog)->ok_button), | |
1613 "clicked", | |
1614 G_CALLBACK(do_select_sound), GINT_TO_POINTER(sound_row_sel)); | |
1615 | |
1616 g_signal_connect(G_OBJECT(GTK_FILE_SELECTION(sounddialog)->cancel_button), | |
1617 "clicked", | |
1618 G_CALLBACK(close_sounddialog), sounddialog); | |
1619 } | |
1620 | |
1621 g_free(buf); | |
1622 gtk_widget_show(sounddialog); | |
1623 gdk_window_raise(sounddialog->window); | |
1624 } | |
1625 | |
1626 | |
1627 static void prefs_sound_sel (GtkTreeSelection *sel, GtkTreeModel *model) { | |
1628 GtkTreeIter iter; | |
1629 GValue val = { 0, }; | |
1630 const char *file; | |
1631 char *pref; | |
1632 | |
1633 if (! gtk_tree_selection_get_selected (sel, &model, &iter)) | |
1634 return; | |
1635 gtk_tree_model_get_value (model, &iter, 3, &val); | |
1636 sound_row_sel = g_value_get_uint(&val); | |
1637 | |
1638 pref = g_strdup_printf("/gaim/gtk/sound/file/%s", | |
1639 gaim_gtk_sound_get_event_option(sound_row_sel)); | |
1640 file = gaim_prefs_get_string(pref); | |
1641 g_free(pref); | |
1642 if (sound_entry) | |
1643 gtk_entry_set_text(GTK_ENTRY(sound_entry), (file && *file != '\0') ? file : "(default)"); | |
1644 g_value_unset (&val); | |
1645 if (sounddialog) | |
1646 gtk_widget_destroy(sounddialog); | |
1647 } | |
1648 | |
1558 GtkWidget *sound_page() { | 1649 GtkWidget *sound_page() { |
1559 GtkWidget *ret; | 1650 GtkWidget *ret; |
1560 GtkWidget *vbox; | 1651 GtkWidget *vbox, *sw, *button; |
1561 GtkSizeGroup *sg; | 1652 GtkSizeGroup *sg; |
1653 GtkTreeIter iter; | |
1654 GtkWidget *event_view; | |
1655 GtkListStore *event_store; | |
1656 GtkCellRenderer *rend; | |
1657 GtkTreeViewColumn *col; | |
1658 GtkTreeSelection *sel; | |
1659 GtkTreePath *path; | |
1660 int j; | |
1661 const char *file; | |
1662 char *pref; | |
1562 #ifndef _WIN32 | 1663 #ifndef _WIN32 |
1563 GtkWidget *dd; | 1664 GtkWidget *dd; |
1564 GtkWidget *hbox; | 1665 GtkWidget *hbox; |
1565 GtkWidget *label; | 1666 GtkWidget *label; |
1566 GtkWidget *entry; | 1667 GtkWidget *entry; |
1625 sound_pref_id = gaim_prefs_connect_callback("/gaim/gtk/sound/method", | 1726 sound_pref_id = gaim_prefs_connect_callback("/gaim/gtk/sound/method", |
1626 sound_changed_cb, hbox); | 1727 sound_changed_cb, hbox); |
1627 | 1728 |
1628 gaim_set_accessible_label (entry, label); | 1729 gaim_set_accessible_label (entry, label); |
1629 #endif /* _WIN32 */ | 1730 #endif /* _WIN32 */ |
1731 | |
1732 vbox = gaim_gtk_make_frame(ret, _("Sound Events")); | |
1733 | |
1734 sw = gtk_scrolled_window_new(NULL,NULL); | |
1735 gtk_scrolled_window_set_policy(GTK_SCROLLED_WINDOW(sw), GTK_POLICY_NEVER, GTK_POLICY_AUTOMATIC); | |
1736 gtk_scrolled_window_set_shadow_type (GTK_SCROLLED_WINDOW(sw), GTK_SHADOW_IN); | |
1737 | |
1738 gtk_box_pack_start(GTK_BOX(vbox), sw, TRUE, TRUE, 0); | |
1739 event_store = gtk_list_store_new (4, G_TYPE_BOOLEAN, G_TYPE_STRING, G_TYPE_STRING, G_TYPE_UINT); | |
1740 | |
1741 for (j=0; j < GAIM_NUM_SOUNDS; j++) { | |
1742 char *pref = g_strdup_printf("/gaim/gtk/sound/enabled/%s", | |
1743 gaim_gtk_sound_get_event_option(j)); | |
1744 const char *label = gaim_gtk_sound_get_event_label(j); | |
1745 | |
1746 if (label == NULL) { | |
1747 g_free(pref); | |
1748 continue; | |
1749 } | |
1750 | |
1751 gtk_list_store_append (event_store, &iter); | |
1752 gtk_list_store_set(event_store, &iter, | |
1753 0, gaim_prefs_get_bool(pref), | |
1754 1, _(label), | |
1755 2, pref, | |
1756 3, j, | |
1757 -1); | |
1758 g_free(pref); | |
1759 } | |
1760 | |
1761 event_view = gtk_tree_view_new_with_model (GTK_TREE_MODEL(event_store)); | |
1762 | |
1763 rend = gtk_cell_renderer_toggle_new(); | |
1764 sel = gtk_tree_view_get_selection (GTK_TREE_VIEW (event_view)); | |
1765 g_signal_connect (G_OBJECT (sel), "changed", | |
1766 G_CALLBACK (prefs_sound_sel), | |
1767 NULL); | |
1768 g_signal_connect (G_OBJECT(rend), "toggled", | |
1769 G_CALLBACK(event_toggled), event_store); | |
1770 path = gtk_tree_path_new_first(); | |
1771 gtk_tree_selection_select_path(sel, path); | |
1772 gtk_tree_path_free(path); | |
1773 | |
1774 col = gtk_tree_view_column_new_with_attributes (_("Play"), | |
1775 rend, | |
1776 "active", 0, | |
1777 NULL); | |
1778 gtk_tree_view_append_column (GTK_TREE_VIEW(event_view), col); | |
1779 | |
1780 rend = gtk_cell_renderer_text_new(); | |
1781 col = gtk_tree_view_column_new_with_attributes (_("Event"), | |
1782 rend, | |
1783 "text", 1, | |
1784 NULL); | |
1785 gtk_tree_view_append_column (GTK_TREE_VIEW(event_view), col); | |
1786 g_object_unref(G_OBJECT(event_store)); | |
1787 gtk_container_add(GTK_CONTAINER(sw), event_view); | |
1788 | |
1789 hbox = gtk_hbox_new(FALSE, 6); | |
1790 gtk_box_pack_start(GTK_BOX(vbox), hbox, FALSE, FALSE, 0); | |
1791 sound_entry = gtk_entry_new(); | |
1792 pref = g_strdup_printf("/gaim/gtk/sound/file/%s", | |
1793 gaim_gtk_sound_get_event_option(0)); | |
1794 file = gaim_prefs_get_string(pref); | |
1795 g_free(pref); | |
1796 gtk_entry_set_text(GTK_ENTRY(sound_entry), (file && *file != '\0') ? file : "(default)"); | |
1797 gtk_editable_set_editable(GTK_EDITABLE(sound_entry), FALSE); | |
1798 gtk_box_pack_start(GTK_BOX(hbox), sound_entry, FALSE, FALSE, 5); | |
1799 | |
1800 button = gtk_button_new_with_label(_("Test")); | |
1801 g_signal_connect(G_OBJECT(button), "clicked", G_CALLBACK(test_sound), NULL); | |
1802 gtk_box_pack_start(GTK_BOX(hbox), button, FALSE, FALSE, 1); | |
1803 | |
1804 button = gtk_button_new_with_label(_("Reset")); | |
1805 g_signal_connect(G_OBJECT(button), "clicked", G_CALLBACK(reset_sound), NULL); | |
1806 gtk_box_pack_start(GTK_BOX(hbox), button, FALSE, FALSE, 1); | |
1807 | |
1808 button = gtk_button_new_with_label(_("Choose...")); | |
1809 g_signal_connect(G_OBJECT(button), "clicked", G_CALLBACK(sel_sound), NULL); | |
1810 gtk_box_pack_start(GTK_BOX(hbox), button, FALSE, FALSE, 1); | |
1630 gtk_widget_show_all(ret); | 1811 gtk_widget_show_all(ret); |
1631 | 1812 |
1632 return ret; | 1813 return ret; |
1633 } | 1814 } |
1634 | 1815 |
1635 GtkWidget *away_page() { | 1816 GtkWidget *away_page() { |
1636 GtkWidget *ret; | 1817 GtkWidget *ret; |
2079 | 2260 |
2080 gtk_widget_show_all(ret); | 2261 gtk_widget_show_all(ret); |
2081 return ret; | 2262 return ret; |
2082 } | 2263 } |
2083 | 2264 |
2084 static void | |
2085 event_toggled(GtkCellRendererToggle *cell, gchar *pth, gpointer data) | |
2086 { | |
2087 GtkTreeModel *model = (GtkTreeModel *)data; | |
2088 GtkTreeIter iter; | |
2089 GtkTreePath *path = gtk_tree_path_new_from_string(pth); | |
2090 const char *pref; | |
2091 | |
2092 gtk_tree_model_get_iter (model, &iter, path); | |
2093 gtk_tree_model_get (model, &iter, | |
2094 2, &pref, | |
2095 -1); | |
2096 | |
2097 gaim_prefs_set_bool(pref, !gtk_cell_renderer_toggle_get_active(cell)); | |
2098 | |
2099 gtk_list_store_set(GTK_LIST_STORE (model), &iter, | |
2100 0, !gtk_cell_renderer_toggle_get_active(cell), | |
2101 -1); | |
2102 | |
2103 gtk_tree_path_free(path); | |
2104 } | |
2105 | |
2106 static void | |
2107 test_sound(GtkWidget *button, gpointer i_am_NULL) | |
2108 { | |
2109 char *pref; | |
2110 gboolean temp_value1, temp_value2; | |
2111 | |
2112 pref = g_strdup_printf("/gaim/gtk/sound/enabled/%s", | |
2113 gaim_gtk_sound_get_event_option(sound_row_sel)); | |
2114 | |
2115 temp_value1 = gaim_prefs_get_bool("/core/sound/while_away"); | |
2116 temp_value2 = gaim_prefs_get_bool(pref); | |
2117 | |
2118 if (!temp_value1) gaim_prefs_set_bool("/core/sound/while_away", TRUE); | |
2119 if (!temp_value2) gaim_prefs_set_bool(pref, TRUE); | |
2120 | |
2121 gaim_sound_play_event(sound_row_sel); | |
2122 | |
2123 if (!temp_value1) gaim_prefs_set_bool("/core/sound/while_away", FALSE); | |
2124 if (!temp_value2) gaim_prefs_set_bool(pref, FALSE); | |
2125 | |
2126 g_free(pref); | |
2127 } | |
2128 | |
2129 static void | |
2130 reset_sound(GtkWidget *button, gpointer i_am_also_NULL) | |
2131 { | |
2132 char *pref = g_strdup_printf("/gaim/gtk/sound/file/%s", | |
2133 gaim_gtk_sound_get_event_option(sound_row_sel)); | |
2134 | |
2135 /* This just resets a sound file back to default */ | |
2136 gaim_prefs_set_string(pref, ""); | |
2137 g_free(pref); | |
2138 | |
2139 gtk_entry_set_text(GTK_ENTRY(sound_entry), "(default)"); | |
2140 } | |
2141 | |
2142 void close_sounddialog(GtkWidget *w, GtkWidget *w2) | |
2143 { | |
2144 | |
2145 GtkWidget *dest; | |
2146 | |
2147 if (!GTK_IS_WIDGET(w2)) | |
2148 dest = w; | |
2149 else | |
2150 dest = w2; | |
2151 | |
2152 sounddialog = NULL; | |
2153 | |
2154 gtk_widget_destroy(dest); | |
2155 } | |
2156 | |
2157 void do_select_sound(GtkWidget *w, gpointer data) | |
2158 { | |
2159 const char *file; | |
2160 char *pref; | |
2161 int snd; | |
2162 | |
2163 file = gtk_file_selection_get_filename(GTK_FILE_SELECTION(sounddialog)); | |
2164 snd = GPOINTER_TO_INT(data); | |
2165 | |
2166 /* If they type in a directory, change there */ | |
2167 if (gaim_gtk_check_if_dir(file, GTK_FILE_SELECTION(sounddialog))) | |
2168 return; | |
2169 | |
2170 /* Set it -- and forget it */ | |
2171 pref = g_strdup_printf("/gaim/gtk/sound/file/%s", | |
2172 gaim_gtk_sound_get_event_option(snd)); | |
2173 gaim_prefs_set_string(pref, file); | |
2174 g_free(pref); | |
2175 | |
2176 /* Set our text entry */ | |
2177 gtk_entry_set_text(GTK_ENTRY(sound_entry), file); | |
2178 | |
2179 /* Close the window! It's getting cold in here! */ | |
2180 close_sounddialog(NULL, sounddialog); | |
2181 | |
2182 if (last_sound_dir) | |
2183 g_free(last_sound_dir); | |
2184 last_sound_dir = g_path_get_dirname(file); | |
2185 } | |
2186 | |
2187 static void sel_sound(GtkWidget *button, gpointer being_NULL_is_fun) | |
2188 { | |
2189 char *buf = g_malloc(BUF_LEN); | |
2190 | |
2191 if (!sounddialog) { | |
2192 sounddialog = gtk_file_selection_new(_("Sound Selection")); | |
2193 | |
2194 gtk_file_selection_hide_fileop_buttons(GTK_FILE_SELECTION(sounddialog)); | |
2195 | |
2196 g_snprintf(buf, BUF_LEN - 1, "%s" G_DIR_SEPARATOR_S, last_sound_dir ? last_sound_dir : gaim_home_dir()); | |
2197 | |
2198 gtk_file_selection_set_filename(GTK_FILE_SELECTION(sounddialog), buf); | |
2199 | |
2200 g_signal_connect(G_OBJECT(sounddialog), "destroy", | |
2201 G_CALLBACK(close_sounddialog), sounddialog); | |
2202 | |
2203 g_signal_connect(G_OBJECT(GTK_FILE_SELECTION(sounddialog)->ok_button), | |
2204 "clicked", | |
2205 G_CALLBACK(do_select_sound), GINT_TO_POINTER(sound_row_sel)); | |
2206 | |
2207 g_signal_connect(G_OBJECT(GTK_FILE_SELECTION(sounddialog)->cancel_button), | |
2208 "clicked", | |
2209 G_CALLBACK(close_sounddialog), sounddialog); | |
2210 } | |
2211 | |
2212 g_free(buf); | |
2213 gtk_widget_show(sounddialog); | |
2214 gdk_window_raise(sounddialog->window); | |
2215 } | |
2216 | |
2217 | |
2218 static void prefs_sound_sel (GtkTreeSelection *sel, GtkTreeModel *model) { | |
2219 GtkTreeIter iter; | |
2220 GValue val = { 0, }; | |
2221 const char *file; | |
2222 char *pref; | |
2223 | |
2224 if (! gtk_tree_selection_get_selected (sel, &model, &iter)) | |
2225 return; | |
2226 gtk_tree_model_get_value (model, &iter, 3, &val); | |
2227 sound_row_sel = g_value_get_uint(&val); | |
2228 | |
2229 pref = g_strdup_printf("/gaim/gtk/sound/file/%s", | |
2230 gaim_gtk_sound_get_event_option(sound_row_sel)); | |
2231 file = gaim_prefs_get_string(pref); | |
2232 g_free(pref); | |
2233 if (sound_entry) | |
2234 gtk_entry_set_text(GTK_ENTRY(sound_entry), (file && *file != '\0') ? file : "(default)"); | |
2235 g_value_unset (&val); | |
2236 if (sounddialog) | |
2237 gtk_widget_destroy(sounddialog); | |
2238 } | |
2239 | |
2240 GtkWidget *sound_events_page() { | |
2241 | |
2242 GtkWidget *ret; | |
2243 GtkWidget *sw; | |
2244 GtkWidget *button, *hbox; | |
2245 GtkTreeIter iter; | |
2246 GtkWidget *event_view; | |
2247 GtkListStore *event_store; | |
2248 GtkCellRenderer *rend; | |
2249 GtkTreeViewColumn *col; | |
2250 GtkTreeSelection *sel; | |
2251 GtkTreePath *path; | |
2252 int j; | |
2253 const char *file; | |
2254 char *pref; | |
2255 | |
2256 ret = gtk_vbox_new(FALSE, 18); | |
2257 gtk_container_set_border_width (GTK_CONTAINER (ret), 12); | |
2258 | |
2259 sw = gtk_scrolled_window_new(NULL,NULL); | |
2260 gtk_scrolled_window_set_policy(GTK_SCROLLED_WINDOW(sw), GTK_POLICY_NEVER, GTK_POLICY_AUTOMATIC); | |
2261 gtk_scrolled_window_set_shadow_type (GTK_SCROLLED_WINDOW(sw), GTK_SHADOW_IN); | |
2262 | |
2263 gtk_box_pack_start(GTK_BOX(ret), sw, TRUE, TRUE, 0); | |
2264 event_store = gtk_list_store_new (4, G_TYPE_BOOLEAN, G_TYPE_STRING, G_TYPE_STRING, G_TYPE_UINT); | |
2265 | |
2266 for (j=0; j < GAIM_NUM_SOUNDS; j++) { | |
2267 char *pref = g_strdup_printf("/gaim/gtk/sound/enabled/%s", | |
2268 gaim_gtk_sound_get_event_option(j)); | |
2269 const char *label = gaim_gtk_sound_get_event_label(j); | |
2270 | |
2271 if (label == NULL) { | |
2272 g_free(pref); | |
2273 continue; | |
2274 } | |
2275 | |
2276 gtk_list_store_append (event_store, &iter); | |
2277 gtk_list_store_set(event_store, &iter, | |
2278 0, gaim_prefs_get_bool(pref), | |
2279 1, _(label), | |
2280 2, pref, | |
2281 3, j, | |
2282 -1); | |
2283 g_free(pref); | |
2284 } | |
2285 | |
2286 event_view = gtk_tree_view_new_with_model (GTK_TREE_MODEL(event_store)); | |
2287 | |
2288 rend = gtk_cell_renderer_toggle_new(); | |
2289 sel = gtk_tree_view_get_selection (GTK_TREE_VIEW (event_view)); | |
2290 g_signal_connect (G_OBJECT (sel), "changed", | |
2291 G_CALLBACK (prefs_sound_sel), | |
2292 NULL); | |
2293 g_signal_connect (G_OBJECT(rend), "toggled", | |
2294 G_CALLBACK(event_toggled), event_store); | |
2295 path = gtk_tree_path_new_first(); | |
2296 gtk_tree_selection_select_path(sel, path); | |
2297 gtk_tree_path_free(path); | |
2298 | |
2299 col = gtk_tree_view_column_new_with_attributes (_("Play"), | |
2300 rend, | |
2301 "active", 0, | |
2302 NULL); | |
2303 gtk_tree_view_append_column (GTK_TREE_VIEW(event_view), col); | |
2304 | |
2305 rend = gtk_cell_renderer_text_new(); | |
2306 col = gtk_tree_view_column_new_with_attributes (_("Event"), | |
2307 rend, | |
2308 "text", 1, | |
2309 NULL); | |
2310 gtk_tree_view_append_column (GTK_TREE_VIEW(event_view), col); | |
2311 g_object_unref(G_OBJECT(event_store)); | |
2312 gtk_container_add(GTK_CONTAINER(sw), event_view); | |
2313 | |
2314 hbox = gtk_hbox_new(FALSE, 6); | |
2315 gtk_box_pack_start(GTK_BOX(ret), hbox, FALSE, FALSE, 0); | |
2316 sound_entry = gtk_entry_new(); | |
2317 pref = g_strdup_printf("/gaim/gtk/sound/file/%s", | |
2318 gaim_gtk_sound_get_event_option(0)); | |
2319 file = gaim_prefs_get_string(pref); | |
2320 g_free(pref); | |
2321 gtk_entry_set_text(GTK_ENTRY(sound_entry), (file && *file != '\0') ? file : "(default)"); | |
2322 gtk_editable_set_editable(GTK_EDITABLE(sound_entry), FALSE); | |
2323 gtk_box_pack_start(GTK_BOX(hbox), sound_entry, FALSE, FALSE, 5); | |
2324 | |
2325 button = gtk_button_new_with_label(_("Test")); | |
2326 g_signal_connect(G_OBJECT(button), "clicked", G_CALLBACK(test_sound), NULL); | |
2327 gtk_box_pack_start(GTK_BOX(hbox), button, FALSE, FALSE, 1); | |
2328 | |
2329 button = gtk_button_new_with_label(_("Reset")); | |
2330 g_signal_connect(G_OBJECT(button), "clicked", G_CALLBACK(reset_sound), NULL); | |
2331 gtk_box_pack_start(GTK_BOX(hbox), button, FALSE, FALSE, 1); | |
2332 | |
2333 button = gtk_button_new_with_label(_("Choose...")); | |
2334 g_signal_connect(G_OBJECT(button), "clicked", G_CALLBACK(sel_sound), NULL); | |
2335 gtk_box_pack_start(GTK_BOX(hbox), button, FALSE, FALSE, 1); | |
2336 | |
2337 gtk_widget_show_all (ret); | |
2338 | |
2339 return ret; | |
2340 } | |
2341 | |
2342 static void away_message_sel_cb(GtkTreeSelection *sel, GtkTreeModel *model) | 2265 static void away_message_sel_cb(GtkTreeSelection *sel, GtkTreeModel *model) |
2343 { | 2266 { |
2344 GtkTreeIter iter; | 2267 GtkTreeIter iter; |
2345 GValue val = { 0, }; | 2268 GValue val = { 0, }; |
2346 gchar buffer[BUF_LONG]; | 2269 gchar buffer[BUF_LONG]; |
2496 gtk_notebook_append_page(GTK_NOTEBOOK(prefsnotebook), page, gtk_label_new(text)); | 2419 gtk_notebook_append_page(GTK_NOTEBOOK(prefsnotebook), page, gtk_label_new(text)); |
2497 return iter; | 2420 return iter; |
2498 } | 2421 } |
2499 | 2422 |
2500 void prefs_notebook_init() { | 2423 void prefs_notebook_init() { |
2501 GtkTreeIter p, p2, c; | 2424 GtkTreeIter p, c; |
2502 GList *l; | 2425 GList *l; |
2503 GaimPlugin *plug; | 2426 GaimPlugin *plug; |
2504 prefs_notebook_add_page(_("Interface"), NULL, interface_page(), &p, NULL, notebook_page++); | 2427 prefs_notebook_add_page(_("Interface"), NULL, interface_page(), &p, NULL, notebook_page++); |
2505 prefs_notebook_add_page(_("Smiley Themes"), NULL, theme_page(), &c, &p, notebook_page++); | 2428 prefs_notebook_add_page(_("Smiley Themes"), NULL, theme_page(), &c, &p, notebook_page++); |
2506 prefs_notebook_add_page(_("Message Text"), NULL, messages_page(), &c, &p, notebook_page++); | 2429 prefs_notebook_add_page(_("Message Text"), NULL, messages_page(), &c, &p, notebook_page++); |
2507 prefs_notebook_add_page(_("Shortcuts"), NULL, hotkeys_page(), &c, &p, notebook_page++); | 2430 prefs_notebook_add_page(_("Shortcuts"), NULL, hotkeys_page(), &c, &p, notebook_page++); |
2508 prefs_notebook_add_page(_("Buddy List"), NULL, list_page(), &c, &p, notebook_page++); | 2431 prefs_notebook_add_page(_("Buddy List"), NULL, list_page(), &c, &p, notebook_page++); |
2509 prefs_notebook_add_page(_("Conversations"), NULL, conv_page(), &p2, NULL, notebook_page++); | 2432 prefs_notebook_add_page(_("Conversations"), NULL, conv_page(), &c, &p, notebook_page++); |
2510 prefs_notebook_add_page(_("IMs"), NULL, im_page(), &c, &p2, notebook_page++); | 2433 prefs_notebook_add_page(_("Sounds"), NULL, sound_page(), &c, &p, notebook_page++); |
2511 prefs_notebook_add_page(_("Chats"), NULL, chat_page(), &c, &p2, notebook_page++); | |
2512 prefs_notebook_add_page(_("Network"), NULL, network_page(), &p, NULL, notebook_page++); | 2434 prefs_notebook_add_page(_("Network"), NULL, network_page(), &p, NULL, notebook_page++); |
2513 prefs_notebook_add_page(_("Proxy"), NULL, proxy_page(), &p, NULL, notebook_page++); | |
2514 #ifndef _WIN32 | 2435 #ifndef _WIN32 |
2515 /* We use the registered default browser in windows */ | 2436 /* We use the registered default browser in windows */ |
2516 prefs_notebook_add_page(_("Browser"), NULL, browser_page(), &p, NULL, notebook_page++); | 2437 prefs_notebook_add_page(_("Browser"), NULL, browser_page(), &p, NULL, notebook_page++); |
2517 #endif | 2438 #endif |
2518 prefs_notebook_add_page(_("Logging"), NULL, logging_page(), &p, NULL, notebook_page++); | 2439 prefs_notebook_add_page(_("Logging"), NULL, logging_page(), &p, NULL, notebook_page++); |
2519 prefs_notebook_add_page(_("Sounds"), NULL, sound_page(), &p, NULL, notebook_page++); | |
2520 prefs_notebook_add_page(_("Sound Events"), NULL, sound_events_page(), &c, &p, notebook_page++); | |
2521 prefs_notebook_add_page(_("Away / Idle"), NULL, away_page(), &p, NULL, notebook_page++); | 2440 prefs_notebook_add_page(_("Away / Idle"), NULL, away_page(), &p, NULL, notebook_page++); |
2522 prefs_notebook_add_page(_("Away Messages"), NULL, away_message_page(), &c, &p, notebook_page++); | 2441 prefs_notebook_add_page(_("Away Messages"), NULL, away_message_page(), &c, &p, notebook_page++); |
2523 | 2442 |
2524 if (gaim_plugins_enabled()) { | 2443 if (gaim_plugins_enabled()) { |
2525 prefs_notebook_add_page(_("Protocols"), NULL, protocol_page(), &proto_iter, NULL, notebook_page++); | |
2526 prefs_notebook_add_page(_("Plugins"), NULL, plugin_page(), &plugin_iter, NULL, notebook_page++); | 2444 prefs_notebook_add_page(_("Plugins"), NULL, plugin_page(), &plugin_iter, NULL, notebook_page++); |
2527 | 2445 |
2528 for (l = gaim_plugins_get_loaded(); l != NULL; l = l->next) { | 2446 for (l = gaim_plugins_get_loaded(); l != NULL; l = l->next) { |
2529 plug = (GaimPlugin *)l->data; | 2447 plug = (GaimPlugin *)l->data; |
2530 | 2448 |
2553 | 2471 |
2554 if(GTK_IS_WIDGET(gtk_frame)) { | 2472 if(GTK_IS_WIDGET(gtk_frame)) { |
2555 prefs_info->iter = g_new0(GtkTreeIter, 1); | 2473 prefs_info->iter = g_new0(GtkTreeIter, 1); |
2556 prefs_notebook_add_page(_(plug->info->name), NULL, | 2474 prefs_notebook_add_page(_(plug->info->name), NULL, |
2557 gtk_frame, prefs_info->iter, | 2475 gtk_frame, prefs_info->iter, |
2558 (plug->info->type == GAIM_PLUGIN_PROTOCOL) ? &proto_iter : &plugin_iter, | 2476 (plug->info->type == GAIM_PLUGIN_PROTOCOL) ? NULL : &plugin_iter, |
2559 notebook_page++); | 2477 notebook_page++); |
2560 } else if(prefs_info->frame) { | 2478 } else if(prefs_info->frame) { |
2561 /* in the event that there is a pref frame and we can | 2479 /* in the event that there is a pref frame and we can |
2562 * not make a widget out of it, we free the | 2480 * not make a widget out of it, we free the |
2563 * pluginpref frame --Gary | 2481 * pluginpref frame --Gary |