Gjsify LogoGjsify Logo

Hierarchy

Index

Constructors

Properties

async_context: object

The server's #GMainContext, if you are using the old API. Servers created using soup_server_listen() will listen on the #GMainContext that was the thread-default context at the time soup_server_listen() was called.

g_type_instance: TypeInstance
http_aliases: string[]

A %NULL-terminated array of URI schemes that should be considered to be aliases for "http". Eg, if this included "dav", than a URI of dav://example.com/path would be treated identically to http://example.com/path. In particular, this is needed in cases where a client sends requests with absolute URIs, where those URIs do not use "http:".

The default value is an array containing the single element "*", a special value which means that any scheme except "https" is considered to be an alias for "http".

See also #SoupServer:https-aliases.

https_aliases: string[]

A comma-delimited list of URI schemes that should be considered to be aliases for "https". See #SoupServer:http-aliases for more information.

The default value is %NULL, meaning that no URI schemes are considered aliases for "https".

interface: Soup.Address

The address of the network interface the server is listening on, if you are using the old #SoupServer API. (This will not be set if you use soup_server_listen(), etc.)

parent: GObject.Object
port: number

The port the server is listening on, if you are using the old #SoupServer API. (This will not be set if you use soup_server_listen(), etc.)

raw_paths: boolean
server_header: string

If non-%NULL, the value to use for the "Server" header on #SoupMessages processed by this server.

The Server header is the server equivalent of the User-Agent header, and provides information about the server and its components. It contains a list of one or more product tokens, separated by whitespace, with the most significant product token coming first. The tokens must be brief, ASCII, and mostly alphanumeric (although "-", "_", and "." are also allowed), and may optionally include a "/" followed by a version string. You may also put comments, enclosed in parentheses, between or after the tokens.

Some HTTP server implementations intentionally do not use version numbers in their Server header, so that installations running older versions of the server don't end up advertising their vulnerability to specific security holes.

As with #SoupSession:user_agent, if you set a #SoupServer:server_header property that has trailing whitespace, #SoupServer will append its own product token (eg, "libsoup/2.3.2") to the end of the header for you.

ssl_cert_file: string

Path to a file containing a PEM-encoded certificate.

If you set this property and #SoupServer:ssl-key-file at construct time, then soup_server_new() will try to read the files; if it cannot, it will return %NULL, with no explicit indication of what went wrong (and logging a warning with newer versions of glib, since returning %NULL from a constructor is illegal).

ssl_key_file: string

Path to a file containing a PEM-encoded private key. See #SoupServer:ssl-cert-file for more information about how this is used.

tls_certificate: TlsCertificate

A #GTlsCertificate that has a #GTlsCertificate:private-key set. If this is set, then the server will be able to speak https in addition to (or instead of) plain http.

Alternatively, you can call soup_server_set_ssl_cert_file() to have #SoupServer read in a a certificate from a file.

$gtype: GType<Soup.Server>
name: string

Methods

  • Adds an authentication domain to server. Each auth domain will have the chance to require authentication for each request that comes in; normally auth domains will require authentication for requests on certain paths that they have been set up to watch, or that meet other criteria set by the caller. If an auth domain determines that a request requires authentication (and the request doesn't contain authentication), server will automatically reject the request with an appropriate status (401 Unauthorized or 407 Proxy Authentication Required). If the request used the "100-continue" Expectation, server will reject it before the request body is sent.

    Parameters

    Returns void

  • Adds an "early" handler to server for requests under path. Note that "normal" and "early" handlers are matched up together, so if you add a normal handler for "/foo" and an early handler for "/foo/bar", then a request to "/foo/bar" (or any path below it) will run only the early handler. (But if you add both handlers at the same path, then both will get run.)

    For requests under path (that have not already been assigned a status code by a #SoupAuthDomain or a signal handler), callback will be invoked after receiving the request headers, but before receiving the request body; the message's #SoupMessage:method and #SoupMessage:request-headers fields will be filled in.

    Early handlers are generally used for processing requests with request bodies in a streaming fashion. If you determine that the request will contain a message body, normally you would call soup_message_body_set_accumulate() on the message's #SoupMessage:request-body to turn off request-body accumulation, and connect to the message's #SoupMessage::got-chunk signal to process each chunk as it comes in.

    To complete the message processing after the full message body has been read, you can either also connect to #SoupMessage::got-body, or else you can register a non-early handler for path as well. As long as you have not set the #SoupMessage:status-code by the time #SoupMessage::got-body is emitted, the non-early handler will be run as well.

    Parameters

    • path: string

      the toplevel path for the handler

    • callback: Soup.ServerCallback

      callback to invoke for requests under path

    Returns void

  • Adds a handler to server for requests under path. If path is %NULL or "/", then this will be the default handler for all requests that don't have a more specific handler. (Note though that if you want to handle requests to the special "" URI, you must explicitly register a handler for ""; the default handler will not be used for that case.)

    For requests under path (that have not already been assigned a status code by a #SoupAuthDomain, an early #SoupServerHandler, or a signal handler), callback will be invoked after receiving the request body; the message's #SoupMessage:method, #SoupMessage:request-headers, and #SoupMessage:request-body fields will be filled in.

    After determining what to do with the request, the callback must at a minimum call soup_message_set_status() (or soup_message_set_status_full()) on the message to set the response status code. Additionally, it may set response headers and/or fill in the response body.

    If the callback cannot fully fill in the response before returning (eg, if it needs to wait for information from a database, or another network server), it should call soup_server_pause_message() to tell server to not send the response right away. When the response is ready, call soup_server_unpause_message() to cause it to be sent.

    To send the response body a bit at a time using "chunked" encoding, first call soup_message_headers_set_encoding() to set %SOUP_ENCODING_CHUNKED on the #SoupMessage:response-headers. Then call soup_message_body_append() (or soup_message_body_append_buffer()) to append each chunk as it becomes ready, and soup_server_unpause_message() to make sure it's running. (The server will automatically pause the message if it is using chunked encoding but no more chunks are available.) When you are done, call soup_message_body_complete() to indicate that no more chunks are coming.

    Parameters

    • path: string

      the toplevel path for the handler

    • callback: Soup.ServerCallback

      callback to invoke for requests under path

    Returns void

  • add_websocket_extension(extension_type: GType<unknown>): void
  • Add support for a WebSocket extension of the given extension_type. When a WebSocket client requests an extension of extension_type, a new #SoupWebsocketExtension of type extension_type will be created to handle the request.

    You can also add support for a WebSocket extension to the server at construct time by using the %SOUP_SERVER_ADD_WEBSOCKET_EXTENSION property. Note that #SoupWebsocketExtensionDeflate is supported by default, use soup_server_remove_websocket_extension() if you want to disable it.

    Parameters

    • extension_type: GType<unknown>

      a #GType

    Returns void

  • Adds a WebSocket handler to server for requests under path. (If path is %NULL or "/", then this will be the default handler for all requests that don't have a more specific handler.)

    When a path has a WebSocket handler registered, server will check incoming requests for WebSocket handshakes after all other handlers have run (unless some earlier handler has already set a status code on the message), and update the request's status, response headers, and response body accordingly.

    If origin is non-%NULL, then only requests containing a matching "Origin" header will be accepted. If protocols is non-%NULL, then only requests containing a compatible "Sec-WebSocket-Protocols" header will be accepted. More complicated requirements can be handled by adding a normal handler to path, and having it perform whatever checks are needed (possibly calling soup_server_check_websocket_handshake() one or more times), and setting a failure status code if the handshake should be rejected.

    Parameters

    • path: string

      the toplevel path for the handler

    • origin: string

      the origin of the connection

    • protocols: string[]

      the protocols supported by this handler

    • callback: Soup.ServerWebsocketCallback

      callback to invoke for successful WebSocket requests under path

    Returns void

  • Creates a binding between source_property on source and target_property on target.

    Whenever the source_property is changed the target_property is updated using the same value. For instance:

      g_object_bind_property (action, "active", widget, "sensitive", 0);
    

    Will result in the "sensitive" property of the widget #GObject instance to be updated with the same value of the "active" property of the action #GObject instance.

    If flags contains %G_BINDING_BIDIRECTIONAL then the binding will be mutual: if target_property on target changes then the source_property on source will be updated as well.

    The binding will automatically be removed when either the source or the target instances are finalized. To remove the binding without affecting the source and the target you can just call g_object_unref() on the returned #GBinding instance.

    Removing the binding by calling g_object_unref() on it must only be done if the binding, source and target are only used from a single thread and it is clear that both source and target outlive the binding. Especially it is not safe to rely on this if the binding, source or target can be finalized from different threads. Keep another reference to the binding and use g_binding_unbind() instead to be on the safe side.

    A #GObject can have multiple bindings.

    Parameters

    • source_property: string

      the property on source to bind

    • target: GObject.Object

      the target #GObject

    • target_property: string

      the property on target to bind

    • flags: BindingFlags

      flags to pass to #GBinding

    Returns Binding

  • Creates a binding between source_property on source and target_property on target, allowing you to set the transformation functions to be used by the binding.

    This function is the language bindings friendly version of g_object_bind_property_full(), using #GClosures instead of function pointers.

    Parameters

    • source_property: string

      the property on source to bind

    • target: GObject.Object

      the target #GObject

    • target_property: string

      the property on target to bind

    • flags: BindingFlags

      flags to pass to #GBinding

    • transform_to: TClosure<any, any>

      a #GClosure wrapping the transformation function from the source to the target, or %NULL to use the default

    • transform_from: TClosure<any, any>

      a #GClosure wrapping the transformation function from the target to the source, or %NULL to use the default

    Returns Binding

  • disconnect(): void
  • disconnect(id: number): void
  • Closes and frees server's listening sockets. If you are using the old #SoupServer APIs, this also includes the effect of soup_server_quit().

    Note that if there are currently requests in progress on server, that they will continue to be processed if server's #GMainContext is still running.

    You can call soup_server_listen(), etc, after calling this function if you want to start listening again.

    Returns void

  • Parameters

    • id: number

    Returns void

  • emit(sigName: "request-aborted", message: Soup.Message, client: ClientContext, ...args: any[]): void
  • emit(sigName: "request-finished", message: Soup.Message, client: ClientContext, ...args: any[]): void
  • emit(sigName: "request-read", message: Soup.Message, client: ClientContext, ...args: any[]): void
  • emit(sigName: "request-started", message: Soup.Message, client: ClientContext, ...args: any[]): void
  • emit(sigName: "notify::async-context", ...args: any[]): void
  • emit(sigName: "notify::http-aliases", ...args: any[]): void
  • emit(sigName: "notify::https-aliases", ...args: any[]): void
  • emit(sigName: "notify::interface", ...args: any[]): void
  • emit(sigName: "notify::port", ...args: any[]): void
  • emit(sigName: "notify::raw-paths", ...args: any[]): void
  • emit(sigName: "notify::server-header", ...args: any[]): void
  • emit(sigName: "notify::ssl-cert-file", ...args: any[]): void
  • emit(sigName: "notify::ssl-key-file", ...args: any[]): void
  • emit(sigName: "notify::tls-certificate", ...args: any[]): void
  • emit(sigName: string, ...args: any[]): void
  • force_floating(): void
  • This function is intended for #GObject implementations to re-enforce a [floating][floating-ref] object reference. Doing this is seldom required: all #GInitiallyUnowneds are created with a floating reference which usually just needs to be sunken by calling g_object_ref_sink().

    Returns void

  • freeze_notify(): void
  • Increases the freeze count on object. If the freeze count is non-zero, the emission of "notify" signals on object is stopped. The signals are queued until the freeze count is decreased to zero. Duplicate notifications are squashed so that at most one #GObject::notify signal is emitted for each property modified while the object is frozen.

    This is necessary for accessors that modify multiple properties to prevent premature notification while the object is still being modified.

    Returns void

  • Gets server's async_context, if you are using the old API. (With the new API, the server runs in the thread's thread-default #GMainContext, regardless of what this method returns.)

    This does not add a ref to the context, so you will need to ref it yourself if you want it to outlive its server.

    Returns MainContext

  • get_data(key?: string): object
  • Gets a named field from the objects table of associations (see g_object_set_data()).

    Parameters

    • Optional key: string

      name of the key for that association

    Returns object

  • Gets server's listening socket, if you are using the old API.

    You should treat this socket as read-only; writing to it or modifiying it may cause server to malfunction.

    Returns Soup.Socket

  • Gets server's list of listening sockets.

    You should treat these sockets as read-only; writing to or modifiying any of these sockets may cause server to malfunction.

    (Beware that in contrast to the old soup_server_get_listener(), this function returns #GSockets, not #SoupSockets.)

    Returns Gio.Socket[]

  • get_port(): number
  • get_property(property_name?: string, value?: any): void
  • Gets a property of an object.

    The value can be:

    • an empty #GValue initialized by %G_VALUE_INIT, which will be automatically initialized with the expected type of the property (since GLib 2.60)
    • a #GValue initialized with the expected type of the property
    • a #GValue initialized with a type to which the expected type of the property can be transformed

    In general, a copy is made of the property contents and the caller is responsible for freeing the memory by calling g_value_unset().

    Note that g_object_get_property() is really intended for language bindings, g_object_get() is much more convenient for C programming.

    Parameters

    • Optional property_name: string

      the name of the property to get

    • Optional value: any

      return location for the property value

    Returns void

  • get_qdata(quark: number): object
  • Gets a list of URIs corresponding to the interfaces server is listening on. These will contain IP addresses, not hostnames, and will also indicate whether the given listener is http or https.

    Note that if you used soup_server_listen_all(), the returned URIs will use the addresses 0.0.0.0 and ::, rather than actually returning separate URIs for each interface on the system.

    Returns Soup.URI[]

  • getv(names: string[], values: any[]): void
  • Gets n_properties properties for an object. Obtained properties will be set to values. All properties must be valid. Warnings will be emitted and undefined behaviour may result if invalid properties are passed in.

    Parameters

    • names: string[]

      the names of each property to get

    • values: any[]

      the values of each property to get

    Returns void

  • is_floating(): boolean
  • is_https(): boolean
  • Checks whether server is capable of https.

    In order for a server to run https, you must call soup_server_set_ssl_cert_file(), or set the #SoupServer:tls-certificate property, to provide it with a certificate to use.

    If you are using the deprecated single-listener APIs, then a return value of %TRUE indicates that the #SoupServer serves https exclusively. If you are using soup_server_listen(), etc, then a %TRUE return value merely indicates that the server is able to do https, regardless of whether it actually currently is or not. Use soup_server_get_uris() to see if it currently has any https listeners.

    Returns boolean

  • This attempts to set up server to listen for connections on address.

    If options includes %SOUP_SERVER_LISTEN_HTTPS, and server has been configured for TLS, then server will listen for https connections on this port. Otherwise it will listen for plain http.

    You may call this method (along with the other "listen" methods) any number of times on a server, if you want to listen on multiple ports, or set up both http and https service.

    After calling this method, server will begin accepting and processing connections as soon as the appropriate #GMainContext is run.

    Note that #SoupServer never makes use of dual IPv4/IPv6 sockets; if address is an IPv6 address, it will only accept IPv6 connections. You must configure IPv4 listening separately.

    Parameters

    Returns boolean

  • This attempts to set up server to listen for connections on all interfaces on the system. (That is, it listens on the addresses 0.0.0.0 and/or ::, depending on whether options includes %SOUP_SERVER_LISTEN_IPV4_ONLY, %SOUP_SERVER_LISTEN_IPV6_ONLY, or neither.) If port is specified, server will listen on that port. If it is 0, server will find an unused port to listen on. (In that case, you can use soup_server_get_uris() to find out what port it ended up choosing.)

    See soup_server_listen() for more details.

    Parameters

    Returns boolean

  • This attempts to set up server to listen for connections on fd.

    See soup_server_listen() for more details.

    Note that server will close fd when you free it or call soup_server_disconnect().

    Parameters

    • fd: number

      the file descriptor of a listening socket

    • options: Soup.ServerListenOptions

      listening options for this server

    Returns boolean

  • This attempts to set up server to listen for connections on "localhost" (that is, 127.0.0.1 and/or ::1, depending on whether options includes %SOUP_SERVER_LISTEN_IPV4_ONLY, %SOUP_SERVER_LISTEN_IPV6_ONLY, or neither). If port is specified, server will listen on that port. If it is 0, server will find an unused port to listen on. (In that case, you can use soup_server_get_uris() to find out what port it ended up choosing.)

    See soup_server_listen() for more details.

    Parameters

    Returns boolean

  • notify(property_name: string): void
  • Emits a "notify" signal for the property property_name on object.

    When possible, eg. when signaling a property change from within the class that registered the property, you should use g_object_notify_by_pspec() instead.

    Note that emission of the notify signal may be blocked with g_object_freeze_notify(). In this case, the signal emissions are queued and will be emitted (in reverse order) when g_object_thaw_notify() is called.

    Parameters

    • property_name: string

      the name of a property installed on the class of object.

    Returns void

  • Emits a "notify" signal for the property specified by pspec on object.

    This function omits the property name lookup, hence it is faster than g_object_notify().

    One way to avoid using g_object_notify() from within the class that registered the properties, and using g_object_notify_by_pspec() instead, is to store the GParamSpec used with g_object_class_install_property() inside a static array, e.g.:

      enum
    {
    PROP_0,
    PROP_FOO,
    PROP_LAST
    };

    static GParamSpec *properties[PROP_LAST];

    static void
    my_object_class_init (MyObjectClass *klass)
    {
    properties[PROP_FOO] = g_param_spec_int ("foo", "Foo", "The foo",
    0, 100,
    50,
    G_PARAM_READWRITE);
    g_object_class_install_property (gobject_class,
    PROP_FOO,
    properties[PROP_FOO]);
    }

    and then notify a change on the "foo" property with:

      g_object_notify_by_pspec (self, properties[PROP_FOO]);
    

    Parameters

    • pspec: ParamSpec

      the #GParamSpec of a property installed on the class of object.

    Returns void

  • Pauses I/O on msg. This can be used when you need to return from the server handler without having the full response ready yet. Use soup_server_unpause_message() to resume I/O.

    This must only be called on #SoupMessages which were created by the #SoupServer and are currently doing I/O, such as those passed into a #SoupServerCallback or emitted in a #SoupServer::request-read signal.

    Parameters

    • msg: Soup.Message

      a #SoupMessage associated with server.

    Returns void

  • quit(): void
  • Stops processing for server, if you are using the old API. Call this to clean up after soup_server_run_async(), or to terminate a call to soup_server_run().

    Note that messages currently in progress will continue to be handled, if the main loop associated with the server is resumed or kept running.

    server is still in a working state after this call; you can start and stop a server as many times as you want.

    Returns void

  • Increases the reference count of object.

    Since GLib 2.56, if GLIB_VERSION_MAX_ALLOWED is 2.56 or greater, the type of object will be propagated to the return type (using the GCC typeof() extension), so any casting the caller needs to do on the return type must be explicit.

    Returns GObject.Object

  • Increase the reference count of object, and possibly remove the [floating][floating-ref] reference, if object has a floating reference.

    In other words, if the object is floating, then this call "assumes ownership" of the floating reference, converting it to a normal reference by clearing the floating flag while leaving the reference count unchanged. If the object is not floating, then this call adds a new normal reference increasing the reference count by one.

    Since GLib 2.56, the type of object will be propagated to the return type under the same conditions as for g_object_ref().

    Returns GObject.Object

  • remove_handler(path: string): void
  • Removes all handlers (early and normal) registered at path.

    Parameters

    • path: string

      the toplevel path for the handler

    Returns void

  • remove_websocket_extension(extension_type: GType<unknown>): void
  • Removes support for WebSocket extension of type extension_type (or any subclass of extension_type) from server. You can also remove extensions enabled by default from the server at construct time by using the %SOUP_SERVER_REMOVE_WEBSOCKET_EXTENSION property.

    Parameters

    • extension_type: GType<unknown>

      a #GType

    Returns void

  • run(): void
  • Starts server, if you are using the old API, causing it to listen for and process incoming connections. Unlike soup_server_run_async(), this creates a #GMainLoop and runs it, and it will not return until someone calls soup_server_quit() to stop the server.

    Returns void

  • run_async(): void
  • Starts server, if you are using the old API, causing it to listen for and process incoming connections.

    The server runs in server's #GMainContext. It will not actually perform any processing unless the appropriate main loop is running. In the simple case where you did not set the server's %SOUP_SERVER_ASYNC_CONTEXT property, this means the server will run whenever the glib main loop is running.

    Returns void

  • run_dispose(): void
  • Releases all references to other objects. This can be used to break reference cycles.

    This function should only be called from object system implementations.

    Returns void

  • set_data(key: string, data?: object): void
  • Each object carries around a table of associations from strings to pointers. This function lets you set an association.

    If the object already had an association with that name, the old association will be destroyed.

    Internally, the key is converted to a #GQuark using g_quark_from_string(). This means a copy of key is kept permanently (even after object has been finalized) — so it is recommended to only use a small, bounded set of values for key in your program, to avoid the #GQuark storage growing unbounded.

    Parameters

    • key: string

      name of the key

    • Optional data: object

      data to associate with that key

    Returns void

  • set_property(property_name: string, value?: any): void
  • set_ssl_cert_file(ssl_cert_file: string, ssl_key_file: string): boolean
  • Sets server up to do https, using the SSL/TLS certificate specified by ssl_cert_file and ssl_key_file (which may point to the same file).

    Alternatively, you can set the #SoupServer:tls-certificate property at construction time, if you already have a #GTlsCertificate.

    Parameters

    • ssl_cert_file: string

      path to a file containing a PEM-encoded SSL/TLS certificate.

    • ssl_key_file: string

      path to a file containing a PEM-encoded private key.

    Returns boolean

  • steal_data(key?: string): object
  • Remove a specified datum from the object's data associations, without invoking the association's destroy handler.

    Parameters

    • Optional key: string

      name of the key

    Returns object

  • steal_qdata(quark: number): object
  • This function gets back user data pointers stored via g_object_set_qdata() and removes the data from object without invoking its destroy() function (if any was set). Usually, calling this function is only required to update user data pointers with a destroy notifier, for example:

    void
    object_add_to_user_list (GObject *object,
    const gchar *new_string)
    {
    // the quark, naming the object data
    GQuark quark_string_list = g_quark_from_static_string ("my-string-list");
    // retrieve the old string list
    GList *list = g_object_steal_qdata (object, quark_string_list);

    // prepend new string
    list = g_list_prepend (list, g_strdup (new_string));
    // this changed 'list', so we need to set it again
    g_object_set_qdata_full (object, quark_string_list, list, free_string_list);
    }
    static void
    free_string_list (gpointer data)
    {
    GList *node, *list = data;

    for (node = list; node; node = node->next)
    g_free (node->data);
    g_list_free (list);
    }

    Using g_object_get_qdata() in the above example, instead of g_object_steal_qdata() would have left the destroy function set, and thus the partial string list would have been freed upon g_object_set_qdata_full().

    Parameters

    • quark: number

      A #GQuark, naming the user data pointer

    Returns object

  • thaw_notify(): void
  • Reverts the effect of a previous call to g_object_freeze_notify(). The freeze count is decreased on object and when it reaches zero, queued "notify" signals are emitted.

    Duplicate notifications for each property are squashed so that at most one #GObject::notify signal is emitted for each property, in the reverse order in which they have been queued.

    It is an error to call this function when the freeze count is zero.

    Returns void

  • Resumes I/O on msg. Use this to resume after calling soup_server_pause_message(), or after adding a new chunk to a chunked response.

    I/O won't actually resume until you return to the main loop.

    This must only be called on #SoupMessages which were created by the #SoupServer and are currently doing I/O, such as those passed into a #SoupServerCallback or emitted in a #SoupServer::request-read signal.

    Parameters

    • msg: Soup.Message

      a #SoupMessage associated with server.

    Returns void

  • unref(): void
  • Decreases the reference count of object. When its reference count drops to 0, the object is finalized (i.e. its memory is freed).

    If the pointer to the #GObject may be reused in future (for example, if it is an instance variable of another object), it is recommended to clear the pointer to %NULL rather than retain a dangling pointer to a potentially invalid #GObject instance. Use g_clear_object() for this.

    Returns void

  • vfunc_constructed(): void
  • vfunc_dispatch_properties_changed(n_pspecs: number, pspecs: ParamSpec): void
  • vfunc_dispose(): void
  • vfunc_finalize(): void
  • vfunc_get_property(property_id: number, value?: any, pspec?: ParamSpec): void
  • Emits a "notify" signal for the property property_name on object.

    When possible, eg. when signaling a property change from within the class that registered the property, you should use g_object_notify_by_pspec() instead.

    Note that emission of the notify signal may be blocked with g_object_freeze_notify(). In this case, the signal emissions are queued and will be emitted (in reverse order) when g_object_thaw_notify() is called.

    virtual

    Parameters

    Returns void

  • vfunc_set_property(property_id: number, value?: any, pspec?: ParamSpec): void
  • watch_closure(closure: TClosure<any, any>): void
  • This function essentially limits the life time of the closure to the life time of the object. That is, when the object is finalized, the closure is invalidated by calling g_closure_invalidate() on it, in order to prevent invocations of the closure with a finalized (nonexisting) object. Also, g_object_ref() and g_object_unref() are added as marshal guards to the closure, to ensure that an extra reference count is held on object during invocation of the closure. Usually, this function will be called on closures that use this object as closure data.

    Parameters

    • closure: TClosure<any, any>

      #GClosure to watch

    Returns void

  • compat_control(what: number, data: object): number
  • Find the #GParamSpec with the given name for an interface. Generally, the interface vtable passed in as g_iface will be the default vtable from g_type_default_interface_ref(), or, if you know the interface has already been loaded, g_type_default_interface_peek().

    Parameters

    • g_iface: TypeInterface

      any interface vtable for the interface, or the default vtable for the interface

    • property_name: string

      name of a property to look up.

    Returns ParamSpec

  • Add a property to an interface; this is only useful for interfaces that are added to GObject-derived types. Adding a property to an interface forces all objects classes with that interface to have a compatible property. The compatible property could be a newly created #GParamSpec, but normally g_object_class_override_property() will be used so that the object class only needs to provide an implementation and inherits the property description, default value, bounds, and so forth from the interface property.

    This function is meant to be called from the interface's default vtable initialization function (the class_init member of #GTypeInfo.) It must not be called after after class_init has been called for any object types implementing this interface.

    If pspec is a floating reference, it will be consumed.

    Parameters

    • g_iface: TypeInterface

      any interface vtable for the interface, or the default vtable for the interface.

    • pspec: ParamSpec

      the #GParamSpec for the new property

    Returns void

  • Lists the properties of an interface.Generally, the interface vtable passed in as g_iface will be the default vtable from g_type_default_interface_ref(), or, if you know the interface has already been loaded, g_type_default_interface_peek().

    Parameters

    • g_iface: TypeInterface

      any interface vtable for the interface, or the default vtable for the interface

    Returns ParamSpec[]

  • Creates a new instance of a #GObject subtype and sets its properties.

    Construction parameters (see %G_PARAM_CONSTRUCT, %G_PARAM_CONSTRUCT_ONLY) which are not explicitly specified are set to their default values.

    Parameters

    • object_type: GType<unknown>

      the type id of the #GObject subtype to instantiate

    • parameters: GObject.Parameter[]

      an array of #GParameter

    Returns GObject.Object

Legend

  • Module
  • Object literal
  • Variable
  • Function
  • Function with type parameter
  • Index signature
  • Type alias
  • Type alias with type parameter
  • Enumeration
  • Enumeration member
  • Property
  • Method
  • Interface
  • Interface with type parameter
  • Constructor
  • Property
  • Method
  • Index signature
  • Class
  • Class with type parameter
  • Constructor
  • Property
  • Method
  • Accessor
  • Index signature
  • Inherited constructor
  • Inherited property
  • Inherited method
  • Inherited accessor
  • Protected property
  • Protected method
  • Protected accessor
  • Private property
  • Private method
  • Private accessor
  • Static property
  • Static method