EWebExtensionContainer

EWebExtensionContainer — Container of WebKitGTK+ Web Extensions

Functions

Properties

gchar * interface-name Read / Write / Construct Only
gchar * object-path Read / Write / Construct Only

Signals

void page-proxy-changed Run Last

Object Hierarchy

    GObject
    ╰── EWebExtensionContainer

Includes

#include <e-util/e-util.h>

Description

EWebExtensionContainer is a container of WebKitGTK+ Web Extensions, which runs a D-Bus server to which the Web Extensions can connect. This object is meant for the client side. It also takes care of all the connections and corresponding GDBusProxy objects.

The Web Extension part can use e_web_extension_container_utils_connect_to_server() to connect to it.

Functions

e_web_extension_container_new ()

EWebExtensionContainer *
e_web_extension_container_new (const gchar *object_path,
                               const gchar *interface_name);

Creates a new EWebExtensionContainer, which opens a new D-Bus server for the given object_path . If any such already exists, then it is returned instead.

The interface_name is used for the e_web_extension_container_call_simple() and for the GDBusProxy instances managed by this object.

Parameters

object_path

a D-Bus object path

 

interface_name

a D-Bus interface name

 

Returns

a new EWebExtensionContainer. Free it with g_object_unref(), when no longer needed.

[transfer full]

Since: 3.36


e_web_extension_container_get_object_path ()

const gchar *
e_web_extension_container_get_object_path
                               (EWebExtensionContainer *container);

Parameters

container

an EWebExtensionContainer

 

Returns

the object path the container had been created with

Since: 3.36


e_web_extension_container_get_interface_name ()

const gchar *
e_web_extension_container_get_interface_name
                               (EWebExtensionContainer *container);

Parameters

container

an EWebExtensionContainer

 

Returns

the interface name the container had been created with

Since: 3.36


e_web_extension_container_get_server_guid ()

const gchar *
e_web_extension_container_get_server_guid
                               (EWebExtensionContainer *container);

Parameters

container

an EWebExtensionContainer

 

Returns

a GUID of the D-Bus server this container created, or NULL, when no server is running.

[nullable]

Since: 3.36


e_web_extension_container_get_server_address ()

const gchar *
e_web_extension_container_get_server_address
                               (EWebExtensionContainer *container);

Returns an address of the created D-Bus server. There can be used e_web_extension_container_utils_connect_to_server() to connect to it.

Parameters

container

an EWebExtensionContainer

 

Returns

an address of the D-Bus server this container created, or NULL, when no server is running.

[nullable]

Since: 3.36


e_web_extension_container_reserve_stamp ()

gint
e_web_extension_container_reserve_stamp
                               (EWebExtensionContainer *container);

Parameters

container

an EWebExtensionContainer

 

Returns

a new stamp, which is used to distinguish between instances of the Web Extensions.

Since: 3.36


e_web_extension_container_ref_proxy ()

GDBusProxy *
e_web_extension_container_ref_proxy (EWebExtensionContainer *container,
                                     guint64 page_id,
                                     gint stamp);

Tries to search for a GDBusProxy, which currently handles a Web Extension with page_id and stamp . The owner should listen to page-proxy-changed signal, to know when the proxy for the page changes.

Free the returned proxy, if not NULL, with g_object_unref(), when no longer needed.

Parameters

container

an EWebExtensionContainer

 

page_id

a page ID, as returned by webkit_web_view_get_page_id()

 

stamp

a stamp of a Web Extension to look for

 

Returns

a GDBusProxy for page_id and stamp , or NULL, when not found.

[transfer full][nullable]

Since: 3.36


e_web_extension_container_forget_stamp ()

void
e_web_extension_container_forget_stamp
                               (EWebExtensionContainer *container,
                                gint stamp);

The owner of container can call this function to free any resources related to stamp , indicating that this stamp is no longer used.

Parameters

container

an EWebExtensionContainer

 

stamp

a stamp of the Web Extension

 

Since: 3.36


e_web_extension_container_call_simple ()

void
e_web_extension_container_call_simple (EWebExtensionContainer *container,
                                       guint64 page_id,
                                       gint stamp,
                                       const gchar *method_name,
                                       GVariant *params);

Either calls asynchronously the D-Bus method named method_name with parameters params immediately, when there exists a GDBusProxy for the given page_id and stamp , or remembers this call and calls it as soon as the GDBusProxy is created. The method_name should be part of the interface this container had been created for.

The D-Bus call is made asynchronously. If there are more pending calls, then they are made in the order they had been added by this function.

Parameters

container

an EWebExtensionContainer

 

page_id

a page ID, as returned by webkit_web_view_get_page_id()

 

stamp

a stamp of a Web Extension to look for

 

method_name

a D-Bus method name

 

params

optional parameters for the D-Bus method.

[nullable]

Since: 3.36


e_web_extension_container_utils_connect_to_server ()

void
e_web_extension_container_utils_connect_to_server
                               (const gchar *server_address,
                                GCancellable *cancellable,
                                GAsyncReadyCallback callback,
                                gpointer user_data);

This is only a wrapper around g_dbus_connection_new_for_address(), setting a GDBusObserver, which will authorize a peer the same way the preview or composer server expects it.

Call e_web_extension_container_utils_connect_to_server_finish() to finish the request from the callback .

Parameters

server_address

a D-Bus server address to connect to

 

cancellable

optional GCancellable object, or NULL

 

callback

a GAsyncReadyCallback to call when the request is satisfied

 

user_data

the user data to pass to callback

 

Since: 3.36


e_web_extension_container_utils_connect_to_server_finish ()

GDBusConnection *
e_web_extension_container_utils_connect_to_server_finish
                               (GAsyncResult *result,
                                GError **error);

Finishes call of e_web_extension_container_utils_connect_to_server().

Free the returned connection, if not NULL, with g_object_unref(), when no longer needed.

Parameters

result

a GAsyncResult obtained from GAsyncReadyCallback passed to e_web_extension_container_utils_connect_to_server()

 

error

return location for a GError, or NULL

 

Returns

a newly allocated GDBusConnection, or NULL on error.

[transfer full][nullable]

Since: 3.36

Property Details

The “interface-name” property

  “interface-name”           gchar *

Owner: EWebExtensionContainer

Flags: Read / Write / Construct Only

Default value: NULL


The “object-path” property

  “object-path”              gchar *

Owner: EWebExtensionContainer

Flags: Read / Write / Construct Only

Default value: NULL

Signal Details

The “page-proxy-changed” signal

void
user_function (EWebExtensionContainer *page_id,
               guint64                 stamp,
               gint                    proxy,
               GDBusProxy             *arg3,
               gpointer                user_data)

A signal emitted whenever a proxy for the given page_id and stamp changes. The proxy can be NULL, which means the previous proxy disappeared.

Parameters

page_id

a page ID

 

stamp

a stamp

 

proxy

a GDBusProxy or NULL.

[nullable]

user_data

user data set when the signal handler was connected.

 

Flags: Run Last

Since: 3.36