| 748 win->conversations.minimum_entry_lines); |
730 win->conversations.minimum_entry_lines); |
| 749 |
731 |
| 750 ag = talkatu_buffer_get_action_group(TALKATU_BUFFER(win->conversations.format_buffer)); |
732 ag = talkatu_buffer_get_action_group(TALKATU_BUFFER(win->conversations.format_buffer)); |
| 751 g_signal_connect_after(G_OBJECT(ag), "action-activated", |
733 g_signal_connect_after(G_OBJECT(ag), "action-activated", |
| 752 G_CALLBACK(formatting_toggle_cb), NULL); |
734 G_CALLBACK(formatting_toggle_cb), NULL); |
| 753 } |
|
| 754 |
|
| 755 static void |
|
| 756 proxy_changed_cb(const char *name, PurplePrefType type, |
|
| 757 gconstpointer value, gpointer data) |
|
| 758 { |
|
| 759 PidginPrefsWindow *win = data; |
|
| 760 const char *proxy = value; |
|
| 761 |
|
| 762 if (!purple_strequal(proxy, "none") && !purple_strequal(proxy, "envvar")) |
|
| 763 gtk_widget_show_all(win->proxy.options); |
|
| 764 else |
|
| 765 gtk_widget_hide(win->proxy.options); |
|
| 766 } |
|
| 767 |
|
| 768 static void |
|
| 769 proxy_print_option(GtkWidget *entry, PidginPrefsWindow *win) |
|
| 770 { |
|
| 771 if (entry == win->proxy.host) { |
|
| 772 purple_prefs_set_string("/purple/proxy/host", |
|
| 773 gtk_entry_get_text(GTK_ENTRY(entry))); |
|
| 774 } else if (entry == win->proxy.port) { |
|
| 775 purple_prefs_set_int("/purple/proxy/port", |
|
| 776 gtk_spin_button_get_value_as_int( |
|
| 777 GTK_SPIN_BUTTON(entry))); |
|
| 778 } else if (entry == win->proxy.username) { |
|
| 779 purple_prefs_set_string("/purple/proxy/username", |
|
| 780 gtk_entry_get_text(GTK_ENTRY(entry))); |
|
| 781 } else if (entry == win->proxy.password) { |
|
| 782 purple_prefs_set_string("/purple/proxy/password", |
|
| 783 gtk_entry_get_text(GTK_ENTRY(entry))); |
|
| 784 } |
|
| 785 } |
|
| 786 |
|
| 787 static void |
|
| 788 proxy_button_clicked_cb(GtkWidget *button, PidginPrefsWindow *win) |
|
| 789 { |
|
| 790 GError *err = NULL; |
|
| 791 |
|
| 792 if (g_spawn_command_line_async(win->proxy.gnome_program_path, &err)) |
|
| 793 return; |
|
| 794 |
|
| 795 purple_notify_error(NULL, NULL, _("Cannot start proxy configuration program."), err->message, NULL); |
|
| 796 g_error_free(err); |
|
| 797 } |
|
| 798 |
|
| 799 static void |
|
| 800 bind_proxy_page(PidginPrefsWindow *win) |
|
| 801 { |
|
| 802 PurpleProxyInfo *proxy_info; |
|
| 803 |
|
| 804 if(purple_running_gnome()) { |
|
| 805 gchar *path = NULL; |
|
| 806 |
|
| 807 gtk_stack_set_visible_child_name(GTK_STACK(win->proxy.stack), |
|
| 808 "gnome"); |
|
| 809 |
|
| 810 path = g_find_program_in_path("gnome-network-properties"); |
|
| 811 if (path == NULL) |
|
| 812 path = g_find_program_in_path("gnome-network-preferences"); |
|
| 813 if (path == NULL) { |
|
| 814 path = g_find_program_in_path("gnome-control-center"); |
|
| 815 if (path != NULL) { |
|
| 816 char *tmp = g_strdup_printf("%s network", path); |
|
| 817 g_free(path); |
|
| 818 path = tmp; |
|
| 819 } |
|
| 820 } |
|
| 821 |
|
| 822 win->proxy.gnome_program_path = path; |
|
| 823 gtk_widget_set_visible(win->proxy.gnome_not_found, |
|
| 824 path == NULL); |
|
| 825 gtk_widget_set_visible(win->proxy.gnome_program, |
|
| 826 path != NULL); |
|
| 827 } else { |
|
| 828 gtk_stack_set_visible_child_name(GTK_STACK(win->proxy.stack), |
|
| 829 "nongnome"); |
|
| 830 |
|
| 831 /* This is a global option that affects SOCKS4 usage even with |
|
| 832 * account-specific proxy settings */ |
|
| 833 pidgin_prefs_bind_checkbox("/purple/proxy/socks4_remotedns", |
|
| 834 win->proxy.socks4_remotedns); |
|
| 835 |
|
| 836 win->proxy.type.type = PURPLE_PREF_STRING; |
|
| 837 win->proxy.type.key = "/purple/proxy/type"; |
|
| 838 pidgin_prefs_bind_dropdown(&win->proxy.type); |
|
| 839 proxy_info = purple_global_proxy_get_info(); |
|
| 840 |
|
| 841 purple_prefs_connect_callback(prefs, "/purple/proxy/type", |
|
| 842 proxy_changed_cb, win); |
|
| 843 |
|
| 844 if (proxy_info != NULL) { |
|
| 845 if (purple_proxy_info_get_hostname(proxy_info)) { |
|
| 846 gtk_entry_set_text(GTK_ENTRY(win->proxy.host), |
|
| 847 purple_proxy_info_get_hostname(proxy_info)); |
|
| 848 } |
|
| 849 |
|
| 850 if (purple_proxy_info_get_port(proxy_info) != 0) { |
|
| 851 gtk_spin_button_set_value( |
|
| 852 GTK_SPIN_BUTTON(win->proxy.port), |
|
| 853 purple_proxy_info_get_port(proxy_info)); |
|
| 854 } |
|
| 855 |
|
| 856 if (purple_proxy_info_get_username(proxy_info) != NULL) { |
|
| 857 gtk_entry_set_text(GTK_ENTRY(win->proxy.username), |
|
| 858 purple_proxy_info_get_username(proxy_info)); |
|
| 859 } |
|
| 860 |
|
| 861 if (purple_proxy_info_get_password(proxy_info) != NULL) { |
|
| 862 gtk_entry_set_text(GTK_ENTRY(win->proxy.password), |
|
| 863 purple_proxy_info_get_password(proxy_info)); |
|
| 864 } |
|
| 865 } |
|
| 866 |
|
| 867 proxy_changed_cb("/purple/proxy/type", PURPLE_PREF_STRING, |
|
| 868 purple_prefs_get_string("/purple/proxy/type"), |
|
| 869 win); |
|
| 870 } |
|
| 871 } |
735 } |
| 872 |
736 |
| 873 #ifdef USE_VV |
737 #ifdef USE_VV |
| 874 static GList * |
738 static GList * |
| 875 get_vv_device_menuitems(PurpleMediaElementType type) |
739 get_vv_device_menuitems(PurpleMediaElementType type) |
| 1431 widget_class, PidginPrefsWindow, |
1294 widget_class, PidginPrefsWindow, |
| 1432 conversations.format_buffer); |
1295 conversations.format_buffer); |
| 1433 gtk_widget_class_bind_template_child( |
1296 gtk_widget_class_bind_template_child( |
| 1434 widget_class, PidginPrefsWindow, |
1297 widget_class, PidginPrefsWindow, |
| 1435 conversations.format_view); |
1298 conversations.format_view); |
| 1436 |
|
| 1437 /* Proxy page */ |
|
| 1438 gtk_widget_class_bind_template_child( |
|
| 1439 widget_class, PidginPrefsWindow, proxy.stack); |
|
| 1440 gtk_widget_class_bind_template_child( |
|
| 1441 widget_class, PidginPrefsWindow, proxy.gnome_not_found); |
|
| 1442 gtk_widget_class_bind_template_child( |
|
| 1443 widget_class, PidginPrefsWindow, proxy.gnome_program); |
|
| 1444 gtk_widget_class_bind_template_child( |
|
| 1445 widget_class, PidginPrefsWindow, |
|
| 1446 proxy.socks4_remotedns); |
|
| 1447 gtk_widget_class_bind_template_child( |
|
| 1448 widget_class, PidginPrefsWindow, proxy.type.combo); |
|
| 1449 gtk_widget_class_bind_template_child( |
|
| 1450 widget_class, PidginPrefsWindow, proxy.options); |
|
| 1451 gtk_widget_class_bind_template_child( |
|
| 1452 widget_class, PidginPrefsWindow, proxy.host); |
|
| 1453 gtk_widget_class_bind_template_child( |
|
| 1454 widget_class, PidginPrefsWindow, proxy.port); |
|
| 1455 gtk_widget_class_bind_template_child( |
|
| 1456 widget_class, PidginPrefsWindow, proxy.username); |
|
| 1457 gtk_widget_class_bind_template_child( |
|
| 1458 widget_class, PidginPrefsWindow, proxy.password); |
|
| 1459 gtk_widget_class_bind_template_callback(widget_class, |
|
| 1460 proxy_button_clicked_cb); |
|
| 1461 gtk_widget_class_bind_template_callback(widget_class, |
|
| 1462 proxy_print_option); |
|
| 1463 } |
1299 } |
| 1464 |
1300 |
| 1465 static void |
1301 static void |
| 1466 pidgin_prefs_window_init(PidginPrefsWindow *win) |
1302 pidgin_prefs_window_init(PidginPrefsWindow *win) |
| 1467 { |
1303 { |