Skip to content

Commit

Permalink
Merge branch 'develop' into downloads
Browse files Browse the repository at this point in the history
Conflicts:
	config/webview.lua
  • Loading branch information
karottenreibe committed Sep 3, 2010
2 parents 38af51a + 0b8c8b5 commit 12f282f
Show file tree
Hide file tree
Showing 9 changed files with 446 additions and 296 deletions.
2 changes: 0 additions & 2 deletions Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -59,8 +59,6 @@ install:
install -m644 README.md AUTHORS COPYING* $(DOCDIR)
cp -r lib/ $(INSTALLDIR)/share/luakit/
chmod -R 755 $(INSTALLDIR)/share/luakit/lib/
cp -r scripts/ $(INSTALLDIR)/share/luakit/
chmod -R 755 $(INSTALLDIR)/share/luakit/scripts/
install -D luakit $(INSTALLDIR)/bin/luakit
install -d $(DESTDIR)/etc/xdg/luakit/
install -D config/*.lua $(DESTDIR)/etc/xdg/luakit/
Expand Down
3 changes: 0 additions & 3 deletions config/binds.lua
Original file line number Diff line number Diff line change
Expand Up @@ -120,9 +120,6 @@ binds.mode_binds = {
buf("^ZZ$", function (w) w:close_win() end),
buf("^D$", function (w) w:close_win() end),

-- Link following
key({}, "f", function (w) w:set_mode("follow") end),

-- Bookmarking
key({}, "B", function (w) w:enter_cmd(":bookmark " .. ((w:get_current() or {}).uri or "http://") .. " ") end),
buf("^gb$", function (w) w:navigate(bookmarks.dump_html()) end),
Expand Down
38 changes: 9 additions & 29 deletions config/modes.lua
Original file line number Diff line number Diff line change
Expand Up @@ -17,20 +17,22 @@ end
window.init_funcs.modes_setup = function (w)
-- Calls the `enter` and `leave` mode hooks.
w.win:add_signal("mode-changed", function (_, mode)
-- Call the last modes `leave` hook.
if current and current.leave then
current.leave(w)
end

-- Update window binds
w:update_binds(mode)
local leave = (current or {}).leave

-- Get new modes functions
current = modes[mode]

-- Call the last modes `leave` hook.
if leave then leave(w) end

-- Check new mode
if not current then
error("changed to un-handled mode: " .. mode)
end

-- Update window binds
w:update_binds(mode)

-- Call new modes `enter` hook.
if current.enter then current.enter(w) end
end)
Expand Down Expand Up @@ -138,25 +140,3 @@ new_mode("search", {
p:show()
end,
})

-- Setup follow mode
new_mode("follow", {
enter = function (w)
local i, p = w.ibar.input, w.ibar.prompt
w:eval_js_from_file(lousy.util.find_data("scripts/follow.js"))
w:eval_js("clear(); show_hints();")
p.text = "Follow:"
p:show()
i.text = ""
i:show()
i:focus()
i:set_position(-1)
end,
leave = function (w)
if w.eval_js then w:eval_js("clear();") end
end,
changed = function (w, text)
local ret = w:eval_js(string.format("update(%q);", text))
w:emit_form_root_active_signal(ret)
end,
})
1 change: 1 addition & 0 deletions config/rc.lua
Original file line number Diff line number Diff line change
Expand Up @@ -31,6 +31,7 @@ require "webview"
require "binds"

-- Init scripts
require "follow"
require "formfiller"
require "go_input"
require "follow_selected"
Expand Down
2 changes: 1 addition & 1 deletion config/webview.lua
Original file line number Diff line number Diff line change
Expand Up @@ -171,7 +171,7 @@ webview.init_funcs = {
-- 'link' contains the download link
-- 'filename' contains the suggested filename (from server or webkit)
view:add_signal("download-request", function (v, link, filename)
w.dbar:download(link, w.window)
w:download(link, w.window)
end)
end,

Expand Down
3 changes: 3 additions & 0 deletions config/window.lua
Original file line number Diff line number Diff line change
Expand Up @@ -526,6 +526,9 @@ window.methods = {
w:update_buf()
end,

-- Small wrapper to ease the use of the download bar
download = function (w, link) w.dbar:download(link) end,

-- Tab label functions
-- TODO: Move these functions into a module (I.e. lousy.widget.tablist)
make_tab_label = function (w, pos)
Expand Down
Loading

0 comments on commit 12f282f

Please sign in to comment.