fix .desktop file
[gconf-editor] / src / gconf-stock-icons.c
1 /*
2  * Copyright (C) 2001, 2002 Anders Carlsson <andersca@gnu.org>
3  *
4  * This program is free software; you can redistribute it and/or
5  * modify it under the terms of the GNU General Public License as
6  * published by the Free Software Foundation; either version 2 of the
7  * License, or (at your option) any later version.
8  *
9  * This program is distributed in the hope that it will be useful,
10  * but WITHOUT ANY WARRANTY; without even the implied warranty of
11  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
12  * General Public License for more details.
13  *
14  * You should have received a copy of the GNU General Public License
15  * along with this program; if not, write to the Free Software
16  * Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
17  */
18
19 #include <config.h>
20
21 #include "gconf-stock-icons.h"
22
23 #include <gtk/gtk.h>
24
25
26 static const char *icon_theme_items[] =
27 {
28         STOCK_BOOKMARK,
29         STOCK_EDIT_BOOKMARK
30 };
31
32 void
33 gconf_stock_icons_register (void)
34 {
35         GtkIconFactory *icon_factory;
36         GtkIconSet *set;
37         GtkIconSource *icon_source;
38         int i;
39         static gboolean initialized = FALSE;
40
41         if (initialized == TRUE) {
42                 return;
43         }
44
45         icon_factory = gtk_icon_factory_new ();
46         gtk_icon_factory_add_default (icon_factory);
47
48         for (i = 0; i < (int) G_N_ELEMENTS (icon_theme_items); i++)
49         {
50                 set = gtk_icon_set_new ();
51                 icon_source = gtk_icon_source_new ();
52                 gtk_icon_source_set_icon_name (icon_source, icon_theme_items[i]);
53                 gtk_icon_set_add_source (set, icon_source);
54                 gtk_icon_factory_add (icon_factory, icon_theme_items[i], set);
55                 gtk_icon_set_unref (set);
56                 gtk_icon_source_free (icon_source);
57         }
58
59         g_object_unref (G_OBJECT (icon_factory));
60
61         initialized = TRUE;
62 }