File: download-Remove-proxy-settings.patch

package info (click to toggle)
gmpc 11.8.16-23
  • links: PTS, VCS
  • area: main
  • in suites: forky, sid
  • size: 20,600 kB
  • sloc: ansic: 51,080; sh: 10,438; makefile: 1,748; xml: 9
file content (252 lines) | stat: -rw-r--r-- 8,701 bytes parent folder | download
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
From: Simon McVittie <smcv@debian.org>
Date: Wed, 27 Aug 2025 10:41:13 +0100
Subject: download: Remove proxy settings

libsoup3 uses desktop-wide proxy settings, via the default GProxyResolver.

Signed-off-by: Simon McVittie <smcv@debian.org>
---
 src/Tools/gmpc_easy_download.c | 197 -----------------------------------------
 src/Tools/plugin-man.c         |   1 -
 src/internal-plugins.h         |   1 -
 3 files changed, 199 deletions(-)

diff --git a/src/Tools/gmpc_easy_download.c b/src/Tools/gmpc_easy_download.c
index db5398a..c11969c 100644
--- a/src/Tools/gmpc_easy_download.c
+++ b/src/Tools/gmpc_easy_download.c
@@ -97,202 +97,6 @@ static int close_cb(void *z)
 
 static SoupSession *soup_session = NULL;
 
-static void gmpc_easy_download_set_proxy(SoupSession * session)
-{
-	if (session == NULL)
-		return;
-
-	if (cfg_get_single_value_as_int_with_default(config, "Network Settings", "Use Proxy", FALSE))
-	{
-		char *value = cfg_get_single_value_as_string(config, "Network Settings", "Proxy Address");
-		char *username = NULL;
-		char *password = NULL;
-		gint port = cfg_get_single_value_as_int_with_default(config, "Network Settings", "Proxy Port", 8080);
-		if (cfg_get_single_value_as_int_with_default(config, "Network Settings", "Use authentication", FALSE))
-		{
-			password = cfg_get_single_value_as_string(config, "Network Settings", "Proxy authentication password");
-			username = cfg_get_single_value_as_string(config, "Network Settings", "Proxy authentication username");
-		}
-		if (value)
-		{
-			SoupURI *uri = NULL;
-			gchar *ppath = NULL;
-			if (username && username[0] != '\0' && password && password[0] != '\0')
-			{
-				gchar *usere = gmpc_easy_download_uri_escape(username);
-				gchar *passe = gmpc_easy_download_uri_escape(password);
-				ppath = g_strdup_printf("http://%s:%s@%s:%i", usere, passe, value, port);
-				g_free(usere);
-				g_free(passe);
-			} else if (username && username[0] != '\0')
-			{
-				gchar *usere = gmpc_easy_download_uri_escape(username);
-				ppath = g_strdup_printf("http://%s@%s:%i", usere, value, port);
-				g_free(usere);
-			} else
-			{
-				ppath = g_strdup_printf("http://%s:%i", value, port);
-			}
-			uri = soup_uri_new(ppath);
-			g_object_set(G_OBJECT(session), SOUP_SESSION_PROXY_URI, uri, NULL);
-			soup_uri_free(uri);
-			g_free(ppath);
-		}
-		g_free(username);
-		g_free(password);
-		g_free(value);
-	} else
-	{
-		g_object_set(G_OBJECT(session), SOUP_SESSION_PROXY_URI, NULL, NULL);
-	}
-}
-
-/***
- * preferences window
- */
-/* for gtkbuilder */
-void proxy_pref_use_proxy_toggled(GtkWidget * toggle_button);
-void proxy_pref_http_address_changed(GtkWidget * entry);
-void proxy_pref_http_port_changed(GtkWidget * entry);
-void proxy_pref_use_auth_toggled(GtkWidget * toggle_button);
-void proxy_pref_auth_username_changed(GtkWidget * entry);
-void proxy_pref_auth_password_changed(GtkWidget * entry);
-
-static GtkBuilder *proxy_pref_xml = NULL;
-static void proxy_pref_destroy(GtkWidget * container)
-{
-	GObject *temp = gtk_builder_get_object(proxy_pref_xml, "frame_proxy_settings");
-	gtk_container_remove(GTK_CONTAINER(container), GTK_WIDGET(temp));
-	g_object_unref(proxy_pref_xml);
-	proxy_pref_xml = NULL;
-}
-
-void proxy_pref_use_proxy_toggled(GtkWidget * toggle_button)
-{
-	cfg_set_single_value_as_int(config, "Network Settings", "Use Proxy",
-								gtk_toggle_button_get_active(GTK_TOGGLE_BUTTON(toggle_button)));
-	gmpc_easy_download_set_proxy(soup_session);
-}
-
-void proxy_pref_http_address_changed(GtkWidget * entry)
-{
-	cfg_set_single_value_as_string(config, "Network Settings", "Proxy Address",
-								   (char *)gtk_entry_get_text(GTK_ENTRY(entry)));
-	gmpc_easy_download_set_proxy(soup_session);
-}
-
-void proxy_pref_http_port_changed(GtkWidget * entry)
-{
-	cfg_set_single_value_as_int(config, "Network Settings", "Proxy Port",
-								gtk_spin_button_get_value_as_int(GTK_SPIN_BUTTON(entry)));
-	gmpc_easy_download_set_proxy(soup_session);
-}
-
-void proxy_pref_use_auth_toggled(GtkWidget * toggle_button)
-{
-	cfg_set_single_value_as_int(config, "Network Settings", "Use authentication",
-								gtk_toggle_button_get_active(GTK_TOGGLE_BUTTON(toggle_button)));
-	gmpc_easy_download_set_proxy(soup_session);
-}
-
-void proxy_pref_auth_username_changed(GtkWidget * entry)
-{
-	cfg_set_single_value_as_string(config, "Network Settings", "Proxy authentication username",
-								   (char *)gtk_entry_get_text(GTK_ENTRY(entry)));
-	gmpc_easy_download_set_proxy(soup_session);
-}
-
-void proxy_pref_auth_password_changed(GtkWidget * entry)
-{
-	cfg_set_single_value_as_string(config, "Network Settings", "Proxy authentication password",
-								   gtk_entry_get_text(GTK_ENTRY(entry)));
-	gmpc_easy_download_set_proxy(soup_session);
-}
-
-static void proxy_pref_construct(GtkWidget * container)
-{
-	GObject *temp = NULL;
-	gchar *string;
-	GError *error = NULL;
-	gchar *path = gmpc_get_full_glade_path("preferences-proxy.ui");
-	proxy_pref_xml = gtk_builder_new();
-	gtk_builder_add_from_file(proxy_pref_xml, path, &error);
-
-	if (error)
-	{
-		g_log(LOG_DOMAIN, G_LOG_LEVEL_WARNING, "Failed to load %s: '%s'", path, error->message);
-		g_error_free(error);
-		g_free(path);
-
-		return;
-	}
-
-	q_free(path);
-	/* use proxy */
-	temp = gtk_builder_get_object(proxy_pref_xml, "checkbutton_use_proxy");
-	gtk_toggle_button_set_active(GTK_TOGGLE_BUTTON(temp),
-								 cfg_get_single_value_as_int_with_default(config, "Network Settings", "Use Proxy",
-																		  FALSE));
-
-	/* hostname */
-	temp = gtk_builder_get_object(proxy_pref_xml, "entry_http_hostname");
-	string = cfg_get_single_value_as_string(config, "Network Settings", "Proxy Address");
-	if (string)
-	{
-		gtk_entry_set_text(GTK_ENTRY(temp), string);
-		g_free(string);
-	}
-
-	/* port */
-	temp = gtk_builder_get_object(proxy_pref_xml, "spinbutton_http_port");
-	gtk_spin_button_set_value(GTK_SPIN_BUTTON(temp),
-							  cfg_get_single_value_as_int_with_default(config, "Network Settings", "Proxy Port", 8080));
-
-	/* use auth */
-	temp = gtk_builder_get_object(proxy_pref_xml, "checkbutton_use_auth");
-	gtk_toggle_button_set_active(GTK_TOGGLE_BUTTON(temp),
-								 cfg_get_single_value_as_int_with_default(config, "Network Settings",
-																		  "Use authentication", FALSE));
-
-	/* username */
-	temp = gtk_builder_get_object(proxy_pref_xml, "entry_auth_username");
-	string = cfg_get_single_value_as_string(config, "Network Settings", "Proxy authentication username");
-	if (string)
-	{
-		gtk_entry_set_text(GTK_ENTRY(temp), string);
-		g_free(string);
-	}
-
-	/* username */
-	temp = gtk_builder_get_object(proxy_pref_xml, "entry_auth_password");
-	string = cfg_get_single_value_as_string(config, "Network Settings", "Proxy authentication password");
-	if (string)
-	{
-		gtk_entry_set_text(GTK_ENTRY(temp), string);
-		g_free(string);
-	}
-
-	/* signal autoconnect */
-	gtk_builder_connect_signals(proxy_pref_xml, NULL);
-	/* Add to parent */
-	temp = gtk_builder_get_object(proxy_pref_xml, "frame_proxy_settings");
-	gtk_container_add(GTK_CONTAINER(container), GTK_WIDGET(temp));
-	gtk_widget_show_all(container);
-}
-
-gmpcPrefPlugin proxyplug_pref = {
-	.construct = proxy_pref_construct,
-	.destroy = proxy_pref_destroy
-};
-
-gmpcPlugin proxyplug = {
-	.name = N_("Proxy"),
-	.version = {0, 0, 0}
-	,
-	.plugin_type = GMPC_INTERNALL,
-	.pref = &proxyplug_pref
-};
-
 /**
  * LIBSOUP BASED ASYNC DOWNLOADER
  */
@@ -540,7 +344,6 @@ GEADAsyncHandler *gmpc_easy_async_downloader_with_headers(const gchar * uri, GEA
 	if (soup_session == NULL)
 	{
 		soup_session = soup_session_async_new();
-		gmpc_easy_download_set_proxy(soup_session);
 		g_object_set(soup_session, "timeout", 5, NULL);
 		/* Set user agent, to get around wikipedia ban. */
 		g_object_set(soup_session, "user-agent", "gmpc ",NULL);
diff --git a/src/Tools/plugin-man.c b/src/Tools/plugin-man.c
index 6014cd9..e5ce122 100644
--- a/src/Tools/plugin-man.c
+++ b/src/Tools/plugin-man.c
@@ -77,7 +77,6 @@ void plugin_manager_load_internal_plugins(void)
 
     plugin_add(&statistics_plugin, 0, NULL);
     plugin_add(&metadata_plug, 0, NULL);
-    plugin_add(&proxyplug, 0, NULL);
 
     plugin_add(&extraplaylist_plugin, 0, NULL);
     plugin_add_new(
diff --git a/src/internal-plugins.h b/src/internal-plugins.h
index 0c45b34..cdd0f1a 100644
--- a/src/internal-plugins.h
+++ b/src/internal-plugins.h
@@ -6,7 +6,6 @@ extern gmpcPlugin metadata_plug;
 extern gmpcPlugin playlist_plug;
 extern gmpcPlugin cover_art_plug;
 extern gmpcPlugin tray_icon2_plug;
-extern gmpcPlugin proxyplug;
 extern gmpcPlugin playlist_editor_plugin;
 extern gmpcPlugin statistics_plugin;
 extern gmpcPlugin extraplaylist_plugin;