fileinfo.c
上传用户:wstnjxml
上传日期:2014-04-03
资源大小:7248k
文件大小:17k
源码类别:

Windows CE

开发平台:

C/C++

  1. /*  XMMS - Cross-platform multimedia player
  2.  *  Copyright (C) 1998-2000  Peter Alm, Mikael Alm, Olle Hallnas, Thomas Nilsson and 4Front Technologies
  3.  *  Copyright (C) 1999,2000  H鍁ard Kv錶en
  4.  *  Copyright (C) 2002,2003,2004,2005  Daisuke Shimamura
  5.  *
  6.  *  This program is free software; you can redistribute it and/or modify
  7.  *  it under the terms of the GNU General Public License as published by
  8.  *  the Free Software Foundation; either version 2 of the License, or
  9.  *  (at your option) any later version.
  10.  *
  11.  *  This program is distributed in the hope that it will be useful,
  12.  *  but WITHOUT ANY WARRANTY; without even the implied warranty of
  13.  *  MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
  14.  *  GNU General Public License for more details.
  15.  *
  16.  *  You should have received a copy of the GNU General Public License
  17.  *  along with this program; if not, write to the Free Software
  18.  *  Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
  19.  */
  20. #include <stdlib.h>
  21. #include <string.h> /* for strlen() */
  22. #include <sys/types.h>
  23. #include <sys/stat.h>
  24. #include <unistd.h>
  25. #include <stdarg.h>
  26. #include <gtk/gtk.h>
  27. #include "FLAC/metadata.h"
  28. #include "charset.h"
  29. #include "configure.h"
  30. #include "plugin_common/tags.h"
  31. #include "plugin_common/locale_hack.h"
  32. static GtkWidget *window = NULL;
  33. static GList *genre_list = NULL;
  34. static GtkWidget *filename_entry, *tag_frame;
  35. static GtkWidget *title_entry, *artist_entry, *album_entry, *date_entry, *tracknum_entry, *comment_entry;
  36. static GtkWidget *genre_combo;
  37. static GtkWidget *flac_samplerate, *flac_channels, *flac_bits_per_sample, *flac_blocksize, *flac_filesize, *flac_samples, *flac_bitrate;
  38. static gchar *current_filename = NULL;
  39. static FLAC__StreamMetadata *tags_ = NULL;
  40. static const gchar *vorbis_genres[] =
  41. {
  42. N_("Blues"), N_("Classic Rock"), N_("Country"), N_("Dance"),
  43. N_("Disco"), N_("Funk"), N_("Grunge"), N_("Hip-Hop"),
  44. N_("Jazz"), N_("Metal"), N_("New Age"), N_("Oldies"),
  45. N_("Other"), N_("Pop"), N_("R&B"), N_("Rap"), N_("Reggae"),
  46. N_("Rock"), N_("Techno"), N_("Industrial"), N_("Alternative"),
  47. N_("Ska"), N_("Death Metal"), N_("Pranks"), N_("Soundtrack"),
  48. N_("Euro-Techno"), N_("Ambient"), N_("Trip-Hop"), N_("Vocal"),
  49. N_("Jazz+Funk"), N_("Fusion"), N_("Trance"), N_("Classical"),
  50. N_("Instrumental"), N_("Acid"), N_("House"), N_("Game"),
  51. N_("Sound Clip"), N_("Gospel"), N_("Noise"), N_("Alt"),
  52. N_("Bass"), N_("Soul"), N_("Punk"), N_("Space"),
  53. N_("Meditative"), N_("Instrumental Pop"),
  54. N_("Instrumental Rock"), N_("Ethnic"), N_("Gothic"),
  55. N_("Darkwave"), N_("Techno-Industrial"), N_("Electronic"),
  56. N_("Pop-Folk"), N_("Eurodance"), N_("Dream"),
  57. N_("Southern Rock"), N_("Comedy"), N_("Cult"),
  58. N_("Gangsta Rap"), N_("Top 40"), N_("Christian Rap"),
  59. N_("Pop/Funk"), N_("Jungle"), N_("Native American"),
  60. N_("Cabaret"), N_("New Wave"), N_("Psychedelic"), N_("Rave"),
  61. N_("Showtunes"), N_("Trailer"), N_("Lo-Fi"), N_("Tribal"),
  62. N_("Acid Punk"), N_("Acid Jazz"), N_("Polka"), N_("Retro"),
  63. N_("Musical"), N_("Rock & Roll"), N_("Hard Rock"), N_("Folk"),
  64. N_("Folk/Rock"), N_("National Folk"), N_("Swing"),
  65. N_("Fast-Fusion"), N_("Bebob"), N_("Latin"), N_("Revival"),
  66. N_("Celtic"), N_("Bluegrass"), N_("Avantgarde"),
  67. N_("Gothic Rock"), N_("Progressive Rock"),
  68. N_("Psychedelic Rock"), N_("Symphonic Rock"), N_("Slow Rock"),
  69. N_("Big Band"), N_("Chorus"), N_("Easy Listening"),
  70. N_("Acoustic"), N_("Humour"), N_("Speech"), N_("Chanson"),
  71. N_("Opera"), N_("Chamber Music"), N_("Sonata"), N_("Symphony"),
  72. N_("Booty Bass"), N_("Primus"), N_("Porn Groove"),
  73. N_("Satire"), N_("Slow Jam"), N_("Club"), N_("Tango"),
  74. N_("Samba"), N_("Folklore"), N_("Ballad"), N_("Power Ballad"),
  75. N_("Rhythmic Soul"), N_("Freestyle"), N_("Duet"),
  76. N_("Punk Rock"), N_("Drum Solo"), N_("A Cappella"),
  77. N_("Euro-House"), N_("Dance Hall"), N_("Goa"),
  78. N_("Drum & Bass"), N_("Club-House"), N_("Hardcore"),
  79. N_("Terror"), N_("Indie"), N_("BritPop"), N_("Negerpunk"),
  80. N_("Polsk Punk"), N_("Beat"), N_("Christian Gangsta Rap"),
  81. N_("Heavy Metal"), N_("Black Metal"), N_("Crossover"),
  82. N_("Contemporary Christian"), N_("Christian Rock"),
  83. N_("Merengue"), N_("Salsa"), N_("Thrash Metal"),
  84. N_("Anime"), N_("JPop"), N_("Synthpop")
  85. };
  86. static void label_set_text(GtkWidget * label, char *str, ...)
  87. {
  88. va_list args;
  89. gchar *tempstr;
  90. va_start(args, str);
  91. tempstr = g_strdup_vprintf(str, args);
  92. va_end(args);
  93. gtk_label_set_text(GTK_LABEL(label), tempstr);
  94. g_free(tempstr);
  95. }
  96. static void set_entry_tag(GtkEntry * entry, const char * utf8)
  97. {
  98. if(utf8) {
  99. if(flac_cfg.title.convert_char_set) {
  100. char *text = convert_from_utf8_to_user(utf8);
  101. gtk_entry_set_text(entry, text);
  102. free(text);
  103. }
  104. else
  105. gtk_entry_set_text(entry, utf8);
  106. }
  107. else
  108. gtk_entry_set_text(entry, "");
  109. }
  110. static void get_entry_tag(GtkEntry * entry, const char *name)
  111. {
  112. gchar *text;
  113. char *utf8;
  114. text = gtk_entry_get_text(entry);
  115. if (!text || strlen(text) == 0)
  116. return;
  117. if(flac_cfg.title.convert_char_set)
  118. utf8 = convert_from_user_to_utf8(text);
  119. else
  120. utf8 = text;
  121. FLAC_plugin__tags_add_tag_utf8(tags_, name, utf8, /*separator=*/0);
  122. if(flac_cfg.title.convert_char_set)
  123. free(utf8);
  124. }
  125. static void show_tag()
  126. {
  127. set_entry_tag(GTK_ENTRY(title_entry)                  , FLAC_plugin__tags_get_tag_utf8(tags_, "TITLE"));
  128. set_entry_tag(GTK_ENTRY(artist_entry)                 , FLAC_plugin__tags_get_tag_utf8(tags_, "ARTIST"));
  129. set_entry_tag(GTK_ENTRY(album_entry)                  , FLAC_plugin__tags_get_tag_utf8(tags_, "ALBUM"));
  130. set_entry_tag(GTK_ENTRY(date_entry)                   , FLAC_plugin__tags_get_tag_utf8(tags_, "DATE"));
  131. set_entry_tag(GTK_ENTRY(tracknum_entry)               , FLAC_plugin__tags_get_tag_utf8(tags_, "TRACKNUMBER"));
  132. set_entry_tag(GTK_ENTRY(comment_entry)                , FLAC_plugin__tags_get_tag_utf8(tags_, "DESCRIPTION"));
  133. set_entry_tag(GTK_ENTRY(GTK_COMBO(genre_combo)->entry), FLAC_plugin__tags_get_tag_utf8(tags_, "GENRE"));
  134. }
  135. static void save_tag(GtkWidget * w, gpointer data)
  136. {
  137. (void)w;
  138. (void)data;
  139. FLAC_plugin__tags_delete_tag(tags_, "TITLE");
  140. FLAC_plugin__tags_delete_tag(tags_, "ARTIST");
  141. FLAC_plugin__tags_delete_tag(tags_, "ALBUM");
  142. FLAC_plugin__tags_delete_tag(tags_, "DATE");
  143. FLAC_plugin__tags_delete_tag(tags_, "TRACKNUMBER");
  144. FLAC_plugin__tags_delete_tag(tags_, "DESCRIPTION");
  145. FLAC_plugin__tags_delete_tag(tags_, "GENRE");
  146. get_entry_tag(GTK_ENTRY(title_entry)                  , "TITLE");
  147. get_entry_tag(GTK_ENTRY(artist_entry)                 , "ARTIST");
  148. get_entry_tag(GTK_ENTRY(album_entry)                  , "ALBUM");
  149. get_entry_tag(GTK_ENTRY(date_entry)                   , "DATE");
  150. get_entry_tag(GTK_ENTRY(tracknum_entry)               , "TRACKNUMBER");
  151. get_entry_tag(GTK_ENTRY(comment_entry)                , "DESCRIPTION");
  152. get_entry_tag(GTK_ENTRY(GTK_COMBO(genre_combo)->entry), "GENRE");
  153. FLAC_plugin__tags_set(current_filename, tags_);
  154. gtk_widget_destroy(window);
  155. }
  156. static void remove_tag(GtkWidget * w, gpointer data)
  157. {
  158. (void)w;
  159. (void)data;
  160. FLAC_plugin__tags_delete_tag(tags_, "TITLE");
  161. FLAC_plugin__tags_delete_tag(tags_, "ARTIST");
  162. FLAC_plugin__tags_delete_tag(tags_, "ALBUM");
  163. FLAC_plugin__tags_delete_tag(tags_, "DATE");
  164. FLAC_plugin__tags_delete_tag(tags_, "TRACKNUMBER");
  165. FLAC_plugin__tags_delete_tag(tags_, "DESCRIPTION");
  166. FLAC_plugin__tags_delete_tag(tags_, "GENRE");
  167. FLAC_plugin__tags_set(current_filename, tags_);
  168. gtk_widget_destroy(window);
  169. }
  170. static void show_file_info()
  171. {
  172. FLAC__StreamMetadata streaminfo;
  173. struct stat _stat;
  174. gtk_label_set_text(GTK_LABEL(flac_samplerate), "");
  175. gtk_label_set_text(GTK_LABEL(flac_channels), "");
  176. gtk_label_set_text(GTK_LABEL(flac_bits_per_sample), "");
  177. gtk_label_set_text(GTK_LABEL(flac_blocksize), "");
  178. gtk_label_set_text(GTK_LABEL(flac_filesize), "");
  179. gtk_label_set_text(GTK_LABEL(flac_samples), "");
  180. gtk_label_set_text(GTK_LABEL(flac_bitrate), "");
  181. if(!FLAC__metadata_get_streaminfo(current_filename, &streaminfo)) {
  182. return;
  183. }
  184. label_set_text(flac_samplerate, _("Samplerate: %d Hz"), streaminfo.data.stream_info.sample_rate);
  185. label_set_text(flac_channels, _("Channels: %d"), streaminfo.data.stream_info.channels);
  186. label_set_text(flac_bits_per_sample, _("Bits/Sample: %d"), streaminfo.data.stream_info.bits_per_sample);
  187. if(streaminfo.data.stream_info.min_blocksize == streaminfo.data.stream_info.max_blocksize)
  188. label_set_text(flac_blocksize, _("Blocksize: %d"), streaminfo.data.stream_info.min_blocksize);
  189. else
  190. label_set_text(flac_blocksize, _("Blocksize: variablen  min/max: %d/%d"), streaminfo.data.stream_info.min_blocksize, streaminfo.data.stream_info.max_blocksize);
  191. if (streaminfo.data.stream_info.total_samples)
  192. label_set_text(flac_samples, _("Samples: %llunLength: %d:%.2d"),
  193. streaminfo.data.stream_info.total_samples,
  194. (int)(streaminfo.data.stream_info.total_samples / streaminfo.data.stream_info.sample_rate / 60),
  195. (int)(streaminfo.data.stream_info.total_samples / streaminfo.data.stream_info.sample_rate % 60));
  196. if(!stat(current_filename, &_stat) && S_ISREG(_stat.st_mode)) {
  197. label_set_text(flac_filesize, _("Filesize: %ld B"), _stat.st_size);
  198. if (streaminfo.data.stream_info.total_samples)
  199. label_set_text(flac_bitrate, _("Avg. bitrate: %.1f kb/snCompression ratio: %.1f%%"),
  200. 8.0 * (float)(_stat.st_size) / (1000.0 * (float)streaminfo.data.stream_info.total_samples / (float)streaminfo.data.stream_info.sample_rate),
  201. 100.0 * (float)_stat.st_size / (float)(streaminfo.data.stream_info.bits_per_sample / 8 * streaminfo.data.stream_info.channels * streaminfo.data.stream_info.total_samples));
  202. }
  203. }
  204. void FLAC_XMMS__file_info_box(char *filename)
  205. {
  206. unsigned i;
  207. gchar *title;
  208. if (!window)
  209. {
  210. GtkWidget *vbox, *hbox, *left_vbox, *table;
  211. GtkWidget *flac_frame, *flac_box;
  212. GtkWidget *label, *filename_hbox;
  213. GtkWidget *bbox, *save, *remove, *cancel;
  214. window = gtk_window_new(GTK_WINDOW_DIALOG);
  215. gtk_window_set_policy(GTK_WINDOW(window), FALSE, FALSE, FALSE);
  216. gtk_signal_connect(GTK_OBJECT(window), "destroy", GTK_SIGNAL_FUNC(gtk_widget_destroyed), &window);
  217. gtk_container_set_border_width(GTK_CONTAINER(window), 10);
  218. vbox = gtk_vbox_new(FALSE, 10);
  219. gtk_container_add(GTK_CONTAINER(window), vbox);
  220. filename_hbox = gtk_hbox_new(FALSE, 5);
  221. gtk_box_pack_start(GTK_BOX(vbox), filename_hbox, FALSE, TRUE, 0);
  222. label = gtk_label_new(_("Filename:"));
  223. gtk_box_pack_start(GTK_BOX(filename_hbox), label, FALSE, TRUE, 0);
  224. filename_entry = gtk_entry_new();
  225. gtk_editable_set_editable(GTK_EDITABLE(filename_entry), FALSE);
  226. gtk_box_pack_start(GTK_BOX(filename_hbox), filename_entry, TRUE, TRUE, 0);
  227. hbox = gtk_hbox_new(FALSE, 10);
  228. gtk_box_pack_start(GTK_BOX(vbox), hbox, FALSE, TRUE, 0);
  229. left_vbox = gtk_vbox_new(FALSE, 10);
  230. gtk_box_pack_start(GTK_BOX(hbox), left_vbox, FALSE, FALSE, 0);
  231. tag_frame = gtk_frame_new(_("Tag:"));
  232. gtk_box_pack_start(GTK_BOX(left_vbox), tag_frame, FALSE, FALSE, 0);
  233. table = gtk_table_new(5, 5, FALSE);
  234. gtk_container_set_border_width(GTK_CONTAINER(table), 5);
  235. gtk_container_add(GTK_CONTAINER(tag_frame), table);
  236. label = gtk_label_new(_("Title:"));
  237. gtk_misc_set_alignment(GTK_MISC(label), 1, 0.5);
  238. gtk_table_attach(GTK_TABLE(table), label, 0, 1, 0, 1, GTK_FILL, GTK_FILL, 5, 5);
  239. title_entry = gtk_entry_new();
  240. gtk_table_attach(GTK_TABLE(table), title_entry, 1, 4, 0, 1, GTK_FILL | GTK_EXPAND | GTK_SHRINK, GTK_FILL | GTK_EXPAND | GTK_SHRINK, 0, 5);
  241. label = gtk_label_new(_("Artist:"));
  242. gtk_misc_set_alignment(GTK_MISC(label), 1, 0.5);
  243. gtk_table_attach(GTK_TABLE(table), label, 0, 1, 1, 2, GTK_FILL, GTK_FILL, 5, 5);
  244. artist_entry = gtk_entry_new();
  245. gtk_table_attach(GTK_TABLE(table), artist_entry, 1, 4, 1, 2, GTK_FILL | GTK_EXPAND | GTK_SHRINK, GTK_FILL | GTK_EXPAND | GTK_SHRINK, 0, 5);
  246. label = gtk_label_new(_("Album:"));
  247. gtk_misc_set_alignment(GTK_MISC(label), 1, 0.5);
  248. gtk_table_attach(GTK_TABLE(table), label, 0, 1, 2, 3, GTK_FILL, GTK_FILL, 5, 5);
  249. album_entry = gtk_entry_new();
  250. gtk_table_attach(GTK_TABLE(table), album_entry, 1, 4, 2, 3, GTK_FILL | GTK_EXPAND | GTK_SHRINK, GTK_FILL | GTK_EXPAND | GTK_SHRINK, 0, 5);
  251. label = gtk_label_new(_("Comment:"));
  252. gtk_misc_set_alignment(GTK_MISC(label), 1, 0.5);
  253. gtk_table_attach(GTK_TABLE(table), label, 0, 1, 3, 4, GTK_FILL, GTK_FILL, 5, 5);
  254. comment_entry = gtk_entry_new();
  255. gtk_table_attach(GTK_TABLE(table), comment_entry, 1, 4, 3, 4, GTK_FILL | GTK_EXPAND | GTK_SHRINK, GTK_FILL | GTK_EXPAND | GTK_SHRINK, 0, 5);
  256. label = gtk_label_new(_("Date:"));
  257. gtk_misc_set_alignment(GTK_MISC(label), 1, 0.5);
  258. gtk_table_attach(GTK_TABLE(table), label, 0, 1, 4, 5, GTK_FILL, GTK_FILL, 5, 5);
  259. date_entry = gtk_entry_new();
  260. gtk_widget_set_usize(date_entry, 40, -1);
  261. gtk_table_attach(GTK_TABLE(table), date_entry, 1, 2, 4, 5, GTK_FILL | GTK_EXPAND | GTK_SHRINK, GTK_FILL | GTK_EXPAND | GTK_SHRINK, 0, 5);
  262. label = gtk_label_new(_("Track number:"));
  263. gtk_misc_set_alignment(GTK_MISC(label), 1, 0.5);
  264. gtk_table_attach(GTK_TABLE(table), label, 2, 3, 4, 5, GTK_FILL, GTK_FILL, 5, 5);
  265. tracknum_entry = gtk_entry_new();
  266. gtk_widget_set_usize(tracknum_entry, 40, -1);
  267. gtk_table_attach(GTK_TABLE(table), tracknum_entry, 3, 4, 4, 5, GTK_FILL | GTK_EXPAND | GTK_SHRINK, GTK_FILL | GTK_EXPAND | GTK_SHRINK, 0, 5);
  268. label = gtk_label_new(_("Genre:"));
  269. gtk_misc_set_alignment(GTK_MISC(label), 1, 0.5);
  270. gtk_table_attach(GTK_TABLE(table), label, 0, 1, 5, 6, GTK_FILL, GTK_FILL, 5, 5);
  271. genre_combo = gtk_combo_new();
  272. gtk_entry_set_editable(GTK_ENTRY(GTK_COMBO(genre_combo)->entry), TRUE);
  273. if (!genre_list)
  274. {
  275. for (i = 0; i < sizeof(vorbis_genres) / sizeof(*vorbis_genres) ; i++)
  276. genre_list = g_list_prepend(genre_list, (char *)vorbis_genres[i]);
  277. genre_list = g_list_prepend(genre_list, "");
  278. genre_list = g_list_sort(genre_list, (GCompareFunc)g_strcasecmp);
  279. }
  280. gtk_combo_set_popdown_strings(GTK_COMBO(genre_combo), genre_list);
  281. gtk_table_attach(GTK_TABLE(table), genre_combo, 1, 4, 5, 6, GTK_FILL | GTK_EXPAND | GTK_SHRINK, GTK_FILL | GTK_EXPAND | GTK_SHRINK, 0, 5);
  282. bbox = gtk_hbutton_box_new();
  283. gtk_button_box_set_layout(GTK_BUTTON_BOX(bbox), GTK_BUTTONBOX_END);
  284. gtk_button_box_set_spacing(GTK_BUTTON_BOX(bbox), 5);
  285. gtk_box_pack_start(GTK_BOX(left_vbox), bbox, FALSE, FALSE, 0);
  286. save = gtk_button_new_with_label(_("Save"));
  287. gtk_signal_connect(GTK_OBJECT(save), "clicked", GTK_SIGNAL_FUNC(save_tag), NULL);
  288. GTK_WIDGET_SET_FLAGS(save, GTK_CAN_DEFAULT);
  289. gtk_box_pack_start(GTK_BOX(bbox), save, TRUE, TRUE, 0);
  290. gtk_widget_grab_default(save);
  291. remove= gtk_button_new_with_label(_("Remove Tag"));
  292. gtk_signal_connect(GTK_OBJECT(remove), "clicked", GTK_SIGNAL_FUNC(remove_tag), NULL);
  293. GTK_WIDGET_SET_FLAGS(remove, GTK_CAN_DEFAULT);
  294. gtk_box_pack_start(GTK_BOX(bbox), remove, TRUE, TRUE, 0);
  295. cancel = gtk_button_new_with_label(_("Cancel"));
  296. gtk_signal_connect_object(GTK_OBJECT(cancel), "clicked", GTK_SIGNAL_FUNC(gtk_widget_destroy), GTK_OBJECT(window));
  297. GTK_WIDGET_SET_FLAGS(cancel, GTK_CAN_DEFAULT);
  298. gtk_box_pack_start(GTK_BOX(bbox), cancel, TRUE, TRUE, 0);
  299. flac_frame = gtk_frame_new(_("FLAC Info:"));
  300. gtk_box_pack_start(GTK_BOX(hbox), flac_frame, FALSE, FALSE, 0);
  301. flac_box = gtk_vbox_new(FALSE, 5);
  302. gtk_container_add(GTK_CONTAINER(flac_frame), flac_box);
  303. gtk_container_set_border_width(GTK_CONTAINER(flac_box), 10);
  304. gtk_box_set_spacing(GTK_BOX(flac_box), 0);
  305. flac_samplerate = gtk_label_new("");
  306. gtk_misc_set_alignment(GTK_MISC(flac_samplerate), 0, 0);
  307. gtk_label_set_justify(GTK_LABEL(flac_samplerate), GTK_JUSTIFY_LEFT);
  308. gtk_box_pack_start(GTK_BOX(flac_box), flac_samplerate, FALSE, FALSE, 0);
  309. flac_channels = gtk_label_new("");
  310. gtk_misc_set_alignment(GTK_MISC(flac_channels), 0, 0);
  311. gtk_label_set_justify(GTK_LABEL(flac_channels), GTK_JUSTIFY_LEFT);
  312. gtk_box_pack_start(GTK_BOX(flac_box), flac_channels, FALSE, FALSE, 0);
  313. flac_bits_per_sample = gtk_label_new("");
  314. gtk_misc_set_alignment(GTK_MISC(flac_bits_per_sample), 0, 0);
  315. gtk_label_set_justify(GTK_LABEL(flac_bits_per_sample), GTK_JUSTIFY_LEFT);
  316. gtk_box_pack_start(GTK_BOX(flac_box), flac_bits_per_sample, FALSE, FALSE, 0);
  317. flac_blocksize = gtk_label_new("");
  318. gtk_misc_set_alignment(GTK_MISC(flac_blocksize), 0, 0);
  319. gtk_label_set_justify(GTK_LABEL(flac_blocksize), GTK_JUSTIFY_LEFT);
  320. gtk_box_pack_start(GTK_BOX(flac_box), flac_blocksize, FALSE, FALSE, 0);
  321. flac_filesize = gtk_label_new("");
  322. gtk_misc_set_alignment(GTK_MISC(flac_filesize), 0, 0);
  323. gtk_label_set_justify(GTK_LABEL(flac_filesize), GTK_JUSTIFY_LEFT);
  324. gtk_box_pack_start(GTK_BOX(flac_box), flac_filesize, FALSE, FALSE, 0);
  325. flac_samples = gtk_label_new("");
  326. gtk_misc_set_alignment(GTK_MISC(flac_samples), 0, 0);
  327. gtk_label_set_justify(GTK_LABEL(flac_samples), GTK_JUSTIFY_LEFT);
  328. gtk_box_pack_start(GTK_BOX(flac_box), flac_samples, FALSE, FALSE, 0);
  329. flac_bitrate = gtk_label_new("");
  330. gtk_misc_set_alignment(GTK_MISC(flac_bitrate), 0, 0);
  331. gtk_label_set_justify(GTK_LABEL(flac_bitrate), GTK_JUSTIFY_LEFT);
  332. gtk_box_pack_start(GTK_BOX(flac_box), flac_bitrate, FALSE, FALSE, 0);
  333. gtk_widget_show_all(window);
  334. }
  335. if(current_filename)
  336. g_free(current_filename);
  337. if(!(current_filename = g_strdup(filename)))
  338. return;
  339. title = g_strdup_printf(_("File Info - %s"), g_basename(filename));
  340. gtk_window_set_title(GTK_WINDOW(window), title);
  341. g_free(title);
  342. gtk_entry_set_text(GTK_ENTRY(filename_entry), filename);
  343. gtk_editable_set_position(GTK_EDITABLE(filename_entry), -1);
  344. if(tags_)
  345. FLAC_plugin__tags_destroy(&tags_);
  346. FLAC_plugin__tags_get(current_filename, &tags_);
  347. show_tag();
  348. show_file_info();
  349. gtk_widget_set_sensitive(tag_frame, TRUE);
  350. }