4 mainmenu - APMS Main Menu
6 Copyright (c) Andrew McMillan, 2007
12 $dbh = DBI
.connect("DBI:Pg:apms_catalyst","general")
16 @window = Gtk
::Window.new
17 @window.border_width
= 5
18 @window.title
= "APMS Main Menu"
21 @tips = Gtk
::Tooltips.new
24 # Add a set of buttons
26 buttons_sql
= $dbh.prepare("SELECT buttonlabel, linktype, linkcode, viewer, sortpanel, filterpanel, description, function FROM programlink WHERE source = #{link_id} AND exists( SELECT 1 FROM usrgroupmenu JOIN usrgroupmenuitem USING ( menuname ) WHERE menuname = 'Main Menu' AND programlink.linkcode = usrgroupmenuitem.linkcode);")
32 # buttons = Gtk::HButtonBox.new
33 buttons
= Gtk
::HBox.new( false, 0 )
34 while btn_row
= buttons_sql
.fetch
do
35 btn
= Gtk
::Button.new(btn_row
["buttonlabel"])
36 @tips.set_tip( btn
, btn_row
["description"], '' )
37 puts btn_row
["buttonlabel"] + " added"
38 btn
.signal_connect("clicked") { |handle
|
39 puts handle
.label
+ " clicked"
40 BrowseWindow
.new( handle
.label
)
42 (width
,height
) = btn
.size_request
44 buttons
.pack_start(btn
, false, false, 0)
46 if btns_width
>= row_width
then
47 puts
"Button row added - width #{btns_width}"
49 # buttons = Gtk::HButtonBox.new
50 buttons
= Gtk
::HBox.new( false, 0 )
51 # buttons.set_layout_style(Gtk::ButtonBox::START)
63 @window.signal_connect("destroy") {
64 puts
"Apms destroy event handler"
78 def initialize( label
)
79 window
= Gtk
::Window.new
82 window
.signal_connect("delete_event") {
83 puts
"BrowseWindow delete event handler"