changeset 615:8fe2e757fa4a

Fixed sub-tune info selection box in fileinfo window.
author Matti Hamalainen <ccr@tnsp.org>
date Sun, 02 Sep 2007 19:57:03 +0000
parents 52a6c114e505
children 1776da045588
files src/xs_fileinfo.c
diffstat 1 files changed, 13 insertions(+), 16 deletions(-) [+]
line wrap: on
line diff
--- a/src/xs_fileinfo.c	Sun Sep 02 17:31:01 2007 +0000
+++ b/src/xs_fileinfo.c	Sun Sep 02 19:57:03 2007 +0000
@@ -217,9 +217,9 @@
 static void xs_fileinfo_subtune(GtkWidget * widget, void *data)
 {
 	t_xs_stil_subnode *tmpNode;
-	GtkWidget *tmpItem, *tmpText;
+	GtkWidget *tmpText;
 	gint tmpIndex;
-	gchar *subName, *subAuthor;
+	gchar *subName, *subAuthor, *subInfo;
 
 	(void) widget;
 	(void) data;
@@ -231,30 +231,28 @@
 	gtk_text_forward_delete(GTK_TEXT(tmpText), gtk_text_get_length(GTK_TEXT(tmpText)));
 
 	/* Get subtune information */
-	tmpItem = gtk_menu_get_active(GTK_MENU(data));
-	tmpIndex = g_list_index(GTK_MENU_SHELL(data)->children, tmpItem);
-
+	tmpIndex = g_list_index(GTK_MENU_SHELL(data)->children, gtk_menu_get_active(GTK_MENU(data)));
+	
 	if (xs_fileinfostil && tmpIndex <= xs_fileinfostil->nsubTunes)
 		tmpNode = xs_fileinfostil->subTunes[tmpIndex];
 	else
 		tmpNode = NULL;
-
+	
 	if (tmpNode) {
 		subName = tmpNode->pName;
 		subAuthor = tmpNode->pAuthor;
-
-		if (tmpNode->pInfo) {
-			gtk_text_insert(GTK_TEXT(tmpText), NULL, NULL, NULL,
-				tmpNode->pInfo, strlen(tmpNode->pInfo));
-		}
+		subInfo = tmpNode->pInfo;
 	} else {
 		subName = NULL;
 		subAuthor = NULL;
+		subInfo = NULL;
 	}
 
 	/* Get and set subtune information */
 	gtk_entry_set_text(GTK_ENTRY(LUW("fileinfo_sub_name")), subName ? subName : "");
 	gtk_entry_set_text(GTK_ENTRY(LUW("fileinfo_sub_author")), subAuthor ? subAuthor : "");
+	gtk_text_insert(GTK_TEXT(tmpText), NULL, NULL, NULL,
+		subInfo ? subInfo : "", -1);
 
 	/* Un-freeze the widget */
 	gtk_text_thaw(GTK_TEXT(tmpText));
@@ -265,6 +263,7 @@
 {
 	GtkWidget *tmpMenuItem, *tmpMenu, *tmpOptionMenu;
 	t_xs_tuneinfo *tmpInfo;
+	gchar tmpStr[256];
 	gint n;
 
 	/* Current implementation leaves old fileinfo window untouched if
@@ -288,9 +287,9 @@
 		gdk_window_raise(xs_fileinfowin->window);
 	else {
 		xs_fileinfowin = create_xs_fileinfowin();
-		gtk_signal_connect(
-			GTK_OBJECT(gtk_range_get_adjustment(GTK_RANGE(LUW("fileinfo_subctrl_adj")))),
-			"value_changed", GTK_SIGNAL_FUNC(xs_fileinfo_setsong), NULL);
+		gtk_signal_connect(GTK_OBJECT(
+			gtk_range_get_adjustment(GTK_RANGE(LUW("fileinfo_subctrl_adj")))), "value_changed",
+			GTK_SIGNAL_FUNC(xs_fileinfo_setsong), NULL);
 	}
 
 	/* Delete current items */
@@ -317,7 +316,6 @@
 
 	/* Other menu items */
 	for (n = 1; n <= tmpInfo->nsubTunes; n++) {
-		gchar tmpStr[64];
 		if (xs_fileinfostil && n <= xs_fileinfostil->nsubTunes && xs_fileinfostil->subTunes[n]) {
 			t_xs_stil_subnode *tmpNode = xs_fileinfostil->subTunes[n];
 			
@@ -338,7 +336,6 @@
 		tmpMenuItem = gtk_menu_item_new_with_label(tmpStr);
 		gtk_widget_show(tmpMenuItem);
 		gtk_menu_append(GTK_MENU(tmpMenu), tmpMenuItem);
-
 		gtk_signal_connect(GTK_OBJECT(tmpMenuItem), "activate",
 			GTK_SIGNAL_FUNC(xs_fileinfo_subtune), tmpMenu);
 	}