Permalink
Browse files

Adapt some samples to phantom-retval change.

  • Loading branch information...
1 parent a07a37e commit 0dc26ddf7d76c141007f9aab4e672fc436664975 @pavouk committed Jul 20, 2011
Showing with 6 additions and 4 deletions.
  1. +2 −1 samples/giostream.lua
  2. +4 −3 samples/gtkpad.lua
View
@@ -17,7 +17,7 @@ local function read_sync(file)
local info = assert(file:query_info('standard::size', 0))
local buffer = bytes.new(info:get_size())
local stream = assert(file:read(nil))
- local ok, read = assert(stream:read_all(buffer, #buffer))
+ local read = assert(stream:read_all(buffer, #buffer))
return tostring(buffer):sub(1,read)
end
@@ -66,6 +66,7 @@ function app:on_activate()
local function perform(read_op, write_op, target_file)
app:hold()
+ print('Starting:', target_file:get_basename())
local contents = read_op(source_file)
target_file:delete()
write_op(target_file, contents)
View
@@ -15,8 +15,7 @@ local Gtk = lgi.Gtk
local Gio = lgi.Gio
local function new_editor(app, file)
- local ok, contents
- if file then ok, contents = file:load_contents() end
+ local contents = file and file:load_contents()
local window = Gtk.Window {
type = Gtk.WindowType.TOPLEVEL,
default_width = 400,
@@ -25,7 +24,9 @@ local function new_editor(app, file)
title = file and file:get_parse_name() or '<Untitled>',
child = Gtk.ScrolledWindow {
child = Gtk.TextView {
- buffer = Gtk.TextBuffer { text = ok and tostring(contents) or '' }
+ buffer = Gtk.TextBuffer {
+ text = contents and tostring(contents) or ''
+ }
}
}
}

0 comments on commit 0dc26dd

Please sign in to comment.