oocairo.image_surface_create_from_png TO awesome.load_image

Replaced all references to image_surface_create_from_png to
awesome.load_image

Signed-off-by: Arvydas Sidorenko <asido4@gmail.com>
Signed-off-by: Uli Schlachter <psychon@znc.in>
This commit is contained in:
Arvydas Sidorenko 2012-01-29 15:17:51 +01:00 committed by Uli Schlachter
parent 9451fec6f1
commit e052bd99b0
7 changed files with 17 additions and 12 deletions

View File

@ -28,6 +28,7 @@ local capi = {
mouse = mouse,
client = client,
keygrabber = keygrabber,
awesome = awesome,
oocairo = oocairo }
@ -543,7 +544,7 @@ function entry(parent, args)
if args.icon then
icon = args.icon
if type(icon) == "string" then
icon = capi.oocairo.image_surface_create_from_png(icon)
icon = capi.awesome.load_image(icon)
end
end
if icon then
@ -580,7 +581,7 @@ function entry(parent, args)
if args.theme.submenu_icon then
submenu = wibox.widget.imagebox()
submenu:set_image(
capi.oocairo.image_surface_create_from_png(
capi.awesome.load_image(
args.theme.submenu_icon))
else
submenu = wibox.widget.textbox()

View File

@ -9,6 +9,7 @@ local type = type
local button = require("awful.button")
local imagebox = require("wibox.widget.imagebox")
local capi = { mouse = mouse,
awesome = awesome,
oocairo = oocairo }
module("awful.widget.button")
@ -21,7 +22,7 @@ function new(args)
if not args or not args.image then return end
local img_release
if type(args.image) == "string" then
img_release = capi.oocairo.image_surface_create_from_png(args.image)
img_release = capi.awesome.load_image(args.image)
elseif type(args.image) == "userdata" and args.image.type and args.image:type() == "cairo_surface_t" then
img_release = args.image
elseif type(args.image) == "userdata" and args.image._NAME and args.image._NAME == "cairo surface object" then

View File

@ -6,7 +6,7 @@
-- Grab environment we need
local capi = { screen = screen,
oocairo = oocairo,
awesome = awesome,
client = client }
local type = type
local setmetatable = setmetatable
@ -53,7 +53,7 @@ function taglist_label(t, args)
local seltags = sel:tags()
for _, v in ipairs(seltags) do
if v == t then
bg_image = capi.oocairo.image_surface_create_from_png(taglist_squares_sel)
bg_image = capi.awesome.load_image(taglist_squares_sel)
bg_resize = taglist_squares_resize == "true"
is_selected = true
break
@ -64,7 +64,7 @@ function taglist_label(t, args)
if not is_selected then
local cls = t:clients()
if #cls > 0 and taglist_squares_unsel then
bg_image = capi.oocairo.image_surface_create_from_png(taglist_squares_unsel)
bg_image = capi.awesome.load_image(taglist_squares_unsel)
bg_resize = taglist_squares_resize == "true"
end
for k, c in pairs(cls) do
@ -87,7 +87,7 @@ function taglist_label(t, args)
if tag.geticon(t) and type(tag.geticon(t)) == "image" then
icon = tag.geticon(t)
elseif tag.geticon(t) then
icon = capi.oocairo.image_surface_create_from_png(tag.geticon(t))
icon = capi.awesome.load_image(tag.geticon(t))
end
return text, bg_color, bg_image, icon

View File

@ -12,6 +12,7 @@ local unpack = unpack
local pairs = pairs
local type = type
local capi = {
awesome = awesome,
oocairo = oocairo
}
@ -63,7 +64,7 @@ end
-- @param file The filename of the file
-- @return a cairo pattern object
function create_png_pattern(file)
local image = capi.oocairo.image_surface_create_from_png(file)
local image = capi.awesome.load_image(file)
return capi.oocairo.pattern_create_for_surface(image)
end

View File

@ -14,6 +14,7 @@ local capi = { screen = screen,
awesome = awesome,
dbus = dbus,
timer = timer,
awesome = awesome,
oocairo = oocairo }
local button = require("awful.button")
local util = require("awful.util")
@ -400,7 +401,7 @@ function notify(args)
iconmargin = wibox.layout.margin(iconbox, margin, margin, margin, margin)
local img = icon
if type(icon) == "string" then
img = capi.oocairo.image_surface_create_from_png(icon)
img = capi.awesome.load_image(icon)
else
img = icon
end

View File

@ -11,6 +11,7 @@ local layout_base = require("wibox.layout.base")
local setmetatable = setmetatable
local pairs = pairs
local type = type
local awesome = awesome
module("wibox.widget.background")
@ -91,7 +92,7 @@ function set_bgimage(box, image)
local image = image
if type(image) == "string" then
image = oocairo.image_surface_create_from_png(image)
image = awesome.load_image(image)
end
box.bgimage = image

View File

@ -4,13 +4,13 @@
-- @release @AWESOME_VERSION@
---------------------------------------------------------------------------
local oocairo = require("oocairo")
local base = require("wibox.widget.base")
local setmetatable = setmetatable
local pairs = pairs
local type = type
local pcall = pcall
local print = print
local awesome = awesome
module("wibox.widget.imagebox")
@ -74,7 +74,7 @@ function set_image(box, image)
local image = image
if type(image) == "string" then
local success, result = pcall(oocairo.image_surface_create_from_png, image)
local success, result = pcall(awesome.load_image, image)
if not success then
print("Error while reading '" .. image .. "': " .. result)
return false