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
@@ -0,0 +1,96 @@
|
|
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 Notify
|
24
|
+
class Configuration < Hash
|
25
|
+
def initialize(dir)
|
26
|
+
@file=File.join(dir,'notifyrc')
|
27
|
+
default={:time=>3.0, :native=>true, :bg=>'Pink', :fg=>'black'}
|
28
|
+
super
|
29
|
+
self.merge!(default)
|
30
|
+
if File.exist?(@file)
|
31
|
+
read
|
32
|
+
else
|
33
|
+
ModErrorError.new(Notify.mod, "Configuration file not found. Use default configuration.")
|
34
|
+
end
|
35
|
+
end
|
36
|
+
|
37
|
+
def read
|
38
|
+
begin
|
39
|
+
f=File.open(@file,'r')
|
40
|
+
array=f.readlines
|
41
|
+
array.reject!{|a| a =~ /^#/}
|
42
|
+
array.reject!{|a| a =~ /^\n/}
|
43
|
+
array.each{|a| a.chomp!}
|
44
|
+
array.each{|a|
|
45
|
+
l=a.split('=', 2)
|
46
|
+
self[l[0].to_sym]=l[1]
|
47
|
+
}
|
48
|
+
test
|
49
|
+
str2value
|
50
|
+
ModErrorInfo.new(Notify.mod, "configuration read.")
|
51
|
+
rescue
|
52
|
+
ModErrorError.new(Notify.mod, "reading configuration file.")
|
53
|
+
ensure
|
54
|
+
f.close if f
|
55
|
+
end
|
56
|
+
end
|
57
|
+
|
58
|
+
def save
|
59
|
+
if $write_config
|
60
|
+
begin
|
61
|
+
dir=File.dirname(@file)
|
62
|
+
Dir.mkdir(dir) unless File.exist?(dir)
|
63
|
+
f=File.open(@file,'w')
|
64
|
+
f.puts '##Configuration file for notify module (ZiK audio player).'
|
65
|
+
self.each_pair{|key, value| f.puts "#{key}=#{value}"}
|
66
|
+
ModErrorInfo.new(Notify.mod, "configuration saved")
|
67
|
+
rescue
|
68
|
+
ModErrorError.new(Notify.mod, "writting configuration file.")
|
69
|
+
ensure
|
70
|
+
f.close if f
|
71
|
+
end
|
72
|
+
end
|
73
|
+
end
|
74
|
+
|
75
|
+
private
|
76
|
+
def str2value
|
77
|
+
self[:time]=self[:time].to_f
|
78
|
+
self[:native]=="false" ? self[:native]=false : self[:native]=true
|
79
|
+
end
|
80
|
+
|
81
|
+
def test
|
82
|
+
begin
|
83
|
+
Gdk::Color.parse(self[:bg])
|
84
|
+
rescue
|
85
|
+
ModErrorError.new(Notify.mod, "#{self[:bg]} is not a valid color. Use default one.")
|
86
|
+
self[:bg]=@default[:bg]
|
87
|
+
end
|
88
|
+
begin
|
89
|
+
Gdk::Color.parse(self[:fg])
|
90
|
+
rescue
|
91
|
+
ModErrorError.new(Notify.mod, "#{self[:fg]} is not a valid color. Use default one.")
|
92
|
+
self[:fg]=@default[:fg]
|
93
|
+
end
|
94
|
+
end
|
95
|
+
end
|
96
|
+
end
|
@@ -0,0 +1,76 @@
|
|
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 Notify
|
24
|
+
class ConfigWidget < Gtk::VBox
|
25
|
+
attr_reader :btime, :bradio1, :bg_entry, :fg_entry
|
26
|
+
|
27
|
+
def initialize(config)
|
28
|
+
@adj=Gtk::Adjustment.new(config[:time], 0.5, 20.0, 0.5, 1.0, 0)
|
29
|
+
@btime=Gtk::SpinButton.new(@adj, 1.0, 1)
|
30
|
+
@time_frame=Gtk::Frame.new(_('Display time'))
|
31
|
+
@time_frame.add(@btime)
|
32
|
+
|
33
|
+
@bradio1=Gtk::RadioButton.new(_('Use native notifications'))
|
34
|
+
@bradio1.signal_connect('toggled'){
|
35
|
+
tf=@bradio1.active?
|
36
|
+
@bg_frame.sensitive=tf
|
37
|
+
@fg_frame.sensitive=tf
|
38
|
+
}
|
39
|
+
@bradio2=Gtk::RadioButton.new(@bradio1, _('Use system notifications'))
|
40
|
+
|
41
|
+
@bg_entry=Gtk::Entry.new
|
42
|
+
@bg_entry.text=config[:bg]
|
43
|
+
@bcolor=Gtk::ColorButton.new(Gdk::Color.parse(config[:bg]))
|
44
|
+
@bcolor.tooltip_text=_('Select a color.')
|
45
|
+
@bcolor.signal_connect('color-set'){@bg_entry.text=@bcolor.color.to_s}
|
46
|
+
@bg_frame=Gtk::Frame.new(_('Background color'))
|
47
|
+
@bg_frame.add(hpack([@bg_entry, @bcolor]))
|
48
|
+
|
49
|
+
@fg_entry=Gtk::Entry.new
|
50
|
+
@fg_entry.text=config[:fg]
|
51
|
+
@bcolor2=Gtk::ColorButton.new(Gdk::Color.parse(config[:fg]))
|
52
|
+
@bcolor2.tooltip_text=_('Select a color.')
|
53
|
+
@bcolor2.signal_connect('color-set'){@fg_entry.text=@bcolor2.color.to_s}
|
54
|
+
@fg_frame=Gtk::Frame.new(_('Foreground color'))
|
55
|
+
@fg_frame.add(hpack([@fg_entry, @bcolor2]))
|
56
|
+
|
57
|
+
config[:native] ? @bradio1.active=true : @bradio2.active=true
|
58
|
+
super()
|
59
|
+
self.spacing=$border
|
60
|
+
self.pack_start(@time_frame, false)
|
61
|
+
self.pack_start(hpack([@bradio1, @bradio2]), false)
|
62
|
+
self.pack_start(@bg_frame, false)
|
63
|
+
self.pack_start(@fg_frame, false)
|
64
|
+
end
|
65
|
+
|
66
|
+
private
|
67
|
+
def hpack(array)
|
68
|
+
hbox=Gtk::HBox.new
|
69
|
+
hbox.spacing=$border
|
70
|
+
array.each{|el|
|
71
|
+
el.is_a?(Gtk::Entry) ? expand=true : expand=false
|
72
|
+
hbox.pack_start(el, expand)}
|
73
|
+
hbox
|
74
|
+
end
|
75
|
+
end
|
76
|
+
end
|
@@ -0,0 +1,56 @@
|
|
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 Notify
|
24
|
+
class Window < Gtk::Window
|
25
|
+
attr_reader :label
|
26
|
+
|
27
|
+
def initialize(config)
|
28
|
+
@config=config
|
29
|
+
|
30
|
+
@label=Gtk::Label.new
|
31
|
+
@label.wrap=true#ellipsize -> true
|
32
|
+
@image=Gtk::Image.new(File.join(Pix_dir,'ZiK.svg'))
|
33
|
+
@frame=Gtk::Frame.new
|
34
|
+
@frame.label_widget=Gtk::Label.new.set_markup('<span foreground="'+@config[:fg]+'">'+_('Playing')+'</span>')
|
35
|
+
@frame.add(@label)
|
36
|
+
@box=Gtk::HBox.new
|
37
|
+
@box.spacing=$border
|
38
|
+
@box.pack_start(@image, false, false)
|
39
|
+
@box.pack_start(@frame, false, false)
|
40
|
+
super(Gtk::Window::TOPLEVEL)
|
41
|
+
self.border_width=$border
|
42
|
+
self.decorated=false
|
43
|
+
self.skip_taskbar_hint=true
|
44
|
+
self.skip_pager_hint=true
|
45
|
+
self.resizable=false
|
46
|
+
self.can_focus=false
|
47
|
+
self.modify_bg(Gtk::STATE_NORMAL, Gdk::Color.parse(@config[:bg]))
|
48
|
+
#See Gtk::Widget#modify_style for global bg, fg, font, bg_pixmap
|
49
|
+
self.gravity=Gdk::Window::GRAVITY_NORTH_EAST
|
50
|
+
self.add(@box)
|
51
|
+
|
52
|
+
@box.show_all
|
53
|
+
end
|
54
|
+
|
55
|
+
end
|
56
|
+
end
|
data/mod/trayicon.rb
ADDED
@@ -0,0 +1,83 @@
|
|
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 Trayicon
|
24
|
+
def Trayicon.mod
|
25
|
+
@m||=Mod.new('trayicon', "Tray icon", _("Display an icon in the system tray."),
|
26
|
+
'Vincent Carmona <vinc4mai@gmail.com>', 'GPL-2')
|
27
|
+
end
|
28
|
+
|
29
|
+
Trayicon.mod
|
30
|
+
def @m.init(input)
|
31
|
+
@dir=input[:mod_dir]
|
32
|
+
@zik=zik
|
33
|
+
require File.join(@dir, 'trayicon', 'config')
|
34
|
+
@config=Configuration.new(input[:config_dir])
|
35
|
+
require File.join(@dir, 'trayicon', 'configwidget')
|
36
|
+
end
|
37
|
+
|
38
|
+
def @m.load
|
39
|
+
unless @loaded
|
40
|
+
require File.join(@dir, 'trayicon', 'icon')
|
41
|
+
(defined? @tray) ? @tray.visible=true : @tray=Trayicon::Icon.new(@zik, @config)
|
42
|
+
@zik.signal_connect('play'){|widget, song|
|
43
|
+
if @loaded
|
44
|
+
@tray.tooltip="ZiK\n#{song.name}"
|
45
|
+
end
|
46
|
+
}
|
47
|
+
@zik.signal_connect('stop'){@tray.tooltip='ZiK' if @loaded}
|
48
|
+
ModErrorInfo.new(self, "module loaded.")
|
49
|
+
@loaded=true
|
50
|
+
else
|
51
|
+
false
|
52
|
+
end
|
53
|
+
end
|
54
|
+
|
55
|
+
def @m.unload
|
56
|
+
if @loaded
|
57
|
+
#@tray.destroy #No method to destroy an Gtk::StatusIcon.
|
58
|
+
@tray.visible=false
|
59
|
+
ModErrorInfo.new(self, ModErrorINFO, "module unloaded.")
|
60
|
+
@loaded=false
|
61
|
+
true
|
62
|
+
else
|
63
|
+
false
|
64
|
+
end
|
65
|
+
end
|
66
|
+
|
67
|
+
def @m.configwidget
|
68
|
+
@wconfig=ConfigWidget.new(@config)
|
69
|
+
end
|
70
|
+
|
71
|
+
def @m.saveconfig
|
72
|
+
if @loaded
|
73
|
+
@config[:scroll_event]=@wconfig.bscroll.active?
|
74
|
+
true
|
75
|
+
else
|
76
|
+
false
|
77
|
+
end
|
78
|
+
end
|
79
|
+
|
80
|
+
def @m.quit
|
81
|
+
@config.save if @config
|
82
|
+
end
|
83
|
+
end
|
@@ -0,0 +1,79 @@
|
|
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 Trayicon
|
24
|
+
class Configuration < Hash
|
25
|
+
def initialize(dir)
|
26
|
+
@file=File.join(dir,'trayiconrc')
|
27
|
+
default={:scroll_event=>false}
|
28
|
+
super
|
29
|
+
self.merge!(default)
|
30
|
+
if File.exist?(@file)
|
31
|
+
read
|
32
|
+
else
|
33
|
+
ModErrorError.new(Trayicon.mod, "Configuration file not found. Use default configuration.")
|
34
|
+
end
|
35
|
+
end
|
36
|
+
|
37
|
+
def read
|
38
|
+
begin
|
39
|
+
f=File.open(@file,'r')
|
40
|
+
array=f.readlines
|
41
|
+
array.reject!{|a| a =~ /^#/}
|
42
|
+
array.reject!{|a| a =~ /^\n/}
|
43
|
+
array.each{|a| a.chomp!}
|
44
|
+
array.each{|a|
|
45
|
+
l=a.split('=', 2)
|
46
|
+
self[l[0].to_sym]=l[1]
|
47
|
+
}
|
48
|
+
str2value
|
49
|
+
ModErrorInfo.new(Trayicon.mod, "configuration read.")
|
50
|
+
rescue
|
51
|
+
ModErrorError.new(Trayicon.mod, "reading configuration file.")
|
52
|
+
ensure
|
53
|
+
f.close if f
|
54
|
+
end
|
55
|
+
end
|
56
|
+
|
57
|
+
def save
|
58
|
+
if $write_config
|
59
|
+
begin
|
60
|
+
dir=File.dirname(@file)
|
61
|
+
Dir.mkdir(dir) unless File.exist?(dir)
|
62
|
+
f=File.open(@file,'w')
|
63
|
+
f.puts '##Configuration file for trayicon module (ZiK audio player).'
|
64
|
+
self.each_pair{|key, value| f.puts "#{key}=#{value}"}
|
65
|
+
ModErrorInfo.new(Trayicon.mod, "configuration saved")
|
66
|
+
rescue
|
67
|
+
ModErrorError.new(Trayicon.mod, "Writting configuration file.")
|
68
|
+
ensure
|
69
|
+
f.close if f
|
70
|
+
end
|
71
|
+
end
|
72
|
+
end
|
73
|
+
|
74
|
+
private
|
75
|
+
def str2value
|
76
|
+
self[:scroll_event]=="true" ? self[:scroll_event]=true : self[:scroll_event]=false
|
77
|
+
end
|
78
|
+
end
|
79
|
+
end
|
@@ -0,0 +1,35 @@
|
|
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 Trayicon
|
24
|
+
class ConfigWidget < Gtk::Frame
|
25
|
+
attr_reader :bscroll
|
26
|
+
|
27
|
+
def initialize(config)
|
28
|
+
@bscroll=Gtk::CheckButton.new(_("Check to add interactions with third button mouse.\ndown : next song.\nup : previous song.\nCtrl+down : decrease volume.\nCtrl+up : increase volume."))
|
29
|
+
@bscroll.active=config[:scroll_event]
|
30
|
+
|
31
|
+
super(_('Scroll actions'))
|
32
|
+
self.add(@bscroll)
|
33
|
+
end
|
34
|
+
end
|
35
|
+
end
|
@@ -0,0 +1,99 @@
|
|
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 Trayicon
|
24
|
+
class Icon < Gtk::StatusIcon
|
25
|
+
def initialize(zik, config)
|
26
|
+
@zik=zik
|
27
|
+
@pop=false
|
28
|
+
|
29
|
+
#*********************Menu**********************************
|
30
|
+
#player
|
31
|
+
@play_it=Gtk::ImageMenuItem.new(Gtk::Stock::MEDIA_PLAY)
|
32
|
+
@play_it.signal_connect('activate'){@zik.play}
|
33
|
+
@pause_it=Gtk::ImageMenuItem.new(Gtk::Stock::MEDIA_PAUSE)
|
34
|
+
@pause_it.signal_connect('activate'){@zik.pause}
|
35
|
+
@previous_it=Gtk::ImageMenuItem.new(Gtk::Stock::MEDIA_PREVIOUS)
|
36
|
+
@previous_it.signal_connect('activate'){@zik.previous_song}
|
37
|
+
@next_it=Gtk::ImageMenuItem.new(Gtk::Stock::MEDIA_NEXT)
|
38
|
+
@next_it.signal_connect('activate'){@zik.next_song}
|
39
|
+
#Hide/show
|
40
|
+
@showgui_it=Gtk::CheckMenuItem.new(_("Main window"))
|
41
|
+
@showgui_it.signal_connect("toggled"){
|
42
|
+
unless @pop
|
43
|
+
@zik.visible? ? @zik.hide : @zik.show
|
44
|
+
end
|
45
|
+
}
|
46
|
+
#Quit
|
47
|
+
@quit_it=Gtk::ImageMenuItem.new(Gtk::Stock::QUIT)
|
48
|
+
@quit_it.signal_connect('activate'){@zik.quit}
|
49
|
+
#Main
|
50
|
+
@menu=Gtk::Menu.new
|
51
|
+
[@play_it, @pause_it, @previous_it, @next_it].each{|it| @menu.append(it)}
|
52
|
+
@menu.append(Gtk::SeparatorMenuItem.new)
|
53
|
+
@menu.append(@showgui_it)
|
54
|
+
@menu.append(Gtk::SeparatorMenuItem.new)
|
55
|
+
@menu.append(@quit_it)
|
56
|
+
@menu.show_all
|
57
|
+
|
58
|
+
#*********************Main**********************************
|
59
|
+
super()
|
60
|
+
self.pixbuf=Gdk::Pixbuf.new(File.join(Pix_dir, 'ZiK.svg'))
|
61
|
+
self.tooltip='ZiK'
|
62
|
+
self.signal_connect('activate'){@zik.visible? ? @zik.hide : @zik.show}
|
63
|
+
self.signal_connect('popup-menu'){|tray, button, time|
|
64
|
+
@pop=true
|
65
|
+
@showgui_it.active=@zik.visible?
|
66
|
+
@menu.popup(nil, nil, button, time)
|
67
|
+
@pop=false
|
68
|
+
}
|
69
|
+
begin
|
70
|
+
self.signal_connect('scroll-event'){|icon, event|
|
71
|
+
if config[:scroll_event]
|
72
|
+
#Check only for control, alt and shift.
|
73
|
+
mask=event.state&(Gdk::Window::CONTROL_MASK|Gdk::Window::MOD1_MASK|Gdk::Window::SHIFT_MASK)
|
74
|
+
case mask
|
75
|
+
when 0#no modifier key hit
|
76
|
+
case event.direction
|
77
|
+
when Gdk::EventScroll::UP
|
78
|
+
@zik.previous_song
|
79
|
+
when Gdk::EventScroll::DOWN
|
80
|
+
@zik.next_song
|
81
|
+
end
|
82
|
+
when Gdk::Window::CONTROL_MASK
|
83
|
+
case event.direction
|
84
|
+
when Gdk::EventScroll::UP
|
85
|
+
@zik.volume_up
|
86
|
+
when Gdk::EventScroll::DOWN
|
87
|
+
@zik.volume_down
|
88
|
+
end
|
89
|
+
end
|
90
|
+
end
|
91
|
+
}
|
92
|
+
@mask=Gdk::Window::ModifierType.new
|
93
|
+
@mask2=Gdk::Window::ModifierType.new(Gdk::Window::CONTROL_MASK)
|
94
|
+
rescue GLib::NoSignalError
|
95
|
+
ModErrorError.new(Trayicon.mod, "Cannot watch for scrolling events.")
|
96
|
+
end
|
97
|
+
end
|
98
|
+
end
|
99
|
+
end
|