diff options
-rw-r--r-- | examples/render-menumodel.qml | 14 | ||||
-rw-r--r-- | libqmenumodel/src/qdbusactiongroup.cpp | 1 | ||||
-rw-r--r-- | libqmenumodel/src/qdbusactiongroup.h | 6 | ||||
-rw-r--r-- | libqmenumodel/src/qdbusmenumodel.cpp | 4 | ||||
-rw-r--r-- | libqmenumodel/src/qdbusmenumodel.h | 4 | ||||
-rw-r--r-- | libqmenumodel/src/qdbusobject.cpp | 1 | ||||
-rw-r--r-- | libqmenumodel/src/qdbusobject.h | 9 | ||||
-rw-r--r-- | libqmenumodel/src/qmenumodel.cpp | 4 | ||||
-rw-r--r-- | libqmenumodel/src/qmenumodel.h | 7 |
9 files changed, 37 insertions, 13 deletions
diff --git a/examples/render-menumodel.qml b/examples/render-menumodel.qml index 1ad41c5..d7c650e 100644 --- a/examples/render-menumodel.qml +++ b/examples/render-menumodel.qml @@ -15,7 +15,11 @@ Item { busType: DBus.SessionBus busName: "com.canonical.testmenu" objectPath: "/com/canonical/testmenu" - onStatusChanged: console.log("status of menu model changed to", status) + onStatusChanged: { + if (status == DBus.Connecting) { + view.reset() + } + } } ListView { @@ -28,7 +32,6 @@ Item { anchors.margins: 10 spacing: 3 model: menuModel - Component.onCompleted: menuModel.start() delegate: Rectangle { width: parent.width height: 30 @@ -85,6 +88,11 @@ Item { newback.pop() view.__back = newback } + function reset() { + while (view.__back.length > 0) { + goback() + } + } } Rectangle { @@ -132,5 +140,7 @@ Item { font.pixelSize: 11 } } + + Component.onCompleted: menuModel.start() } diff --git a/libqmenumodel/src/qdbusactiongroup.cpp b/libqmenumodel/src/qdbusactiongroup.cpp index fc5b18e..0c1367a 100644 --- a/libqmenumodel/src/qdbusactiongroup.cpp +++ b/libqmenumodel/src/qdbusactiongroup.cpp @@ -22,6 +22,7 @@ #include "converter.h" extern "C" { +#include <glib.h> #include <gio/gio.h> } diff --git a/libqmenumodel/src/qdbusactiongroup.h b/libqmenumodel/src/qdbusactiongroup.h index 518f78c..beaca24 100644 --- a/libqmenumodel/src/qdbusactiongroup.h +++ b/libqmenumodel/src/qdbusactiongroup.h @@ -27,6 +27,12 @@ class QStateAction; +typedef char gchar; +typedef void* gpointer; +typedef struct _GVariant GVariant; +typedef struct _GActionGroup GActionGroup; +typedef struct _GDBusActionGroup GDBusActionGroup; + class QDBusActionGroup : public QObject, public QDBusObject { Q_OBJECT diff --git a/libqmenumodel/src/qdbusmenumodel.cpp b/libqmenumodel/src/qdbusmenumodel.cpp index ae88c35..f3da989 100644 --- a/libqmenumodel/src/qdbusmenumodel.cpp +++ b/libqmenumodel/src/qdbusmenumodel.cpp @@ -17,6 +17,10 @@ * Renato Araujo Oliveira Filho <renato@canonical.com> */ +extern "C" { +#include <gio/gio.h> +} + #include "qdbusmenumodel.h" /*! diff --git a/libqmenumodel/src/qdbusmenumodel.h b/libqmenumodel/src/qdbusmenumodel.h index 767451a..6943613 100644 --- a/libqmenumodel/src/qdbusmenumodel.h +++ b/libqmenumodel/src/qdbusmenumodel.h @@ -23,10 +23,6 @@ #include "qdbusobject.h" #include "qmenumodel.h" -extern "C" { -#include <gio/gio.h> -} - class QDBusMenuModel : public QMenuModel, public QDBusObject { Q_OBJECT diff --git a/libqmenumodel/src/qdbusobject.cpp b/libqmenumodel/src/qdbusobject.cpp index ecb8ee9..5a5a14b 100644 --- a/libqmenumodel/src/qdbusobject.cpp +++ b/libqmenumodel/src/qdbusobject.cpp @@ -19,6 +19,7 @@ extern "C" { #include <glib-object.h> +#include <gio/gio.h> } #include "qdbusobject.h" diff --git a/libqmenumodel/src/qdbusobject.h b/libqmenumodel/src/qdbusobject.h index ef2b42f..324d3fd 100644 --- a/libqmenumodel/src/qdbusobject.h +++ b/libqmenumodel/src/qdbusobject.h @@ -20,14 +20,15 @@ #ifndef QDBUSOBJECT_H #define QDBUSOBJECT_H -extern "C" { -#include <gio/gio.h> -} - #include <QString> #include "dbus-enums.h" +typedef unsigned int guint; +typedef char gchar; +typedef void* gpointer; +typedef struct _GDBusConnection GDBusConnection; + class QDBusObject { public: diff --git a/libqmenumodel/src/qmenumodel.cpp b/libqmenumodel/src/qmenumodel.cpp index 4c0fc23..1aaf210 100644 --- a/libqmenumodel/src/qmenumodel.cpp +++ b/libqmenumodel/src/qmenumodel.cpp @@ -17,6 +17,10 @@ * Renato Araujo Oliveira Filho <renato@canonical.com> */ +extern "C" { +#include <gio/gio.h> +} + #include "qmenumodel.h" #include "converter.h" diff --git a/libqmenumodel/src/qmenumodel.h b/libqmenumodel/src/qmenumodel.h index 7520480..b5c76c0 100644 --- a/libqmenumodel/src/qmenumodel.h +++ b/libqmenumodel/src/qmenumodel.h @@ -22,9 +22,10 @@ #include <QAbstractListModel> -extern "C" { -#include <gio/gio.h> -} +typedef int gint; +typedef unsigned int guint; +typedef void* gpointer; +typedef struct _GMenuModel GMenuModel; class QMenuModel : public QAbstractListModel { |