Re: [Vala] How to use TlsServerConnection in Vala?



On Fri, Feb 24, 2012 at 4:22 PM, marcin saepia net <marcin saepia net> wrote:

Hi,

I am trying to get representation of code below in Vala.

Especially I mean the line

 test->server_connection = g_tls_server_connection_new
(G_IO_STREAM(connection), cert, &error);

I really don't know, but from the vapi file it seems that:
 * TlsServerConnection is an interface but it has no abstract methods
 * A class which implements it, has to subclass TlsConnection
 * TlsConnection is not abstract, but it has a protected constructor.
So I guess:
 * declare a class which implements TlsServerConnection and derives
TlsConnection
 * offer a constructor that will call the base protected one.

public class MyConn : TlsConnection, TlsServerConnection
{
  public MyConn()
  {
    base();
  }
}

Read https://live.gnome.org/Vala/Tutorial#GObject-Style_Construction
about properties that are "construct"
I see that class IOStream has a property:
                [NoAccessorMethod]
                public GLib.IOStream base_io_stream { owned get; construct; }
Perhaps is what you need for "connection"

HTH



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