----Next_Part(Wed_Oct_27_17:51:14_1999_886)--
Content-Type: Text/Plain; charset=iso-2022-jp
Content-Transfer-Encoding: 7bit

はじめまして。

Ruby 1.4.2
Ruby/Gtk 0.22
Gtk+ 1.2.6

Ruby/Gtkで statusbarを使いたくて探してみたのですが messages methodに
bug(?)があるようで、testgtkでは使えなくなっていたので少しい討澆泙靴拭

楊の archiveも検索してみたのですが件について探しきれませんでした。
pointerをご存知の方いらっしゃいますか?

あと、rb_struct_* は、etc/etc.cを見て見様見まねでい討澆泙靴拭
凖祖妖努 も読んでみたのですが、structに付いてはれてない様で‥;

まつもとゆきひろ氏の Ruby本には辺の事もい討△襪里任靴腓Δ
以下の errorがでるのですがどの様に対垢戮でしょうえ岱磔で structすら使ったことがない者がい討い襪里如邸邸

齡癆黷癇鰲艮欝癇鉗鈑 瘡鱚痲蜴蜚蛛跚繝闔齡瘤 嗟鼇

よろしくお願いします。
--
             yashi

----Next_Part(Wed_Oct_27_17:51:14_1999_886)--
Content-Type: Text/Plain; charset=us-ascii
Content-Transfer-Encoding: 7bit
Content-Disposition: attachment; filename="gtk.patch"

diff -u --new-file --recursive gtk-0.22/sample/testgtk/statusbar.rb gtk/sample/testgtk/statusbar.rb
--- gtk-0.22/sample/testgtk/statusbar.rb	Tue Aug 24 23:21:39 1999
+++ gtk/sample/testgtk/statusbar.rb	Wed Oct 27 16:54:31 1999
@@ -49,8 +49,12 @@
     @statusbar  tatusbar  tk::Statusbar::new()
     box1.pack_end(statusbar, true, true, 0)
     statusbar.show
-    statusbar.signal_connect("text_popped") do popped end
-
+    statusbar.signal_connect("text_popped") do |o, mid, text|
+      popped(mid, text)
+    end
+    statusbar.signal_connect("text_pushed") do |o, mid, text|
+      pushed(mid, text)
+    end
 #
 # GtkWidget* gtk_widget_new  (guint type, ...);
 #
@@ -107,11 +111,14 @@
   def steal
     @statusbar.remove(1, 4)
   end
-  def popped
-    if @statusbar.messages.nil?
+  def popped(mid, text)
+    if @statusbar.messages.nil? then
       @counter  
     end
   end
+  def pushed(mid, text)
+    # do nothing... as of gtk 1.2.6
+  end
   def contexts
     string  any context"
     printf("GtkStatusBar: context%s\", context_id
\n",
@@ -139,17 +146,11 @@
            @statusbar.get_context_id(string))
   end
   def dump_stack
-   print("not implemented.\n")
-   #   GSList *list
-#   for (list  tatusbar.messages; list; list  ist.next)
-#     {
-#       GtkStatusbarMsg *msg
-
-#       msg  ist.data
-#       g_print ("context_id: %d, message_id: %d, status_text: \"%s\"\n",
-#                msg.context_id,
-#                msg.message_id,
-#                msg.text)
-#     }
+    @statusbar.messages.each do |m|
+      printf ("context_id: %d, message_id: %d, status_text: \"%s\"\n",
+	      m.context_id,
+	      m.message_id,
+	      m.text)
+    end
   end
 end
diff -u --new-file --recursive gtk-0.22/sample/testgtk/testgtk.rb gtk/sample/testgtk/testgtk.rb
--- gtk-0.22/sample/testgtk/testgtk.rb	Sun Sep 26 01:54:55 1999
+++ gtk/sample/testgtk/testgtk.rb	Wed Oct 27 17:29:01 1999
@@ -115,7 +115,7 @@
     ["scrolled windows", ScrolledWindowSample],
     ["shapes", ShapesSample],
     ["spinbutton", SpinButtonSample],
-    ["statusbar", nil], #StatusbarSample],   # has BUG
+    ["statusbar", StatusbarSample],   # still has BUG
     ["test idle", nil],
     ["test mainloop", nil],
     ["test scrolling", nil],
diff -u --new-file --recursive gtk-0.22/src/rbgtkbox.c gtk/src/rbgtkbox.c
--- gtk-0.22/src/rbgtkbox.c	Tue Aug 24 23:21:44 1999
+++ gtk/src/rbgtkbox.c	Wed Oct 27 17:01:50 1999
@@ -479,6 +479,34 @@
   return Qnil;
 }
 
+static VALUE
+gSMsg2ary(msgs)
+    GSList *msgs;
+{
+    VALUE sMsg  b_struct_define("SMsg", "text", "context_id", "message_id", 0);
+    VALUE msg;
+    VALUE ary  b_ary_new();
+
+    while (msgs) {
+	GtkStatusbarMsg *gSMsg  sgs->data;
+	msg  b_struct_new(sMsg,
+			    rb_tainted_str_new2(gSMsg->text),
+			    INT2FIX(gSMsg->context_id),
+			    INT2FIX(gSMsg->message_id));
+	rb_ary_push(ary, msg);
+	msgs  sgs->next;
+    }
+
+    return ary;
+}
+
+static VALUE
+statusbar_messages(self)
+    VALUE self;
+{
+    return gSMsg2ary(GTK_STATUSBAR(get_widget(self))->messages);
+}
+
 void Init_gtk_statusbar()
 {
     gStatusBar  b_define_class_under(mGtk, "Statusbar", gHBox);
@@ -491,6 +519,7 @@
     rb_define_method(gStatusBar, "pop", statusbar_pop, 1);
     rb_define_method(gStatusBar, "get_context_id", statusbar_get_context_id, 1);
     rb_define_method(gStatusBar, "remove", statusbar_remove, 2);
+    rb_define_method(gStatusBar, "messages", statusbar_messages, 0);
 }
 
 /*

----Next_Part(Wed_Oct_27_17:51:14_1999_886)----