[gupnp-tools/wip/gupnp-1.6: 2/2] all: Switch to GUPnP 1.6 and libsoup 3




commit 899f1b1f0bef6878517185a1cca889ac30f448e0
Author: Jens Georg <mail jensge org>
Date:   Fri May 20 00:09:43 2022 +0200

    all: Switch to GUPnP 1.6 and libsoup 3

 meson.build                                    |   8 +-
 src/av-cp/playlist-treeview.c                  |   1 -
 src/av-cp/renderer-combo.c                     |  34 ++++-
 src/av-cp/server-device.c                      |  26 +++-
 src/common/icons.c                             | 199 +++++++++++--------------
 src/common/icons.h                             |  13 +-
 src/network-light/upnp.c                       |  20 +--
 src/universal-cp/details-treeview.c            |   8 +-
 src/universal-cp/device-treeview.c             |  69 ++++++---
 subprojects/{gssdp-1.2.wrap => gssdp-1.6.wrap} |   0
 subprojects/{gupnp-1.2.wrap => gupnp-1.6.wrap} |   0
 11 files changed, 206 insertions(+), 172 deletions(-)
---
diff --git a/meson.build b/meson.build
index db84969..0baacb7 100644
--- a/meson.build
+++ b/meson.build
@@ -1,4 +1,4 @@
-project('gupnp-tools', ['c'], version: '0.10.2')
+project('gupnp-tools', ['c'], version: '0.11.0')
 
 gnome = import('gnome')
 i18n = import('i18n')
@@ -7,9 +7,9 @@ if host_machine.system() == 'windows'
     win = import('windows')
 endif
 
-gssdp = dependency('gssdp-1.2', version: '>= 1.2.0', default_options: ['sniffer=false'])
-gupnp = dependency('gupnp-1.2', version: '>= 1.4.0')
-soup = dependency('libsoup-2.4', version: '>= 2.42')
+gssdp = dependency('gssdp-1.6', version: '>= 1.5.0', default_options: ['sniffer=false'])
+gupnp = dependency('gupnp-1.6', version: '>= 1.5.1')
+soup = dependency('libsoup-3.0', version: '>= 3.0')
 gupnp_av = dependency('gupnp-av-1.0', version: '>= 0.5.5', required: get_option('av-tools'))
 gtk = dependency('gtk+-3.0', version: '>= 3.10')
 glib = dependency('glib-2.0', version: '>= 2.24')
diff --git a/src/av-cp/playlist-treeview.c b/src/av-cp/playlist-treeview.c
index 9c3f525..bda5d09 100644
--- a/src/av-cp/playlist-treeview.c
+++ b/src/av-cp/playlist-treeview.c
@@ -1024,7 +1024,6 @@ remove_media_server (GUPnPDeviceProxy *proxy)
                       compare_media_server,
                       (gpointer) udn,
                       FALSE)) {
-                unschedule_icon_update (info);
                 gtk_tree_store_remove (GTK_TREE_STORE (model), &iter);
         }
 }
diff --git a/src/av-cp/renderer-combo.c b/src/av-cp/renderer-combo.c
index 962e5b0..95d3c2b 100644
--- a/src/av-cp/renderer-combo.c
+++ b/src/av-cp/renderer-combo.c
@@ -340,12 +340,20 @@ set_duration (const gchar *udn,
 }
 
 static void
-on_device_icon_available (GUPnPDeviceInfo *info,
-                          GdkPixbuf       *icon)
+on_device_icon_available (GObject *source,
+                          GAsyncResult *res,
+                          gpointer user_data)
 {
         GtkTreeModel *model;
         GtkTreeIter   iter;
         const char   *udn;
+        g_autoptr (GdkPixbuf) icon;
+        g_autoptr (GError) error = NULL;
+
+        icon = update_icon_finish (GUPNP_DEVICE_INFO (source), res, &error);
+        if (error != NULL) {
+                g_debug ("Failed to download icon: %s", error->message);
+        }
 
         if (icon == NULL)
                 return;
@@ -353,7 +361,7 @@ on_device_icon_available (GUPnPDeviceInfo *info,
         model = gtk_combo_box_get_model (GTK_COMBO_BOX (renderer_combo));
         g_assert (model != NULL);
 
-        udn = gupnp_device_info_get_udn (info);
+        udn = gupnp_device_info_get_udn (GUPNP_DEVICE_INFO (source));
 
         if (find_renderer (model, udn, &iter)) {
                 gtk_list_store_set (GTK_LIST_STORE (model),
@@ -362,7 +370,7 @@ on_device_icon_available (GUPnPDeviceInfo *info,
                                     -1);
         }
 
-        g_object_unref (icon);
+        g_object_set_data (source, "icon-download-cancellable", NULL);
 }
 
 static void
@@ -516,7 +524,12 @@ append_media_renderer_to_tree (GUPnPDeviceProxy  *proxy,
         gupnp_service_proxy_set_subscribed (av_transport, TRUE);
         gupnp_service_proxy_set_subscribed (rendering_control, TRUE);
 
-        schedule_icon_update (info, on_device_icon_available);
+        GCancellable *cancellable = g_cancellable_new ();
+        g_object_set_data_full (G_OBJECT (info),
+                                "icon-download-cancellable",
+                                cancellable,
+                                g_object_unref);
+        update_icon_async (info, cancellable, on_device_icon_available, NULL);
 
         if (was_empty)
                 gtk_combo_box_set_active_iter (combo, &iter);
@@ -846,7 +859,16 @@ remove_media_renderer (GUPnPDeviceProxy *proxy)
         model = gtk_combo_box_get_model (combo);
 
         if (find_renderer (model, udn, &iter)) {
-                unschedule_icon_update (info);
+                GCancellable *cancellable =
+                        g_object_get_data (G_OBJECT (info),
+                                           "icon-download-cancellable");
+                if (cancellable != NULL) {
+                        g_cancellable_cancel (cancellable);
+
+                        g_object_set_data (G_OBJECT (info),
+                                           "icon-download-cancellable",
+                                           NULL);
+                }
                 gtk_list_store_remove (GTK_LIST_STORE (model), &iter);
                 gtk_combo_box_set_active (combo, 0);
         }
diff --git a/src/av-cp/server-device.c b/src/av-cp/server-device.c
index dd312ef..e767447 100644
--- a/src/av-cp/server-device.c
+++ b/src/av-cp/server-device.c
@@ -150,8 +150,9 @@ av_cp_media_server_get_property (GObject    *obj,
 }
 
 static void
-av_cp_media_server_on_icon_updated (GUPnPDeviceInfo *info,
-                                    GdkPixbuf       *icon);
+av_cp_media_server_on_icon_updated (GObject *source,
+                                    GAsyncResult *res,
+                                    gpointer user_data);
 
 static void
 av_cp_media_server_on_get_sort_caps (GObject      *object,
@@ -308,13 +309,20 @@ av_cp_media_server_init (AVCPMediaServer *self)
 }
 
 static void
-av_cp_media_server_on_icon_updated (GUPnPDeviceInfo *info,
-                                    GdkPixbuf       *icon)
+av_cp_media_server_on_icon_updated (GObject *source,
+                                    GAsyncResult *res,
+                                    gpointer user_data)
 {
-        AVCPMediaServer *self = AV_CP_MEDIA_SERVER (info);
+        AVCPMediaServer *self = AV_CP_MEDIA_SERVER (source);
         AVCPMediaServerPrivate *priv = av_cp_media_server_get_instance_private (self);
+        g_autoptr (GError) error = NULL;
+
+        priv->icon =
+                update_icon_finish (GUPNP_DEVICE_INFO (source), res, &error);
+        if (error != NULL) {
+                g_debug ("Failed to download device icon: %s", error->message);
+        }
 
-        priv->icon = icon;
         av_cp_media_server_get_content_directory (self);
 
         if (priv->content_directory != NULL) {
@@ -401,8 +409,10 @@ av_cp_media_server_init_finish (GAsyncInitable *initable,
 static void
 av_cp_media_server_introspect (AVCPMediaServer *self)
 {
-        schedule_icon_update (GUPNP_DEVICE_INFO (self),
-                              av_cp_media_server_on_icon_updated);
+        update_icon_async (GUPNP_DEVICE_INFO (self),
+                           NULL,
+                           av_cp_media_server_on_icon_updated,
+                           NULL);
 }
 
 static void
diff --git a/src/common/icons.c b/src/common/icons.c
index 3419f8d..e8fa308 100644
--- a/src/common/icons.c
+++ b/src/common/icons.c
@@ -39,11 +39,6 @@ static SoupSession *download_session;
 static GList       *pending_gets;
 
 typedef struct {
-        GUPnPDeviceInfo *info;
-
-        DeviceIconAvailableCallback callback;
-
-        SoupMessage     *message;
         gchar           *mime_type;
         gint             width;
         gint             height;
@@ -52,28 +47,23 @@ typedef struct {
 static void
 get_icon_url_data_free (GetIconURLData *data)
 {
-        g_object_unref (data->info);
-
         g_free (data->mime_type);
         g_slice_free (GetIconURLData, data);
 }
 
+G_DEFINE_AUTOPTR_CLEANUP_FUNC (GetIconURLData, get_icon_url_data_free)
+
 static GdkPixbuf *
-get_icon_from_message (SoupMessage    *msg,
-                       GetIconURLData *data,
-                       GError        **error)
+get_icon_from_bytes (GBytes *icon_data, GetIconURLData *data, GError **error)
 {
-        GdkPixbufLoader *loader;
+        g_autoptr (GdkPixbufLoader) loader;
         GdkPixbuf       *pixbuf;
 
         loader = gdk_pixbuf_loader_new_with_mime_type (data->mime_type, error);
         if (loader == NULL)
                 return NULL;
 
-        gdk_pixbuf_loader_write (loader,
-                                 (guchar *) msg->response_body->data,
-                                 msg->response_body->length,
-                                 error);
+        gdk_pixbuf_loader_write_bytes (loader, icon_data, error);
         pixbuf = gdk_pixbuf_loader_get_pixbuf (loader);
         if (pixbuf) {
                 gfloat aspect_ratio;
@@ -89,7 +79,6 @@ get_icon_from_message (SoupMessage    *msg,
         }
 
         gdk_pixbuf_loader_close (loader, NULL);
-        g_object_unref (loader);
 
         return pixbuf;
 }
@@ -97,123 +86,115 @@ get_icon_from_message (SoupMessage    *msg,
 /**
  * Icon downloaded.
  **/
+
 static void
-got_icon_url (SoupSession    *session,
-              SoupMessage    *msg,
-              GetIconURLData *data)
+on_got_icon (GObject *source, GAsyncResult *res, gpointer user_data)
 {
-        GdkPixbuf *pixbuf = NULL;
-
-        if (SOUP_STATUS_IS_SUCCESSFUL (msg->status_code)) {
-                GError *error = NULL;
+        GError *error = NULL;
+        g_autoptr (GTask) task = G_TASK (user_data);
+        SoupMessage *message =
+                soup_session_get_async_result_message (SOUP_SESSION (source),
+                                                       res);
+
+        g_autoptr (GBytes) body =
+                soup_session_send_and_read_finish (SOUP_SESSION (source),
+                                                   res,
+                                                   &error);
 
-                pixbuf = get_icon_from_message (msg, data, &error);
+        if (error != NULL) {
+                g_task_return_error (task, error);
 
-                if (error) {
-                        g_warning ("Failed to create icon for '%s': %s",
-                                   gupnp_device_info_get_udn (data->info),
-                                   error->message);
-                        g_error_free (error);
-                } else if (!pixbuf) {
-                        g_warning ("Failed to create icon for '%s'",
-                                   gupnp_device_info_get_udn (data->info));
-                }
+                return;
         }
 
-        data->callback (data->info, pixbuf);
-
-        pending_gets = g_list_remove (pending_gets, data);
-        get_icon_url_data_free (data);
-}
+        if (!SOUP_STATUS_IS_SUCCESSFUL (soup_message_get_status (message))) {
+                g_task_return_error (
+                        task,
+                        g_error_new (G_IO_ERROR,
+                                     G_IO_ERROR_FAILED,
+                                     "Unable to  download icon: %s",
+                                     error->message));
+                return;
+        }
 
-static gboolean
-on_icon_schedule_error (gpointer user_data)
-{
-        GetIconURLData *data = (GetIconURLData *) user_data;
+        GdkPixbuf *device_icon =
+                get_icon_from_bytes (body, g_task_get_task_data (task), &error);
+        if (error != NULL) {
+                g_task_return_error (task, error);
 
-        data->callback (data->info, NULL);
-        g_object_unref (data->info);
-        g_slice_free (GetIconURLData, data);
+                return;
+        }
 
-        return FALSE;
+        g_task_return_pointer (task, device_icon, g_object_unref);
 }
 
 void
-schedule_icon_update (GUPnPDeviceInfo            *info,
-                      DeviceIconAvailableCallback callback)
+update_icon_async (GUPnPDeviceInfo *info,
+                   GCancellable *cancellable,
+                   GAsyncReadyCallback callback,
+                   gpointer user_data)
 {
-        GetIconURLData *data;
-        char           *icon_url;
+        g_autoptr (GTask) task =
+                g_task_new (info, cancellable, callback, user_data);
+
+        g_autoptr (GetIconURLData) data;
+        g_autofree char *icon_url;
 
         data = g_slice_new0 (GetIconURLData);
-        data->info = g_object_ref (info);
-        data->callback = callback;
-
-        icon_url = gupnp_device_info_get_icon_url
-                        (info,
-                         NULL,
-                         PREFERED_DEPTH,
-                         PREFERED_WIDTH,
-                         PREFERED_HEIGHT,
-                         TRUE,
-                         &data->mime_type,
-                         NULL,
-                         &data->width,
-                         &data->height);
+
+        icon_url = gupnp_device_info_get_icon_url (info,
+                                                   NULL,
+                                                   PREFERED_DEPTH,
+                                                   PREFERED_WIDTH,
+                                                   PREFERED_HEIGHT,
+                                                   TRUE,
+                                                   &data->mime_type,
+                                                   NULL,
+                                                   &data->width,
+                                                   &data->height);
+
         if (icon_url == NULL) {
-                g_free (data->mime_type);
+                g_task_return_pointer (task, NULL, NULL);
 
-                g_idle_add (on_icon_schedule_error, data);
                 return;
         }
 
-        char *new_uri = gupnp_context_rewrite_uri (gupnp_device_info_get_context (info), icon_url);
-        g_free (icon_url);
+        g_autofree char *new_url =
+                gupnp_context_rewrite_uri (gupnp_device_info_get_context (info),
+                                           icon_url);
+        g_autoptr (SoupMessage) message =
+                soup_message_new (SOUP_METHOD_GET, new_url);
 
-        data->message = soup_message_new (SOUP_METHOD_GET, new_uri);
-
-        if (data->message == NULL) {
-                g_warning ("Invalid URL icon for device '%s': %s",
-                           gupnp_device_info_get_udn (info),
-                           new_uri);
-
-                g_free (new_uri);
-                g_free (data->mime_type);
-                g_idle_add (on_icon_schedule_error, data);
+        if (message == NULL) {
+                g_task_return_error (task,
+                                     g_error_new (G_URI_ERROR,
+                                                  G_URI_ERROR_FAILED,
+                                                  "Could not parse icon url %s",
+                                                  new_url));
 
                 return;
         }
 
-        pending_gets = g_list_prepend (pending_gets, data);
-        soup_session_queue_message (download_session,
-                                    data->message,
-                                    (SoupSessionCallback) got_icon_url,
-                                    data);
+        g_task_set_task_data (task,
+                              g_steal_pointer (&data),
+                              (GDestroyNotify) get_icon_url_data_free);
 
-        g_free (new_uri);
+        soup_session_send_and_read_async (download_session,
+                                          message,
+                                          G_PRIORITY_LOW,
+                                          cancellable,
+                                          on_got_icon,
+                                          task);
+
+        g_steal_pointer (&task);
 }
 
-void
-unschedule_icon_update (GUPnPDeviceInfo *info)
+GdkPixbuf *
+update_icon_finish (GUPnPDeviceInfo *info, GAsyncResult *res, GError **error)
 {
-        GList *gets;
-
-        for (gets = pending_gets; gets; gets = gets->next) {
-                GetIconURLData *data;
-                const char *udn1;
-                const char *udn2;
-
-                data = gets->data;
-                udn1 = gupnp_device_info_get_udn (info);
-                udn2 = gupnp_device_info_get_udn (data->info);
-
-                if (udn1 && udn2 && strcmp (udn1, udn2) == 0) {
-                        soup_session_cancel_message (download_session,
-                                                     data->message,
-                                                     SOUP_STATUS_CANCELLED);
-                        break;
-                }
-        }
+        g_return_val_if_fail (g_task_is_valid (res, info), NULL);
+
+        return g_task_propagate_pointer (G_TASK (res), error);
 }
 
 GdkPixbuf *
@@ -329,16 +310,6 @@ deinit_icons (void)
 {
         int i;
 
-        while (pending_gets) {
-                GetIconURLData *data;
-
-                data = pending_gets->data;
-
-                soup_session_cancel_message (download_session,
-                                             data->message,
-                                             SOUP_STATUS_CANCELLED);
-        }
-
         g_object_unref (download_session);
 
         for (i = 0; i < ICON_LAST; i++) {
diff --git a/src/common/icons.h b/src/common/icons.h
index 6b5fb95..7708a38 100644
--- a/src/common/icons.h
+++ b/src/common/icons.h
@@ -46,15 +46,14 @@ typedef enum
         ICON_LAST
 } IconID;
 
-typedef void (* DeviceIconAvailableCallback) (GUPnPDeviceInfo *info,
-                                              GdkPixbuf       *icon);
-
 void
-schedule_icon_update   (GUPnPDeviceInfo            *info,
-                        DeviceIconAvailableCallback callback);
+update_icon_async (GUPnPDeviceInfo *info,
+                   GCancellable *cancellable,
+                   GAsyncReadyCallback callback,
+                   gpointer user_data);
 
-void
-unschedule_icon_update (GUPnPDeviceInfo *info);
+GdkPixbuf *
+update_icon_finish (GUPnPDeviceInfo *info, GAsyncResult *res, GError **error);
 
 GdkPixbuf *
 get_icon_by_id         (IconID icon_id);
diff --git a/src/network-light/upnp.c b/src/network-light/upnp.c
index 1536d6c..09680c7 100644
--- a/src/network-light/upnp.c
+++ b/src/network-light/upnp.c
@@ -197,7 +197,7 @@ on_get_status (GUPnPService       *service,
                                   get_status (),
                                   NULL);
 
-        gupnp_service_action_return (action);
+        gupnp_service_action_return_success (action);
 }
 
 G_MODULE_EXPORT
@@ -212,7 +212,7 @@ on_get_target (GUPnPService       *service,
                                   get_status (),
                                   NULL);
 
-        gupnp_service_action_return (action);
+        gupnp_service_action_return_success (action);
 }
 
 G_MODULE_EXPORT
@@ -228,7 +228,7 @@ on_set_target (GUPnPService       *service,
                                   G_TYPE_BOOLEAN,
                                   &status,
                                   NULL);
-        gupnp_service_action_return (action);
+        gupnp_service_action_return_success (action);
 
         set_status (status);
 }
@@ -267,7 +267,7 @@ on_get_load_level_status (GUPnPService       *service,
                                   get_load_level (),
                                   NULL);
 
-        gupnp_service_action_return (action);
+        gupnp_service_action_return_success (action);
 }
 
 G_MODULE_EXPORT
@@ -282,7 +282,7 @@ on_get_load_level_target (GUPnPService       *service,
                                   get_load_level (),
                                   NULL);
 
-        gupnp_service_action_return (action);
+        gupnp_service_action_return_success (action);
 }
 
 G_MODULE_EXPORT
@@ -298,7 +298,7 @@ on_set_load_level_target (GUPnPService       *service,
                                   G_TYPE_UINT,
                                   &load_level,
                                   NULL);
-        gupnp_service_action_return (action);
+        gupnp_service_action_return_success (action);
 
         if (load_level > 100)
                 load_level = 100;
@@ -802,10 +802,10 @@ init_upnp (gchar **interfaces, guint port, gchar *name, gboolean ipv4, gboolean
         g_assert (context_manager != NULL);
 
         if (interfaces != NULL) {
-                white_list = gupnp_context_manager_get_white_list
-                                            (context_manager);
-                gupnp_white_list_add_entryv (white_list, interfaces);
-                gupnp_white_list_set_enabled (white_list, TRUE);
+                white_list = gupnp_context_manager_get_context_filter (
+                        context_manager);
+                gupnp_context_filter_add_entryv (white_list, interfaces);
+                gupnp_context_filter_set_enabled (white_list, TRUE);
         }
 
         g_signal_connect (context_manager,
diff --git a/src/universal-cp/details-treeview.c b/src/universal-cp/details-treeview.c
index 0ac1c2b..d1e3716 100644
--- a/src/universal-cp/details-treeview.c
+++ b/src/universal-cp/details-treeview.c
@@ -310,7 +310,7 @@ void
 show_service_details (GUPnPServiceInfo *info)
 {
         char          *details[32];
-        const SoupURI *uri;
+        const GUri *uri;
         const char    *str;
         int            i = 0;
 
@@ -332,7 +332,7 @@ show_service_details (GUPnPServiceInfo *info)
         details[i++] = _("Base URL");
         uri = gupnp_service_info_get_url_base (info);
         if (uri)
-                details[i++] = soup_uri_to_string ((SoupURI *) uri, FALSE);
+                details[i++] = g_uri_to_string ((GUri *) uri);
 
         details[i++] = _("Service ID");
         details[i++] = gupnp_service_info_get_id (info);
@@ -357,7 +357,7 @@ void
 show_device_details (GUPnPDeviceInfo *info)
 {
         char          *details[32];
-        const SoupURI *uri;
+        const GUri *uri;
         const char    *str;
         int            i = 0;
 
@@ -379,7 +379,7 @@ show_device_details (GUPnPDeviceInfo *info)
         details[i++] = _("Base URL");
         uri = gupnp_device_info_get_url_base (info);
         if (uri)
-                details[i++] = soup_uri_to_string ((SoupURI *) uri, FALSE);
+                details[i++] = g_uri_to_string ((GUri *) uri);
 
         details[i++] = _("Friendly Name");
         details[i++] = gupnp_device_info_get_friendly_name (info);
diff --git a/src/universal-cp/device-treeview.c b/src/universal-cp/device-treeview.c
index df3a649..3d31b9f 100644
--- a/src/universal-cp/device-treeview.c
+++ b/src/universal-cp/device-treeview.c
@@ -324,7 +324,16 @@ remove_device (GUPnPDeviceInfo *info)
                 return;
 
         if (find_device (model, udn, &root_iter, &iter)) {
-                unschedule_icon_update (info);
+                GCancellable *cancellable =
+                        g_object_get_data (G_OBJECT (info),
+                                           "icon-download-cancellable");
+                if (cancellable != NULL) {
+                        g_cancellable_cancel (cancellable);
+
+                        g_object_set_data (G_OBJECT (info),
+                                           "icon-download-cancellable",
+                                           NULL);
+                }
                 gtk_tree_store_remove (GTK_TREE_STORE (model), &iter);
         }
 }
@@ -380,13 +389,21 @@ on_state_variable_changed (GUPnPServiceProxy *proxy,
 }
 
 static void
-on_device_icon_available (GUPnPDeviceInfo *info,
-                          GdkPixbuf       *icon)
+on_device_icon_available (GObject *source,
+                          GAsyncResult *res,
+                          gpointer user_data)
 {
         GtkTreeModel *model;
         GtkTreeIter   root_iter;
         GtkTreeIter   device_iter;
         const char   *udn;
+        g_autoptr (GError) error = NULL;
+        g_autoptr (GdkPixbuf) icon = NULL;
+
+        icon = update_icon_finish (GUPNP_DEVICE_INFO (source), res, &error);
+        if (error != NULL) {
+                g_debug ("Failed to download icon: %s", error->message);
+        }
 
         // There was no icon or there was an error getting that
         // icon. Just keep the default then
@@ -394,21 +411,22 @@ on_device_icon_available (GUPnPDeviceInfo *info,
                 return;
         }
 
-        model = gtk_tree_view_get_model (GTK_TREE_VIEW (treeview));
+        model = gtk_tree_view_get_model (GTK_TREE_VIEW (user_data));
         g_assert (model != NULL);
 
-        udn = gupnp_device_info_get_udn (info);
+        udn = gupnp_device_info_get_udn (GUPNP_DEVICE_INFO (source));
 
         if (!gtk_tree_model_get_iter_first (model, &root_iter))
                 return;
 
-        if (find_device (model, udn, &root_iter, &device_iter))
+        if (find_device (model, udn, &root_iter, &device_iter)) {
+                g_object_set_data (source, "icon-download-cancellable", NULL);
+
                 gtk_tree_store_set (GTK_TREE_STORE (model),
                                     &device_iter,
                                     0, icon,
                                     -1);
-
-        g_clear_object (&icon);
+        }
 }
 
 static void
@@ -553,20 +571,24 @@ append_introspection (GUPnPServiceProxy         *proxy,
 }
 
 static void
-got_introspection (GUPnPServiceInfo          *info,
-                   GUPnPServiceIntrospection *introspection,
-                   const GError              *error,
-                   gpointer                   user_data)
+got_introspection (GObject *source, GAsyncResult *res, gpointer user_data)
 {
         GtkTreeModel *model;
         GtkTreeIter  *service_iter;
+        GError *error = NULL;
+
+        GUPnPServiceIntrospection *introspection =
+                gupnp_service_info_introspect_finish (
+                        GUPNP_SERVICE_INFO (source),
+                        res,
+                        &error);
 
         service_iter = (GtkTreeIter *) user_data;
 
         model = gtk_tree_view_get_model (GTK_TREE_VIEW (treeview));
         g_assert (model != NULL);
 
-        append_introspection (GUPNP_SERVICE_PROXY (info),
+        append_introspection (GUPNP_SERVICE_PROXY (source),
                               introspection,
                               GTK_TREE_STORE (model),
                               service_iter);
@@ -576,7 +598,9 @@ got_introspection (GUPnPServiceInfo          *info,
                 g_object_unref (introspection);
 
                 /* Services are subscribed to by default */
-                gupnp_service_proxy_set_subscribed (GUPNP_SERVICE_PROXY (info), TRUE);
+                gupnp_service_proxy_set_subscribed (
+                        GUPNP_SERVICE_PROXY (source),
+                        TRUE);
         }
 }
 
@@ -602,9 +626,10 @@ append_service_tree (GUPnPServiceInfo *info,
                                  5, ICON_SERVICE,
                                  -1);
 
-                gupnp_service_info_get_introspection_async (info,
-                                                            got_introspection,
-                                                            service_iter);
+                gupnp_service_info_introspect_async (info,
+                                                     NULL,
+                                                     got_introspection,
+                                                     service_iter);
 
                 g_free (id);
         }
@@ -621,6 +646,7 @@ append_device_tree (GUPnPDeviceInfo *info,
         if (friendly_name) {
                 GtkTreeIter device_iter;
                 GList *child;
+                GCancellable *cancellable = g_cancellable_new ();
 
                 gtk_tree_store_insert_with_values
                                 (GTK_TREE_STORE (model),
@@ -632,7 +658,14 @@ append_device_tree (GUPnPDeviceInfo *info,
                                  -1);
                 g_free (friendly_name);
 
-                schedule_icon_update (info, on_device_icon_available);
+                g_object_set_data_full (G_OBJECT (info),
+                                        "icon-download-cancellable",
+                                        cancellable,
+                                        g_object_unref);
+                update_icon_async (info,
+                                   cancellable,
+                                   on_device_icon_available,
+                                   treeview);
 
                 /* Append the embedded devices */
                 child = gupnp_device_info_list_devices (info);
diff --git a/subprojects/gssdp-1.2.wrap b/subprojects/gssdp-1.6.wrap
similarity index 100%
rename from subprojects/gssdp-1.2.wrap
rename to subprojects/gssdp-1.6.wrap
diff --git a/subprojects/gupnp-1.2.wrap b/subprojects/gupnp-1.6.wrap
similarity index 100%
rename from subprojects/gupnp-1.2.wrap
rename to subprojects/gupnp-1.6.wrap


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