changeset 138:64a8fa2ba5f2

Fixed the file-info window, which did not update correctly in some cases when previous shown data had STIL-information and new one did not.
author Matti Hamalainen <ccr@tnsp.org>
date Thu, 26 Feb 2004 02:45:02 +0000
parents 6afee1ba02bb
children 7cc2cc5f6f21
files src/xmms-sid.c src/xmms-sid.h
diffstat 2 files changed, 31 insertions(+), 26 deletions(-) [+]
line wrap: on
line diff
--- a/src/xmms-sid.c	Thu Feb 26 02:19:05 2004 +0000
+++ b/src/xmms-sid.c	Thu Feb 26 02:45:02 2004 +0000
@@ -643,34 +643,40 @@
  t_xs_stil_subnode *tmpNode;
  GtkWidget *tmpItem, *tmpText;
  gint tmpIndex;
+ gchar *subName, *subAuthor;
 
- if (!xs_fileinfostil) return;
+ /* Freeze text-widget and delete the old text */
+ tmpText = LUW("fileinfo_sub_info");
+ gtk_text_freeze(GTK_TEXT(tmpText));
+ gtk_text_set_point(GTK_TEXT(tmpText), 0);
+ gtk_text_forward_delete(GTK_TEXT(tmpText),
+ gtk_text_get_length(GTK_TEXT(tmpText)));
 
- /* Get number of subtune */
- tmpItem  = gtk_menu_get_active(GTK_MENU(data));
- tmpIndex = g_list_index(GTK_MENU_SHELL(data)->children, tmpItem);
- tmpNode = &xs_fileinfostil->subTune[tmpIndex];
+ if (xs_fileinfostil)
+ 	{
+	/* Get subtune information */
+	tmpItem  = gtk_menu_get_active(GTK_MENU(data));
+	tmpIndex = g_list_index(GTK_MENU_SHELL(data)->children, tmpItem);
+	tmpNode = &xs_fileinfostil->subTune[tmpIndex];
+
+	subName = tmpNode->pName;
+	subAuthor = tmpNode->pAuthor;
+
+	/* Put in the new text, if available */
+	if (tmpNode->pInfo)
+		{
+		gtk_text_insert (GTK_TEXT (tmpText), NULL, NULL, NULL,
+		tmpNode->pInfo, strlen(tmpNode->pInfo));
+		}
+	} else {
+	/* We don't have any information */
+	subName = NULL;
+	subAuthor = NULL;
+	}
 
  /* Get and set subtune information */
- gtk_entry_set_text(GTK_ENTRY(LUW("fileinfo_sub_name")), tmpNode->pName ? tmpNode->pName : "");
- gtk_entry_set_text(GTK_ENTRY(LUW("fileinfo_sub_author")), tmpNode->pAuthor ? tmpNode->pAuthor : "");
-	
- /* Freeze the widget for update */
- tmpText = LUW("fileinfo_sub_info");
- gtk_text_freeze(GTK_TEXT(tmpText));
-
- /* Delete the old text */
- gtk_text_set_point(GTK_TEXT(tmpText), 0);
- gtk_text_forward_delete(GTK_TEXT(tmpText),
- 	gtk_text_get_length(GTK_TEXT(tmpText)));
-
- if (tmpNode->pInfo)
-	{
-	/* Put in the new text */	
-	gtk_text_insert (GTK_TEXT (tmpText), NULL, NULL, NULL,
-		tmpNode->pInfo, strlen(tmpNode->pInfo));
-
-	}
+ gtk_entry_set_text(GTK_ENTRY(LUW("fileinfo_sub_name")), subName ? subName : "");
+ gtk_entry_set_text(GTK_ENTRY(LUW("fileinfo_sub_author")), subAuthor ? subAuthor : "");
 
  /* Un-freeze the widget */
  gtk_text_thaw(GTK_TEXT(tmpText));
@@ -714,7 +720,7 @@
 	}
 
 
- /* Set the song informations */
+ /* Set the generic song information */
  gtk_entry_set_text(GTK_ENTRY(LUW("fileinfo_filename")), pcFilename);
  gtk_entry_set_text(GTK_ENTRY(LUW("fileinfo_songname")), xs_fileinfotune->tuneName);
  gtk_entry_set_text(GTK_ENTRY(LUW("fileinfo_composer")), xs_fileinfotune->tuneComposer);
--- a/src/xmms-sid.h	Thu Feb 26 02:19:05 2004 +0000
+++ b/src/xmms-sid.h	Thu Feb 26 02:45:02 2004 +0000
@@ -4,7 +4,6 @@
    Main header file
 
    Written by Matti "ccr" Hamalainen <ccr@tnsp.org>
-   (few bits may still be by Willem Monsuwe)
 
    This program is free software; you can redistribute it and/or modify
    it under the terms of the GNU General Public License as published by