[rhythmbox] remove old proxy code, use libsoup-gnome



commit ddb82e1457d12d39c30237767fe59246f6df4344
Author: Jonathan Matthew <jonathan d14n org>
Date:   Fri Jun 26 21:23:45 2009 +1000

    remove old proxy code, use libsoup-gnome
    
    Besides throwing away a pile of dead code, this means things work with
    proxy autoconfiguration (bug #345712).

 configure.ac                                      |    4 +-
 lib/Makefile.am                                   |    5 +-
 lib/rb-preferences.h                              |    1 -
 lib/rb-proxy-config.c                             |  289 ---------------------
 lib/rb-proxy-config.h                             |   78 ------
 plugins/audioscrobbler/rb-audioscrobbler-plugin.c |   29 +--
 plugins/audioscrobbler/rb-audioscrobbler.c        |   57 +----
 plugins/audioscrobbler/rb-audioscrobbler.h        |    4 +-
 plugins/audioscrobbler/rb-lastfm-source.c         |   57 +----
 shell/rb-shell.c                                  |   17 --
 10 files changed, 27 insertions(+), 514 deletions(-)
---
diff --git a/configure.ac b/configure.ac
index 5f2f725..447b20b 100644
--- a/configure.ac
+++ b/configure.ac
@@ -42,6 +42,7 @@ BRASERO_MIN_REQS=0.9.1
 TOTEM_PLPARSER_REQS=2.26.0
 VALA_REQS=0.1.0
 AVAHI_REQS=0.6
+LIBSOUP_REQS=2.26.0
 
 AC_MSG_CHECKING([for GNU extension fwrite_unlocked])
 AC_LINK_IFELSE(
@@ -83,7 +84,8 @@ PKG_CHECK_MODULES(RHYTHMBOX,				\
 		  glib-2.0 >= $GLIB_REQS		\
 		  gio-2.0 >= $GLIB_REQS			\
 		  gnome-media-profiles >= $GNOME_MEDIA_PROFILES_REQS \
-		  libsoup-2.4				\
+		  libsoup-2.4 >= $LIBSOUP_REQS		\
+		  libsoup-gnome-2.4 >= $LIBSOUP_REQS	\
 		  $LIBGNOME_REQS)
 
 PKG_CHECK_MODULES(TOTEM_PLPARSER, totem-plparser >= $TOTEM_PLPARSER_REQS, have_totem_plparser=yes, have_totem_plparser=no)
diff --git a/lib/Makefile.am b/lib/Makefile.am
index be203ac..45bdeb1 100644
--- a/lib/Makefile.am
+++ b/lib/Makefile.am
@@ -32,8 +32,6 @@ librb_la_SOURCES =					\
 	rb-tree-dnd.c					\
 	rb-tree-dnd.h					\
 	rb-preferences.h				\
-	rb-proxy-config.c				\
-	rb-proxy-config.h				\
 	rb-string-value-map.c				\
 	rb-string-value-map.h				\
 	rb-async-queue-watch.c				\
@@ -47,11 +45,10 @@ INCLUDES =						\
 	-DEGG_SM_CLIENT_BACKEND_XSMP			\
 	-I$(top_srcdir) 				\
 	-I$(top_srcdir)/widgets				\
-	$(SOUP_CFLAGS)					\
 	$(HAL_CFLAGS)					\
 	$(RHYTHMBOX_CFLAGS)
 
-librb_la_LIBADD = $(SOUP_LIBS) $(HAL_LIBS) -lSM -lICE
+librb_la_LIBADD = $(HAL_LIBS) -lSM -lICE
 
 BUILT_SOURCES=
 
diff --git a/lib/rb-preferences.h b/lib/rb-preferences.h
index 6a7dfcb..1d8c5fa 100644
--- a/lib/rb-preferences.h
+++ b/lib/rb-preferences.h
@@ -54,7 +54,6 @@ G_BEGIN_DECLS
 #define CONF_STATE_PLAY_ORDER	CONF_PREFIX "/state/play_order"
 #define CONF_STATE_VOLUME	CONF_PREFIX "/state/volume"
 #define CONF_STATE_BURN_DEVICE	CONF_PREFIX "/state/burn_device"
-#define CONF_UI_AUTO_PROXY_COMPLAINT	CONF_PREFIX "/ui/auto_proxy_complaint"
 
 #define CONF_AUDIOSCROBBLER_USERNAME CONF_PREFIX "/audioscrobbler/username"
 #define CONF_AUDIOSCROBBLER_PASSWORD CONF_PREFIX "/audioscrobbler/password"
diff --git a/plugins/audioscrobbler/rb-audioscrobbler-plugin.c b/plugins/audioscrobbler/rb-audioscrobbler-plugin.c
index ef6b46c..7f87add 100644
--- a/plugins/audioscrobbler/rb-audioscrobbler-plugin.c
+++ b/plugins/audioscrobbler/rb-audioscrobbler-plugin.c
@@ -122,19 +122,17 @@ impl_activate (RBPlugin *bplugin,
 	       RBShell *shell)
 {
 	RBAudioscrobblerPlugin *plugin = RB_AUDIOSCROBBLER_PLUGIN (bplugin);
-	RBProxyConfig *proxy_config;
 	GtkUIManager *uimanager = NULL;
 	gboolean no_registration;
 	char *file;
 
-    /* Source icon data */
-    gchar *icon_filename;
-    gint icon_size;
-    GdkPixbuf *icon_pixbuf;
+	/* Source icon data */
+	gchar *icon_filename;
+	gint icon_size;
+	GdkPixbuf *icon_pixbuf;
 
 	g_assert (plugin->audioscrobbler == NULL);
 	g_object_get (G_OBJECT (shell),
-		      "proxy-config", &proxy_config,
 		      "no-registration", &no_registration,
 		      "ui-manager", &uimanager,
 		      NULL);
@@ -145,10 +143,8 @@ impl_activate (RBPlugin *bplugin,
 	 * last.fm only allows one active client per user.
 	 */
 	if (!no_registration) {
-		plugin->audioscrobbler = rb_audioscrobbler_new (RB_SHELL_PLAYER (rb_shell_get_player (shell)),
-								proxy_config);
+		plugin->audioscrobbler = rb_audioscrobbler_new (RB_SHELL_PLAYER (rb_shell_get_player (shell)));
 	}
-	g_object_unref (G_OBJECT (proxy_config));
 
 	file = rb_plugin_find_file (bplugin, "audioscrobbler-ui.xml");
 	plugin->ui_merge_id = gtk_ui_manager_add_ui_from_file (uimanager,
@@ -158,14 +154,13 @@ impl_activate (RBPlugin *bplugin,
 
 	plugin->lastfm_source = rb_lastfm_source_new (bplugin, shell);
     
-    icon_filename = rb_plugin_find_file (bplugin, "as-icon.png");
-    gtk_icon_size_lookup (GTK_ICON_SIZE_LARGE_TOOLBAR, &icon_size, NULL);
-    icon_pixbuf = gdk_pixbuf_new_from_file_at_size (icon_filename,
-                                                    icon_size, icon_size,
-                                                    NULL);
-    g_free (icon_filename);
-    rb_source_set_pixbuf (plugin->lastfm_source, icon_pixbuf);
-    g_object_unref (icon_pixbuf);
+	icon_filename = rb_plugin_find_file (bplugin, "as-icon.png");
+	gtk_icon_size_lookup (GTK_ICON_SIZE_LARGE_TOOLBAR, &icon_size, NULL);
+	icon_pixbuf = gdk_pixbuf_new_from_file_at_size (icon_filename, icon_size, icon_size, NULL);
+
+	g_free (icon_filename);
+	rb_source_set_pixbuf (plugin->lastfm_source, icon_pixbuf);
+	g_object_unref (icon_pixbuf);
     
 	rb_shell_append_source (shell, plugin->lastfm_source, NULL);
 
diff --git a/plugins/audioscrobbler/rb-audioscrobbler.c b/plugins/audioscrobbler/rb-audioscrobbler.c
index 268f840..fadc7b7 100644
--- a/plugins/audioscrobbler/rb-audioscrobbler.c
+++ b/plugins/audioscrobbler/rb-audioscrobbler.c
@@ -46,6 +46,7 @@
 #include <gconf/gconf-value.h>
 
 #include <libsoup/soup.h>
+#include <libsoup/soup-gnome.h>
 
 #include "eel-gconf-extensions.h"
 #include "rb-audioscrobbler.h"
@@ -56,7 +57,6 @@
 #include "rb-shell.h"
 #include "rb-shell-player.h"
 #include "rb-source.h"
-#include "rb-proxy-config.h"
 #include "rb-cut-and-paste-code.h"
 #include "rb-plugin.h"
 #include "rb-util.h"
@@ -142,7 +142,6 @@ struct _RBAudioscrobblerPrivate
 
 	/* HTTP requests session */
 	SoupSession *soup_session;
-	RBProxyConfig *proxy_config;
 
 	/* callback for songs that were played offline (eg on an iPod) */
 	gulong offline_play_notify_id;
@@ -195,8 +194,6 @@ static void	     rb_audioscrobbler_gconf_changed_cb (GConfClient *client,
 static void	     rb_audioscrobbler_song_changed_cb (RBShellPlayer *player,
 							RhythmDBEntry *entry,
 							RBAudioscrobbler *audioscrobbler);
-static void	     rb_audioscrobbler_proxy_config_changed_cb (RBProxyConfig *config,
-								RBAudioscrobbler *audioscrobbler);
 static void          rb_audioscrobbler_offline_play_notify_cb (RhythmDB *db,
 							       RhythmDBEntry *rb_entry,
 							       const gchar *property_name,
@@ -212,7 +209,6 @@ enum
 {
 	PROP_0,
 	PROP_SHELL_PLAYER,
-	PROP_PROXY_CONFIG
 };
 
 G_DEFINE_TYPE (RBAudioscrobbler, rb_audioscrobbler, G_TYPE_OBJECT)
@@ -272,13 +268,6 @@ rb_audioscrobbler_class_init (RBAudioscrobblerClass *klass)
 							      "RBShellPlayer object",
 							      RB_TYPE_SHELL_PLAYER,
 							      G_PARAM_READWRITE | G_PARAM_CONSTRUCT_ONLY));
-	g_object_class_install_property (object_class,
-					 PROP_PROXY_CONFIG,
-					 g_param_spec_object ("proxy-config",
-							      "RBProxyConfig",
-							      "RBProxyConfig object",
-							      RB_TYPE_PROXY_CONFIG,
-							      G_PARAM_WRITABLE | G_PARAM_CONSTRUCT_ONLY));
 
 	g_type_class_add_private (klass, sizeof (RBAudioscrobblerPrivate));
 }
@@ -361,11 +350,6 @@ rb_audioscrobbler_dispose (GObject *object)
 		audioscrobbler->priv->soup_session = NULL;
 	}
 
-	if (audioscrobbler->priv->proxy_config != NULL) {
-		g_object_unref (audioscrobbler->priv->proxy_config);
-		audioscrobbler->priv->proxy_config = NULL;
-	}
-
 	if (audioscrobbler->priv->shell_player != NULL) {
 		g_object_unref (audioscrobbler->priv->shell_player);
 		audioscrobbler->priv->shell_player = NULL;
@@ -407,12 +391,10 @@ rb_audioscrobbler_finalize (GObject *object)
 }
 
 RBAudioscrobbler*
-rb_audioscrobbler_new (RBShellPlayer *shell_player,
-		       RBProxyConfig *proxy_config)
+rb_audioscrobbler_new (RBShellPlayer *shell_player)
 {
 	return g_object_new (RB_TYPE_AUDIOSCROBBLER,
 			     "shell-player", shell_player,
-			     "proxy-config", proxy_config,
 			     NULL);
 }
 
@@ -433,14 +415,6 @@ rb_audioscrobbler_set_property (GObject *object,
 					 G_CALLBACK (rb_audioscrobbler_song_changed_cb),
 					 audioscrobbler, 0);
 		break;
-	case PROP_PROXY_CONFIG:
-		audioscrobbler->priv->proxy_config = g_value_get_object (value);
-		g_object_ref (G_OBJECT (audioscrobbler->priv->proxy_config));
-		g_signal_connect_object (G_OBJECT (audioscrobbler->priv->proxy_config),
-					 "config-changed",
-					 G_CALLBACK (rb_audioscrobbler_proxy_config_changed_cb),
-					 audioscrobbler, 0);
-		break;
 	default:
 		G_OBJECT_WARN_INVALID_PROPERTY_ID (object, prop_id, pspec);
 		break;
@@ -747,14 +721,10 @@ rb_audioscrobbler_perform (RBAudioscrobbler *audioscrobbler,
 
 	/* create soup session, if we haven't got one yet */
 	if (!audioscrobbler->priv->soup_session) {
-		SoupURI *uri;
-
-		uri = rb_proxy_config_get_libsoup_uri (audioscrobbler->priv->proxy_config);
-		audioscrobbler->priv->soup_session = soup_session_async_new_with_options (
-					"proxy-uri", uri,
+		audioscrobbler->priv->soup_session =
+			soup_session_async_new_with_options (
+					SOUP_SESSION_ADD_FEATURE_BY_TYPE, SOUP_TYPE_GNOME_FEATURES_2_26,
 					NULL);
-		if (uri)
-			soup_uri_free (uri);
 	}
 
 	soup_session_queue_message (audioscrobbler->priv->soup_session,
@@ -1114,23 +1084,6 @@ rb_audioscrobbler_get_config_widget (RBAudioscrobbler *audioscrobbler,
 
 
 /* Callback functions: */
-
-static void
-rb_audioscrobbler_proxy_config_changed_cb (RBProxyConfig *config,
-					   RBAudioscrobbler *audioscrobbler)
-{
-	SoupURI *uri;
-
-	if (audioscrobbler->priv->soup_session) {
-		uri = rb_proxy_config_get_libsoup_uri (config);
-		g_object_set (G_OBJECT (audioscrobbler->priv->soup_session),
-					"proxy-uri", uri,
-					NULL);
-		if (uri)
-			soup_uri_free (uri);
-	}
-}
-
 static void
 rb_audioscrobbler_gconf_changed_cb (GConfClient *client,
 				    guint cnxn_id,
diff --git a/plugins/audioscrobbler/rb-audioscrobbler.h b/plugins/audioscrobbler/rb-audioscrobbler.h
index ceb9423..382ee04 100644
--- a/plugins/audioscrobbler/rb-audioscrobbler.h
+++ b/plugins/audioscrobbler/rb-audioscrobbler.h
@@ -36,7 +36,6 @@ G_BEGIN_DECLS
 #include <glib.h>
 
 #include "rb-shell-player.h"
-#include "rb-proxy-config.h"
 #include "rb-plugin.h"
 
 #define RB_TYPE_AUDIOSCROBBLER			(rb_audioscrobbler_get_type ())
@@ -64,8 +63,7 @@ typedef struct
 
 GType			rb_audioscrobbler_get_type (void);
 
-RBAudioscrobbler *	rb_audioscrobbler_new (RBShellPlayer *shell_player,
-					       RBProxyConfig *proxy_config);
+RBAudioscrobbler *	rb_audioscrobbler_new (RBShellPlayer *shell_player);
 
 GtkWidget *		rb_audioscrobbler_get_config_widget (RBAudioscrobbler *audioscrobbler,
 							     RBPlugin *plugin);
diff --git a/plugins/audioscrobbler/rb-lastfm-source.c b/plugins/audioscrobbler/rb-lastfm-source.c
index 4ad04eb..c71d3af 100644
--- a/plugins/audioscrobbler/rb-lastfm-source.c
+++ b/plugins/audioscrobbler/rb-lastfm-source.c
@@ -55,10 +55,10 @@
 #include <totem-pl-parser.h>
 
 #include <libsoup/soup.h>
+#include <libsoup/soup-gnome.h>
 
 #include "eel-gconf-extensions.h"
 
-#include "rb-proxy-config.h"
 #include "rb-preferences.h"
 
 #include "rb-audioscrobbler.h"
@@ -256,7 +256,6 @@ struct RBLastfmSourcePrivate
 	const char *station_failed_reason;
 
 	SoupSession *soup_session;
-	RBProxyConfig *proxy_config;
 
 	guint emit_coverart_id;
 };
@@ -277,7 +276,6 @@ enum
 	PROP_0,
 	PROP_ENTRY_TYPE,
 	PROP_STATION_ENTRY_TYPE,
-	PROP_PROXY_CONFIG,
 	PROP_PLAY_ORDER
 };
 
@@ -344,14 +342,6 @@ rb_lastfm_source_class_init (RBLastfmSourceClass *klass)
 							     "Entry type for last.fm stations",
 							     RHYTHMDB_TYPE_ENTRY_TYPE,
 							     G_PARAM_READWRITE | G_PARAM_CONSTRUCT_ONLY));
-	g_object_class_install_property (object_class,
-					 PROP_PROXY_CONFIG,
-					 g_param_spec_object ("proxy-config",
-							      "RBProxyConfig",
-							      "RBProxyConfig object",
-							      RB_TYPE_PROXY_CONFIG,
-							      G_PARAM_WRITABLE | G_PARAM_CONSTRUCT_ONLY));
-
 	g_object_class_override_property (object_class,
 					  PROP_PLAY_ORDER,
 					  "play-order");
@@ -412,11 +402,6 @@ rb_lastfm_source_dispose (GObject *object)
 		source->priv->db = NULL;
 	}
 
-	if (source->priv->proxy_config != NULL) {
-		g_object_unref (source->priv->proxy_config);
-		source->priv->proxy_config = NULL;
-	}
-
 	if (source->priv->soup_session != NULL) {
 		soup_session_abort (source->priv->soup_session);
 		g_object_unref (source->priv->soup_session);
@@ -645,10 +630,6 @@ rb_lastfm_source_set_property (GObject *object,
 	case PROP_STATION_ENTRY_TYPE:
 		source->priv->station_entry_type = g_value_get_boxed (value);
 		break;
-	case PROP_PROXY_CONFIG:
-		source->priv->proxy_config = g_value_get_object (value);
-		g_object_ref (G_OBJECT (source->priv->proxy_config));
-		break;
 	default:
 		G_OBJECT_WARN_INVALID_PROPERTY_ID (object, prop_id, pspec);
 		break;
@@ -698,7 +679,6 @@ rb_lastfm_source_new (RBPlugin *plugin,
 		      RBShell  *shell)
 {
 	RBSource *source;
-	RBProxyConfig *proxy_config;
 	RhythmDBEntryType station_entry_type;
 	RhythmDBEntryType track_entry_type;
 	RhythmDB *db;
@@ -726,22 +706,18 @@ rb_lastfm_source_new (RBPlugin *plugin,
 		track_entry_type->pre_entry_destroy = destroy_track_data;
 	}
 
-	g_object_get (G_OBJECT (shell), "proxy-config", &proxy_config, NULL);
-
 	source = RB_SOURCE (g_object_new (RB_TYPE_LASTFM_SOURCE,
 					  "plugin", plugin,
 					  "name", _("Last.fm"),
 					  "shell", shell,
 					  "station-entry-type", station_entry_type,
 					  "entry-type", track_entry_type,
-					  "proxy-config", proxy_config,
 					  "source-group", RB_SOURCE_GROUP_LIBRARY,
 					  NULL));
 
 	rb_shell_register_entry_type_for_source (shell, source, track_entry_type);
 
 	g_object_unref (db);
-	g_object_unref (proxy_config);
 	return source;
 }
 
@@ -1485,22 +1461,6 @@ http_response_cb (SoupSession *session, SoupMessage *req, gpointer user_data)
 }
 
 static void
-proxy_config_changed_cb (RBProxyConfig *config,
-			 RBLastfmSource *source)
-{
-	SoupURI *uri;
-
-	if (source->priv->soup_session) {
-		uri = rb_proxy_config_get_libsoup_uri (config);
-		g_object_set (G_OBJECT (source->priv->soup_session),
-					"proxy-uri", uri,
-					NULL);
-		if (uri)
-			soup_uri_free (uri);
-	}
-}
-
-static void
 process_queue (RBLastfmSource *source)
 {
 	RBLastfmAction *action;
@@ -1535,17 +1495,10 @@ process_queue (RBLastfmSource *source)
 	}
 
 	if (source->priv->soup_session == NULL) {
-		SoupURI *uri;
-
-		uri = rb_proxy_config_get_libsoup_uri (source->priv->proxy_config);
-		source->priv->soup_session = soup_session_async_new_with_options ("proxy-uri", uri, NULL);
-		if (uri)
-			soup_uri_free (uri);
-		
-		g_signal_connect_object (G_OBJECT (source->priv->proxy_config),
-					 "config-changed",
-					 G_CALLBACK (proxy_config_changed_cb),
-					 source, 0);
+		source->priv->soup_session =
+			soup_session_async_new_with_options (
+					SOUP_SESSION_ADD_FEATURE_BY_TYPE, SOUP_TYPE_GNOME_FEATURES_2_26,
+					NULL);
 	}
 
 
diff --git a/shell/rb-shell.c b/shell/rb-shell.c
index 30ea138..a12986d 100644
--- a/shell/rb-shell.c
+++ b/shell/rb-shell.c
@@ -81,7 +81,6 @@
 #include "rb-import-errors-source.h"
 #include "rb-plugins-engine.h"
 #include "rb-plugin-manager.h"
-#include "rb-proxy-config.h"
 #include "rb-util.h"
 #include "rb-sourcelist-model.h"
 #include "rb-song-info.h"
@@ -346,8 +345,6 @@ struct RBShellPrivate
 	RBSource *missing_files_source;
 	RBSource *import_errors_source;
 
-	RBProxyConfig *proxy_config;
-
 	RBSource *selected_source;
 
 	GtkWidget *prefs;
@@ -582,13 +579,6 @@ rb_shell_class_init (RBShellClass *klass)
 							      RB_TYPE_PLAY_QUEUE_SOURCE,
 							      G_PARAM_READABLE));
 	g_object_class_install_property (object_class,
-					 PROP_PROXY_CONFIG,
-					 g_param_spec_object ("proxy-config",
-						 	      "proxy-config",
-							      "HTTP proxy configuration",
-							      RB_TYPE_PROXY_CONFIG,
-							      G_PARAM_READABLE));
-	g_object_class_install_property (object_class,
 					 PROP_LIBRARY_SOURCE,
 					 g_param_spec_object ("library-source",
 							      "library-source",
@@ -796,9 +786,6 @@ rb_shell_get_property (GObject *object,
 	case PROP_QUEUE_SOURCE:
 		g_value_set_object (value, shell->priv->queue_source);
 		break;
-	case PROP_PROXY_CONFIG:
-		g_value_set_object (value, shell->priv->proxy_config);
-		break;
  	case PROP_LIBRARY_SOURCE:
  		g_value_set_object (value, shell->priv->library_source);
  		break;
@@ -924,8 +911,6 @@ rb_shell_finalize (GObject *object)
 	rb_debug ("unreffing removable media manager");
 	g_object_unref (G_OBJECT (shell->priv->removable_media_manager));
 
-	g_object_unref (G_OBJECT (shell->priv->proxy_config));
-
 	rb_debug ("unreffing clipboard shell");
 	g_object_unref (G_OBJECT (shell->priv->clipboard_shell));
 
@@ -1193,8 +1178,6 @@ construct_widgets (RBShell *shell)
 
 	gtk_container_add (GTK_CONTAINER (win), shell->priv->main_vbox);
 
-	shell->priv->proxy_config = rb_proxy_config_new ();
-
 	rb_profile_end ("constructing widgets");
 }
 



[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]