annotate src/xs_fileinfo.c @ 222:dcf88b73e4c1

Added fileinfo-dialog module.
author Matti Hamalainen <ccr@tnsp.org>
date Wed, 15 Dec 2004 14:02:05 +0000
parents
children 608f31f6c095
Ignore whitespace changes - Everywhere: Within whitespace: At end of lines:
rev   line source
222
dcf88b73e4c1 Added fileinfo-dialog module.
Matti Hamalainen <ccr@tnsp.org>
parents:
diff changeset
1 /*
dcf88b73e4c1 Added fileinfo-dialog module.
Matti Hamalainen <ccr@tnsp.org>
parents:
diff changeset
2 XMMS-SID - SIDPlay input plugin for X MultiMedia System (XMMS)
dcf88b73e4c1 Added fileinfo-dialog module.
Matti Hamalainen <ccr@tnsp.org>
parents:
diff changeset
3
dcf88b73e4c1 Added fileinfo-dialog module.
Matti Hamalainen <ccr@tnsp.org>
parents:
diff changeset
4 File information window
dcf88b73e4c1 Added fileinfo-dialog module.
Matti Hamalainen <ccr@tnsp.org>
parents:
diff changeset
5
dcf88b73e4c1 Added fileinfo-dialog module.
Matti Hamalainen <ccr@tnsp.org>
parents:
diff changeset
6 Written by Matti "ccr" Hamalainen <ccr@tnsp.org>
dcf88b73e4c1 Added fileinfo-dialog module.
Matti Hamalainen <ccr@tnsp.org>
parents:
diff changeset
7
dcf88b73e4c1 Added fileinfo-dialog module.
Matti Hamalainen <ccr@tnsp.org>
parents:
diff changeset
8 This program is free software; you can redistribute it and/or modify
dcf88b73e4c1 Added fileinfo-dialog module.
Matti Hamalainen <ccr@tnsp.org>
parents:
diff changeset
9 it under the terms of the GNU General Public License as published by
dcf88b73e4c1 Added fileinfo-dialog module.
Matti Hamalainen <ccr@tnsp.org>
parents:
diff changeset
10 the Free Software Foundation; either version 2 of the License, or
dcf88b73e4c1 Added fileinfo-dialog module.
Matti Hamalainen <ccr@tnsp.org>
parents:
diff changeset
11 (at your option) any later version.
dcf88b73e4c1 Added fileinfo-dialog module.
Matti Hamalainen <ccr@tnsp.org>
parents:
diff changeset
12
dcf88b73e4c1 Added fileinfo-dialog module.
Matti Hamalainen <ccr@tnsp.org>
parents:
diff changeset
13 This program is distributed in the hope that it will be useful,
dcf88b73e4c1 Added fileinfo-dialog module.
Matti Hamalainen <ccr@tnsp.org>
parents:
diff changeset
14 but WITHOUT ANY WARRANTY; without even the implied warranty of
dcf88b73e4c1 Added fileinfo-dialog module.
Matti Hamalainen <ccr@tnsp.org>
parents:
diff changeset
15 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
dcf88b73e4c1 Added fileinfo-dialog module.
Matti Hamalainen <ccr@tnsp.org>
parents:
diff changeset
16 GNU General Public License for more details.
dcf88b73e4c1 Added fileinfo-dialog module.
Matti Hamalainen <ccr@tnsp.org>
parents:
diff changeset
17
dcf88b73e4c1 Added fileinfo-dialog module.
Matti Hamalainen <ccr@tnsp.org>
parents:
diff changeset
18 You should have received a copy of the GNU General Public License
dcf88b73e4c1 Added fileinfo-dialog module.
Matti Hamalainen <ccr@tnsp.org>
parents:
diff changeset
19 along with this program; if not, write to the Free Software
dcf88b73e4c1 Added fileinfo-dialog module.
Matti Hamalainen <ccr@tnsp.org>
parents:
diff changeset
20 Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
dcf88b73e4c1 Added fileinfo-dialog module.
Matti Hamalainen <ccr@tnsp.org>
parents:
diff changeset
21 */
dcf88b73e4c1 Added fileinfo-dialog module.
Matti Hamalainen <ccr@tnsp.org>
parents:
diff changeset
22 #include <gdk/gdkkeysyms.h>
dcf88b73e4c1 Added fileinfo-dialog module.
Matti Hamalainen <ccr@tnsp.org>
parents:
diff changeset
23 #include <gtk/gtk.h>
dcf88b73e4c1 Added fileinfo-dialog module.
Matti Hamalainen <ccr@tnsp.org>
parents:
diff changeset
24
dcf88b73e4c1 Added fileinfo-dialog module.
Matti Hamalainen <ccr@tnsp.org>
parents:
diff changeset
25 #include "xmms-sid.h"
dcf88b73e4c1 Added fileinfo-dialog module.
Matti Hamalainen <ccr@tnsp.org>
parents:
diff changeset
26 #include "xs_stil.h"
dcf88b73e4c1 Added fileinfo-dialog module.
Matti Hamalainen <ccr@tnsp.org>
parents:
diff changeset
27 #include "xs_config.h"
dcf88b73e4c1 Added fileinfo-dialog module.
Matti Hamalainen <ccr@tnsp.org>
parents:
diff changeset
28 #include "xs_interface.h"
dcf88b73e4c1 Added fileinfo-dialog module.
Matti Hamalainen <ccr@tnsp.org>
parents:
diff changeset
29 #include "xs_glade.h"
dcf88b73e4c1 Added fileinfo-dialog module.
Matti Hamalainen <ccr@tnsp.org>
parents:
diff changeset
30
dcf88b73e4c1 Added fileinfo-dialog module.
Matti Hamalainen <ccr@tnsp.org>
parents:
diff changeset
31 static GtkWidget *xs_fileinfowin = NULL;
dcf88b73e4c1 Added fileinfo-dialog module.
Matti Hamalainen <ccr@tnsp.org>
parents:
diff changeset
32
dcf88b73e4c1 Added fileinfo-dialog module.
Matti Hamalainen <ccr@tnsp.org>
parents:
diff changeset
33 #define LUW(x...) lookup_widget(xs_fileinfowin, ## x)
dcf88b73e4c1 Added fileinfo-dialog module.
Matti Hamalainen <ccr@tnsp.org>
parents:
diff changeset
34
dcf88b73e4c1 Added fileinfo-dialog module.
Matti Hamalainen <ccr@tnsp.org>
parents:
diff changeset
35
dcf88b73e4c1 Added fileinfo-dialog module.
Matti Hamalainen <ccr@tnsp.org>
parents:
diff changeset
36 void xs_fileinfo_ok(void)
dcf88b73e4c1 Added fileinfo-dialog module.
Matti Hamalainen <ccr@tnsp.org>
parents:
diff changeset
37 {
dcf88b73e4c1 Added fileinfo-dialog module.
Matti Hamalainen <ccr@tnsp.org>
parents:
diff changeset
38 gtk_widget_destroy(xs_fileinfowin);
dcf88b73e4c1 Added fileinfo-dialog module.
Matti Hamalainen <ccr@tnsp.org>
parents:
diff changeset
39 xs_fileinfowin = NULL;
dcf88b73e4c1 Added fileinfo-dialog module.
Matti Hamalainen <ccr@tnsp.org>
parents:
diff changeset
40 }
dcf88b73e4c1 Added fileinfo-dialog module.
Matti Hamalainen <ccr@tnsp.org>
parents:
diff changeset
41
dcf88b73e4c1 Added fileinfo-dialog module.
Matti Hamalainen <ccr@tnsp.org>
parents:
diff changeset
42
dcf88b73e4c1 Added fileinfo-dialog module.
Matti Hamalainen <ccr@tnsp.org>
parents:
diff changeset
43 void xs_fileinfo_subtune(GtkWidget *widget, void *data)
dcf88b73e4c1 Added fileinfo-dialog module.
Matti Hamalainen <ccr@tnsp.org>
parents:
diff changeset
44 {
dcf88b73e4c1 Added fileinfo-dialog module.
Matti Hamalainen <ccr@tnsp.org>
parents:
diff changeset
45 t_xs_stil_subnode *tmpNode;
dcf88b73e4c1 Added fileinfo-dialog module.
Matti Hamalainen <ccr@tnsp.org>
parents:
diff changeset
46 GtkWidget *tmpItem, *tmpText;
dcf88b73e4c1 Added fileinfo-dialog module.
Matti Hamalainen <ccr@tnsp.org>
parents:
diff changeset
47 gint tmpIndex;
dcf88b73e4c1 Added fileinfo-dialog module.
Matti Hamalainen <ccr@tnsp.org>
parents:
diff changeset
48 gchar *subName, *subAuthor;
dcf88b73e4c1 Added fileinfo-dialog module.
Matti Hamalainen <ccr@tnsp.org>
parents:
diff changeset
49
dcf88b73e4c1 Added fileinfo-dialog module.
Matti Hamalainen <ccr@tnsp.org>
parents:
diff changeset
50 /* Freeze text-widget and delete the old text */
dcf88b73e4c1 Added fileinfo-dialog module.
Matti Hamalainen <ccr@tnsp.org>
parents:
diff changeset
51 tmpText = LUW("fileinfo_sub_info");
dcf88b73e4c1 Added fileinfo-dialog module.
Matti Hamalainen <ccr@tnsp.org>
parents:
diff changeset
52 gtk_text_freeze(GTK_TEXT(tmpText));
dcf88b73e4c1 Added fileinfo-dialog module.
Matti Hamalainen <ccr@tnsp.org>
parents:
diff changeset
53 gtk_text_set_point(GTK_TEXT(tmpText), 0);
dcf88b73e4c1 Added fileinfo-dialog module.
Matti Hamalainen <ccr@tnsp.org>
parents:
diff changeset
54 gtk_text_forward_delete(GTK_TEXT(tmpText),
dcf88b73e4c1 Added fileinfo-dialog module.
Matti Hamalainen <ccr@tnsp.org>
parents:
diff changeset
55 gtk_text_get_length(GTK_TEXT(tmpText)));
dcf88b73e4c1 Added fileinfo-dialog module.
Matti Hamalainen <ccr@tnsp.org>
parents:
diff changeset
56
dcf88b73e4c1 Added fileinfo-dialog module.
Matti Hamalainen <ccr@tnsp.org>
parents:
diff changeset
57 if (xs_fileinfostil)
dcf88b73e4c1 Added fileinfo-dialog module.
Matti Hamalainen <ccr@tnsp.org>
parents:
diff changeset
58 {
dcf88b73e4c1 Added fileinfo-dialog module.
Matti Hamalainen <ccr@tnsp.org>
parents:
diff changeset
59 /* Get subtune number */
dcf88b73e4c1 Added fileinfo-dialog module.
Matti Hamalainen <ccr@tnsp.org>
parents:
diff changeset
60 tmpItem = gtk_menu_get_active(GTK_MENU(data));
dcf88b73e4c1 Added fileinfo-dialog module.
Matti Hamalainen <ccr@tnsp.org>
parents:
diff changeset
61 tmpIndex = g_list_index(GTK_MENU_SHELL(data)->children, tmpItem);
dcf88b73e4c1 Added fileinfo-dialog module.
Matti Hamalainen <ccr@tnsp.org>
parents:
diff changeset
62
dcf88b73e4c1 Added fileinfo-dialog module.
Matti Hamalainen <ccr@tnsp.org>
parents:
diff changeset
63 /* Get subtune information */
dcf88b73e4c1 Added fileinfo-dialog module.
Matti Hamalainen <ccr@tnsp.org>
parents:
diff changeset
64 tmpNode = &xs_fileinfostil->subTune[tmpIndex];
dcf88b73e4c1 Added fileinfo-dialog module.
Matti Hamalainen <ccr@tnsp.org>
parents:
diff changeset
65 subName = tmpNode->pName;
dcf88b73e4c1 Added fileinfo-dialog module.
Matti Hamalainen <ccr@tnsp.org>
parents:
diff changeset
66 subAuthor = tmpNode->pAuthor;
dcf88b73e4c1 Added fileinfo-dialog module.
Matti Hamalainen <ccr@tnsp.org>
parents:
diff changeset
67
dcf88b73e4c1 Added fileinfo-dialog module.
Matti Hamalainen <ccr@tnsp.org>
parents:
diff changeset
68 /* Put in the new text, if available */
dcf88b73e4c1 Added fileinfo-dialog module.
Matti Hamalainen <ccr@tnsp.org>
parents:
diff changeset
69 if (tmpNode->pInfo)
dcf88b73e4c1 Added fileinfo-dialog module.
Matti Hamalainen <ccr@tnsp.org>
parents:
diff changeset
70 {
dcf88b73e4c1 Added fileinfo-dialog module.
Matti Hamalainen <ccr@tnsp.org>
parents:
diff changeset
71 gtk_text_insert (GTK_TEXT (tmpText), NULL, NULL, NULL,
dcf88b73e4c1 Added fileinfo-dialog module.
Matti Hamalainen <ccr@tnsp.org>
parents:
diff changeset
72 tmpNode->pInfo, strlen(tmpNode->pInfo));
dcf88b73e4c1 Added fileinfo-dialog module.
Matti Hamalainen <ccr@tnsp.org>
parents:
diff changeset
73 }
dcf88b73e4c1 Added fileinfo-dialog module.
Matti Hamalainen <ccr@tnsp.org>
parents:
diff changeset
74 } else {
dcf88b73e4c1 Added fileinfo-dialog module.
Matti Hamalainen <ccr@tnsp.org>
parents:
diff changeset
75 /* We don't have any information */
dcf88b73e4c1 Added fileinfo-dialog module.
Matti Hamalainen <ccr@tnsp.org>
parents:
diff changeset
76 subName = NULL;
dcf88b73e4c1 Added fileinfo-dialog module.
Matti Hamalainen <ccr@tnsp.org>
parents:
diff changeset
77 subAuthor = NULL;
dcf88b73e4c1 Added fileinfo-dialog module.
Matti Hamalainen <ccr@tnsp.org>
parents:
diff changeset
78 }
dcf88b73e4c1 Added fileinfo-dialog module.
Matti Hamalainen <ccr@tnsp.org>
parents:
diff changeset
79
dcf88b73e4c1 Added fileinfo-dialog module.
Matti Hamalainen <ccr@tnsp.org>
parents:
diff changeset
80 /* Get and set subtune information */
dcf88b73e4c1 Added fileinfo-dialog module.
Matti Hamalainen <ccr@tnsp.org>
parents:
diff changeset
81 gtk_entry_set_text(GTK_ENTRY(LUW("fileinfo_sub_name")), subName ? subName : "");
dcf88b73e4c1 Added fileinfo-dialog module.
Matti Hamalainen <ccr@tnsp.org>
parents:
diff changeset
82 gtk_entry_set_text(GTK_ENTRY(LUW("fileinfo_sub_author")), subAuthor ? subAuthor : "");
dcf88b73e4c1 Added fileinfo-dialog module.
Matti Hamalainen <ccr@tnsp.org>
parents:
diff changeset
83
dcf88b73e4c1 Added fileinfo-dialog module.
Matti Hamalainen <ccr@tnsp.org>
parents:
diff changeset
84 /* Un-freeze the widget */
dcf88b73e4c1 Added fileinfo-dialog module.
Matti Hamalainen <ccr@tnsp.org>
parents:
diff changeset
85 gtk_text_thaw(GTK_TEXT(tmpText));
dcf88b73e4c1 Added fileinfo-dialog module.
Matti Hamalainen <ccr@tnsp.org>
parents:
diff changeset
86 }
dcf88b73e4c1 Added fileinfo-dialog module.
Matti Hamalainen <ccr@tnsp.org>
parents:
diff changeset
87
dcf88b73e4c1 Added fileinfo-dialog module.
Matti Hamalainen <ccr@tnsp.org>
parents:
diff changeset
88
dcf88b73e4c1 Added fileinfo-dialog module.
Matti Hamalainen <ccr@tnsp.org>
parents:
diff changeset
89 void xs_fileinfo(gchar *pcFilename)
dcf88b73e4c1 Added fileinfo-dialog module.
Matti Hamalainen <ccr@tnsp.org>
parents:
diff changeset
90 {
dcf88b73e4c1 Added fileinfo-dialog module.
Matti Hamalainen <ccr@tnsp.org>
parents:
diff changeset
91 GtkWidget *tmpMenuItem, *tmpMenu, *tmpOptionMenu;
dcf88b73e4c1 Added fileinfo-dialog module.
Matti Hamalainen <ccr@tnsp.org>
parents:
diff changeset
92 t_xs_stil_subnode *tmpNode;
dcf88b73e4c1 Added fileinfo-dialog module.
Matti Hamalainen <ccr@tnsp.org>
parents:
diff changeset
93 gchar tmpStr[32], *tmpS;
dcf88b73e4c1 Added fileinfo-dialog module.
Matti Hamalainen <ccr@tnsp.org>
parents:
diff changeset
94 gint n;
dcf88b73e4c1 Added fileinfo-dialog module.
Matti Hamalainen <ccr@tnsp.org>
parents:
diff changeset
95
dcf88b73e4c1 Added fileinfo-dialog module.
Matti Hamalainen <ccr@tnsp.org>
parents:
diff changeset
96 /* Free old info, if set */
dcf88b73e4c1 Added fileinfo-dialog module.
Matti Hamalainen <ccr@tnsp.org>
parents:
diff changeset
97 if (xs_fileinfotune)
dcf88b73e4c1 Added fileinfo-dialog module.
Matti Hamalainen <ccr@tnsp.org>
parents:
diff changeset
98 xs_tune_free(xs_fileinfotune);
dcf88b73e4c1 Added fileinfo-dialog module.
Matti Hamalainen <ccr@tnsp.org>
parents:
diff changeset
99
dcf88b73e4c1 Added fileinfo-dialog module.
Matti Hamalainen <ccr@tnsp.org>
parents:
diff changeset
100 /* Get new tune information */
dcf88b73e4c1 Added fileinfo-dialog module.
Matti Hamalainen <ccr@tnsp.org>
parents:
diff changeset
101 if ((xs_fileinfotune = xs_player->plrGetSIDInfo(pcFilename)) == NULL)
dcf88b73e4c1 Added fileinfo-dialog module.
Matti Hamalainen <ccr@tnsp.org>
parents:
diff changeset
102 return;
dcf88b73e4c1 Added fileinfo-dialog module.
Matti Hamalainen <ccr@tnsp.org>
parents:
diff changeset
103
dcf88b73e4c1 Added fileinfo-dialog module.
Matti Hamalainen <ccr@tnsp.org>
parents:
diff changeset
104 if (xs_cfg.stilDBEnable)
dcf88b73e4c1 Added fileinfo-dialog module.
Matti Hamalainen <ccr@tnsp.org>
parents:
diff changeset
105 xs_fileinfostil = xs_stil_get(pcFilename);
dcf88b73e4c1 Added fileinfo-dialog module.
Matti Hamalainen <ccr@tnsp.org>
parents:
diff changeset
106 else
dcf88b73e4c1 Added fileinfo-dialog module.
Matti Hamalainen <ccr@tnsp.org>
parents:
diff changeset
107 xs_fileinfostil = NULL;
dcf88b73e4c1 Added fileinfo-dialog module.
Matti Hamalainen <ccr@tnsp.org>
parents:
diff changeset
108
dcf88b73e4c1 Added fileinfo-dialog module.
Matti Hamalainen <ccr@tnsp.org>
parents:
diff changeset
109
dcf88b73e4c1 Added fileinfo-dialog module.
Matti Hamalainen <ccr@tnsp.org>
parents:
diff changeset
110 /* Check if there already is an open fileinfo window */
dcf88b73e4c1 Added fileinfo-dialog module.
Matti Hamalainen <ccr@tnsp.org>
parents:
diff changeset
111 if (xs_fileinfowin)
dcf88b73e4c1 Added fileinfo-dialog module.
Matti Hamalainen <ccr@tnsp.org>
parents:
diff changeset
112 {
dcf88b73e4c1 Added fileinfo-dialog module.
Matti Hamalainen <ccr@tnsp.org>
parents:
diff changeset
113 /* Raise old window */
dcf88b73e4c1 Added fileinfo-dialog module.
Matti Hamalainen <ccr@tnsp.org>
parents:
diff changeset
114 gdk_window_raise(xs_fileinfowin->window);
dcf88b73e4c1 Added fileinfo-dialog module.
Matti Hamalainen <ccr@tnsp.org>
parents:
diff changeset
115
dcf88b73e4c1 Added fileinfo-dialog module.
Matti Hamalainen <ccr@tnsp.org>
parents:
diff changeset
116 /* Delete items */
dcf88b73e4c1 Added fileinfo-dialog module.
Matti Hamalainen <ccr@tnsp.org>
parents:
diff changeset
117 tmpOptionMenu = LUW("fileinfo_sub_tune");
dcf88b73e4c1 Added fileinfo-dialog module.
Matti Hamalainen <ccr@tnsp.org>
parents:
diff changeset
118 gtk_widget_destroy(GTK_OPTION_MENU(tmpOptionMenu)->menu);
dcf88b73e4c1 Added fileinfo-dialog module.
Matti Hamalainen <ccr@tnsp.org>
parents:
diff changeset
119 GTK_OPTION_MENU(tmpOptionMenu)->menu = gtk_menu_new();
dcf88b73e4c1 Added fileinfo-dialog module.
Matti Hamalainen <ccr@tnsp.org>
parents:
diff changeset
120 } else {
dcf88b73e4c1 Added fileinfo-dialog module.
Matti Hamalainen <ccr@tnsp.org>
parents:
diff changeset
121 /* If not, create a new one */
dcf88b73e4c1 Added fileinfo-dialog module.
Matti Hamalainen <ccr@tnsp.org>
parents:
diff changeset
122 xs_fileinfowin = create_xs_fileinfowin();
dcf88b73e4c1 Added fileinfo-dialog module.
Matti Hamalainen <ccr@tnsp.org>
parents:
diff changeset
123
dcf88b73e4c1 Added fileinfo-dialog module.
Matti Hamalainen <ccr@tnsp.org>
parents:
diff changeset
124 /* Connect additional signals */
dcf88b73e4c1 Added fileinfo-dialog module.
Matti Hamalainen <ccr@tnsp.org>
parents:
diff changeset
125 gtk_signal_connect(GTK_OBJECT(
dcf88b73e4c1 Added fileinfo-dialog module.
Matti Hamalainen <ccr@tnsp.org>
parents:
diff changeset
126 gtk_range_get_adjustment(GTK_RANGE(LUW("fileinfo_subctrl_adj")))),
dcf88b73e4c1 Added fileinfo-dialog module.
Matti Hamalainen <ccr@tnsp.org>
parents:
diff changeset
127 "value_changed", GTK_SIGNAL_FUNC (xs_fileinfo_setsong), NULL);
dcf88b73e4c1 Added fileinfo-dialog module.
Matti Hamalainen <ccr@tnsp.org>
parents:
diff changeset
128 }
dcf88b73e4c1 Added fileinfo-dialog module.
Matti Hamalainen <ccr@tnsp.org>
parents:
diff changeset
129
dcf88b73e4c1 Added fileinfo-dialog module.
Matti Hamalainen <ccr@tnsp.org>
parents:
diff changeset
130
dcf88b73e4c1 Added fileinfo-dialog module.
Matti Hamalainen <ccr@tnsp.org>
parents:
diff changeset
131 /* Set the generic song information */
dcf88b73e4c1 Added fileinfo-dialog module.
Matti Hamalainen <ccr@tnsp.org>
parents:
diff changeset
132 gtk_entry_set_text(GTK_ENTRY(LUW("fileinfo_filename")), pcFilename);
dcf88b73e4c1 Added fileinfo-dialog module.
Matti Hamalainen <ccr@tnsp.org>
parents:
diff changeset
133 gtk_entry_set_text(GTK_ENTRY(LUW("fileinfo_songname")), xs_fileinfotune->tuneName);
dcf88b73e4c1 Added fileinfo-dialog module.
Matti Hamalainen <ccr@tnsp.org>
parents:
diff changeset
134 gtk_entry_set_text(GTK_ENTRY(LUW("fileinfo_composer")), xs_fileinfotune->tuneComposer);
dcf88b73e4c1 Added fileinfo-dialog module.
Matti Hamalainen <ccr@tnsp.org>
parents:
diff changeset
135 gtk_entry_set_text(GTK_ENTRY(LUW("fileinfo_copyright")), xs_fileinfotune->tuneCopyright);
dcf88b73e4c1 Added fileinfo-dialog module.
Matti Hamalainen <ccr@tnsp.org>
parents:
diff changeset
136
dcf88b73e4c1 Added fileinfo-dialog module.
Matti Hamalainen <ccr@tnsp.org>
parents:
diff changeset
137
dcf88b73e4c1 Added fileinfo-dialog module.
Matti Hamalainen <ccr@tnsp.org>
parents:
diff changeset
138 /* Main tune - the pseudo tune */
dcf88b73e4c1 Added fileinfo-dialog module.
Matti Hamalainen <ccr@tnsp.org>
parents:
diff changeset
139 tmpOptionMenu = LUW("fileinfo_sub_tune");
dcf88b73e4c1 Added fileinfo-dialog module.
Matti Hamalainen <ccr@tnsp.org>
parents:
diff changeset
140 tmpMenu = GTK_OPTION_MENU(tmpOptionMenu)->menu;
dcf88b73e4c1 Added fileinfo-dialog module.
Matti Hamalainen <ccr@tnsp.org>
parents:
diff changeset
141
dcf88b73e4c1 Added fileinfo-dialog module.
Matti Hamalainen <ccr@tnsp.org>
parents:
diff changeset
142 tmpMenuItem = gtk_menu_item_new_with_label ("General info");
dcf88b73e4c1 Added fileinfo-dialog module.
Matti Hamalainen <ccr@tnsp.org>
parents:
diff changeset
143 gtk_widget_show (tmpMenuItem);
dcf88b73e4c1 Added fileinfo-dialog module.
Matti Hamalainen <ccr@tnsp.org>
parents:
diff changeset
144 gtk_menu_append (GTK_MENU(tmpMenu), tmpMenuItem);
dcf88b73e4c1 Added fileinfo-dialog module.
Matti Hamalainen <ccr@tnsp.org>
parents:
diff changeset
145 gtk_signal_connect (GTK_OBJECT (tmpMenuItem), "activate",
dcf88b73e4c1 Added fileinfo-dialog module.
Matti Hamalainen <ccr@tnsp.org>
parents:
diff changeset
146 GTK_SIGNAL_FUNC (xs_fileinfo_subtune), tmpMenu);
dcf88b73e4c1 Added fileinfo-dialog module.
Matti Hamalainen <ccr@tnsp.org>
parents:
diff changeset
147
dcf88b73e4c1 Added fileinfo-dialog module.
Matti Hamalainen <ccr@tnsp.org>
parents:
diff changeset
148 /* Other menu items */
dcf88b73e4c1 Added fileinfo-dialog module.
Matti Hamalainen <ccr@tnsp.org>
parents:
diff changeset
149 for (n = 1; n <= xs_fileinfotune->nsubTunes; n++)
dcf88b73e4c1 Added fileinfo-dialog module.
Matti Hamalainen <ccr@tnsp.org>
parents:
diff changeset
150 {
dcf88b73e4c1 Added fileinfo-dialog module.
Matti Hamalainen <ccr@tnsp.org>
parents:
diff changeset
151 if (xs_fileinfostil)
dcf88b73e4c1 Added fileinfo-dialog module.
Matti Hamalainen <ccr@tnsp.org>
parents:
diff changeset
152 {
dcf88b73e4c1 Added fileinfo-dialog module.
Matti Hamalainen <ccr@tnsp.org>
parents:
diff changeset
153 tmpNode = &xs_fileinfostil->subTune[n];
dcf88b73e4c1 Added fileinfo-dialog module.
Matti Hamalainen <ccr@tnsp.org>
parents:
diff changeset
154 if (tmpNode->pName)
dcf88b73e4c1 Added fileinfo-dialog module.
Matti Hamalainen <ccr@tnsp.org>
parents:
diff changeset
155 tmpS = tmpNode->pName;
dcf88b73e4c1 Added fileinfo-dialog module.
Matti Hamalainen <ccr@tnsp.org>
parents:
diff changeset
156 else
dcf88b73e4c1 Added fileinfo-dialog module.
Matti Hamalainen <ccr@tnsp.org>
parents:
diff changeset
157 if (tmpNode->pInfo)
dcf88b73e4c1 Added fileinfo-dialog module.
Matti Hamalainen <ccr@tnsp.org>
parents:
diff changeset
158 tmpS = tmpNode->pInfo;
dcf88b73e4c1 Added fileinfo-dialog module.
Matti Hamalainen <ccr@tnsp.org>
parents:
diff changeset
159 else
dcf88b73e4c1 Added fileinfo-dialog module.
Matti Hamalainen <ccr@tnsp.org>
parents:
diff changeset
160 tmpS = "---";
dcf88b73e4c1 Added fileinfo-dialog module.
Matti Hamalainen <ccr@tnsp.org>
parents:
diff changeset
161
dcf88b73e4c1 Added fileinfo-dialog module.
Matti Hamalainen <ccr@tnsp.org>
parents:
diff changeset
162 snprintf(tmpStr, sizeof(tmpStr), "Tune #%i: %s", n, tmpS);
dcf88b73e4c1 Added fileinfo-dialog module.
Matti Hamalainen <ccr@tnsp.org>
parents:
diff changeset
163 } else
dcf88b73e4c1 Added fileinfo-dialog module.
Matti Hamalainen <ccr@tnsp.org>
parents:
diff changeset
164 snprintf(tmpStr, sizeof(tmpStr), "Tune #%i", n);
dcf88b73e4c1 Added fileinfo-dialog module.
Matti Hamalainen <ccr@tnsp.org>
parents:
diff changeset
165
dcf88b73e4c1 Added fileinfo-dialog module.
Matti Hamalainen <ccr@tnsp.org>
parents:
diff changeset
166 tmpMenuItem = gtk_menu_item_new_with_label(tmpStr);
dcf88b73e4c1 Added fileinfo-dialog module.
Matti Hamalainen <ccr@tnsp.org>
parents:
diff changeset
167 gtk_widget_show (tmpMenuItem);
dcf88b73e4c1 Added fileinfo-dialog module.
Matti Hamalainen <ccr@tnsp.org>
parents:
diff changeset
168 gtk_menu_append (GTK_MENU(tmpMenu), tmpMenuItem);
dcf88b73e4c1 Added fileinfo-dialog module.
Matti Hamalainen <ccr@tnsp.org>
parents:
diff changeset
169
dcf88b73e4c1 Added fileinfo-dialog module.
Matti Hamalainen <ccr@tnsp.org>
parents:
diff changeset
170 gtk_signal_connect (GTK_OBJECT(tmpMenuItem), "activate",
dcf88b73e4c1 Added fileinfo-dialog module.
Matti Hamalainen <ccr@tnsp.org>
parents:
diff changeset
171 GTK_SIGNAL_FUNC(xs_fileinfo_subtune), tmpMenu);
dcf88b73e4c1 Added fileinfo-dialog module.
Matti Hamalainen <ccr@tnsp.org>
parents:
diff changeset
172 }
dcf88b73e4c1 Added fileinfo-dialog module.
Matti Hamalainen <ccr@tnsp.org>
parents:
diff changeset
173
dcf88b73e4c1 Added fileinfo-dialog module.
Matti Hamalainen <ccr@tnsp.org>
parents:
diff changeset
174 /* Set the subtune information */
dcf88b73e4c1 Added fileinfo-dialog module.
Matti Hamalainen <ccr@tnsp.org>
parents:
diff changeset
175 xs_fileinfo_subtune(NULL, tmpMenu);
dcf88b73e4c1 Added fileinfo-dialog module.
Matti Hamalainen <ccr@tnsp.org>
parents:
diff changeset
176
dcf88b73e4c1 Added fileinfo-dialog module.
Matti Hamalainen <ccr@tnsp.org>
parents:
diff changeset
177 /* Update subtune controls */
dcf88b73e4c1 Added fileinfo-dialog module.
Matti Hamalainen <ccr@tnsp.org>
parents:
diff changeset
178 xs_subctrl_update();
dcf88b73e4c1 Added fileinfo-dialog module.
Matti Hamalainen <ccr@tnsp.org>
parents:
diff changeset
179
dcf88b73e4c1 Added fileinfo-dialog module.
Matti Hamalainen <ccr@tnsp.org>
parents:
diff changeset
180 /* Show the window */
dcf88b73e4c1 Added fileinfo-dialog module.
Matti Hamalainen <ccr@tnsp.org>
parents:
diff changeset
181 gtk_widget_show(xs_fileinfowin);
dcf88b73e4c1 Added fileinfo-dialog module.
Matti Hamalainen <ccr@tnsp.org>
parents:
diff changeset
182 }
dcf88b73e4c1 Added fileinfo-dialog module.
Matti Hamalainen <ccr@tnsp.org>
parents:
diff changeset
183