/* Pubic methods*/
static RygelMediaContainer* rygel_external_content_dir_real_create_root_container (RygelContentDirectory* base) {
	RygelExternalContentDir * self;
	ExternalPlugin* _tmp2_;
	GUPnPRootDevice* _tmp1_;
	GUPnPRootDevice* _tmp0_;
	ExternalPlugin* _tmp3_;
	ExternalPlugin* plugin;
	RygelMediaContainer* _tmp4_;
	self = (RygelExternalContentDir*) base;
	_tmp2_ = NULL;
	_tmp1_ = NULL;
	_tmp0_ = NULL;
	_tmp3_ = NULL;
	plugin = (_tmp3_ = (_tmp2_ = EXTERNAL_PLUGIN (gupnp_device_info_get_resource_factory ((GUPnPDeviceInfo*) (_tmp1_ = (g_object_get ((GUPnPService*) self, "root-device", &_tmp0_, NULL), _tmp0_)))), (_tmp2_ == NULL) ? NULL : g_object_ref (_tmp2_)), (_tmp1_ == NULL) ? NULL : (_tmp1_ = (g_object_unref (_tmp1_), NULL)), _tmp3_);
	_tmp4_ = NULL;
	return (_tmp4_ = (RygelMediaContainer*) rygel_external_container_new ("0", plugin->service_name, plugin->root_object, gupnp_context_get_host_ip (gupnp_service_info_get_context ((GUPnPServiceInfo*) self)), NULL), (plugin == NULL) ? NULL : (plugin = (g_object_unref (plugin), NULL)), _tmp4_);
}
Exemple #2
0
/**
 * gupnp_service_info_get_introspection_async_full:
 * @info: A #GUPnPServiceInfo
 * @callback: (scope async) : callback to be called when introspection object is ready.
 * @cancellable: GCancellable that can be used to cancel the call, or %NULL.
 * @user_data: user_data to be passed to the callback.
 *
 * Note that introspection object is created from the information in service
 * description document (SCPD) provided by the service so it can not be created
 * if the service does not provide an SCPD.
 *
 * If @cancellable is used to cancel the call, @callback will be called with
 * error code %G_IO_ERROR_CANCELLED.
 *
 * Since: 0.20.9
 **/
void
gupnp_service_info_get_introspection_async_full
                                (GUPnPServiceInfo                 *info,
                                 GUPnPServiceIntrospectionCallback callback,
                                 GCancellable                     *cancellable,
                                 gpointer                          user_data)
{
        GetSCPDURLData *data;
        char *scpd_url;
        SoupSession *session;
        GUPnPServiceInfoPrivate *priv;

        g_return_if_fail (GUPNP_IS_SERVICE_INFO (info));
        g_return_if_fail (callback != NULL);

        data = g_slice_new (GetSCPDURLData);

        scpd_url = gupnp_service_info_get_scpd_url (info);

        data->message = NULL;
        if (scpd_url != NULL) {
                GUPnPContext *context = NULL;
                char *local_scpd_url = NULL;

                context = gupnp_service_info_get_context (info);

                local_scpd_url = gupnp_context_rewrite_uri (context, scpd_url);
                g_free (scpd_url);

                data->message = soup_message_new (SOUP_METHOD_GET,
                                                  local_scpd_url);
                g_free (local_scpd_url);
        }

        if (data->message == NULL) {
                GError *error;

                error = g_error_new
                                (GUPNP_SERVER_ERROR,
                                 GUPNP_SERVER_ERROR_INVALID_URL,
                                 "No valid SCPD URL defined");

                callback (info, NULL, error, user_data);

                g_error_free (error);

                g_slice_free (GetSCPDURLData, data);

                return;
        }

        data->info      = info;
        data->callback  = callback;
        data->user_data = user_data;

        /* Send off the message */
        priv = gupnp_service_info_get_instance_private (info);
        priv->pending_gets = g_list_prepend (priv->pending_gets, data);

        session = gupnp_context_get_session (priv->context);

        soup_session_queue_message (session,
                                    data->message,
                                    (SoupSessionCallback) got_scpd_url,
                                    data);

        data->cancellable = cancellable;
        if (data->cancellable) {
                g_object_ref (cancellable);
                data->cancelled_id = g_cancellable_connect
                                (data->cancellable,
                                 G_CALLBACK (cancellable_cancelled_cb),
                                 data,
                                 NULL);
        }
}