pidgin/gtkprefs.c

changeset 21453
a90cf329cd48
parent 21233
e75de8db4f2b
parent 21434
ca83eed2d63e
child 21630
591a79c1b295
equal deleted inserted replaced
21273:2f91b326b3f0 21453:a90cf329cd48
894 894
895 vbox = pidgin_make_frame(ret, _("System Tray Icon")); 895 vbox = pidgin_make_frame(ret, _("System Tray Icon"));
896 label = pidgin_prefs_dropdown(vbox, _("_Show system tray icon:"), PURPLE_PREF_STRING, 896 label = pidgin_prefs_dropdown(vbox, _("_Show system tray icon:"), PURPLE_PREF_STRING,
897 PIDGIN_PREFS_ROOT "/docklet/show", 897 PIDGIN_PREFS_ROOT "/docklet/show",
898 _("Always"), "always", 898 _("Always"), "always",
899 _("On unread messages"), "pending",
899 _("Never"), "never", 900 _("Never"), "never",
900 _("On unread messages"), "pending",
901 NULL); 901 NULL);
902 gtk_size_group_add_widget(sg, label); 902 gtk_size_group_add_widget(sg, label);
903 gtk_misc_set_alignment(GTK_MISC(label), 0.0, 0.5); 903 gtk_misc_set_alignment(GTK_MISC(label), 0.0, 0.5);
904 904
905 vbox = pidgin_make_frame(ret, _("Conversation Window Hiding")); 905 vbox = pidgin_make_frame(ret, _("Conversation Window Hiding"));
955 gtk_size_group_add_widget(sg, label); 955 gtk_size_group_add_widget(sg, label);
956 956
957 g_list_free(names); 957 g_list_free(names);
958 958
959 gtk_widget_show_all(ret); 959 gtk_widget_show_all(ret);
960 g_object_unref(sg);
960 return ret; 961 return ret;
961 } 962 }
962 963
963 #if GTK_CHECK_VERSION(2,4,0) 964 #if GTK_CHECK_VERSION(2,4,0)
964 static void 965 static void
1112 purple_prefs_set_string("/purple/proxy/username", gtk_entry_get_text(entry)); 1113 purple_prefs_set_string("/purple/proxy/username", gtk_entry_get_text(entry));
1113 else if (entrynum == PROXYPASS) 1114 else if (entrynum == PROXYPASS)
1114 purple_prefs_set_string("/purple/proxy/password", gtk_entry_get_text(entry)); 1115 purple_prefs_set_string("/purple/proxy/password", gtk_entry_get_text(entry));
1115 } 1116 }
1116 1117
1118 static void
1119 proxy_button_clicked_cb(GtkWidget *button, gpointer null)
1120 {
1121 GError *err = NULL;
1122
1123 if (g_spawn_command_line_async ("gnome-network-preferences", &err))
1124 return;
1125
1126 purple_notify_error(NULL, NULL, _("Cannot start proxy configuration program."), err->message);
1127 g_error_free(err);
1128 }
1129
1130 static void
1131 browser_button_clicked_cb(GtkWidget *button, gpointer null)
1132 {
1133 GError *err = NULL;
1134
1135 if (g_spawn_command_line_async ("gnome-default-applications-properties", &err))
1136 return;
1137
1138 purple_notify_error(NULL, NULL, _("Cannot start browser configuration program."), err->message);
1139 g_error_free(err);
1140 }
1141
1117 static GtkWidget * 1142 static GtkWidget *
1118 network_page() 1143 network_page()
1119 { 1144 {
1120 GtkWidget *ret; 1145 GtkWidget *ret;
1121 GtkWidget *vbox, *hbox, *entry; 1146 GtkWidget *vbox, *hbox, *entry;
1122 GtkWidget *table, *label, *auto_ip_checkbox, *ports_checkbox, *spin_button; 1147 GtkWidget *table, *label, *auto_ip_checkbox, *ports_checkbox, *spin_button;
1148 GtkWidget *proxy_warning = NULL, *browser_warning = NULL;
1149 GtkWidget *proxy_button = NULL, *browser_button = NULL;
1123 GtkSizeGroup *sg; 1150 GtkSizeGroup *sg;
1124 PurpleProxyInfo *proxy_info = NULL; 1151 PurpleProxyInfo *proxy_info = NULL;
1125 1152
1126 ret = gtk_vbox_new(FALSE, PIDGIN_HIG_CAT_SPACE); 1153 ret = gtk_vbox_new(FALSE, PIDGIN_HIG_CAT_SPACE);
1127 gtk_container_set_border_width (GTK_CONTAINER (ret), PIDGIN_HIG_BORDER); 1154 gtk_container_set_border_width (GTK_CONTAINER (ret), PIDGIN_HIG_BORDER);
1180 } 1207 }
1181 1208
1182 g_signal_connect(G_OBJECT(auto_ip_checkbox), "clicked", 1209 g_signal_connect(G_OBJECT(auto_ip_checkbox), "clicked",
1183 G_CALLBACK(pidgin_toggle_sensitive), table); 1210 G_CALLBACK(pidgin_toggle_sensitive), table);
1184 1211
1212 g_object_unref(sg);
1213
1185 vbox = pidgin_make_frame (ret, _("Ports")); 1214 vbox = pidgin_make_frame (ret, _("Ports"));
1186 sg = gtk_size_group_new(GTK_SIZE_GROUP_HORIZONTAL); 1215 sg = gtk_size_group_new(GTK_SIZE_GROUP_HORIZONTAL);
1187 1216
1188 ports_checkbox = pidgin_prefs_checkbox(_("_Manually specify range of ports to listen on"), 1217 ports_checkbox = pidgin_prefs_checkbox(_("_Manually specify range of ports to listen on"),
1189 "/purple/network/ports_range_use", vbox); 1218 "/purple/network/ports_range_use", vbox);
1200 if (!purple_prefs_get_bool("/purple/network/ports_range_use")) 1229 if (!purple_prefs_get_bool("/purple/network/ports_range_use"))
1201 gtk_widget_set_sensitive(GTK_WIDGET(spin_button), FALSE); 1230 gtk_widget_set_sensitive(GTK_WIDGET(spin_button), FALSE);
1202 g_signal_connect(G_OBJECT(ports_checkbox), "clicked", 1231 g_signal_connect(G_OBJECT(ports_checkbox), "clicked",
1203 G_CALLBACK(pidgin_toggle_sensitive), spin_button); 1232 G_CALLBACK(pidgin_toggle_sensitive), spin_button);
1204 1233
1205 if (!purple_running_gnome()) { 1234 if (purple_running_gnome()) {
1235 vbox = pidgin_make_frame(ret, _("Proxy Server & Browser"));
1236 prefs_proxy_frame = gtk_vbox_new(FALSE, 0);
1237
1238 proxy_warning = hbox = gtk_hbox_new(FALSE, PIDGIN_HIG_BOX_SPACE);
1239 gtk_container_add(GTK_CONTAINER(vbox), hbox);
1240
1241 label = gtk_label_new(NULL);
1242 gtk_label_set_markup(GTK_LABEL(label),
1243 _("<b>Proxy configuration program was not found.</b>"));
1244 gtk_box_pack_start(GTK_BOX(hbox), label, FALSE, FALSE, 0);
1245
1246 browser_warning = hbox = gtk_hbox_new(FALSE, PIDGIN_HIG_BOX_SPACE);
1247 gtk_container_add(GTK_CONTAINER(vbox), hbox);
1248
1249 label = gtk_label_new(NULL);
1250 gtk_label_set_markup(GTK_LABEL(label),
1251 _("<b>Browser configuration program was not found.</b>"));
1252 gtk_box_pack_start(GTK_BOX(hbox), label, FALSE, FALSE, 0);
1253
1254 hbox = gtk_hbox_new(FALSE, PIDGIN_HIG_BOX_SPACE);
1255 gtk_container_add(GTK_CONTAINER(vbox), hbox);
1256 label = gtk_label_new(_("Proxy & Browser preferences are configured\n"
1257 "in GNOME Preferences"));
1258 gtk_box_pack_start(GTK_BOX(hbox), label, FALSE, FALSE, 0);
1259 gtk_widget_show(label);
1260
1261 hbox = gtk_hbox_new(FALSE, PIDGIN_HIG_BOX_SPACE);
1262 gtk_container_add(GTK_CONTAINER(vbox), hbox);
1263 proxy_button = gtk_button_new_with_mnemonic(_("Configure _Proxy"));
1264 g_signal_connect(G_OBJECT(proxy_button), "clicked",
1265 G_CALLBACK(proxy_button_clicked_cb), NULL);
1266 gtk_box_pack_start(GTK_BOX(hbox), proxy_button, FALSE, FALSE, 0);
1267 gtk_widget_show(proxy_button);
1268 browser_button = gtk_button_new_with_mnemonic(_("Configure _Browser"));
1269 g_signal_connect(G_OBJECT(browser_button), "clicked",
1270 G_CALLBACK(browser_button_clicked_cb), NULL);
1271 gtk_box_pack_start(GTK_BOX(hbox), browser_button, FALSE, FALSE, 0);
1272 gtk_widget_show(browser_button);
1273 } else {
1206 vbox = pidgin_make_frame(ret, _("Proxy Server")); 1274 vbox = pidgin_make_frame(ret, _("Proxy Server"));
1207 prefs_proxy_frame = gtk_vbox_new(FALSE, 0); 1275 prefs_proxy_frame = gtk_vbox_new(FALSE, 0);
1276
1208 pidgin_prefs_dropdown(vbox, _("Proxy _type:"), PURPLE_PREF_STRING, 1277 pidgin_prefs_dropdown(vbox, _("Proxy _type:"), PURPLE_PREF_STRING,
1209 "/purple/proxy/type", 1278 "/purple/proxy/type",
1210 _("No proxy"), "none", 1279 _("No proxy"), "none",
1211 "SOCKS 4", "socks4", 1280 "SOCKS 4", "socks4",
1212 "SOCKS 5", "socks5", 1281 "SOCKS 5", "socks5",
1299 purple_proxy_info_get_password(proxy_info)); 1368 purple_proxy_info_get_password(proxy_info));
1300 pidgin_set_accessible_label (entry, label); 1369 pidgin_set_accessible_label (entry, label);
1301 } 1370 }
1302 1371
1303 gtk_widget_show_all(ret); 1372 gtk_widget_show_all(ret);
1373 g_object_unref(sg);
1304 /* Only hide table if not running gnome otherwise we hide the IP address table! */ 1374 /* Only hide table if not running gnome otherwise we hide the IP address table! */
1305 if (!purple_running_gnome() && (proxy_info == NULL || 1375 if (!purple_running_gnome() && (proxy_info == NULL ||
1306 purple_proxy_info_get_type(proxy_info) == PURPLE_PROXY_NONE || 1376 purple_proxy_info_get_type(proxy_info) == PURPLE_PROXY_NONE ||
1307 purple_proxy_info_get_type(proxy_info) == PURPLE_PROXY_USE_ENVVAR)) 1377 purple_proxy_info_get_type(proxy_info) == PURPLE_PROXY_USE_ENVVAR)) {
1308 gtk_widget_hide(table); 1378 gtk_widget_hide(table);
1379 } else if (purple_running_gnome()) {
1380 gchar *path;
1381 path = g_find_program_in_path("gnome-network-preferences");
1382 if (path != NULL) {
1383 gtk_widget_set_sensitive(proxy_button, TRUE);
1384 gtk_widget_hide(proxy_warning);
1385 g_free(path);
1386 } else {
1387 gtk_widget_set_sensitive(proxy_button, FALSE);
1388 gtk_widget_show(proxy_warning);
1389 }
1390 path = g_find_program_in_path("gnome-default-applications-properties");
1391 if (path != NULL) {
1392 gtk_widget_set_sensitive(browser_button, TRUE);
1393 gtk_widget_hide(browser_warning);
1394 g_free(path);
1395 } else {
1396 gtk_widget_set_sensitive(browser_button, FALSE);
1397 gtk_widget_show(browser_warning);
1398 }
1399 }
1400
1309 return ret; 1401 return ret;
1310 } 1402 }
1311 1403
1312 #ifndef _WIN32 1404 #ifndef _WIN32
1313 static gboolean manual_browser_set(GtkWidget *entry, GdkEventFocus *event, gpointer data) { 1405 static gboolean manual_browser_set(GtkWidget *entry, GdkEventFocus *event, gpointer data) {
1325 char *name; 1417 char *name;
1326 char *command; 1418 char *command;
1327 }; 1419 };
1328 1420
1329 /* Sorted reverse alphabetically */ 1421 /* Sorted reverse alphabetically */
1330 static struct browser possible_browsers[] = { 1422 static const struct browser possible_browsers[] = {
1331 {N_("Seamonkey"), "seamonkey"}, 1423 {N_("Seamonkey"), "seamonkey"},
1332 {N_("Opera"), "opera"}, 1424 {N_("Opera"), "opera"},
1333 {N_("Netscape"), "netscape"}, 1425 {N_("Netscape"), "netscape"},
1334 {N_("Mozilla"), "mozilla"}, 1426 {N_("Mozilla"), "mozilla"},
1335 {N_("Konqueror"), "kfmclient"}, 1427 {N_("Konqueror"), "kfmclient"},
1450 g_signal_connect(G_OBJECT(entry), "focus-out-event", 1542 g_signal_connect(G_OBJECT(entry), "focus-out-event",
1451 G_CALLBACK(manual_browser_set), NULL); 1543 G_CALLBACK(manual_browser_set), NULL);
1452 pidgin_set_accessible_label (entry, label); 1544 pidgin_set_accessible_label (entry, label);
1453 1545
1454 gtk_widget_show_all(ret); 1546 gtk_widget_show_all(ret);
1547 g_object_unref(sg);
1455 return ret; 1548 return ret;
1456 } 1549 }
1457 #endif /*_WIN32*/ 1550 #endif /*_WIN32*/
1458 1551
1459 static GtkWidget * 1552 static GtkWidget *
1556 1649
1557 static void 1650 static void
1558 test_sound(GtkWidget *button, gpointer i_am_NULL) 1651 test_sound(GtkWidget *button, gpointer i_am_NULL)
1559 { 1652 {
1560 char *pref; 1653 char *pref;
1561 gboolean temp_value; 1654 gboolean temp_enabled;
1655 gboolean temp_mute;
1562 1656
1563 pref = g_strdup_printf(PIDGIN_PREFS_ROOT "/sound/enabled/%s", 1657 pref = g_strdup_printf(PIDGIN_PREFS_ROOT "/sound/enabled/%s",
1564 pidgin_sound_get_event_option(sound_row_sel)); 1658 pidgin_sound_get_event_option(sound_row_sel));
1565 1659
1566 temp_value = purple_prefs_get_bool(pref); 1660 temp_enabled = purple_prefs_get_bool(pref);
1567 1661 temp_mute = purple_prefs_get_bool(PIDGIN_PREFS_ROOT "/sound/mute");
1568 if (!temp_value) purple_prefs_set_bool(pref, TRUE); 1662
1663 if (!temp_enabled) purple_prefs_set_bool(pref, TRUE);
1664 if (temp_mute) purple_prefs_set_bool(PIDGIN_PREFS_ROOT "/sound/mute", FALSE);
1569 1665
1570 purple_sound_play_event(sound_row_sel, NULL); 1666 purple_sound_play_event(sound_row_sel, NULL);
1571 1667
1572 if (!temp_value) purple_prefs_set_bool(pref, FALSE); 1668 if (!temp_enabled) purple_prefs_set_bool(pref, FALSE);
1669 if (temp_mute) purple_prefs_set_bool(PIDGIN_PREFS_ROOT "/sound/mute", TRUE);
1573 1670
1574 g_free(pref); 1671 g_free(pref);
1575 } 1672 }
1576 1673
1577 /* 1674 /*
1887 button = gtk_button_new_with_label(_("Choose...")); 1984 button = gtk_button_new_with_label(_("Choose..."));
1888 g_signal_connect(G_OBJECT(button), "clicked", G_CALLBACK(select_sound), NULL); 1985 g_signal_connect(G_OBJECT(button), "clicked", G_CALLBACK(select_sound), NULL);
1889 gtk_box_pack_start(GTK_BOX(hbox), button, FALSE, FALSE, 1); 1986 gtk_box_pack_start(GTK_BOX(hbox), button, FALSE, FALSE, 1);
1890 1987
1891 gtk_widget_show_all(ret); 1988 gtk_widget_show_all(ret);
1989 g_object_unref(sg);
1892 1990
1893 return ret; 1991 return ret;
1894 } 1992 }
1895 1993
1896 1994
2012 gtk_widget_set_sensitive(GTK_WIDGET(menu), FALSE); 2110 gtk_widget_set_sensitive(GTK_WIDGET(menu), FALSE);
2013 gtk_widget_set_sensitive(GTK_WIDGET(label), FALSE); 2111 gtk_widget_set_sensitive(GTK_WIDGET(label), FALSE);
2014 } 2112 }
2015 2113
2016 gtk_widget_show_all(ret); 2114 gtk_widget_show_all(ret);
2115 g_object_unref(sg);
2017 2116
2018 return ret; 2117 return ret;
2019 } 2118 }
2020 2119
2021 static int 2120 static int

mercurial