comparison src/gtkprefs.c @ 8231:f50c059b6384

[gaim-migrate @ 8954] This is Tim Ringenbach's patch to move some IP-related functions into the new gaim_network namespace, improve the local IP checking functionality by opening a socket, change some prefs, and add the ability to modify these prefs in the UI. Some ft.c bugs were fixed, and OSCAR, Jabber and Yahoo were updated to reflect the changes. The DCC SEND portion of this patch was not committed, as per his request (unless I misunderstood? :) committer: Tailor Script <tailor@pidgin.im>
author Christian Hammond <chipx86@chipx86.com>
date Thu, 12 Feb 2004 00:36:55 +0000
parents cd9ea20cd8ed
children 32625c0dbba6
comparison
equal deleted inserted replaced
8230:4e354776ae2a 8231:f50c059b6384
31 #include "proxy.h" 31 #include "proxy.h"
32 #include "prpl.h" 32 #include "prpl.h"
33 #include "sound.h" 33 #include "sound.h"
34 #include "util.h" 34 #include "util.h"
35 #include "multi.h" 35 #include "multi.h"
36 #include "network.h"
36 37
37 #include "gtkblist.h" 38 #include "gtkblist.h"
38 #include "gtkconv.h" 39 #include "gtkconv.h"
39 #include "gtkdebug.h" 40 #include "gtkdebug.h"
40 #include "gtkimhtml.h" 41 #include "gtkimhtml.h"
1048 1049
1049 gtk_widget_show_all(ret); 1050 gtk_widget_show_all(ret);
1050 return ret; 1051 return ret;
1051 } 1052 }
1052 1053
1054 static void network_ip_changed(GtkEntry *entry, gpointer data)
1055 {
1056 gaim_prefs_set_string("/core/network/public_ip", gtk_entry_get_text(entry));
1057 }
1058
1059 GtkWidget *network_page() {
1060 GtkWidget *ret;
1061 GtkWidget *vbox, *entry;
1062 GtkWidget *table, *label, *auto_ip_checkbox, *ports_checkbox, *spin_button;
1063 GtkSizeGroup *sg;
1064
1065 ret = gtk_vbox_new(FALSE, 18);
1066 gtk_container_set_border_width (GTK_CONTAINER (ret), 12);
1067
1068 vbox = gaim_gtk_make_frame (ret, _("IP Address"));
1069
1070 auto_ip_checkbox = gaim_gtk_prefs_checkbox(_("_Autodetect IP Address"),
1071 "/core/network/auto_ip", vbox);
1072
1073 table = gtk_table_new(2, 1, FALSE);
1074 gtk_container_set_border_width(GTK_CONTAINER(table), 5);
1075 gtk_table_set_col_spacings(GTK_TABLE(table), 5);
1076 gtk_table_set_row_spacings(GTK_TABLE(table), 10);
1077 gtk_container_add(GTK_CONTAINER(vbox), table);
1078
1079 label = gtk_label_new_with_mnemonic(_("Public _IP:"));
1080 gtk_misc_set_alignment(GTK_MISC(label), 1.0, 0.5);
1081 gtk_table_attach(GTK_TABLE(table), label, 0, 1, 0, 1, GTK_FILL, 0, 0, 0);
1082
1083 entry = gtk_entry_new();
1084 gtk_label_set_mnemonic_widget(GTK_LABEL(label), entry);
1085 gtk_table_attach(GTK_TABLE(table), entry, 1, 2, 0, 1, GTK_FILL, 0, 0, 0);
1086 g_signal_connect(G_OBJECT(entry), "changed",
1087 G_CALLBACK(network_ip_changed), NULL);
1088
1089 if (gaim_network_get_local_ip() != NULL)
1090 gtk_entry_set_text(GTK_ENTRY(entry),
1091 gaim_network_get_local_ip());
1092
1093 gaim_set_accessible_label (entry, label);
1094
1095
1096 if (gaim_prefs_get_bool("/core/network/auto_ip")) {
1097 gtk_widget_set_sensitive(GTK_WIDGET(table), FALSE);
1098 }
1099
1100 g_signal_connect(G_OBJECT(auto_ip_checkbox), "clicked",
1101 G_CALLBACK(gaim_gtk_toggle_sensitive), table);
1102
1103
1104
1105 vbox = gaim_gtk_make_frame (ret, _("Ports"));
1106 sg = gtk_size_group_new(GTK_SIZE_GROUP_HORIZONTAL);
1107
1108 ports_checkbox = gaim_gtk_prefs_checkbox(_("_Manually specify range of ports to listen on"),
1109 "/core/network/ports_range_use", vbox);
1110
1111 spin_button = gaim_gtk_prefs_labeled_spin_button(vbox, _("_Start Port:"),
1112 "/core/network/ports_range_start", 0, 65535, sg);
1113 if (!gaim_prefs_get_bool("/core/network/ports_range_use"))
1114 gtk_widget_set_sensitive(GTK_WIDGET(spin_button), FALSE);
1115 g_signal_connect(G_OBJECT(ports_checkbox), "clicked",
1116 G_CALLBACK(gaim_gtk_toggle_sensitive), spin_button);
1117
1118 spin_button = gaim_gtk_prefs_labeled_spin_button(vbox, _("_End Port:"),
1119 "/core/network/ports_range_end", 0, 65535, sg);
1120 if (!gaim_prefs_get_bool("/core/network/ports_range_use"))
1121 gtk_widget_set_sensitive(GTK_WIDGET(spin_button), FALSE);
1122 g_signal_connect(G_OBJECT(ports_checkbox), "clicked",
1123 G_CALLBACK(gaim_gtk_toggle_sensitive), spin_button);
1124
1125 gtk_widget_show_all(ret);
1126 return ret;
1127 }
1128
1053 static void 1129 static void
1054 proxy_changed_cb(const char *name, GaimPrefType type, gpointer value, 1130 proxy_changed_cb(const char *name, GaimPrefType type, gpointer value,
1055 gpointer data) 1131 gpointer data)
1056 { 1132 {
1057 GtkWidget *frame = data; 1133 GtkWidget *frame = data;
2371 prefs_notebook_add_page(_("Shortcuts"), NULL, hotkeys_page(), &c, &p, notebook_page++); 2447 prefs_notebook_add_page(_("Shortcuts"), NULL, hotkeys_page(), &c, &p, notebook_page++);
2372 prefs_notebook_add_page(_("Buddy List"), NULL, list_page(), &c, &p, notebook_page++); 2448 prefs_notebook_add_page(_("Buddy List"), NULL, list_page(), &c, &p, notebook_page++);
2373 prefs_notebook_add_page(_("Conversations"), NULL, conv_page(), &p2, NULL, notebook_page++); 2449 prefs_notebook_add_page(_("Conversations"), NULL, conv_page(), &p2, NULL, notebook_page++);
2374 prefs_notebook_add_page(_("IMs"), NULL, im_page(), &c, &p2, notebook_page++); 2450 prefs_notebook_add_page(_("IMs"), NULL, im_page(), &c, &p2, notebook_page++);
2375 prefs_notebook_add_page(_("Chats"), NULL, chat_page(), &c, &p2, notebook_page++); 2451 prefs_notebook_add_page(_("Chats"), NULL, chat_page(), &c, &p2, notebook_page++);
2452 /* XXX */prefs_notebook_add_page(_("Network"), NULL, network_page(), &p, NULL, notebook_page++);
2376 prefs_notebook_add_page(_("Proxy"), NULL, proxy_page(), &p, NULL, notebook_page++); 2453 prefs_notebook_add_page(_("Proxy"), NULL, proxy_page(), &p, NULL, notebook_page++);
2377 #ifndef _WIN32 2454 #ifndef _WIN32
2378 /* We use the registered default browser in windows */ 2455 /* We use the registered default browser in windows */
2379 prefs_notebook_add_page(_("Browser"), NULL, browser_page(), &p, NULL, notebook_page++); 2456 prefs_notebook_add_page(_("Browser"), NULL, browser_page(), &p, NULL, notebook_page++);
2380 #endif 2457 #endif