1
# Copyright 2005 Joe Wreschnig
3
# This program is free software; you can redistribute it and/or modify
4
# it under the terms of the GNU General Public License version 2 as
5
# published by the Free Software Foundation
7
# $Id: stock.py 4004 2007-04-16 02:45:47Z piman $
18
EDIT_TAGS = 'ql-edit-tags'
19
PLUGINS = 'ql-plugins'
20
PREVIEW = 'ql-preview'
22
ENQUEUE = 'ql-enqueue'
23
PLAYLISTS = 'ql-add-to-playlist'
24
DEVICES = 'ql-copy-to-device'
28
STORAGE = 'device-generic'
32
VOLUME_OFF = 'audio-volume-muted'
33
VOLUME_MIN = 'audio-volume-low'
34
VOLUME_MED = 'audio-volume-medium'
35
VOLUME_MAX = 'audio-volume-high'
37
NO_ALBUM = os.path.join(const.BASEDIR, 'missing-cover.svg')
39
_ICONS = [QL_ICON, EF_ICON, VOLUME_OFF, VOLUME_MIN, VOLUME_MED, VOLUME_MAX,
43
factory = gtk.IconFactory()
45
icon_filename = os.path.join(const.BASEDIR, fn + ".png")
46
pb = gtk.gdk.pixbuf_new_from_file(icon_filename)
47
factory.add(fn, gtk.IconSet(pb))
50
(EDIT_TAGS, _("Edit _Tags"), 0, 0, ""),
51
(PLUGINS, _("_Plugins"), 0, 0, ""),
52
(PREVIEW, _("_Preview"), 0, 0, ""),
53
(ENQUEUE, _("Add to _Queue"), 0, 0, ""),
54
(PLAYLISTS, _("_Add to Playlist"), 0, 0, ""),
55
(DEVICES, _("_Copy to Device"), 0, 0, ""),
56
(EJECT, _("_Eject"), 0, 0, ""),
57
(RENAME, _("_Rename"), 0, 0, ""),
60
lookup = gtk.icon_factory_lookup_default
61
factory.add(EDIT_TAGS, lookup(gtk.STOCK_PROPERTIES))
62
factory.add(PLUGINS, lookup(gtk.STOCK_EXECUTE))
63
factory.add(PREVIEW, lookup(gtk.STOCK_CONVERT))
64
factory.add(ENQUEUE, lookup(gtk.STOCK_ADD))
65
factory.add(PLAYLISTS, lookup(gtk.STOCK_ADD))
66
factory.add(DEVICES, lookup(gtk.STOCK_COPY))
67
factory.add(RENAME, lookup(gtk.STOCK_EDIT))
69
# Introduced in GTK 2.8
71
except AttributeError:
72
gtk.STOCK_INFO = 'gtk-info'
73
if not gtk.stock_lookup(gtk.STOCK_INFO):
74
factory.add(gtk.STOCK_INFO, lookup(gtk.STOCK_DIALOG_INFO))
75
gtk.stock_add([(gtk.STOCK_INFO, _("_Information"), 0, 0, "")])
77
factory.add(REMOVE, lookup(gtk.STOCK_REMOVE))
78
# Translators: Only translate this if it conflicts with "Delete",
79
# as is the case in e.g. Finnish. It should be disambiguated as
80
# "Remove from Library" (as opposed to, from playlist, from disk, etc.)
81
# Don't literally translate "ql-remove". It needs an access key, so
82
# a sample translation would be "_Remove from Library".
83
if _("ql-remove") == "ql-remove":
84
gtk.stock_add([(REMOVE,) + gtk.stock_lookup(gtk.STOCK_REMOVE)[1:]])
86
old = gtk.stock_lookup(gtk.STOCK_REMOVE)
87
gtk.stock_add([(REMOVE, _("ql-remove"), 0, 0, "")])
90
# Translators: Only translate this if GTK does so incorrectly or not
91
# at all. Don't literally translate media/next/previous/play/pause.
92
# This string needs an access key.
93
(gtk.STOCK_MEDIA_NEXT, _('gtk-media-next')),
94
# Translators: Only translate this if GTK does so incorrectly or not
95
# at all. Don't literally translate media/next/previous/play/pause.
96
# This string needs an access key.
97
(gtk.STOCK_MEDIA_PREVIOUS, _('gtk-media-previous')),
98
# Translators: Only translate this if GTK does so incorrectly or not
99
# at all. Don't literally translate media/next/previous/play/pause.
100
# This string needs an access key.
101
(gtk.STOCK_MEDIA_PLAY, _('gtk-media-play')),
102
# Translators: Only translate this if GTK does so incorrectly or not
103
# at all. Don't literally translate media/next/previous/play/pause.
104
# This string needs an access key.
105
(gtk.STOCK_MEDIA_PAUSE, _('gtk-media-pause')),
107
if key != name: # translated, so re-register with a good name
108
gtk.stock_add([(key, name) + gtk.stock_lookup(key)[2:]])
110
factory.add_default()