changeset 35796:497a1c45a597

Add uiMainDone(), uiVideoDone(), uiPlaybarDone() and uiMenuDone(). These are the counterparts to the Init functions and they free and release everything associated with the respective window. (Something that hasn't been done so far.)
author ib
date Fri, 25 Jan 2013 23:47:34 +0000
parents 5eac7c0879b7
children 6874a4b07594
files gui/interface.c gui/ui/actions.c gui/ui/main.c gui/ui/menu.c gui/ui/playbar.c gui/ui/ui.h gui/ui/video.c
diffstat 7 files changed, 37 insertions(+), 4 deletions(-) [+]
line wrap: on
line diff
--- a/gui/interface.c	Fri Jan 25 22:31:37 2013 +0000
+++ b/gui/interface.c	Fri Jan 25 23:47:34 2013 +0000
@@ -231,7 +231,13 @@
 
         cfg_write();
 
-        // NOTE TO MYSELF: destroy the windows
+        if (guiApp.menuIsPresent)
+            uiMenuDone();
+        if (guiApp.playbarIsPresent)
+            uiPlaybarDone();
+
+        uiVideoDone();
+        uiMainDone();
 
         wsDone();
     }
--- a/gui/ui/actions.c	Fri Jan 25 22:31:37 2013 +0000
+++ b/gui/ui/actions.c	Fri Jan 25 23:47:34 2013 +0000
@@ -639,14 +639,13 @@
     /* reload playbar */
 
     if (bprev)
-        wsWindowDestroy(&guiApp.playbarWindow);
+        uiPlaybarDone();
 
     uiPlaybarInit();
 
     /* reload main window */
 
-    wsWindowDestroy(&guiApp.mainWindow);
-
+    uiMainDone();
     uiMainInit();
 
     wsWindowVisibility(&guiApp.mainWindow, wsShowWindow);
--- a/gui/ui/main.c	Fri Jan 25 22:31:37 2013 +0000
+++ b/gui/ui/main.c	Fri Jan 25 23:47:34 2013 +0000
@@ -361,3 +361,9 @@
   guiApp.mainWindow.KeyHandler = uiMainKey;
   guiApp.mainWindow.DNDHandler = uiMainDND;
 }
+
+void uiMainDone (void)
+{
+  nfree(mainDrawBuffer);
+  wsWindowDestroy(&guiApp.mainWindow);
+}
--- a/gui/ui/menu.c	Fri Jan 25 22:31:37 2013 +0000
+++ b/gui/ui/menu.c	Fri Jan 25 23:47:34 2013 +0000
@@ -29,6 +29,7 @@
 #include "gui/app/gui.h"
 #include "actions.h"
 #include "ui.h"
+#include "gui/util/mem.h"
 
 #include "gui/dialog/dialog.h"
 
@@ -125,6 +126,12 @@
  uiMenuRender=True; wsWindowRedraw( &guiApp.menuWindow );
 }
 
+void uiMenuDone( void )
+{
+  nfree(menuDrawBuffer);
+  wsWindowDestroy(&guiApp.menuWindow);
+}
+
 void uiMenuShow( int mx,int my )
 {
  int x,y;
--- a/gui/ui/playbar.c	Fri Jan 25 22:31:37 2013 +0000
+++ b/gui/ui/playbar.c	Fri Jan 25 23:47:34 2013 +0000
@@ -260,6 +260,12 @@
  playbarLength=guiApp.videoWindow.Height;
 }
 
+void uiPlaybarDone( void )
+{
+  nfree(playbarDrawBuffer);
+  wsWindowDestroy(&guiApp.playbarWindow);
+}
+
 void uiPlaybarShow( int y )
 {
  if ( !guiApp.playbarIsPresent || !gtkEnablePlayBar ) return;
--- a/gui/ui/ui.h	Fri Jan 25 22:31:37 2013 +0000
+++ b/gui/ui/ui.h	Fri Jan 25 23:47:34 2013 +0000
@@ -28,14 +28,18 @@
 extern int             sx, sy;
 
 void uiMainInit( void );
+void uiMainDone( void );
 
 void uiVideoInit( void );
+void uiVideoDone( void );
 
 void uiMenuInit( void );
+void uiMenuDone( void );
 void uiMenuHide( int mx, int my, int w );
 void uiMenuShow( int mx, int my );
 
 void uiPlaybarInit( void );
+void uiPlaybarDone( void );
 void uiPlaybarShow( int y );
 
 #endif /* MPLAYER_GUI_UI_H */
--- a/gui/ui/video.c	Fri Jan 25 22:31:37 2013 +0000
+++ b/gui/ui/video.c	Fri Jan 25 23:47:34 2013 +0000
@@ -126,3 +126,8 @@
   guiApp.videoWindow.KeyHandler = guiApp.mainWindow.KeyHandler;
   guiApp.videoWindow.DNDHandler = guiApp.mainWindow.DNDHandler;
 }
+
+void uiVideoDone (void)
+{
+  wsWindowDestroy(&guiApp.videoWindow);
+}