2 * This file is part of the sigrok project.
4 * Copyright (C) 2011 Gareth McMullin <gareth@blacksphere.co.nz>
6 * This program is free software: you can redistribute it and/or modify
7 * it under the terms of the GNU General Public License as published by
8 * the Free Software Foundation, either version 3 of the License, or
9 * (at your option) any later version.
11 * This program is distributed in the hope that it will be useful,
12 * but WITHOUT ANY WARRANTY; without even the implied warranty of
13 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
14 * GNU General Public License for more details.
16 * You should have received a copy of the GNU General Public License
17 * along with this program. If not, see <http://www.gnu.org/licenses/>.
31 {"sigrok_logo.png", "sigrok-logo"},
34 static gint n_stock_icons = G_N_ELEMENTS (stock_icons);
36 void icons_register(void)
38 GtkIconFactory *icon_factory;
40 GtkIconSource *icon_source;
46 sysdir = g_win32_get_package_installation_directory_of_module(NULL);
47 g_build_filename(sysdir, "share", PACKAGE_TARNAME, "icons", NULL);
50 tmp = g_build_filename(PKG_DATA_DIR, "icons", NULL);
52 icon_factory = gtk_icon_factory_new ();
53 gtk_icon_factory_add_default (icon_factory);
54 icon_source = gtk_icon_source_new ();
56 for(i = 0; i < n_stock_icons; i++) {
58 g_build_filename(tmp, stock_icons[i].filename, NULL);
60 icon_set = gtk_icon_set_new ();
61 gtk_icon_source_set_filename(icon_source, filename);
62 gtk_icon_source_set_icon_name(icon_source, stock_icons[i].stock_id);
63 gtk_icon_set_add_source (icon_set, icon_source);
64 gtk_icon_factory_add (icon_factory, stock_icons[i].stock_id, icon_set);
69 gtk_icon_source_free (icon_source);
70 g_object_unref (icon_factory);