=== modified file 'src/CMakeLists.txt'
--- src/CMakeLists.txt 2012-02-27 14:27:17 +0000
+++ src/CMakeLists.txt 2013-01-04 10:33:53 +0000
@@ -15,6 +15,10 @@
${QT_QTXML_INCLUDE_DIR}
)
+qt4_add_dbus_interface(appmenu_qt_SRCS com.canonical.AppMenu.Registrar.xml
+ registrar)
+
+
qt4_automoc(${appmenu_qt_SRCS})
link_directories(
=== modified file 'src/appmenuplatformmenubar.cpp'
--- src/appmenuplatformmenubar.cpp 2012-04-04 16:06:06 +0000
+++ src/appmenuplatformmenubar.cpp 2013-01-04 10:36:25 +0000
@@ -15,6 +15,7 @@
along with appmenu-qt. If not, see .
*/
#include "appmenuplatformmenubar.h"
+#include "registrar.h"
// dbusmenu-qt
#include
@@ -393,6 +394,8 @@
bool MenuBarAdapter::registerWindow()
{
+ static com::canonical::AppMenu::Registrar *registrar = 0;
+
if (!m_menuBar->window()) {
WARN << "No parent for this menubar";
return false;
@@ -403,9 +406,8 @@
return true;
}
- QDBusInterface host(REGISTRAR_SERVICE, REGISTRAR_PATH, REGISTRAR_IFACE);
- if (!host.isValid()) {
- return false;
+ if (!registrar) {
+ registrar = new com::canonical::AppMenu::Registrar(REGISTRAR_SERVICE, REGISTRAR_PATH, QDBusConnection::sessionBus(), 0);
}
Q_FOREACH(QAction *action, m_menuBar->actions()) {
@@ -428,8 +430,9 @@
}
m_registeredWinId = winId;
- QVariant path = QVariant::fromValue(QDBusObjectPath(m_objectPath));
- host.asyncCall(QLatin1String("RegisterWindow"), QVariant(winId), path);
+ if (registrar) {
+ registrar->RegisterWindow(winId, QDBusObjectPath(m_objectPath));
+ }
return true;
}
=== added file 'src/com.canonical.AppMenu.Registrar.xml'
--- src/com.canonical.AppMenu.Registrar.xml 1970-01-01 00:00:00 +0000
+++ src/com.canonical.AppMenu.Registrar.xml 2013-01-04 10:04:35 +0000
@@ -0,0 +1,56 @@
+
+
+
+
+
+ An interface to register a menu from an application's window to be displayed in another
+ window. This manages that association between XWindow Window IDs and the dbus
+ address and object that provides the menu using the dbusmenu dbus interface.
+
+
+
+
+ The XWindow ID of the window
+
+
+ The object on the dbus interface implementing the dbusmenu interface
+
+
+
+
+ A method to allow removing a window from the database. Windows will also be removed
+ when the client drops off DBus so this is not required. It is polite though. And
+ important for testing.
+
+
+ The XWindow ID of the window
+
+
+
+ Gets the registered menu for a given window ID.
+
+ The XWindow ID of the window to get
+
+
+ The address of the connection on DBus (e.g. :1.23 or org.example.service)
+
+
+ The path to the object which implements the com.canonical.dbusmenu interface.
+
+
+
+