[Date Prev][Date Next] [Thread Prev][Thread Next] [Date Index] [Thread Index]

Re: remove ruby1.6



Hi,

At Fri, 12 Aug 2005 17:16:19 +0200,
Michael Ablassmeier wrote:

> On Fri, Aug 12, 2005 at 10:24:05PM +0900, akira yamada / ?????????????????? wrote:
> > I don't know about aswiki, rsjog, tdiary (tdiary-plugin)
> > and tictactoe.  (I use tDiary on ruby1.8 and I have no problem.)
> 
> tictactoe depends on libgtk-ruby1.6. A short investigaion shows that it
> does not work with libgtk2-ruby out of the box. Im going to take a
> closer look in the next days (mostly some issues with create_from_xpm
> etc).

As I experienced porting from libgtk-ruby to libgtk2-ruby with gemcal in 
mhc-util package, I hacked tictactoe as well.
I hope this help you.
Anyway, http://ruby-gnome2.sourceforge.jp/ is good resource.

--- tictactoe.rb.orig	2003-11-22 01:41:38.000000000 +0900
+++ tictactoe.rb	2005-08-13 02:22:37.968965999 +0900
@@ -16,7 +16,8 @@
 #*                                                                         *
 #***************************************************************************
 
-require 'gtk'
+require 'gtk2'
+Gtk.init
 
 EASY = 1
 HARD = 2
@@ -158,7 +159,7 @@
   def initialize(message)
     super()
     set_modal(true)
-    set_position(Gtk::WIN_POS_CENTER)
+    set_window_position(Gtk::Window::POS_CENTER)
     set_default_size(300,120)
 
     vbox.add(Gtk::Label.new(message))
@@ -176,16 +177,16 @@
   def initialize
     super()
     set_modal(true)
-    set_position(Gtk::WIN_POS_CENTER)
+    set_window_position(Gtk::Window::POS_CENTER)
     set_default_size(400,300)
     set_title('About Tic-Tac-Toe for Ruby/GTK')
     
-    text = Gtk::Text.new(nil, nil)
+    text = Gtk::TextView.new(nil)
     text.set_editable(false)
 
-    font = Gdk::Font.font_load("-adobe-courier-medium-r-normal--*-120-*-*-*-*-*-*")
+    #font = Pango::FontDescription.new("serif normal")
 
-    text.insert(font, nil, nil,
+    text.buffer.set_text(
 		"\nTic Tac Toe for Ruby/Gtk\n" +
 		"Version 0.8.1\n\n" +
 		"(c) 06/2002, 11/2003 Daniel Lichtenberger\n\n" +
@@ -204,7 +205,8 @@
     okbutton = Gtk::Button.new('OK')
     action_area.add(okbutton)
     okbutton.signal_connect('clicked') do
-      destroy
+      # destroy
+      hide
     end
     
     show_all
@@ -236,7 +238,7 @@
 
   # id should be "player1", "player2" or "empty"
   def create_pixmap(id)
-    Gtk::Pixmap::new(@pix[id], @mask[id])
+    Gtk::Image::new(@pix[id], @mask[id])
   end
 end
 
@@ -352,7 +354,7 @@
 class GButton < Gtk::Button
   def initialize(x, y, gamefield, gfbuttons, aip, pixmaps)
     super()
-    set_usize(67, 67)
+#    set_usize(67, 67)
 
     @gx = x; @gy = y
     @gamefield = gamefield
@@ -468,10 +470,10 @@
 # main program
 
 # create main window
-window = Gtk::Window.new(Gtk::WINDOW_TOPLEVEL)
-window.set_position(Gtk::WIN_POS_CENTER)
+window = Gtk::Window.new(Gtk::Window::TOPLEVEL)
+window.set_window_position(Gtk::Window::POS_CENTER)
 window.set_default_size(200,200)
-window.set_policy(false, false, false)
+#window.set_policy(false, false, false)
 window.show
 
 # load pixmaps
@@ -494,13 +496,13 @@
 r1 = Gtk::RadioButton.new(nil, 'easy')
 r2 = Gtk::RadioButton.new(r1, 'hard')
 r1.signal_connect('toggled') do
-  if r1.active
+  if r1.active?
     $aiplayer.set_difficulty(EASY) 
     newGame
   end
 end
 r2.signal_connect('toggled') do
-  if r2.active
+  if r2.active?
     $aiplayer.set_difficulty(HARD) 
     newGame
   end
@@ -520,7 +522,7 @@
 box.add button
 button = Gtk::Button.new('About')
 button.signal_connect('clicked') do
-  dlg = AboutBox.new()
+  AboutBox.new()
 end
 box.add button
 

Regards,
Fumitoshi UKAI



Reply to: