Mercurial > hg > xmms-sid
comparison src/xs_fileinfo.c @ 625:547f4d35f56a
Unify xs_fileinfo with Aud-SID.
author | Matti Hamalainen <ccr@tnsp.org> |
---|---|
date | Mon, 03 Sep 2007 02:27:01 +0000 |
parents | d7389ea52113 |
children | 248aa59cb6a3 |
comparison
equal
deleted
inserted
replaced
624:0bf32fa002bf | 625:547f4d35f56a |
---|---|
128 (void) widget; | 128 (void) widget; |
129 (void) data; | 129 (void) data; |
130 | 130 |
131 /* Freeze text-widget and delete the old text */ | 131 /* Freeze text-widget and delete the old text */ |
132 tmpText = LUW("fileinfo_sub_info"); | 132 tmpText = LUW("fileinfo_sub_info"); |
133 #ifndef AUDACIOUS_PLUGIN | |
133 gtk_text_freeze(GTK_TEXT(tmpText)); | 134 gtk_text_freeze(GTK_TEXT(tmpText)); |
134 gtk_text_set_point(GTK_TEXT(tmpText), 0); | 135 gtk_text_set_point(GTK_TEXT(tmpText), 0); |
135 gtk_text_forward_delete(GTK_TEXT(tmpText), gtk_text_get_length(GTK_TEXT(tmpText))); | 136 gtk_text_forward_delete(GTK_TEXT(tmpText), gtk_text_get_length(GTK_TEXT(tmpText))); |
137 #endif | |
136 | 138 |
137 /* Get subtune information */ | 139 /* Get subtune information */ |
138 tmpIndex = g_list_index(GTK_MENU_SHELL(data)->children, gtk_menu_get_active(GTK_MENU(data))); | 140 tmpIndex = g_list_index(GTK_MENU_SHELL(data)->children, gtk_menu_get_active(GTK_MENU(data))); |
139 | 141 |
140 if (xs_fileinfostil && tmpIndex <= xs_fileinfostil->nsubTunes) | 142 if (xs_fileinfostil && tmpIndex <= xs_fileinfostil->nsubTunes) |
153 } | 155 } |
154 | 156 |
155 /* Get and set subtune information */ | 157 /* Get and set subtune information */ |
156 gtk_entry_set_text(GTK_ENTRY(LUW("fileinfo_sub_name")), subName ? subName : ""); | 158 gtk_entry_set_text(GTK_ENTRY(LUW("fileinfo_sub_name")), subName ? subName : ""); |
157 gtk_entry_set_text(GTK_ENTRY(LUW("fileinfo_sub_author")), subAuthor ? subAuthor : ""); | 159 gtk_entry_set_text(GTK_ENTRY(LUW("fileinfo_sub_author")), subAuthor ? subAuthor : ""); |
160 | |
161 #ifdef AUDACIOUS_PLUGIN | |
162 gtk_text_buffer_set_text(GTK_TEXT_BUFFER(gtk_text_view_get_buffer(GTK_TEXT_VIEW(tmpText))), | |
163 subInfo ? subInfo : "", -1); | |
164 #else | |
158 gtk_text_insert(GTK_TEXT(tmpText), NULL, NULL, NULL, | 165 gtk_text_insert(GTK_TEXT(tmpText), NULL, NULL, NULL, |
159 subInfo ? subInfo : "", -1); | 166 subInfo ? subInfo : "", -1); |
160 | 167 |
161 /* Un-freeze the widget */ | 168 /* Un-freeze the widget */ |
162 gtk_text_thaw(GTK_TEXT(tmpText)); | 169 gtk_text_thaw(GTK_TEXT(tmpText)); |
170 #endif | |
163 } | 171 } |
164 | 172 |
165 | 173 |
166 void xs_fileinfo(gchar * pcFilename) | 174 void xs_fileinfo(gchar * pcFilename) |
167 { | 175 { |
168 GtkWidget *tmpMenuItem, *tmpMenu, *tmpOptionMenu; | 176 GtkWidget *tmpMenuItem, *tmpMenu, *tmpOptionMenu; |
169 t_xs_tuneinfo *tmpInfo; | 177 t_xs_tuneinfo *tmpInfo; |
170 gchar tmpStr[256]; | 178 gchar tmpStr[256], *tmpFilename; |
171 gint n; | 179 gint n; |
172 | 180 |
173 /* Current implementation leaves old fileinfo window untouched if | 181 /* Current implementation leaves old fileinfo window untouched if |
174 * no information can be found for the new file. Hmm... | 182 * no information can be found for the new file. Hmm... |
175 */ | 183 */ |
189 /* Check if there already is an open fileinfo window */ | 197 /* Check if there already is an open fileinfo window */ |
190 if (xs_fileinfowin) | 198 if (xs_fileinfowin) |
191 gdk_window_raise(xs_fileinfowin->window); | 199 gdk_window_raise(xs_fileinfowin->window); |
192 else { | 200 else { |
193 xs_fileinfowin = create_xs_fileinfowin(); | 201 xs_fileinfowin = create_xs_fileinfowin(); |
202 #ifndef AUDACIOUS_PLUGIN | |
194 gtk_signal_connect(GTK_OBJECT( | 203 gtk_signal_connect(GTK_OBJECT( |
195 gtk_range_get_adjustment(GTK_RANGE(LUW("fileinfo_subctrl_adj")))), "value_changed", | 204 gtk_range_get_adjustment(GTK_RANGE(LUW("fileinfo_subctrl_adj")))), |
196 GTK_SIGNAL_FUNC(xs_fileinfo_setsong), NULL); | 205 "value_changed", GTK_SIGNAL_FUNC(xs_fileinfo_setsong), NULL); |
206 #endif | |
197 } | 207 } |
198 | 208 |
199 /* Delete current items */ | 209 /* Delete current items */ |
200 tmpOptionMenu = LUW("fileinfo_sub_tune"); | 210 tmpOptionMenu = LUW("fileinfo_sub_tune"); |
201 tmpMenu = gtk_option_menu_get_menu(GTK_OPTION_MENU(tmpOptionMenu)); | 211 tmpMenu = gtk_option_menu_get_menu(GTK_OPTION_MENU(tmpOptionMenu)); |
203 gtk_option_menu_remove_menu(GTK_OPTION_MENU(tmpOptionMenu)); | 213 gtk_option_menu_remove_menu(GTK_OPTION_MENU(tmpOptionMenu)); |
204 tmpMenu = gtk_menu_new(); | 214 tmpMenu = gtk_menu_new(); |
205 | 215 |
206 | 216 |
207 /* Set the generic song information */ | 217 /* Set the generic song information */ |
208 gtk_entry_set_text(GTK_ENTRY(LUW("fileinfo_filename")), pcFilename); | 218 tmpFilename = XS_CS_FILENAME(pcFilename); |
219 gtk_entry_set_text(GTK_ENTRY(LUW("fileinfo_filename")), tmpFilename); | |
220 g_free(tmpFilename); | |
209 gtk_entry_set_text(GTK_ENTRY(LUW("fileinfo_songname")), tmpInfo->sidName); | 221 gtk_entry_set_text(GTK_ENTRY(LUW("fileinfo_songname")), tmpInfo->sidName); |
210 gtk_entry_set_text(GTK_ENTRY(LUW("fileinfo_composer")), tmpInfo->sidComposer); | 222 gtk_entry_set_text(GTK_ENTRY(LUW("fileinfo_composer")), tmpInfo->sidComposer); |
211 gtk_entry_set_text(GTK_ENTRY(LUW("fileinfo_copyright")), tmpInfo->sidCopyright); | 223 gtk_entry_set_text(GTK_ENTRY(LUW("fileinfo_copyright")), tmpInfo->sidCopyright); |
212 | 224 |
213 | 225 |
214 /* Main tune - the pseudo tune */ | 226 /* Main tune - the pseudo tune */ |
215 tmpMenuItem = gtk_menu_item_new_with_label(_("General info")); | 227 tmpMenuItem = gtk_menu_item_new_with_label(_("General info")); |
216 gtk_widget_show(tmpMenuItem); | 228 gtk_widget_show(tmpMenuItem); |
217 gtk_menu_append(GTK_MENU(tmpMenu), tmpMenuItem); | 229 gtk_menu_append(GTK_MENU(tmpMenu), tmpMenuItem); |
230 #ifdef AUDACIOUS_PLUGIN | |
231 g_signal_connect(G_OBJECT(tmpMenuItem), "activate", | |
232 G_CALLBACK(xs_fileinfo_subtune), tmpMenu); | |
233 #else | |
218 gtk_signal_connect(GTK_OBJECT(tmpMenuItem), "activate", | 234 gtk_signal_connect(GTK_OBJECT(tmpMenuItem), "activate", |
219 GTK_SIGNAL_FUNC(xs_fileinfo_subtune), tmpMenu); | 235 GTK_SIGNAL_FUNC(xs_fileinfo_subtune), tmpMenu); |
236 #endif | |
220 | 237 |
221 /* Other menu items */ | 238 /* Other menu items */ |
222 for (n = 1; n <= tmpInfo->nsubTunes; n++) { | 239 for (n = 1; n <= tmpInfo->nsubTunes; n++) { |
223 if (xs_fileinfostil && n <= xs_fileinfostil->nsubTunes && xs_fileinfostil->subTunes[n]) { | 240 if (xs_fileinfostil && n <= xs_fileinfostil->nsubTunes && xs_fileinfostil->subTunes[n]) { |
224 t_xs_stil_subnode *tmpNode = xs_fileinfostil->subTunes[n]; | 241 t_xs_stil_subnode *tmpNode = xs_fileinfostil->subTunes[n]; |
238 } | 255 } |
239 | 256 |
240 tmpMenuItem = gtk_menu_item_new_with_label(tmpStr); | 257 tmpMenuItem = gtk_menu_item_new_with_label(tmpStr); |
241 gtk_widget_show(tmpMenuItem); | 258 gtk_widget_show(tmpMenuItem); |
242 gtk_menu_append(GTK_MENU(tmpMenu), tmpMenuItem); | 259 gtk_menu_append(GTK_MENU(tmpMenu), tmpMenuItem); |
260 #ifdef AUDACIOUS_PLUGIN | |
261 g_signal_connect(G_OBJECT(tmpMenuItem), "activate", | |
262 G_CALLBACK(xs_fileinfo_subtune), tmpMenu); | |
263 #else | |
243 gtk_signal_connect(GTK_OBJECT(tmpMenuItem), "activate", | 264 gtk_signal_connect(GTK_OBJECT(tmpMenuItem), "activate", |
244 GTK_SIGNAL_FUNC(xs_fileinfo_subtune), tmpMenu); | 265 GTK_SIGNAL_FUNC(xs_fileinfo_subtune), tmpMenu); |
266 #endif | |
245 } | 267 } |
246 | 268 |
247 gtk_option_menu_set_menu(GTK_OPTION_MENU(tmpOptionMenu), tmpMenu); | 269 gtk_option_menu_set_menu(GTK_OPTION_MENU(tmpOptionMenu), tmpMenu); |
248 gtk_widget_show(tmpOptionMenu); | 270 gtk_widget_show(tmpOptionMenu); |
249 | 271 |