/* Copyright (C) 2016 The giomm Development Team
*
* This library is free software; you can redistribute it and/or
* modify it under the terms of the GNU Lesser General Public
* License as published by the Free Software Foundation; either
* version 2.1 of the License, or (at your option) any later version.
*
* This library is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
* Lesser General Public License for more details.
*
* You should have received a copy of the GNU Lesser General Public
* License along with this library. If not, see .
*/
#include
#include
namespace
{
extern "C"
{
int ListStoreBase_CompareDataFunc(gconstpointer a, gconstpointer b, gpointer user_data)
{
auto slot = static_cast(user_data);
const Glib::RefPtr item_a =
Glib::wrap(static_cast(const_cast(a)), true);
const Glib::RefPtr item_b =
Glib::wrap(static_cast(const_cast(b)), true);
return (*slot)(item_a, item_b);
}
}
} // anonymous namespace
namespace Gio
{
void ListStoreBase::splice(guint position, guint n_removals,
const std::vector>& additions)
{
const std::size_t n_additions = additions.size();
std::unique_ptr g_additions{new gpointer[n_additions]};
for (std::size_t i = 0; i < n_additions; i++)
{
g_additions[i] = additions[i]->gobj();
}
g_list_store_splice(gobj(), position, n_removals, g_additions.get(), n_additions);
}
} // namespace Gio