/* Copyright (C) 2006 The gtkmm 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 Gtk
{
std::vector RecentInfo::get_applications() const
{
gsize length = 0;
char** const applications =
gtk_recent_info_get_applications(const_cast(gobj()), &length);
return Glib::ArrayHandler::array_to_vector(applications, length, Glib::OWNERSHIP_DEEP);
}
bool RecentInfo::get_application_info(const Glib::ustring& app_name, std::string& app_exec,
guint& count, std::time_t& time_) const
{
const char* app_exec_cstr = nullptr;
const int found = gtk_recent_info_get_application_info(
const_cast(gobj()), app_name.c_str(), &app_exec_cstr, &count, &time_);
if (app_exec_cstr)
app_exec = app_exec_cstr;
else
app_exec.erase();
return (found != 0);
}
std::vector RecentInfo::get_groups() const
{
gsize length = 0;
char** const groups = gtk_recent_info_get_groups(const_cast(gobj()), &length);
return Glib::ArrayHandler::array_to_vector(groups, length, Glib::OWNERSHIP_DEEP);
}
RecentInfoTraits::CppType RecentInfoTraits::to_cpp_type(const CType& obj)
{
return Glib::wrap(const_cast(obj), true);
}
} // namespace Gtk
namespace Glib
{
GType Value >::value_type()
{
return gtk_recent_info_get_type();
}
void Value >::set(const CppType& data)
{
set_boxed(Glib::unwrap(data));
}
Value >::CppType Value >::get() const
{
return Glib::wrap(static_cast(get_boxed()), true);
}
} // namespace Glib