Masato Taruishi
taru****@users*****
2004年 9月 10日 (金) 19:36:05 JST
=================================================================== RCS file: demo/haviewer/haviewer.glade,v retrieving revision 1.12 retrieving revision 1.13 diff -u -r1.12 -r1.13 --- demo/haviewer/haviewer.glade 2004/09/10 09:22:21 1.12 +++ demo/haviewer/haviewer.glade 2004/09/10 10:36:05 1.13 @@ -366,7 +366,6 @@ <widget class="GtkHBox" id="hbox6"> <property name="border_width">4</property> <property name="visible">True</property> - <property name="sensitive">False</property> <property name="homogeneous">False</property> <property name="spacing">8</property> @@ -394,8 +393,9 @@ <child> <widget class="GtkEntry" id="monitor_entry"> <property name="visible">True</property> + <property name="sensitive">False</property> <property name="can_focus">True</property> - <property name="editable">True</property> + <property name="editable">False</property> <property name="visibility">True</property> <property name="max_length">0</property> <property name="text" translatable="yes">cn=u0001,o=ultrapossum</property> @@ -420,6 +420,7 @@ <child> <widget class="GtkButton" id="button1"> <property name="visible">True</property> + <property name="sensitive">False</property> <property name="can_focus">True</property> <property name="label">gtk-add</property> <property name="use_stock">True</property> @@ -434,13 +435,72 @@ </child> <child> - <widget class="GtkButton" id="button3"> + <widget class="GtkButton" id="entry_update"> <property name="visible">True</property> <property name="can_focus">True</property> - <property name="label">gtk-refresh</property> - <property name="use_stock">True</property> <property name="relief">GTK_RELIEF_NORMAL</property> <property name="focus_on_click">True</property> + <signal name="clicked" handler="on_entry_update_clicked" last_modification_time="Fri, 10 Sep 2004 09:30:03 GMT"/> + + <child> + <widget class="GtkAlignment" id="alignment3"> + <property name="visible">True</property> + <property name="xalign">0.5</property> + <property name="yalign">0.5</property> + <property name="xscale">0</property> + <property name="yscale">0</property> + <property name="top_padding">0</property> + <property name="bottom_padding">0</property> + <property name="left_padding">0</property> + <property name="right_padding">0</property> + + <child> + <widget class="GtkHBox" id="hbox10"> + <property name="visible">True</property> + <property name="homogeneous">False</property> + <property name="spacing">2</property> + + <child> + <widget class="GtkImage" id="image3"> + <property name="visible">True</property> + <property name="stock">gtk-execute</property> + <property name="icon_size">4</property> + <property name="xalign">0.5</property> + <property name="yalign">0.5</property> + <property name="xpad">0</property> + <property name="ypad">0</property> + </widget> + <packing> + <property name="padding">0</property> + <property name="expand">False</property> + <property name="fill">False</property> + </packing> + </child> + + <child> + <widget class="GtkLabel" id="label18"> + <property name="visible">True</property> + <property name="label" translatable="yes">Modify</property> + <property name="use_underline">True</property> + <property name="use_markup">False</property> + <property name="justify">GTK_JUSTIFY_LEFT</property> + <property name="wrap">False</property> + <property name="selectable">False</property> + <property name="xalign">0.5</property> + <property name="yalign">0.5</property> + <property name="xpad">0</property> + <property name="ypad">0</property> + </widget> + <packing> + <property name="padding">0</property> + <property name="expand">False</property> + <property name="fill">False</property> + </packing> + </child> + </widget> + </child> + </widget> + </child> </widget> <packing> <property name="padding">0</property> @@ -452,8 +512,9 @@ <child> <widget class="GtkButton" id="button2"> <property name="visible">True</property> + <property name="sensitive">False</property> <property name="can_focus">True</property> - <property name="label">gtk-delete</property> + <property name="label">gtk-remove</property> <property name="use_stock">True</property> <property name="relief">GTK_RELIEF_NORMAL</property> <property name="focus_on_click">True</property> =================================================================== RCS file: demo/haviewer/haviewer.rb,v retrieving revision 1.25 retrieving revision 1.26 diff -u -r1.25 -r1.26 --- demo/haviewer/haviewer.rb 2004/09/10 09:24:45 1.25 +++ demo/haviewer/haviewer.rb 2004/09/10 10:36:05 1.26 @@ -8,6 +8,10 @@ Gtk.main_quit end +def on_entry_update_clicked + $haview.views["entry"].entry_update +end + class HAViewer Hosts = [] @@ -175,7 +179,7 @@ @entryCSN = $1 end end - UltraPossumHost.update_latest_entryCSN +# UltraPossumHost.update_latest_entryCSN case @entryCSN when @@latest_entryCSN @repl_sign.on(Green) @@ -265,6 +269,7 @@ end end end + UltraPossumHost.update_latest_entryCSN Column = ["S", "Host", "Type", "Status", "Pid", "Since" ] @@ -337,7 +342,27 @@ class EntryView < View - Column = ["S", "Host", "Type", "entryCSN" ] + def entry_update + open("|ldapmodify -x -h #{Conf["LDAPMASTER"]} -D #{Conf["ROOTDN"]} -w #{Conf["ROOTPW"]} > /dev/null", "w") { |io| + date=`sh -c 'LANG=C date'` + io.puts <<EOF +dn: #{UltraPossumHost::monitored_entry} +changetype: modify +replace: description +description: #{date} +EOF + } + UltraPossumHost.update_latest_entryCSN +# @glade["latest_entrycsn"].set_text(UltraPossumHost::latest_entryCSN) + UltraPossumHosts.each do |host| + host.monitor_entry + end + UltraPossumHosts.each do |host| + update(host) + end + end + + Column = ["S", "Host", "Type", "entryCSN" ] def initialize(haview) super @@ -377,12 +402,12 @@ def initialize(glade) @glade = @glade = GladeXML.new(glade) {|handler| method(handler)} - @views = [] + @views = {} update end - def add_view(view) - @views << view + def add_view(name, view) + @views[name] = view end def update @@ -396,20 +421,20 @@ Gtk.init -haview = HAViewer.new('haviewer.glade') -haview.add_view( HAViewer::View::UltraPossum.new(haview) ) -haview.add_view( HAViewer::View::UltraPossum::EntryView.new(haview) ) -haview.update +$haview = HAViewer.new('haviewer.glade') +$haview.add_view( "status", HAViewer::View::UltraPossum.new($haview) ) +$haview.add_view( "entry", HAViewer::View::UltraPossum::EntryView.new($haview) ) +$haview.update HAViewer::Hosts.each do |host| - haview.views.each do |view| + $haview.views.each do |name,view| view.update(host) end Thread.new { while(1) do host.update - haview.views.each do |view| + $haview.views.each do |name,view| view.update(host) - haview.update + $haview.update end sleep 5 end