Debian Codegraph @

gtk/src/icontheme.ccg

raw
1 /* Copyright (C) 2003 The gtkmm Development Team
2 *
3 * This library is free software; you can redistribute it and/or
4 * modify it under the terms of the GNU Lesser General Public
5 * License as published by the Free Software Foundation; either
6 * version 2.1 of the License, or (at your option) any later version.
7 *
8 * This library is distributed in the hope that it will be useful,
9 * but WITHOUT ANY WARRANTY; without even the implied warranty of
10 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
11 * Lesser General Public License for more details.
12 *
13 * You should have received a copy of the GNU Lesser General Public
14 * License along with this library; if not, see <https://www.gnu.org/licenses/>.
15 */
16
17 #include <glibmm/vectorutils.h>
18
19 #include <gtk/gtk.h> //For gtk_icon_theme_error_get_type().
20
21
22 namespace Gtk
23 {
24
25 void IconTheme::set_search_path(const std::vector<Glib::ustring>& path)
26 {
27 gtk_icon_theme_set_search_path(gobj(), const_cast<const char**>(Glib::ArrayHandler<Glib::ustring>::vector_to_array(path).data ()), path.size());
28 }
29
30 std::vector<Glib::ustring> IconTheme::get_search_path() const
31 {
32 int temp_int = 0;
33 gchar** temp_path = nullptr;
34 gtk_icon_theme_get_search_path(const_cast<GtkIconTheme*>(gobj()), &temp_path, &temp_int);
35 return Glib::ArrayHandler<Glib::ustring>::array_to_vector(temp_path, temp_int, Glib::OWNERSHIP_DEEP);
36 }
37
38 std::vector<int> IconTheme::get_icon_sizes(const Glib::ustring& icon_name) const
39 {
40 int* pArrayInts = gtk_icon_theme_get_icon_sizes(const_cast<GtkIconTheme*>(gobj()), icon_name.c_str());
41
42 //pArrayInts is null-terminated.
43 return Glib::ArrayHandler<int>::array_to_vector(pArrayInts, Glib::OWNERSHIP_SHALLOW);
44 }
45
46 std::vector<Glib::ustring> IconTheme::list_icons() const
47 {
48 return Glib::ListHandler<Glib::ustring>::list_to_vector(gtk_icon_theme_list_icons(const_cast<GtkIconTheme*>(gobj()), nullptr /* means all icons according to the C documentation. */ ), Glib::OWNERSHIP_DEEP);
49 }
50
51 } // namespace Gtk