X-Git-Url: https://git.decadent.org.uk/gitweb/?a=blobdiff_plain;f=ioncore%2Fsaveload.c;h=71ddb9dca422f18579c15291a5df9ce934c02509;hb=df57861c962a50bfbf57f276d288395fe0c6a4b6;hp=bb67ac1fcb482b5bb7f657421fafce6237071f5d;hpb=803afbc1cd633f6c025bcd9537e9b7e9aedadd0d;p=ion3.git diff --git a/ioncore/saveload.c b/ioncore/saveload.c index bb67ac1..71ddb9d 100644 --- a/ioncore/saveload.c +++ b/ioncore/saveload.c @@ -1,12 +1,9 @@ /* * ion/ioncore/saveload.c * - * Copyright (c) Tuomo Valkonen 1999-2007. + * Copyright (c) Tuomo Valkonen 1999-2008. * - * 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 - * the Free Software Foundation; either version 2.1 of the License, or - * (at your option) any later version. + * See the included file LICENSE for details. */ #include @@ -38,8 +35,6 @@ static bool layout_load_error=FALSE; static SMAddCallback *add_cb; static SMCfgCallback *cfg_cb; -static SMPHolderCallback *ph_cb; -static bool clientwin_was_missing=FALSE; void ioncore_set_sm_callbacks(SMAddCallback *add, SMCfgCallback *cfg) @@ -56,26 +51,29 @@ void ioncore_get_sm_callbacks(SMAddCallback **add, SMCfgCallback **cfg) } -void ioncore_set_sm_pholder_callback(SMPHolderCallback *phcb) -{ - ph_cb=phcb; -} +/*}}}*/ -void ioncore_clientwin_load_missing() -{ - clientwin_was_missing=TRUE; -} +/*{{{ Load support functions */ -/*}}}*/ +static WPHolder **current_ph_p=NULL; -/*{{{ Load support functions */ +WPHolder *ioncore_get_load_pholder() +{ + if(current_ph_p==NULL){ + return NULL; + }else{ + WPHolder *ph=*current_ph_p; + *current_ph_p=NULL; + return ph; + } +} WRegion *create_region_load(WWindow *par, const WFitParams *fp, - ExtlTab tab) + ExtlTab tab, WPHolder **sm_ph_p) { char *objclass=NULL, *name=NULL; WRegionLoadCreateFn* fn=NULL; @@ -83,36 +81,10 @@ WRegion *create_region_load(WWindow *par, const WFitParams *fp, WRegion *reg=NULL; bool grouped=FALSE; char *grouped_name=NULL; + WPHolder **old_ph_p; if(!extl_table_gets_s(tab, "type", &objclass)) return NULL; - - /* Backwards compatibility hack. */ - if(strcmp(objclass, "WFloatWS")==0){ - objclass=scopy("WGroupWS"); - }else if(strcmp(objclass, "WIonWS")==0){ - WGroupWS *ws=create_groupws(par, fp); - if(ws!=NULL){ - extl_table_gets_s(tab, "name", &name); - extl_table_sets_s(tab, "type", "WTiling"); - extl_table_sets_b(tab, "bottom", TRUE); - extl_table_sets_b(tab, "bottom_last_close", TRUE); - extl_table_sets_i(tab, "sizepolicy", SIZEPOLICY_FULL_EXACT); - - if(name!=NULL) - region_set_name((WRegion*)ws, name); - - reg=group_attach_new((WGroup*)ws, tab); - - if(reg!=NULL) - return (WRegion*)ws; - - destroy_obj((Obj*)ws); - } - objclass=scopy("WTiling"); - }else if(strcmp(objclass, "WFloatFrame")==0){ - objclass=scopy("WFrame"); - } if(objclass==NULL) return NULL; @@ -130,19 +102,14 @@ WRegion *create_region_load(WWindow *par, const WFitParams *fp, free(objclass); - clientwin_was_missing=FALSE; + old_ph_p=current_ph_p; + current_ph_p=sm_ph_p; reg=fn(par, fp, tab); - if(reg==NULL){ - if(clientwin_was_missing && add_cb!=NULL && ph_cb!=NULL){ - WPHolder *ph=ph_cb(); - if(ph!=NULL){ - if(!add_cb(ph, tab)) - destroy_obj((Obj*)ph); - } - } - }else{ + current_ph_p=old_ph_p; + + if(reg!=NULL){ if(!OBJ_IS(reg, WClientWin)){ if(extl_table_gets_s(tab, "name", &name)){ region_set_name(reg, name); @@ -151,8 +118,6 @@ WRegion *create_region_load(WWindow *par, const WFitParams *fp, } } - ph_cb=NULL; - return reg; } @@ -187,10 +152,34 @@ ExtlTab region_get_base_configuration(WRegion *reg) } +static bool get_config_clientwins=TRUE; + + ExtlTab region_get_configuration(WRegion *reg) { ExtlTab tab=extl_table_none(); - CALL_DYN_RET(tab, ExtlTab, region_get_configuration, reg, (reg)); + if(get_config_clientwins || !OBJ_IS(reg, WClientWin)){ + CALL_DYN_RET(tab, ExtlTab, region_get_configuration, reg, (reg)); + } + return tab; +} + + +/*EXTL_DOC + * Get configuration tree. If \var{clientwins} is unset, client windows + * are filtered out. + */ +EXTL_EXPORT_AS(WRegion, get_configuration) +ExtlTab region_get_configuration_extl(WRegion *reg, bool clientwins) +{ + ExtlTab tab; + + get_config_clientwins=clientwins; + + tab=region_get_configuration(reg); + + get_config_clientwins=TRUE; + return tab; }