Mercurial > hg > xmms-sid
annotate src/xs_fileinfo.c @ 626:248aa59cb6a3
XS_SIGNAL_CONNECT() macro added and used.
author | Matti Hamalainen <ccr@tnsp.org> |
---|---|
date | Mon, 03 Sep 2007 02:41:04 +0000 |
parents | 547f4d35f56a |
children | ea06356d792b |
rev | line source |
---|---|
222 | 1 /* |
2 XMMS-SID - SIDPlay input plugin for X MultiMedia System (XMMS) | |
3 | |
4 File information window | |
5 | |
324 | 6 Programmed and designed by Matti 'ccr' Hamalainen <ccr@tnsp.org> |
422 | 7 (C) Copyright 1999-2007 Tecnic Software productions (TNSP) |
222 | 8 |
9 This program is free software; you can redistribute it and/or modify | |
10 it under the terms of the GNU General Public License as published by | |
11 the Free Software Foundation; either version 2 of the License, or | |
12 (at your option) any later version. | |
13 | |
14 This program is distributed in the hope that it will be useful, | |
15 but WITHOUT ANY WARRANTY; without even the implied warranty of | |
16 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the | |
17 GNU General Public License for more details. | |
18 | |
412
7f694e5a1493
Updated GNU GPL (new FSF address) and some cleanups.
Matti Hamalainen <ccr@tnsp.org>
parents:
399
diff
changeset
|
19 You should have received a copy of the GNU General Public License along |
7f694e5a1493
Updated GNU GPL (new FSF address) and some cleanups.
Matti Hamalainen <ccr@tnsp.org>
parents:
399
diff
changeset
|
20 with this program; if not, write to the Free Software Foundation, Inc., |
7f694e5a1493
Updated GNU GPL (new FSF address) and some cleanups.
Matti Hamalainen <ccr@tnsp.org>
parents:
399
diff
changeset
|
21 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA. |
222 | 22 */ |
23 #include <gdk/gdkkeysyms.h> | |
24 #include <gtk/gtk.h> | |
25 | |
290
b6bcd62394f3
Include correct headers, typecast returnvalue to gint
Matti Hamalainen <ccr@tnsp.org>
parents:
282
diff
changeset
|
26 #include "xs_fileinfo.h" |
526
fa95d942f226
Header cleanup; Moved some types from xmms-sid.h to xs_player.h; Renamed few functions.
Matti Hamalainen <ccr@tnsp.org>
parents:
492
diff
changeset
|
27 #include "xs_player.h" |
232
e613873c3379
Thread locking now final. All parts, including GTK GUI, should be(?)
Matti Hamalainen <ccr@tnsp.org>
parents:
230
diff
changeset
|
28 #include "xs_support.h" |
222 | 29 #include "xs_config.h" |
30 #include "xs_interface.h" | |
31 #include "xs_glade.h" | |
622
d7389ea52113
Move SLDB and STIL utility functions to xs_slsup.[ch] and amend some changes between XMMS-SID and Aud-SID via a macro mess.
Matti Hamalainen <ccr@tnsp.org>
parents:
615
diff
changeset
|
32 #include "xs_slsup.h" |
462 | 33 |
34 | |
359
b1a858b8cb1a
Re-indentation all (non-generated) code.
Matti Hamalainen <ccr@tnsp.org>
parents:
341
diff
changeset
|
35 static GtkWidget *xs_fileinfowin = NULL; |
b1a858b8cb1a
Re-indentation all (non-generated) code.
Matti Hamalainen <ccr@tnsp.org>
parents:
341
diff
changeset
|
36 static t_xs_stil_node *xs_fileinfostil = NULL; |
232
e613873c3379
Thread locking now final. All parts, including GTK GUI, should be(?)
Matti Hamalainen <ccr@tnsp.org>
parents:
230
diff
changeset
|
37 XS_MUTEX(xs_fileinfowin); |
222 | 38 |
296
4279cc6a3412
No need for variadic macros here.
Matti Hamalainen <ccr@tnsp.org>
parents:
290
diff
changeset
|
39 #define LUW(x) lookup_widget(xs_fileinfowin, x) |
222 | 40 |
41 | |
622
d7389ea52113
Move SLDB and STIL utility functions to xs_slsup.[ch] and amend some changes between XMMS-SID and Aud-SID via a macro mess.
Matti Hamalainen <ccr@tnsp.org>
parents:
615
diff
changeset
|
42 #ifndef AUDACIOUS_PLUGIN |
232
e613873c3379
Thread locking now final. All parts, including GTK GUI, should be(?)
Matti Hamalainen <ccr@tnsp.org>
parents:
230
diff
changeset
|
43 void xs_fileinfo_update(void) |
e613873c3379
Thread locking now final. All parts, including GTK GUI, should be(?)
Matti Hamalainen <ccr@tnsp.org>
parents:
230
diff
changeset
|
44 { |
359
b1a858b8cb1a
Re-indentation all (non-generated) code.
Matti Hamalainen <ccr@tnsp.org>
parents:
341
diff
changeset
|
45 XS_MUTEX_LOCK(xs_status); |
b1a858b8cb1a
Re-indentation all (non-generated) code.
Matti Hamalainen <ccr@tnsp.org>
parents:
341
diff
changeset
|
46 XS_MUTEX_LOCK(xs_fileinfowin); |
b1a858b8cb1a
Re-indentation all (non-generated) code.
Matti Hamalainen <ccr@tnsp.org>
parents:
341
diff
changeset
|
47 |
b1a858b8cb1a
Re-indentation all (non-generated) code.
Matti Hamalainen <ccr@tnsp.org>
parents:
341
diff
changeset
|
48 /* Check if control window exists, we are currently playing and have a tune */ |
b1a858b8cb1a
Re-indentation all (non-generated) code.
Matti Hamalainen <ccr@tnsp.org>
parents:
341
diff
changeset
|
49 if (xs_fileinfowin) { |
492
1775b3f16cd9
Move variables to better block.
Matti Hamalainen <ccr@tnsp.org>
parents:
473
diff
changeset
|
50 gboolean isEnabled; |
1775b3f16cd9
Move variables to better block.
Matti Hamalainen <ccr@tnsp.org>
parents:
473
diff
changeset
|
51 GtkAdjustment *tmpAdj; |
1775b3f16cd9
Move variables to better block.
Matti Hamalainen <ccr@tnsp.org>
parents:
473
diff
changeset
|
52 |
359
b1a858b8cb1a
Re-indentation all (non-generated) code.
Matti Hamalainen <ccr@tnsp.org>
parents:
341
diff
changeset
|
53 if (xs_status.tuneInfo && xs_status.isPlaying && (xs_status.tuneInfo->nsubTunes > 1)) { |
b1a858b8cb1a
Re-indentation all (non-generated) code.
Matti Hamalainen <ccr@tnsp.org>
parents:
341
diff
changeset
|
54 tmpAdj = gtk_range_get_adjustment(GTK_RANGE(LUW("fileinfo_subctrl_adj"))); |
232
e613873c3379
Thread locking now final. All parts, including GTK GUI, should be(?)
Matti Hamalainen <ccr@tnsp.org>
parents:
230
diff
changeset
|
55 |
359
b1a858b8cb1a
Re-indentation all (non-generated) code.
Matti Hamalainen <ccr@tnsp.org>
parents:
341
diff
changeset
|
56 tmpAdj->value = xs_status.currSong; |
b1a858b8cb1a
Re-indentation all (non-generated) code.
Matti Hamalainen <ccr@tnsp.org>
parents:
341
diff
changeset
|
57 tmpAdj->lower = 1; |
b1a858b8cb1a
Re-indentation all (non-generated) code.
Matti Hamalainen <ccr@tnsp.org>
parents:
341
diff
changeset
|
58 tmpAdj->upper = xs_status.tuneInfo->nsubTunes; |
b1a858b8cb1a
Re-indentation all (non-generated) code.
Matti Hamalainen <ccr@tnsp.org>
parents:
341
diff
changeset
|
59 XS_MUTEX_UNLOCK(xs_status); |
b1a858b8cb1a
Re-indentation all (non-generated) code.
Matti Hamalainen <ccr@tnsp.org>
parents:
341
diff
changeset
|
60 XS_MUTEX_UNLOCK(xs_fileinfowin); |
b1a858b8cb1a
Re-indentation all (non-generated) code.
Matti Hamalainen <ccr@tnsp.org>
parents:
341
diff
changeset
|
61 gtk_adjustment_value_changed(tmpAdj); |
b1a858b8cb1a
Re-indentation all (non-generated) code.
Matti Hamalainen <ccr@tnsp.org>
parents:
341
diff
changeset
|
62 XS_MUTEX_LOCK(xs_status); |
b1a858b8cb1a
Re-indentation all (non-generated) code.
Matti Hamalainen <ccr@tnsp.org>
parents:
341
diff
changeset
|
63 XS_MUTEX_LOCK(xs_fileinfowin); |
b1a858b8cb1a
Re-indentation all (non-generated) code.
Matti Hamalainen <ccr@tnsp.org>
parents:
341
diff
changeset
|
64 isEnabled = TRUE; |
b1a858b8cb1a
Re-indentation all (non-generated) code.
Matti Hamalainen <ccr@tnsp.org>
parents:
341
diff
changeset
|
65 } else |
b1a858b8cb1a
Re-indentation all (non-generated) code.
Matti Hamalainen <ccr@tnsp.org>
parents:
341
diff
changeset
|
66 isEnabled = FALSE; |
232
e613873c3379
Thread locking now final. All parts, including GTK GUI, should be(?)
Matti Hamalainen <ccr@tnsp.org>
parents:
230
diff
changeset
|
67 |
359
b1a858b8cb1a
Re-indentation all (non-generated) code.
Matti Hamalainen <ccr@tnsp.org>
parents:
341
diff
changeset
|
68 /* Enable or disable subtune-control in fileinfo window */ |
b1a858b8cb1a
Re-indentation all (non-generated) code.
Matti Hamalainen <ccr@tnsp.org>
parents:
341
diff
changeset
|
69 gtk_widget_set_sensitive(LUW("fileinfo_subctrl_prev"), isEnabled); |
b1a858b8cb1a
Re-indentation all (non-generated) code.
Matti Hamalainen <ccr@tnsp.org>
parents:
341
diff
changeset
|
70 gtk_widget_set_sensitive(LUW("fileinfo_subctrl_adj"), isEnabled); |
b1a858b8cb1a
Re-indentation all (non-generated) code.
Matti Hamalainen <ccr@tnsp.org>
parents:
341
diff
changeset
|
71 gtk_widget_set_sensitive(LUW("fileinfo_subctrl_next"), isEnabled); |
b1a858b8cb1a
Re-indentation all (non-generated) code.
Matti Hamalainen <ccr@tnsp.org>
parents:
341
diff
changeset
|
72 } |
b1a858b8cb1a
Re-indentation all (non-generated) code.
Matti Hamalainen <ccr@tnsp.org>
parents:
341
diff
changeset
|
73 |
b1a858b8cb1a
Re-indentation all (non-generated) code.
Matti Hamalainen <ccr@tnsp.org>
parents:
341
diff
changeset
|
74 XS_MUTEX_UNLOCK(xs_status); |
b1a858b8cb1a
Re-indentation all (non-generated) code.
Matti Hamalainen <ccr@tnsp.org>
parents:
341
diff
changeset
|
75 XS_MUTEX_UNLOCK(xs_fileinfowin); |
232
e613873c3379
Thread locking now final. All parts, including GTK GUI, should be(?)
Matti Hamalainen <ccr@tnsp.org>
parents:
230
diff
changeset
|
76 } |
e613873c3379
Thread locking now final. All parts, including GTK GUI, should be(?)
Matti Hamalainen <ccr@tnsp.org>
parents:
230
diff
changeset
|
77 |
e613873c3379
Thread locking now final. All parts, including GTK GUI, should be(?)
Matti Hamalainen <ccr@tnsp.org>
parents:
230
diff
changeset
|
78 |
424
faf12767a6f1
Preparing for internationalization.
Matti Hamalainen <ccr@tnsp.org>
parents:
422
diff
changeset
|
79 static void xs_fileinfo_setsong(void) |
230 | 80 { |
359
b1a858b8cb1a
Re-indentation all (non-generated) code.
Matti Hamalainen <ccr@tnsp.org>
parents:
341
diff
changeset
|
81 gint n; |
b1a858b8cb1a
Re-indentation all (non-generated) code.
Matti Hamalainen <ccr@tnsp.org>
parents:
341
diff
changeset
|
82 |
b1a858b8cb1a
Re-indentation all (non-generated) code.
Matti Hamalainen <ccr@tnsp.org>
parents:
341
diff
changeset
|
83 XS_MUTEX_LOCK(xs_status); |
b1a858b8cb1a
Re-indentation all (non-generated) code.
Matti Hamalainen <ccr@tnsp.org>
parents:
341
diff
changeset
|
84 XS_MUTEX_LOCK(xs_fileinfowin); |
b1a858b8cb1a
Re-indentation all (non-generated) code.
Matti Hamalainen <ccr@tnsp.org>
parents:
341
diff
changeset
|
85 |
b1a858b8cb1a
Re-indentation all (non-generated) code.
Matti Hamalainen <ccr@tnsp.org>
parents:
341
diff
changeset
|
86 if (xs_status.tuneInfo && xs_status.isPlaying) { |
b1a858b8cb1a
Re-indentation all (non-generated) code.
Matti Hamalainen <ccr@tnsp.org>
parents:
341
diff
changeset
|
87 n = (gint) gtk_range_get_adjustment(GTK_RANGE(LUW("fileinfo_subctrl_adj")))->value; |
b1a858b8cb1a
Re-indentation all (non-generated) code.
Matti Hamalainen <ccr@tnsp.org>
parents:
341
diff
changeset
|
88 if ((n >= 1) && (n <= xs_status.tuneInfo->nsubTunes)) |
b1a858b8cb1a
Re-indentation all (non-generated) code.
Matti Hamalainen <ccr@tnsp.org>
parents:
341
diff
changeset
|
89 xs_status.currSong = n; |
234
6f9764fbd693
Make the slider in fileinfo window's subtune selector work as expected.
Matti Hamalainen <ccr@tnsp.org>
parents:
232
diff
changeset
|
90 } |
6f9764fbd693
Make the slider in fileinfo window's subtune selector work as expected.
Matti Hamalainen <ccr@tnsp.org>
parents:
232
diff
changeset
|
91 |
359
b1a858b8cb1a
Re-indentation all (non-generated) code.
Matti Hamalainen <ccr@tnsp.org>
parents:
341
diff
changeset
|
92 XS_MUTEX_UNLOCK(xs_fileinfowin); |
b1a858b8cb1a
Re-indentation all (non-generated) code.
Matti Hamalainen <ccr@tnsp.org>
parents:
341
diff
changeset
|
93 XS_MUTEX_UNLOCK(xs_status); |
230 | 94 } |
622
d7389ea52113
Move SLDB and STIL utility functions to xs_slsup.[ch] and amend some changes between XMMS-SID and Aud-SID via a macro mess.
Matti Hamalainen <ccr@tnsp.org>
parents:
615
diff
changeset
|
95 #endif /* AUDACIOUS_PLUGIN */ |
230 | 96 |
97 | |
222 | 98 void xs_fileinfo_ok(void) |
99 { | |
359
b1a858b8cb1a
Re-indentation all (non-generated) code.
Matti Hamalainen <ccr@tnsp.org>
parents:
341
diff
changeset
|
100 XS_MUTEX_LOCK(xs_fileinfowin); |
b1a858b8cb1a
Re-indentation all (non-generated) code.
Matti Hamalainen <ccr@tnsp.org>
parents:
341
diff
changeset
|
101 if (xs_fileinfowin) { |
b1a858b8cb1a
Re-indentation all (non-generated) code.
Matti Hamalainen <ccr@tnsp.org>
parents:
341
diff
changeset
|
102 gtk_widget_destroy(xs_fileinfowin); |
b1a858b8cb1a
Re-indentation all (non-generated) code.
Matti Hamalainen <ccr@tnsp.org>
parents:
341
diff
changeset
|
103 xs_fileinfowin = NULL; |
b1a858b8cb1a
Re-indentation all (non-generated) code.
Matti Hamalainen <ccr@tnsp.org>
parents:
341
diff
changeset
|
104 } |
b1a858b8cb1a
Re-indentation all (non-generated) code.
Matti Hamalainen <ccr@tnsp.org>
parents:
341
diff
changeset
|
105 XS_MUTEX_UNLOCK(xs_fileinfowin); |
222 | 106 } |
107 | |
108 | |
359
b1a858b8cb1a
Re-indentation all (non-generated) code.
Matti Hamalainen <ccr@tnsp.org>
parents:
341
diff
changeset
|
109 gboolean xs_fileinfo_delete(GtkWidget * widget, GdkEvent * event, gpointer user_data) |
282
0d2d379a83c0
Fixed nasty crash when closing fileinfo-window from window's closebutton -
Matti Hamalainen <ccr@tnsp.org>
parents:
239
diff
changeset
|
110 { |
359
b1a858b8cb1a
Re-indentation all (non-generated) code.
Matti Hamalainen <ccr@tnsp.org>
parents:
341
diff
changeset
|
111 (void) widget; |
b1a858b8cb1a
Re-indentation all (non-generated) code.
Matti Hamalainen <ccr@tnsp.org>
parents:
341
diff
changeset
|
112 (void) event; |
b1a858b8cb1a
Re-indentation all (non-generated) code.
Matti Hamalainen <ccr@tnsp.org>
parents:
341
diff
changeset
|
113 (void) user_data; |
b1a858b8cb1a
Re-indentation all (non-generated) code.
Matti Hamalainen <ccr@tnsp.org>
parents:
341
diff
changeset
|
114 |
b1a858b8cb1a
Re-indentation all (non-generated) code.
Matti Hamalainen <ccr@tnsp.org>
parents:
341
diff
changeset
|
115 XSDEBUG("delete_event\n"); |
b1a858b8cb1a
Re-indentation all (non-generated) code.
Matti Hamalainen <ccr@tnsp.org>
parents:
341
diff
changeset
|
116 xs_fileinfo_ok(); |
b1a858b8cb1a
Re-indentation all (non-generated) code.
Matti Hamalainen <ccr@tnsp.org>
parents:
341
diff
changeset
|
117 return FALSE; |
282
0d2d379a83c0
Fixed nasty crash when closing fileinfo-window from window's closebutton -
Matti Hamalainen <ccr@tnsp.org>
parents:
239
diff
changeset
|
118 } |
0d2d379a83c0
Fixed nasty crash when closing fileinfo-window from window's closebutton -
Matti Hamalainen <ccr@tnsp.org>
parents:
239
diff
changeset
|
119 |
0d2d379a83c0
Fixed nasty crash when closing fileinfo-window from window's closebutton -
Matti Hamalainen <ccr@tnsp.org>
parents:
239
diff
changeset
|
120 |
424
faf12767a6f1
Preparing for internationalization.
Matti Hamalainen <ccr@tnsp.org>
parents:
422
diff
changeset
|
121 static void xs_fileinfo_subtune(GtkWidget * widget, void *data) |
222 | 122 { |
359
b1a858b8cb1a
Re-indentation all (non-generated) code.
Matti Hamalainen <ccr@tnsp.org>
parents:
341
diff
changeset
|
123 t_xs_stil_subnode *tmpNode; |
615
8fe2e757fa4a
Fixed sub-tune info selection box in fileinfo window.
Matti Hamalainen <ccr@tnsp.org>
parents:
614
diff
changeset
|
124 GtkWidget *tmpText; |
359
b1a858b8cb1a
Re-indentation all (non-generated) code.
Matti Hamalainen <ccr@tnsp.org>
parents:
341
diff
changeset
|
125 gint tmpIndex; |
615
8fe2e757fa4a
Fixed sub-tune info selection box in fileinfo window.
Matti Hamalainen <ccr@tnsp.org>
parents:
614
diff
changeset
|
126 gchar *subName, *subAuthor, *subInfo; |
222 | 127 |
359
b1a858b8cb1a
Re-indentation all (non-generated) code.
Matti Hamalainen <ccr@tnsp.org>
parents:
341
diff
changeset
|
128 (void) widget; |
b1a858b8cb1a
Re-indentation all (non-generated) code.
Matti Hamalainen <ccr@tnsp.org>
parents:
341
diff
changeset
|
129 (void) data; |
222 | 130 |
359
b1a858b8cb1a
Re-indentation all (non-generated) code.
Matti Hamalainen <ccr@tnsp.org>
parents:
341
diff
changeset
|
131 /* Freeze text-widget and delete the old text */ |
b1a858b8cb1a
Re-indentation all (non-generated) code.
Matti Hamalainen <ccr@tnsp.org>
parents:
341
diff
changeset
|
132 tmpText = LUW("fileinfo_sub_info"); |
625
547f4d35f56a
Unify xs_fileinfo with Aud-SID.
Matti Hamalainen <ccr@tnsp.org>
parents:
622
diff
changeset
|
133 #ifndef AUDACIOUS_PLUGIN |
359
b1a858b8cb1a
Re-indentation all (non-generated) code.
Matti Hamalainen <ccr@tnsp.org>
parents:
341
diff
changeset
|
134 gtk_text_freeze(GTK_TEXT(tmpText)); |
b1a858b8cb1a
Re-indentation all (non-generated) code.
Matti Hamalainen <ccr@tnsp.org>
parents:
341
diff
changeset
|
135 gtk_text_set_point(GTK_TEXT(tmpText), 0); |
b1a858b8cb1a
Re-indentation all (non-generated) code.
Matti Hamalainen <ccr@tnsp.org>
parents:
341
diff
changeset
|
136 gtk_text_forward_delete(GTK_TEXT(tmpText), gtk_text_get_length(GTK_TEXT(tmpText))); |
625
547f4d35f56a
Unify xs_fileinfo with Aud-SID.
Matti Hamalainen <ccr@tnsp.org>
parents:
622
diff
changeset
|
137 #endif |
222 | 138 |
392
b09d74eb71e6
Working on getting STIL and SLDB using completely dynamically allocated
Matti Hamalainen <ccr@tnsp.org>
parents:
359
diff
changeset
|
139 /* Get subtune information */ |
615
8fe2e757fa4a
Fixed sub-tune info selection box in fileinfo window.
Matti Hamalainen <ccr@tnsp.org>
parents:
614
diff
changeset
|
140 tmpIndex = g_list_index(GTK_MENU_SHELL(data)->children, gtk_menu_get_active(GTK_MENU(data))); |
8fe2e757fa4a
Fixed sub-tune info selection box in fileinfo window.
Matti Hamalainen <ccr@tnsp.org>
parents:
614
diff
changeset
|
141 |
430 | 142 if (xs_fileinfostil && tmpIndex <= xs_fileinfostil->nsubTunes) |
392
b09d74eb71e6
Working on getting STIL and SLDB using completely dynamically allocated
Matti Hamalainen <ccr@tnsp.org>
parents:
359
diff
changeset
|
143 tmpNode = xs_fileinfostil->subTunes[tmpIndex]; |
b09d74eb71e6
Working on getting STIL and SLDB using completely dynamically allocated
Matti Hamalainen <ccr@tnsp.org>
parents:
359
diff
changeset
|
144 else |
b09d74eb71e6
Working on getting STIL and SLDB using completely dynamically allocated
Matti Hamalainen <ccr@tnsp.org>
parents:
359
diff
changeset
|
145 tmpNode = NULL; |
615
8fe2e757fa4a
Fixed sub-tune info selection box in fileinfo window.
Matti Hamalainen <ccr@tnsp.org>
parents:
614
diff
changeset
|
146 |
392
b09d74eb71e6
Working on getting STIL and SLDB using completely dynamically allocated
Matti Hamalainen <ccr@tnsp.org>
parents:
359
diff
changeset
|
147 if (tmpNode) { |
359
b1a858b8cb1a
Re-indentation all (non-generated) code.
Matti Hamalainen <ccr@tnsp.org>
parents:
341
diff
changeset
|
148 subName = tmpNode->pName; |
b1a858b8cb1a
Re-indentation all (non-generated) code.
Matti Hamalainen <ccr@tnsp.org>
parents:
341
diff
changeset
|
149 subAuthor = tmpNode->pAuthor; |
615
8fe2e757fa4a
Fixed sub-tune info selection box in fileinfo window.
Matti Hamalainen <ccr@tnsp.org>
parents:
614
diff
changeset
|
150 subInfo = tmpNode->pInfo; |
222 | 151 } else { |
359
b1a858b8cb1a
Re-indentation all (non-generated) code.
Matti Hamalainen <ccr@tnsp.org>
parents:
341
diff
changeset
|
152 subName = NULL; |
b1a858b8cb1a
Re-indentation all (non-generated) code.
Matti Hamalainen <ccr@tnsp.org>
parents:
341
diff
changeset
|
153 subAuthor = NULL; |
615
8fe2e757fa4a
Fixed sub-tune info selection box in fileinfo window.
Matti Hamalainen <ccr@tnsp.org>
parents:
614
diff
changeset
|
154 subInfo = NULL; |
222 | 155 } |
156 | |
359
b1a858b8cb1a
Re-indentation all (non-generated) code.
Matti Hamalainen <ccr@tnsp.org>
parents:
341
diff
changeset
|
157 /* Get and set subtune information */ |
b1a858b8cb1a
Re-indentation all (non-generated) code.
Matti Hamalainen <ccr@tnsp.org>
parents:
341
diff
changeset
|
158 gtk_entry_set_text(GTK_ENTRY(LUW("fileinfo_sub_name")), subName ? subName : ""); |
b1a858b8cb1a
Re-indentation all (non-generated) code.
Matti Hamalainen <ccr@tnsp.org>
parents:
341
diff
changeset
|
159 gtk_entry_set_text(GTK_ENTRY(LUW("fileinfo_sub_author")), subAuthor ? subAuthor : ""); |
625
547f4d35f56a
Unify xs_fileinfo with Aud-SID.
Matti Hamalainen <ccr@tnsp.org>
parents:
622
diff
changeset
|
160 |
547f4d35f56a
Unify xs_fileinfo with Aud-SID.
Matti Hamalainen <ccr@tnsp.org>
parents:
622
diff
changeset
|
161 #ifdef AUDACIOUS_PLUGIN |
547f4d35f56a
Unify xs_fileinfo with Aud-SID.
Matti Hamalainen <ccr@tnsp.org>
parents:
622
diff
changeset
|
162 gtk_text_buffer_set_text(GTK_TEXT_BUFFER(gtk_text_view_get_buffer(GTK_TEXT_VIEW(tmpText))), |
547f4d35f56a
Unify xs_fileinfo with Aud-SID.
Matti Hamalainen <ccr@tnsp.org>
parents:
622
diff
changeset
|
163 subInfo ? subInfo : "", -1); |
547f4d35f56a
Unify xs_fileinfo with Aud-SID.
Matti Hamalainen <ccr@tnsp.org>
parents:
622
diff
changeset
|
164 #else |
615
8fe2e757fa4a
Fixed sub-tune info selection box in fileinfo window.
Matti Hamalainen <ccr@tnsp.org>
parents:
614
diff
changeset
|
165 gtk_text_insert(GTK_TEXT(tmpText), NULL, NULL, NULL, |
8fe2e757fa4a
Fixed sub-tune info selection box in fileinfo window.
Matti Hamalainen <ccr@tnsp.org>
parents:
614
diff
changeset
|
166 subInfo ? subInfo : "", -1); |
222 | 167 |
359
b1a858b8cb1a
Re-indentation all (non-generated) code.
Matti Hamalainen <ccr@tnsp.org>
parents:
341
diff
changeset
|
168 /* Un-freeze the widget */ |
b1a858b8cb1a
Re-indentation all (non-generated) code.
Matti Hamalainen <ccr@tnsp.org>
parents:
341
diff
changeset
|
169 gtk_text_thaw(GTK_TEXT(tmpText)); |
625
547f4d35f56a
Unify xs_fileinfo with Aud-SID.
Matti Hamalainen <ccr@tnsp.org>
parents:
622
diff
changeset
|
170 #endif |
222 | 171 } |
172 | |
173 | |
359
b1a858b8cb1a
Re-indentation all (non-generated) code.
Matti Hamalainen <ccr@tnsp.org>
parents:
341
diff
changeset
|
174 void xs_fileinfo(gchar * pcFilename) |
222 | 175 { |
359
b1a858b8cb1a
Re-indentation all (non-generated) code.
Matti Hamalainen <ccr@tnsp.org>
parents:
341
diff
changeset
|
176 GtkWidget *tmpMenuItem, *tmpMenu, *tmpOptionMenu; |
b1a858b8cb1a
Re-indentation all (non-generated) code.
Matti Hamalainen <ccr@tnsp.org>
parents:
341
diff
changeset
|
177 t_xs_tuneinfo *tmpInfo; |
625
547f4d35f56a
Unify xs_fileinfo with Aud-SID.
Matti Hamalainen <ccr@tnsp.org>
parents:
622
diff
changeset
|
178 gchar tmpStr[256], *tmpFilename; |
359
b1a858b8cb1a
Re-indentation all (non-generated) code.
Matti Hamalainen <ccr@tnsp.org>
parents:
341
diff
changeset
|
179 gint n; |
222 | 180 |
359
b1a858b8cb1a
Re-indentation all (non-generated) code.
Matti Hamalainen <ccr@tnsp.org>
parents:
341
diff
changeset
|
181 /* Current implementation leaves old fileinfo window untouched if |
b1a858b8cb1a
Re-indentation all (non-generated) code.
Matti Hamalainen <ccr@tnsp.org>
parents:
341
diff
changeset
|
182 * no information can be found for the new file. Hmm... |
b1a858b8cb1a
Re-indentation all (non-generated) code.
Matti Hamalainen <ccr@tnsp.org>
parents:
341
diff
changeset
|
183 */ |
232
e613873c3379
Thread locking now final. All parts, including GTK GUI, should be(?)
Matti Hamalainen <ccr@tnsp.org>
parents:
230
diff
changeset
|
184 |
359
b1a858b8cb1a
Re-indentation all (non-generated) code.
Matti Hamalainen <ccr@tnsp.org>
parents:
341
diff
changeset
|
185 /* Get new tune information */ |
b1a858b8cb1a
Re-indentation all (non-generated) code.
Matti Hamalainen <ccr@tnsp.org>
parents:
341
diff
changeset
|
186 XS_MUTEX_LOCK(xs_fileinfowin); |
b1a858b8cb1a
Re-indentation all (non-generated) code.
Matti Hamalainen <ccr@tnsp.org>
parents:
341
diff
changeset
|
187 XS_MUTEX_LOCK(xs_status); |
b1a858b8cb1a
Re-indentation all (non-generated) code.
Matti Hamalainen <ccr@tnsp.org>
parents:
341
diff
changeset
|
188 if ((tmpInfo = xs_status.sidPlayer->plrGetSIDInfo(pcFilename)) == NULL) { |
b1a858b8cb1a
Re-indentation all (non-generated) code.
Matti Hamalainen <ccr@tnsp.org>
parents:
341
diff
changeset
|
189 XS_MUTEX_UNLOCK(xs_fileinfowin); |
b1a858b8cb1a
Re-indentation all (non-generated) code.
Matti Hamalainen <ccr@tnsp.org>
parents:
341
diff
changeset
|
190 XS_MUTEX_UNLOCK(xs_status); |
b1a858b8cb1a
Re-indentation all (non-generated) code.
Matti Hamalainen <ccr@tnsp.org>
parents:
341
diff
changeset
|
191 return; |
b1a858b8cb1a
Re-indentation all (non-generated) code.
Matti Hamalainen <ccr@tnsp.org>
parents:
341
diff
changeset
|
192 } |
b1a858b8cb1a
Re-indentation all (non-generated) code.
Matti Hamalainen <ccr@tnsp.org>
parents:
341
diff
changeset
|
193 XS_MUTEX_UNLOCK(xs_status); |
222 | 194 |
359
b1a858b8cb1a
Re-indentation all (non-generated) code.
Matti Hamalainen <ccr@tnsp.org>
parents:
341
diff
changeset
|
195 xs_fileinfostil = xs_stil_get(pcFilename); |
222 | 196 |
359
b1a858b8cb1a
Re-indentation all (non-generated) code.
Matti Hamalainen <ccr@tnsp.org>
parents:
341
diff
changeset
|
197 /* Check if there already is an open fileinfo window */ |
614
52a6c114e505
Sub-tune info selector fixed in file information dialog.
Matti Hamalainen <ccr@tnsp.org>
parents:
612
diff
changeset
|
198 if (xs_fileinfowin) |
359
b1a858b8cb1a
Re-indentation all (non-generated) code.
Matti Hamalainen <ccr@tnsp.org>
parents:
341
diff
changeset
|
199 gdk_window_raise(xs_fileinfowin->window); |
614
52a6c114e505
Sub-tune info selector fixed in file information dialog.
Matti Hamalainen <ccr@tnsp.org>
parents:
612
diff
changeset
|
200 else { |
52a6c114e505
Sub-tune info selector fixed in file information dialog.
Matti Hamalainen <ccr@tnsp.org>
parents:
612
diff
changeset
|
201 xs_fileinfowin = create_xs_fileinfowin(); |
625
547f4d35f56a
Unify xs_fileinfo with Aud-SID.
Matti Hamalainen <ccr@tnsp.org>
parents:
622
diff
changeset
|
202 #ifndef AUDACIOUS_PLUGIN |
626
248aa59cb6a3
XS_SIGNAL_CONNECT() macro added and used.
Matti Hamalainen <ccr@tnsp.org>
parents:
625
diff
changeset
|
203 XS_SIGNAL_CONNECT(gtk_range_get_adjustment(GTK_RANGE(LUW("fileinfo_subctrl_adj"))), |
248aa59cb6a3
XS_SIGNAL_CONNECT() macro added and used.
Matti Hamalainen <ccr@tnsp.org>
parents:
625
diff
changeset
|
204 "value_changed", xs_fileinfo_setsong, NULL); |
625
547f4d35f56a
Unify xs_fileinfo with Aud-SID.
Matti Hamalainen <ccr@tnsp.org>
parents:
622
diff
changeset
|
205 #endif |
614
52a6c114e505
Sub-tune info selector fixed in file information dialog.
Matti Hamalainen <ccr@tnsp.org>
parents:
612
diff
changeset
|
206 } |
222 | 207 |
614
52a6c114e505
Sub-tune info selector fixed in file information dialog.
Matti Hamalainen <ccr@tnsp.org>
parents:
612
diff
changeset
|
208 /* Delete current items */ |
52a6c114e505
Sub-tune info selector fixed in file information dialog.
Matti Hamalainen <ccr@tnsp.org>
parents:
612
diff
changeset
|
209 tmpOptionMenu = LUW("fileinfo_sub_tune"); |
52a6c114e505
Sub-tune info selector fixed in file information dialog.
Matti Hamalainen <ccr@tnsp.org>
parents:
612
diff
changeset
|
210 tmpMenu = gtk_option_menu_get_menu(GTK_OPTION_MENU(tmpOptionMenu)); |
52a6c114e505
Sub-tune info selector fixed in file information dialog.
Matti Hamalainen <ccr@tnsp.org>
parents:
612
diff
changeset
|
211 gtk_widget_destroy(tmpMenu); |
52a6c114e505
Sub-tune info selector fixed in file information dialog.
Matti Hamalainen <ccr@tnsp.org>
parents:
612
diff
changeset
|
212 gtk_option_menu_remove_menu(GTK_OPTION_MENU(tmpOptionMenu)); |
52a6c114e505
Sub-tune info selector fixed in file information dialog.
Matti Hamalainen <ccr@tnsp.org>
parents:
612
diff
changeset
|
213 tmpMenu = gtk_menu_new(); |
222 | 214 |
215 | |
359
b1a858b8cb1a
Re-indentation all (non-generated) code.
Matti Hamalainen <ccr@tnsp.org>
parents:
341
diff
changeset
|
216 /* Set the generic song information */ |
625
547f4d35f56a
Unify xs_fileinfo with Aud-SID.
Matti Hamalainen <ccr@tnsp.org>
parents:
622
diff
changeset
|
217 tmpFilename = XS_CS_FILENAME(pcFilename); |
547f4d35f56a
Unify xs_fileinfo with Aud-SID.
Matti Hamalainen <ccr@tnsp.org>
parents:
622
diff
changeset
|
218 gtk_entry_set_text(GTK_ENTRY(LUW("fileinfo_filename")), tmpFilename); |
547f4d35f56a
Unify xs_fileinfo with Aud-SID.
Matti Hamalainen <ccr@tnsp.org>
parents:
622
diff
changeset
|
219 g_free(tmpFilename); |
359
b1a858b8cb1a
Re-indentation all (non-generated) code.
Matti Hamalainen <ccr@tnsp.org>
parents:
341
diff
changeset
|
220 gtk_entry_set_text(GTK_ENTRY(LUW("fileinfo_songname")), tmpInfo->sidName); |
b1a858b8cb1a
Re-indentation all (non-generated) code.
Matti Hamalainen <ccr@tnsp.org>
parents:
341
diff
changeset
|
221 gtk_entry_set_text(GTK_ENTRY(LUW("fileinfo_composer")), tmpInfo->sidComposer); |
b1a858b8cb1a
Re-indentation all (non-generated) code.
Matti Hamalainen <ccr@tnsp.org>
parents:
341
diff
changeset
|
222 gtk_entry_set_text(GTK_ENTRY(LUW("fileinfo_copyright")), tmpInfo->sidCopyright); |
222 | 223 |
224 | |
359
b1a858b8cb1a
Re-indentation all (non-generated) code.
Matti Hamalainen <ccr@tnsp.org>
parents:
341
diff
changeset
|
225 /* Main tune - the pseudo tune */ |
424
faf12767a6f1
Preparing for internationalization.
Matti Hamalainen <ccr@tnsp.org>
parents:
422
diff
changeset
|
226 tmpMenuItem = gtk_menu_item_new_with_label(_("General info")); |
359
b1a858b8cb1a
Re-indentation all (non-generated) code.
Matti Hamalainen <ccr@tnsp.org>
parents:
341
diff
changeset
|
227 gtk_widget_show(tmpMenuItem); |
b1a858b8cb1a
Re-indentation all (non-generated) code.
Matti Hamalainen <ccr@tnsp.org>
parents:
341
diff
changeset
|
228 gtk_menu_append(GTK_MENU(tmpMenu), tmpMenuItem); |
626
248aa59cb6a3
XS_SIGNAL_CONNECT() macro added and used.
Matti Hamalainen <ccr@tnsp.org>
parents:
625
diff
changeset
|
229 XS_SIGNAL_CONNECT(tmpMenuItem, "activate", xs_fileinfo_subtune, tmpMenu); |
222 | 230 |
359
b1a858b8cb1a
Re-indentation all (non-generated) code.
Matti Hamalainen <ccr@tnsp.org>
parents:
341
diff
changeset
|
231 /* Other menu items */ |
b1a858b8cb1a
Re-indentation all (non-generated) code.
Matti Hamalainen <ccr@tnsp.org>
parents:
341
diff
changeset
|
232 for (n = 1; n <= tmpInfo->nsubTunes; n++) { |
473 | 233 if (xs_fileinfostil && n <= xs_fileinfostil->nsubTunes && xs_fileinfostil->subTunes[n]) { |
430 | 234 t_xs_stil_subnode *tmpNode = xs_fileinfostil->subTunes[n]; |
392
b09d74eb71e6
Working on getting STIL and SLDB using completely dynamically allocated
Matti Hamalainen <ccr@tnsp.org>
parents:
359
diff
changeset
|
235 |
430 | 236 g_snprintf(tmpStr, sizeof(tmpStr), _("Tune #%i: "), n); |
237 | |
473 | 238 if (tmpNode->pName) |
239 xs_pnstrcat(tmpStr, sizeof(tmpStr), tmpNode->pName); | |
240 else if (tmpNode->pTitle) | |
241 xs_pnstrcat(tmpStr, sizeof(tmpStr), tmpNode->pTitle); | |
242 else if (tmpNode->pInfo) | |
243 xs_pnstrcat(tmpStr, sizeof(tmpStr), tmpNode->pInfo); | |
244 else | |
359
b1a858b8cb1a
Re-indentation all (non-generated) code.
Matti Hamalainen <ccr@tnsp.org>
parents:
341
diff
changeset
|
245 xs_pnstrcat(tmpStr, sizeof(tmpStr), "---"); |
239
7833df935239
Added xs_pnstrcat() to ease forming of limited size strings.
Matti Hamalainen <ccr@tnsp.org>
parents:
234
diff
changeset
|
246 } else { |
424
faf12767a6f1
Preparing for internationalization.
Matti Hamalainen <ccr@tnsp.org>
parents:
422
diff
changeset
|
247 g_snprintf(tmpStr, sizeof(tmpStr), _("Tune #%i"), n); |
239
7833df935239
Added xs_pnstrcat() to ease forming of limited size strings.
Matti Hamalainen <ccr@tnsp.org>
parents:
234
diff
changeset
|
248 } |
222 | 249 |
359
b1a858b8cb1a
Re-indentation all (non-generated) code.
Matti Hamalainen <ccr@tnsp.org>
parents:
341
diff
changeset
|
250 tmpMenuItem = gtk_menu_item_new_with_label(tmpStr); |
b1a858b8cb1a
Re-indentation all (non-generated) code.
Matti Hamalainen <ccr@tnsp.org>
parents:
341
diff
changeset
|
251 gtk_widget_show(tmpMenuItem); |
b1a858b8cb1a
Re-indentation all (non-generated) code.
Matti Hamalainen <ccr@tnsp.org>
parents:
341
diff
changeset
|
252 gtk_menu_append(GTK_MENU(tmpMenu), tmpMenuItem); |
626
248aa59cb6a3
XS_SIGNAL_CONNECT() macro added and used.
Matti Hamalainen <ccr@tnsp.org>
parents:
625
diff
changeset
|
253 XS_SIGNAL_CONNECT(tmpMenuItem, "activate", xs_fileinfo_subtune, tmpMenu); |
222 | 254 } |
255 | |
614
52a6c114e505
Sub-tune info selector fixed in file information dialog.
Matti Hamalainen <ccr@tnsp.org>
parents:
612
diff
changeset
|
256 gtk_option_menu_set_menu(GTK_OPTION_MENU(tmpOptionMenu), tmpMenu); |
52a6c114e505
Sub-tune info selector fixed in file information dialog.
Matti Hamalainen <ccr@tnsp.org>
parents:
612
diff
changeset
|
257 gtk_widget_show(tmpOptionMenu); |
52a6c114e505
Sub-tune info selector fixed in file information dialog.
Matti Hamalainen <ccr@tnsp.org>
parents:
612
diff
changeset
|
258 |
359
b1a858b8cb1a
Re-indentation all (non-generated) code.
Matti Hamalainen <ccr@tnsp.org>
parents:
341
diff
changeset
|
259 /* Set the subtune information */ |
b1a858b8cb1a
Re-indentation all (non-generated) code.
Matti Hamalainen <ccr@tnsp.org>
parents:
341
diff
changeset
|
260 xs_fileinfo_subtune(NULL, tmpMenu); |
222 | 261 |
359
b1a858b8cb1a
Re-indentation all (non-generated) code.
Matti Hamalainen <ccr@tnsp.org>
parents:
341
diff
changeset
|
262 /* Free temporary tuneinfo */ |
b1a858b8cb1a
Re-indentation all (non-generated) code.
Matti Hamalainen <ccr@tnsp.org>
parents:
341
diff
changeset
|
263 xs_tuneinfo_free(tmpInfo); |
232
e613873c3379
Thread locking now final. All parts, including GTK GUI, should be(?)
Matti Hamalainen <ccr@tnsp.org>
parents:
230
diff
changeset
|
264 |
359
b1a858b8cb1a
Re-indentation all (non-generated) code.
Matti Hamalainen <ccr@tnsp.org>
parents:
341
diff
changeset
|
265 /* Show the window */ |
b1a858b8cb1a
Re-indentation all (non-generated) code.
Matti Hamalainen <ccr@tnsp.org>
parents:
341
diff
changeset
|
266 gtk_widget_show(xs_fileinfowin); |
232
e613873c3379
Thread locking now final. All parts, including GTK GUI, should be(?)
Matti Hamalainen <ccr@tnsp.org>
parents:
230
diff
changeset
|
267 |
359
b1a858b8cb1a
Re-indentation all (non-generated) code.
Matti Hamalainen <ccr@tnsp.org>
parents:
341
diff
changeset
|
268 XS_MUTEX_UNLOCK(xs_fileinfowin); |
232
e613873c3379
Thread locking now final. All parts, including GTK GUI, should be(?)
Matti Hamalainen <ccr@tnsp.org>
parents:
230
diff
changeset
|
269 |
622
d7389ea52113
Move SLDB and STIL utility functions to xs_slsup.[ch] and amend some changes between XMMS-SID and Aud-SID via a macro mess.
Matti Hamalainen <ccr@tnsp.org>
parents:
615
diff
changeset
|
270 #ifndef AUDACIOUS_PLUGIN |
359
b1a858b8cb1a
Re-indentation all (non-generated) code.
Matti Hamalainen <ccr@tnsp.org>
parents:
341
diff
changeset
|
271 xs_fileinfo_update(); |
622
d7389ea52113
Move SLDB and STIL utility functions to xs_slsup.[ch] and amend some changes between XMMS-SID and Aud-SID via a macro mess.
Matti Hamalainen <ccr@tnsp.org>
parents:
615
diff
changeset
|
272 #endif |
222 | 273 } |