changeset 2408:88168440e223

Add _gtk_projectm_destroy_impl().
author William Pitcock <nenolod@atheme.org>
date Mon, 18 Feb 2008 02:03:54 -0600
parents d722ca89f7bf
children f67bdd91620a
files src/projectm-1.0/gtk_projectm_impl.cxx src/projectm-1.0/main.c
diffstat 2 files changed, 17 insertions(+), 1 deletions(-) [+]
line wrap: on
line diff
--- a/src/projectm-1.0/gtk_projectm_impl.cxx	Mon Feb 18 01:47:02 2008 -0600
+++ b/src/projectm-1.0/gtk_projectm_impl.cxx	Mon Feb 18 02:03:54 2008 -0600
@@ -35,6 +35,7 @@
 static gboolean _gtk_projectm_redraw_impl(GtkWidget *widget);
 static gboolean _gtk_projectm_expose_impl(GtkWidget *widget, GdkEventExpose *event, gpointer data);
 static gboolean _gtk_projectm_configure_impl(GtkWidget *widget, GdkEventConfigure *event, gpointer data);
+static void _gtk_projectm_destroy_impl(GtkWidget *widget);
 
 struct _GtkProjectMPrivate {
     projectM *pm;
@@ -65,6 +66,8 @@
                            G_CALLBACK(_gtk_projectm_realize_impl), priv);
     g_signal_connect(G_OBJECT(priv->drawing_area), "expose_event",
                      G_CALLBACK(_gtk_projectm_expose_impl), priv);
+    g_signal_connect(G_OBJECT(priv->drawing_area), "destroy",
+                     G_CALLBACK(_gtk_projectm_destroy_impl), priv);
 
     priv->timer = g_timer_new();
     priv->frames = 0;
@@ -164,6 +167,19 @@
     return TRUE;
 }
 
+static void
+_gtk_projectm_destroy_impl(GtkWidget *widget)
+{
+    struct _GtkProjectMPrivate *priv = (struct _GtkProjectMPrivate *) g_object_get_data(G_OBJECT(widget), "GtkProjectMPrivate");
+
+    if (priv->idle_id)
+        g_source_remove(priv->idle_id);
+
+    delete priv->pm;
+    g_free(priv->timer);
+    g_slice_free(struct _GtkProjectMPrivate, priv);
+}
+
 /********************************************************************************
  * XXX: This code is from projectM and still needs to be rewritten!             *
  ********************************************************************************/
--- a/src/projectm-1.0/main.c	Mon Feb 18 01:47:02 2008 -0600
+++ b/src/projectm-1.0/main.c	Mon Feb 18 02:03:54 2008 -0600
@@ -40,7 +40,7 @@
 void
 projectM_cleanup(void)
 {
-
+    gtk_widget_destroy(window);
 }
 
 void