1 diff -uNr a/setup.py b/setup.py
2 --- a/setup.py 2010-04-05 22:00:41.000000000 +0800
3 +++ b/setup.py 2010-04-06 21:19:58.512158072 +0800
8 from distutils.core import setup
10 +# Form ccsm's setup.py
11 +podir = os.path.join (os.path.realpath ("."), "data/po")
12 +if os.path.isdir (podir):
13 + buildcmd = "msgfmt -o data/po/%s/LC_MESSAGES/xmms2tray.mo data/po/%s.po"
14 + mopath = "data/po/%s/LC_MESSAGES/xmms2tray.mo"
15 + destpath = "share/locale/%s/LC_MESSAGES/LC_MESSAGES"
16 + for name in os.listdir (podir):
17 + if name[-2:] == "po":
19 + if sys.argv[1] == "." or (sys.argv[1] == "install" and not os.path.exists (mopath % name)):
20 + if not os.path.isdir ("data/po/" + name + "/LC_MESSAGES"):
21 + os.makedirs ("data/po/" + name + "/LC_MESSAGES")
22 + os.system (buildcmd % (name, name))
24 +# From apport's setup.py
26 +for filepath in glob.glob("data/po/*/LC_MESSAGES/*.mo"):
27 + lang = filepath[len("date/po/"):]
28 + targetpath = os.path.dirname(os.path.join("share/locale",lang))
29 + mo_files.append((targetpath, [filepath]))
31 setup(name='xmms2tray',
33 description='tray icon for XMMS2',
35 data_files=[('share/doc/xmms2tray', ['README', 'COPYING', 'ChangeLog']),
36 ('share/xmms2tray/data', ['data/xmms2_simple.png',
37 'data/xmms2_glossy.png',
38 - 'data/xmms2_glossy_24.png',
39 - 'data/xmms2_simple_64.png',
40 - 'data/xmms2_64.png',
41 - 'data/xmms2_24.png']),
42 - ('share/xmms2tray/data/po/LC_MESSAGES/xmms2tray.mo',
43 - ['data/po/de/LC_MESSAGES/xmms2tray.mo'])],
44 + 'data/xmms2_64.png']),
45 + ('share/icons/hicolor/16x16/apps',['images/16x16/xmms2tray.png','images/16x16/xmms2trayicon.png']),
46 + ('share/icons/hicolor/22x22/apps',['images/22x22/xmms2tray.png','images/22x22/xmms2trayicon.png']),
47 + ('share/icons/hicolor/24x24/apps',['images/24x24/xmms2tray.png','images/24x24/xmms2trayicon.png']),
48 + ('share/icons/hicolor/48x48/apps',['images/48x48/xmms2tray.png','images/48x48/xmms2trayicon.png']),
49 + ('share/icons/hicolor/128x128/apps',['images/128x128/xmms2tray.png', 'images/128x128/xmms2trayicon.png']),
51 scripts=['xmms2tray'],
54 diff -uNr a/src/xmms2tray/__init__.py b/src/xmms2tray/__init__.py
55 --- a/src/xmms2tray/__init__.py 2010-09-03 21:42:37.805999976 +0800
56 +++ b/src/xmms2tray/__init__.py 2010-09-03 21:48:24.623999983 +0800
58 if not info: return #for "not playing"
59 if 'artist' in info and 'title' in info:
60 info['artist'] = info['artist']
61 - nowpl = '%s - <i>%s</i>\n' % \
62 - ( info['artist'].replace('&', '&').replace('<', '<'),
63 - info['title'].replace('&', '&').replace('<', '<'))
64 + nowpl = _("Title:") + '\t<b>%s</b>' \
65 + % info['title'].replace('&', '&').replace('<', '<') \
66 + + '\n' + _("Artist:") + '\t%s\n' \
67 + % info['artist'].replace('&', '&').replace('<', '<')
69 elif 'title' in info: #ex. curl
70 nowpl = info['title'].replace('&', '&').replace('<', '<')
72 if self.config['notify'] and HAVE_NOTIFY:
73 if self._notify_id != info['id']:
74 self._notify_id = info['id']
75 - self._notification = pynotify.Notification(_('Now Playing'), nowpl, self._logo_img)
76 + self._notification.update(_('Now Playing'), nowpl)
77 pbuf = gtk.gdk.pixbuf_new_from_file(img)
78 self._notification.set_icon_from_pixbuf(pbuf)
79 if self.config['att_note']:
84 - icon = gtk.StatusIcon()
85 - icon.set_from_file('data/xmms2_24.png')
86 + icon = gtk.status_icon_new_from_icon_name('xmms2trayicon')
87 icon.connect('popup-menu', self.menu_called)
88 icon.set_visible(True)
91 if cl['command'][0] == '$':
92 if os.access('/usr'+cl['command'][1:], os.R_OK | os.X_OK):
93 cl['command'] = '/usr'+cl['command'][1:]
94 - if cl['iconfile'][0] == '$':
95 + if cl.has_key('iconfile') and cl['iconfile'][0] == '$':
96 cl['iconfile'] = '/usr'+cl['iconfile'][1:]
98 elif os.access('/usr/local'+cl['command'][1:], os.R_OK|os.X_OK):
99 cl['command'] = '/usr/local'+cl['command'][1:]
100 - if cl['iconfile'][0] == '$':
101 + if cl.has_key('iconfile') and cl['iconfile'][0] == '$':
102 cl['iconfile'] = '/usr/local'+cl['iconfile'][1:]
104 elif os.access(cl['command'], os.R_OK | os.X_OK):
106 img.set_from_pixbuf(pb.scale_simple(16,16,
107 gtk.gdk.INTERP_BILINEAR))
109 + #TODO: find a way to choose app's icon..such as names
110 + elif 'iconname' in item:
111 + mi = gtk.ImageMenuItem(item['title'])
113 + img.set_from_icon_name(item['iconname'], gtk.ICON_SIZE_MENU)
115 elif item.get('check'):
116 mi = gtk.CheckMenuItem(item['title'])
117 if item.get('action') == 'playpause':
120 pynotify.init("XMMS2tray")
122 - self._notification = None
123 + self._notification = pynotify.Notification('xmms2tray')
124 self._logo_img = os.getcwd() + '/data/xmms2_64.png'
125 self.xmms.playback_status(self.pbstatus_cb)
126 self.xmms.broadcast_playback_status(self.pbstatus_cb)
127 @@ -376,13 +382,13 @@
131 - if not os.path.exists('data/xmms2_24.png'): # go somewhere else
132 - if os.path.exists('%s/share/xmms2tray/data/xmms2_24.png' % sys.prefix):
133 + if not os.path.exists('data'): # go somewhere else
134 + if os.path.exists('%s/share/xmms2tray/data' % sys.prefix):
135 os.chdir('%s/share/xmms2tray' % sys.prefix)
137 raise RuntimeError('XMMS2tray has been installed in a non-standard way. Please run from the directory including data/')
139 - translations = gettext.translation(GETTEXT_DOMAIN, "data/po", fallback=True)
140 + translations = gettext.translation(GETTEXT_DOMAIN, "../locale", fallback=True)
142 translations.install()
144 diff -uNr a/src/xmms2tray/menu_conf.py b/src/xmms2tray/menu_conf.py
145 --- a/src/xmms2tray/menu_conf.py 2010-04-05 22:00:41.000000000 +0800
146 +++ b/src/xmms2tray/menu_conf.py 2010-04-06 20:38:05.902157793 +0800
148 { 'title': _('_Stop'),
150 'stockicon': 'media_stop'},
151 - { 'title': _('_Next'),
153 - 'stockicon': 'media_next'},
154 { 'title': _('Pre_vious'),
156 - 'stockicon': 'media_previous'}
157 + 'stockicon': 'media_previous'},
158 + { 'title': _('_Next'),
160 + 'stockicon': 'media_next'}
165 # 'command' must be a full path; item is only shown if exists.
166 # use $ as first char for 'either /usr or /use/local'
168 - { 'title': _('Launch Insanity'),
169 - 'iconfile': '$/share/insanity/pixmaps/blue_ghost_128.xpm',
170 - 'command': '$/bin/insanity'},
171 + { 'title': _('Launch Abraca'),
172 + 'iconname': 'abraca',
173 + 'command': '$/bin/abraca' },
175 + { 'title': _('Launch Etude'),
176 + 'iconname': 'etude',
177 + 'command': '$/bin/etude' },
179 + { 'title': _('Launch LXmusic'),
180 + 'iconname': 'lxmusic',
181 + 'command': '$/bin/lxmusic' },
183 - { 'title': _('Launch gxmms2'),
184 + { 'title': _('Launch GXMMS2'),
185 'iconfile': '$/share/gxmms2/gxmms2_mini.xpm',
186 'command': '$/bin/gxmms2'},
188 - { 'title': _('Launch Abraca'),
189 - 'iconfile': 'data/xmms2_24.png',
190 - 'command': '$/bin/abraca' },
191 + { 'title': _('Launch Insanity'),
192 + 'iconfile': '$/share/insanity/pixmaps/blue_ghost_128.xpm',
193 + 'command': '$/bin/insanity'},
195 { 'title': _('Launch X4X'),
196 - 'iconfile': '$/share/pixmaps/x4x.png',
198 'command': '$/bin/x4x'},
200 - { 'title': _('Launch Esperanza'),
201 - 'iconfile': 'data/xmms2_24.png',
202 - 'command': '$/bin/esperanza' }