+void
+free_system_view(systemView * SystemView)
+{
+ if(!SystemView)return;
+ //free_EventDB(SystemView->EventDB);
+ //free_SystemInfo(SystemView->SystemInfo);
+ //free_Options(SystemView->Options);
+ if(SystemView->Next)
+ free_system_view(SystemView->Next);
+ g_free(SystemView);
+}
+
+void free_tab(tab * Tab)
+{
+ if(!Tab) return;
+ if(Tab->custom->vbox)
+ gtk_widget_destroy(Tab->custom->vbox);
+ if(Tab->Attributes)
+ g_object_unref(Tab->Attributes);
+
+ if(Tab->Next) free_tab(Tab->Next);
+ g_free(Tab);
+}
+
+void
+mainWindow_free(mainWindow * mw)
+{
+ if(mw){
+ Main_Window_List = g_slist_remove(Main_Window_List, mw);
+
+ //should free memory allocated dynamically first
+ free_system_view(mw->SystemView);
+ free_tab(mw->Tab);
+ g_object_unref(mw->Attributes);
+
+ g_free(mw);
+ }
+}
+
+void
+mainWindow_Destructor(mainWindow * mw)
+{
+ if(GTK_IS_WIDGET(mw->MWindow)){
+ gtk_widget_destroy(mw->MWindow);
+ // gtk_widget_destroy(mw->HelpContents);
+ // gtk_widget_destroy(mw->AboutBox);
+ mw = NULL;
+ }
+
+ mainWindow_free(mw);
+}
+
+