changeset 118:5bddcad25ef7

Finalized the fileinfo window code.
author Matti Hamalainen <ccr@tnsp.org>
date Wed, 14 Jan 2004 01:56:02 +0000
parents 453ac1293f6a
children f4620b534861
files src/xmms-sid.c
diffstat 1 files changed, 30 insertions(+), 48 deletions(-) [+]
line wrap: on
line diff
--- a/src/xmms-sid.c	Wed Jan 14 01:55:04 2004 +0000
+++ b/src/xmms-sid.c	Wed Jan 14 01:56:02 2004 +0000
@@ -633,7 +633,7 @@
 void xs_fileinfo_subtune(GtkWidget *widget, void *data)
 {
  t_xs_stil_subnode *tmpNode;
- GtkWidget *tmpItem;
+ GtkWidget *tmpItem, *tmpText;
  gint tmpIndex;
 
  if (!xs_fileinfostil) return;
@@ -644,62 +644,45 @@
  tmpNode = &xs_fileinfostil->subTune[tmpIndex];
 
  /* Get and set subtune information */
- if (tmpNode->pArtist)
-	gtk_entry_set_text(GTK_ENTRY(LUW("fileinfo_sub_artist")), tmpNode->pArtist);
-
- if (tmpNode->pTitle)
-	gtk_entry_set_text(GTK_ENTRY(LUW("fileinfo_sub_title")), tmpNode->pTitle);
+ 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));
 
-#if 0
-XSDEBUG("%i: '%s', '%s', '%s', '%s'\n", tmpIndex,
-	tmpNode->pName,
-	tmpNode->pTitle,
-	tmpNode->pArtist,
-	tmpNode->pAuthor);
+ /* 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->pComment)
+ if (tmpNode->pInfo)
 	{
-	/* Freeze the widget for update */
-	gtk_text_freeze(GTK_TEXT(fileinfo_sub_comment));
-
-	/* Delete the old comment */
-	gtk_text_set_point(GTK_TEXT(fileinfo_sub_comment), 0);
-	gtk_text_forward_delete(GTK_TEXT(fileinfo_sub_comment),
-	gtk_text_get_length(GTK_TEXT(fileinfo_sub_comment)));
+	/* Put in the new text */	
+	gtk_text_insert (GTK_TEXT (tmpText), NULL, NULL, NULL,
+		tmpNode->pInfo, strlen(tmpNode->pInfo));
 
-	/* Put in the new comment */	
-	gtk_text_insert (GTK_TEXT (fileinfo_sub_comment), NULL, NULL, NULL,
-	a_tune->comment, strlen(a_tune->comment));
+	}
 
-	/* Un-freeze the widget */
-	gtk_text_thaw(GTK_TEXT(fileinfo_sub_comment));
-	}
-#endif
-
- gtk_widget_show(xs_fileinfowin);
+ /* Un-freeze the widget */
+ gtk_text_thaw(GTK_TEXT(tmpText));
 }
 
 
 void xs_fileinfo(gchar *pcFilename)
 {
- GtkWidget *tmpMenuItem, *tmpMenu, *tmpOptionMenu;
+ GtkWidget *tmpMenuItem, *tmpMenu, *tmpOptionMenu, *tmpText;
  t_xs_stil_subnode *tmpNode;
  gchar tmpStr[32], *tmpS;
  gint n;
 
  /* Free old info, if set */
- if (xs_fileinfotune) xs_tune_free(xs_fileinfotune);
+ if (xs_fileinfotune)
+ 	xs_tune_free(xs_fileinfotune);
  
  /* Get new tune information */
  if ((xs_fileinfotune = xs_player->plrGetSIDInfo(pcFilename)) == NULL)
- 	{
- 	if (xs_fileinfowin)
- 		{
- 		gtk_widget_destroy(xs_fileinfowin);
- 		xs_fileinfowin = NULL;
- 		}
  	return;
- 	}
 
  if (xs_cfg.stilDBEnable)
 	xs_fileinfostil = xs_stil_get(pcFilename);
@@ -710,7 +693,13 @@
  /* Check if there already is an open fileinfo window */
  if (xs_fileinfowin)
 	{
+	/* Raise old window */
 	gdk_window_raise(xs_fileinfowin->window);
+
+	/* Delete items */
+	tmpOptionMenu = LUW("fileinfo_sub_tune");
+	gtk_widget_destroy(GTK_OPTION_MENU(tmpOptionMenu)->menu);
+	GTK_OPTION_MENU(tmpOptionMenu)->menu = gtk_menu_new();	
 	} else {
 	/* If not, create a new one */
 	xs_fileinfowin = create_xs_fileinfowin();
@@ -740,17 +729,10 @@
 	if (xs_fileinfostil)
 		{
 		tmpNode = &xs_fileinfostil->subTune[n];
-		if (tmpNode->pName)
-			tmpS = tmpNode->pName;
-			else
-		if (tmpNode->pTitle)
-			tmpS = tmpNode->pTitle;
-			else
-			tmpS = "-";
-		
-		snprintf(tmpStr, sizeof(tmpStr), "#%i: %s", n, tmpS);
+		tmpS = (tmpNode->pName) ? tmpNode->pName : "-";
+		snprintf(tmpStr, sizeof(tmpStr), "Tune #%i: %s", n, tmpS);
 		} else
-		snprintf(tmpStr, sizeof(tmpStr), "Tune #%i", n);
+		snprintf(tmpStr, sizeof(tmpStr), "Tune #%i: -", n);
 
 	tmpMenuItem = gtk_menu_item_new_with_label(tmpStr);
 	gtk_widget_show (tmpMenuItem);