[Libguestfs] [PATCH 05/61] p2v client: newmain - give mock obj a name, more gtk and gdk mocks

Maros Zatko mzatko at redhat.com
Wed Feb 12 14:30:17 UTC 2014


---
 p2v/client/lib/virt-p2v/ui/main.rb | 31 ++++++++++++++++++++++---------
 1 file changed, 22 insertions(+), 9 deletions(-)

diff --git a/p2v/client/lib/virt-p2v/ui/main.rb b/p2v/client/lib/virt-p2v/ui/main.rb
index 55cc9f0..93b2663 100644
--- a/p2v/client/lib/virt-p2v/ui/main.rb
+++ b/p2v/client/lib/virt-p2v/ui/main.rb
@@ -21,17 +21,18 @@ module VirtP2V
 module UI
   class NeverMind
     def method_missing(m, *args, &block)
-      puts "Never mind call '#{m} #{args}'. ON #{self.inspect}"
+      puts "Never mind call '#{m} #{args}'. ON #{@name || self.inspect}"
       self
     end
 
     def self.method_missing(m, *args, &block)
-      puts "Never mind class call '#{m} #{args}'. ON #{self.inspect}"
+      puts "Never mind class call '#{m} #{args}'. ON #{@name || self.inspect}"
       self
     end
 
-    def initialize
-      puts "Hi, I'm #{self.inspect}"
+    def initialize(name=nil, *args)
+      @name = name
+      puts "Hi, I'm #{@name || self.inspect}"
     end
   end
 end
@@ -40,10 +41,16 @@ end
 module Gtk
   Builder = VirtP2V::UI::NeverMind
   STATE_NORMAL = 0
+  SELECTION_SINGLE = 1
+  TreeRowReference = VirtP2V::UI::NeverMind
+
 end
 
 module Gdk
   Color = VirtP2V::UI::NeverMind
+  Cursor = VirtP2V::UI::NeverMind
+  Cursor::Type = VirtP2V::UI::NeverMind
+  Cursor::Type::X_CURSOR = VirtP2V::UI::NeverMind
 end
 
 module VirtP2V
@@ -161,12 +168,12 @@ class NewMain < Main
     # need to write tests
     puts "GET_OBJ #{name}"
     if name == "network_win" then
-      n = NeverMind.new
-      n.define_method : do
-
-      end
+      n = NeverMind.new name
+#      n.define_method : do
+#
+#      end
     else
-      NeverMind.new
+      NeverMind.new name
     end
   end
 
@@ -175,6 +182,12 @@ class NewMain < Main
     # basic idea is to 'proceed with actions
     # as would user do' based on parameters passed
     # through kernel command line
+    puts "this is the main loop"
+  end
+
+  def register_handler(signal, handler)
+    super(signal, handler)
+    puts "#{handler} for #{signal} action registered"
   end
 
   def initialize dry=nil
-- 
1.8.3.1




More information about the Libguestfs mailing list