2 Copyright 2007-2008 Vincent Carmona
4 This file is part of ZiK.
6 ZiK is free software; you can redistribute it and/or modify
7 it under the terms of the GNU General Public License as published by
8 the Free Software Foundation; either version 2 of the License, or
9 (at your option) any later version.
11 ZiK is distributed in the hope that it will be useful,
12 but WITHOUT ANY WARRANTY; without even the implied warranty of
13 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
14 GNU General Public License for more details.
16 You should have received a copy of the GNU General Public License
17 along with ZiK; if not, write to the Free Software
18 Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
21 bindtextdomain('ZiK',{:path=>Ldir})
23 class SysTray < Gtk::StatusIcon
24 def initialize(window,player)
27 @bplay_tray=Gtk::CheckMenuItem.new(_('Play'))
28 @bplay_tray.signal_connect("toggled"){
29 if @show_tray #Do not process when setting the toggled state on showing the popup menu.
42 @bprev_tray=Gtk::ImageMenuItem.new(Gtk::Stock::MEDIA_PREVIOUS)
43 @bprev_tray.signal_connect("activate"){window.prev}
44 @bnext_tray=Gtk::ImageMenuItem.new(Gtk::Stock::MEDIA_NEXT)
45 @bnext_tray.signal_connect("activate"){window.next_s}
46 @bquit_tray=Gtk::ImageMenuItem.new(Gtk::Stock::QUIT)
47 @bshow_tray=Gtk::CheckMenuItem.new(_('Show player'))
48 @bshow_tray.signal_connect("toggled"){
49 if @show_tray #Do not process when setting the toggled state on showing the popup menu.
57 # @bnotification_tray=Gtk::CheckMenuItem.new(_('Afficher les notifications'))
58 @bquit_tray.signal_connect("activate"){window.quit}
59 @popup_tray=Gtk::Menu.new
60 @popup_tray.append(@bplay_tray)
61 @popup_tray.append(@bprev_tray)
62 @popup_tray.append(@bnext_tray)
63 @popup_tray.append(Gtk::SeparatorMenuItem.new)
64 @popup_tray.append(@bshow_tray)
65 # @popup_tray.append(@bnotification_tray)
66 @popup_tray.append(Gtk::SeparatorMenuItem.new)
67 @popup_tray.append(@bquit_tray)
71 self.pixbuf=Gdk::Pixbuf.new(File.join(Pdir,'ZiK.svg'))
72 self.tooltip=_('Audio player')
73 self.signal_connect('activate'){
80 self.signal_connect('popup-menu'){|tray, button, time|
82 @bplay_tray.active=@player.playing?
83 @bshow_tray.active=window.visible?
85 @popup_tray.popup(nil, nil, button, time)