Lua: Remove calls to add_signal()

The requirement to call add_signal() was added to catch typos. However, this
requirement became increasingly annoying with property::<name> signals and e.g.
gears.object allowing arbitrary properties to be changed.

All of this ended up in a single commit because tests/examples fails if I first
let add_signal() emit a deprecation warning.

Signed-off-by: Uli Schlachter <psychon@znc.in>
This commit is contained in:
Uli Schlachter 2016-06-04 18:23:48 +02:00
parent 231436d9e3
commit 0857f6f1b5
24 changed files with 16 additions and 226 deletions

View File

@ -2,7 +2,6 @@
--- Disonnect to a signal. --- Disonnect to a signal.
-- @tparam string name The name of the signal -- @tparam string name The name of the signal
-- @tparam function func The callback that should be disconnected -- @tparam function func The callback that should be disconnected
-- @see add_signal
-- @function disconnect_signal -- @function disconnect_signal
--- Emit a signal. --- Emit a signal.
@ -13,15 +12,9 @@
-- that are given to emit_signal() -- that are given to emit_signal()
-- @function emit_signal -- @function emit_signal
--- Add a signal to an object. All signals must be added before they can be used.
--
-- @tparam string name The name of the new signal.
-- @function add_signal
--- Connect to a signal. --- Connect to a signal.
-- @tparam string name The name of the signal -- @tparam string name The name of the signal
-- @tparam function func The callback to call when the signal is emitted -- @tparam function func The callback to call when the signal is emitted
-- @see add_signal
-- @function connect_signal -- @function connect_signal
--- Connect to a signal weakly. This allows the callback function to be garbage --- Connect to a signal weakly. This allows the callback function to be garbage

View File

@ -1159,25 +1159,17 @@ end
--- The last geometry when client was floating. --- The last geometry when client was floating.
-- @signal property::floating_geometry -- @signal property::floating_geometry
capi.client.add_signal("property::floating_geometry")
capi.client.add_signal("property::floating")
capi.client.add_signal("property::dockable")
--- Emited when a client need to get a titlebar. --- Emited when a client need to get a titlebar.
-- @signal request::titlebars -- @signal request::titlebars
-- @tparam[opt=nil] string content The context (like "rules") -- @tparam[opt=nil] string content The context (like "rules")
-- @tparam[opt=nil] table hints Some hints. -- @tparam[opt=nil] table hints Some hints.
capi.client.add_signal("request::titlebars")
--- The client marked signal (deprecated). --- The client marked signal (deprecated).
-- @signal .marked -- @signal .marked
capi.client.add_signal("marked")
--- The client unmarked signal (deprecated). --- The client unmarked signal (deprecated).
-- @signal unmarked -- @signal unmarked
capi.client.add_signal("unmarked")
-- Add clients during startup to focus history. -- Add clients during startup to focus history.
-- This used to happen through ewmh.activate, but that only handles visible -- This used to happen through ewmh.activate, but that only handles visible

View File

@ -222,8 +222,6 @@ local function arrange_tag(t)
layout.arrange(t.screen) layout.arrange(t.screen)
end end
capi.screen.add_signal("arrange")
capi.tag.connect_signal("property::master_width_factor", arrange_tag) capi.tag.connect_signal("property::master_width_factor", arrange_tag)
capi.tag.connect_signal("property::master_count", arrange_tag) capi.tag.connect_signal("property::master_count", arrange_tag)
capi.tag.connect_signal("property::column_count", arrange_tag) capi.tag.connect_signal("property::column_count", arrange_tag)

View File

@ -558,7 +558,6 @@ attach = function(d, position_f, args)
end end
-- Create a way to detach a placement function -- Create a way to detach a placement function
d:add_signal("property::detach_callback")
function d.detach_callback() function d.detach_callback()
d:disconnect_signal("property::width" , tracker) d:disconnect_signal("property::width" , tracker)
d:disconnect_signal("property::height" , tracker) d:disconnect_signal("property::height" , tracker)

View File

@ -465,8 +465,6 @@ function screen.object.set_selected_tag() end
--- When the tag history changed. --- When the tag history changed.
-- @signal tag::history::update -- @signal tag::history::update
capi.screen.add_signal("padding")
-- Extend the luaobject -- Extend the luaobject
object.properties(capi.screen, { object.properties(capi.screen, {
getter_class = screen.object, getter_class = screen.object,

View File

@ -297,7 +297,5 @@ capi.awesome.connect_signal("spawn::canceled" , spawn.on_snid_cancel )
capi.awesome.connect_signal("spawn::timeout" , spawn.on_snid_cancel ) capi.awesome.connect_signal("spawn::timeout" , spawn.on_snid_cancel )
capi.client.connect_signal ("manage" , spawn.on_snid_callback ) capi.client.connect_signal ("manage" , spawn.on_snid_callback )
capi.client.add_signal ("spawn::completed_with_payload" )
return setmetatable(spawn, { __call = function(_, ...) return spawn.spawn(...) end }) return setmetatable(spawn, { __call = function(_, ...) return spawn.spawn(...) end })
-- vim: filetype=lua:expandtab:shiftwidth=4:tabstop=8:softtabstop=4:textwidth=80 -- vim: filetype=lua:expandtab:shiftwidth=4:tabstop=8:softtabstop=4:textwidth=80

View File

@ -1323,22 +1323,6 @@ capi.client.connect_signal("untagged", client_untagged)
capi.client.connect_signal("tagged", client_tagged) capi.client.connect_signal("tagged", client_tagged)
capi.tag.connect_signal("request::select", tag.object.view_only) capi.tag.connect_signal("request::select", tag.object.view_only)
capi.tag.add_signal("property::hide")
capi.tag.add_signal("property::icon")
capi.tag.add_signal("property::icon_only")
capi.tag.add_signal("property::layout")
capi.tag.add_signal("property::mwfact")
capi.tag.add_signal("property::master_width_factor")
capi.tag.add_signal("property::useless_gap")
capi.tag.add_signal("property::master_fill_policy")
capi.tag.add_signal("property::ncol")
capi.tag.add_signal("property::column_count")
capi.tag.add_signal("property::nmaster")
capi.tag.add_signal("property::master_count")
capi.tag.add_signal("property::windowfact")
capi.tag.add_signal("property::screen")
capi.tag.add_signal("property::index")
--- True when a tagged client is urgent --- True when a tagged client is urgent
-- @signal property::urgent -- @signal property::urgent
-- @see client.urgent -- @see client.urgent
@ -1347,15 +1331,6 @@ capi.tag.add_signal("property::index")
-- @signal property::urgent_count -- @signal property::urgent_count
-- @see client.urgent -- @see client.urgent
capi.tag.add_signal("property::urgent")
capi.tag.add_signal("property::urgent_count")
capi.tag.add_signal("property::volatile")
capi.tag.add_signal("request::screen")
capi.tag.add_signal("removal-pending")
capi.screen.add_signal("tag::history::update")
capi.screen.connect_signal("tag::history::update", tag.history.update) capi.screen.connect_signal("tag::history::update", tag.history.update)
capi.screen.connect_signal("removed", function(s) capi.screen.connect_signal("removed", function(s)

View File

@ -196,7 +196,6 @@ end
-- @see set_markup -- @see set_markup
tooltip.new = function(args) tooltip.new = function(args)
local self = setmetatable(object(), instance_mt) local self = setmetatable(object(), instance_mt)
self:add_signal("property::visible")
self.visible = false self.visible = false
-- private data -- private data

View File

@ -341,11 +341,9 @@ function awfulwibar.new(arg)
w._screen = screen --HACK When a screen is removed, then getbycoords wont work w._screen = screen --HACK When a screen is removed, then getbycoords wont work
w._stretch = arg.stretch == nil and has_to_stretch or arg.stretch w._stretch = arg.stretch == nil and has_to_stretch or arg.stretch
w:add_signal("property::position")
w.get_position = get_position w.get_position = get_position
w.set_position = set_position w.set_position = set_position
w:add_signal("property::stretch")
w.get_stretch = get_stretch w.get_stretch = get_stretch
w.set_stretch = set_stretch w.set_stretch = set_stretch
w.remove = remove w.remove = remove

View File

@ -21,45 +21,36 @@ local object = { properties = properties, mt = {} }
--- Verify that obj is indeed a valid object as returned by new() --- Verify that obj is indeed a valid object as returned by new()
local function check(obj) local function check(obj)
if type(obj) ~= "table" or type(obj._signals) ~= "table" then if type(obj) ~= "table" or type(obj._signals) ~= "table" then
error("add_signal() called on non-object") error("called on non-object")
end end
end end
--- Find a given signal --- Find a given signal
-- @tparam table obj The object to search in -- @tparam table obj The object to search in
-- @tparam string name The signal to find -- @tparam string name The signal to find
-- @tparam string error_msg Error message for if the signal is not found
-- @treturn table The signal table -- @treturn table The signal table
local function find_signal(obj, name, error_msg) local function find_signal(obj, name)
check(obj) check(obj)
if not obj._signals[name] then if not obj._signals[name] then
error("Trying to " .. error_msg .. " non-existent signal '" .. name .. "'")
end
return obj._signals[name]
end
--- Add a signal to an object. All signals must be added before they can be used.
--
--@DOC_text_gears_object_signal_EXAMPLE@
-- @tparam string name The name of the new signal.
function object:add_signal(name)
check(self)
assert(type(name) == "string", "name must be a string, got: " .. type(name)) assert(type(name) == "string", "name must be a string, got: " .. type(name))
if not self._signals[name] then obj._signals[name] = {
self._signals[name] = {
strong = {}, strong = {},
weak = setmetatable({}, { __mode = "kv" }) weak = setmetatable({}, { __mode = "kv" })
} }
end end
return obj._signals[name]
end
function object.add_signal()
require("awful.util").deprecate("Use signals without explicitly adding them. This is now done implicitly.")
end end
--- Connect to a signal. --- Connect to a signal.
-- @tparam string name The name of the signal -- @tparam string name The name of the signal
-- @tparam function func The callback to call when the signal is emitted -- @tparam function func The callback to call when the signal is emitted
-- @see add_signal
function object:connect_signal(name, func) function object:connect_signal(name, func)
assert(type(func) == "function", "callback must be a function, got: " .. type(func)) assert(type(func) == "function", "callback must be a function, got: " .. type(func))
local sig = find_signal(self, name, "connect to") local sig = find_signal(self, name)
assert(sig.weak[func] == nil, "Trying to connect a strong callback which is already connected weakly") assert(sig.weak[func] == nil, "Trying to connect a strong callback which is already connected weakly")
sig.strong[func] = true sig.strong[func] = true
end end
@ -100,7 +91,7 @@ end
-- @tparam function func The callback to call when the signal is emitted -- @tparam function func The callback to call when the signal is emitted
function object:weak_connect_signal(name, func) function object:weak_connect_signal(name, func)
assert(type(func) == "function", "callback must be a function, got: " .. type(func)) assert(type(func) == "function", "callback must be a function, got: " .. type(func))
local sig = find_signal(self, name, "connect to") local sig = find_signal(self, name)
assert(sig.strong[func] == nil, "Trying to connect a weak callback which is already connected strongly") assert(sig.strong[func] == nil, "Trying to connect a weak callback which is already connected strongly")
sig.weak[func] = make_the_gc_obey(func) sig.weak[func] = make_the_gc_obey(func)
end end
@ -108,9 +99,8 @@ end
--- Disonnect to a signal. --- Disonnect to a signal.
-- @tparam string name The name of the signal -- @tparam string name The name of the signal
-- @tparam function func The callback that should be disconnected -- @tparam function func The callback that should be disconnected
-- @see add_signal
function object:disconnect_signal(name, func) function object:disconnect_signal(name, func)
local sig = find_signal(self, name, "disconnect from") local sig = find_signal(self, name)
sig.weak[func] = nil sig.weak[func] = nil
sig.strong[func] = nil sig.strong[func] = nil
end end
@ -122,7 +112,7 @@ end
-- function receives the object as first argument and then any extra arguments -- function receives the object as first argument and then any extra arguments
-- that are given to emit_signal() -- that are given to emit_signal()
function object:emit_signal(name, ...) function object:emit_signal(name, ...)
local sig = find_signal(self, name, "emit") local sig = find_signal(self, name)
for func in pairs(sig.strong) do for func in pairs(sig.strong) do
func(self, ...) func(self, ...)
end end
@ -163,8 +153,8 @@ local function set_miss(self, key, value)
end end
end end
--- Returns a new object. You can call `:emit_signal()`, `:disconnect_signal()`, --- Returns a new object. You can call `:emit_signal()`, `:disconnect_signal()`
-- `:connect_signal()` and `:add_signal()` on the resulting object. -- and `:connect_signal()` on the resulting object.
-- --
-- Note that `args.enable_auto_signals` is only supported when -- Note that `args.enable_auto_signals` is only supported when
-- `args.enable_properties` is true. -- `args.enable_properties` is true.

View File

@ -97,11 +97,6 @@ local timer_instance_mt = {
timer.new = function(args) timer.new = function(args)
local ret = object() local ret = object()
ret:add_signal("property::timeout")
ret:add_signal("timeout")
ret:add_signal("start")
ret:add_signal("stop")
ret.data = { timeout = 0 } ret.data = { timeout = 0 }
setmetatable(ret, timer_instance_mt) setmetatable(ret, timer_instance_mt)

View File

@ -298,7 +298,6 @@ local function setup_signals(_drawable)
local d = _drawable.drawable local d = _drawable.drawable
local function clone_signal(name) local function clone_signal(name)
_drawable:add_signal(name)
-- When "name" is emitted on wibox.drawin, also emit it on wibox -- When "name" is emitted on wibox.drawin, also emit it on wibox
d:connect_signal(name, function(_, ...) d:connect_signal(name, function(_, ...)
_drawable:emit_signal(name, ...) _drawable:emit_signal(name, ...)

View File

@ -89,7 +89,6 @@ end
local function setup_signals(_wibox) local function setup_signals(_wibox)
local obj local obj
local function clone_signal(name) local function clone_signal(name)
_wibox:add_signal(name)
-- When "name" is emitted on wibox.drawin, also emit it on wibox -- When "name" is emitted on wibox.drawin, also emit it on wibox
obj:connect_signal(name, function(_, ...) obj:connect_signal(name, function(_, ...)
_wibox:emit_signal(name, ...) _wibox:emit_signal(name, ...)
@ -225,8 +224,6 @@ local function new(args)
return ret return ret
end end
capi.drawin.add_signal("property::get_wibox")
--- Redraw a wibox. You should never have to call this explicitely because it is --- Redraw a wibox. You should never have to call this explicitely because it is
-- automatically called when needed. -- automatically called when needed.
-- @param wibox -- @param wibox

View File

@ -556,18 +556,8 @@ function base.make_widget(proxy, widget_name, args)
class = args.class, class = args.class,
} }
-- This signal is used by layouts to find out when they have to update.
ret:add_signal("widget::layout_changed")
ret:add_signal("widget::redraw_needed")
-- Mouse input, oh noes!
ret:add_signal("button::press")
ret:add_signal("button::release")
ret:add_signal("mouse::enter")
ret:add_signal("mouse::leave")
-- Backwards compatibility -- Backwards compatibility
-- TODO: Remove this -- TODO: Remove this
ret:add_signal("widget::updated")
ret:connect_signal("widget::updated", function() ret:connect_signal("widget::updated", function()
ret:emit_signal("widget::layout_changed") ret:emit_signal("widget::layout_changed")
ret:emit_signal("widget::redraw_needed") ret:emit_signal("widget::redraw_needed")
@ -648,7 +638,7 @@ end
function base.check_widget(widget) function base.check_widget(widget)
assert(type(widget) == "table", "Type should be table, but is " .. tostring(type(widget))) assert(type(widget) == "table", "Type should be table, but is " .. tostring(type(widget)))
assert(widget.is_widget, "Argument is not a widget!") assert(widget.is_widget, "Argument is not a widget!")
for _, func in pairs({ "add_signal", "connect_signal", "disconnect_signal" }) do for _, func in pairs({ "connect_signal", "disconnect_signal" }) do
assert(type(widget[func]) == "function", func .. " is not a function") assert(type(widget[func]) == "function", func .. " is not a function")
end end
end end

View File

@ -6,7 +6,6 @@
local fake_screens = {} local fake_screens = {}
_G.screen = setmetatable({ _G.screen = setmetatable({
add_signal = function() end,
set_index_miss_handler = function() end, set_index_miss_handler = function() end,
set_newindex_miss_handler = function() end, set_newindex_miss_handler = function() end,
}, { }, {

View File

@ -9,31 +9,6 @@ describe("gears.object", function()
local obj local obj
before_each(function() before_each(function()
obj = object() obj = object()
obj:add_signal("signal")
end)
it("strong connect non-existent signal", function()
assert.has.errors(function()
obj:connect_signal("foo", function() end)
end)
end)
it("weak connect non-existent signal", function()
assert.has.errors(function()
obj:weak_connect_signal("foo", function() end)
end)
end)
it("strong disconnect non-existent signal", function()
assert.has.errors(function()
obj:disconnect_signal("foo", function() end)
end)
end)
it("emitting non-existent signal", function()
assert.has.errors(function()
obj:emit_signal("foo")
end)
end) end)
it("strong connecting and emitting signal", function() it("strong connecting and emitting signal", function()
@ -188,7 +163,6 @@ describe("gears.object", function()
it("auto emit disabled", function() it("auto emit disabled", function()
local got_it = false local got_it = false
obj:add_signal("property::foo")
obj:connect_signal("property::foo", function() got_it=true end) obj:connect_signal("property::foo", function() got_it=true end)
obj.foo = 42 obj.foo = 42
@ -199,7 +173,6 @@ describe("gears.object", function()
it("auto emit enabled", function() it("auto emit enabled", function()
local got_it = false local got_it = false
local obj2 = object{enable_auto_signals=true, enable_properties=true} local obj2 = object{enable_auto_signals=true, enable_properties=true}
obj2:add_signal("property::foo")
obj2:connect_signal("property::foo", function() got_it=true end) obj2:connect_signal("property::foo", function() got_it=true end)
obj2.foo = 42 obj2.foo = 42
@ -207,13 +180,6 @@ describe("gears.object", function()
assert.is_true(got_it) assert.is_true(got_it)
end) end)
it("auto emit enabled", function()
assert.has.errors(function()
local obj2 = object{enable_auto_signals=true, enable_properties=true}
obj2.foo = "bar"
end)
end)
it("auto emit without dynamic properties", function() it("auto emit without dynamic properties", function()
assert.has.errors(function() assert.has.errors(function()
object{enable_auto_signals=true, enable_properties=false} object{enable_auto_signals=true, enable_properties=false}

View File

@ -83,8 +83,6 @@ return {
widget_stub = function(width, height) widget_stub = function(width, height)
local w = object() local w = object()
w._private = {} w._private = {}
w:add_signal("widget::redraw_needed")
w:add_signal("widget::layout_changed")
w.is_widget = true w.is_widget = true
w._private.visible = true w._private.visible = true
w._private.opacity = 1 w._private.opacity = 1

View File

@ -17,12 +17,6 @@ local function _shim_fake_class()
return obj._connect_signal(obj, name, func) return obj._connect_signal(obj, name, func)
end end
obj._add_signal = obj.add_signal
function obj.add_signal(name)
return obj._add_signal(obj, name)
end
function obj.set_index_miss_handler(handler) function obj.set_index_miss_handler(handler)
meta.__index = handler meta.__index = handler
end end
@ -50,11 +44,6 @@ awesome.startup = true
function awesome.register_xproperty() function awesome.register_xproperty()
end end
awesome.add_signal("refresh")
awesome.add_signal("wallpaper_changed")
awesome.add_signal("spawn::canceled")
awesome.add_signal("spawn::timeout")
return awesome return awesome
-- vim: filetype=lua:expandtab:shiftwidth=4:tabstop=8:softtabstop=4:textwidth=80 -- vim: filetype=lua:expandtab:shiftwidth=4:tabstop=8:softtabstop=4:textwidth=80

View File

@ -4,20 +4,6 @@ local clients = {}
local client, meta = awesome._shim_fake_class() local client, meta = awesome._shim_fake_class()
local function add_signals(c)
c:add_signal("property::width")
c:add_signal("property::height")
c:add_signal("property::x")
c:add_signal("property::y")
c:add_signal("property::screen")
c:add_signal("property::geometry")
c:add_signal("request::geometry")
c:add_signal("request::tag")
c:add_signal("swapped")
c:add_signal("raised")
c:add_signal("property::_label") --Used internally
end
-- Keep an history of the geometry for validation and images -- Keep an history of the geometry for validation and images
local function push_geometry(c) local function push_geometry(c)
table.insert(c._old_geo, c:geometry()) table.insert(c._old_geo, c:geometry())
@ -46,9 +32,6 @@ function client.gen_fake(args)
ret[v] = ret[v] or 1 ret[v] = ret[v] or 1
end end
add_signals(ret)
-- Emulate capi.client.geometry -- Emulate capi.client.geometry
function ret:geometry(new) function ret:geometry(new)
if new then if new then
@ -142,37 +125,6 @@ function client.get(s)
return ret return ret
end end
client:_add_signal("manage")
client:_add_signal("unmanage")
client:_add_signal("property::urgent")
client:_add_signal("untagged")
client:_add_signal("tagged")
client:_add_signal("property::shape_client_bounding")
client:_add_signal("property::shape_client_clip")
client:_add_signal("property::width")
client:_add_signal("property::height")
client:_add_signal("property::x")
client:_add_signal("property::y")
client:_add_signal("property::geometry")
client:_add_signal("focus")
client:_add_signal("new")
client:_add_signal("property::size_hints_honor")
client:_add_signal("property::struts")
client:_add_signal("property::minimized")
client:_add_signal("property::maximized_horizontal")
client:_add_signal("property::maximized_vertical")
client:_add_signal("property::sticky")
client:_add_signal("property::fullscreen")
client:_add_signal("property::border_width")
client:_add_signal("property::hidden")
client:_add_signal("property::screen")
client:_add_signal("request::tag")
client:_add_signal("request::geometry")
client:_add_signal("request::activate")
client:_add_signal("raised")
client:_add_signal("lowered")
client:_add_signal("list")
return client return client
-- vim: filetype=lua:expandtab:shiftwidth=4:tabstop=8:softtabstop=4:textwidth=80 -- vim: filetype=lua:expandtab:shiftwidth=4:tabstop=8:softtabstop=4:textwidth=80

View File

@ -7,10 +7,6 @@ screen.count = 1
local function create_screen(args) local function create_screen(args)
local s = gears_obj() local s = gears_obj()
s:add_signal("property::workarea")
s:add_signal("property::index")
s:add_signal("padding")
-- Copy the geo in case the args are mutated -- Copy the geo in case the args are mutated
local geo = { local geo = {
x = args.x , x = args.x ,
@ -99,10 +95,6 @@ end
screen._add_screen {width=320, height=240} screen._add_screen {width=320, height=240}
screen.add_signal("property::workarea")
screen.add_signal("added")
screen.add_signal("removed")
return screen return screen
-- vim: filetype=lua:expandtab:shiftwidth=4:tabstop=8:softtabstop=4:textwidth=80 -- vim: filetype=lua:expandtab:shiftwidth=4:tabstop=8:softtabstop=4:textwidth=80

View File

@ -5,20 +5,6 @@ local tag, meta = awesome._shim_fake_class()
local function new_tag(_, args) local function new_tag(_, args)
local ret = gears_obj() local ret = gears_obj()
ret:add_signal("property::layout")
ret:add_signal("property::name")
ret:add_signal("property::geometry")
ret:add_signal("property::screen")
ret:add_signal("property::master_width_factor")
ret:add_signal("property::mwfact")
ret:add_signal("property::ncol")
ret:add_signal("property::column_count")
ret:add_signal("property::master_count")
ret:add_signal("property::nmaster")
ret:add_signal("property::index")
ret:add_signal("property::useless_gap")
ret:add_signal("property::_wa_tracker")
ret.name = args.name or "test" ret.name = args.name or "test"
ret.activated = true ret.activated = true
ret.selected = true ret.selected = true
@ -42,12 +28,6 @@ local function new_tag(_, args)
}) })
end end
tag:_add_signal("request::select")
tag:_add_signal("property::selected")
tag:_add_signal("property::activated")
tag:_add_signal("tagged")
tag:_add_signal("untagged")
return setmetatable(tag, { return setmetatable(tag, {
__call = new_tag, __call = new_tag,
}) })

View File

@ -31,8 +31,6 @@ local o = gears.object {
enable_auto_signals = true, enable_auto_signals = true,
} }
o:add_signal "property::foo"
print(o.foo) print(o.foo)
o.foo = 42 o.foo = 42
@ -42,7 +40,6 @@ print(o.foo)
o:method(1, 2, 3) o:method(1, 2, 3)
-- Random properties can also be added, the signal will be emited automatically. -- Random properties can also be added, the signal will be emited automatically.
o:add_signal "property::something"
o:connect_signal("property::something", function(obj, value) o:connect_signal("property::something", function(obj, value)
print("In the connection handler!", obj, value) print("In the connection handler!", obj, value)

View File

@ -2,9 +2,6 @@ local gears = require("gears") --DOC_HIDE
local o = gears.object{} local o = gears.object{}
-- Add a new signals to the object. This is used to catch typos
o:add_signal "my_signal"
-- Function can be attached to signals -- Function can be attached to signals
local function slot(obj, a, b, c) local function slot(obj, a, b, c)
print("In slot", obj, a, b, c) print("In slot", obj, a, b, c)

View File

@ -18,7 +18,6 @@ client.focus = client.get()[1]
local c = client.focus local c = client.focus
-- local c2 = client.get()[2] -- local c2 = client.get()[2]
client.add_signal("property::foo")
c.foo = "bar" c.foo = "bar"
-- Check if the property system works -- Check if the property system works