From e735d95e613e2ee6170799002183e0770d34590e Mon Sep 17 00:00:00 2001 From: Lars Uebernickel Date: Wed, 5 Jun 2013 13:50:12 -0400 Subject: unitymenumodel: add activate() --- libqmenumodel/src/unitymenumodel.cpp | 17 +++++++++++++++++ libqmenumodel/src/unitymenumodel.h | 3 +++ 2 files changed, 20 insertions(+) (limited to 'libqmenumodel') 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 UnityMenuModel::roleNames() const return names; } + +#include + +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 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); -- cgit v1.2.3