Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Port to libsoup3 #5

Open
wants to merge 1 commit into
base: master
Choose a base branch
from
Open
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 2 additions & 2 deletions configure.ac
Original file line number Diff line number Diff line change
@@ -40,10 +40,10 @@ PKG_PROG_PKG_CONFIG
###########################

GTK3_REQUIRED_VERSION=3.1.4
SOUP_REQUIRED_VERSION=2.42.0
SOUP_REQUIRED_VERSION=3.0.7

PKG_CHECK_MODULES(LIBTIMEZONEMAP, gtk+-3.0 >= $GTK3_REQUIRED_VERSION
libsoup-2.4 >= $SOUP_REQUIRED_VERSION
libsoup-3.0 >= $SOUP_REQUIRED_VERSION
json-glib-1.0
librsvg-2.0)
LIBTIMEZONEMAP_LIBS="$LIBTIMEZONEMAP_LIBS $LIBM"
21 changes: 12 additions & 9 deletions src/timezone-completion.c
Original file line number Diff line number Diff line change
@@ -270,9 +270,10 @@ geonames_data_ready (GObject *object, GAsyncResult *res, gpointer user_data)
CcTimezoneCompletionPrivate * priv = completion->priv;
GError * error = NULL;
GInputStream * stream;
SoupMessage *message;
const gchar * reason_phrase;
SoupStatus status_code;

stream = soup_request_send_finish (SOUP_REQUEST (object), res, &error);
stream = soup_session_send_finish (priv->soup_session, res, &error);
if (stream == NULL)
{
if (!g_error_matches (error, G_IO_ERROR, G_IO_ERROR_CANCELLED))
@@ -283,8 +284,9 @@ geonames_data_ready (GObject *object, GAsyncResult *res, gpointer user_data)
return;
}

message = soup_request_http_get_message (SOUP_REQUEST_HTTP (object));
if (message->status_code == SOUP_STATUS_OK)
reason_phrase = soup_message_get_reason_phrase (SOUP_MESSAGE (object));
status_code = soup_message_get_status (SOUP_MESSAGE (object));
if (status_code == SOUP_STATUS_OK)
{
JsonParser *parser;

@@ -296,10 +298,10 @@ geonames_data_ready (GObject *object, GAsyncResult *res, gpointer user_data)
else
{
g_warning ("Unable to fetch geonames (server responded with: %u %s)",
message->status_code, message->reason_phrase);
status_code, reason_phrase);
}

g_object_unref (message);
g_object_unref (object);
g_object_unref (stream);
}

@@ -362,7 +364,7 @@ static gboolean
request_zones (CcTimezoneCompletion * completion)
{
CcTimezoneCompletionPrivate * priv = completion->priv;
SoupRequest *req;
SoupMessage *req;
GError *error = NULL;

priv->queued_request = 0;
@@ -391,10 +393,11 @@ request_zones (CcTimezoneCompletion * completion)
g_free (locale);
g_free (escaped);

req = soup_session_request (priv->soup_session, url, &error);
req = soup_message_new (NULL, url);
if (req)
{
soup_request_send_async (req, priv->cancel, geonames_data_ready, completion);
soup_session_send_async (priv->soup_session, req, G_PRIORITY_DEFAULT,
priv->cancel, geonames_data_ready, completion);
g_object_unref (req);
}
else