4
* Copyright (C) 2010 Stefan Walter
6
* This program is free software; you can redistribute it and/or modify
7
* it under the terms of the GNU Lesser General Public License as
8
* published by the Free Software Foundation; either version 2.1 of
9
* the License, or (at your option) any later version.
11
* This program is distributed in the hope that it will be useful, but
12
* WITHOUT ANY WARRANTY; without even the implied warranty of
13
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
14
* Lesser General Public License for more details.
16
* You should have received a copy of the GNU Lesser General Public
17
* License along with this program; if not, write to the Free Software
18
* Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA
25
#include "gcr-types.h"
26
#include "gcr-icons.h"
27
#include "gcr-internal.h"
29
static gboolean registered_icons = FALSE;
30
static const gchar *themed_icons[] = {
37
add_theme_source (GtkIconSet *iconset, const gchar *icon, GtkIconSize size)
39
GtkIconSource *source;
41
source = gtk_icon_source_new ();
42
gtk_icon_source_set_icon_name (source, icon);
43
gtk_icon_source_set_direction_wildcarded (source, TRUE);
44
gtk_icon_source_set_state_wildcarded (source, TRUE);
47
gtk_icon_source_set_size_wildcarded (source, TRUE);
49
gtk_icon_source_set_size_wildcarded (source, FALSE);
50
gtk_icon_source_set_size (source, size);
53
gtk_icon_set_add_source (iconset, source);
54
gtk_icon_source_free (source);
58
_gcr_icons_register (void)
60
GtkIconFactory *factory;
67
/* Setup the icon factory. */
68
factory = gtk_icon_factory_new ();
69
gtk_icon_factory_add_default (factory);
71
for (name = themed_icons; name && *name; name++) {
72
iconset = gtk_icon_set_new ();
73
add_theme_source (iconset, *name, GTK_ICON_SIZE_BUTTON);
74
add_theme_source (iconset, *name, GTK_ICON_SIZE_MENU);
75
add_theme_source (iconset, *name, GTK_ICON_SIZE_LARGE_TOOLBAR);
76
add_theme_source (iconset, *name, GTK_ICON_SIZE_SMALL_TOOLBAR);
77
add_theme_source (iconset, *name, GTK_ICON_SIZE_DIALOG);
78
add_theme_source (iconset, *name, -1);
79
gtk_icon_factory_add (factory, *name, iconset);
80
gtk_icon_set_unref (iconset);
83
g_object_unref (factory);
84
registered_icons = TRUE;