aboutsummaryrefslogtreecommitdiff
path: root/libqmenumodel
diff options
context:
space:
mode:
Diffstat (limited to 'libqmenumodel')
-rw-r--r--libqmenumodel/src/unitymenumodel.cpp17
-rw-r--r--libqmenumodel/src/unitymenumodel.h3
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);