Skip to content

St.BoxLayout.vertical is deprecated on Gnome 48 [with possible fix] #312

Open
@damian-aragunde-udc

Description

@damian-aragunde-udc

Description:
As I boot up the system and look at the journals, I notice this report:

abr 05 16:51:03 mysetup-lin gnome-shell[1135]: The GObject property St.BoxLayout.vertical is deprecated.
                                               0 setWidgetOrientation() ["file:///home/me/.local/share/gnome-shell/extensions/[email protected]/extension.js":184:5]
                                               1 DefaultMenu() ["file:///home/me/.local/share/gnome-shell/extensions/[email protected]/extension.js":5747:25]
                                               2 enable() ["file:///home/me/.local/share/gnome-shell/extensions/[email protected]/extension.js":6324:25]
                                               3 createIndicator() ["file:///home/me/.local/share/gnome-shell/extensions/[email protected]/extension.js":7492:21]
                                               4 enable() ["file:///home/me/.local/share/gnome-shell/extensions/[email protected]/extension.js":7544:10]
                                               5 _callExtensionEnable() ["resource:///org/gnome/shell/ui/extensionSystem.js":266:38]
                                               6 loadExtension() ["resource:///org/gnome/shell/ui/extensionSystem.js":433:32]
                                               7 InterpretGeneratorResume() ["self-hosted":1417:34]
                                               8 AsyncFunctionNext() ["self-hosted":804:27]
                                               9 anonymous() ["resource:///org/gnome/shell/ui/init.js":21:20]

The search:
So when I looked at the code, I found this:

// Compatibility for GNOME 48+ where 'vertical' was deprecated in favor of 'orientation'
export function setWidgetOrientation(
    widget: { vertical?: boolean; orientation?: Clutter.Orientation },
    vertical: boolean,
) {
    if (widget.orientation) {
        widget.orientation = vertical
            ? Clutter.Orientation.VERTICAL
            : Clutter.Orientation.HORIZONTAL;
    } else {
        widget.vertical = vertical;
    }
}

At src/utils/ui.ts

The possible problem:
It seems that with Gnome 48 it always results in the "else" clause being executed.
So with this condition, the value could be 'negative' until 'orientation' is existing.

My fix:
I used the "in" operation instead:

function setWidgetOrientation(widget, vertical) {
//  if (widget.orientation) {
//    widget.orientation = vertical ? Clutter.Orientation.VERTICAL : Clutter.Orientation.HORIZONTAL;
//  } else {
//    widget.vertical = vertical;
//  }
    if ('orientation' in widget) {
        widget.orientation = vertical
            ? Clutter.Orientation.VERTICAL
            : Clutter.Orientation.HORIZONTAL;
    } else {
        widget.vertical = vertical;
    }
}

Also, from my quick look on the web, the deprecation starts at Gnome 46, not 48. Perhaps this could be corrected in the comments. ;)

Information:

  • Tiling Shell version: 16.3
  • GNOME version: 48.0
  • Distro: Manjaro Linux

Metadata

Metadata

Assignees

No one assigned

    Labels

    questionFurther information is requested

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions