zik 0.16.1
Sign up to get free protection for your applications and to get access to all the features.
- data.tar.gz.sig +0 -0
- data/ChangeLog +222 -0
- data/INSTALL +34 -0
- data/Makefile.in +199 -0
- data/README +53 -0
- data/ZiK.desktop +11 -0
- data/ZiK.rb +377 -0
- data/configure +269 -0
- data/dependencies +142 -0
- data/doc/COPYING +340 -0
- data/doc/ChangeLog +222 -0
- data/doc/html/fr/index.html +128 -0
- data/doc/html/index.html +126 -0
- data/doc/html/pix/ZiK3.png +0 -0
- data/doc/html/pix/capture.png +0 -0
- data/doc/html/pix/capture_cd.png +0 -0
- data/doc/html/pix/capture_compact.png +0 -0
- data/doc/html/pix/capture_radio.png +0 -0
- data/doc/html/pix/icon.png +0 -0
- data/doc/html/pix/logo.png +0 -0
- data/doc/html/styles/main.css +47 -0
- data/doc/man/manpage.1 +43 -0
- data/gui/assistant.rb +133 -0
- data/gui/cdgui.rb +54 -0
- data/gui/common.rb +56 -0
- data/gui/config.rb +120 -0
- data/gui/edit.rb +413 -0
- data/gui/error.rb +124 -0
- data/gui/gui.rb +1383 -0
- data/gui/mod.rb +239 -0
- data/gui/preference.rb +496 -0
- data/gui/progress.rb +50 -0
- data/gui/radiogui.rb +404 -0
- data/gui/search.rb +249 -0
- data/gui/socket.rb +107 -0
- data/mod/brainz.rb +76 -0
- data/mod/brainz/dialogs.rb +132 -0
- data/mod/brainz/functions.rb +55 -0
- data/mod/brainz/ofa.rb +76 -0
- data/mod/brainz/song.rb +139 -0
- data/mod/brainz/widget.rb +34 -0
- data/mod/cover.rb +90 -0
- data/mod/cover/application-x-cd-image.svg +666 -0
- data/mod/cover/config.rb +79 -0
- data/mod/cover/configwidget.rb +35 -0
- data/mod/cover/widget.rb +147 -0
- data/mod/hotkeys.rb +137 -0
- data/mod/hotkeys/config.rb +84 -0
- data/mod/hotkeys/configwidget.rb +93 -0
- data/mod/interact.rb +131 -0
- data/mod/interact/configwidget.rb +107 -0
- data/mod/interact/interaction.rb +79 -0
- data/mod/notify.rb +128 -0
- data/mod/notify/config.rb +96 -0
- data/mod/notify/configwidget.rb +76 -0
- data/mod/notify/window.rb +56 -0
- data/mod/trayicon.rb +83 -0
- data/mod/trayicon/config.rb +79 -0
- data/mod/trayicon/configwidget.rb +35 -0
- data/mod/trayicon/icon.rb +99 -0
- data/pix/ZiK.svg +78 -0
- data/pix/ZiK3.png +0 -0
- data/pix/assistant/capture.png +0 -0
- data/pix/gtk-directory.svg +287 -0
- data/pix/media-cdrom.svg +292 -0
- data/pix/network-wireless.svg +429 -0
- data/pix/player_play.svg +286 -0
- data/pix/sound.svg +244 -0
- data/pix/sound_directory.svg +464 -0
- data/player/cdplayer.rb +108 -0
- data/player/player.rb +132 -0
- data/player/radioplayer.rb +124 -0
- data/playlist/cdlist.rb +140 -0
- data/playlist/common.rb +343 -0
- data/playlist/editlist.rb +50 -0
- data/playlist/export.rb +108 -0
- data/playlist/playlist.rb +143 -0
- data/playlist/radiolist.rb +148 -0
- data/playlist/song.rb +122 -0
- data/po/ZiK.pot +622 -0
- data/po/fr/ZiK.po +658 -0
- data/zik +2 -0
- metadata +265 -0
- metadata.gz.sig +0 -0
data/gui/progress.rb
ADDED
@@ -0,0 +1,50 @@
|
|
1
|
+
# encoding: UTF-8
|
2
|
+
=begin
|
3
|
+
Copyright 2007-2011 Vincent Carmona
|
4
|
+
vinc4mai@gmail.com
|
5
|
+
|
6
|
+
This file is part of ZiK.
|
7
|
+
|
8
|
+
ZiK is free software; you can redistribute it and/or modify
|
9
|
+
it under the terms of the GNU General Public License as published by
|
10
|
+
the Free Software Foundation; either version 2 of the License, or
|
11
|
+
(at your option) any later version.
|
12
|
+
|
13
|
+
ZiK is distributed in the hope that it will be useful,
|
14
|
+
but WITHOUT ANY WARRANTY; without even the implied warranty of
|
15
|
+
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
16
|
+
GNU General Public License for more details.
|
17
|
+
|
18
|
+
You should have received a copy of the GNU General Public License
|
19
|
+
along with ZiK; if not, write to the Free Software
|
20
|
+
Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
|
21
|
+
=end
|
22
|
+
|
23
|
+
class ProgressWindow < Gtk::Window
|
24
|
+
def initialize(title, parent)
|
25
|
+
@pbar=Gtk::ProgressBar.new
|
26
|
+
bcancel=Gtk::Button.new(Gtk::Stock::CANCEL)
|
27
|
+
bcancel.signal_connect('clicked'){bcancel.state=Gtk::STATE_ACTIVE; parent.abort_export_songs}
|
28
|
+
vbox=Gtk::VBox.new
|
29
|
+
vbox.pack_start(@pbar)
|
30
|
+
vbox.pack_start(bcancel)
|
31
|
+
super()
|
32
|
+
self.signal_connect("delete_event"){true}
|
33
|
+
self.transient_for=parent
|
34
|
+
self.destroy_with_parent=true
|
35
|
+
self.skip_taskbar_hint=true
|
36
|
+
self.skip_pager_hint=true
|
37
|
+
self.title=title
|
38
|
+
self.icon=Gdk::Pixbuf.new(File.join(Pix_dir,'ZiK.svg'))
|
39
|
+
add(vbox)
|
40
|
+
show_all
|
41
|
+
end
|
42
|
+
|
43
|
+
def fraction=(n)
|
44
|
+
@pbar.fraction=n
|
45
|
+
end
|
46
|
+
|
47
|
+
def text=(t)
|
48
|
+
@pbar.text=t
|
49
|
+
end
|
50
|
+
end
|
data/gui/radiogui.rb
ADDED
@@ -0,0 +1,404 @@
|
|
1
|
+
# encoding: UTF-8
|
2
|
+
=begin
|
3
|
+
Copyright 2007-2011 Vincent Carmona
|
4
|
+
vinc4mai@gmail.com
|
5
|
+
|
6
|
+
This file is part of ZiK.
|
7
|
+
|
8
|
+
ZiK is free software; you can redistribute it and/or modify
|
9
|
+
it under the terms of the GNU General Public License as published by
|
10
|
+
the Free Software Foundation; either version 2 of the License, or
|
11
|
+
(at your option) any later version.
|
12
|
+
|
13
|
+
ZiK is distributed in the hope that it will be useful,
|
14
|
+
but WITHOUT ANY WARRANTY; without even the implied warranty of
|
15
|
+
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
16
|
+
GNU General Public License for more details.
|
17
|
+
|
18
|
+
You should have received a copy of the GNU General Public License
|
19
|
+
along with ZiK; if not, write to the Free Software
|
20
|
+
Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
|
21
|
+
=end
|
22
|
+
|
23
|
+
module Radio
|
24
|
+
class Dialog < Gtk::Dialog
|
25
|
+
def initialize(name, parent)
|
26
|
+
@entry=Gtk::Entry.new
|
27
|
+
@frame=Gtk::Frame.new(_("Name"))
|
28
|
+
@frame.add(@entry)
|
29
|
+
@entry2=Gtk::Entry.new
|
30
|
+
@frame2=Gtk::Frame.new(_("Url"))
|
31
|
+
@frame2.add(@entry2)
|
32
|
+
super(name, parent, Gtk::Dialog::DESTROY_WITH_PARENT,
|
33
|
+
[Gtk::Stock::CANCEL, Gtk::Dialog::RESPONSE_CANCEL], [Gtk::Stock::APPLY, Gtk::Dialog::RESPONSE_ACCEPT])
|
34
|
+
self.vbox.add(@frame)
|
35
|
+
self.vbox.add(@frame2)
|
36
|
+
self.show_all
|
37
|
+
end
|
38
|
+
|
39
|
+
def name
|
40
|
+
@entry.text
|
41
|
+
end
|
42
|
+
|
43
|
+
def name=(n)
|
44
|
+
@entry.text=n
|
45
|
+
end
|
46
|
+
|
47
|
+
def url
|
48
|
+
@entry2.text
|
49
|
+
end
|
50
|
+
|
51
|
+
def url=(u)
|
52
|
+
@entry2.text=u
|
53
|
+
end
|
54
|
+
end
|
55
|
+
|
56
|
+
class Window < Gtk::ScrolledWindow
|
57
|
+
attr_reader :store, :view, :renderer
|
58
|
+
|
59
|
+
def initialize(parent, list)
|
60
|
+
@parent=parent
|
61
|
+
@list=list
|
62
|
+
|
63
|
+
@store=Gtk::ListStore.new(String, TrueClass)
|
64
|
+
refresh_store
|
65
|
+
|
66
|
+
@renderer=Gtk::CellRendererText.new
|
67
|
+
@col=Gtk::TreeViewColumn.new(_("Radio"), @renderer, :text => 0)
|
68
|
+
@view=Gtk::TreeView.new(@store)
|
69
|
+
@view.append_column(@col)
|
70
|
+
@view.signal_connect("button_press_event"){|widget, event|
|
71
|
+
@menu.popup(nil, nil, event.button, event.time) if event.button==3
|
72
|
+
}
|
73
|
+
|
74
|
+
@selection=@view.selection
|
75
|
+
|
76
|
+
@bedit=Gtk::ImageMenuItem.new(Gtk::Stock::EDIT)
|
77
|
+
@bedit.signal_connect("activate"){
|
78
|
+
iter=@selection.selected
|
79
|
+
if iter
|
80
|
+
radio=@list.radios[iter.path.to_s.to_i]
|
81
|
+
dialog=Radio::Dialog.new(_("Edit a radio"), @parent)
|
82
|
+
dialog.name=radio.name
|
83
|
+
dialog.url=radio.url
|
84
|
+
if dialog.run==Gtk::Dialog::RESPONSE_ACCEPT
|
85
|
+
radio.name=dialog.name
|
86
|
+
radio.url=dialog.url
|
87
|
+
end
|
88
|
+
dialog.destroy
|
89
|
+
end
|
90
|
+
}
|
91
|
+
@menu=Gtk::Menu.new
|
92
|
+
@menu.append(@bedit)
|
93
|
+
@menu.show_all
|
94
|
+
|
95
|
+
super()
|
96
|
+
self.set_policy(Gtk::POLICY_AUTOMATIC,Gtk::POLICY_AUTOMATIC)
|
97
|
+
self.add(@view)
|
98
|
+
end
|
99
|
+
|
100
|
+
def refresh_store
|
101
|
+
@store.clear
|
102
|
+
@list.radios.each_with_index{|radio, i|
|
103
|
+
child=@store.append
|
104
|
+
child[0]=radio.name
|
105
|
+
child[1]=@list.current==i
|
106
|
+
}
|
107
|
+
end
|
108
|
+
|
109
|
+
def add_radio
|
110
|
+
dialog=Radio::Dialog.new(_("Add a radio"), @parent)
|
111
|
+
if dialog.run==Gtk::Dialog::RESPONSE_ACCEPT
|
112
|
+
@list.add(dialog.name, dialog.url)
|
113
|
+
refresh_store
|
114
|
+
end
|
115
|
+
dialog.destroy
|
116
|
+
end
|
117
|
+
|
118
|
+
def rm
|
119
|
+
begin
|
120
|
+
i=@selection.selected.path.to_s.to_i
|
121
|
+
@list.rm(i)
|
122
|
+
refresh_store
|
123
|
+
rescue
|
124
|
+
ErrorError.new("Cannot remove current item (Nothing selected?).")
|
125
|
+
end
|
126
|
+
end
|
127
|
+
|
128
|
+
def clear
|
129
|
+
@store.clear
|
130
|
+
@list.clear
|
131
|
+
end
|
132
|
+
|
133
|
+
def import
|
134
|
+
dialog = Gtk::FileChooserDialog.new(_("Import a radios list"), @parent,
|
135
|
+
Gtk::FileChooser::ACTION_OPEN, nil,
|
136
|
+
[Gtk::Stock::CANCEL, Gtk::Dialog::RESPONSE_CANCEL], [Gtk::Stock::OPEN, Gtk::Dialog::RESPONSE_ACCEPT])
|
137
|
+
filter=Gtk::FileFilter.new
|
138
|
+
filter.add_pattern('*.m3u')
|
139
|
+
dialog.filter=filter
|
140
|
+
if dialog.run == Gtk::Dialog::RESPONSE_ACCEPT
|
141
|
+
@list.import(dialog.filename)
|
142
|
+
refresh_store
|
143
|
+
end
|
144
|
+
dialog.destroy
|
145
|
+
end
|
146
|
+
end
|
147
|
+
|
148
|
+
class Edit < Gtk::Window
|
149
|
+
#Code looks like EditListWindow in gui/edit.rb file => Mix this 2 classes
|
150
|
+
|
151
|
+
attr_writer :force_refresh_parent
|
152
|
+
|
153
|
+
def initialize(parent, list, wradio)
|
154
|
+
@parent=parent; @list=list; @wradio=wradio
|
155
|
+
|
156
|
+
#*********************Playlist zone****************************
|
157
|
+
@store=Gtk::ListStore.new(String, Radio::WebRadio)
|
158
|
+
refresh_store
|
159
|
+
|
160
|
+
@renderer=Gtk::CellRendererText.new
|
161
|
+
@col=Gtk::TreeViewColumn.new(_("Radio"), @renderer, :text => 0)
|
162
|
+
@view=Gtk::TreeView.new(@store)
|
163
|
+
@view.headers_visible=false
|
164
|
+
@view.reorderable=true
|
165
|
+
@view.append_column(@col)
|
166
|
+
|
167
|
+
@wlist=Gtk::ScrolledWindow.new
|
168
|
+
@wlist.set_policy(Gtk::POLICY_AUTOMATIC,Gtk::POLICY_AUTOMATIC)
|
169
|
+
@wlist.add(@view)
|
170
|
+
|
171
|
+
@selection=@view.selection
|
172
|
+
@selection.mode=Gtk::SELECTION_MULTIPLE
|
173
|
+
|
174
|
+
#*********************Right buttons zone************************
|
175
|
+
@btop=Gtk::Button.new
|
176
|
+
@btop.image=Gtk::Image.new(Gtk::Stock::GOTO_TOP,Gtk::IconSize::BUTTON)
|
177
|
+
@btop.tooltip_text=_('Move to the top')
|
178
|
+
@btop.signal_connect('clicked'){top}
|
179
|
+
|
180
|
+
@bup=Gtk::Button.new
|
181
|
+
@bup.image=Gtk::Image.new(Gtk::Stock::GO_UP,Gtk::IconSize::BUTTON)
|
182
|
+
@bup.tooltip_text=_('Move up')
|
183
|
+
@bup.signal_connect('clicked'){up}
|
184
|
+
|
185
|
+
@brm=Gtk::Button.new
|
186
|
+
@brm.image=Gtk::Image.new(Gtk::Stock::REMOVE,Gtk::IconSize::BUTTON)
|
187
|
+
@brm.tooltip_text=_('Remove selection')
|
188
|
+
@brm.signal_connect('clicked'){rm}
|
189
|
+
|
190
|
+
@bedit=Gtk::Button.new
|
191
|
+
@bedit.image=Gtk::Image.new(Gtk::Stock::EDIT,Gtk::IconSize::BUTTON)
|
192
|
+
@bedit.tooltip_text=_('Edit a radio')
|
193
|
+
@bedit.signal_connect('clicked'){
|
194
|
+
s=@selection.selected_rows
|
195
|
+
unless s.empty?#Almost same code in Radio::Window!
|
196
|
+
i=s[-1].to_s.to_i
|
197
|
+
radio=@list.radios[i]
|
198
|
+
dialog=Radio::Dialog.new(_("Edit a radio"), @parent)
|
199
|
+
dialog.name=radio.name
|
200
|
+
dialog.url=radio.url
|
201
|
+
self.hide
|
202
|
+
if dialog.run==Gtk::Dialog::RESPONSE_ACCEPT
|
203
|
+
radio.name=dialog.name
|
204
|
+
radio.url=dialog.url
|
205
|
+
refresh_store
|
206
|
+
@force_refresh_parent=true
|
207
|
+
end
|
208
|
+
dialog.destroy
|
209
|
+
self.show
|
210
|
+
end
|
211
|
+
}
|
212
|
+
|
213
|
+
@bdown=Gtk::Button.new
|
214
|
+
@bdown.image=Gtk::Image.new(Gtk::Stock::GO_DOWN,Gtk::IconSize::BUTTON)
|
215
|
+
@bdown.tooltip_text=_('Move down')
|
216
|
+
@bdown.signal_connect('clicked'){down}
|
217
|
+
|
218
|
+
@bbottom=Gtk::Button.new
|
219
|
+
@bbottom.image=Gtk::Image.new(Gtk::Stock::GOTO_BOTTOM,Gtk::IconSize::BUTTON)
|
220
|
+
@bbottom.tooltip_text=_('Move to the bottom')
|
221
|
+
@bbottom.signal_connect('clicked'){bottom}
|
222
|
+
|
223
|
+
#*********************Bottom buttons zone***********************
|
224
|
+
@badd=Gtk::Button.new
|
225
|
+
@badd.image=Gtk::Image.new(Gtk::Stock::ADD,Gtk::IconSize::BUTTON)
|
226
|
+
@badd.tooltip_text=_('Add a radio')
|
227
|
+
@badd.signal_connect('clicked'){add_radio}
|
228
|
+
|
229
|
+
@bclear=Gtk::Button.new
|
230
|
+
@bclear.image=Gtk::Image.new(Gtk::Stock::CLEAR,Gtk::IconSize::BUTTON)
|
231
|
+
@bclear.tooltip_text=_('Clear radios list')
|
232
|
+
@bclear.signal_connect('clicked'){clear}
|
233
|
+
|
234
|
+
#*********************Main window*******************************
|
235
|
+
@table=Gtk::Table.new(9,5)
|
236
|
+
@table.row_spacings=$border
|
237
|
+
@table.column_spacings=$border
|
238
|
+
@table.attach(@wlist, 0, 4, 0, 8)
|
239
|
+
@table.attach(@btop, 4, 5, 1, 2, Gtk::SHRINK, Gtk::SHRINK)
|
240
|
+
@table.attach(@bup, 4, 5, 2, 3, Gtk::SHRINK, Gtk::SHRINK)
|
241
|
+
@table.attach(@brm, 4, 5, 3, 4, Gtk::SHRINK, Gtk::SHRINK)
|
242
|
+
@table.attach(@bedit, 4, 5, 4, 5, Gtk::SHRINK, Gtk::SHRINK)
|
243
|
+
@table.attach(@bdown, 4, 5, 5, 6, Gtk::SHRINK, Gtk::SHRINK)
|
244
|
+
@table.attach(@bbottom, 4, 5, 6, 7, Gtk::SHRINK, Gtk::SHRINK)
|
245
|
+
@table.attach(@badd, 1, 2, 8, 9, Gtk::SHRINK, Gtk::SHRINK)
|
246
|
+
@table.attach(@bclear, 2, 3, 8, 9, Gtk::SHRINK, Gtk::SHRINK)
|
247
|
+
|
248
|
+
@bcancel=Gtk::Button.new(Gtk::Stock::CANCEL)
|
249
|
+
@bcancel.signal_connect('clicked'){
|
250
|
+
if @force_refresh_parent
|
251
|
+
refresh_list
|
252
|
+
@wradio.refresh_store
|
253
|
+
end
|
254
|
+
quit
|
255
|
+
}
|
256
|
+
@bok=Gtk::Button.new(Gtk::Stock::OK)
|
257
|
+
@bok.signal_connect('clicked'){
|
258
|
+
refresh_list
|
259
|
+
@parent.refresh_radiolist(@list, @force_refresh_parent)
|
260
|
+
quit
|
261
|
+
}
|
262
|
+
@hbox=Gtk::HBox.new
|
263
|
+
[@bcancel, @bok].reverse.each{|button| @hbox.pack_end(button,false)}
|
264
|
+
|
265
|
+
@vbox=Gtk::VBox.new
|
266
|
+
@vbox.pack_start(@table)
|
267
|
+
@vbox.pack_start(@hbox,false)
|
268
|
+
|
269
|
+
super(Gtk::Window::TOPLEVEL)
|
270
|
+
self.transient_for=parent
|
271
|
+
self.modal=true
|
272
|
+
self.skip_taskbar_hint=true
|
273
|
+
self.skip_pager_hint=true
|
274
|
+
self.title=_('Edit radios list')
|
275
|
+
self.icon=Gdk::Pixbuf.new(File.join(Pix_dir,'ZiK.svg'))
|
276
|
+
s=parent.size; self.set_default_size((0.8*s[0]).to_i,(0.8*s[1]).to_i)
|
277
|
+
self.add(@vbox)
|
278
|
+
self.signal_connect("delete_event") {quit;true}
|
279
|
+
|
280
|
+
self.show_all
|
281
|
+
end
|
282
|
+
|
283
|
+
def refresh_store
|
284
|
+
@store.clear
|
285
|
+
@list.radios.each{|radio|
|
286
|
+
child=@store.append
|
287
|
+
child[0]=radio.name
|
288
|
+
child[1]=radio
|
289
|
+
}
|
290
|
+
end
|
291
|
+
|
292
|
+
def quit
|
293
|
+
self.destroy
|
294
|
+
end
|
295
|
+
|
296
|
+
private
|
297
|
+
|
298
|
+
def top
|
299
|
+
refresh_list
|
300
|
+
s=@selection.selected_rows
|
301
|
+
unless s.empty?
|
302
|
+
index=[]; tmp=[]
|
303
|
+
s.each{|p| index.push(p.to_s.to_i)}
|
304
|
+
index.reverse!.each{|i| tmp.push(@list.radios.delete_at(i))}
|
305
|
+
@list.radios.unshift(tmp.reverse!).flatten!
|
306
|
+
refresh_store
|
307
|
+
@selection.select_range(Gtk::TreePath.new('0'), Gtk::TreePath.new((tmp.length-1).to_s))
|
308
|
+
end
|
309
|
+
end
|
310
|
+
|
311
|
+
def up
|
312
|
+
refresh_list
|
313
|
+
s=@selection.selected_rows
|
314
|
+
unless s.empty?
|
315
|
+
index=[]
|
316
|
+
s.each{|p| index.push(p.to_s.to_i)}
|
317
|
+
n=0
|
318
|
+
index.each{|i|
|
319
|
+
@list.radios[i-1], @list.radios[i]= @list.radios[i], @list.radios[i-1] unless i==n
|
320
|
+
n+=1
|
321
|
+
}
|
322
|
+
refresh_store
|
323
|
+
n=0
|
324
|
+
index.each{|i|
|
325
|
+
i==n ? p=i.to_s : p=(i-1).to_s
|
326
|
+
@selection.select_path(Gtk::TreePath.new(p))
|
327
|
+
n+=1
|
328
|
+
}
|
329
|
+
end
|
330
|
+
end
|
331
|
+
|
332
|
+
def rm
|
333
|
+
begin
|
334
|
+
s=@selection.selected_rows
|
335
|
+
s.reverse!.each{|path| @list.rm(path.to_s.to_i)}
|
336
|
+
refresh_store
|
337
|
+
rescue
|
338
|
+
ErrorError.new("Cannot remove current item (Nothing selected?).")
|
339
|
+
end
|
340
|
+
end
|
341
|
+
|
342
|
+
def down
|
343
|
+
refresh_list
|
344
|
+
s=@selection.selected_rows
|
345
|
+
unless s.empty?
|
346
|
+
index=[]
|
347
|
+
s.each{|p| index.push(p.to_s.to_i)}
|
348
|
+
n=@list.radios.length-1
|
349
|
+
index.reverse!.each{|i|
|
350
|
+
@list.radios[i+1], @list.radios[i]= @list.radios[i], @list.radios[i+1] unless i==n
|
351
|
+
n-=1
|
352
|
+
}
|
353
|
+
refresh_store
|
354
|
+
n=@list.radios.length-1
|
355
|
+
index.each{|i|
|
356
|
+
i==n ? p=i.to_s : p=(i+1).to_s
|
357
|
+
@selection.select_path(Gtk::TreePath.new(p))
|
358
|
+
n-=1
|
359
|
+
}
|
360
|
+
end
|
361
|
+
end
|
362
|
+
|
363
|
+
def bottom
|
364
|
+
refresh_list
|
365
|
+
s=@selection.selected_rows
|
366
|
+
unless s.empty?
|
367
|
+
index=[]; tmp=[]
|
368
|
+
s.each{|p| index.push(p.to_s.to_i)}
|
369
|
+
index.reverse!.each{|i| tmp.push(@list.radios.delete_at(i))}
|
370
|
+
b=@list.radios.length.to_s
|
371
|
+
@list.radios.concat(tmp.reverse!)
|
372
|
+
refresh_store
|
373
|
+
e=(@list.radios.length-1).to_s
|
374
|
+
@selection.select_range(Gtk::TreePath.new(b), Gtk::TreePath.new(e))
|
375
|
+
end
|
376
|
+
end
|
377
|
+
|
378
|
+
def add_radio#Same code in Radio::Window!
|
379
|
+
dialog=Radio::Dialog.new(_("Add a radio"), @parent)
|
380
|
+
if dialog.run==Gtk::Dialog::RESPONSE_ACCEPT
|
381
|
+
@list.add(dialog.name, dialog.url)
|
382
|
+
refresh_store
|
383
|
+
end
|
384
|
+
dialog.destroy
|
385
|
+
end
|
386
|
+
|
387
|
+
def clear#Same code in Radio::Window!
|
388
|
+
@store.clear
|
389
|
+
@list.clear
|
390
|
+
end
|
391
|
+
|
392
|
+
def refresh_list
|
393
|
+
@list.radios.clear
|
394
|
+
iter=@store.iter_first
|
395
|
+
if iter
|
396
|
+
@list.radios.push(iter[1])
|
397
|
+
while iter.next!
|
398
|
+
@list.radios.push(iter[1])
|
399
|
+
end
|
400
|
+
end
|
401
|
+
end
|
402
|
+
end
|
403
|
+
end
|
404
|
+
|