[gnome-software] Port to SoupSession
- From: Kalev Lember <klember src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [gnome-software] Port to SoupSession
- Date: Fri, 29 May 2015 11:43:22 +0000 (UTC)
commit 34c7b0ad74761f62b549e78d75178dc062d6ba7c
Author: Kalev Lember <kalevlember gmail com>
Date: Fri May 29 13:09:27 2015 +0200
Port to SoupSession
Since libsoup 2.42, SoupSession is no longer an abstract class and is
preferred over SoupSessionSync that we've been using. Switching over
brings us nicer timeout and idle-timeout defaults and an out-of-box
proxy setup we no longer have to manually set up.
https://bugzilla.gnome.org/show_bug.cgi?id=749971
configure.ac | 2 +-
src/gs-shell-details.c | 11 +++--------
src/plugins/gs-plugin-fedora-tagger-ratings.c | 9 +++------
src/plugins/gs-plugin-fedora-tagger-usage.c | 9 +++------
src/plugins/gs-plugin-fwupd.c | 9 +++------
src/plugins/gs-plugin-icons.c | 9 +++------
6 files changed, 16 insertions(+), 33 deletions(-)
---
diff --git a/configure.ac b/configure.ac
index ac3d7a2..ce7e943 100644
--- a/configure.ac
+++ b/configure.ac
@@ -63,7 +63,7 @@ PKG_CHECK_MODULES(GTK, gtk+-3.0 >= 3.14.1 gio-unix-2.0)
PKG_CHECK_MODULES(PACKAGEKIT, packagekit-glib2 >= 1.0.0)
PKG_CHECK_MODULES(APPSTREAM, appstream-glib >= 0.3.4)
PKG_CHECK_MODULES(SQLITE, sqlite3)
-PKG_CHECK_MODULES(SOUP, libsoup-2.4)
+PKG_CHECK_MODULES(SOUP, libsoup-2.4 >= 2.42)
PKG_CHECK_MODULES(GSETTINGS_DESKTOP_SCHEMAS, gsettings-desktop-schemas >= 3.11.5)
PKG_CHECK_MODULES(GNOME_DESKTOP, gnome-desktop-3.0)
AC_PATH_PROG(APPSTREAM_UTIL, [appstream-util], [unfound])
diff --git a/src/gs-shell-details.c b/src/gs-shell-details.c
index c24748c..d5d2fbc 100644
--- a/src/gs-shell-details.c
+++ b/src/gs-shell-details.c
@@ -1314,14 +1314,9 @@ gs_shell_details_init (GsShellDetails *shell_details)
priv = shell_details->priv;
/* setup networking */
- priv->session = soup_session_sync_new_with_options (SOUP_SESSION_USER_AGENT,
- "gnome-software",
- SOUP_SESSION_TIMEOUT, 5000,
- NULL);
- if (priv->session != NULL) {
- soup_session_add_feature_by_type (priv->session,
- SOUP_TYPE_PROXY_RESOLVER_DEFAULT);
- }
+ priv->session = soup_session_new_with_options (SOUP_SESSION_USER_AGENT,
+ "gnome-software",
+ NULL);
gtk_list_box_set_header_func (GTK_LIST_BOX (priv->list_box_addons),
list_header_func,
diff --git a/src/plugins/gs-plugin-fedora-tagger-ratings.c b/src/plugins/gs-plugin-fedora-tagger-ratings.c
index 95aa00a..6e8cbfa 100644
--- a/src/plugins/gs-plugin-fedora-tagger-ratings.c
+++ b/src/plugins/gs-plugin-fedora-tagger-ratings.c
@@ -160,10 +160,9 @@ gs_plugin_setup_networking (GsPlugin *plugin, GError **error)
return TRUE;
/* set up a session */
- plugin->priv->session = soup_session_sync_new_with_options (SOUP_SESSION_USER_AGENT,
- "gnome-software",
- SOUP_SESSION_TIMEOUT, 5000,
- NULL);
+ plugin->priv->session = soup_session_new_with_options (SOUP_SESSION_USER_AGENT,
+ "gnome-software",
+ NULL);
if (plugin->priv->session == NULL) {
g_set_error (error,
GS_PLUGIN_ERROR,
@@ -172,8 +171,6 @@ gs_plugin_setup_networking (GsPlugin *plugin, GError **error)
plugin->name);
return FALSE;
}
- soup_session_add_feature_by_type (plugin->priv->session,
- SOUP_TYPE_PROXY_RESOLVER_DEFAULT);
return TRUE;
}
diff --git a/src/plugins/gs-plugin-fedora-tagger-usage.c b/src/plugins/gs-plugin-fedora-tagger-usage.c
index c042dc5..220a83b 100644
--- a/src/plugins/gs-plugin-fedora-tagger-usage.c
+++ b/src/plugins/gs-plugin-fedora-tagger-usage.c
@@ -105,10 +105,9 @@ gs_plugin_setup_networking (GsPlugin *plugin, GError **error)
return TRUE;
/* set up a session */
- plugin->priv->session = soup_session_sync_new_with_options (SOUP_SESSION_USER_AGENT,
- "gnome-software",
- SOUP_SESSION_TIMEOUT, 5000,
- NULL);
+ plugin->priv->session = soup_session_new_with_options (SOUP_SESSION_USER_AGENT,
+ "gnome-software",
+ NULL);
if (plugin->priv->session == NULL) {
g_set_error (error,
GS_PLUGIN_ERROR,
@@ -117,8 +116,6 @@ gs_plugin_setup_networking (GsPlugin *plugin, GError **error)
plugin->name);
return FALSE;
}
- soup_session_add_feature_by_type (plugin->priv->session,
- SOUP_TYPE_PROXY_RESOLVER_DEFAULT);
return TRUE;
}
diff --git a/src/plugins/gs-plugin-fwupd.c b/src/plugins/gs-plugin-fwupd.c
index 7134a08..bf46bac 100644
--- a/src/plugins/gs-plugin-fwupd.c
+++ b/src/plugins/gs-plugin-fwupd.c
@@ -54,10 +54,9 @@ gs_plugin_fwupd_setup_networking (GsPlugin *plugin, GError **error)
return TRUE;
/* set up a session */
- plugin->priv->session = soup_session_sync_new_with_options (SOUP_SESSION_USER_AGENT,
- "gnome-software",
- SOUP_SESSION_TIMEOUT, 5000,
- NULL);
+ plugin->priv->session = soup_session_new_with_options (SOUP_SESSION_USER_AGENT,
+ "gnome-software",
+ NULL);
if (plugin->priv->session == NULL) {
g_set_error (error,
GS_PLUGIN_ERROR,
@@ -66,8 +65,6 @@ gs_plugin_fwupd_setup_networking (GsPlugin *plugin, GError **error)
plugin->name);
return FALSE;
}
- soup_session_add_feature_by_type (plugin->priv->session,
- SOUP_TYPE_PROXY_RESOLVER_DEFAULT);
return TRUE;
}
diff --git a/src/plugins/gs-plugin-icons.c b/src/plugins/gs-plugin-icons.c
index ce85c76..62fc530 100644
--- a/src/plugins/gs-plugin-icons.c
+++ b/src/plugins/gs-plugin-icons.c
@@ -88,10 +88,9 @@ gs_plugin_setup_networking (GsPlugin *plugin, GError **error)
return TRUE;
/* set up a session */
- plugin->priv->session = soup_session_sync_new_with_options (SOUP_SESSION_USER_AGENT,
- "gnome-software",
- SOUP_SESSION_TIMEOUT, 5000,
- NULL);
+ plugin->priv->session = soup_session_new_with_options (SOUP_SESSION_USER_AGENT,
+ "gnome-software",
+ NULL);
if (plugin->priv->session == NULL) {
g_set_error (error,
GS_PLUGIN_ERROR,
@@ -100,8 +99,6 @@ gs_plugin_setup_networking (GsPlugin *plugin, GError **error)
plugin->name);
return FALSE;
}
- soup_session_add_feature_by_type (plugin->priv->session,
- SOUP_TYPE_PROXY_RESOLVER_DEFAULT);
return TRUE;
}
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]