| 52 G_DEFINE_TYPE(PidginProxyPrefs, pidgin_proxy_prefs, ADW_TYPE_PREFERENCES_PAGE) |
52 G_DEFINE_TYPE(PidginProxyPrefs, pidgin_proxy_prefs, ADW_TYPE_PREFERENCES_PAGE) |
| 53 |
53 |
| 54 /****************************************************************************** |
54 /****************************************************************************** |
| 55 * Helpers |
55 * Helpers |
| 56 *****************************************************************************/ |
56 *****************************************************************************/ |
| |
57 static gchar * |
| |
58 proxy_type_expression_cb(GObject *self, G_GNUC_UNUSED gpointer data) |
| |
59 { |
| |
60 const gchar *text = ""; |
| |
61 const gchar *value = NULL; |
| |
62 |
| |
63 value = gtk_string_object_get_string(GTK_STRING_OBJECT(self)); |
| |
64 if(purple_strequal(value, "none")) { |
| |
65 text = _("No proxy"); |
| |
66 } else if(purple_strequal(value, "socks4")) { |
| |
67 text = _("SOCKS 4"); |
| |
68 } else if(purple_strequal(value, "socks5")) { |
| |
69 text = _("SOCKS 5"); |
| |
70 } else if(purple_strequal(value, "tor")) { |
| |
71 text = _("Tor/Privacy (SOCKS 5)"); |
| |
72 } else if(purple_strequal(value, "http")) { |
| |
73 text = _("HTTP"); |
| |
74 } else if(purple_strequal(value, "envvar")) { |
| |
75 text = _("Use Environmental Settings"); |
| |
76 } |
| |
77 |
| |
78 return g_strdup(text); |
| |
79 } |
| |
80 |
| 57 static void |
81 static void |
| 58 proxy_changed_cb(const gchar *name, PurplePrefType type, gconstpointer value, |
82 proxy_changed_cb(const gchar *name, PurplePrefType type, gconstpointer value, |
| 59 gpointer data) |
83 gpointer data) |
| 60 { |
84 { |
| 61 PidginProxyPrefs *prefs = data; |
85 PidginProxyPrefs *prefs = data; |
| 139 gtk_widget_class_bind_template_child( |
163 gtk_widget_class_bind_template_child( |
| 140 widget_class, PidginProxyPrefs, nongnome); |
164 widget_class, PidginProxyPrefs, nongnome); |
| 141 gtk_widget_class_bind_template_child( |
165 gtk_widget_class_bind_template_child( |
| 142 widget_class, PidginProxyPrefs, socks4_remotedns); |
166 widget_class, PidginProxyPrefs, socks4_remotedns); |
| 143 gtk_widget_class_bind_template_child( |
167 gtk_widget_class_bind_template_child( |
| 144 widget_class, PidginProxyPrefs, type.combo); |
168 widget_class, PidginProxyPrefs, type); |
| 145 gtk_widget_class_bind_template_child( |
169 gtk_widget_class_bind_template_child( |
| 146 widget_class, PidginProxyPrefs, options); |
170 widget_class, PidginProxyPrefs, options); |
| 147 gtk_widget_class_bind_template_child( |
171 gtk_widget_class_bind_template_child( |
| 148 widget_class, PidginProxyPrefs, host); |
172 widget_class, PidginProxyPrefs, host); |
| 149 gtk_widget_class_bind_template_child( |
173 gtk_widget_class_bind_template_child( |
| 150 widget_class, PidginProxyPrefs, port); |
174 widget_class, PidginProxyPrefs, port); |
| 151 gtk_widget_class_bind_template_child( |
175 gtk_widget_class_bind_template_child( |
| 152 widget_class, PidginProxyPrefs, username); |
176 widget_class, PidginProxyPrefs, username); |
| 153 gtk_widget_class_bind_template_child( |
177 gtk_widget_class_bind_template_child( |
| 154 widget_class, PidginProxyPrefs, password); |
178 widget_class, PidginProxyPrefs, password); |
| |
179 gtk_widget_class_bind_template_callback(widget_class, |
| |
180 proxy_type_expression_cb); |
| 155 gtk_widget_class_bind_template_callback(widget_class, |
181 gtk_widget_class_bind_template_callback(widget_class, |
| 156 proxy_row_activated_cb); |
182 proxy_row_activated_cb); |
| 157 gtk_widget_class_bind_template_callback(widget_class, |
183 gtk_widget_class_bind_template_callback(widget_class, |
| 158 proxy_print_option); |
184 proxy_print_option); |
| 159 } |
185 } |
| 195 /* This is a global option that affects SOCKS4 usage even with |
221 /* This is a global option that affects SOCKS4 usage even with |
| 196 * account-specific proxy settings */ |
222 * account-specific proxy settings */ |
| 197 pidgin_prefs_bind_switch("/purple/proxy/socks4_remotedns", |
223 pidgin_prefs_bind_switch("/purple/proxy/socks4_remotedns", |
| 198 prefs->socks4_remotedns); |
224 prefs->socks4_remotedns); |
| 199 |
225 |
| 200 prefs->type.type = PURPLE_PREF_STRING; |
226 pidgin_prefs_bind_combo_row("/purple/proxy/type", prefs->type); |
| 201 prefs->type.key = "/purple/proxy/type"; |
227 |
| 202 pidgin_prefs_bind_dropdown(&prefs->type); |
|
| 203 proxy_info = purple_global_proxy_get_info(); |
228 proxy_info = purple_global_proxy_get_info(); |
| 204 |
229 |
| 205 purple_prefs_connect_callback(prefs, "/purple/proxy/type", |
230 purple_prefs_connect_callback(prefs, "/purple/proxy/type", |
| 206 proxy_changed_cb, prefs); |
231 proxy_changed_cb, prefs); |
| 207 |
232 |