annotate Plugins/Input/sid/xs_fileinfo.c @ 1458:f12d7e208b43 trunk

[svn] Update FSF address in copyright notices. Update autotools templates.
author chainsaw
date Wed, 02 Aug 2006 15:44:07 -0700
parents d0e9693d2115
children 705d4c089fce
Ignore whitespace changes - Everywhere: Within whitespace: At end of lines:
rev   line source
269
1b82a9932b60 [svn] Import sid plugin. Ported from XMMS by giacomo.
chainsaw
parents:
diff changeset
1 /*
1b82a9932b60 [svn] Import sid plugin. Ported from XMMS by giacomo.
chainsaw
parents:
diff changeset
2 XMMS-SID - SIDPlay input plugin for X MultiMedia System (XMMS)
1b82a9932b60 [svn] Import sid plugin. Ported from XMMS by giacomo.
chainsaw
parents:
diff changeset
3
1b82a9932b60 [svn] Import sid plugin. Ported from XMMS by giacomo.
chainsaw
parents:
diff changeset
4 File information window
1b82a9932b60 [svn] Import sid plugin. Ported from XMMS by giacomo.
chainsaw
parents:
diff changeset
5
1b82a9932b60 [svn] Import sid plugin. Ported from XMMS by giacomo.
chainsaw
parents:
diff changeset
6 Programmed and designed by Matti 'ccr' Hamalainen <ccr@tnsp.org>
1b82a9932b60 [svn] Import sid plugin. Ported from XMMS by giacomo.
chainsaw
parents:
diff changeset
7 (C) Copyright 1999-2005 Tecnic Software productions (TNSP)
1b82a9932b60 [svn] Import sid plugin. Ported from XMMS by giacomo.
chainsaw
parents:
diff changeset
8
1b82a9932b60 [svn] Import sid plugin. Ported from XMMS by giacomo.
chainsaw
parents:
diff changeset
9 This program is free software; you can redistribute it and/or modify
1b82a9932b60 [svn] Import sid plugin. Ported from XMMS by giacomo.
chainsaw
parents:
diff changeset
10 it under the terms of the GNU General Public License as published by
1b82a9932b60 [svn] Import sid plugin. Ported from XMMS by giacomo.
chainsaw
parents:
diff changeset
11 the Free Software Foundation; either version 2 of the License, or
1b82a9932b60 [svn] Import sid plugin. Ported from XMMS by giacomo.
chainsaw
parents:
diff changeset
12 (at your option) any later version.
1b82a9932b60 [svn] Import sid plugin. Ported from XMMS by giacomo.
chainsaw
parents:
diff changeset
13
1b82a9932b60 [svn] Import sid plugin. Ported from XMMS by giacomo.
chainsaw
parents:
diff changeset
14 This program is distributed in the hope that it will be useful,
1b82a9932b60 [svn] Import sid plugin. Ported from XMMS by giacomo.
chainsaw
parents:
diff changeset
15 but WITHOUT ANY WARRANTY; without even the implied warranty of
1b82a9932b60 [svn] Import sid plugin. Ported from XMMS by giacomo.
chainsaw
parents:
diff changeset
16 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
1b82a9932b60 [svn] Import sid plugin. Ported from XMMS by giacomo.
chainsaw
parents:
diff changeset
17 GNU General Public License for more details.
1b82a9932b60 [svn] Import sid plugin. Ported from XMMS by giacomo.
chainsaw
parents:
diff changeset
18
1b82a9932b60 [svn] Import sid plugin. Ported from XMMS by giacomo.
chainsaw
parents:
diff changeset
19 You should have received a copy of the GNU General Public License
1b82a9932b60 [svn] Import sid plugin. Ported from XMMS by giacomo.
chainsaw
parents:
diff changeset
20 along with this program; if not, write to the Free Software
1458
f12d7e208b43 [svn] Update FSF address in copyright notices. Update autotools templates.
chainsaw
parents: 304
diff changeset
21 Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02111-1307, USA.
269
1b82a9932b60 [svn] Import sid plugin. Ported from XMMS by giacomo.
chainsaw
parents:
diff changeset
22 */
1b82a9932b60 [svn] Import sid plugin. Ported from XMMS by giacomo.
chainsaw
parents:
diff changeset
23 #include <gdk/gdkkeysyms.h>
1b82a9932b60 [svn] Import sid plugin. Ported from XMMS by giacomo.
chainsaw
parents:
diff changeset
24 #include <gtk/gtk.h>
1b82a9932b60 [svn] Import sid plugin. Ported from XMMS by giacomo.
chainsaw
parents:
diff changeset
25
1b82a9932b60 [svn] Import sid plugin. Ported from XMMS by giacomo.
chainsaw
parents:
diff changeset
26 #include "xs_fileinfo.h"
1b82a9932b60 [svn] Import sid plugin. Ported from XMMS by giacomo.
chainsaw
parents:
diff changeset
27 #include "xs_support.h"
1b82a9932b60 [svn] Import sid plugin. Ported from XMMS by giacomo.
chainsaw
parents:
diff changeset
28 #include "xs_stil.h"
1b82a9932b60 [svn] Import sid plugin. Ported from XMMS by giacomo.
chainsaw
parents:
diff changeset
29 #include "xs_config.h"
1b82a9932b60 [svn] Import sid plugin. Ported from XMMS by giacomo.
chainsaw
parents:
diff changeset
30 #include "xs_interface.h"
1b82a9932b60 [svn] Import sid plugin. Ported from XMMS by giacomo.
chainsaw
parents:
diff changeset
31 #include "xs_glade.h"
1b82a9932b60 [svn] Import sid plugin. Ported from XMMS by giacomo.
chainsaw
parents:
diff changeset
32
1b82a9932b60 [svn] Import sid plugin. Ported from XMMS by giacomo.
chainsaw
parents:
diff changeset
33 static GtkWidget *xs_fileinfowin = NULL;
1b82a9932b60 [svn] Import sid plugin. Ported from XMMS by giacomo.
chainsaw
parents:
diff changeset
34 static t_xs_stil_node *xs_fileinfostil = NULL;
304
d0e9693d2115 [svn] Convert to configdb. GThreadify and peel off layer of threading macro madness.
chainsaw
parents: 269
diff changeset
35 GStaticMutex xs_fileinfowin_mutex = G_STATIC_MUTEX_INIT;
d0e9693d2115 [svn] Convert to configdb. GThreadify and peel off layer of threading macro madness.
chainsaw
parents: 269
diff changeset
36 GStaticMutex xs_status_mutex = G_STATIC_MUTEX_INIT;
d0e9693d2115 [svn] Convert to configdb. GThreadify and peel off layer of threading macro madness.
chainsaw
parents: 269
diff changeset
37 extern t_xs_status xs_status;
269
1b82a9932b60 [svn] Import sid plugin. Ported from XMMS by giacomo.
chainsaw
parents:
diff changeset
38
1b82a9932b60 [svn] Import sid plugin. Ported from XMMS by giacomo.
chainsaw
parents:
diff changeset
39 #define LUW(x) lookup_widget(xs_fileinfowin, x)
1b82a9932b60 [svn] Import sid plugin. Ported from XMMS by giacomo.
chainsaw
parents:
diff changeset
40
1b82a9932b60 [svn] Import sid plugin. Ported from XMMS by giacomo.
chainsaw
parents:
diff changeset
41
1b82a9932b60 [svn] Import sid plugin. Ported from XMMS by giacomo.
chainsaw
parents:
diff changeset
42 void xs_fileinfo_update(void)
1b82a9932b60 [svn] Import sid plugin. Ported from XMMS by giacomo.
chainsaw
parents:
diff changeset
43 {
1b82a9932b60 [svn] Import sid plugin. Ported from XMMS by giacomo.
chainsaw
parents:
diff changeset
44 gboolean isEnabled;
1b82a9932b60 [svn] Import sid plugin. Ported from XMMS by giacomo.
chainsaw
parents:
diff changeset
45 GtkAdjustment *tmpAdj;
1b82a9932b60 [svn] Import sid plugin. Ported from XMMS by giacomo.
chainsaw
parents:
diff changeset
46
304
d0e9693d2115 [svn] Convert to configdb. GThreadify and peel off layer of threading macro madness.
chainsaw
parents: 269
diff changeset
47 g_static_mutex_lock(&xs_status_mutex);
d0e9693d2115 [svn] Convert to configdb. GThreadify and peel off layer of threading macro madness.
chainsaw
parents: 269
diff changeset
48 g_static_mutex_lock(&xs_fileinfowin_mutex);
269
1b82a9932b60 [svn] Import sid plugin. Ported from XMMS by giacomo.
chainsaw
parents:
diff changeset
49
1b82a9932b60 [svn] Import sid plugin. Ported from XMMS by giacomo.
chainsaw
parents:
diff changeset
50 /* Check if control window exists, we are currently playing and have a tune */
1b82a9932b60 [svn] Import sid plugin. Ported from XMMS by giacomo.
chainsaw
parents:
diff changeset
51 if (xs_fileinfowin) {
1b82a9932b60 [svn] Import sid plugin. Ported from XMMS by giacomo.
chainsaw
parents:
diff changeset
52 if (xs_status.tuneInfo && xs_status.isPlaying && (xs_status.tuneInfo->nsubTunes > 1)) {
1b82a9932b60 [svn] Import sid plugin. Ported from XMMS by giacomo.
chainsaw
parents:
diff changeset
53 tmpAdj = gtk_range_get_adjustment(GTK_RANGE(LUW("fileinfo_subctrl_adj")));
1b82a9932b60 [svn] Import sid plugin. Ported from XMMS by giacomo.
chainsaw
parents:
diff changeset
54
1b82a9932b60 [svn] Import sid plugin. Ported from XMMS by giacomo.
chainsaw
parents:
diff changeset
55 tmpAdj->value = xs_status.currSong;
1b82a9932b60 [svn] Import sid plugin. Ported from XMMS by giacomo.
chainsaw
parents:
diff changeset
56 tmpAdj->lower = 1;
1b82a9932b60 [svn] Import sid plugin. Ported from XMMS by giacomo.
chainsaw
parents:
diff changeset
57 tmpAdj->upper = xs_status.tuneInfo->nsubTunes;
304
d0e9693d2115 [svn] Convert to configdb. GThreadify and peel off layer of threading macro madness.
chainsaw
parents: 269
diff changeset
58 g_static_mutex_unlock(&xs_status_mutex);
d0e9693d2115 [svn] Convert to configdb. GThreadify and peel off layer of threading macro madness.
chainsaw
parents: 269
diff changeset
59 g_static_mutex_unlock(&xs_fileinfowin_mutex);
269
1b82a9932b60 [svn] Import sid plugin. Ported from XMMS by giacomo.
chainsaw
parents:
diff changeset
60 gtk_adjustment_value_changed(tmpAdj);
304
d0e9693d2115 [svn] Convert to configdb. GThreadify and peel off layer of threading macro madness.
chainsaw
parents: 269
diff changeset
61 g_static_mutex_lock(&xs_status_mutex);
d0e9693d2115 [svn] Convert to configdb. GThreadify and peel off layer of threading macro madness.
chainsaw
parents: 269
diff changeset
62 g_static_mutex_lock(&xs_fileinfowin_mutex);
269
1b82a9932b60 [svn] Import sid plugin. Ported from XMMS by giacomo.
chainsaw
parents:
diff changeset
63 isEnabled = TRUE;
1b82a9932b60 [svn] Import sid plugin. Ported from XMMS by giacomo.
chainsaw
parents:
diff changeset
64 } else
1b82a9932b60 [svn] Import sid plugin. Ported from XMMS by giacomo.
chainsaw
parents:
diff changeset
65 isEnabled = FALSE;
1b82a9932b60 [svn] Import sid plugin. Ported from XMMS by giacomo.
chainsaw
parents:
diff changeset
66
1b82a9932b60 [svn] Import sid plugin. Ported from XMMS by giacomo.
chainsaw
parents:
diff changeset
67 /* Enable or disable subtune-control in fileinfo window */
1b82a9932b60 [svn] Import sid plugin. Ported from XMMS by giacomo.
chainsaw
parents:
diff changeset
68 gtk_widget_set_sensitive(LUW("fileinfo_subctrl_prev"), isEnabled);
1b82a9932b60 [svn] Import sid plugin. Ported from XMMS by giacomo.
chainsaw
parents:
diff changeset
69 gtk_widget_set_sensitive(LUW("fileinfo_subctrl_adj"), isEnabled);
1b82a9932b60 [svn] Import sid plugin. Ported from XMMS by giacomo.
chainsaw
parents:
diff changeset
70 gtk_widget_set_sensitive(LUW("fileinfo_subctrl_next"), isEnabled);
1b82a9932b60 [svn] Import sid plugin. Ported from XMMS by giacomo.
chainsaw
parents:
diff changeset
71 }
1b82a9932b60 [svn] Import sid plugin. Ported from XMMS by giacomo.
chainsaw
parents:
diff changeset
72
304
d0e9693d2115 [svn] Convert to configdb. GThreadify and peel off layer of threading macro madness.
chainsaw
parents: 269
diff changeset
73 g_static_mutex_unlock(&xs_status_mutex);
d0e9693d2115 [svn] Convert to configdb. GThreadify and peel off layer of threading macro madness.
chainsaw
parents: 269
diff changeset
74 g_static_mutex_unlock(&xs_fileinfowin_mutex);
269
1b82a9932b60 [svn] Import sid plugin. Ported from XMMS by giacomo.
chainsaw
parents:
diff changeset
75 }
1b82a9932b60 [svn] Import sid plugin. Ported from XMMS by giacomo.
chainsaw
parents:
diff changeset
76
1b82a9932b60 [svn] Import sid plugin. Ported from XMMS by giacomo.
chainsaw
parents:
diff changeset
77
1b82a9932b60 [svn] Import sid plugin. Ported from XMMS by giacomo.
chainsaw
parents:
diff changeset
78 void xs_fileinfo_setsong(void)
1b82a9932b60 [svn] Import sid plugin. Ported from XMMS by giacomo.
chainsaw
parents:
diff changeset
79 {
1b82a9932b60 [svn] Import sid plugin. Ported from XMMS by giacomo.
chainsaw
parents:
diff changeset
80 gint n;
1b82a9932b60 [svn] Import sid plugin. Ported from XMMS by giacomo.
chainsaw
parents:
diff changeset
81
304
d0e9693d2115 [svn] Convert to configdb. GThreadify and peel off layer of threading macro madness.
chainsaw
parents: 269
diff changeset
82 g_static_mutex_lock(&xs_status_mutex);
d0e9693d2115 [svn] Convert to configdb. GThreadify and peel off layer of threading macro madness.
chainsaw
parents: 269
diff changeset
83 g_static_mutex_lock(&xs_fileinfowin_mutex);
269
1b82a9932b60 [svn] Import sid plugin. Ported from XMMS by giacomo.
chainsaw
parents:
diff changeset
84
1b82a9932b60 [svn] Import sid plugin. Ported from XMMS by giacomo.
chainsaw
parents:
diff changeset
85 if (xs_status.tuneInfo && xs_status.isPlaying) {
1b82a9932b60 [svn] Import sid plugin. Ported from XMMS by giacomo.
chainsaw
parents:
diff changeset
86 n = (gint) gtk_range_get_adjustment(GTK_RANGE(LUW("fileinfo_subctrl_adj")))->value;
1b82a9932b60 [svn] Import sid plugin. Ported from XMMS by giacomo.
chainsaw
parents:
diff changeset
87 if ((n >= 1) && (n <= xs_status.tuneInfo->nsubTunes))
1b82a9932b60 [svn] Import sid plugin. Ported from XMMS by giacomo.
chainsaw
parents:
diff changeset
88 xs_status.currSong = n;
1b82a9932b60 [svn] Import sid plugin. Ported from XMMS by giacomo.
chainsaw
parents:
diff changeset
89 }
1b82a9932b60 [svn] Import sid plugin. Ported from XMMS by giacomo.
chainsaw
parents:
diff changeset
90
304
d0e9693d2115 [svn] Convert to configdb. GThreadify and peel off layer of threading macro madness.
chainsaw
parents: 269
diff changeset
91 g_static_mutex_unlock(&xs_fileinfowin_mutex);
d0e9693d2115 [svn] Convert to configdb. GThreadify and peel off layer of threading macro madness.
chainsaw
parents: 269
diff changeset
92 g_static_mutex_unlock(&xs_status_mutex);
269
1b82a9932b60 [svn] Import sid plugin. Ported from XMMS by giacomo.
chainsaw
parents:
diff changeset
93 }
1b82a9932b60 [svn] Import sid plugin. Ported from XMMS by giacomo.
chainsaw
parents:
diff changeset
94
1b82a9932b60 [svn] Import sid plugin. Ported from XMMS by giacomo.
chainsaw
parents:
diff changeset
95
1b82a9932b60 [svn] Import sid plugin. Ported from XMMS by giacomo.
chainsaw
parents:
diff changeset
96 void xs_fileinfo_ok(void)
1b82a9932b60 [svn] Import sid plugin. Ported from XMMS by giacomo.
chainsaw
parents:
diff changeset
97 {
304
d0e9693d2115 [svn] Convert to configdb. GThreadify and peel off layer of threading macro madness.
chainsaw
parents: 269
diff changeset
98 g_static_mutex_lock(&xs_fileinfowin_mutex);
269
1b82a9932b60 [svn] Import sid plugin. Ported from XMMS by giacomo.
chainsaw
parents:
diff changeset
99 if (xs_fileinfowin) {
1b82a9932b60 [svn] Import sid plugin. Ported from XMMS by giacomo.
chainsaw
parents:
diff changeset
100 gtk_widget_destroy(xs_fileinfowin);
1b82a9932b60 [svn] Import sid plugin. Ported from XMMS by giacomo.
chainsaw
parents:
diff changeset
101 xs_fileinfowin = NULL;
1b82a9932b60 [svn] Import sid plugin. Ported from XMMS by giacomo.
chainsaw
parents:
diff changeset
102 }
304
d0e9693d2115 [svn] Convert to configdb. GThreadify and peel off layer of threading macro madness.
chainsaw
parents: 269
diff changeset
103 g_static_mutex_unlock(&xs_fileinfowin_mutex);
269
1b82a9932b60 [svn] Import sid plugin. Ported from XMMS by giacomo.
chainsaw
parents:
diff changeset
104 }
1b82a9932b60 [svn] Import sid plugin. Ported from XMMS by giacomo.
chainsaw
parents:
diff changeset
105
1b82a9932b60 [svn] Import sid plugin. Ported from XMMS by giacomo.
chainsaw
parents:
diff changeset
106
1b82a9932b60 [svn] Import sid plugin. Ported from XMMS by giacomo.
chainsaw
parents:
diff changeset
107 gboolean xs_fileinfo_delete(GtkWidget * widget, GdkEvent * event, gpointer user_data)
1b82a9932b60 [svn] Import sid plugin. Ported from XMMS by giacomo.
chainsaw
parents:
diff changeset
108 {
1b82a9932b60 [svn] Import sid plugin. Ported from XMMS by giacomo.
chainsaw
parents:
diff changeset
109 (void) widget;
1b82a9932b60 [svn] Import sid plugin. Ported from XMMS by giacomo.
chainsaw
parents:
diff changeset
110 (void) event;
1b82a9932b60 [svn] Import sid plugin. Ported from XMMS by giacomo.
chainsaw
parents:
diff changeset
111 (void) user_data;
1b82a9932b60 [svn] Import sid plugin. Ported from XMMS by giacomo.
chainsaw
parents:
diff changeset
112
1b82a9932b60 [svn] Import sid plugin. Ported from XMMS by giacomo.
chainsaw
parents:
diff changeset
113 XSDEBUG("delete_event\n");
1b82a9932b60 [svn] Import sid plugin. Ported from XMMS by giacomo.
chainsaw
parents:
diff changeset
114 xs_fileinfo_ok();
1b82a9932b60 [svn] Import sid plugin. Ported from XMMS by giacomo.
chainsaw
parents:
diff changeset
115 return FALSE;
1b82a9932b60 [svn] Import sid plugin. Ported from XMMS by giacomo.
chainsaw
parents:
diff changeset
116 }
1b82a9932b60 [svn] Import sid plugin. Ported from XMMS by giacomo.
chainsaw
parents:
diff changeset
117
1b82a9932b60 [svn] Import sid plugin. Ported from XMMS by giacomo.
chainsaw
parents:
diff changeset
118
1b82a9932b60 [svn] Import sid plugin. Ported from XMMS by giacomo.
chainsaw
parents:
diff changeset
119
1b82a9932b60 [svn] Import sid plugin. Ported from XMMS by giacomo.
chainsaw
parents:
diff changeset
120 void xs_fileinfo_subtune(GtkWidget * widget, void *data)
1b82a9932b60 [svn] Import sid plugin. Ported from XMMS by giacomo.
chainsaw
parents:
diff changeset
121 {
1b82a9932b60 [svn] Import sid plugin. Ported from XMMS by giacomo.
chainsaw
parents:
diff changeset
122 t_xs_stil_subnode *tmpNode;
1b82a9932b60 [svn] Import sid plugin. Ported from XMMS by giacomo.
chainsaw
parents:
diff changeset
123 GtkWidget *tmpItem, *tmpText;
1b82a9932b60 [svn] Import sid plugin. Ported from XMMS by giacomo.
chainsaw
parents:
diff changeset
124 gint tmpIndex;
1b82a9932b60 [svn] Import sid plugin. Ported from XMMS by giacomo.
chainsaw
parents:
diff changeset
125 gchar *subName, *subAuthor;
1b82a9932b60 [svn] Import sid plugin. Ported from XMMS by giacomo.
chainsaw
parents:
diff changeset
126
1b82a9932b60 [svn] Import sid plugin. Ported from XMMS by giacomo.
chainsaw
parents:
diff changeset
127 (void) widget;
1b82a9932b60 [svn] Import sid plugin. Ported from XMMS by giacomo.
chainsaw
parents:
diff changeset
128 (void) data;
1b82a9932b60 [svn] Import sid plugin. Ported from XMMS by giacomo.
chainsaw
parents:
diff changeset
129
1b82a9932b60 [svn] Import sid plugin. Ported from XMMS by giacomo.
chainsaw
parents:
diff changeset
130 /* Freeze text-widget and delete the old text */
1b82a9932b60 [svn] Import sid plugin. Ported from XMMS by giacomo.
chainsaw
parents:
diff changeset
131 tmpText = LUW("fileinfo_sub_info");
1b82a9932b60 [svn] Import sid plugin. Ported from XMMS by giacomo.
chainsaw
parents:
diff changeset
132
1b82a9932b60 [svn] Import sid plugin. Ported from XMMS by giacomo.
chainsaw
parents:
diff changeset
133 if (xs_fileinfostil) {
1b82a9932b60 [svn] Import sid plugin. Ported from XMMS by giacomo.
chainsaw
parents:
diff changeset
134 /* Get subtune number */
1b82a9932b60 [svn] Import sid plugin. Ported from XMMS by giacomo.
chainsaw
parents:
diff changeset
135 tmpItem = gtk_menu_get_active(GTK_MENU(data));
1b82a9932b60 [svn] Import sid plugin. Ported from XMMS by giacomo.
chainsaw
parents:
diff changeset
136 tmpIndex = g_list_index(GTK_MENU_SHELL(data)->children, tmpItem);
1b82a9932b60 [svn] Import sid plugin. Ported from XMMS by giacomo.
chainsaw
parents:
diff changeset
137
1b82a9932b60 [svn] Import sid plugin. Ported from XMMS by giacomo.
chainsaw
parents:
diff changeset
138 /* Get subtune information */
1b82a9932b60 [svn] Import sid plugin. Ported from XMMS by giacomo.
chainsaw
parents:
diff changeset
139 tmpNode = &xs_fileinfostil->subTunes[tmpIndex];
1b82a9932b60 [svn] Import sid plugin. Ported from XMMS by giacomo.
chainsaw
parents:
diff changeset
140 subName = tmpNode->pName;
1b82a9932b60 [svn] Import sid plugin. Ported from XMMS by giacomo.
chainsaw
parents:
diff changeset
141 subAuthor = tmpNode->pAuthor;
1b82a9932b60 [svn] Import sid plugin. Ported from XMMS by giacomo.
chainsaw
parents:
diff changeset
142
1b82a9932b60 [svn] Import sid plugin. Ported from XMMS by giacomo.
chainsaw
parents:
diff changeset
143 /* Put in the new text, if available */
1b82a9932b60 [svn] Import sid plugin. Ported from XMMS by giacomo.
chainsaw
parents:
diff changeset
144 if (tmpNode->pInfo) {
1b82a9932b60 [svn] Import sid plugin. Ported from XMMS by giacomo.
chainsaw
parents:
diff changeset
145 gsize pInfo_utf8_size;
1b82a9932b60 [svn] Import sid plugin. Ported from XMMS by giacomo.
chainsaw
parents:
diff changeset
146 gchar *pInfo_utf8 = g_locale_to_utf8( tmpNode->pInfo , strlen(tmpNode->pInfo) , NULL , &pInfo_utf8_size , NULL );
1b82a9932b60 [svn] Import sid plugin. Ported from XMMS by giacomo.
chainsaw
parents:
diff changeset
147 gtk_text_buffer_set_text( GTK_TEXT_BUFFER(gtk_text_view_get_buffer(GTK_TEXT_VIEW(tmpText))),
1b82a9932b60 [svn] Import sid plugin. Ported from XMMS by giacomo.
chainsaw
parents:
diff changeset
148 pInfo_utf8, pInfo_utf8_size);
1b82a9932b60 [svn] Import sid plugin. Ported from XMMS by giacomo.
chainsaw
parents:
diff changeset
149 }
1b82a9932b60 [svn] Import sid plugin. Ported from XMMS by giacomo.
chainsaw
parents:
diff changeset
150 } else {
1b82a9932b60 [svn] Import sid plugin. Ported from XMMS by giacomo.
chainsaw
parents:
diff changeset
151 /* We don't have any information */
1b82a9932b60 [svn] Import sid plugin. Ported from XMMS by giacomo.
chainsaw
parents:
diff changeset
152 subName = NULL;
1b82a9932b60 [svn] Import sid plugin. Ported from XMMS by giacomo.
chainsaw
parents:
diff changeset
153 subAuthor = NULL;
1b82a9932b60 [svn] Import sid plugin. Ported from XMMS by giacomo.
chainsaw
parents:
diff changeset
154 }
1b82a9932b60 [svn] Import sid plugin. Ported from XMMS by giacomo.
chainsaw
parents:
diff changeset
155
1b82a9932b60 [svn] Import sid plugin. Ported from XMMS by giacomo.
chainsaw
parents:
diff changeset
156 /* Get and set subtune information */
1b82a9932b60 [svn] Import sid plugin. Ported from XMMS by giacomo.
chainsaw
parents:
diff changeset
157 gtk_entry_set_text(GTK_ENTRY(LUW("fileinfo_sub_name")), subName ? g_locale_to_utf8(subName,strlen(subName),NULL,NULL,NULL) : "");
1b82a9932b60 [svn] Import sid plugin. Ported from XMMS by giacomo.
chainsaw
parents:
diff changeset
158 gtk_entry_set_text(GTK_ENTRY(LUW("fileinfo_sub_author")), subAuthor ? g_locale_to_utf8(subAuthor,strlen(subAuthor),NULL,NULL,NULL) : "");
1b82a9932b60 [svn] Import sid plugin. Ported from XMMS by giacomo.
chainsaw
parents:
diff changeset
159 }
1b82a9932b60 [svn] Import sid plugin. Ported from XMMS by giacomo.
chainsaw
parents:
diff changeset
160
1b82a9932b60 [svn] Import sid plugin. Ported from XMMS by giacomo.
chainsaw
parents:
diff changeset
161
1b82a9932b60 [svn] Import sid plugin. Ported from XMMS by giacomo.
chainsaw
parents:
diff changeset
162 void xs_fileinfo(gchar * pcFilename)
1b82a9932b60 [svn] Import sid plugin. Ported from XMMS by giacomo.
chainsaw
parents:
diff changeset
163 {
1b82a9932b60 [svn] Import sid plugin. Ported from XMMS by giacomo.
chainsaw
parents:
diff changeset
164 GtkWidget *tmpMenuItem, *tmpMenu, *tmpOptionMenu;
1b82a9932b60 [svn] Import sid plugin. Ported from XMMS by giacomo.
chainsaw
parents:
diff changeset
165 t_xs_tuneinfo *tmpInfo;
1b82a9932b60 [svn] Import sid plugin. Ported from XMMS by giacomo.
chainsaw
parents:
diff changeset
166 t_xs_stil_subnode *tmpNode;
1b82a9932b60 [svn] Import sid plugin. Ported from XMMS by giacomo.
chainsaw
parents:
diff changeset
167 gchar tmpStr[64];
1b82a9932b60 [svn] Import sid plugin. Ported from XMMS by giacomo.
chainsaw
parents:
diff changeset
168 gint n;
1b82a9932b60 [svn] Import sid plugin. Ported from XMMS by giacomo.
chainsaw
parents:
diff changeset
169
1b82a9932b60 [svn] Import sid plugin. Ported from XMMS by giacomo.
chainsaw
parents:
diff changeset
170 /* Current implementation leaves old fileinfo window untouched if
1b82a9932b60 [svn] Import sid plugin. Ported from XMMS by giacomo.
chainsaw
parents:
diff changeset
171 * no information can be found for the new file. Hmm...
1b82a9932b60 [svn] Import sid plugin. Ported from XMMS by giacomo.
chainsaw
parents:
diff changeset
172 */
1b82a9932b60 [svn] Import sid plugin. Ported from XMMS by giacomo.
chainsaw
parents:
diff changeset
173
1b82a9932b60 [svn] Import sid plugin. Ported from XMMS by giacomo.
chainsaw
parents:
diff changeset
174 /* Get new tune information */
304
d0e9693d2115 [svn] Convert to configdb. GThreadify and peel off layer of threading macro madness.
chainsaw
parents: 269
diff changeset
175 g_static_mutex_lock(&xs_fileinfowin_mutex);
d0e9693d2115 [svn] Convert to configdb. GThreadify and peel off layer of threading macro madness.
chainsaw
parents: 269
diff changeset
176 g_static_mutex_lock(&xs_status_mutex);
269
1b82a9932b60 [svn] Import sid plugin. Ported from XMMS by giacomo.
chainsaw
parents:
diff changeset
177 if ((tmpInfo = xs_status.sidPlayer->plrGetSIDInfo(pcFilename)) == NULL) {
304
d0e9693d2115 [svn] Convert to configdb. GThreadify and peel off layer of threading macro madness.
chainsaw
parents: 269
diff changeset
178 g_static_mutex_unlock(&xs_fileinfowin_mutex);
d0e9693d2115 [svn] Convert to configdb. GThreadify and peel off layer of threading macro madness.
chainsaw
parents: 269
diff changeset
179 g_static_mutex_unlock(&xs_status_mutex);
269
1b82a9932b60 [svn] Import sid plugin. Ported from XMMS by giacomo.
chainsaw
parents:
diff changeset
180 return;
1b82a9932b60 [svn] Import sid plugin. Ported from XMMS by giacomo.
chainsaw
parents:
diff changeset
181 }
304
d0e9693d2115 [svn] Convert to configdb. GThreadify and peel off layer of threading macro madness.
chainsaw
parents: 269
diff changeset
182 g_static_mutex_unlock(&xs_status_mutex);
269
1b82a9932b60 [svn] Import sid plugin. Ported from XMMS by giacomo.
chainsaw
parents:
diff changeset
183
1b82a9932b60 [svn] Import sid plugin. Ported from XMMS by giacomo.
chainsaw
parents:
diff changeset
184 xs_fileinfostil = xs_stil_get(pcFilename);
1b82a9932b60 [svn] Import sid plugin. Ported from XMMS by giacomo.
chainsaw
parents:
diff changeset
185
1b82a9932b60 [svn] Import sid plugin. Ported from XMMS by giacomo.
chainsaw
parents:
diff changeset
186 /* Check if there already is an open fileinfo window */
1b82a9932b60 [svn] Import sid plugin. Ported from XMMS by giacomo.
chainsaw
parents:
diff changeset
187 if (xs_fileinfowin) {
1b82a9932b60 [svn] Import sid plugin. Ported from XMMS by giacomo.
chainsaw
parents:
diff changeset
188 /* Raise old window */
1b82a9932b60 [svn] Import sid plugin. Ported from XMMS by giacomo.
chainsaw
parents:
diff changeset
189 gdk_window_raise(xs_fileinfowin->window);
1b82a9932b60 [svn] Import sid plugin. Ported from XMMS by giacomo.
chainsaw
parents:
diff changeset
190
1b82a9932b60 [svn] Import sid plugin. Ported from XMMS by giacomo.
chainsaw
parents:
diff changeset
191 /* Delete items */
1b82a9932b60 [svn] Import sid plugin. Ported from XMMS by giacomo.
chainsaw
parents:
diff changeset
192 tmpOptionMenu = LUW("fileinfo_sub_tune");
1b82a9932b60 [svn] Import sid plugin. Ported from XMMS by giacomo.
chainsaw
parents:
diff changeset
193 gtk_widget_destroy(GTK_OPTION_MENU(tmpOptionMenu)->menu);
1b82a9932b60 [svn] Import sid plugin. Ported from XMMS by giacomo.
chainsaw
parents:
diff changeset
194 GTK_OPTION_MENU(tmpOptionMenu)->menu = gtk_menu_new();
1b82a9932b60 [svn] Import sid plugin. Ported from XMMS by giacomo.
chainsaw
parents:
diff changeset
195 } else {
1b82a9932b60 [svn] Import sid plugin. Ported from XMMS by giacomo.
chainsaw
parents:
diff changeset
196 /* If not, create a new one */
1b82a9932b60 [svn] Import sid plugin. Ported from XMMS by giacomo.
chainsaw
parents:
diff changeset
197 xs_fileinfowin = create_xs_fileinfowin();
1b82a9932b60 [svn] Import sid plugin. Ported from XMMS by giacomo.
chainsaw
parents:
diff changeset
198
1b82a9932b60 [svn] Import sid plugin. Ported from XMMS by giacomo.
chainsaw
parents:
diff changeset
199 /* Connect additional signals */
1b82a9932b60 [svn] Import sid plugin. Ported from XMMS by giacomo.
chainsaw
parents:
diff changeset
200 gtk_signal_connect(GTK_OBJECT(gtk_range_get_adjustment(GTK_RANGE(LUW("fileinfo_subctrl_adj")))),
1b82a9932b60 [svn] Import sid plugin. Ported from XMMS by giacomo.
chainsaw
parents:
diff changeset
201 "value_changed", GTK_SIGNAL_FUNC(xs_fileinfo_setsong), NULL);
1b82a9932b60 [svn] Import sid plugin. Ported from XMMS by giacomo.
chainsaw
parents:
diff changeset
202 }
1b82a9932b60 [svn] Import sid plugin. Ported from XMMS by giacomo.
chainsaw
parents:
diff changeset
203
1b82a9932b60 [svn] Import sid plugin. Ported from XMMS by giacomo.
chainsaw
parents:
diff changeset
204
1b82a9932b60 [svn] Import sid plugin. Ported from XMMS by giacomo.
chainsaw
parents:
diff changeset
205 /* Set the generic song information */
1b82a9932b60 [svn] Import sid plugin. Ported from XMMS by giacomo.
chainsaw
parents:
diff changeset
206 gtk_entry_set_text(GTK_ENTRY(LUW("fileinfo_filename")), g_locale_to_utf8(pcFilename,strlen(pcFilename),NULL,NULL,NULL) );
1b82a9932b60 [svn] Import sid plugin. Ported from XMMS by giacomo.
chainsaw
parents:
diff changeset
207 gtk_entry_set_text(GTK_ENTRY(LUW("fileinfo_songname")), g_locale_to_utf8(tmpInfo->sidName,strlen(tmpInfo->sidName),NULL,NULL,NULL) );
1b82a9932b60 [svn] Import sid plugin. Ported from XMMS by giacomo.
chainsaw
parents:
diff changeset
208 gtk_entry_set_text(GTK_ENTRY(LUW("fileinfo_composer")), g_locale_to_utf8(tmpInfo->sidComposer,strlen(tmpInfo->sidComposer),NULL,NULL,NULL) );
1b82a9932b60 [svn] Import sid plugin. Ported from XMMS by giacomo.
chainsaw
parents:
diff changeset
209 gtk_entry_set_text(GTK_ENTRY(LUW("fileinfo_copyright")), g_locale_to_utf8(tmpInfo->sidCopyright,strlen(tmpInfo->sidCopyright),NULL,NULL,NULL) );
1b82a9932b60 [svn] Import sid plugin. Ported from XMMS by giacomo.
chainsaw
parents:
diff changeset
210
1b82a9932b60 [svn] Import sid plugin. Ported from XMMS by giacomo.
chainsaw
parents:
diff changeset
211 /* Main tune - the pseudo tune */
1b82a9932b60 [svn] Import sid plugin. Ported from XMMS by giacomo.
chainsaw
parents:
diff changeset
212 tmpOptionMenu = LUW("fileinfo_sub_tune");
1b82a9932b60 [svn] Import sid plugin. Ported from XMMS by giacomo.
chainsaw
parents:
diff changeset
213 tmpMenu = GTK_OPTION_MENU(tmpOptionMenu)->menu;
1b82a9932b60 [svn] Import sid plugin. Ported from XMMS by giacomo.
chainsaw
parents:
diff changeset
214
1b82a9932b60 [svn] Import sid plugin. Ported from XMMS by giacomo.
chainsaw
parents:
diff changeset
215 tmpMenuItem = gtk_menu_item_new_with_label("General info");
1b82a9932b60 [svn] Import sid plugin. Ported from XMMS by giacomo.
chainsaw
parents:
diff changeset
216 gtk_widget_show(tmpMenuItem);
1b82a9932b60 [svn] Import sid plugin. Ported from XMMS by giacomo.
chainsaw
parents:
diff changeset
217 gtk_menu_append(GTK_MENU(tmpMenu), tmpMenuItem);
1b82a9932b60 [svn] Import sid plugin. Ported from XMMS by giacomo.
chainsaw
parents:
diff changeset
218 gtk_signal_connect(GTK_OBJECT(tmpMenuItem), "activate", GTK_SIGNAL_FUNC(xs_fileinfo_subtune), tmpMenu);
1b82a9932b60 [svn] Import sid plugin. Ported from XMMS by giacomo.
chainsaw
parents:
diff changeset
219
1b82a9932b60 [svn] Import sid plugin. Ported from XMMS by giacomo.
chainsaw
parents:
diff changeset
220 /* Other menu items */
1b82a9932b60 [svn] Import sid plugin. Ported from XMMS by giacomo.
chainsaw
parents:
diff changeset
221 for (n = 1; n <= tmpInfo->nsubTunes; n++) {
1b82a9932b60 [svn] Import sid plugin. Ported from XMMS by giacomo.
chainsaw
parents:
diff changeset
222 if (xs_fileinfostil) {
1b82a9932b60 [svn] Import sid plugin. Ported from XMMS by giacomo.
chainsaw
parents:
diff changeset
223 snprintf(tmpStr, sizeof(tmpStr), "Tune #%i: ", n);
1b82a9932b60 [svn] Import sid plugin. Ported from XMMS by giacomo.
chainsaw
parents:
diff changeset
224 tmpNode = &xs_fileinfostil->subTunes[n];
1b82a9932b60 [svn] Import sid plugin. Ported from XMMS by giacomo.
chainsaw
parents:
diff changeset
225 if (tmpNode->pName)
1b82a9932b60 [svn] Import sid plugin. Ported from XMMS by giacomo.
chainsaw
parents:
diff changeset
226 xs_pnstrcat(tmpStr, sizeof(tmpStr), tmpNode->pName);
1b82a9932b60 [svn] Import sid plugin. Ported from XMMS by giacomo.
chainsaw
parents:
diff changeset
227 else if (tmpNode->pInfo)
1b82a9932b60 [svn] Import sid plugin. Ported from XMMS by giacomo.
chainsaw
parents:
diff changeset
228 xs_pnstrcat(tmpStr, sizeof(tmpStr), tmpNode->pInfo);
1b82a9932b60 [svn] Import sid plugin. Ported from XMMS by giacomo.
chainsaw
parents:
diff changeset
229 else
1b82a9932b60 [svn] Import sid plugin. Ported from XMMS by giacomo.
chainsaw
parents:
diff changeset
230 xs_pnstrcat(tmpStr, sizeof(tmpStr), "---");
1b82a9932b60 [svn] Import sid plugin. Ported from XMMS by giacomo.
chainsaw
parents:
diff changeset
231 } else {
1b82a9932b60 [svn] Import sid plugin. Ported from XMMS by giacomo.
chainsaw
parents:
diff changeset
232 snprintf(tmpStr, sizeof(tmpStr), "Tune #%i", n);
1b82a9932b60 [svn] Import sid plugin. Ported from XMMS by giacomo.
chainsaw
parents:
diff changeset
233 }
1b82a9932b60 [svn] Import sid plugin. Ported from XMMS by giacomo.
chainsaw
parents:
diff changeset
234
1b82a9932b60 [svn] Import sid plugin. Ported from XMMS by giacomo.
chainsaw
parents:
diff changeset
235 tmpMenuItem = gtk_menu_item_new_with_label(tmpStr);
1b82a9932b60 [svn] Import sid plugin. Ported from XMMS by giacomo.
chainsaw
parents:
diff changeset
236 gtk_widget_show(tmpMenuItem);
1b82a9932b60 [svn] Import sid plugin. Ported from XMMS by giacomo.
chainsaw
parents:
diff changeset
237 gtk_menu_append(GTK_MENU(tmpMenu), tmpMenuItem);
1b82a9932b60 [svn] Import sid plugin. Ported from XMMS by giacomo.
chainsaw
parents:
diff changeset
238
1b82a9932b60 [svn] Import sid plugin. Ported from XMMS by giacomo.
chainsaw
parents:
diff changeset
239 gtk_signal_connect(GTK_OBJECT(tmpMenuItem), "activate", GTK_SIGNAL_FUNC(xs_fileinfo_subtune), tmpMenu);
1b82a9932b60 [svn] Import sid plugin. Ported from XMMS by giacomo.
chainsaw
parents:
diff changeset
240 }
1b82a9932b60 [svn] Import sid plugin. Ported from XMMS by giacomo.
chainsaw
parents:
diff changeset
241
1b82a9932b60 [svn] Import sid plugin. Ported from XMMS by giacomo.
chainsaw
parents:
diff changeset
242 /* Set the subtune information */
1b82a9932b60 [svn] Import sid plugin. Ported from XMMS by giacomo.
chainsaw
parents:
diff changeset
243 xs_fileinfo_subtune(NULL, tmpMenu);
1b82a9932b60 [svn] Import sid plugin. Ported from XMMS by giacomo.
chainsaw
parents:
diff changeset
244
1b82a9932b60 [svn] Import sid plugin. Ported from XMMS by giacomo.
chainsaw
parents:
diff changeset
245 /* Free temporary tuneinfo */
1b82a9932b60 [svn] Import sid plugin. Ported from XMMS by giacomo.
chainsaw
parents:
diff changeset
246 xs_tuneinfo_free(tmpInfo);
1b82a9932b60 [svn] Import sid plugin. Ported from XMMS by giacomo.
chainsaw
parents:
diff changeset
247
1b82a9932b60 [svn] Import sid plugin. Ported from XMMS by giacomo.
chainsaw
parents:
diff changeset
248 /* Show the window */
1b82a9932b60 [svn] Import sid plugin. Ported from XMMS by giacomo.
chainsaw
parents:
diff changeset
249 gtk_widget_show(xs_fileinfowin);
1b82a9932b60 [svn] Import sid plugin. Ported from XMMS by giacomo.
chainsaw
parents:
diff changeset
250
304
d0e9693d2115 [svn] Convert to configdb. GThreadify and peel off layer of threading macro madness.
chainsaw
parents: 269
diff changeset
251 g_static_mutex_unlock(&xs_fileinfowin_mutex);
269
1b82a9932b60 [svn] Import sid plugin. Ported from XMMS by giacomo.
chainsaw
parents:
diff changeset
252
1b82a9932b60 [svn] Import sid plugin. Ported from XMMS by giacomo.
chainsaw
parents:
diff changeset
253 xs_fileinfo_update();
1b82a9932b60 [svn] Import sid plugin. Ported from XMMS by giacomo.
chainsaw
parents:
diff changeset
254 }