~ubuntu-branches/ubuntu/karmic/quodlibet/karmic

« back to all changes in this revision

Viewing changes to quodlibet/stock.py

  • Committer: Bazaar Package Importer
  • Author(s): Luca Falavigna
  • Date: 2009-01-30 23:55:34 UTC
  • mfrom: (1.1.12 upstream)
  • Revision ID: james.westby@ubuntu.com-20090130235534-l4e72ulw0vqfo17w
Tags: 2.0-1ubuntu1
* Merge from Debian experimental (LP: #276856), remaining Ubuntu changes:
  + debian/patches/40-use-music-profile.patch:
    - Use the "Music and Movies" pipeline per default.
* Refresh the above patch for new upstream release.

Show diffs side-by-side

added added

removed removed

Lines of Context:
 
1
# Copyright 2005 Joe Wreschnig
 
2
#
 
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
 
6
#
 
7
# $Id: stock.py 4330 2008-09-14 03:19:26Z piman $
 
8
 
 
9
import os
 
10
 
 
11
import gtk
 
12
 
 
13
import const
 
14
 
 
15
QL_ICON = 'quodlibet'
 
16
EF_ICON = 'exfalso'
 
17
 
 
18
EDIT_TAGS = 'ql-edit-tags'
 
19
PLUGINS = 'ql-plugins'
 
20
PREVIEW = 'ql-preview'
 
21
REMOVE = 'ql-remove'
 
22
ENQUEUE = 'ql-enqueue'
 
23
PLAYLISTS = 'ql-add-to-playlist'
 
24
DEVICES = 'ql-copy-to-device'
 
25
RENAME = 'ql-rename'
 
26
 
 
27
IPOD = 'device-ipod'
 
28
STORAGE = 'device-generic'
 
29
 
 
30
EJECT = 'media-eject'
 
31
 
 
32
VOLUME_OFF = 'audio-volume-muted'
 
33
VOLUME_MIN = 'audio-volume-low'
 
34
VOLUME_MED = 'audio-volume-medium'
 
35
VOLUME_MAX = 'audio-volume-high'
 
36
 
 
37
NO_ALBUM = os.path.join(const.IMAGEDIR, 'missing-cover.svg')
 
38
 
 
39
_ICONS = [QL_ICON, EF_ICON, VOLUME_OFF, VOLUME_MIN, VOLUME_MED, VOLUME_MAX,
 
40
          IPOD, STORAGE, EJECT]
 
41
 
 
42
def init():
 
43
    factory = gtk.IconFactory()
 
44
    for fn in _ICONS:
 
45
        icon_filename = os.path.join(const.IMAGEDIR, fn + ".png")
 
46
        pb = gtk.gdk.pixbuf_new_from_file(icon_filename)
 
47
        factory.add(fn, gtk.IconSet(pb))
 
48
 
 
49
    gtk.stock_add([
 
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, ""),
 
58
        ])
 
59
 
 
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))
 
68
 
 
69
    # Introduced in GTK 2.8
 
70
    try: gtk.STOCK_INFO
 
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, "")])
 
76
 
 
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:]])
 
85
    else:
 
86
        old = gtk.stock_lookup(gtk.STOCK_REMOVE)
 
87
        gtk.stock_add([(REMOVE, _("ql-remove"), 0, 0, "")])
 
88
 
 
89
    for key, name in [
 
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')),
 
106
        ]:
 
107
        if key != name: # translated, so re-register with a good name
 
108
            gtk.stock_add([(key, name) + gtk.stock_lookup(key)[2:]])
 
109
 
 
110
    factory.add_default()