WebKit2WebExtension.ContextMenuItem

g GObject.InitiallyUnowned GObject.InitiallyUnowned WebKit2WebExtension.ContextMenuItem WebKit2WebExtension.ContextMenuItem GObject.InitiallyUnowned->WebKit2WebExtension.ContextMenuItem GObject.Object GObject.Object GObject.Object->GObject.InitiallyUnowned

Subclasses:

None

Methods

Inherited:

GObject.Object (37)

Structs:

GObject.ObjectClass (5)

class

new (action)

class

new_from_gaction (action, label, target)

class

new_from_stock_action (action)

class

new_from_stock_action_with_label (action, label)

class

new_separator ()

class

new_with_submenu (label, submenu)

get_action ()

get_gaction ()

get_stock_action ()

get_submenu ()

is_separator ()

set_submenu (submenu)

Virtual Methods

Inherited:

GObject.Object (7)

Properties

None

Signals

Inherited:

GObject.Object (1)

Fields

Inherited:

GObject.Object (1)

Name

Type

Access

Description

parent

GObject.InitiallyUnowned

r

Class Details

class WebKit2WebExtension.ContextMenuItem(**kwargs)
Bases:

GObject.InitiallyUnowned

Abstract:

No

Structure:

WebKit2WebExtension.ContextMenuItemClass

One item of a WebKit2WebExtension.ContextMenu.

The WebKit2WebExtension.ContextMenu is composed of WebKit2WebExtension.ContextMenuItem s. These items can be created from a Gtk.Action, from a WebKit2WebExtension.ContextMenuAction or from a WebKit2WebExtension.ContextMenuAction and a label. These WebKit2WebExtension.ContextMenuAction s denote stock actions for the items. You can also create separators and submenus.

classmethod new(action)
Parameters:

action (Gtk.Action) – a Gtk.Action

Returns:

the newly created WebKit2WebExtension.ContextMenuItem object.

Return type:

WebKit2WebExtension.ContextMenuItem

Creates a new WebKit2WebExtension.ContextMenuItem for the given action.

Deprecated since version 2.18: Use WebKit2WebExtension.ContextMenuItem.new_from_gaction() instead.

classmethod new_from_gaction(action, label, target)
Parameters:
Returns:

the newly created WebKit2WebExtension.ContextMenuItem object.

Return type:

WebKit2WebExtension.ContextMenuItem

Creates a new WebKit2WebExtension.ContextMenuItem for the given action and label.

On activation target will be passed as parameter to the callback.

New in version 2.18.

classmethod new_from_stock_action(action)
Parameters:

action (WebKit2WebExtension.ContextMenuAction) – a WebKit2WebExtension.ContextMenuAction stock action

Returns:

the newly created WebKit2WebExtension.ContextMenuItem object.

Return type:

WebKit2WebExtension.ContextMenuItem

Creates a new WebKit2WebExtension.ContextMenuItem for the given stock action.

Stock actions are handled automatically by WebKit so that, for example, when a menu item created with a WebKit2WebExtension.ContextMenuAction.STOP is activated the action associated will be handled by WebKit and the current load operation will be stopped. You can get the Gio.Action of a WebKit2WebExtension.ContextMenuItem created with a WebKit2WebExtension.ContextMenuAction with WebKit2WebExtension.ContextMenuItem.get_gaction() and connect to the Gio.SimpleAction ::activate signal to be notified when the item is activated, but you can’t prevent the associated action from being performed.

classmethod new_from_stock_action_with_label(action, label)
Parameters:
Returns:

the newly created WebKit2WebExtension.ContextMenuItem object.

Return type:

WebKit2WebExtension.ContextMenuItem

Creates a new WebKit2WebExtension.ContextMenuItem for the given stock action using the given label.

Stock actions have a predefined label, this method can be used to create a WebKit2WebExtension.ContextMenuItem for a WebKit2WebExtension.ContextMenuAction but using a custom label.

classmethod new_separator()
Returns:

the newly created WebKit2WebExtension.ContextMenuItem object.

Return type:

WebKit2WebExtension.ContextMenuItem

Creates a new WebKit2WebExtension.ContextMenuItem representing a separator.

classmethod new_with_submenu(label, submenu)
Parameters:
Returns:

the newly created WebKit2WebExtension.ContextMenuItem object.

Return type:

WebKit2WebExtension.ContextMenuItem

Creates a new WebKit2WebExtension.ContextMenuItem using the given label with a submenu.

get_action()
Returns:

the Gtk.Action associated to the WebKit2WebExtension.ContextMenuItem, or None if self is a separator.

Return type:

Gtk.Action

Gets the action associated to self as a Gtk.Action.

Deprecated since version 2.18: Use WebKit2WebExtension.ContextMenuItem.get_gaction() instead.

get_gaction()
Returns:

the Gio.Action associated to the WebKit2WebExtension.ContextMenuItem, or None if self is a separator.

Return type:

Gio.Action

Gets the action associated to self as a Gio.Action.

New in version 2.18.

get_stock_action()
Returns:

the WebKit2WebExtension.ContextMenuAction of self

Return type:

WebKit2WebExtension.ContextMenuAction

Gets the WebKit2WebExtension.ContextMenuAction of self.

If the WebKit2WebExtension.ContextMenuItem was not created for a stock action WebKit2WebExtension.ContextMenuAction.CUSTOM will be returned. If the WebKit2WebExtension.ContextMenuItem is a separator WebKit2WebExtension.ContextMenuAction.NO_ACTION will be returned.

get_submenu()
Returns:

the WebKit2WebExtension.ContextMenu representing the submenu of self or None if self doesn’t have a submenu.

Return type:

WebKit2WebExtension.ContextMenu

Gets the submenu of self.

is_separator()
Returns:

True is self is a separator or False otherwise

Return type:

bool

Checks whether self is a separator.

set_submenu(submenu)
Parameters:

submenu (WebKit2WebExtension.ContextMenu or None) – a WebKit2WebExtension.ContextMenu

Sets or replaces the self submenu.

If submenu is None the current submenu of self is removed.