X-Git-Url: https://git.decadent.org.uk/gitweb/?a=blobdiff_plain;f=ioncore%2Fnames.c;h=5f3c386d8eab7337fd9b5be31c63b8aba9f014aa;hb=refs%2Ftags%2F20070203;hp=70855042e7e6fd288ad718f037f66325835c5ef1;hpb=8366314611bf30a0f31d25bf5f5023186fa87692;p=ion3.git diff --git a/ioncore/names.c b/ioncore/names.c index 7085504..5f3c386 100644 --- a/ioncore/names.c +++ b/ioncore/names.c @@ -1,7 +1,7 @@ /* * ion/ioncore/names.c * - * Copyright (c) Tuomo Valkonen 1999-2006. + * Copyright (c) Tuomo Valkonen 1999-2007. * * Ion is free software; you can redistribute it and/or modify it under * the terms of the GNU Lesser General Public License as published by @@ -19,6 +19,7 @@ #include #include "common.h" +#include "global.h" #include "region.h" #include "clientwin.h" #include "names.h" @@ -416,7 +417,7 @@ static bool do_set_name(bool (*fn)(WRegion *reg, WNamespace *ns, const char *p), if(nm!=NULL) free(nm); - region_notify_change(reg, "name"); + region_notify_change(reg, ioncore_g.notifies.name); return ret; } @@ -537,16 +538,13 @@ WClientWin *ioncore_lookup_clientwin(const char *name) } -static ExtlTab do_list(WNamespace *ns, const char *typenam) +static bool do_list(ExtlFn fn, WNamespace *ns, const char *typenam) { - ExtlTab tab; Rb_node node; int n=0; if(!ns->initialised) - return extl_table_none(); - - tab=extl_create_table(); + return FALSE; rb_traverse(node, ns->rb){ WRegion *reg=(WRegion*)node->v.val; @@ -556,33 +554,38 @@ static ExtlTab do_list(WNamespace *ns, const char *typenam) if(typenam!=NULL && !obj_is_str((Obj*)reg, typenam)) continue; - if(extl_table_seti_o(tab, n+1, (Obj*)reg)) - n++; + if(!extl_iter_obj(fn, (Obj*)reg)) + return FALSE; } - return tab; + return TRUE; } /*EXTL_DOC - * Find all non-client window regions inheriting \var{typenam}. + * Iterate over all non-client window regions with (inherited) class + * \var{typenam} until \var{iterfn} returns \code{false}. + * The function itself returns \code{true} if it reaches the end of list + * without this happening. */ EXTL_SAFE EXTL_EXPORT -ExtlTab ioncore_region_list(const char *typenam) +bool ioncore_region_i(ExtlFn fn, const char *typenam) { - return do_list(&ioncore_internal_ns, typenam); + return do_list(fn, &ioncore_internal_ns, typenam); } /*EXTL_DOC - * Return a list of all client windows. + * Iterate over client windows until \var{iterfn} returns \code{false}. + * The function itself returns \code{true} if it reaches the end of list + * without this happening. */ EXTL_SAFE EXTL_EXPORT -ExtlTab ioncore_clientwin_list() +bool ioncore_clientwin_i(ExtlFn fn) { - return do_list(&ioncore_clientwin_ns, NULL); + return do_list(fn, &ioncore_clientwin_ns, NULL); }