diff options
author | Lars Uebernickel <lars.uebernickel@canonical.com> | 2013-06-05 13:50:12 -0400 |
---|---|---|
committer | Lars Uebernickel <lars.uebernickel@canonical.com> | 2013-06-05 13:50:12 -0400 |
commit | e735d95e613e2ee6170799002183e0770d34590e (patch) | |
tree | d8f823bb8f17a9db0f4105f0566cf4b862e5476d /libqmenumodel | |
parent | 692926cb12c8f8e6d3969c249dbf924a0bd1499b (diff) | |
download | qmenumodel-e735d95e613e2ee6170799002183e0770d34590e.tar.gz qmenumodel-e735d95e613e2ee6170799002183e0770d34590e.tar.bz2 qmenumodel-e735d95e613e2ee6170799002183e0770d34590e.zip |
unitymenumodel: add activate()
Diffstat (limited to 'libqmenumodel')
-rw-r--r-- | libqmenumodel/src/unitymenumodel.cpp | 17 | ||||
-rw-r--r-- | libqmenumodel/src/unitymenumodel.h | 3 |
2 files changed, 20 insertions, 0 deletions
diff --git a/libqmenumodel/src/unitymenumodel.cpp b/libqmenumodel/src/unitymenumodel.cpp index 336b72a..8000222 100644 --- a/libqmenumodel/src/unitymenumodel.cpp +++ b/libqmenumodel/src/unitymenumodel.cpp @@ -37,6 +37,7 @@ public: int nrItems(); QVariant data(int position, int role); + void activate(int position); private: UnityMenuModel *model; @@ -127,6 +128,14 @@ QVariant UnityMenuModelPrivate::data(int position, int role) } } +void UnityMenuModelPrivate::activate(int position) +{ + GtkMenuTrackerItem *item; + + item = (GtkMenuTrackerItem *) g_sequence_get (g_sequence_get_iter_at_pos (this->items, position)); + gtk_menu_tracker_item_activated (item); +} + void UnityMenuModelPrivate::freeMenuItem (gpointer data, gpointer user_data) { GSequenceIter *it = (GSequenceIter *) data; @@ -282,3 +291,11 @@ QHash<int, QByteArray> UnityMenuModel::roleNames() const return names; } + +#include <QDebug> + +void UnityMenuModel::activate(int index) +{ + if (priv) + priv->activate(index); +} diff --git a/libqmenumodel/src/unitymenumodel.h b/libqmenumodel/src/unitymenumodel.h index 75af13a..38dd472 100644 --- a/libqmenumodel/src/unitymenumodel.h +++ b/libqmenumodel/src/unitymenumodel.h @@ -45,6 +45,9 @@ public: QModelIndex parent(const QModelIndex &index) const; QHash<int, QByteArray> roleNames() const; +public Q_SLOTS: + void activate(int index); + protected: UnityMenuModel(QObject *parent = NULL); void init(const QByteArray &busName, const QByteArray &actionGroupObjectPath, const QByteArray &menuObjectPath); |