aboutsummaryrefslogtreecommitdiff
path: root/libqmenumodel/src/unitymenumodelevents.cpp
diff options
context:
space:
mode:
authorAlbert Astals Cid <albert.astals@canonical.com>2017-02-28 17:43:28 +0100
committerAlbert Astals Cid <albert.astals@canonical.com>2017-02-28 17:43:28 +0100
commit87ea781595dfbe0274ede247f9d50610079787c8 (patch)
tree1ac78772495b5f4a0d67da4a04466a28310820de /libqmenumodel/src/unitymenumodelevents.cpp
parent2eaa36e38c910a0ee2450ac7ccae6473d359eb58 (diff)
downloadqmenumodel-87ea781595dfbe0274ede247f9d50610079787c8.tar.gz
qmenumodel-87ea781595dfbe0274ede247f9d50610079787c8.tar.bz2
qmenumodel-87ea781595dfbe0274ede247f9d50610079787c8.zip
Batch add and removes into the model
Diffstat (limited to 'libqmenumodel/src/unitymenumodelevents.cpp')
-rw-r--r--libqmenumodel/src/unitymenumodelevents.cpp20
1 files changed, 12 insertions, 8 deletions
diff --git a/libqmenumodel/src/unitymenumodelevents.cpp b/libqmenumodel/src/unitymenumodelevents.cpp
index e03d1c7..55cbaf0 100644
--- a/libqmenumodel/src/unitymenumodelevents.cpp
+++ b/libqmenumodel/src/unitymenumodelevents.cpp
@@ -35,26 +35,30 @@ UnityMenuModelClearEvent::UnityMenuModelClearEvent(bool _reset)
reset(_reset)
{}
-UnityMenuModelAddRowEvent::UnityMenuModelAddRowEvent(GtkMenuTrackerItem *_item, int _position)
+UnityMenuModelAddRowEvent::UnityMenuModelAddRowEvent(GPtrArray *_items, int _position)
: QEvent(UnityMenuModelAddRowEvent::eventType),
- item(_item),
+ items(_items),
position(_position)
{
- if (item) {
- g_object_ref(item);
+ if (items) {
+ for (gint i = 0; i < items->len; ++i)
+ g_object_ref(g_ptr_array_index(items, i));
+ g_ptr_array_ref(items);
}
}
UnityMenuModelAddRowEvent::~UnityMenuModelAddRowEvent()
{
- if (item) {
- g_object_unref(item);
+ if (items) {
+ for (gint i = 0; i < items->len; ++i)
+ g_object_ref(g_ptr_array_index(items, i));
+ g_ptr_array_unref(items);
}
}
-UnityMenuModelRemoveRowEvent::UnityMenuModelRemoveRowEvent(int _position)
+UnityMenuModelRemoveRowEvent::UnityMenuModelRemoveRowEvent(int _position, int _nItems)
: QEvent(UnityMenuModelRemoveRowEvent::eventType),
- position(_position)
+ position(_position), nItems(_nItems)
{}
UnityMenuModelDataChangeEvent::UnityMenuModelDataChangeEvent(int _position)