forked from quickshell/quickshell
core/menu: add handle support to QsMenuOpener + add handle to tray
This commit is contained in:
parent
acdbe73c10
commit
54350277be
6 changed files with 101 additions and 51 deletions
|
@ -519,7 +519,7 @@ void DBusMenuHandle::setAddress(const QString& service, const QString& path) {
|
|||
this->onMenuPathChanged();
|
||||
}
|
||||
|
||||
void DBusMenuHandle::ref() {
|
||||
void DBusMenuHandle::refHandle() {
|
||||
this->refcount++;
|
||||
qCDebug(logDbusMenu) << this << "gained a reference. Refcount is now" << this->refcount;
|
||||
|
||||
|
@ -532,7 +532,7 @@ void DBusMenuHandle::ref() {
|
|||
}
|
||||
}
|
||||
|
||||
void DBusMenuHandle::unref() {
|
||||
void DBusMenuHandle::unrefHandle() {
|
||||
this->refcount--;
|
||||
qCDebug(logDbusMenu) << this << "lost a reference. Refcount is now" << this->refcount;
|
||||
|
||||
|
@ -564,9 +564,7 @@ void DBusMenuHandle::onMenuPathChanged() {
|
|||
}
|
||||
}
|
||||
|
||||
QsMenuEntry* DBusMenuHandle::menu() const {
|
||||
return this->loaded ? &this->mMenu->rootItem : nullptr;
|
||||
}
|
||||
QsMenuEntry* DBusMenuHandle::menu() { return this->loaded ? &this->mMenu->rootItem : nullptr; }
|
||||
|
||||
QDebug operator<<(QDebug debug, const DBusMenuHandle* handle) {
|
||||
if (handle) {
|
||||
|
|
|
@ -162,19 +162,15 @@ class DBusMenuHandle;
|
|||
QDebug operator<<(QDebug debug, const DBusMenuHandle* handle);
|
||||
|
||||
class DBusMenuHandle: public menu::QsMenuHandle {
|
||||
Q_OBJECT;
|
||||
QML_ELEMENT;
|
||||
QML_UNCREATABLE("");
|
||||
|
||||
public:
|
||||
explicit DBusMenuHandle(QObject* parent): menu::QsMenuHandle(parent) {}
|
||||
|
||||
void setAddress(const QString& service, const QString& path);
|
||||
|
||||
void ref() override;
|
||||
void unref() override;
|
||||
void refHandle() override;
|
||||
void unrefHandle() override;
|
||||
|
||||
[[nodiscard]] QsMenuEntry* menu() const override;
|
||||
[[nodiscard]] QsMenuEntry* menu() override;
|
||||
|
||||
private:
|
||||
void onMenuPathChanged();
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue