changeset 23:8ba26b3c03fd

Added SubtlyBrowserStop
author unexist
date Fri, 22 Jan 2010 13:44:35 +0100
parents 80c19b39f3f6
children 4652f9744833
files subtly.rb subtly/browser.rb subtly/webkit.rb
diffstat 3 files changed, 32 insertions(+), 6 deletions(-) [+]
line wrap: on
line diff
--- a/subtly.rb	Fri Jan 22 13:32:42 2010 +0100
+++ b/subtly.rb	Fri Jan 22 13:44:35 2010 +0100
@@ -18,6 +18,8 @@
   "O"   => :SubtlyUriEdit,
   "p"   => :SubtlyUriPaste,
   "i"   => :SubtlyModeInsert,
+  "Esc" => :SubtlyModeCommand,
+  "s"   => :SubtlyBrowserStop,
   "b"   => :SubtlyBrowserBack,
   "m"   => :SubtlyBrowserForward,
   "r"   => :SubtlyBrowerReloadCache,
@@ -25,7 +27,6 @@
   "gg"  => :SubtlyScrollTop,
   "G"   => :SubtlyScrollBottom,
   "ZZ"  => :SubtlyQuit,
-  "Esc" => :SubtlyModeCommand,
 
   # Jumps
   "g_"  => "http://www.google.de/search?q=%s"
--- a/subtly/browser.rb	Fri Jan 22 13:32:42 2010 +0100
+++ b/subtly/browser.rb	Fri Jan 22 13:44:35 2010 +0100
@@ -73,7 +73,7 @@
       @vbox1.add(@hbox,     false, true,  0)
       @hbox.add(@info,      true,  true,  5)
       @hbox.add(@status,    true,  true,  5)
-      @hbox.add(@page,    false, true,  5)
+      @hbox.add(@page,      false, true,  5)
       #@vbox2.add(@list,     false, true, 0)
       @vbox2.add(@input,    false, true,  0)
       @vbox1.add(@vbox2,    false, true,  0)
@@ -182,6 +182,8 @@
           @webkit.back
         when :SubtlyBrowserForward then
           @webkit.forward
+        when :SubtlyBrowserStop then
+          @webkit.stop
         when :SubtlyBrowerReloadCache then
           @webkit.reload(true)
         when :SubtlyBrowerReload then
--- a/subtly/webkit.rb	Fri Jan 22 13:32:42 2010 +0100
+++ b/subtly/webkit.rb	Fri Jan 22 13:44:35 2010 +0100
@@ -63,18 +63,30 @@
  
     ## back
     # Step back in browser history
+    #
+    # @param [Fixnum, #read]  steps  Steps to move back
     ##
 
-    def back
-      Subtly::Webkit.ffi_go_steps(@widget, -1)
+    def back(steps = 1)
+      Subtly::Webkit.ffi_go_steps(@widget, steps * -1)
     end
 
     ## forward
     # Step forward in history
+    #
+    # @param [Fixnum, #read]  steps  Steps to move forward
     ##
 
-    def forward
-      Subtly::Webkit.ffi_go_steps(@widget, 1)
+    def forward(steps = 1)
+      Subtly::Webkit.ffi_go_steps(@widget, steps)
+    end
+
+    ## stop
+    # Stop page loading
+    ##
+
+    def stop
+      Subtly::Webkit.ffi_stop(@widget)
     end
 
     ## reload
@@ -149,6 +161,17 @@
       :webkit_web_view_go_back_or_forward, [ :pointer, :int ], :void
     )
 
+    ## ffi_stop
+    # Stop page loading
+    #
+    # @param  [Pointer, #read]  web_view  A #WebKitWebView
+    ##
+
+
+    attach_function(:ffi_stop,
+      :webkit_web_view_stop_loading, [ :pointer ], :void
+    )
+
     ## ffi_reload_cache
     # Reload view from cache
     #