Class

ValentDevicePlugin

unstable since: 1.0

Description [src]

abstract class Valent.DevicePlugin : Valent.Extension
  implements Gio.ActionGroup, Gio.ActionMap {
  /* No available fields */
}

An abstract base class for device plugins.

ValentDevicePlugin is a base class for plugins that operate in the scope of a single device. This usually means communicating with other devices, however plugins aren’t required to be packet based.

Plugin Requirements

Device plugins essentially have two sets of dependent conditions for being enabled. Plugins become available (i.e. can be enabled) when any of the following are true:

  • any of the device’s outgoing capabilities match any of the plugin’s incoming capabilities
  • any of the device’s incoming capabilities match any of the plugin’s outgoing capabilities
  • the plugin doesn’t list any capabilities (eg. a non-packet based plugin)

When a plugin becomes available it may be enabled, disabled and configured.

Plugin Actions

ValentDevicePlugin implements the GActionGroup and GActionMap interfaces, providing a simple way for plugins to expose functions and states. Each GAction added to the action map will be included in the device action group with the plugin’s module name as a prefix (eg. share.uri).

If the ValentDeviceManager is exported on D-Bus, the actions will be exported along with the ValentDevice.

Implementation Notes

Implementations that define X-DevicePluginIncoming in the .plugin file must override Valent.DevicePluginClass.handle_packet to handle incoming packets. Implementations that depend on the device state, especially those that define X-DevicePluginOutgoing in the .plugin file, should override Valent.DevicePluginClass.update_state.

For device plugin preferences see ValentDevicePreferencesGroup.

.plugin File

Implementations may define the following extra fields in the .plugin file:

  • X-DevicePluginCategory

    A list of categories separated by semi-colons, serving as a hint for organizational purposes. This should be in the form Main;Additional;, with values from the freedesktop.org Desktop Menu Specification.

  • X-DevicePluginIncoming

    A list of packet types (eg. kdeconnect.ping) separated by semi-colons indicating the packets that the plugin can handle.

  • X-DevicePluginOutgoing

    A list of packet types (eg. kdeconnect.share.request) separated by semi-colons indicating the packets that the plugin may send.

  • X-DevicePluginSettings

    A GSettings schema ID for the plugin’s settings. See valent_context_get_plugin_settings() for more information.

Available since: 1.0

Hierarchy

hierarchy this ValentDevicePlugin implements_0 GActionGroup this--implements_0 implements_1 GActionMap this--implements_1 ancestor_0 ValentExtension ancestor_0--this ancestor_1 ValentObject ancestor_1--ancestor_0 ancestor_2 GObject ancestor_2--ancestor_1

Instance methods

valent_device_plugin_handle_packet

Handle a packet from the device the plugin is bound to.

unstable since: 1.0

valent_device_plugin_hide_notification

A convenience for withdrawing a notification.

unstable since: 1.0

valent_device_plugin_queue_packet

Queue a KDE Connect packet to be sent to the device this plugin is bound to.

unstable since: 1.0

valent_device_plugin_set_menu_action

Set or remove a device menu action by GAction name.

unstable since: 1.0

valent_device_plugin_set_menu_item

Set or remove a device GMenuItem by GAction name.

unstable since: 1.0

valent_device_plugin_show_notification

A convenience for showing a local notification.

unstable since: 1.0

valent_device_plugin_update_state

Update the plugin based on the new state of the device.

unstable since: 1.0

Methods inherited from ValentExtension (6)
valent_extension_get_context

Get the settings for this plugin.

unstable since: 1.0

valent_extension_get_object

Get the object this plugin is bound to.

unstable since: 1.0

valent_extension_get_settings

Get the settings for this plugin.

unstable since: 1.0

valent_extension_plugin_state_changed

Emits GObject::notify for ValentExtension:plugin-state.

unstable since: 1.0

valent_extension_plugin_state_check

Get the extension state, while propagating any errors that describe it.

unstable since: 1.0

valent_extension_toggle_actions

Enable or disable all actions.

unstable since: 1.0

Methods inherited from ValentObject (8)
valent_object_chain_cancellable

Chain a cancellable to the object’s cancellable.

unstable since: 1.0

valent_object_destroy

Destroy the object.

unstable since: 1.0

valent_object_in_destruction

Get whether the object is destroyed or in destruction.

unstable since: 1.0

valent_object_lock

Acquire a lock on object.

unstable since: 1.0

valent_object_notify

Emit GObject::notify on object, on the main thread.

unstable since: 1.0

valent_object_notify_by_pspec

Emit GObject::notify on object, on the main thread.

unstable since: 1.0

valent_object_ref_cancellable

Get a GCancellable for the object.

unstable since: 1.0

valent_object_unlock

Release a lock on object.

unstable since: 1.0

Methods inherited from GObject (43)

Please see GObject for a full list of methods.

Methods inherited from GActionGroup (14)
g_action_group_action_added

Emits the GActionGroup::action-added signal on action_group.

unstable since: 2.28

g_action_group_action_enabled_changed

Emits the GActionGroup::action-enabled-changed signal on action_group.

unstable since: 2.28

g_action_group_action_removed

Emits the GActionGroup::action-removed signal on action_group.

unstable since: 2.28

g_action_group_action_state_changed

Emits the GActionGroup::action-state-changed signal on action_group.

unstable since: 2.28

g_action_group_activate_action

Activate the named action within action_group.

unstable since: 2.28

g_action_group_change_action_state

Request for the state of the named action within action_group to be changed to value.

unstable since: 2.28

g_action_group_get_action_enabled

Checks if the named action within action_group is currently enabled.

unstable since: 2.28

g_action_group_get_action_parameter_type

Queries the type of the parameter that must be given when activating the named action within action_group.

unstable since: 2.28

g_action_group_get_action_state

Queries the current state of the named action within action_group.

unstable since: 2.28

g_action_group_get_action_state_hint

Requests a hint about the valid range of values for the state of the named action within action_group.

unstable since: 2.28

g_action_group_get_action_state_type

Queries the type of the state of the named action within action_group.

unstable since: 2.28

g_action_group_has_action

Checks if the named action exists within action_group.

unstable since: 2.28

g_action_group_list_actions

Lists the actions contained within action_group.

unstable since: 2.28

g_action_group_query_action

Queries all aspects of the named action within an action_group.

unstable since: 2.32

Methods inherited from GActionMap (5)
g_action_map_add_action

Adds an action to the action_map.

unstable since: 2.32

g_action_map_add_action_entries

A convenience function for creating multiple GSimpleAction instances and adding them to a GActionMap.

unstable since: 2.32

g_action_map_lookup_action

Looks up the action with the name action_name in action_map.

unstable since: 2.32

g_action_map_remove_action

Removes the named action from the action map.

unstable since: 2.32

g_action_map_remove_action_entries

Remove actions from a GActionMap. This is meant as the reverse of g_action_map_add_action_entries().

unstable since: 2.78

Properties

Properties inherited from ValentExtension (5)
Valent.Extension:context

The ValentDevice this plugin is bound to.

unstable since: 1.0

Valent.Extension:object

The GObject this plugin is bound to.

unstable since: 1.0

Valent.Extension:plugin-info

The PeasPluginInfo describing this plugin.

unstable since: 1.0

Valent.Extension:plugin-state

The ValentPluginState describing the state of the extension.

unstable since: 1.0

Valent.Extension:settings

The GSettings for this plugin.

unstable since: 1.0

Properties inherited from ValentObject (1)
Valent.Object:cancellable

The object GCancellable.

unstable since: 1.0

Signals

Signals inherited from ValentObject (1)
ValentObject::destroy

Emitted when the object is being destroyed.

unstable since: 1.0

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.

Signals inherited from GActionGroup (4)
GActionGroup::action-added

Signals that a new action was just added to the group. This signal is emitted after the action has been added and is now visible.

unstable since: 2.28

GActionGroup::action-enabled-changed

Signals that the enabled status of the named action has changed.

unstable since: 2.28

GActionGroup::action-removed

Signals that an action is just about to be removed from the group. This signal is emitted before the action is removed, so the action is still visible and can be queried from the signal handler.

unstable since: 2.28

GActionGroup::action-state-changed

Signals that the state of the named action has changed.

unstable since: 2.28

Class structure

struct ValentDevicePluginClass {
  ValentExtensionClass parent_class;
  void (* handle_packet) (
    ValentDevicePlugin* plugin,
    const char* type,
    JsonNode* packet
  );
  void (* update_state) (
    ValentDevicePlugin* plugin,
    ValentDeviceState state
  );
  
}

The virtual function table for ValentDevicePlugin.

Class members
parent_class: ValentExtensionClass
No description available.
handle_packet: void (* handle_packet) ( ValentDevicePlugin* plugin, const char* type, JsonNode* packet )

The virtual function pointer for valent_device_plugin_handle_packet()

update_state: void (* update_state) ( ValentDevicePlugin* plugin, ValentDeviceState state )

The virtual function pointer for valent_device_plugin_update_state()

Virtual methods

Valent.DevicePluginClass.handle_packet

Handle a packet from the device the plugin is bound to.

unstable since: 1.0

Valent.DevicePluginClass.update_state

Update the plugin based on the new state of the device.

unstable since: 1.0