31
31
static GtkIconFactory *factory = NULL;
33
const char RB_STOCK_TRAY_ICON[] = "rhythmbox-tray-icon";
34
const char RB_STOCK_SET_STAR[] = "rhythmbox-set-star";
35
const char RB_STOCK_UNSET_STAR[] = "rhythmbox-unset-star";
36
const char RB_STOCK_NO_STAR[] = "rhythmbox-no-star";
37
const char RB_STOCK_PODCAST[] = "rhythmbox-podcast";
38
const char GNOME_MEDIA_SHUFFLE[] = "stock_shuffle";
39
const char GNOME_MEDIA_REPEAT[] = "stock_repeat";
40
const char GNOME_MEDIA_PLAYLIST[] = "stock_playlist";
41
const char GNOME_MEDIA_AUTO_PLAYLIST[] = "stock_smart-playlist";
34
49
rb_stock_icons_init (void)
51
GtkIconTheme *theme = gtk_icon_theme_get_default ();
38
static const char *items[] =
54
static const RBStockIcon items[] =
50
RB_STOCK_PLAYLIST_MENU,
58
RB_STOCK_VOLUME_MEDIUM,
63
RB_STOCK_AUTOMATIC_PLAYLIST,
56
/* Rhythmbox custom icons */
57
{RB_STOCK_TRAY_ICON, TRUE},
58
{RB_STOCK_SET_STAR, TRUE},
59
{RB_STOCK_UNSET_STAR, TRUE},
60
{RB_STOCK_PODCAST, TRUE},
61
{RB_STOCK_NO_STAR, TRUE},
63
/* gnome-icon-theme icons */
64
{GNOME_MEDIA_SHUFFLE, FALSE},
65
{GNOME_MEDIA_REPEAT, FALSE},
66
{GNOME_MEDIA_PLAYLIST, FALSE},
67
{GNOME_MEDIA_AUTO_PLAYLIST, FALSE},
71
70
g_return_if_fail (factory == NULL);
76
75
for (i = 0; i < (int) G_N_ELEMENTS (items); i++) {
77
76
GtkIconSet *icon_set;
81
fn = g_strconcat (items[i], ".png", NULL);
82
pixbuf = gdk_pixbuf_new_from_file (rb_file (fn), NULL);
85
icon_set = gtk_icon_set_new_from_pixbuf (pixbuf);
86
gtk_icon_factory_add (factory, items[i], icon_set);
87
gtk_icon_set_unref (icon_set);
89
g_object_unref (G_OBJECT (pixbuf));
79
if (items[i].custom) {
80
char *fn = g_strconcat (items[i].name, ".png", NULL);
81
pixbuf = gdk_pixbuf_new_from_file (rb_file (fn), NULL);
84
/* we should really add all the sizes */
86
gtk_icon_size_lookup (GTK_ICON_SIZE_LARGE_TOOLBAR, &size, NULL);
87
pixbuf = gtk_icon_theme_load_icon (theme,
95
icon_set = gtk_icon_set_new_from_pixbuf (pixbuf);
96
gtk_icon_factory_add (factory, items[i].name, icon_set);
97
gtk_icon_set_unref (icon_set);
99
g_object_unref (G_OBJECT (pixbuf));
101
g_warning ("Unable to load icon %s", items[i].name);