Show
Ignore:
Timestamp:
06/27/09 15:13:21 (14 months ago)
Author:
ibboard
Message:

Fixes #95: Can't re-open GTK# tabs

  • Make Unit for UnitDisplayWidget visible as a property
  • Hook in to Destroyed event of UnitDisplayWidget to remove it from the map of tabs
Files:
1 modified

Legend:

Unmodified
Added
Removed
  • IBBoard.WarFoundry.GUI.GTK/trunk/FrmMainWindow.cs

    r147 r149  
    131131            FailedUnitRequirementMethod = new FailedUnitRequirementDelegate(OnFailedUnitRequirement); 
    132132            UnitNameChangedMethod = new StringValChangedDelegate(OnUnitNameChanged); 
    133             logger.Debug("Initialising complete - trying to load default army or system"); 
    134133             
    135134            //FIXME: Temporary hack to add paths and factories 
     
    148147                WarFoundryLoader.GetDefault().RegisterNonNativeFactory((INonNativeWarFoundryFactory)factory); 
    149148            } 
     149             
     150            logger.Debug("Initialising complete - seeing if we can load default army or system"); 
    150151                                 
    151152            if (args.Length == 1) 
     
    919920                    logger.Debug("Adding page for "+unit.Name); 
    920921                    unitToWidgetMap[unit] = widget; 
     922                    widget.Destroyed+= new EventHandler(UnitWidgetDestroyed); 
    921923                    int pageNum = NotebookUtil.AddPageToNotebookWithCloseButton(unitsNotebook, widget, unit.Name); 
    922924                    logger.Debug("Page added at index "+pageNum); 
     
    926928            } 
    927929        } 
     930 
     931        private void UnitWidgetDestroyed(object sender, EventArgs e) 
     932        { 
     933            if (sender is UnitDisplayWidget) 
     934            { 
     935                unitToWidgetMap.Remove(((UnitDisplayWidget)sender).Unit); 
     936            } 
     937        } 
    928938    } 
    929939}