diff options
-rw-r--r-- | plugins/gtkui/callbacks.c | 1 | ||||
-rw-r--r-- | plugins/gtkui/callbacks.h | 4 | ||||
-rw-r--r-- | plugins/gtkui/deadbeef.glade | 69 | ||||
-rw-r--r-- | plugins/gtkui/interface.c | 28 | ||||
-rw-r--r-- | plugins/gtkui/prefwin.c | 14 | ||||
-rw-r--r-- | plugins/lastfm/lastfm.c | 3 | ||||
-rw-r--r-- | plugins/vfs_curl/vfs_curl.c | 4 |
7 files changed, 121 insertions, 2 deletions
diff --git a/plugins/gtkui/callbacks.c b/plugins/gtkui/callbacks.c index 7bd1973d..74b92e8e 100644 --- a/plugins/gtkui/callbacks.c +++ b/plugins/gtkui/callbacks.c @@ -1291,4 +1291,3 @@ on_sort_by_custom_activate (GtkMenuItem *menuitem, dlg = NULL; } - diff --git a/plugins/gtkui/callbacks.h b/plugins/gtkui/callbacks.h index 068cce0a..098c77c7 100644 --- a/plugins/gtkui/callbacks.h +++ b/plugins/gtkui/callbacks.h @@ -1167,3 +1167,7 @@ on_reset_autostop_toggled (GtkToggleButton *togglebutton, void on_editcolumn_title_changed (GtkEditable *editable, gpointer user_data); + +void +on_useragent_changed (GtkEditable *editable, + gpointer user_data); diff --git a/plugins/gtkui/deadbeef.glade b/plugins/gtkui/deadbeef.glade index 64a59712..28b38349 100644 --- a/plugins/gtkui/deadbeef.glade +++ b/plugins/gtkui/deadbeef.glade @@ -4874,6 +4874,75 @@ SOCKS5_HOSTNAME</property> <property name="fill">False</property> </packing> </child> + + <child> + <widget class="GtkHSeparator" id="hseparator1"> + <property name="visible">True</property> + </widget> + <packing> + <property name="padding">0</property> + <property name="expand">False</property> + <property name="fill">True</property> + </packing> + </child> + + <child> + <widget class="GtkHBox" id="hbox104"> + <property name="visible">True</property> + <property name="homogeneous">False</property> + <property name="spacing">8</property> + + <child> + <widget class="GtkLabel" id="label131"> + <property name="visible">True</property> + <property name="label" translatable="yes">HTTP User Agent:</property> + <property name="use_underline">False</property> + <property name="use_markup">False</property> + <property name="justify">GTK_JUSTIFY_LEFT</property> + <property name="wrap">False</property> + <property name="selectable">False</property> + <property name="xalign">0.5</property> + <property name="yalign">0.5</property> + <property name="xpad">0</property> + <property name="ypad">0</property> + <property name="ellipsize">PANGO_ELLIPSIZE_NONE</property> + <property name="width_chars">-1</property> + <property name="single_line_mode">False</property> + <property name="angle">0</property> + </widget> + <packing> + <property name="padding">0</property> + <property name="expand">False</property> + <property name="fill">False</property> + </packing> + </child> + + <child> + <widget class="GtkEntry" id="useragent"> + <property name="visible">True</property> + <property name="can_focus">True</property> + <property name="editable">True</property> + <property name="visibility">True</property> + <property name="max_length">0</property> + <property name="text" translatable="yes"></property> + <property name="has_frame">True</property> + <property name="invisible_char">•</property> + <property name="activates_default">False</property> + <signal name="changed" handler="on_useragent_changed" last_modification_time="Thu, 16 Aug 2012 18:24:48 GMT"/> + </widget> + <packing> + <property name="padding">0</property> + <property name="expand">True</property> + <property name="fill">True</property> + </packing> + </child> + </widget> + <packing> + <property name="padding">0</property> + <property name="expand">False</property> + <property name="fill">True</property> + </packing> + </child> </widget> <packing> <property name="tab_expand">False</property> diff --git a/plugins/gtkui/interface.c b/plugins/gtkui/interface.c index 7837484e..074458da 100644 --- a/plugins/gtkui/interface.c +++ b/plugins/gtkui/interface.c @@ -1780,6 +1780,10 @@ create_prefwin (void) GtkWidget *hbox62; GtkWidget *label98; GtkWidget *proxypassword; + GtkWidget *hseparator1; + GtkWidget *hbox104; + GtkWidget *label131; + GtkWidget *useragent; GtkWidget *label16; GtkWidget *hpaned1; GtkWidget *scrolledwindow2; @@ -2448,6 +2452,23 @@ create_prefwin (void) gtk_entry_set_visibility (GTK_ENTRY (proxypassword), FALSE); gtk_entry_set_invisible_char (GTK_ENTRY (proxypassword), 9679); + hseparator1 = gtk_hseparator_new (); + gtk_widget_show (hseparator1); + gtk_box_pack_start (GTK_BOX (vbox11), hseparator1, FALSE, TRUE, 0); + + hbox104 = gtk_hbox_new (FALSE, 8); + gtk_widget_show (hbox104); + gtk_box_pack_start (GTK_BOX (vbox11), hbox104, FALSE, TRUE, 0); + + label131 = gtk_label_new (_("HTTP User Agent:")); + gtk_widget_show (label131); + gtk_box_pack_start (GTK_BOX (hbox104), label131, FALSE, FALSE, 0); + + useragent = gtk_entry_new (); + gtk_widget_show (useragent); + gtk_box_pack_start (GTK_BOX (hbox104), useragent, TRUE, TRUE, 0); + gtk_entry_set_invisible_char (GTK_ENTRY (useragent), 8226); + label16 = gtk_label_new (_("Network")); gtk_widget_show (label16); gtk_notebook_set_tab_label (GTK_NOTEBOOK (notebook), gtk_notebook_get_nth_page (GTK_NOTEBOOK (notebook), 5), label16); @@ -2726,6 +2747,9 @@ create_prefwin (void) g_signal_connect ((gpointer) proxypassword, "changed", G_CALLBACK (on_proxypassword_changed), NULL); + g_signal_connect ((gpointer) useragent, "changed", + G_CALLBACK (on_useragent_changed), + NULL); g_signal_connect ((gpointer) pref_pluginlist, "cursor_changed", G_CALLBACK (on_pref_pluginlist_cursor_changed), NULL); @@ -2866,6 +2890,10 @@ create_prefwin (void) GLADE_HOOKUP_OBJECT (prefwin, hbox62, "hbox62"); GLADE_HOOKUP_OBJECT (prefwin, label98, "label98"); GLADE_HOOKUP_OBJECT (prefwin, proxypassword, "proxypassword"); + GLADE_HOOKUP_OBJECT (prefwin, hseparator1, "hseparator1"); + GLADE_HOOKUP_OBJECT (prefwin, hbox104, "hbox104"); + GLADE_HOOKUP_OBJECT (prefwin, label131, "label131"); + GLADE_HOOKUP_OBJECT (prefwin, useragent, "useragent"); GLADE_HOOKUP_OBJECT (prefwin, label16, "label16"); GLADE_HOOKUP_OBJECT (prefwin, hpaned1, "hpaned1"); GLADE_HOOKUP_OBJECT (prefwin, scrolledwindow2, "scrolledwindow2"); diff --git a/plugins/gtkui/prefwin.c b/plugins/gtkui/prefwin.c index a7395e60..8dc3649a 100644 --- a/plugins/gtkui/prefwin.c +++ b/plugins/gtkui/prefwin.c @@ -636,6 +636,10 @@ on_preferences_activate (GtkMenuItem *menuitem, gtk_entry_set_text (GTK_ENTRY (lookup_widget (w, "proxyuser")), deadbeef->conf_get_str_fast ("network.proxy.username", "")); gtk_entry_set_text (GTK_ENTRY (lookup_widget (w, "proxypassword")), deadbeef->conf_get_str_fast ("network.proxy.password", "")); + char ua[100]; + deadbeef->conf_get_str ("network.http_user_agent", "deadbeef", ua, sizeof (ua)); + gtk_entry_set_text (GTK_ENTRY (lookup_widget (w, "useragent")), ua); + // list of plugins GtkTreeView *tree = GTK_TREE_VIEW (lookup_widget (w, "pref_pluginlist")); GtkCellRenderer *rend_text = gtk_cell_renderer_text_new (); @@ -1407,3 +1411,13 @@ on_convert8to16_toggled (GtkToggleButton *togglebutton, deadbeef->sendmessage (DB_EV_CONFIGCHANGED, 0, 0, 0); } + + +void +on_useragent_changed (GtkEditable *editable, + gpointer user_data) +{ + deadbeef->conf_set_str ("network.http_user_agent", gtk_entry_get_text (GTK_ENTRY (editable))); + deadbeef->sendmessage (DB_EV_CONFIGCHANGED, 0, 0, 0); +} + diff --git a/plugins/lastfm/lastfm.c b/plugins/lastfm/lastfm.c index 1e4fec70..2f542a62 100644 --- a/plugins/lastfm/lastfm.c +++ b/plugins/lastfm/lastfm.c @@ -130,6 +130,9 @@ curl_req_send (const char *req, const char *post) { curl_easy_setopt(curl, CURLOPT_HTTP_VERSION, CURL_HTTP_VERSION_1_1); curl_easy_setopt (curl, CURLOPT_NOSIGNAL, 1); curl_easy_setopt (curl, CURLOPT_PROGRESSFUNCTION, lfm_curl_control); + char ua[100]; + deadbeef->conf_get_str ("network.http_user_agent", "deadbeef", ua, sizeof (ua)); + curl_easy_setopt (curl, CURLOPT_USERAGENT, ua); curl_easy_setopt (curl, CURLOPT_NOPROGRESS, 0); if (post) { curl_easy_setopt(curl, CURLOPT_POST, 1); diff --git a/plugins/vfs_curl/vfs_curl.c b/plugins/vfs_curl/vfs_curl.c index bf35b7f4..2574e9fe 100644 --- a/plugins/vfs_curl/vfs_curl.c +++ b/plugins/vfs_curl/vfs_curl.c @@ -576,7 +576,9 @@ http_thread_func (void *ctx) { struct curl_slist *headers = NULL; curl_easy_reset (curl); curl_easy_setopt (curl, CURLOPT_URL, fp->url); - curl_easy_setopt (curl, CURLOPT_USERAGENT, "deadbeef"); + char ua[100]; + deadbeef->conf_get_str ("network.http_user_agent", "deadbeef", ua, sizeof (ua)); + curl_easy_setopt (curl, CURLOPT_USERAGENT, ua); curl_easy_setopt (curl, CURLOPT_NOPROGRESS, 1); curl_easy_setopt (curl, CURLOPT_WRITEFUNCTION, http_curl_write); curl_easy_setopt (curl, CURLOPT_WRITEDATA, ctx); |