diff src/xs_config.c @ 577:fdddab8f0c1b

Scrubbing through the filter configuration code; Configuration dialog window delete event was not handled and caused problems if WM's "close window" was used, fixed.
author Matti Hamalainen <ccr@tnsp.org>
date Tue, 20 Mar 2007 13:43:00 +0000
parents cf32867a71ed
children d9290bd40037
line wrap: on
line diff
--- a/src/xs_config.c	Tue Mar 20 13:14:02 2007 +0000
+++ b/src/xs_config.c	Tue Mar 20 13:43:00 2007 +0000
@@ -292,8 +292,6 @@
 	g_snprintf(tmpKey, sizeof(tmpKey), "filter%dNPoints", nFilter);
 	if (!XS_CFG_GET_INT(cfg, XS_CONFIG_IDENT, tmpKey, &(pResult->npoints)))
 		return FALSE;
-	if (pResult->npoints > XS_SIDPLAY2_NFPOINTS)
-		return FALSE;
 	
 	g_snprintf(tmpKey, sizeof(tmpKey), "filter%dName", nFilter);
 	if (!XS_CFG_GET_STRING(cfg, XS_CONFIG_IDENT, tmpKey, &tmpStr))
@@ -473,7 +471,8 @@
 		}
 	}
 	
-xs_filter_load_into(cfg, 0, &xs_cfg.sid2Filter);
+	/* Filters and presets are a special case */
+	xs_filter_load_into(cfg, 0, &xs_cfg.sid2Filter);
 
 	XS_CONFIG_FREE(cfg);
 
@@ -481,7 +480,6 @@
 	XSDEBUG("OK\n");
 }
 
-#include "tmp.c"
 
 /* Write the current configuration
  */
@@ -498,6 +496,7 @@
 
 #ifndef AUDACIOUS_PLUGIN
 	if (!cfg) cfg = xmms_cfg_new();
+	if (!cfg) return -1;
 #endif
 
 	/* Write the new settings to XMMS configuration file */
@@ -529,10 +528,6 @@
 		}
 	}
 
-xs_filter_save(cfg, &testFilter6581R4, 0);
-xs_filter_save(cfg, &testFilter6581R1, 1);
-xs_filters_export("paske.filters", &testFilter6581R1, 1);
-
 
 	XS_CONFIG_WRITE(cfg);
 	XS_CONFIG_FREE(cfg);
@@ -939,6 +934,21 @@
 }
 
 
+gboolean xs_configwin_delete(GtkWidget * widget, GdkEvent * event, gpointer user_data)
+{
+	(void) widget;
+	(void) event;
+	(void) user_data;
+	
+	XSDEBUG("config::delete_event\n");
+	if (xs_configwin) {
+		gtk_widget_destroy(xs_configwin);
+		xs_configwin = NULL;
+	}
+	return FALSE;
+}
+
+
 /* Execute the configuration panel
  */
 void xs_configure(void)
@@ -946,10 +956,10 @@
 	gint i;
 	gfloat tmpValue;
 	gchar tmpStr[32];
-	GtkWidget *c;
+	GtkWidget *tmpCurve;
 
 	/* Check if the window already exists */
-	if (xs_configwin != NULL) {
+	if (xs_configwin) {
 		gdk_window_raise(xs_configwin->window);
 		return;
 	}
@@ -961,19 +971,20 @@
 	XS_MUTEX_LOCK(xs_cfg);
 
 	/* Create the custom filter curve widget for libSIDPlay2 */
-	c = xs_curve_new();
-	xs_curve_reset(XS_CURVE(c));
-	xs_curve_set_range(XS_CURVE(c),
+	tmpCurve = xs_curve_new();
+	xs_curve_reset(XS_CURVE(tmpCurve));
+	xs_curve_set_range(XS_CURVE(tmpCurve),
 		0,0, XS_SIDPLAY2_NFPOINTS, XS_SIDPLAY2_FMAX);
-	xs_curve_set_points(XS_CURVE(c),
+
+	xs_curve_set_points(XS_CURVE(tmpCurve),
 		xs_cfg.sid2Filter.points, xs_cfg.sid2Filter.npoints);
 	
-	gtk_widget_set_name(c, "cfg_sp2_filter_curve");
-	gtk_widget_ref(c);
+	gtk_widget_set_name(tmpCurve, "cfg_sp2_filter_curve");
+	gtk_widget_ref(tmpCurve);
 	gtk_object_set_data_full(GTK_OBJECT(xs_configwin),
-		"cfg_sp2_filter_curve", c, (GtkDestroyNotify) gtk_widget_unref);
-	gtk_widget_show(c);
-	gtk_container_add(GTK_CONTAINER(LUW("cfg_sp2_filter_frame")), c);
+		"cfg_sp2_filter_curve", tmpCurve, (GtkDestroyNotify) gtk_widget_unref);
+	gtk_widget_show(tmpCurve);
+	gtk_container_add(GTK_CONTAINER(LUW("cfg_sp2_filter_frame")), tmpCurve);
 
 
 	/* Based on available optional parts, gray out options */