Skip to content
This repository has been archived by the owner on Sep 19, 2020. It is now read-only.

Commit

Permalink
Fixes #258, #254 and #257
Browse files Browse the repository at this point in the history
  • Loading branch information
oeed committed Jul 21, 2014
1 parent 2238335 commit cb6791a
Show file tree
Hide file tree
Showing 4 changed files with 18 additions and 20 deletions.
13 changes: 5 additions & 8 deletions System/API/Bedrock.lua
Original file line number Diff line number Diff line change
Expand Up @@ -166,12 +166,6 @@ function HandleKeyChar(self, event, keychar)
--self:Draw()
end
end
--[[
elseif keychar == keys.up then
Scroll('mouse_scroll', -1)
elseif keychar == keys.down then
Scroll('mouse_scroll', 1)
]]--
end
end

Expand Down Expand Up @@ -388,7 +382,7 @@ function ObjectFromFile(self, file, view)
end
return object
elseif not file.Type then
error('No object type specified. (e.g. Type = "Button")')
error('No object type specified. (e.g. Type = "Button") Name: '..(file.Name or '?'))
else
error('No Object: '..file.Type..'. The API probably isn\'t loaded')
end
Expand Down Expand Up @@ -632,9 +626,12 @@ function HandleTimer(self, event, timer)
end
end

local prevObj = nil
function SetActiveObject(self, object)
if object then
if object or (not object and prevObj) then
object = object or prevObj
if object ~= self.ActiveObject then
prevObj = self.ActiveObject
self.ActiveObject = object
object:ForceDraw()
end
Expand Down
10 changes: 6 additions & 4 deletions System/API/Helpers.lua
Original file line number Diff line number Diff line change
Expand Up @@ -23,14 +23,16 @@ OpenFile = function(path, args)
Helpers.OpenFile(shortcutPointer, tArgs)
elseif extension == 'program' and fs.isDir(path) and fs.exists(path..'/startup') then
return LaunchProgram(path..'/startup', args, Helpers.RemoveExtension(fs.getName(path)))
elseif extension == 'program' and not fs.isDir(path) then
return LaunchProgram(path, args, Helpers.RemoveExtension(fs.getName(path)))
elseif fs.isDir(path) then
LaunchProgram('/System/Programs/Files.program/startup', {path}, 'Files')
elseif extension then
local _path = Indexer.FindFileInFolder(extension, 'Icons')
if _path then
if _path and not _path:find('System/Images/Icons/') then
Helpers.OpenFile(Helpers.ParentFolder(Helpers.ParentFolder(_path)), {path})
else

elseif _path then
OpenFileWith(path)
end
else
OpenFileWith(path)
Expand Down Expand Up @@ -382,7 +384,7 @@ OpenFileWith = function(path, bedrock)
local view = {
Children = {children},
Width=28,
Height=10+height,
Height=10+height
}
bedrock:DisplayWindow(view, 'Open With')

Expand Down
6 changes: 5 additions & 1 deletion System/Objects/Overlay.lua
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@ end
OnLoad = function(self)
self:GetObject('OneButton').OnClick = function(btn)
if btn:ToggleMenu('onemenu') then
--TODO: updating

self.Bedrock:GetObject('DesktopMenuItem').OnClick = function(itm)
Current.Desktop:SwitchTo()
end
Expand All @@ -25,6 +25,10 @@ OnLoad = function(self)
Helpers.OpenFile('System/Programs/Settings.program')
end

self.Bedrock:GetObject('UpdateMenuItem').OnClick = function(itm)
CheckAutoUpdate(true)
end

self.Bedrock:GetObject('RestartMenuItem').OnClick = function(itm)
Restart()
end
Expand Down
9 changes: 2 additions & 7 deletions System/Programs/Update OneOS.program/startup
Original file line number Diff line number Diff line change
Expand Up @@ -119,13 +119,8 @@ function StartUpdate()
OneOS.Log.i('Latest release: '..latestReleaseTag)

OneOS.Log.i('Optaining Latest Version URL')
local refs = downloadJSON('https://api.github.com/repos/oeed/OneOS/git/refs')
local latestReleaseSha = ''
for i, v in ipairs(refs) do
if v.ref == 'refs/tags/'..latestReleaseTag then
latestReleaseSha = v.object.sha
end
end
local refs = downloadJSON('https://api.github.com/repos/'..Settings.GitHubUsername..'/'..Settings.GitHubRepoName..'/git/refs/tags/'..latestReleaseTag)
local latestReleaseSha = refs.object.sha

OneOS.Log.i('Downloading tree for SHA: '..latestReleaseSha)
local tree = downloadJSON('https://api.github.com/repos/oeed/OneOS/git/trees/'..latestReleaseSha..'?recursive=1').tree
Expand Down

0 comments on commit cb6791a

Please sign in to comment.