changeset 208:8ebef120d67f

Use glib string functions more exclusively, moved fileinfo dialog to separate module (like it was in 0.7-series)
author Matti Hamalainen <ccr@tnsp.org>
date Wed, 15 Dec 2004 10:24:03 +0000
parents 7048944d3bca
children 174130d3ddd0
files src/xmms-sid.c
diffstat 1 files changed, 8 insertions(+), 162 deletions(-) [+]
line wrap: on
line diff
--- a/src/xmms-sid.c	Wed Dec 15 10:23:02 2004 +0000
+++ b/src/xmms-sid.c	Wed Dec 15 10:24:03 2004 +0000
@@ -30,8 +30,6 @@
 
 #include <gdk/gdkkeysyms.h>
 #include <gtk/gtk.h>
-
-#include "xmms-sid.h"
 #include "xs_support.h"
 #include "xs_config.h"
 #include "xs_length.h"
@@ -97,13 +95,12 @@
 /*
  * Global variables
  */
-static pthread_t		xs_decode_thread;
-static pthread_mutex_t		xs_mutex	= PTHREAD_MUTEX_INITIALIZER;
 struct t_xs_cfg			xs_cfg;
 t_xs_status			xs_status;
 t_xs_player			*xs_player	= NULL;
-static GtkWidget		*xs_fileinfowin = NULL,
-				*xs_subctrl	= NULL;
+static pthread_t		xs_decode_thread;
+static pthread_mutex_t		xs_mutex	= PTHREAD_MUTEX_INITIALIZER;
+static GtkWidget		*xs_subctrl	= NULL;
 static GtkObject		*xs_subctrl_adj = NULL;
 static t_xs_tune		*xs_fileinfotune = NULL;
 static t_xs_stil_node		*xs_fileinfostil = NULL;
@@ -246,11 +243,11 @@
 	switch (xs_cfg.playerEngine) {
 	case XS_ENG_SIDPLAY1:
 	case XS_ENG_SIDPLAY2:
-		if (!strcasecmp(pcExt, "psid")) return TRUE;
-		if (!strcasecmp(pcExt, "sid"))	return TRUE;
-		if (!strcasecmp(pcExt, "dat"))	return TRUE;
-		if (!strcasecmp(pcExt, "inf"))	return TRUE;
-		if (!strcasecmp(pcExt, "info"))	return TRUE;
+		if (!g_strcasecmp(pcExt, "psid")) return TRUE;
+		if (!g_strcasecmp(pcExt, "sid")) return TRUE;
+		if (!g_strcasecmp(pcExt, "dat")) return TRUE;
+		if (!g_strcasecmp(pcExt, "inf")) return TRUE;
+		if (!g_strcasecmp(pcExt, "info")) return TRUE;
 		break;
 	}
 	}
@@ -847,154 +844,3 @@
  g_free(pTune);
 }
 
-
-/*
- * File-information window
- */
-void xs_fileinfo_ok(void)
-{
- gtk_widget_destroy(xs_fileinfowin);
- xs_fileinfowin = NULL;
-}
-
-
-void xs_fileinfo_subtune(GtkWidget *widget, void *data)
-{
- t_xs_stil_subnode *tmpNode;
- GtkWidget *tmpItem, *tmpText;
- gint tmpIndex;
- gchar *subName, *subAuthor;
-
- /* 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)));
-
- if (xs_fileinfostil)
- 	{
-	/* Get subtune number */
-	tmpItem  = gtk_menu_get_active(GTK_MENU(data));
-	tmpIndex = g_list_index(GTK_MENU_SHELL(data)->children, tmpItem);
-
-	/* Get subtune information */
-	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")), subName ? subName : "");
- gtk_entry_set_text(GTK_ENTRY(LUW("fileinfo_sub_author")), subAuthor ? subAuthor : "");
-
- /* Un-freeze the widget */
- gtk_text_thaw(GTK_TEXT(tmpText));
-}
-
-
-void xs_fileinfo(gchar *pcFilename)
-{
- GtkWidget *tmpMenuItem, *tmpMenu, *tmpOptionMenu;
- t_xs_stil_subnode *tmpNode;
- gchar tmpStr[32], *tmpS;
- gint n;
-
- /* Free old info, if set */
- if (xs_fileinfotune)
- 	xs_tune_free(xs_fileinfotune);
- 
- /* Get new tune information */
- if ((xs_fileinfotune = xs_player->plrGetSIDInfo(pcFilename)) == NULL)
- 	return;
-
- if (xs_cfg.stilDBEnable)
-	xs_fileinfostil = xs_stil_get(pcFilename);
-	else
-	xs_fileinfostil = NULL;
- 
-
- /* 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();
-	
-	/* Connect additional signals */
-	gtk_signal_connect(GTK_OBJECT(
-		gtk_range_get_adjustment(GTK_RANGE(LUW("fileinfo_subctrl_adj")))),
-		"value_changed", GTK_SIGNAL_FUNC (xs_fileinfo_setsong), NULL);
-	}
-
-
- /* 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);
- gtk_entry_set_text(GTK_ENTRY(LUW("fileinfo_copyright")), xs_fileinfotune->tuneCopyright);
-
-
- /* Main tune - the pseudo tune */
- tmpOptionMenu = LUW("fileinfo_sub_tune");
- tmpMenu = GTK_OPTION_MENU(tmpOptionMenu)->menu;
-
- tmpMenuItem = gtk_menu_item_new_with_label ("General info");
- 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);
-
- /* Other menu items */
- for (n = 1; n <= xs_fileinfotune->nsubTunes; n++)
-	{
-	if (xs_fileinfostil)
-		{
-		tmpNode = &xs_fileinfostil->subTune[n];
-		if (tmpNode->pName)
-			tmpS = tmpNode->pName;
-			else
-		if (tmpNode->pInfo)
-			tmpS = tmpNode->pInfo;
-			else
-			tmpS = "---";
-
-		snprintf(tmpStr, sizeof(tmpStr), "Tune #%i: %s", n, tmpS);
-		} else
-		snprintf(tmpStr, sizeof(tmpStr), "Tune #%i", n);
-
-	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);
-	}
-
- /* Set the subtune information */
- xs_fileinfo_subtune(NULL, tmpMenu);
-
- /* Update subtune controls */
- xs_subctrl_update();
-
- /* Show the window */
- gtk_widget_show(xs_fileinfowin);
-}