]> git.decadent.org.uk Git - ion3.git/blobdiff - ioncore/saveload.c
[svn-upgrade] Integrating new upstream version, ion3 (20071220)
[ion3.git] / ioncore / saveload.c
index db8a12f47b55dcb9e9ee043690836ec042aaa750..c76c68e9aec642d959b425bddf07a31cb91494aa 100644 (file)
@@ -35,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)
@@ -53,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;
@@ -80,6 +81,7 @@ 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;
@@ -100,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);
@@ -121,8 +118,6 @@ WRegion *create_region_load(WWindow *par, const WFitParams *fp,
         }
     }
     
-    ph_cb=NULL;
-    
     return reg;
 }