updated on Thu Jan 26 00:18:00 UTC 2012
[aur-mirror.git] / xmms2tray / xmms2traymod.patch
blobbac197cb67f7046dca85d1c8e8a2bd327e60980b
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
4 @@ -1,7 +1,29 @@
5 #!/usr/bin/env python
7 +import sys, os, glob
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":
18 + name = name[:-3]
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
25 +mo_files = []
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',
32 version='0.5.1',
33 description='tray icon for XMMS2',
34 @@ -16,12 +38,13 @@
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']),
50 + ] + mo_files,
51 scripts=['xmms2tray'],
53 classifiers=[
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
57 @@ -167,9 +167,10 @@
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('&', '&amp;').replace('<', '&lt;'),
63 - info['title'].replace('&', '&amp;').replace('<', '&lt;'))
64 + nowpl = _("Title:") + '\t<b>%s</b>' \
65 + % info['title'].replace('&', '&amp;').replace('<', '&lt;') \
66 + + '\n' + _("Artist:") + '\t%s\n' \
67 + % info['artist'].replace('&', '&amp;').replace('<', '&lt;')
69 elif 'title' in info: #ex. curl
70 nowpl = info['title'].replace('&', '&amp').replace('<', '&lt;')
71 @@ -179,7 +180,7 @@
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']:
80 @@ -208,8 +209,7 @@
81 self.set_tip()
83 def __init__(self):
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)
89 self.icon = icon
90 @@ -245,12 +245,12 @@
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:]
97 menucfg.append(cl)
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:]
103 menucfg.append(cl)
104 elif os.access(cl['command'], os.R_OK | os.X_OK):
105 @@ -281,6 +281,12 @@
106 img.set_from_pixbuf(pb.scale_simple(16,16,
107 gtk.gdk.INTERP_BILINEAR))
108 mi.set_image(img)
109 + #TODO: find a way to choose app's icon..such as names
110 + elif 'iconname' in item:
111 + mi = gtk.ImageMenuItem(item['title'])
112 + img = gtk.Image()
113 + img.set_from_icon_name(item['iconname'], gtk.ICON_SIZE_MENU)
114 + mi.set_image(img)
115 elif item.get('check'):
116 mi = gtk.CheckMenuItem(item['title'])
117 if item.get('action') == 'playpause':
118 @@ -297,7 +303,7 @@
119 if HAVE_NOTIFY:
120 pynotify.init("XMMS2tray")
121 self._notify_id = 0
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 @@
130 def main():
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)
136 else:
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()
143 global menu_conf
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
147 @@ -33,12 +33,12 @@
148 { 'title': _('_Stop'),
149 'action': 'stop',
150 'stockicon': 'media_stop'},
151 - { 'title': _('_Next'),
152 - 'action': 'next',
153 - 'stockicon': 'media_next'},
154 { 'title': _('Pre_vious'),
155 'action': 'prev',
156 - 'stockicon': 'media_previous'}
157 + 'stockicon': 'media_previous'},
158 + { 'title': _('_Next'),
159 + 'action': 'next',
160 + 'stockicon': 'media_next'}
163 BOTTOM = [
164 @@ -53,25 +53,29 @@
165 # 'command' must be a full path; item is only shown if exists.
166 # use $ as first char for 'either /usr or /use/local'
167 CLIENTS = [
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',
197 + 'iconname': 'x4x',
198 'command': '$/bin/x4x'},
200 - { 'title': _('Launch Esperanza'),
201 - 'iconfile': 'data/xmms2_24.png',
202 - 'command': '$/bin/esperanza' }
205 OPTIONS = [