summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorBertrand Jacquin (Beber) <beber.mailing@gmail.com>2006-06-04 18:46:18 +0200
committerbeber <beber@meathook.melee>2006-06-04 18:46:18 +0200
commit13c49b79ab4e0faedfe813b5b116a0f50a10d0d4 (patch)
treed8d39c085e255d9153d37515a795f88cb4064670
parentruby: change the default size (diff)
downloadwmhuitrehuitre-13c49b79ab4e0faedfe813b5b116a0f50a10d0d4.tar.gz
ruby: get xml from moules.org and show it
-rwxr-xr-xruby/wmHuitreHuitre.rb17
1 files changed, 17 insertions, 0 deletions
diff --git a/ruby/wmHuitreHuitre.rb b/ruby/wmHuitreHuitre.rb
index e830e1d..537ccfb 100755
--- a/ruby/wmHuitreHuitre.rb
+++ b/ruby/wmHuitreHuitre.rb
@@ -7,6 +7,10 @@
# Jabber Chat Room: else@chat.jabberfr.org
require 'gtk2'
+require 'net/http'
+
+hostname = "moules.org"
+path = "/board/backend"
Gtk.init
@@ -46,7 +50,20 @@ table.attach(entry_box, 0, 1, 2, 3, Gtk::FILL | Gtk::EXPAND, 0,
table.attach(bouton, 1, 2, 2, 3, Gtk::FILL, 0, 0, 0)
table.attach(dialog_box, 0, 2, 1, 2, Gtk::FILL, Gtk::FILL | Gtk::EXPAND, 0, 0)
+text = Gtk::TextView.new()
+buf = Gtk::TextBuffer.new()
+text.set_editable(false)
+
+Net::HTTP.start(hostname) do |http|
+ response = http.get(path, {'User-Agent' => 'wmHuitreHuitre/0.1'})
+ buf.set_text(response.body)
+end
+
+text.set_buffer(buf)
+
dialog_box.set_policy(Gtk::POLICY_NEVER, Gtk::POLICY_AUTOMATIC)
+dialog_box << text
+
interface.show_all
Gtk.main