Budgie.Applet

g Atk.ImplementorIface Atk.ImplementorIface Gtk.Widget Gtk.Widget Atk.ImplementorIface->Gtk.Widget Budgie.Applet Budgie.Applet GObject.GInterface GObject.GInterface GObject.GInterface->Atk.ImplementorIface Gtk.Buildable Gtk.Buildable GObject.GInterface->Gtk.Buildable GObject.InitiallyUnowned GObject.InitiallyUnowned GObject.InitiallyUnowned->Gtk.Widget GObject.Object GObject.Object GObject.Object->GObject.InitiallyUnowned Gtk.Bin Gtk.Bin Gtk.EventBox Gtk.EventBox Gtk.Bin->Gtk.EventBox Gtk.Buildable->Gtk.Widget Gtk.Container Gtk.Container Gtk.Container->Gtk.Bin Gtk.EventBox->Budgie.Applet Gtk.Widget->Gtk.Container

Subclasses:None

Virtual Methods

Inherited:Gtk.Container (10), Gtk.Widget (82), GObject.Object (7), Gtk.Buildable (10)
  do_get_settings_ui ()
  do_invoke_action (action)
  do_panel_position_changed (position)
  do_panel_size_changed (panel_size, icon_size, small_icon_size)
  do_supports_settings ()
  do_update_popovers (manager)

Properties

Inherited:Gtk.EventBox (2), Gtk.Container (3), Gtk.Widget (39)
Name Type Flags Short Description
settings-prefix str r/w Set the Gio.Settings schema prefix
settings-schema str r/w Set the Gio.Settings relocatable schema ID
supported-actions Budgie.PanelAction r/w Get/set the supported panel actions

Style Properties

Inherited:Gtk.Widget (17)

Signals

Inherited:Gtk.Container (4), Gtk.Widget (69), GObject.Object (1)
Name Short Description
panel-position-changed Used to notify this applet of a change in the panel’s placement on screen, so that it may adjust its own layout to better suit the geometry.
panel-size-changed Used to notify this applet of a change in the panel size

Fields

Inherited:Gtk.Container (4), Gtk.Widget (69), GObject.Object (1)
Name Type Access Description
parent_instance Gtk.EventBox r  

Class Details

class Budgie.Applet(**kwargs)
Bases:Gtk.EventBox
Abstract:No
Structure:Budgie.AppletClass
classmethod new()
Returns:A new Budgie.Applet
Return type:Budgie.Applet
get_applet_settings(uuid)
Parameters:uuid (str) – UUID for this instance
Returns:A newly created Gio.Settings for this applet instance
Return type:Gio.Settings

If your Budgie.Plugin implementation passes the UUID to your Budgie.Applet implementation on construction, you can take advantage of per-instance settings.

For most applets, global Gio.Settings keys are more than suffice. However, in some situations, it may be beneficial to enable multiple unique instances of your applet, each with their own configuration.

To facilitate this, use this function to create a new relocatable settings instance using your UUID. Make sure you set the Budgie.Applet :settings-schema and Budgie.Applet :settings-prefix properties first.

get_settings_prefix()
Return type:str

Utility function for Python usage. See: Budgie.Applet :settings-prefix

get_settings_schema()
Return type:str

Utility function for Python usage. See Budgie.Applet :settings-schema

get_settings_ui()
Returns:A GTK Settings UI
Return type:Gtk.Widget or None

For applets that need to expose settings, they should both override the #BudgieApplet::supports_settings method and return a new widget instance whenever this function is invoked.

This UI will live in the Raven sidebar within the Budgie Desktop, and will be destroyed as soon as it’s not being used. It’s advisable to keep this widget implementation light, and to prefer vertical space.

get_supported_actions()
Return type:Budgie.PanelAction

Utility function for Python bindings. See Budgie.Applet :supported-actions

invoke_action(action)
Parameters:action (Budgie.PanelAction) – Action to invoke

Invoke the given action on this applet. This action will only be one that has been declared in supported actions bitmask.

To allow better integration between the Budgie Desktop, and the applets that live within it, the panel will relay actions to applets that have set their Budgie.Applet :supported-actions to a matching bitmask.

For example, if we wish to listen for Menu Key events, we can simply do the following in C:

static void my_applet_invoke_action(BudgieApplet *applet, BudgiePanelAction action)
{
        if (action == BUDGIE_PANEL_ACTION_MENU) {
                my_applet_do_predict_the_lottery(MY_APPLET(applet));
        }
}

static void my_class_init(GObjectClass *class)
{
        MyClass *mc = MY_CLASS(klass);
        ..
        mc->invoke_action = my_applet_invoke_action;
}

Likewise, a Vala implementation might look like the following:

public override void invoke_action(Budgie.PanelAction action)
{
    if (action == Budgie.PanelAction.MENU) {
        this.predict_the_lottery();
    }
}
set_settings_prefix(prefix)
Parameters:prefix (str) –

Utility function for Python usage. See: Budgie.Applet :settings-prefix

set_settings_schema(schema)
Parameters:schema (str) –

Utility function for Python usage. See Budgie.Applet :settings-schema

supports_settings()
Returns:true if this implementation supports a Settings UI
Return type:bool

Implementations should override this to return True if they support a settings UI

update_popovers(manager)
Parameters:manager (Budgie.PopoverManager or None) –

This virtual method should be implemented by panel applets that wish to support Gtk.Popover’s natively. As each Budgie Panel may house multiple Gtk.Popover widgets, each one must be registered with the manager.

During this call, it is safe to store a reference to the manager. In this call you should invoke #BudgiePopoverManager::register_popover to register your popover with the panel manager.

Each registered popover joins the global menu system of popovers in the panel. It is a requirement to register, otherwise the panel will not know when to expand and collapse the main panel harness to accommodate the Gtk.Popover.

do_get_settings_ui() virtual
Returns:A GTK Settings UI
Return type:Gtk.Widget or None

For applets that need to expose settings, they should both override the #BudgieApplet::supports_settings method and return a new widget instance whenever this function is invoked.

This UI will live in the Raven sidebar within the Budgie Desktop, and will be destroyed as soon as it’s not being used. It’s advisable to keep this widget implementation light, and to prefer vertical space.

do_invoke_action(action) virtual
Parameters:action (Budgie.PanelAction) – Action to invoke

Invoke the given action on this applet. This action will only be one that has been declared in supported actions bitmask.

To allow better integration between the Budgie Desktop, and the applets that live within it, the panel will relay actions to applets that have set their Budgie.Applet :supported-actions to a matching bitmask.

For example, if we wish to listen for Menu Key events, we can simply do the following in C:

static void my_applet_invoke_action(BudgieApplet *applet, BudgiePanelAction action)
{
        if (action == BUDGIE_PANEL_ACTION_MENU) {
                my_applet_do_predict_the_lottery(MY_APPLET(applet));
        }
}

static void my_class_init(GObjectClass *class)
{
        MyClass *mc = MY_CLASS(klass);
        ..
        mc->invoke_action = my_applet_invoke_action;
}

Likewise, a Vala implementation might look like the following:

public override void invoke_action(Budgie.PanelAction action)
{
    if (action == Budgie.PanelAction.MENU) {
        this.predict_the_lottery();
    }
}
do_panel_position_changed(position) virtual
Parameters:position (Budgie.PanelPosition) –
do_panel_size_changed(panel_size, icon_size, small_icon_size) virtual
Parameters:
  • panel_size (int) –
  • icon_size (int) –
  • small_icon_size (int) –
do_supports_settings() virtual
Returns:true if this implementation supports a Settings UI
Return type:bool

Implementations should override this to return True if they support a settings UI

do_update_popovers(manager) virtual
Parameters:manager (Budgie.PopoverManager or None) –

This virtual method should be implemented by panel applets that wish to support Gtk.Popover’s natively. As each Budgie Panel may house multiple Gtk.Popover widgets, each one must be registered with the manager.

During this call, it is safe to store a reference to the manager. In this call you should invoke #BudgiePopoverManager::register_popover to register your popover with the panel manager.

Each registered popover joins the global menu system of popovers in the panel. It is a requirement to register, otherwise the panel will not know when to expand and collapse the main panel harness to accommodate the Gtk.Popover.

Signal Details

Budgie.Applet.signals.panel_position_changed(applet, position)
Signal Name:

panel-position-changed

Flags:

RUN_LAST, ACTION

Parameters:

Used to notify this applet of a change in the panel’s placement on screen, so that it may adjust its own layout to better suit the geometry.

Budgie.Applet.signals.panel_size_changed(applet, panel_size, icon_size, small_icon_size)
Signal Name:

panel-size-changed

Flags:

RUN_LAST, ACTION

Parameters:
  • applet (Budgie.Applet) – The object which received the signal
  • panel_size (int) – The new panel size
  • icon_size (int) – Larget possible icon size for the panel
  • small_icon_size (int) – Smaller icon that will still fit on the panel

Used to notify this applet of a change in the panel size

Property Details

Budgie.Applet.props.settings_prefix
Name:settings-prefix
Type:str
Default Value:None
Flags:READABLE, WRITABLE

The Gio.Settings schema path prefix for this applet

For applets that require unique instance configuration, the panel management must know where to initialise the settings within the tree. The path takes the form:

$SETTINGS_PREFIX/{$UUID}

As an example, the Budgie Menu Applet set’s the settings-prefix to: /com/solus-project/budgie-panel/instance/budgie-menu.

This results in relocatable schemas being created at:

/com/solus-project/budgie-panel/instance/budgie-menu/{$UUID}

Budgie.Applet.props.settings_schema
Name:settings-schema
Type:str
Default Value:None
Flags:READABLE, WRITABLE

The ID of the Gio.Settings schema used by this applet

This only takes effect when you’ve also set Budgie.Applet :settings-prefix, and is used by the panel managemen to both initialise and delete your per-instance settings, respectively.

As an example, the Budgie Menu Applet uses the schema:

com.solus-project.budgie-menu

as defined by the accompanying gschema XML file. Providing an incorrect schema ID is considered programmer error.

Budgie.Applet.props.supported_actions
Name:supported-actions
Type:Budgie.PanelAction
Default Value:Budgie.PanelAction.NONE
Flags:READABLE, WRITABLE

The actions supported by this applet instance