From e052bd99b0233b9a650e97101c8568ab272bd5c0 Mon Sep 17 00:00:00 2001 From: Arvydas Sidorenko Date: Sun, 29 Jan 2012 15:17:51 +0100 Subject: [PATCH] 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 Signed-off-by: Uli Schlachter --- lib/awful/menu.lua.in | 5 +++-- lib/awful/widget/button.lua.in | 3 ++- lib/awful/widget/taglist.lua.in | 8 ++++---- lib/gears/color.lua.in | 3 ++- lib/naughty.lua.in | 3 ++- lib/wibox/widget/background.lua.in | 3 ++- lib/wibox/widget/imagebox.lua.in | 4 ++-- 7 files changed, 17 insertions(+), 12 deletions(-) diff --git a/lib/awful/menu.lua.in b/lib/awful/menu.lua.in index 012847fc..3e8566fc 100644 --- a/lib/awful/menu.lua.in +++ b/lib/awful/menu.lua.in @@ -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() diff --git a/lib/awful/widget/button.lua.in b/lib/awful/widget/button.lua.in index 39fc2f31..7647cd09 100644 --- a/lib/awful/widget/button.lua.in +++ b/lib/awful/widget/button.lua.in @@ -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 diff --git a/lib/awful/widget/taglist.lua.in b/lib/awful/widget/taglist.lua.in index c414c2a5..cd433ac6 100644 --- a/lib/awful/widget/taglist.lua.in +++ b/lib/awful/widget/taglist.lua.in @@ -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 diff --git a/lib/gears/color.lua.in b/lib/gears/color.lua.in index 9b0a9926..8aa642a4 100644 --- a/lib/gears/color.lua.in +++ b/lib/gears/color.lua.in @@ -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 diff --git a/lib/naughty.lua.in b/lib/naughty.lua.in index 1bbede2d..cc6a374a 100644 --- a/lib/naughty.lua.in +++ b/lib/naughty.lua.in @@ -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 diff --git a/lib/wibox/widget/background.lua.in b/lib/wibox/widget/background.lua.in index aaef50cd..89f9aa35 100644 --- a/lib/wibox/widget/background.lua.in +++ b/lib/wibox/widget/background.lua.in @@ -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 diff --git a/lib/wibox/widget/imagebox.lua.in b/lib/wibox/widget/imagebox.lua.in index a908aa63..2e35ccb7 100644 --- a/lib/wibox/widget/imagebox.lua.in +++ b/lib/wibox/widget/imagebox.lua.in @@ -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