Mercurial > pidgin
comparison src/gtkprefs.c @ 9123:6ea36eac6f22
[gaim-migrate @ 9900]
(12:38:12) Me: i did try to contact you before i reverted it the first time
(12:38:28) seanegn: I know. I've been real unavailable of late.
(12:39:51) Me: i'll tell you what i'm going to do then. i'm going to pull
that, tag, and then put it back in after we get the tarballs made
(12:39:57) Me: cause i do like the changes, just not the timing
(12:42:16) seanegn: oh, of course. Everything I do is awesome.
committer: Tailor Script <tailor@pidgin.im>
author | Luke Schierer <lschiere@pidgin.im> |
---|---|
date | Sun, 30 May 2004 16:44:45 +0000 |
parents | 2063f8de8f93 |
children | 933a19e3a6b3 |
comparison
equal
deleted
inserted
replaced
9122:a1adaeee5b9e | 9123:6ea36eac6f22 |
---|---|
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, "new")) | 946 if (strcmp(placement, "number")) |
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 |
952 GtkWidget *conv_page() { | 952 GtkWidget *conv_page() { |
953 GtkWidget *ret; | 953 GtkWidget *ret; |
954 GtkWidget *vbox; | 954 GtkWidget *vbox; |
955 GtkWidget *label; | 955 GtkWidget *label; |
956 GtkWidget *close_checkbox; | 956 GtkWidget *close_checkbox;/*, *icons_checkbox;*/ |
957 GtkWidget *tabs_checkbox, *tab_placement; | 957 GtkWidget *tabs_checkbox, *same_checkbox, *tab_placement; |
958 /* GtkWidget *same_checkbox, *icons_checkbox; */ | |
959 GtkSizeGroup *sg; | 958 GtkSizeGroup *sg; |
960 GList *names = NULL; | 959 GList *names = NULL; |
961 | 960 |
962 ret = gtk_vbox_new(FALSE, 18); | 961 ret = gtk_vbox_new(FALSE, 18); |
963 gtk_container_set_border_width(GTK_CONTAINER(ret), 12); | 962 gtk_container_set_border_width(GTK_CONTAINER(ret), 12); |
971 GAIM_PREF_STRING, "/gaim/gtk/conversations/placement", names); | 970 GAIM_PREF_STRING, "/gaim/gtk/conversations/placement", names); |
972 g_list_free(names); | 971 g_list_free(names); |
973 | 972 |
974 gtk_misc_set_alignment(GTK_MISC(label), 0, 0); | 973 gtk_misc_set_alignment(GTK_MISC(label), 0, 0); |
975 gtk_size_group_add_widget(sg, label); | 974 gtk_size_group_add_widget(sg, label); |
976 #if 1 /* PREFSLASH04 */ | 975 |
977 label = gaim_gtk_prefs_dropdown(vbox, _("Show _buttons as:"), GAIM_PREF_INT, | 976 label = gaim_gtk_prefs_labeled_spin_button(vbox, _("Number of conversations per window"), |
978 "/gaim/gtk/conversations/button_type", | |
979 _("Pictures"), GAIM_BUTTON_IMAGE, | |
980 _("Text"), GAIM_BUTTON_TEXT, | |
981 _("Pictures and text"), GAIM_BUTTON_TEXT_IMAGE, | |
982 _("None"), GAIM_BUTTON_NONE, | |
983 NULL); | |
984 | |
985 gtk_size_group_add_widget(sg, label); | |
986 gtk_misc_set_alignment(GTK_MISC(label), 0, 0); | |
987 #endif /* PREFSLASH04 */ | |
988 | |
989 #if 0 /* I don't like this */ | |
990 label = gaim_gtk_prefs_labeled_spin_button(vbox, _("Number of conversations per window"), | |
991 "/gaim/gtk/conversations/placement_number", | 977 "/gaim/gtk/conversations/placement_number", |
992 1, 50, sg); | 978 1, 50, sg); |
979 | |
993 if (strcmp("number", | 980 if (strcmp("number", |
994 gaim_prefs_get_string("/gaim/gtk/conversations/placement"))) | 981 gaim_prefs_get_string("/gaim/gtk/conversations/placement"))) |
995 gtk_widget_set_sensitive(label, FALSE); | 982 gtk_widget_set_sensitive(label, FALSE); |
996 else | 983 else |
997 gtk_widget_set_sensitive(label, TRUE); | 984 gtk_widget_set_sensitive(label, TRUE); |
998 #endif /* I think it should be a plugin */ | 985 |
986 placement_pref_id = gaim_prefs_connect_callback("/gaim/gtk/conversations/placement", | |
987 conversation_placement_cb, | |
988 label); | |
999 | 989 |
1000 gaim_gtk_prefs_checkbox(_("Show _formatting toolbar"), | 990 gaim_gtk_prefs_checkbox(_("Show _formatting toolbar"), |
1001 "/gaim/gtk/conversations/show_formatting_toolbar", vbox); | 991 "/gaim/gtk/conversations/show_formatting_toolbar", vbox); |
1002 | 992 |
1003 gaim_gtk_prefs_checkbox(_("Show a_liases in tabs/titles"), | 993 gaim_gtk_prefs_checkbox(_("Show a_liases in tabs/titles"), |
1004 "/core/conversations/use_alias_for_title", vbox); | 994 "/core/conversations/use_alias_for_title", vbox); |
1005 | 995 |
1006 gaim_gtk_prefs_checkbox(_("_Raise window on events"), | |
1007 "/gaim/gtk/conversations/raise_on_events", vbox); | |
1008 | |
1009 /* XXX This caption totally sucks but I can't break the string freeze. */ | |
1010 gaim_gtk_prefs_checkbox(_("Co_lorize screen names"), | |
1011 "/gaim/gtk/conversations/chat/color_nicks", vbox); | |
1012 gaim_gtk_prefs_checkbox(_("Show buddy _icons"), | |
1013 "/gaim/gtk/conversations/im/show_buddy_icons", vbox); | |
1014 gaim_gtk_prefs_checkbox(_("Enable buddy icon a_nimation"), | |
1015 "/gaim/gtk/conversations/im/animate_buddy_icons", vbox); | |
1016 gaim_gtk_prefs_checkbox(_("Notify buddies that you are _typing to them"), | |
1017 "/core/conversations/im/send_typing", vbox); | |
1018 | |
1019 vbox = gaim_gtk_make_frame (ret, _("Tab Options")); | 996 vbox = gaim_gtk_make_frame (ret, _("Tab Options")); |
1020 | 997 |
1021 tabs_checkbox = gaim_gtk_prefs_checkbox(_("Show IMs and chats in _tabbed windows"), | 998 tabs_checkbox = gaim_gtk_prefs_checkbox(_("Show IMs and chats in _tabbed windows"), |
1022 "/gaim/gtk/conversations/tabs", vbox); | 999 "/gaim/gtk/conversations/tabs", vbox); |
1023 if (strcmp(gaim_prefs_get_string("/gaim/gtk/conversations/placement"), "new")) | 1000 |
1024 gtk_widget_set_sensitive(tabs_checkbox, FALSE); | |
1025 | |
1026 #if 0 /* Overzealous last-minute prefslashing */ | |
1027 same_checkbox = gaim_gtk_prefs_checkbox(_("Show IMs and chats in _same tabbed window"), | 1001 same_checkbox = gaim_gtk_prefs_checkbox(_("Show IMs and chats in _same tabbed window"), |
1028 "/core/conversations/combine_chat_im", vbox); | 1002 "/core/conversations/combine_chat_im", vbox); |
1003 | |
1029 if (!gaim_prefs_get_bool("/gaim/gtk/conversations/tabs")) { | 1004 if (!gaim_prefs_get_bool("/gaim/gtk/conversations/tabs")) { |
1030 gtk_widget_set_sensitive(GTK_WIDGET(same_checkbox), FALSE); | 1005 gtk_widget_set_sensitive(GTK_WIDGET(same_checkbox), FALSE); |
1031 } | 1006 } |
1032 | 1007 |
1033 g_signal_connect(G_OBJECT(tabs_checkbox), "clicked", | 1008 g_signal_connect(G_OBJECT(tabs_checkbox), "clicked", |
1034 G_CALLBACK(gaim_gtk_toggle_sensitive), same_checkbox); | 1009 G_CALLBACK(gaim_gtk_toggle_sensitive), same_checkbox); |
1035 #endif | |
1036 | |
1037 placement_pref_id = gaim_prefs_connect_callback("/gaim/gtk/conversations/placement", | |
1038 conversation_placement_cb, | |
1039 tabs_checkbox); | |
1040 | 1010 |
1041 close_checkbox = gaim_gtk_prefs_checkbox(_("Show _close button on tabs"), | 1011 close_checkbox = gaim_gtk_prefs_checkbox(_("Show _close button on tabs"), |
1042 "/gaim/gtk/conversations/close_on_tabs", | 1012 "/gaim/gtk/conversations/close_on_tabs", |
1043 vbox); | 1013 vbox); |
1044 | 1014 |
1074 gtk_widget_show_all(ret); | 1044 gtk_widget_show_all(ret); |
1075 | 1045 |
1076 return ret; | 1046 return ret; |
1077 } | 1047 } |
1078 | 1048 |
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 | |
1079 static void network_ip_changed(GtkEntry *entry, gpointer data) | 1127 static void network_ip_changed(GtkEntry *entry, gpointer data) |
1080 { | 1128 { |
1081 gaim_network_set_public_ip(gtk_entry_get_text(entry)); | 1129 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; | |
1082 } | 1198 } |
1083 | 1199 |
1084 static void | 1200 static void |
1085 proxy_changed_cb(const char *name, GaimPrefType type, gpointer value, | 1201 proxy_changed_cb(const char *name, GaimPrefType type, gpointer value, |
1086 gpointer data) | 1202 gpointer data) |
1104 gaim_prefs_set_string("/core/proxy/username", gtk_entry_get_text(entry)); | 1220 gaim_prefs_set_string("/core/proxy/username", gtk_entry_get_text(entry)); |
1105 else if (entrynum == PROXYPASS) | 1221 else if (entrynum == PROXYPASS) |
1106 gaim_prefs_set_string("/core/proxy/password", gtk_entry_get_text(entry)); | 1222 gaim_prefs_set_string("/core/proxy/password", gtk_entry_get_text(entry)); |
1107 } | 1223 } |
1108 | 1224 |
1109 GtkWidget *network_page() { | 1225 GtkWidget *proxy_page() { |
1110 GtkWidget *ret; | 1226 GtkWidget *ret; |
1111 GtkWidget *vbox, *hbox, *entry; | 1227 GtkWidget *vbox; |
1112 GtkWidget *table, *label, *auto_ip_checkbox, *ports_checkbox, *spin_button; | 1228 GtkWidget *entry; |
1113 GtkSizeGroup *sg; | 1229 GtkWidget *label; |
1230 GtkWidget *hbox; | |
1231 GtkWidget *table; | |
1114 GaimProxyInfo *proxy_info; | 1232 GaimProxyInfo *proxy_info; |
1115 | 1233 |
1116 ret = gtk_vbox_new(FALSE, 18); | 1234 ret = gtk_vbox_new(FALSE, 18); |
1117 gtk_container_set_border_width (GTK_CONTAINER (ret), 12); | 1235 gtk_container_set_border_width (GTK_CONTAINER (ret), 12); |
1118 | 1236 |
1119 vbox = gaim_gtk_make_frame (ret, _("IP Address")); | 1237 vbox = gaim_gtk_make_frame (ret, _("Proxy Type")); |
1120 | 1238 gaim_gtk_prefs_dropdown(vbox, _("Proxy _type:"), GAIM_PREF_STRING, |
1121 auto_ip_checkbox = gaim_gtk_prefs_checkbox(_("_Autodetect IP Address"), | 1239 "/core/proxy/type", |
1122 "/core/network/auto_ip", vbox); | 1240 _("No proxy"), "none", |
1123 | 1241 "SOCKS 4", "socks4", |
1124 table = gtk_table_new(2, 1, FALSE); | 1242 "SOCKS 5", "socks5", |
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); | |
1125 gtk_container_set_border_width(GTK_CONTAINER(table), 5); | 1262 gtk_container_set_border_width(GTK_CONTAINER(table), 5); |
1126 gtk_table_set_col_spacings(GTK_TABLE(table), 5); | 1263 gtk_table_set_col_spacings(GTK_TABLE(table), 5); |
1127 gtk_table_set_row_spacings(GTK_TABLE(table), 10); | 1264 gtk_table_set_row_spacings(GTK_TABLE(table), 10); |
1128 gtk_container_add(GTK_CONTAINER(vbox), table); | 1265 gtk_container_add(GTK_CONTAINER(vbox), table); |
1129 | |
1130 label = gtk_label_new_with_mnemonic(_("Public _IP:")); | |
1131 gtk_misc_set_alignment(GTK_MISC(label), 1.0, 0.5); | |
1132 gtk_table_attach(GTK_TABLE(table), label, 0, 1, 0, 1, GTK_FILL, 0, 0, 0); | |
1133 | |
1134 entry = gtk_entry_new(); | |
1135 gtk_label_set_mnemonic_widget(GTK_LABEL(label), entry); | |
1136 gtk_table_attach(GTK_TABLE(table), entry, 1, 2, 0, 1, GTK_FILL, 0, 0, 0); | |
1137 g_signal_connect(G_OBJECT(entry), "changed", | |
1138 G_CALLBACK(network_ip_changed), NULL); | |
1139 | |
1140 if (gaim_network_get_public_ip() != NULL) | |
1141 gtk_entry_set_text(GTK_ENTRY(entry), | |
1142 gaim_network_get_public_ip()); | |
1143 | |
1144 gaim_set_accessible_label (entry, label); | |
1145 | |
1146 | |
1147 if (gaim_prefs_get_bool("/core/network/auto_ip")) { | |
1148 gtk_widget_set_sensitive(GTK_WIDGET(table), FALSE); | |
1149 } | |
1150 | |
1151 g_signal_connect(G_OBJECT(auto_ip_checkbox), "clicked", | |
1152 G_CALLBACK(gaim_gtk_toggle_sensitive), table); | |
1153 | |
1154 vbox = gaim_gtk_make_frame (ret, _("Ports")); | |
1155 sg = gtk_size_group_new(GTK_SIZE_GROUP_HORIZONTAL); | |
1156 | |
1157 ports_checkbox = gaim_gtk_prefs_checkbox(_("_Manually specify range of ports to listen on"), | |
1158 "/core/network/ports_range_use", vbox); | |
1159 | |
1160 spin_button = gaim_gtk_prefs_labeled_spin_button(vbox, _("_Start Port:"), | |
1161 "/core/network/ports_range_start", 0, 65535, sg); | |
1162 if (!gaim_prefs_get_bool("/core/network/ports_range_use")) | |
1163 gtk_widget_set_sensitive(GTK_WIDGET(spin_button), FALSE); | |
1164 g_signal_connect(G_OBJECT(ports_checkbox), "clicked", | |
1165 G_CALLBACK(gaim_gtk_toggle_sensitive), spin_button); | |
1166 | |
1167 spin_button = gaim_gtk_prefs_labeled_spin_button(vbox, _("_End Port:"), | |
1168 "/core/network/ports_range_end", 0, 65535, sg); | |
1169 if (!gaim_prefs_get_bool("/core/network/ports_range_use")) | |
1170 gtk_widget_set_sensitive(GTK_WIDGET(spin_button), FALSE); | |
1171 g_signal_connect(G_OBJECT(ports_checkbox), "clicked", | |
1172 G_CALLBACK(gaim_gtk_toggle_sensitive), spin_button); | |
1173 | |
1174 vbox = gaim_gtk_make_frame(ret, _("Proxy Server")); | |
1175 prefs_proxy_frame = gtk_vbox_new(FALSE, 0); | |
1176 gaim_gtk_prefs_dropdown(vbox, _("Proxy _type:"), GAIM_PREF_STRING, | |
1177 "/core/proxy/type", | |
1178 _("No proxy"), "none", | |
1179 "SOCKS 4", "socks4", | |
1180 "SOCKS 5", "socks5", | |
1181 "HTTP", "http", | |
1182 _("Use Environmental Settings"), "envvar", | |
1183 NULL); | |
1184 gtk_box_pack_start(GTK_BOX(vbox), prefs_proxy_frame, 0, 0, 0); | |
1185 proxy_info = gaim_global_proxy_get_info(); | |
1186 | |
1187 if (proxy_info == NULL || | |
1188 gaim_proxy_info_get_type(proxy_info) == GAIM_PROXY_NONE || | |
1189 gaim_proxy_info_get_type(proxy_info) == GAIM_PROXY_USE_ENVVAR) { | |
1190 | |
1191 gtk_widget_set_sensitive(GTK_WIDGET(prefs_proxy_frame), FALSE); | |
1192 } | |
1193 proxy_pref_id = gaim_prefs_connect_callback("/core/proxy/type", | |
1194 proxy_changed_cb, prefs_proxy_frame); | |
1195 | |
1196 table = gtk_table_new(4, 2, FALSE); | |
1197 gtk_container_set_border_width(GTK_CONTAINER(table), 5); | |
1198 gtk_table_set_col_spacings(GTK_TABLE(table), 5); | |
1199 gtk_table_set_row_spacings(GTK_TABLE(table), 10); | |
1200 gtk_container_add(GTK_CONTAINER(prefs_proxy_frame), table); | |
1201 | 1266 |
1202 | 1267 |
1203 label = gtk_label_new_with_mnemonic(_("_Host:")); | 1268 label = gtk_label_new_with_mnemonic(_("_Host:")); |
1204 gtk_misc_set_alignment(GTK_MISC(label), 1.0, 0.5); | 1269 gtk_misc_set_alignment(GTK_MISC(label), 1.0, 0.5); |
1205 gtk_table_attach(GTK_TABLE(table), label, 0, 1, 0, 1, GTK_FILL, 0, 0, 0); | 1270 gtk_table_attach(GTK_TABLE(table), label, 0, 1, 0, 1, GTK_FILL, 0, 0, 0); |
1218 gtk_box_pack_start(GTK_BOX(vbox), hbox, FALSE, FALSE, 0); | 1283 gtk_box_pack_start(GTK_BOX(vbox), hbox, FALSE, FALSE, 0); |
1219 gaim_set_accessible_label (entry, label); | 1284 gaim_set_accessible_label (entry, label); |
1220 | 1285 |
1221 label = gtk_label_new_with_mnemonic(_("_Port:")); | 1286 label = gtk_label_new_with_mnemonic(_("_Port:")); |
1222 gtk_misc_set_alignment(GTK_MISC(label), 1.0, 0.5); | 1287 gtk_misc_set_alignment(GTK_MISC(label), 1.0, 0.5); |
1223 gtk_table_attach(GTK_TABLE(table), label, 2, 3, 0, 1, GTK_FILL, 0, 0, 0); | 1288 gtk_table_attach(GTK_TABLE(table), label, 0, 1, 1, 2, GTK_FILL, 0, 0, 0); |
1224 | 1289 |
1225 entry = gtk_entry_new(); | 1290 entry = gtk_entry_new(); |
1226 gtk_label_set_mnemonic_widget(GTK_LABEL(label), entry); | 1291 gtk_label_set_mnemonic_widget(GTK_LABEL(label), entry); |
1227 gtk_table_attach(GTK_TABLE(table), entry, 3, 4, 0, 1, GTK_FILL, 0, 0, 0); | 1292 gtk_table_attach(GTK_TABLE(table), entry, 1, 2, 1, 2, GTK_FILL, 0, 0, 0); |
1228 g_signal_connect(G_OBJECT(entry), "changed", | 1293 g_signal_connect(G_OBJECT(entry), "changed", |
1229 G_CALLBACK(proxy_print_option), (void *)PROXYPORT); | 1294 G_CALLBACK(proxy_print_option), (void *)PROXYPORT); |
1230 | 1295 |
1231 if (proxy_info != NULL && gaim_proxy_info_get_port(proxy_info) != 0) { | 1296 if (proxy_info != NULL && gaim_proxy_info_get_port(proxy_info) != 0) { |
1232 char buf[128]; | 1297 char buf[128]; |
1237 } | 1302 } |
1238 gaim_set_accessible_label (entry, label); | 1303 gaim_set_accessible_label (entry, label); |
1239 | 1304 |
1240 label = gtk_label_new_with_mnemonic(_("_User:")); | 1305 label = gtk_label_new_with_mnemonic(_("_User:")); |
1241 gtk_misc_set_alignment(GTK_MISC(label), 1.0, 0.5); | 1306 gtk_misc_set_alignment(GTK_MISC(label), 1.0, 0.5); |
1242 gtk_table_attach(GTK_TABLE(table), label, 0, 1, 1, 2, GTK_FILL, 0, 0, 0); | 1307 gtk_table_attach(GTK_TABLE(table), label, 0, 1, 2, 3, GTK_FILL, 0, 0, 0); |
1243 | 1308 |
1244 entry = gtk_entry_new(); | 1309 entry = gtk_entry_new(); |
1245 gtk_label_set_mnemonic_widget(GTK_LABEL(label), entry); | 1310 gtk_label_set_mnemonic_widget(GTK_LABEL(label), entry); |
1246 gtk_table_attach(GTK_TABLE(table), entry, 1, 2, 1, 2, GTK_FILL, 0, 0, 0); | 1311 gtk_table_attach(GTK_TABLE(table), entry, 1, 2, 2, 3, GTK_FILL, 0, 0, 0); |
1247 g_signal_connect(G_OBJECT(entry), "changed", | 1312 g_signal_connect(G_OBJECT(entry), "changed", |
1248 G_CALLBACK(proxy_print_option), (void *)PROXYUSER); | 1313 G_CALLBACK(proxy_print_option), (void *)PROXYUSER); |
1249 | 1314 |
1250 if (proxy_info != NULL && gaim_proxy_info_get_username(proxy_info) != NULL) | 1315 if (proxy_info != NULL && gaim_proxy_info_get_username(proxy_info) != NULL) |
1251 gtk_entry_set_text(GTK_ENTRY(entry), | 1316 gtk_entry_set_text(GTK_ENTRY(entry), |
1255 gtk_box_pack_start(GTK_BOX(vbox), hbox, FALSE, FALSE, 0); | 1320 gtk_box_pack_start(GTK_BOX(vbox), hbox, FALSE, FALSE, 0); |
1256 gaim_set_accessible_label (entry, label); | 1321 gaim_set_accessible_label (entry, label); |
1257 | 1322 |
1258 label = gtk_label_new_with_mnemonic(_("Pa_ssword:")); | 1323 label = gtk_label_new_with_mnemonic(_("Pa_ssword:")); |
1259 gtk_misc_set_alignment(GTK_MISC(label), 1.0, 0.5); | 1324 gtk_misc_set_alignment(GTK_MISC(label), 1.0, 0.5); |
1260 gtk_table_attach(GTK_TABLE(table), label, 2, 3, 1, 2, GTK_FILL, 0, 0, 0); | 1325 gtk_table_attach(GTK_TABLE(table), label, 0, 1, 3, 4, GTK_FILL, 0, 0, 0); |
1261 | 1326 |
1262 entry = gtk_entry_new(); | 1327 entry = gtk_entry_new(); |
1263 gtk_label_set_mnemonic_widget(GTK_LABEL(label), entry); | 1328 gtk_label_set_mnemonic_widget(GTK_LABEL(label), entry); |
1264 gtk_table_attach(GTK_TABLE(table), entry, 3, 4, 1, 2, GTK_FILL , 0, 0, 0); | 1329 gtk_table_attach(GTK_TABLE(table), entry, 1, 2, 3, 4, GTK_FILL , 0, 0, 0); |
1265 gtk_entry_set_visibility(GTK_ENTRY(entry), FALSE); | 1330 gtk_entry_set_visibility(GTK_ENTRY(entry), FALSE); |
1266 g_signal_connect(G_OBJECT(entry), "changed", | 1331 g_signal_connect(G_OBJECT(entry), "changed", |
1267 G_CALLBACK(proxy_print_option), (void *)PROXYPASS); | 1332 G_CALLBACK(proxy_print_option), (void *)PROXYPASS); |
1268 | 1333 |
1269 if (proxy_info != NULL && gaim_proxy_info_get_password(proxy_info) != NULL) | 1334 if (proxy_info != NULL && gaim_proxy_info_get_password(proxy_info) != NULL) |
1488 | 1553 |
1489 gtk_widget_set_sensitive(hbox, !strcmp(method, "custom")); | 1554 gtk_widget_set_sensitive(hbox, !strcmp(method, "custom")); |
1490 } | 1555 } |
1491 #endif | 1556 #endif |
1492 | 1557 |
1493 | |
1494 static void | |
1495 event_toggled(GtkCellRendererToggle *cell, gchar *pth, gpointer data) | |
1496 { | |
1497 GtkTreeModel *model = (GtkTreeModel *)data; | |
1498 GtkTreeIter iter; | |
1499 GtkTreePath *path = gtk_tree_path_new_from_string(pth); | |
1500 const char *pref; | |
1501 | |
1502 gtk_tree_model_get_iter (model, &iter, path); | |
1503 gtk_tree_model_get (model, &iter, | |
1504 2, &pref, | |
1505 -1); | |
1506 | |
1507 gaim_prefs_set_bool(pref, !gtk_cell_renderer_toggle_get_active(cell)); | |
1508 | |
1509 gtk_list_store_set(GTK_LIST_STORE (model), &iter, | |
1510 0, !gtk_cell_renderer_toggle_get_active(cell), | |
1511 -1); | |
1512 | |
1513 gtk_tree_path_free(path); | |
1514 } | |
1515 | |
1516 static void | |
1517 test_sound(GtkWidget *button, gpointer i_am_NULL) | |
1518 { | |
1519 char *pref; | |
1520 gboolean temp_value1, temp_value2; | |
1521 | |
1522 pref = g_strdup_printf("/gaim/gtk/sound/enabled/%s", | |
1523 gaim_gtk_sound_get_event_option(sound_row_sel)); | |
1524 | |
1525 temp_value1 = gaim_prefs_get_bool("/core/sound/while_away"); | |
1526 temp_value2 = gaim_prefs_get_bool(pref); | |
1527 | |
1528 if (!temp_value1) gaim_prefs_set_bool("/core/sound/while_away", TRUE); | |
1529 if (!temp_value2) gaim_prefs_set_bool(pref, TRUE); | |
1530 | |
1531 gaim_sound_play_event(sound_row_sel); | |
1532 | |
1533 if (!temp_value1) gaim_prefs_set_bool("/core/sound/while_away", FALSE); | |
1534 if (!temp_value2) gaim_prefs_set_bool(pref, FALSE); | |
1535 | |
1536 g_free(pref); | |
1537 } | |
1538 | |
1539 static void | |
1540 reset_sound(GtkWidget *button, gpointer i_am_also_NULL) | |
1541 { | |
1542 char *pref = g_strdup_printf("/gaim/gtk/sound/file/%s", | |
1543 gaim_gtk_sound_get_event_option(sound_row_sel)); | |
1544 | |
1545 /* This just resets a sound file back to default */ | |
1546 gaim_prefs_set_string(pref, ""); | |
1547 g_free(pref); | |
1548 | |
1549 gtk_entry_set_text(GTK_ENTRY(sound_entry), "(default)"); | |
1550 } | |
1551 | |
1552 void close_sounddialog(GtkWidget *w, GtkWidget *w2) | |
1553 { | |
1554 | |
1555 GtkWidget *dest; | |
1556 | |
1557 if (!GTK_IS_WIDGET(w2)) | |
1558 dest = w; | |
1559 else | |
1560 dest = w2; | |
1561 | |
1562 sounddialog = NULL; | |
1563 | |
1564 gtk_widget_destroy(dest); | |
1565 } | |
1566 | |
1567 void do_select_sound(GtkWidget *w, gpointer data) | |
1568 { | |
1569 const char *file; | |
1570 char *pref; | |
1571 int snd; | |
1572 | |
1573 file = gtk_file_selection_get_filename(GTK_FILE_SELECTION(sounddialog)); | |
1574 snd = GPOINTER_TO_INT(data); | |
1575 | |
1576 /* If they type in a directory, change there */ | |
1577 if (gaim_gtk_check_if_dir(file, GTK_FILE_SELECTION(sounddialog))) | |
1578 return; | |
1579 | |
1580 /* Set it -- and forget it */ | |
1581 pref = g_strdup_printf("/gaim/gtk/sound/file/%s", | |
1582 gaim_gtk_sound_get_event_option(snd)); | |
1583 gaim_prefs_set_string(pref, file); | |
1584 g_free(pref); | |
1585 | |
1586 /* Set our text entry */ | |
1587 gtk_entry_set_text(GTK_ENTRY(sound_entry), file); | |
1588 | |
1589 /* Close the window! It's getting cold in here! */ | |
1590 close_sounddialog(NULL, sounddialog); | |
1591 | |
1592 if (last_sound_dir) | |
1593 g_free(last_sound_dir); | |
1594 last_sound_dir = g_path_get_dirname(file); | |
1595 } | |
1596 | |
1597 static void sel_sound(GtkWidget *button, gpointer being_NULL_is_fun) | |
1598 { | |
1599 char *buf = g_malloc(BUF_LEN); | |
1600 | |
1601 if (!sounddialog) { | |
1602 sounddialog = gtk_file_selection_new(_("Sound Selection")); | |
1603 | |
1604 gtk_file_selection_hide_fileop_buttons(GTK_FILE_SELECTION(sounddialog)); | |
1605 | |
1606 g_snprintf(buf, BUF_LEN - 1, "%s" G_DIR_SEPARATOR_S, last_sound_dir ? last_sound_dir : gaim_home_dir()); | |
1607 | |
1608 gtk_file_selection_set_filename(GTK_FILE_SELECTION(sounddialog), buf); | |
1609 | |
1610 g_signal_connect(G_OBJECT(sounddialog), "destroy", | |
1611 G_CALLBACK(close_sounddialog), sounddialog); | |
1612 | |
1613 g_signal_connect(G_OBJECT(GTK_FILE_SELECTION(sounddialog)->ok_button), | |
1614 "clicked", | |
1615 G_CALLBACK(do_select_sound), GINT_TO_POINTER(sound_row_sel)); | |
1616 | |
1617 g_signal_connect(G_OBJECT(GTK_FILE_SELECTION(sounddialog)->cancel_button), | |
1618 "clicked", | |
1619 G_CALLBACK(close_sounddialog), sounddialog); | |
1620 } | |
1621 | |
1622 g_free(buf); | |
1623 gtk_widget_show(sounddialog); | |
1624 gdk_window_raise(sounddialog->window); | |
1625 } | |
1626 | |
1627 | |
1628 static void prefs_sound_sel (GtkTreeSelection *sel, GtkTreeModel *model) { | |
1629 GtkTreeIter iter; | |
1630 GValue val = { 0, }; | |
1631 const char *file; | |
1632 char *pref; | |
1633 | |
1634 if (! gtk_tree_selection_get_selected (sel, &model, &iter)) | |
1635 return; | |
1636 gtk_tree_model_get_value (model, &iter, 3, &val); | |
1637 sound_row_sel = g_value_get_uint(&val); | |
1638 | |
1639 pref = g_strdup_printf("/gaim/gtk/sound/file/%s", | |
1640 gaim_gtk_sound_get_event_option(sound_row_sel)); | |
1641 file = gaim_prefs_get_string(pref); | |
1642 g_free(pref); | |
1643 if (sound_entry) | |
1644 gtk_entry_set_text(GTK_ENTRY(sound_entry), (file && *file != '\0') ? file : "(default)"); | |
1645 g_value_unset (&val); | |
1646 if (sounddialog) | |
1647 gtk_widget_destroy(sounddialog); | |
1648 } | |
1649 | |
1650 GtkWidget *sound_page() { | 1558 GtkWidget *sound_page() { |
1651 GtkWidget *ret; | 1559 GtkWidget *ret; |
1652 GtkWidget *vbox, *sw, *button; | 1560 GtkWidget *vbox; |
1653 GtkSizeGroup *sg; | 1561 GtkSizeGroup *sg; |
1654 GtkTreeIter iter; | |
1655 GtkWidget *event_view; | |
1656 GtkListStore *event_store; | |
1657 GtkCellRenderer *rend; | |
1658 GtkTreeViewColumn *col; | |
1659 GtkTreeSelection *sel; | |
1660 GtkTreePath *path; | |
1661 GtkWidget *hbox; | |
1662 int j; | |
1663 const char *file; | |
1664 char *pref; | |
1665 #ifndef _WIN32 | 1562 #ifndef _WIN32 |
1666 GtkWidget *dd; | 1563 GtkWidget *dd; |
1564 GtkWidget *hbox; | |
1667 GtkWidget *label; | 1565 GtkWidget *label; |
1668 GtkWidget *entry; | 1566 GtkWidget *entry; |
1669 const char *cmd; | 1567 const char *cmd; |
1670 #endif | 1568 #endif |
1671 | 1569 |
1699 gtk_misc_set_alignment(GTK_MISC(dd), 0, 0); | 1597 gtk_misc_set_alignment(GTK_MISC(dd), 0, 0); |
1700 | 1598 |
1701 hbox = gtk_hbox_new(FALSE, 5); | 1599 hbox = gtk_hbox_new(FALSE, 5); |
1702 gtk_box_pack_start(GTK_BOX(vbox), hbox, FALSE, FALSE, 5); | 1600 gtk_box_pack_start(GTK_BOX(vbox), hbox, FALSE, FALSE, 5); |
1703 | 1601 |
1602 hbox = gtk_hbox_new(FALSE, 5); | |
1603 gtk_container_add(GTK_CONTAINER(vbox), hbox); | |
1704 label = gtk_label_new_with_mnemonic(_("Sound c_ommand:\n(%s for filename)")); | 1604 label = gtk_label_new_with_mnemonic(_("Sound c_ommand:\n(%s for filename)")); |
1705 gtk_size_group_add_widget(sg, label); | 1605 gtk_size_group_add_widget(sg, label); |
1706 gtk_misc_set_alignment(GTK_MISC(label), 0, 0); | 1606 gtk_misc_set_alignment(GTK_MISC(label), 0, 0); |
1707 gtk_box_pack_start(GTK_BOX(hbox), label, FALSE, FALSE, 5); | 1607 gtk_box_pack_start(GTK_BOX(hbox), label, FALSE, FALSE, 5); |
1708 | 1608 |
1725 sound_pref_id = gaim_prefs_connect_callback("/gaim/gtk/sound/method", | 1625 sound_pref_id = gaim_prefs_connect_callback("/gaim/gtk/sound/method", |
1726 sound_changed_cb, hbox); | 1626 sound_changed_cb, hbox); |
1727 | 1627 |
1728 gaim_set_accessible_label (entry, label); | 1628 gaim_set_accessible_label (entry, label); |
1729 #endif /* _WIN32 */ | 1629 #endif /* _WIN32 */ |
1730 | |
1731 vbox = gaim_gtk_make_frame(ret, _("Sound Events")); | |
1732 | |
1733 /* The following is an ugly hack to make the frame expand so the | |
1734 * sound events list is big enough to be usable */ | |
1735 gtk_box_set_child_packing(GTK_BOX(vbox->parent), vbox, TRUE, TRUE, 0, | |
1736 GTK_PACK_START); | |
1737 gtk_box_set_child_packing(GTK_BOX(vbox->parent->parent), vbox->parent, TRUE, | |
1738 TRUE, 0, GTK_PACK_START); | |
1739 gtk_box_set_child_packing(GTK_BOX(vbox->parent->parent->parent), | |
1740 vbox->parent->parent, TRUE, TRUE, 0, GTK_PACK_START); | |
1741 | |
1742 sw = gtk_scrolled_window_new(NULL,NULL); | |
1743 gtk_scrolled_window_set_policy(GTK_SCROLLED_WINDOW(sw), GTK_POLICY_NEVER, GTK_POLICY_AUTOMATIC); | |
1744 gtk_scrolled_window_set_shadow_type (GTK_SCROLLED_WINDOW(sw), GTK_SHADOW_IN); | |
1745 | |
1746 gtk_box_pack_start(GTK_BOX(vbox), sw, TRUE, TRUE, 0); | |
1747 event_store = gtk_list_store_new (4, G_TYPE_BOOLEAN, G_TYPE_STRING, G_TYPE_STRING, G_TYPE_UINT); | |
1748 | |
1749 for (j=0; j < GAIM_NUM_SOUNDS; j++) { | |
1750 char *pref = g_strdup_printf("/gaim/gtk/sound/enabled/%s", | |
1751 gaim_gtk_sound_get_event_option(j)); | |
1752 const char *label = gaim_gtk_sound_get_event_label(j); | |
1753 | |
1754 if (label == NULL) { | |
1755 g_free(pref); | |
1756 continue; | |
1757 } | |
1758 | |
1759 gtk_list_store_append (event_store, &iter); | |
1760 gtk_list_store_set(event_store, &iter, | |
1761 0, gaim_prefs_get_bool(pref), | |
1762 1, _(label), | |
1763 2, pref, | |
1764 3, j, | |
1765 -1); | |
1766 g_free(pref); | |
1767 } | |
1768 | |
1769 event_view = gtk_tree_view_new_with_model (GTK_TREE_MODEL(event_store)); | |
1770 | |
1771 rend = gtk_cell_renderer_toggle_new(); | |
1772 sel = gtk_tree_view_get_selection (GTK_TREE_VIEW (event_view)); | |
1773 g_signal_connect (G_OBJECT (sel), "changed", | |
1774 G_CALLBACK (prefs_sound_sel), | |
1775 NULL); | |
1776 g_signal_connect (G_OBJECT(rend), "toggled", | |
1777 G_CALLBACK(event_toggled), event_store); | |
1778 path = gtk_tree_path_new_first(); | |
1779 gtk_tree_selection_select_path(sel, path); | |
1780 gtk_tree_path_free(path); | |
1781 | |
1782 col = gtk_tree_view_column_new_with_attributes (_("Play"), | |
1783 rend, | |
1784 "active", 0, | |
1785 NULL); | |
1786 gtk_tree_view_append_column (GTK_TREE_VIEW(event_view), col); | |
1787 | |
1788 rend = gtk_cell_renderer_text_new(); | |
1789 col = gtk_tree_view_column_new_with_attributes (_("Event"), | |
1790 rend, | |
1791 "text", 1, | |
1792 NULL); | |
1793 gtk_tree_view_append_column (GTK_TREE_VIEW(event_view), col); | |
1794 g_object_unref(G_OBJECT(event_store)); | |
1795 gtk_container_add(GTK_CONTAINER(sw), event_view); | |
1796 | |
1797 hbox = gtk_hbox_new(FALSE, 6); | |
1798 gtk_box_pack_start(GTK_BOX(vbox), hbox, FALSE, FALSE, 0); | |
1799 sound_entry = gtk_entry_new(); | |
1800 pref = g_strdup_printf("/gaim/gtk/sound/file/%s", | |
1801 gaim_gtk_sound_get_event_option(0)); | |
1802 file = gaim_prefs_get_string(pref); | |
1803 g_free(pref); | |
1804 gtk_entry_set_text(GTK_ENTRY(sound_entry), (file && *file != '\0') ? file : "(default)"); | |
1805 gtk_editable_set_editable(GTK_EDITABLE(sound_entry), FALSE); | |
1806 gtk_box_pack_start(GTK_BOX(hbox), sound_entry, FALSE, FALSE, 5); | |
1807 | |
1808 button = gtk_button_new_with_label(_("Test")); | |
1809 g_signal_connect(G_OBJECT(button), "clicked", G_CALLBACK(test_sound), NULL); | |
1810 gtk_box_pack_start(GTK_BOX(hbox), button, FALSE, FALSE, 1); | |
1811 | |
1812 button = gtk_button_new_with_label(_("Reset")); | |
1813 g_signal_connect(G_OBJECT(button), "clicked", G_CALLBACK(reset_sound), NULL); | |
1814 gtk_box_pack_start(GTK_BOX(hbox), button, FALSE, FALSE, 1); | |
1815 | |
1816 button = gtk_button_new_with_label(_("Choose...")); | |
1817 g_signal_connect(G_OBJECT(button), "clicked", G_CALLBACK(sel_sound), NULL); | |
1818 gtk_box_pack_start(GTK_BOX(hbox), button, FALSE, FALSE, 1); | |
1819 gtk_widget_show_all(ret); | 1630 gtk_widget_show_all(ret); |
1820 | 1631 |
1821 return ret; | 1632 return ret; |
1822 } | 1633 } |
1823 | 1634 |
1902 gtk_widget_show_all(ret); | 1713 gtk_widget_show_all(ret); |
1903 | 1714 |
1904 return ret; | 1715 return ret; |
1905 } | 1716 } |
1906 | 1717 |
1907 #if 0 | |
1908 static GtkWidget * | 1718 static GtkWidget * |
1909 protocol_page() { | 1719 protocol_page() { |
1910 GtkWidget *ret; | 1720 GtkWidget *ret; |
1911 | 1721 |
1912 ret = gtk_label_new(NULL); | 1722 ret = gtk_label_new(NULL); |
1913 gtk_widget_show(ret); | 1723 gtk_widget_show(ret); |
1914 | 1724 |
1915 return ret; | 1725 return ret; |
1916 } | 1726 } |
1917 #endif | |
1918 | 1727 |
1919 static GtkWidget *plugin_description=NULL, *plugin_details=NULL; | 1728 static GtkWidget *plugin_description=NULL, *plugin_details=NULL; |
1920 | 1729 |
1921 static void prefs_plugin_sel (GtkTreeSelection *sel, GtkTreeModel *model) | 1730 static void prefs_plugin_sel (GtkTreeSelection *sel, GtkTreeModel *model) |
1922 { | 1731 { |
2270 | 2079 |
2271 gtk_widget_show_all(ret); | 2080 gtk_widget_show_all(ret); |
2272 return ret; | 2081 return ret; |
2273 } | 2082 } |
2274 | 2083 |
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 | |
2275 static void away_message_sel_cb(GtkTreeSelection *sel, GtkTreeModel *model) | 2342 static void away_message_sel_cb(GtkTreeSelection *sel, GtkTreeModel *model) |
2276 { | 2343 { |
2277 GtkTreeIter iter; | 2344 GtkTreeIter iter; |
2278 GValue val = { 0, }; | 2345 GValue val = { 0, }; |
2279 gchar buffer[BUF_LONG]; | 2346 gchar buffer[BUF_LONG]; |
2429 gtk_notebook_append_page(GTK_NOTEBOOK(prefsnotebook), page, gtk_label_new(text)); | 2496 gtk_notebook_append_page(GTK_NOTEBOOK(prefsnotebook), page, gtk_label_new(text)); |
2430 return iter; | 2497 return iter; |
2431 } | 2498 } |
2432 | 2499 |
2433 void prefs_notebook_init() { | 2500 void prefs_notebook_init() { |
2434 GtkTreeIter p, c; | 2501 GtkTreeIter p, p2, c; |
2435 GList *l; | 2502 GList *l; |
2436 GaimPlugin *plug; | 2503 GaimPlugin *plug; |
2437 prefs_notebook_add_page(_("Interface"), NULL, interface_page(), &p, NULL, notebook_page++); | 2504 prefs_notebook_add_page(_("Interface"), NULL, interface_page(), &p, NULL, notebook_page++); |
2438 prefs_notebook_add_page(_("Smiley Themes"), NULL, theme_page(), &c, &p, notebook_page++); | 2505 prefs_notebook_add_page(_("Smiley Themes"), NULL, theme_page(), &c, &p, notebook_page++); |
2439 prefs_notebook_add_page(_("Message Text"), NULL, messages_page(), &c, &p, notebook_page++); | 2506 prefs_notebook_add_page(_("Message Text"), NULL, messages_page(), &c, &p, notebook_page++); |
2440 prefs_notebook_add_page(_("Shortcuts"), NULL, hotkeys_page(), &c, &p, notebook_page++); | 2507 prefs_notebook_add_page(_("Shortcuts"), NULL, hotkeys_page(), &c, &p, notebook_page++); |
2441 prefs_notebook_add_page(_("Buddy List"), NULL, list_page(), &c, &p, notebook_page++); | 2508 prefs_notebook_add_page(_("Buddy List"), NULL, list_page(), &c, &p, notebook_page++); |
2442 prefs_notebook_add_page(_("Conversations"), NULL, conv_page(), &c, &p, notebook_page++); | 2509 prefs_notebook_add_page(_("Conversations"), NULL, conv_page(), &p2, NULL, notebook_page++); |
2443 prefs_notebook_add_page(_("Sounds"), NULL, sound_page(), &c, &p, notebook_page++); | 2510 prefs_notebook_add_page(_("IMs"), NULL, im_page(), &c, &p2, notebook_page++); |
2511 prefs_notebook_add_page(_("Chats"), NULL, chat_page(), &c, &p2, notebook_page++); | |
2444 prefs_notebook_add_page(_("Network"), NULL, network_page(), &p, NULL, notebook_page++); | 2512 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++); | |
2445 #ifndef _WIN32 | 2514 #ifndef _WIN32 |
2446 /* We use the registered default browser in windows */ | 2515 /* We use the registered default browser in windows */ |
2447 prefs_notebook_add_page(_("Browser"), NULL, browser_page(), &p, NULL, notebook_page++); | 2516 prefs_notebook_add_page(_("Browser"), NULL, browser_page(), &p, NULL, notebook_page++); |
2448 #endif | 2517 #endif |
2449 prefs_notebook_add_page(_("Logging"), NULL, logging_page(), &p, NULL, notebook_page++); | 2518 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++); | |
2450 prefs_notebook_add_page(_("Away / Idle"), NULL, away_page(), &p, NULL, notebook_page++); | 2521 prefs_notebook_add_page(_("Away / Idle"), NULL, away_page(), &p, NULL, notebook_page++); |
2451 prefs_notebook_add_page(_("Away Messages"), NULL, away_message_page(), &c, &p, notebook_page++); | 2522 prefs_notebook_add_page(_("Away Messages"), NULL, away_message_page(), &c, &p, notebook_page++); |
2452 | 2523 |
2453 if (gaim_plugins_enabled()) { | 2524 if (gaim_plugins_enabled()) { |
2525 prefs_notebook_add_page(_("Protocols"), NULL, protocol_page(), &proto_iter, NULL, notebook_page++); | |
2454 prefs_notebook_add_page(_("Plugins"), NULL, plugin_page(), &plugin_iter, NULL, notebook_page++); | 2526 prefs_notebook_add_page(_("Plugins"), NULL, plugin_page(), &plugin_iter, NULL, notebook_page++); |
2455 | 2527 |
2456 for (l = gaim_plugins_get_loaded(); l != NULL; l = l->next) { | 2528 for (l = gaim_plugins_get_loaded(); l != NULL; l = l->next) { |
2457 plug = (GaimPlugin *)l->data; | 2529 plug = (GaimPlugin *)l->data; |
2458 | 2530 |
2481 | 2553 |
2482 if(GTK_IS_WIDGET(gtk_frame)) { | 2554 if(GTK_IS_WIDGET(gtk_frame)) { |
2483 prefs_info->iter = g_new0(GtkTreeIter, 1); | 2555 prefs_info->iter = g_new0(GtkTreeIter, 1); |
2484 prefs_notebook_add_page(_(plug->info->name), NULL, | 2556 prefs_notebook_add_page(_(plug->info->name), NULL, |
2485 gtk_frame, prefs_info->iter, | 2557 gtk_frame, prefs_info->iter, |
2486 (plug->info->type == GAIM_PLUGIN_PROTOCOL) ? NULL : &plugin_iter, | 2558 (plug->info->type == GAIM_PLUGIN_PROTOCOL) ? &proto_iter : &plugin_iter, |
2487 notebook_page++); | 2559 notebook_page++); |
2488 } else if(prefs_info->frame) { | 2560 } else if(prefs_info->frame) { |
2489 /* in the event that there is a pref frame and we can | 2561 /* in the event that there is a pref frame and we can |
2490 * not make a widget out of it, we free the | 2562 * not make a widget out of it, we free the |
2491 * pluginpref frame --Gary | 2563 * pluginpref frame --Gary |
2767 gaim_prefs_rename("/core/conversations/placement", | 2839 gaim_prefs_rename("/core/conversations/placement", |
2768 "/gaim/gtk/conversations/placement"); | 2840 "/gaim/gtk/conversations/placement"); |
2769 | 2841 |
2770 gaim_prefs_rename("/gaim/gtk/conversations/use_custom_font", | 2842 gaim_prefs_rename("/gaim/gtk/conversations/use_custom_font", |
2771 "/gaim/gtk/conversations/send_formatting"); | 2843 "/gaim/gtk/conversations/send_formatting"); |
2772 | |
2773 gaim_prefs_rename("/gaim/gtk/conversations/im/button_type", | |
2774 "/gaim/gtk/conversations/button_type"); | |
2775 gaim_prefs_rename("/gaim/gtk/conversations/im/raise_on_events", | |
2776 "/gaim/gtk/conversations/raise_on_events"); | |
2777 | 2844 |
2778 /* Remove some no-longer-used prefs */ | 2845 /* Remove some no-longer-used prefs */ |
2779 gaim_prefs_remove("/gaim/gtk/blist/show_group_count"); | 2846 gaim_prefs_remove("/gaim/gtk/blist/show_group_count"); |
2780 gaim_prefs_remove("/gaim/gtk/conversations/icons_on_tabs"); | 2847 gaim_prefs_remove("/gaim/gtk/conversations/icons_on_tabs"); |
2781 #if 0 /* PREFSLASH04 */ | 2848 #if 0 /* PREFSLASH04 */ |