| 1 | /* |
| 2 | * Copyright (C) 2016 Canonical, Ltd. |
| 3 | * |
| 4 | * This program is free software: you can redistribute it and/or modify it under |
| 5 | * the terms of the GNU Lesser General Public License version 3, as published by |
| 6 | * the Free Software Foundation. |
| 7 | * |
| 8 | * This program is distributed in the hope that it will be useful, but WITHOUT |
| 9 | * ANY WARRANTY; without even the implied warranties of MERCHANTABILITY, |
| 10 | * SATISFACTORY QUALITY, or FITNESS FOR A PARTICULAR PURPOSE. See the GNU |
| 11 | * Lesser General Public License for more details. |
| 12 | * |
| 13 | * You should have received a copy of the GNU Lesser General Public License |
| 14 | * along with this program. If not, see <http://www.gnu.org/licenses/>. |
| 15 | */ |
| 16 | |
| 17 | #ifndef MENUREGISTRAR_H |
| 18 | #define MENUREGISTRAR_H |
| 19 | |
| 20 | #include <QObject> |
| 21 | #include <QWindow> |
| 22 | #include <QPointer> |
| 23 | #include <QDBusObjectPath> |
| 24 | |
| 25 | #include <gio/gio.h> |
| 26 | |
| 27 | class LomiriMenuRegistrar : public QObject |
| 28 | { |
| 29 | Q_OBJECT |
| 30 | public: |
| 31 | LomiriMenuRegistrar(); |
| 32 | ~LomiriMenuRegistrar(); |
| 33 | |
| 34 | void registerMenuForWindow(QWindow* window, const QDBusObjectPath& path); |
| 35 | void unregisterMenu(); |
| 36 | |
| 37 | private Q_SLOTS: |
| 38 | void registerSurfaceMenu(); |
| 39 | void onRegistrarServiceChanged(); |
| 40 | |
| 41 | private: |
| 42 | void registerMenu(); |
| 43 | |
| 44 | void registerApplicationMenu(); |
| 45 | void unregisterApplicationMenu(); |
| 46 | |
| 47 | void unregisterSurfaceMenu(); |
| 48 | |
| 49 | GDBusConnection *m_connection; |
| 50 | QString m_service; |
| 51 | QDBusObjectPath m_path; |
| 52 | QPointer<QWindow> m_window; |
| 53 | QString m_registeredSurfaceId; |
| 54 | pid_t m_registeredProcessId; |
| 55 | }; |
| 56 | |
| 57 | |
| 58 | #endif // MENUREGISTRAR_H |
| 59 |