grab back the focus on a proper textedit when reinserting a deleted element (useful...
authorgc <gc>
Sun, 12 Jun 2005 17:57:52 +0000 (17:57 +0000)
committergc <gc>
Sun, 12 Jun 2005 17:57:52 +0000 (17:57 +0000)
bin/booh
lib/booh/GtkAutoTable.rb

index 1079cf8f6fe33a284023d19496ed1923c9debd79..79d9ecbb42a96f20120a5b803883734529c19a0b 100755 (executable)
--- a/bin/booh
+++ b/bin/booh
@@ -811,6 +811,7 @@ def add_thumbnail(autotable, filename, type, thumbnail_img, caption)
                           Proc.new { |pos|
                               autotable.reinsert(pos, vbox, filename)
                               $notebook.set_page(1)
+                              autotable.queue_draws << proc { $vbox2textview[vbox].grab_focus }
                               Proc.new {
                                   perform_delete.call
                                   $notebook.set_page(1)
index 93b01bf3aea213c12745cf54c3a367d75723b27e..ca6b87b6f38405144b5e76b05a302f298cbed52a 100644 (file)
@@ -30,11 +30,14 @@ end
 
 class Gtk::AutoTable < Gtk::VBox
 
+    attr_accessor :queue_draws
+
     def initialize(row_spacings)
         @children = []
         @containers = []
         @width = -1
         @old_widths = []
+        @queue_draws = []
         @row_spacings = row_spacings
         @table = nil
         super
@@ -53,9 +56,9 @@ class Gtk::AutoTable < Gtk::VBox
             end
         }
         @timeout = Gtk.timeout_add(100) {
-            if @queue_draw
-                queue_draw
-                @queue_draw = false
+            if @queue_draws.size > 0
+                @queue_draws.each { |elem| elem.call }
+                @queue_draws.clear
             end
             true
         }
@@ -331,7 +334,7 @@ class Gtk::AutoTable < Gtk::VBox
                         put(e, e[:xnew], e[:ynew])
                     }
                     show_all
-                    @queue_draw = true
+                    @queue_draws << proc { queue_draw }
                 end
             end
         end