Class

WebKit2WindowProperties

Description [src]

class WebKit2.WindowProperties : GObject.Object
{
  priv: WebKitWindowPropertiesPrivate*
}

Window properties of a WebKitWebView.

The content of a WebKitWebView can request to change certain properties of the window containing the view. This can include the x, y position of the window, the width and height but also if a toolbar, scrollbar, statusbar, locationbar should be visible to the user, and the request to show the WebKitWebView fullscreen.

The WebKitWebView::ready-to-show signal handler is the proper place to apply the initial window properties. Then you can monitor the WebKitWindowProperties by connecting to ::notify signal.

static void ready_to_show_cb (WebKitWebView *web_view, gpointer user_data)
{
    GtkWidget *window;
    WebKitWindowProperties *window_properties;
    gboolean visible;

    // Create the window to contain the WebKitWebView.
    window = browser_window_new ();
    gtk_container_add (GTK_CONTAINER (window), GTK_WIDGET (web_view));
    gtk_widget_show (GTK_WIDGET (web_view));

    // Get the WebKitWindowProperties of the web view and monitor it.
    window_properties = webkit_web_view_get_window_properties (web_view);
    g_signal_connect (window_properties, "notify::geometry",
                      G_CALLBACK (window_geometry_changed), window);
    g_signal_connect (window_properties, "notify::toolbar-visible",
                      G_CALLBACK (window_toolbar_visibility_changed), window);
    g_signal_connect (window_properties, "notify::menubar-visible",
                      G_CALLBACK (window_menubar_visibility_changed), window);

    // Apply the window properties before showing the window.
    visible = webkit_window_properties_get_toolbar_visible (window_properties);
    browser_window_set_toolbar_visible (BROWSER_WINDOW (window), visible);
    visible = webkit_window_properties_get_menubar_visible (window_properties);
    browser_window_set_menubar_visible (BROWSER_WINDOW (window), visible);

    if (webkit_window_properties_get_fullscreen (window_properties)) {
        gtk_window_fullscreen (GTK_WINDOW (window));
    } else {
        GdkRectangle geometry;

        gtk_window_set_resizable (GTK_WINDOW (window),
                                  webkit_window_properties_get_resizable (window_properties));
        webkit_window_properties_get_geometry (window_properties, &geometry);
        gtk_window_move (GTK_WINDOW (window), geometry.x, geometry.y);
        gtk_window_resize (GTK_WINDOW (window), geometry.width, geometry.height);
    }

    gtk_widget_show (window);
}

Hierarchy

hierarchy this WebKitWindowProperties ancestor_0 GObject ancestor_0--this

Ancestors

Instance methods

webkit_window_properties_get_fullscreen

Get whether the window should be shown in fullscreen state or not.

webkit_window_properties_get_geometry

Get the geometry the window should have on the screen when shown.

webkit_window_properties_get_locationbar_visible

Get whether the window should have the locationbar visible or not.

webkit_window_properties_get_menubar_visible

Get whether the window should have the menubar visible or not.

webkit_window_properties_get_resizable

Get whether the window should be resizable by the user or not.

webkit_window_properties_get_scrollbars_visible

Get whether the window should have the scrollbars visible or not.

webkit_window_properties_get_statusbar_visible

Get whether the window should have the statusbar visible or not.

webkit_window_properties_get_toolbar_visible

Get whether the window should have the toolbar visible or not.

Methods inherited from GObject (43)

Please see GObject for a full list of methods.

Properties

WebKit2.WindowProperties:fullscreen

Whether window will be displayed fullscreen.

WebKit2.WindowProperties:geometry

The size and position of the window on the screen.

WebKit2.WindowProperties:locationbar-visible

Whether the locationbar should be visible for the window.

WebKit2.WindowProperties:menubar-visible

Whether the menubar should be visible for the window.

WebKit2.WindowProperties:resizable

Whether the window can be resized.

WebKit2.WindowProperties:scrollbars-visible

Whether the scrollbars should be visible for the window.

WebKit2.WindowProperties:statusbar-visible

Whether the statusbar should be visible for the window.

WebKit2.WindowProperties:toolbar-visible

Whether the toolbar should be visible for the window.

Signals

Signals inherited from GObject (1)
GObject::notify

The notify signal is emitted on an object when one of its properties has its value set through g_object_set_property(), g_object_set(), et al.

Class structure

struct WebKit2WindowPropertiesClass {
  GObjectClass parent_class;
  void (* _webkit_reserved0) (
void
  );
  void (* _webkit_reserved1) (
void
  );
  void (* _webkit_reserved2) (
void
  );
  void (* _webkit_reserved3) (
void
  );
  
}

No description available.

Class members
parent_class: GObjectClass

No description available.

_webkit_reserved0: void (* _webkit_reserved0) ( void )

No description available.

_webkit_reserved1: void (* _webkit_reserved1) ( void )

No description available.

_webkit_reserved2: void (* _webkit_reserved2) ( void )

No description available.

_webkit_reserved3: void (* _webkit_reserved3) ( void )

No description available.