summaryrefslogtreecommitdiff
path: root/plugins/gtkui/prefwin.c
diff options
context:
space:
mode:
authorGravatar Alexey Yakovenko <wakeroid@gmail.com>2010-05-02 20:50:12 +0200
committerGravatar Alexey Yakovenko <wakeroid@gmail.com>2010-05-02 20:50:12 +0200
commit8cb6665f0ebdf0825b48984efa8086a08dc51c63 (patch)
tree7f81da1db32092c1a1c9d9785cfb154d8f3479c6 /plugins/gtkui/prefwin.c
parent2700bbbc3d62c36d9e35e3b2778547754f934fbc (diff)
added proxy username/password authentication support
Diffstat (limited to 'plugins/gtkui/prefwin.c')
-rw-r--r--plugins/gtkui/prefwin.c87
1 files changed, 87 insertions, 0 deletions
diff --git a/plugins/gtkui/prefwin.c b/plugins/gtkui/prefwin.c
index a0018680..e4e9cf07 100644
--- a/plugins/gtkui/prefwin.c
+++ b/plugins/gtkui/prefwin.c
@@ -19,6 +19,8 @@
#include <gtk/gtk.h>
#include <string.h>
#include <assert.h>
+#include <stdlib.h>
+#include <gdk/gdkkeysyms.h>
#include "gtkui.h"
#include "support.h"
#include "interface.h"
@@ -468,6 +470,8 @@ on_preferences_activate (GtkMenuItem *menuitem,
else if (!strcasecmp (type, "SOCKS5_HOSTNAME")) {
gtk_combo_box_set_active (combobox, 5);
}
+ gtk_entry_set_text (GTK_ENTRY (lookup_widget (w, "proxyuser")), deadbeef->conf_get_str ("network.proxy.username", ""));
+ gtk_entry_set_text (GTK_ENTRY (lookup_widget (w, "proxypassword")), deadbeef->conf_get_str ("network.proxy.password", ""));
// list of plugins
GtkTreeView *tree = GTK_TREE_VIEW (lookup_widget (w, "pref_pluginlist"));
@@ -1072,3 +1076,86 @@ on_wv_strip_id3v1_toggled (GtkToggleButton *togglebutton,
deadbeef->conf_set_int ("wv.strip_id3v1", gtk_toggle_button_get_active (togglebutton));
}
+void
+on_pref_network_proxyaddress_changed (GtkEditable *editable,
+ gpointer user_data)
+{
+ deadbeef->conf_set_str ("network.proxy.address", gtk_entry_get_text (GTK_ENTRY (editable)));
+}
+
+
+void
+on_pref_network_enableproxy_clicked (GtkButton *button,
+ gpointer user_data)
+{
+ deadbeef->conf_set_int ("network.proxy", gtk_toggle_button_get_active (GTK_TOGGLE_BUTTON (button)));
+}
+
+
+void
+on_pref_network_proxyport_changed (GtkEditable *editable,
+ gpointer user_data)
+{
+ deadbeef->conf_set_int ("network.proxy.port", atoi (gtk_entry_get_text (GTK_ENTRY (editable))));
+}
+
+
+void
+on_pref_network_proxytype_changed (GtkComboBox *combobox,
+ gpointer user_data)
+{
+
+ int active = gtk_combo_box_get_active (combobox);
+ switch (active) {
+ case 0:
+ deadbeef->conf_set_str ("network.proxy.type", "HTTP");
+ break;
+ case 1:
+ deadbeef->conf_set_str ("network.proxy.type", "HTTP_1_0");
+ break;
+ case 2:
+ deadbeef->conf_set_str ("network.proxy.type", "SOCKS4");
+ break;
+ case 3:
+ deadbeef->conf_set_str ("network.proxy.type", "SOCKS5");
+ break;
+ case 4:
+ deadbeef->conf_set_str ("network.proxy.type", "SOCKS4A");
+ break;
+ case 5:
+ deadbeef->conf_set_str ("network.proxy.type", "SOCKS5_HOSTNAME");
+ break;
+ default:
+ deadbeef->conf_set_str ("network.proxy.type", "HTTP");
+ break;
+ }
+}
+
+void
+on_proxyuser_changed (GtkEditable *editable,
+ gpointer user_data)
+{
+ deadbeef->conf_set_str ("network.proxy.username", gtk_entry_get_text (GTK_ENTRY (editable)));
+}
+
+
+void
+on_proxypassword_changed (GtkEditable *editable,
+ gpointer user_data)
+{
+ deadbeef->conf_set_str ("network.proxy.password", gtk_entry_get_text (GTK_ENTRY (editable)));
+}
+
+
+gboolean
+on_prefwin_key_press_event (GtkWidget *widget,
+ GdkEventKey *event,
+ gpointer user_data)
+{
+ if (event->keyval == GDK_Escape) {
+ gtk_widget_hide (widget);
+ gtk_widget_destroy (widget);
+ }
+ return FALSE;
+}
+