appsMenu: Add side parameter

In order to re-use the menu in the overview, we must be able to
change the side of the arrow, so expose the parent class parameter.

Part-of: <https://gitlab.gnome.org/GNOME/gnome-shell/-/merge_requests/1948>
This commit is contained in:
Florian Müllner 2021-08-11 22:53:54 +02:00 committed by Marge Bot
parent 0f5881788c
commit 958fb6fddc

View File

@ -1,6 +1,6 @@
// -*- mode: js; js-indent-level: 4; indent-tabs-mode: nil -*- // -*- mode: js; js-indent-level: 4; indent-tabs-mode: nil -*-
/* exported AppMenu */ /* exported AppMenu */
const { Gio, GLib, Meta, Shell, St } = imports.gi; const { Clutter, Gio, GLib, Meta, Shell, St } = imports.gi;
const PopupMenu = imports.ui.popupMenu; const PopupMenu = imports.ui.popupMenu;
const Main = imports.ui.main; const Main = imports.ui.main;
@ -8,9 +8,17 @@ const Main = imports.ui.main;
var AppMenu = class AppMenu extends PopupMenu.PopupMenu { var AppMenu = class AppMenu extends PopupMenu.PopupMenu {
/** /**
* @param {Clutter.Actor} sourceActor - actor the menu is attached to * @param {Clutter.Actor} sourceActor - actor the menu is attached to
* @param {St.Side} side - arrow side
*/ */
constructor(sourceActor) { constructor(sourceActor, side = St.Side.TOP) {
super(sourceActor, 0.5, St.Side.TOP); if (Clutter.get_default_text_direction() === Clutter.TextDirection.RTL) {
if (side === St.Side.LEFT)
side = St.Side.RIGHT;
else if (side === St.Side.RIGHT)
side = St.Side.LEFT;
}
super(sourceActor, 0.5, side);
this.actor.add_style_class_name('app-menu'); this.actor.add_style_class_name('app-menu');