From 6d332f07a04d56537dbb1142bdd584f8d7303a7d Mon Sep 17 00:00:00 2001 From: Julien Danjou Date: Fri, 9 Oct 2009 20:39:55 +0200 Subject: [PATCH] lua{class,object}: rename signals functions I knew this was wrong at the beginning, f*ck. Signed-off-by: Julien Danjou --- awesomerc.lua.in | 8 ++--- common/luaclass.c | 12 +++---- common/luaclass.h | 24 ++++++------- common/luaobject.c | 28 +++++++-------- common/luaobject.h | 16 ++++----- dbus.c | 8 ++--- ewmh.c | 30 ++++++++-------- lib/awful/autofocus.lua.in | 12 +++---- lib/awful/button.lua.in | 4 +-- lib/awful/client.lua.in | 22 ++++++------ lib/awful/ewmh.lua.in | 10 +++--- lib/awful/key.lua.in | 4 +-- lib/awful/layout/init.lua.in | 52 +++++++++++++-------------- lib/awful/menu.lua.in | 2 +- lib/awful/mouse/finder.lua.in | 4 +-- lib/awful/remote.lua.in | 2 +- lib/awful/rules.lua.in | 4 +-- lib/awful/startup_notification.lua.in | 8 ++--- lib/awful/tag.lua.in | 26 +++++++------- lib/awful/tooltip.lua.in | 14 ++++---- lib/awful/wibox.lua.in | 22 ++++++------ lib/awful/widget/button.lua.in | 4 +-- lib/awful/widget/common.lua.in | 4 +-- lib/awful/widget/layoutbox.lua.in | 4 +-- lib/awful/widget/taglist.lua.in | 28 +++++++-------- lib/awful/widget/tasklist.lua.in | 36 +++++++++---------- lib/awful/widget/textclock.lua.in | 2 +- lib/naughty.lua.in | 10 +++--- luaa.c | 8 ++--- objects/wibox.c | 2 +- screen.c | 8 ++--- 31 files changed, 209 insertions(+), 209 deletions(-) diff --git a/awesomerc.lua.in b/awesomerc.lua.in index 388d968b0..568ce70e1 100644 --- a/awesomerc.lua.in +++ b/awesomerc.lua.in @@ -307,9 +307,9 @@ awful.rules.rules = { -- {{{ Signals -- Signal function to execute when a new client appears. -client.add_signal("manage", function (c, startup) +client.connect_signal("manage", function (c, startup) -- Enable sloppy focus - c:add_signal("mouse::enter", function(c) + c:connect_signal("mouse::enter", function(c) if awful.layout.get(c.screen) ~= awful.layout.suit.magnifier and awful.client.focus.filter(c) then client.focus = c @@ -329,6 +329,6 @@ client.add_signal("manage", function (c, startup) end end) -client.add_signal("focus", function(c) c.border_color = beautiful.border_focus end) -client.add_signal("unfocus", function(c) c.border_color = beautiful.border_normal end) +client.connect_signal("focus", function(c) c.border_color = beautiful.border_focus end) +client.connect_signal("unfocus", function(c) c.border_color = beautiful.border_normal end) -- }}} diff --git a/common/luaclass.c b/common/luaclass.c index 69070abf4..65a8a7693 100644 --- a/common/luaclass.c +++ b/common/luaclass.c @@ -248,23 +248,23 @@ luaA_class_setup(lua_State *L, lua_class_t *class, } void -luaA_class_add_signal(lua_State *L, lua_class_t *lua_class, const char *name, lua_CFunction fn) +luaA_class_connect_signal(lua_State *L, lua_class_t *lua_class, const char *name, lua_CFunction fn) { lua_pushcfunction(L, fn); - luaA_class_add_signal_from_stack(L, lua_class, name, -1); + luaA_class_connect_signal_from_stack(L, lua_class, name, -1); } void -luaA_class_add_signal_from_stack(lua_State *L, lua_class_t *lua_class, - const char *name, int ud) +luaA_class_connect_signal_from_stack(lua_State *L, lua_class_t *lua_class, + const char *name, int ud) { luaA_checkfunction(L, ud); signal_add(&lua_class->signals, name, luaA_object_ref(L, ud)); } void -luaA_class_remove_signal_from_stack(lua_State *L, lua_class_t *lua_class, - const char *name, int ud) +luaA_class_disconnect_signal_from_stack(lua_State *L, lua_class_t *lua_class, + const char *name, int ud) { luaA_checkfunction(L, ud); void *ref = (void *) lua_topointer(L, ud); diff --git a/common/luaclass.h b/common/luaclass.h index 5f7628aef..96a89f0a5 100644 --- a/common/luaclass.h +++ b/common/luaclass.h @@ -73,9 +73,9 @@ struct lua_class_t const char * luaA_typename(lua_State *, int); lua_class_t * luaA_class_get(lua_State *, int); -void luaA_class_add_signal(lua_State *, lua_class_t *, const char *, lua_CFunction); -void luaA_class_add_signal_from_stack(lua_State *, lua_class_t *, const char *, int); -void luaA_class_remove_signal_from_stack(lua_State *, lua_class_t *, const char *, int); +void luaA_class_connect_signal(lua_State *, lua_class_t *, const char *, lua_CFunction); +void luaA_class_connect_signal_from_stack(lua_State *, lua_class_t *, const char *, int); +void luaA_class_disconnect_signal_from_stack(lua_State *, lua_class_t *, const char *, int); void luaA_class_emit_signal(lua_State *, lua_class_t *, const char *, int); void luaA_openlib(lua_State *, const char *, const struct luaL_reg[], const struct luaL_reg[]); @@ -106,18 +106,18 @@ luaA_checkudataornil(lua_State *L, int udx, lua_class_t *class) #define LUA_CLASS_FUNCS(prefix, lua_class) \ static inline int \ - luaA_##prefix##_class_add_signal(lua_State *L) \ + luaA_##prefix##_class_connect_signal(lua_State *L) \ { \ - luaA_class_add_signal_from_stack(L, &(lua_class), \ - luaL_checkstring(L, 1), 2); \ + luaA_class_connect_signal_from_stack(L, &(lua_class), \ + luaL_checkstring(L, 1), 2); \ return 0; \ } \ \ static inline int \ - luaA_##prefix##_class_remove_signal(lua_State *L) \ + luaA_##prefix##_class_disconnect_signal(lua_State *L) \ { \ - luaA_class_remove_signal_from_stack(L, &(lua_class), \ - luaL_checkstring(L, 1), 2); \ + luaA_class_disconnect_signal_from_stack(L, &(lua_class), \ + luaL_checkstring(L, 1), 2); \ return 0; \ } \ \ @@ -125,13 +125,13 @@ luaA_checkudataornil(lua_State *L, int udx, lua_class_t *class) luaA_##prefix##_class_emit_signal(lua_State *L) \ { \ luaA_class_emit_signal(L, &(lua_class), luaL_checkstring(L, 1), \ - lua_gettop(L) - 1); \ + lua_gettop(L) - 1); \ return 0; \ } #define LUA_CLASS_METHODS(class) \ - { "add_signal", luaA_##class##_class_add_signal }, \ - { "remove_signal", luaA_##class##_class_remove_signal }, \ + { "connect_signal", luaA_##class##_class_connect_signal }, \ + { "disconnect_signal", luaA_##class##_class_disconnect_signal }, \ { "emit_signal", luaA_##class##_class_emit_signal }, #define LUA_CLASS_META \ diff --git a/common/luaobject.c b/common/luaobject.c index 72025ae18..bcb7b83d8 100644 --- a/common/luaobject.c +++ b/common/luaobject.c @@ -149,19 +149,19 @@ luaA_settype(lua_State *L, lua_class_t *lua_class) } void -luaA_object_add_signal(lua_State *L, int oud, - const char *name, lua_CFunction fn) +luaA_object_connect_signal(lua_State *L, int oud, + const char *name, lua_CFunction fn) { lua_pushcfunction(L, fn); - luaA_object_add_signal_from_stack(L, oud, name, -1); + luaA_object_connect_signal_from_stack(L, oud, name, -1); } void -luaA_object_remove_signal(lua_State *L, int oud, - const char *name, lua_CFunction fn) +luaA_object_disconnect_signal(lua_State *L, int oud, + const char *name, lua_CFunction fn) { lua_pushcfunction(L, fn); - luaA_object_remove_signal_from_stack(L, oud, name, -1); + luaA_object_disconnect_signal_from_stack(L, oud, name, -1); } /** Add a signal to an object. @@ -171,8 +171,8 @@ luaA_object_remove_signal(lua_State *L, int oud, * \param ud The index of function to call when signal is emitted. */ void -luaA_object_add_signal_from_stack(lua_State *L, int oud, - const char *name, int ud) +luaA_object_connect_signal_from_stack(lua_State *L, int oud, + const char *name, int ud) { luaA_checkfunction(L, ud); lua_object_t *obj = lua_touserdata(L, oud); @@ -186,8 +186,8 @@ luaA_object_add_signal_from_stack(lua_State *L, int oud, * \param ud The index of function to call when signal is emitted. */ void -luaA_object_remove_signal_from_stack(lua_State *L, int oud, - const char *name, int ud) +luaA_object_disconnect_signal_from_stack(lua_State *L, int oud, + const char *name, int ud) { luaA_checkfunction(L, ud); lua_object_t *obj = lua_touserdata(L, oud); @@ -274,16 +274,16 @@ luaA_object_emit_signal(lua_State *L, int oud, } int -luaA_object_add_signal_simple(lua_State *L) +luaA_object_connect_signal_simple(lua_State *L) { - luaA_object_add_signal_from_stack(L, 1, luaL_checkstring(L, 2), 3); + luaA_object_connect_signal_from_stack(L, 1, luaL_checkstring(L, 2), 3); return 0; } int -luaA_object_remove_signal_simple(lua_State *L) +luaA_object_disconnect_signal_simple(lua_State *L) { - luaA_object_remove_signal_from_stack(L, 1, luaL_checkstring(L, 2), 3); + luaA_object_disconnect_signal_from_stack(L, 1, luaL_checkstring(L, 2), 3); return 0; } diff --git a/common/luaobject.h b/common/luaobject.h index 9ecd9a224..62b1374da 100644 --- a/common/luaobject.h +++ b/common/luaobject.h @@ -150,14 +150,14 @@ luaA_object_push(lua_State *L, void *pointer) void signal_object_emit(lua_State *, signal_array_t *, const char *, int); -void luaA_object_add_signal(lua_State *, int, const char *, lua_CFunction); -void luaA_object_remove_signal(lua_State *, int, const char *, lua_CFunction); -void luaA_object_add_signal_from_stack(lua_State *, int, const char *, int); -void luaA_object_remove_signal_from_stack(lua_State *, int, const char *, int); +void luaA_object_connect_signal(lua_State *, int, const char *, lua_CFunction); +void luaA_object_disconnect_signal(lua_State *, int, const char *, lua_CFunction); +void luaA_object_connect_signal_from_stack(lua_State *, int, const char *, int); +void luaA_object_disconnect_signal_from_stack(lua_State *, int, const char *, int); void luaA_object_emit_signal(lua_State *, int, const char *, int); -int luaA_object_add_signal_simple(lua_State *); -int luaA_object_remove_signal_simple(lua_State *); +int luaA_object_connect_signal_simple(lua_State *); +int luaA_object_disconnect_signal_simple(lua_State *); int luaA_object_emit_signal_simple(lua_State *); #define LUA_OBJECT_FUNCS(lua_class, type, prefix) \ @@ -196,8 +196,8 @@ int luaA_object_tostring(lua_State *); #define LUA_OBJECT_META(prefix) \ { "__tostring", luaA_object_tostring }, \ - { "add_signal", luaA_object_add_signal_simple }, \ - { "remove_signal", luaA_object_remove_signal_simple }, \ + { "connect_signal", luaA_object_connect_signal_simple }, \ + { "disconnect_signal", luaA_object_disconnect_signal_simple }, \ { "emit_signal", luaA_object_emit_signal_simple }, #endif diff --git a/dbus.c b/dbus.c index c059b2ccd..5f735e9a4 100644 --- a/dbus.c +++ b/dbus.c @@ -754,7 +754,7 @@ luaA_dbus_remove_match(lua_State *L) * \lparam The function to call. */ static int -luaA_dbus_add_signal(lua_State *L) +luaA_dbus_connect_signal(lua_State *L) { const char *name = luaL_checkstring(L, 1); luaA_checkfunction(L, 2); @@ -775,7 +775,7 @@ luaA_dbus_add_signal(lua_State *L) * \lparam The function to call. */ static int -luaA_dbus_remove_signal(lua_State *L) +luaA_dbus_disconnect_signal(lua_State *L) { const char *name = luaL_checkstring(L, 1); luaA_checkfunction(L, 2); @@ -791,8 +791,8 @@ const struct luaL_reg awesome_dbus_lib[] = { "release_name", luaA_dbus_release_name }, { "add_match", luaA_dbus_add_match }, { "remove_match", luaA_dbus_remove_match }, - { "add_signal", luaA_dbus_add_signal }, - { "remove_signal", luaA_dbus_remove_signal }, + { "connect_signal", luaA_dbus_connect_signal }, + { "disconnect_signal", luaA_dbus_disconnect_signal }, { NULL, NULL } }; diff --git a/ewmh.c b/ewmh.c index 44be7d334..a6ec6b914 100644 --- a/ewmh.c +++ b/ewmh.c @@ -80,16 +80,16 @@ ewmh_client_update_hints(lua_State *L) static int ewmh_signal_on_client_new(lua_State *L) { - luaA_object_add_signal(L, 1, "property::modal" , ewmh_client_update_hints); - luaA_object_add_signal(L, 1, "property::fullscreen" , ewmh_client_update_hints); - luaA_object_add_signal(L, 1, "property::maximized_horizontal" , ewmh_client_update_hints); - luaA_object_add_signal(L, 1, "property::maximized_vertical" , ewmh_client_update_hints); - luaA_object_add_signal(L, 1, "property::sticky" , ewmh_client_update_hints); - luaA_object_add_signal(L, 1, "property::skip_taskbar" , ewmh_client_update_hints); - luaA_object_add_signal(L, 1, "property::above" , ewmh_client_update_hints); - luaA_object_add_signal(L, 1, "property::below" , ewmh_client_update_hints); - luaA_object_add_signal(L, 1, "property::minimized" , ewmh_client_update_hints); - luaA_object_add_signal(L, 1, "property::urgent" , ewmh_client_update_hints); + luaA_object_connect_signal(L, 1, "property::modal" , ewmh_client_update_hints); + luaA_object_connect_signal(L, 1, "property::fullscreen" , ewmh_client_update_hints); + luaA_object_connect_signal(L, 1, "property::maximized_horizontal" , ewmh_client_update_hints); + luaA_object_connect_signal(L, 1, "property::maximized_vertical" , ewmh_client_update_hints); + luaA_object_connect_signal(L, 1, "property::sticky" , ewmh_client_update_hints); + luaA_object_connect_signal(L, 1, "property::skip_taskbar" , ewmh_client_update_hints); + luaA_object_connect_signal(L, 1, "property::above" , ewmh_client_update_hints); + luaA_object_connect_signal(L, 1, "property::below" , ewmh_client_update_hints); + luaA_object_connect_signal(L, 1, "property::minimized" , ewmh_client_update_hints); + luaA_object_connect_signal(L, 1, "property::urgent" , ewmh_client_update_hints); return 0; } @@ -222,11 +222,11 @@ ewmh_init(void) ewmh_update_desktop_geometry(); - luaA_class_add_signal(globalconf.L, &client_class, "new", ewmh_signal_on_client_new); - luaA_class_add_signal(globalconf.L, &client_class, "focus", ewmh_update_net_active_window); - luaA_class_add_signal(globalconf.L, &client_class, "unfocus", ewmh_update_net_active_window); - luaA_class_add_signal(globalconf.L, &client_class, "manage", ewmh_update_net_client_list); - luaA_class_add_signal(globalconf.L, &client_class, "unmanage", ewmh_update_net_client_list); + luaA_class_connect_signal(globalconf.L, &client_class, "new", ewmh_signal_on_client_new); + luaA_class_connect_signal(globalconf.L, &client_class, "focus", ewmh_update_net_active_window); + luaA_class_connect_signal(globalconf.L, &client_class, "unfocus", ewmh_update_net_active_window); + luaA_class_connect_signal(globalconf.L, &client_class, "manage", ewmh_update_net_client_list); + luaA_class_connect_signal(globalconf.L, &client_class, "unmanage", ewmh_update_net_client_list); } /** Set the client list in stacking order, bottom to top. diff --git a/lib/awful/autofocus.lua.in b/lib/awful/autofocus.lua.in index bc00adda5..b25098cef 100644 --- a/lib/awful/autofocus.lua.in +++ b/lib/awful/autofocus.lua.in @@ -25,12 +25,12 @@ local function check_focus(obj) end end -atag.attached_add_signal(nil, "property::selected", check_focus) -client.add_signal("unmanage", check_focus) -client.add_signal("new", function(c) - c:add_signal("untagged", check_focus) - c:add_signal("property::hidden", check_focus) - c:add_signal("property::minimized", check_focus) +atag.attached_connect_signal(nil, "property::selected", check_focus) +client.connect_signal("unmanage", check_focus) +client.connect_signal("new", function(c) + c:connect_signal("untagged", check_focus) + c:connect_signal("property::hidden", check_focus) + c:connect_signal("property::minimized", check_focus) end) -- vim: filetype=lua:expandtab:shiftwidth=4:tabstop=8:softtabstop=4:encoding=utf-8:textwidth=80 diff --git a/lib/awful/button.lua.in b/lib/awful/button.lua.in index ba82bf000..78228f6aa 100644 --- a/lib/awful/button.lua.in +++ b/lib/awful/button.lua.in @@ -38,10 +38,10 @@ function new(mod, button, press, release) ret[#ret + 1] = capi.button({ modifiers = util.table.join(mod, set), button = button }) if press then - ret[#ret]:add_signal("press", function(bobj, ...) press(...) end) + ret[#ret]:connect_signal("press", function(bobj, ...) press(...) end) end if release then - ret[#ret]:add_signal("release", function (bobj, ...) release(...) end) + ret[#ret]:connect_signal("release", function (bobj, ...) release(...) end) end end return ret diff --git a/lib/awful/client.lua.in b/lib/awful/client.lua.in index ec810c326..98968501c 100644 --- a/lib/awful/client.lua.in +++ b/lib/awful/client.lua.in @@ -570,16 +570,16 @@ local function store_floating_geometry(c) end -- Store the initial client geometry. -capi.client.add_signal("new", function(c) +capi.client.connect_signal("new", function(c) local function store_init_geometry(c) property.set(c, "floating_geometry", c:geometry()) - c:remove_signal("property::geometry", store_init_geometry) + c:disconnect_signal("property::geometry", store_init_geometry) end - c:add_signal("property::geometry", store_init_geometry) + c:connect_signal("property::geometry", store_init_geometry) end) -capi.client.add_signal("manage", function(c) - c:add_signal("property::geometry", store_floating_geometry) +capi.client.connect_signal("manage", function(c) + c:connect_signal("property::geometry", store_floating_geometry) end) --- Return if a client has a fixe size or not. @@ -834,13 +834,13 @@ function property.set(c, prop, value) end -- Register standards signals -capi.client.add_signal("focus", focus.history.add) -capi.client.add_signal("unmanage", focus.history.delete) +capi.client.connect_signal("focus", focus.history.add) +capi.client.connect_signal("unmanage", focus.history.delete) -capi.client.add_signal("manage", function(c) c:add_signal("property::urgent", urgent.add) end) -capi.client.add_signal("focus", urgent.delete) -capi.client.add_signal("unmanage", urgent.delete) +capi.client.connect_signal("manage", function(c) c:connect_signal("property::urgent", urgent.add) end) +capi.client.connect_signal("focus", urgent.delete) +capi.client.connect_signal("unmanage", urgent.delete) -capi.client.add_signal("unmanage", floating.delete) +capi.client.connect_signal("unmanage", floating.delete) -- vim: filetype=lua:expandtab:shiftwidth=4:tabstop=8:softtabstop=4:encoding=utf-8:textwidth=80 diff --git a/lib/awful/ewmh.lua.in b/lib/awful/ewmh.lua.in index cfac21791..56e551006 100644 --- a/lib/awful/ewmh.lua.in +++ b/lib/awful/ewmh.lua.in @@ -102,11 +102,11 @@ local function screen_change(window) end end -client.add_signal("manage", function (c) - c:add_signal("request::maximized_horizontal", maximized_horizontal) - c:add_signal("request::maximized_vertical", maximized_vertical) - c:add_signal("request::fullscreen", fullscreen) - c:add_signal("property::screen", screen_change) +client.connect_signal("manage", function (c) + c:connect_signal("request::maximized_horizontal", maximized_horizontal) + c:connect_signal("request::maximized_vertical", maximized_vertical) + c:connect_signal("request::fullscreen", fullscreen) + c:connect_signal("property::screen", screen_change) end) -- vim: filetype=lua:expandtab:shiftwidth=4:tabstop=8:softtabstop=4:encoding=utf-8:textwidth=80 diff --git a/lib/awful/key.lua.in b/lib/awful/key.lua.in index ea5ce691e..07429d0fc 100644 --- a/lib/awful/key.lua.in +++ b/lib/awful/key.lua.in @@ -38,10 +38,10 @@ function new(mod, key, press, release) ret[#ret + 1] = capi.key({ modifiers = util.table.join(mod, set), key = key }) if press then - ret[#ret]:add_signal("press", function(kobj, ...) press(...) end) + ret[#ret]:connect_signal("press", function(kobj, ...) press(...) end) end if release then - ret[#ret]:add_signal("release", function(kobj, ...) release(...) end) + ret[#ret]:connect_signal("release", function(kobj, ...) release(...) end) end end return ret diff --git a/lib/awful/layout/init.lua.in b/lib/awful/layout/init.lua.in index f5d870bc9..3e4a891cc 100644 --- a/lib/awful/layout/init.lua.in +++ b/lib/awful/layout/init.lua.in @@ -96,21 +96,21 @@ end local function arrange_prop(obj) arrange(obj.screen) end -capi.client.add_signal("new", function(c) - c:add_signal("property::size_hints_honor", arrange_prop) - c:add_signal("property::struts", arrange_prop) - c:add_signal("property::minimized", arrange_prop) - c:add_signal("property::sticky", arrange_prop) - c:add_signal("property::fullscreen", arrange_prop) - c:add_signal("property::maximized_horizontal", arrange_prop) - c:add_signal("property::maximized_vertical", arrange_prop) - c:add_signal("property::border_width", arrange_prop) - c:add_signal("property::hidden", arrange_prop) - c:add_signal("property::floating", arrange_prop) - c:add_signal("property::geometry", arrange_prop) +capi.client.connect_signal("new", function(c) + c:connect_signal("property::size_hints_honor", arrange_prop) + c:connect_signal("property::struts", arrange_prop) + c:connect_signal("property::minimized", arrange_prop) + c:connect_signal("property::sticky", arrange_prop) + c:connect_signal("property::fullscreen", arrange_prop) + c:connect_signal("property::maximized_horizontal", arrange_prop) + c:connect_signal("property::maximized_vertical", arrange_prop) + c:connect_signal("property::border_width", arrange_prop) + c:connect_signal("property::hidden", arrange_prop) + c:connect_signal("property::floating", arrange_prop) + c:connect_signal("property::geometry", arrange_prop) -- If prop is screen, we do not know what was the previous screen, so -- let's arrange all screens :-( - c:add_signal("property::screen", function(c) + c:connect_signal("property::screen", function(c) for screen = 1, capi.screen.count() do arrange(screen) end end) end) @@ -124,29 +124,29 @@ local function arrange_on_tagged(c, tag) end for s = 1, capi.screen.count() do - tag.attached_add_signal(s, "property::mwfact", arrange_prop) - tag.attached_add_signal(s, "property::nmaster", arrange_prop) - tag.attached_add_signal(s, "property::ncol", arrange_prop) - tag.attached_add_signal(s, "property::layout", arrange_prop) - tag.attached_add_signal(s, "property::windowfact", arrange_prop) - tag.attached_add_signal(s, "property::selected", arrange_prop) - tag.attached_add_signal(s, "tagged", arrange_prop) - capi.screen[s]:add_signal("property::workarea", function(screen) + tag.attached_connect_signal(s, "property::mwfact", arrange_prop) + tag.attached_connect_signal(s, "property::nmaster", arrange_prop) + tag.attached_connect_signal(s, "property::ncol", arrange_prop) + tag.attached_connect_signal(s, "property::layout", arrange_prop) + tag.attached_connect_signal(s, "property::windowfact", arrange_prop) + tag.attached_connect_signal(s, "property::selected", arrange_prop) + tag.attached_connect_signal(s, "tagged", arrange_prop) + capi.screen[s]:connect_signal("property::workarea", function(screen) arrange(screen.index) end) - capi.screen[s]:add_signal("tag::attach", function (screen, tag) + capi.screen[s]:connect_signal("tag::attach", function (screen, tag) arrange(screen.index) end) - capi.screen[s]:add_signal("tag::detach", function (screen, tag) + capi.screen[s]:connect_signal("tag::detach", function (screen, tag) arrange(screen.index) end) - capi.screen[s]:add_signal("padding", function (screen) + capi.screen[s]:connect_signal("padding", function (screen) arrange(screen.index) end) end -capi.client.add_signal("focus", function(c) arrange(c.screen) end) -capi.client.add_signal("list", function() +capi.client.connect_signal("focus", function(c) arrange(c.screen) end) +capi.client.connect_signal("list", function() for screen = 1, capi.screen.count() do arrange(screen) end diff --git a/lib/awful/menu.lua.in b/lib/awful/menu.lua.in index 772f214c9..c7d12c25d 100644 --- a/lib/awful/menu.lua.in +++ b/lib/awful/menu.lua.in @@ -237,7 +237,7 @@ local function add_item(data, num, item_info) item:buttons(bindings) local mouse_enter_func = function () item_enter(data, num, true) end - item:add_signal("mouse::enter", mouse_enter_func) + item:connect_signal("mouse::enter", mouse_enter_func) -- Create the submenu icon widget local submenu diff --git a/lib/awful/mouse/finder.lua.in b/lib/awful/mouse/finder.lua.in index c72b45bd3..32c9b52c4 100644 --- a/lib/awful/mouse/finder.lua.in +++ b/lib/awful/mouse/finder.lua.in @@ -137,8 +137,8 @@ local function new() -- setup the timer action only if needed data[self].timer = timer { timeout = data[self].timeout } data[self].animate_timer = timer { timeout = data[self].animate_timeout } - data[self].timer:add_signal("timeout", data[self].hide) - data[self].animate_timer:add_signal("timeout", data[self].animate) + data[self].timer:connect_signal("timeout", data[self].hide) + data[self].animate_timer:connect_signal("timeout", data[self].animate) data[self].wibox.ontop = true data[self].wibox.visible = false diff --git a/lib/awful/remote.lua.in b/lib/awful/remote.lua.in index 1b15813d5..ab8a5304d 100644 --- a/lib/awful/remote.lua.in +++ b/lib/awful/remote.lua.in @@ -18,7 +18,7 @@ local type = type module("awful.remote") if dbus then - dbus.add_signal("org.naquadah.awesome.awful.Remote", function(data, code) + dbus.connect_signal("org.naquadah.awesome.awful.Remote", function(data, code) if data.member == "Eval" then local f, e = loadstring(code) if f then diff --git a/lib/awful/rules.lua.in b/lib/awful/rules.lua.in index 65c095245..e345afc0a 100644 --- a/lib/awful/rules.lua.in +++ b/lib/awful/rules.lua.in @@ -145,7 +145,7 @@ function apply(c) end end -client.add_signal("manage", apply) -client.remove_signal("manage", atag.withcurrent) +client.connect_signal("manage", apply) +client.disconnect_signal("manage", atag.withcurrent) -- vim: filetype=lua:expandtab:shiftwidth=4:tabstop=8:softtabstop=4:encoding=utf-8:textwidth=80 diff --git a/lib/awful/startup_notification.lua.in b/lib/awful/startup_notification.lua.in index f6caac5d6..bfd62e650 100644 --- a/lib/awful/startup_notification.lua.in +++ b/lib/awful/startup_notification.lua.in @@ -46,9 +46,9 @@ end local function unregister_hook(event) unregister_event(event.id) end local function register_hook(event) register_event(event.id) end -capi.awesome.add_signal("spawn::initiated", register_hook) -capi.awesome.add_signal("spawn::canceled", unregister_hook) -capi.awesome.add_signal("spawn::completed", unregister_hook) -capi.awesome.add_signal("spawn::timeout", unregister_hook) +capi.awesome.connect_signal("spawn::initiated", register_hook) +capi.awesome.connect_signal("spawn::canceled", unregister_hook) +capi.awesome.connect_signal("spawn::completed", unregister_hook) +capi.awesome.connect_signal("spawn::timeout", unregister_hook) -- vim: filetype=lua:expandtab:shiftwidth=4:tabstop=8:softtabstop=4:encoding=utf-8:textwidth=80 diff --git a/lib/awful/tag.lua.in b/lib/awful/tag.lua.in index 4a869327f..91ab0f4fa 100644 --- a/lib/awful/tag.lua.in +++ b/lib/awful/tag.lua.in @@ -459,33 +459,33 @@ function withcurrent(c, startup) end end -local function attached_add_signal_screen(screen, sig, func) - capi.screen[screen]:add_signal("tag::attach", function (s, tag) - tag:add_signal(sig, func) +local function attached_connect_signal_screen(screen, sig, func) + capi.screen[screen]:connect_signal("tag::attach", function (s, tag) + tag:connect_signal(sig, func) end) - capi.screen[screen]:add_signal("tag::detach", function (s, tag) - tag:remove_signal(sig, func) + capi.screen[screen]:connect_signal("tag::detach", function (s, tag) + tag:disconnect_signal(sig, func) end) for _, tag in ipairs(capi.screen[screen]:tags()) do - tag:add_signal(sig, func) + tag:connect_signal(sig, func) end end --- Add a signal to all attached tag and all tag that will be attached in the -- future. When a tag is detach from the screen, its signal is removed. -- @param screen The screen concerned, or all if nil. -function attached_add_signal(screen, ...) +function attached_connect_signal(screen, ...) if screen then - attached_add_signal_screen(screen, ...) + attached_connect_signal_screen(screen, ...) else for screen = 1, capi.screen.count() do - attached_add_signal_screen(screen, ...) + attached_connect_signal_screen(screen, ...) end end end -- Register standards signals -capi.client.add_signal("manage", function(c, startup) +capi.client.connect_signal("manage", function(c, startup) -- If we are not managing this application at startup, -- move it to the screen where the mouse is. -- We only do it for "normal" windows (i.e. no dock, etc). @@ -502,13 +502,13 @@ capi.client.add_signal("manage", function(c, startup) c.screen = capi.mouse.screen end end - c:add_signal("property::screen", withcurrent) + c:connect_signal("property::screen", withcurrent) end) -capi.client.add_signal("manage", withcurrent) +capi.client.connect_signal("manage", withcurrent) for s = 1, capi.screen.count() do - capi.screen[s]:add_signal("tag::history::update", history.update) + capi.screen[s]:connect_signal("tag::history::update", history.update) end setmetatable(_M, { __call = function (_, ...) return new(...) end }) diff --git a/lib/awful/tooltip.lua.in b/lib/awful/tooltip.lua.in index f28280475..73f76e2d5 100644 --- a/lib/awful/tooltip.lua.in +++ b/lib/awful/tooltip.lua.in @@ -18,7 +18,7 @@ local ipairs = ipairs -- A tooltip is a small hint displayed when the mouse cursor -- hovers a specific item. -- In awesome, a tooltip can be linked with almost any --- object having a add_signal() method and receiving +-- object having a connect_signal() method and receiving -- mouse::enter and mouse::leave signals. --

How to create a tooltip?
-- @@ -151,16 +151,16 @@ end -- @param self The tooltip. -- @param object An object. local function add_to_object(self, object) - object:add_signal("mouse::enter", data[self].show) - object:add_signal("mouse::leave", data[self].hide) + object:connect_signal("mouse::enter", data[self].show) + object:connect_signal("mouse::leave", data[self].hide) end --- Remove tooltip from an object. -- @param self The tooltip. -- @param object An object. local function remove_from_object(self, object) - object:remove_signal("mouse::enter", data[self].show) - object:remove_signal("mouse::leave", data[self].hide) + object:disconnect_signal("mouse::enter", data[self].show) + object:disconnect_signal("mouse::leave", data[self].hide) end @@ -206,7 +206,7 @@ local function new(args) self:set_text(args.timer_function()) set_geometry(self) end - data[self].timer:add_signal("timeout", data[self].timer_function) + data[self].timer:connect_signal("timeout", data[self].timer_function) end -- set tooltip properties @@ -216,7 +216,7 @@ local function new(args) self.wibox.widgets = { my_textbox } -- add some signals on both the tooltip and widget - self.wibox:add_signal("mouse::enter", data[self].hide) + self.wibox:connect_signal("mouse::enter", data[self].hide) -- Add tooltip to objects if args.objects then diff --git a/lib/awful/wibox.lua.in b/lib/awful/wibox.lua.in index 2985deb99..c57af64e1 100644 --- a/lib/awful/wibox.lua.in +++ b/lib/awful/wibox.lua.in @@ -128,15 +128,15 @@ function attach(wibox, position) wibox_prop_table.position = position end - wibox:add_signal("property::width", wibox_update_strut) - wibox:add_signal("property::height", wibox_update_strut) - wibox:add_signal("property::visible", wibox_update_strut) + wibox:connect_signal("property::width", wibox_update_strut) + wibox:connect_signal("property::height", wibox_update_strut) + wibox:connect_signal("property::visible", wibox_update_strut) - wibox:add_signal("property::screen", call_wibox_position_hook_on_prop_update) - wibox:add_signal("property::width", call_wibox_position_hook_on_prop_update) - wibox:add_signal("property::height", call_wibox_position_hook_on_prop_update) - wibox:add_signal("property::visible", call_wibox_position_hook_on_prop_update) - wibox:add_signal("property::border_width", call_wibox_position_hook_on_prop_update) + wibox:connect_signal("property::screen", call_wibox_position_hook_on_prop_update) + wibox:connect_signal("property::width", call_wibox_position_hook_on_prop_update) + wibox:connect_signal("property::height", call_wibox_position_hook_on_prop_update) + wibox:connect_signal("property::visible", call_wibox_position_hook_on_prop_update) + wibox:connect_signal("property::border_width", call_wibox_position_hook_on_prop_update) end --- Align a wibox. @@ -326,11 +326,11 @@ local function update_wiboxes_on_struts(c) end -- Hook registered to reset all wiboxes position. -capi.client.add_signal("manage", function(c) +capi.client.connect_signal("manage", function(c) update_wiboxes_on_struts(c) - c:add_signal("property::struts", update_wiboxes_on_struts) + c:connect_signal("property::struts", update_wiboxes_on_struts) end) -capi.client.add_signal("unmanage", update_wiboxes_on_struts) +capi.client.connect_signal("unmanage", update_wiboxes_on_struts) setmetatable(_M, { __call = function(_, ...) return new(...) end }) diff --git a/lib/awful/widget/button.lua.in b/lib/awful/widget/button.lua.in index 52215ba21..188c5189f 100644 --- a/lib/awful/widget/button.lua.in +++ b/lib/awful/widget/button.lua.in @@ -33,8 +33,8 @@ function new(args) local w = capi.widget(args) w.image = img_release w:buttons(button({}, 1, function () w.image = img_press end, function () w.image = img_release end)) - w:add_signal("mouse::leave", function () w.image = img_release end) - w:add_signal("mouse::enter", function () + w:connect_signal("mouse::leave", function () w.image = img_release end) + w:connect_signal("mouse::enter", function () if capi.mouse.coords().buttons[1] then w.image = img_press end end) return w diff --git a/lib/awful/widget/common.lua.in b/lib/awful/widget/common.lua.in index 8e2af4336..71be953d5 100644 --- a/lib/awful/widget/common.lua.in +++ b/lib/awful/widget/common.lua.in @@ -81,8 +81,8 @@ function common.list_update(w, buttons, label, data, template, objects) -- button object the user provided, but with the object as -- argument. local btn = capi.button { modifiers = b.modifiers, button = b.button } - btn:add_signal("press", function () b:emit_signal("press", o) end) - btn:add_signal("release", function () b:emit_signal("release", o) end) + btn:connect_signal("press", function () b:emit_signal("press", o) end) + btn:connect_signal("release", function () b:emit_signal("release", o) end) data[o][#data[o] + 1] = btn end end diff --git a/lib/awful/widget/layoutbox.lua.in b/lib/awful/widget/layoutbox.lua.in index 88e4be431..e449c599e 100644 --- a/lib/awful/widget/layoutbox.lua.in +++ b/lib/awful/widget/layoutbox.lua.in @@ -42,8 +42,8 @@ function new(screen, args) return update(w, tag.screen) end - tag.attached_add_signal(screen, "property::selected", update_on_tag_selection) - tag.attached_add_signal(screen, "property::layout", update_on_tag_selection) + tag.attached_connect_signal(screen, "property::selected", update_on_tag_selection) + tag.attached_connect_signal(screen, "property::layout", update_on_tag_selection) return w end diff --git a/lib/awful/widget/taglist.lua.in b/lib/awful/widget/taglist.lua.in index 72d2af08a..9460e3b9d 100644 --- a/lib/awful/widget/taglist.lua.in +++ b/lib/awful/widget/taglist.lua.in @@ -165,29 +165,29 @@ function new(screen, filter, buttons, style, template) end end local uc = function (c) return u(c.screen) end - capi.client.add_signal("focus", uc) - capi.client.add_signal("unfocus", uc) - tag.attached_add_signal(screen, "property::selected", uc) - tag.attached_add_signal(screen, "property::icon", uc) - tag.attached_add_signal(screen, "property::hide", uc) - tag.attached_add_signal(screen, "property::name", uc) - capi.screen[screen]:add_signal("tag::attach", function(screen, tag) + capi.client.connect_signal("focus", uc) + capi.client.connect_signal("unfocus", uc) + tag.attached_connect_signal(screen, "property::selected", uc) + tag.attached_connect_signal(screen, "property::icon", uc) + tag.attached_connect_signal(screen, "property::hide", uc) + tag.attached_connect_signal(screen, "property::name", uc) + capi.screen[screen]:connect_signal("tag::attach", function(screen, tag) u(screen.index) end) - capi.screen[screen]:add_signal("tag::detach", function(screen, tag) + capi.screen[screen]:connect_signal("tag::detach", function(screen, tag) u(screen.index) end) - capi.client.add_signal("new", function(c) - c:add_signal("property::urgent", uc) - c:add_signal("property::screen", function(c) + capi.client.connect_signal("new", function(c) + c:connect_signal("property::urgent", uc) + c:connect_signal("property::screen", function(c) -- If client change screen, refresh it anyway since we don't from -- which screen it was coming :-) u(screen) end) - c:add_signal("tagged", uc) - c:add_signal("untagged", uc) + c:connect_signal("tagged", uc) + c:connect_signal("untagged", uc) end) - capi.client.add_signal("unmanage", uc) + capi.client.connect_signal("unmanage", uc) u(screen) return w end diff --git a/lib/awful/widget/tasklist.lua.in b/lib/awful/widget/tasklist.lua.in index dd813e6ef..986c0082a 100644 --- a/lib/awful/widget/tasklist.lua.in +++ b/lib/awful/widget/tasklist.lua.in @@ -135,25 +135,25 @@ function new(screen, filter, buttons, style, template) local data = setmetatable({}, { __mode = 'k' }) local u = function () tasklist_update(screen, w, buttons, filter, data, style, template) end - capi.screen[screen]:add_signal("tag::detach", u) - tag.attached_add_signal(screen, "property::selected", u) - capi.client.add_signal("new", function (c) - c:add_signal("property::urgent", u) - c:add_signal("property::floating", u) - c:add_signal("property::maximized_horizontal", u) - c:add_signal("property::maximized_vertical", u) - c:add_signal("property::name", u) - c:add_signal("property::icon_name", u) - c:add_signal("property::icon", u) - c:add_signal("property::skip_taskbar", u) - c:add_signal("property::hidden", u) - c:add_signal("tagged", u) - c:add_signal("untagged", u) + capi.screen[screen]:connect_signal("tag::detach", u) + tag.attached_connect_signal(screen, "property::selected", u) + capi.client.connect_signal("new", function (c) + c:connect_signal("property::urgent", u) + c:connect_signal("property::floating", u) + c:connect_signal("property::maximized_horizontal", u) + c:connect_signal("property::maximized_vertical", u) + c:connect_signal("property::name", u) + c:connect_signal("property::icon_name", u) + c:connect_signal("property::icon", u) + c:connect_signal("property::skip_taskbar", u) + c:connect_signal("property::hidden", u) + c:connect_signal("tagged", u) + c:connect_signal("untagged", u) end) - capi.client.add_signal("unmanage", u) - capi.client.add_signal("list", u) - capi.client.add_signal("focus", u) - capi.client.add_signal("unfocus", u) + capi.client.connect_signal("unmanage", u) + capi.client.connect_signal("list", u) + capi.client.connect_signal("focus", u) + capi.client.connect_signal("unfocus", u) u() return w end diff --git a/lib/awful/widget/textclock.lua.in b/lib/awful/widget/textclock.lua.in index 622907909..053e60cf8 100644 --- a/lib/awful/widget/textclock.lua.in +++ b/lib/awful/widget/textclock.lua.in @@ -25,7 +25,7 @@ function new(args, format, timeout) local w = capi.widget(args) local timer = capi.timer { timeout = timeout } w.text = os.date(format) - timer:add_signal("timeout", function() w.text = os.date(format) end) + timer:connect_signal("timeout", function() w.text = os.date(format) end) timer:start() return w end diff --git a/lib/naughty.lua.in b/lib/naughty.lua.in index b1725cff3..c378c2a46 100644 --- a/lib/naughty.lua.in +++ b/lib/naughty.lua.in @@ -324,7 +324,7 @@ function notify(args) local die = function () destroy(notification) end if timeout > 0 then local timer_die = capi.timer { timeout = timeout } - timer_die:add_signal("timeout", die) + timer_die:connect_signal("timeout", die) if not suspended then timer_die:start() end @@ -346,7 +346,7 @@ function notify(args) else if notification.timer then notification.timer:stop() end notification.timer = capi.timer { timeout = hover_timeout } - notification.timer:add_signal("timeout", die) + notification.timer:connect_signal("timeout", die) notification.timer:start() end end @@ -403,7 +403,7 @@ function notify(args) border_color = border_color, border_width = border_width }) - if hover_timeout then notification.box:add_signal("mouse::enter", hover_destroy) end + if hover_timeout then notification.box:connect_signal("mouse::enter", hover_destroy) end -- calculate the height if not height then @@ -465,7 +465,7 @@ end -- DBUS/Notification support -- Notify if capi.dbus then - capi.dbus.add_signal("org.freedesktop.Notifications", function (data, appname, replaces_id, icon, title, text, actions, hints, expire) + capi.dbus.connect_signal("org.freedesktop.Notifications", function (data, appname, replaces_id, icon, title, text, actions, hints, expire) args = { preset = { } } if data.member == "Notify" then if text ~= "" then @@ -543,7 +543,7 @@ if capi.dbus then end end) - capi.dbus.add_signal("org.freedesktop.DBus.Introspectable", + capi.dbus.connect_signal("org.freedesktop.DBus.Introspectable", function (data, text) if data.member == "Introspect" then local xml = [=[geometry.height) w->geometry.height = 1; - luaA_object_add_signal(L, -2, "property::border_width", luaA_wibox_need_update); + luaA_object_connect_signal(L, -2, "property::border_width", luaA_wibox_need_update); return 1; } diff --git a/screen.c b/screen.c index 4bda44a04..1b0257910 100644 --- a/screen.c +++ b/screen.c @@ -538,7 +538,7 @@ luaA_screen_index(lua_State *L) * \lparam A function to call when the signal is emitted. */ static int -luaA_screen_add_signal(lua_State *L) +luaA_screen_connect_signal(lua_State *L) { screen_t *s = lua_touserdata(L, 1); const char *name = luaL_checkstring(L, 2); @@ -556,7 +556,7 @@ luaA_screen_add_signal(lua_State *L) * \lparam A function to remove */ static int -luaA_screen_remove_signal(lua_State *L) +luaA_screen_disconnect_signal(lua_State *L) { screen_t *s = lua_touserdata(L, 1); const char *name = luaL_checkstring(L, 2); @@ -619,8 +619,8 @@ const struct luaL_reg awesome_screen_methods[] = const struct luaL_reg awesome_screen_meta[] = { - { "add_signal", luaA_screen_add_signal }, - { "remove_signal", luaA_screen_remove_signal }, + { "connect_signal", luaA_screen_connect_signal }, + { "disconnect_signal", luaA_screen_disconnect_signal }, { "emit_signal", luaA_screen_emit_signal }, { "tags", luaA_screen_tags }, { "__index", luaA_screen_index },