annotate Plugins/Input/aac/src/fileinfo.c @ 827:6812adf5ff2e trunk

[svn] Okay, we need to pinch more playback code to avoid false positives.
author chainsaw
date Sun, 12 Mar 2006 15:05:18 -0800
parents ee3bf186998e
children e23aec1dd3ef
Ignore whitespace changes - Everywhere: Within whitespace: At end of lines:
rev   line source
342
320f0205ad45 [svn] Initial fileinfo box, loosely based around the mpg123-clone one.
nenolod
parents:
diff changeset
1 /* BMP - Cross-platform multimedia player
320f0205ad45 [svn] Initial fileinfo box, loosely based around the mpg123-clone one.
nenolod
parents:
diff changeset
2 * Copyright (C) 2003-2004 BMP development team.
320f0205ad45 [svn] Initial fileinfo box, loosely based around the mpg123-clone one.
nenolod
parents:
diff changeset
3 *
320f0205ad45 [svn] Initial fileinfo box, loosely based around the mpg123-clone one.
nenolod
parents:
diff changeset
4 * Based on XMMS:
320f0205ad45 [svn] Initial fileinfo box, loosely based around the mpg123-clone one.
nenolod
parents:
diff changeset
5 * Copyright (C) 1998-2003 XMMS development team.
320f0205ad45 [svn] Initial fileinfo box, loosely based around the mpg123-clone one.
nenolod
parents:
diff changeset
6 *
320f0205ad45 [svn] Initial fileinfo box, loosely based around the mpg123-clone one.
nenolod
parents:
diff changeset
7 * This program is free software; you can redistribute it and/or modify
320f0205ad45 [svn] Initial fileinfo box, loosely based around the mpg123-clone one.
nenolod
parents:
diff changeset
8 * it under the terms of the GNU General Public License as published by
320f0205ad45 [svn] Initial fileinfo box, loosely based around the mpg123-clone one.
nenolod
parents:
diff changeset
9 * the Free Software Foundation; either version 2 of the License, or
320f0205ad45 [svn] Initial fileinfo box, loosely based around the mpg123-clone one.
nenolod
parents:
diff changeset
10 * (at your option) any later version.
320f0205ad45 [svn] Initial fileinfo box, loosely based around the mpg123-clone one.
nenolod
parents:
diff changeset
11 *
320f0205ad45 [svn] Initial fileinfo box, loosely based around the mpg123-clone one.
nenolod
parents:
diff changeset
12 * This program is distributed in the hope that it will be useful,
320f0205ad45 [svn] Initial fileinfo box, loosely based around the mpg123-clone one.
nenolod
parents:
diff changeset
13 * but WITHOUT ANY WARRANTY; without even the implied warranty of
320f0205ad45 [svn] Initial fileinfo box, loosely based around the mpg123-clone one.
nenolod
parents:
diff changeset
14 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
320f0205ad45 [svn] Initial fileinfo box, loosely based around the mpg123-clone one.
nenolod
parents:
diff changeset
15 * GNU General Public License for more details.
320f0205ad45 [svn] Initial fileinfo box, loosely based around the mpg123-clone one.
nenolod
parents:
diff changeset
16 *
320f0205ad45 [svn] Initial fileinfo box, loosely based around the mpg123-clone one.
nenolod
parents:
diff changeset
17 * You should have received a copy of the GNU General Public License
320f0205ad45 [svn] Initial fileinfo box, loosely based around the mpg123-clone one.
nenolod
parents:
diff changeset
18 * along with this program; if not, write to the Free Software
320f0205ad45 [svn] Initial fileinfo box, loosely based around the mpg123-clone one.
nenolod
parents:
diff changeset
19 * Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
320f0205ad45 [svn] Initial fileinfo box, loosely based around the mpg123-clone one.
nenolod
parents:
diff changeset
20 */
320f0205ad45 [svn] Initial fileinfo box, loosely based around the mpg123-clone one.
nenolod
parents:
diff changeset
21
320f0205ad45 [svn] Initial fileinfo box, loosely based around the mpg123-clone one.
nenolod
parents:
diff changeset
22 #include <glib.h>
320f0205ad45 [svn] Initial fileinfo box, loosely based around the mpg123-clone one.
nenolod
parents:
diff changeset
23 #include <glib/gi18n.h>
320f0205ad45 [svn] Initial fileinfo box, loosely based around the mpg123-clone one.
nenolod
parents:
diff changeset
24 #include <gtk/gtk.h>
320f0205ad45 [svn] Initial fileinfo box, loosely based around the mpg123-clone one.
nenolod
parents:
diff changeset
25 #include <gdk/gdkkeysyms.h>
320f0205ad45 [svn] Initial fileinfo box, loosely based around the mpg123-clone one.
nenolod
parents:
diff changeset
26 #include <stdio.h>
320f0205ad45 [svn] Initial fileinfo box, loosely based around the mpg123-clone one.
nenolod
parents:
diff changeset
27 #include <stdlib.h>
320f0205ad45 [svn] Initial fileinfo box, loosely based around the mpg123-clone one.
nenolod
parents:
diff changeset
28 #include <string.h>
320f0205ad45 [svn] Initial fileinfo box, loosely based around the mpg123-clone one.
nenolod
parents:
diff changeset
29 #include <stdarg.h>
320f0205ad45 [svn] Initial fileinfo box, loosely based around the mpg123-clone one.
nenolod
parents:
diff changeset
30
320f0205ad45 [svn] Initial fileinfo box, loosely based around the mpg123-clone one.
nenolod
parents:
diff changeset
31 #include <unistd.h>
320f0205ad45 [svn] Initial fileinfo box, loosely based around the mpg123-clone one.
nenolod
parents:
diff changeset
32 #include <fcntl.h>
320f0205ad45 [svn] Initial fileinfo box, loosely based around the mpg123-clone one.
nenolod
parents:
diff changeset
33 #include <errno.h>
320f0205ad45 [svn] Initial fileinfo box, loosely based around the mpg123-clone one.
nenolod
parents:
diff changeset
34
320f0205ad45 [svn] Initial fileinfo box, loosely based around the mpg123-clone one.
nenolod
parents:
diff changeset
35 #include "audacious/util.h"
320f0205ad45 [svn] Initial fileinfo box, loosely based around the mpg123-clone one.
nenolod
parents:
diff changeset
36 #include <libaudacious/util.h>
320f0205ad45 [svn] Initial fileinfo box, loosely based around the mpg123-clone one.
nenolod
parents:
diff changeset
37 #include <libaudacious/vfs.h>
320f0205ad45 [svn] Initial fileinfo box, loosely based around the mpg123-clone one.
nenolod
parents:
diff changeset
38 #include <libaudacious/xentry.h>
320f0205ad45 [svn] Initial fileinfo box, loosely based around the mpg123-clone one.
nenolod
parents:
diff changeset
39
320f0205ad45 [svn] Initial fileinfo box, loosely based around the mpg123-clone one.
nenolod
parents:
diff changeset
40 #include "tagging.h"
320f0205ad45 [svn] Initial fileinfo box, loosely based around the mpg123-clone one.
nenolod
parents:
diff changeset
41
320f0205ad45 [svn] Initial fileinfo box, loosely based around the mpg123-clone one.
nenolod
parents:
diff changeset
42 #include "mp3.xpm"
320f0205ad45 [svn] Initial fileinfo box, loosely based around the mpg123-clone one.
nenolod
parents:
diff changeset
43
320f0205ad45 [svn] Initial fileinfo box, loosely based around the mpg123-clone one.
nenolod
parents:
diff changeset
44 static GtkWidget *window = NULL;
320f0205ad45 [svn] Initial fileinfo box, loosely based around the mpg123-clone one.
nenolod
parents:
diff changeset
45 static GtkWidget *filename_entry, *id3_frame;
320f0205ad45 [svn] Initial fileinfo box, loosely based around the mpg123-clone one.
nenolod
parents:
diff changeset
46 static GtkWidget *title_entry, *artist_entry, *album_entry, *year_entry,
320f0205ad45 [svn] Initial fileinfo box, loosely based around the mpg123-clone one.
nenolod
parents:
diff changeset
47 *tracknum_entry, *comment_entry;
320f0205ad45 [svn] Initial fileinfo box, loosely based around the mpg123-clone one.
nenolod
parents:
diff changeset
48 static GtkWidget *genre_combo;
320f0205ad45 [svn] Initial fileinfo box, loosely based around the mpg123-clone one.
nenolod
parents:
diff changeset
49
320f0205ad45 [svn] Initial fileinfo box, loosely based around the mpg123-clone one.
nenolod
parents:
diff changeset
50 GtkWidget *vbox, *hbox, *left_vbox, *table;
320f0205ad45 [svn] Initial fileinfo box, loosely based around the mpg123-clone one.
nenolod
parents:
diff changeset
51 GtkWidget *mpeg_frame, *mpeg_box;
320f0205ad45 [svn] Initial fileinfo box, loosely based around the mpg123-clone one.
nenolod
parents:
diff changeset
52 GtkWidget *label, *filename_vbox;
320f0205ad45 [svn] Initial fileinfo box, loosely based around the mpg123-clone one.
nenolod
parents:
diff changeset
53 GtkWidget *bbox;
320f0205ad45 [svn] Initial fileinfo box, loosely based around the mpg123-clone one.
nenolod
parents:
diff changeset
54 GtkWidget *remove_id3, *cancel, *save;
320f0205ad45 [svn] Initial fileinfo box, loosely based around the mpg123-clone one.
nenolod
parents:
diff changeset
55 GtkWidget *boxx;
320f0205ad45 [svn] Initial fileinfo box, loosely based around the mpg123-clone one.
nenolod
parents:
diff changeset
56
320f0205ad45 [svn] Initial fileinfo box, loosely based around the mpg123-clone one.
nenolod
parents:
diff changeset
57 const gchar *emphasis[4];
320f0205ad45 [svn] Initial fileinfo box, loosely based around the mpg123-clone one.
nenolod
parents:
diff changeset
58 const gchar *bool_label[2];
320f0205ad45 [svn] Initial fileinfo box, loosely based around the mpg123-clone one.
nenolod
parents:
diff changeset
59
320f0205ad45 [svn] Initial fileinfo box, loosely based around the mpg123-clone one.
nenolod
parents:
diff changeset
60 static GList *genre_list = NULL;
320f0205ad45 [svn] Initial fileinfo box, loosely based around the mpg123-clone one.
nenolod
parents:
diff changeset
61 static gchar *current_filename = NULL;
320f0205ad45 [svn] Initial fileinfo box, loosely based around the mpg123-clone one.
nenolod
parents:
diff changeset
62
320f0205ad45 [svn] Initial fileinfo box, loosely based around the mpg123-clone one.
nenolod
parents:
diff changeset
63 #define MAX_STR_LEN 100
320f0205ad45 [svn] Initial fileinfo box, loosely based around the mpg123-clone one.
nenolod
parents:
diff changeset
64
408
ee3bf186998e [svn] Disable unused function: audmp4_strip_spaces
chainsaw
parents: 387
diff changeset
65 #if 0
342
320f0205ad45 [svn] Initial fileinfo box, loosely based around the mpg123-clone one.
nenolod
parents:
diff changeset
66 static guint
320f0205ad45 [svn] Initial fileinfo box, loosely based around the mpg123-clone one.
nenolod
parents:
diff changeset
67 audmp4_strip_spaces(char *src, size_t n)
320f0205ad45 [svn] Initial fileinfo box, loosely based around the mpg123-clone one.
nenolod
parents:
diff changeset
68 {
320f0205ad45 [svn] Initial fileinfo box, loosely based around the mpg123-clone one.
nenolod
parents:
diff changeset
69 gchar *space = NULL, /* last space in src */
320f0205ad45 [svn] Initial fileinfo box, loosely based around the mpg123-clone one.
nenolod
parents:
diff changeset
70 *start = src;
320f0205ad45 [svn] Initial fileinfo box, loosely based around the mpg123-clone one.
nenolod
parents:
diff changeset
71
320f0205ad45 [svn] Initial fileinfo box, loosely based around the mpg123-clone one.
nenolod
parents:
diff changeset
72 while (n--)
320f0205ad45 [svn] Initial fileinfo box, loosely based around the mpg123-clone one.
nenolod
parents:
diff changeset
73 switch (*src++) {
320f0205ad45 [svn] Initial fileinfo box, loosely based around the mpg123-clone one.
nenolod
parents:
diff changeset
74 case '\0':
320f0205ad45 [svn] Initial fileinfo box, loosely based around the mpg123-clone one.
nenolod
parents:
diff changeset
75 n = 0; /* breaks out of while loop */
320f0205ad45 [svn] Initial fileinfo box, loosely based around the mpg123-clone one.
nenolod
parents:
diff changeset
76
320f0205ad45 [svn] Initial fileinfo box, loosely based around the mpg123-clone one.
nenolod
parents:
diff changeset
77 src--;
320f0205ad45 [svn] Initial fileinfo box, loosely based around the mpg123-clone one.
nenolod
parents:
diff changeset
78 break;
320f0205ad45 [svn] Initial fileinfo box, loosely based around the mpg123-clone one.
nenolod
parents:
diff changeset
79 case ' ':
320f0205ad45 [svn] Initial fileinfo box, loosely based around the mpg123-clone one.
nenolod
parents:
diff changeset
80 if (space == NULL)
320f0205ad45 [svn] Initial fileinfo box, loosely based around the mpg123-clone one.
nenolod
parents:
diff changeset
81 space = src - 1;
320f0205ad45 [svn] Initial fileinfo box, loosely based around the mpg123-clone one.
nenolod
parents:
diff changeset
82 break;
320f0205ad45 [svn] Initial fileinfo box, loosely based around the mpg123-clone one.
nenolod
parents:
diff changeset
83 default:
320f0205ad45 [svn] Initial fileinfo box, loosely based around the mpg123-clone one.
nenolod
parents:
diff changeset
84 space = NULL; /* don't terminate intermediate spaces */
320f0205ad45 [svn] Initial fileinfo box, loosely based around the mpg123-clone one.
nenolod
parents:
diff changeset
85
320f0205ad45 [svn] Initial fileinfo box, loosely based around the mpg123-clone one.
nenolod
parents:
diff changeset
86 break;
320f0205ad45 [svn] Initial fileinfo box, loosely based around the mpg123-clone one.
nenolod
parents:
diff changeset
87 }
320f0205ad45 [svn] Initial fileinfo box, loosely based around the mpg123-clone one.
nenolod
parents:
diff changeset
88 if (space != NULL) {
320f0205ad45 [svn] Initial fileinfo box, loosely based around the mpg123-clone one.
nenolod
parents:
diff changeset
89 src = space;
320f0205ad45 [svn] Initial fileinfo box, loosely based around the mpg123-clone one.
nenolod
parents:
diff changeset
90 *src = '\0';
320f0205ad45 [svn] Initial fileinfo box, loosely based around the mpg123-clone one.
nenolod
parents:
diff changeset
91 }
320f0205ad45 [svn] Initial fileinfo box, loosely based around the mpg123-clone one.
nenolod
parents:
diff changeset
92 return src - start;
320f0205ad45 [svn] Initial fileinfo box, loosely based around the mpg123-clone one.
nenolod
parents:
diff changeset
93 }
320f0205ad45 [svn] Initial fileinfo box, loosely based around the mpg123-clone one.
nenolod
parents:
diff changeset
94
320f0205ad45 [svn] Initial fileinfo box, loosely based around the mpg123-clone one.
nenolod
parents:
diff changeset
95 static void
320f0205ad45 [svn] Initial fileinfo box, loosely based around the mpg123-clone one.
nenolod
parents:
diff changeset
96 set_entry_tag(GtkEntry * entry, gchar * tag, gint length)
320f0205ad45 [svn] Initial fileinfo box, loosely based around the mpg123-clone one.
nenolod
parents:
diff changeset
97 {
320f0205ad45 [svn] Initial fileinfo box, loosely based around the mpg123-clone one.
nenolod
parents:
diff changeset
98 gint stripped_len;
320f0205ad45 [svn] Initial fileinfo box, loosely based around the mpg123-clone one.
nenolod
parents:
diff changeset
99 gchar *text, *text_utf8;
320f0205ad45 [svn] Initial fileinfo box, loosely based around the mpg123-clone one.
nenolod
parents:
diff changeset
100
320f0205ad45 [svn] Initial fileinfo box, loosely based around the mpg123-clone one.
nenolod
parents:
diff changeset
101 stripped_len = audmp4_strip_spaces(tag, length);
320f0205ad45 [svn] Initial fileinfo box, loosely based around the mpg123-clone one.
nenolod
parents:
diff changeset
102 text = g_strdup_printf(tag);
320f0205ad45 [svn] Initial fileinfo box, loosely based around the mpg123-clone one.
nenolod
parents:
diff changeset
103
320f0205ad45 [svn] Initial fileinfo box, loosely based around the mpg123-clone one.
nenolod
parents:
diff changeset
104 if ((text_utf8 = str_to_utf8(text))) {
320f0205ad45 [svn] Initial fileinfo box, loosely based around the mpg123-clone one.
nenolod
parents:
diff changeset
105 gtk_entry_set_text(entry, text_utf8);
320f0205ad45 [svn] Initial fileinfo box, loosely based around the mpg123-clone one.
nenolod
parents:
diff changeset
106 g_free(text_utf8);
320f0205ad45 [svn] Initial fileinfo box, loosely based around the mpg123-clone one.
nenolod
parents:
diff changeset
107 }
320f0205ad45 [svn] Initial fileinfo box, loosely based around the mpg123-clone one.
nenolod
parents:
diff changeset
108 else {
320f0205ad45 [svn] Initial fileinfo box, loosely based around the mpg123-clone one.
nenolod
parents:
diff changeset
109 gtk_entry_set_text(entry, "");
320f0205ad45 [svn] Initial fileinfo box, loosely based around the mpg123-clone one.
nenolod
parents:
diff changeset
110 }
320f0205ad45 [svn] Initial fileinfo box, loosely based around the mpg123-clone one.
nenolod
parents:
diff changeset
111
320f0205ad45 [svn] Initial fileinfo box, loosely based around the mpg123-clone one.
nenolod
parents:
diff changeset
112 g_free(text);
320f0205ad45 [svn] Initial fileinfo box, loosely based around the mpg123-clone one.
nenolod
parents:
diff changeset
113 }
320f0205ad45 [svn] Initial fileinfo box, loosely based around the mpg123-clone one.
nenolod
parents:
diff changeset
114
320f0205ad45 [svn] Initial fileinfo box, loosely based around the mpg123-clone one.
nenolod
parents:
diff changeset
115 static void
320f0205ad45 [svn] Initial fileinfo box, loosely based around the mpg123-clone one.
nenolod
parents:
diff changeset
116 get_entry_tag(GtkEntry * entry, gchar * tag, gint length)
320f0205ad45 [svn] Initial fileinfo box, loosely based around the mpg123-clone one.
nenolod
parents:
diff changeset
117 {
320f0205ad45 [svn] Initial fileinfo box, loosely based around the mpg123-clone one.
nenolod
parents:
diff changeset
118 gchar *text = str_to_utf8(gtk_entry_get_text(entry));
320f0205ad45 [svn] Initial fileinfo box, loosely based around the mpg123-clone one.
nenolod
parents:
diff changeset
119 memset(tag, ' ', length);
320f0205ad45 [svn] Initial fileinfo box, loosely based around the mpg123-clone one.
nenolod
parents:
diff changeset
120 memcpy(tag, text, strlen(text) > length ? length : strlen(text));
320f0205ad45 [svn] Initial fileinfo box, loosely based around the mpg123-clone one.
nenolod
parents:
diff changeset
121 }
320f0205ad45 [svn] Initial fileinfo box, loosely based around the mpg123-clone one.
nenolod
parents:
diff changeset
122
320f0205ad45 [svn] Initial fileinfo box, loosely based around the mpg123-clone one.
nenolod
parents:
diff changeset
123 static void
320f0205ad45 [svn] Initial fileinfo box, loosely based around the mpg123-clone one.
nenolod
parents:
diff changeset
124 press_save(GtkWidget * w, gpointer data)
320f0205ad45 [svn] Initial fileinfo box, loosely based around the mpg123-clone one.
nenolod
parents:
diff changeset
125 {
320f0205ad45 [svn] Initial fileinfo box, loosely based around the mpg123-clone one.
nenolod
parents:
diff changeset
126 gtk_button_clicked(GTK_BUTTON(save));
320f0205ad45 [svn] Initial fileinfo box, loosely based around the mpg123-clone one.
nenolod
parents:
diff changeset
127 }
387
7f0e78f42032 [svn] Disable adplug if the includes are missing (or in a very lame place). Stop blowing holes in my ship.
chainsaw
parents: 342
diff changeset
128 #endif
342
320f0205ad45 [svn] Initial fileinfo box, loosely based around the mpg123-clone one.
nenolod
parents:
diff changeset
129
320f0205ad45 [svn] Initial fileinfo box, loosely based around the mpg123-clone one.
nenolod
parents:
diff changeset
130 static gint
320f0205ad45 [svn] Initial fileinfo box, loosely based around the mpg123-clone one.
nenolod
parents:
diff changeset
131 genre_comp_func(gconstpointer a, gconstpointer b)
320f0205ad45 [svn] Initial fileinfo box, loosely based around the mpg123-clone one.
nenolod
parents:
diff changeset
132 {
320f0205ad45 [svn] Initial fileinfo box, loosely based around the mpg123-clone one.
nenolod
parents:
diff changeset
133 return strcasecmp(a, b);
320f0205ad45 [svn] Initial fileinfo box, loosely based around the mpg123-clone one.
nenolod
parents:
diff changeset
134 }
320f0205ad45 [svn] Initial fileinfo box, loosely based around the mpg123-clone one.
nenolod
parents:
diff changeset
135
320f0205ad45 [svn] Initial fileinfo box, loosely based around the mpg123-clone one.
nenolod
parents:
diff changeset
136 static gboolean
320f0205ad45 [svn] Initial fileinfo box, loosely based around the mpg123-clone one.
nenolod
parents:
diff changeset
137 fileinfo_keypress_cb(GtkWidget * widget,
320f0205ad45 [svn] Initial fileinfo box, loosely based around the mpg123-clone one.
nenolod
parents:
diff changeset
138 GdkEventKey * event,
320f0205ad45 [svn] Initial fileinfo box, loosely based around the mpg123-clone one.
nenolod
parents:
diff changeset
139 gpointer data)
320f0205ad45 [svn] Initial fileinfo box, loosely based around the mpg123-clone one.
nenolod
parents:
diff changeset
140 {
320f0205ad45 [svn] Initial fileinfo box, loosely based around the mpg123-clone one.
nenolod
parents:
diff changeset
141 if (!event)
320f0205ad45 [svn] Initial fileinfo box, loosely based around the mpg123-clone one.
nenolod
parents:
diff changeset
142 return FALSE;
320f0205ad45 [svn] Initial fileinfo box, loosely based around the mpg123-clone one.
nenolod
parents:
diff changeset
143
320f0205ad45 [svn] Initial fileinfo box, loosely based around the mpg123-clone one.
nenolod
parents:
diff changeset
144 switch (event->keyval) {
320f0205ad45 [svn] Initial fileinfo box, loosely based around the mpg123-clone one.
nenolod
parents:
diff changeset
145 case GDK_Escape:
320f0205ad45 [svn] Initial fileinfo box, loosely based around the mpg123-clone one.
nenolod
parents:
diff changeset
146 gtk_widget_destroy(window);
320f0205ad45 [svn] Initial fileinfo box, loosely based around the mpg123-clone one.
nenolod
parents:
diff changeset
147 break;
320f0205ad45 [svn] Initial fileinfo box, loosely based around the mpg123-clone one.
nenolod
parents:
diff changeset
148 default:
320f0205ad45 [svn] Initial fileinfo box, loosely based around the mpg123-clone one.
nenolod
parents:
diff changeset
149 return FALSE;
320f0205ad45 [svn] Initial fileinfo box, loosely based around the mpg123-clone one.
nenolod
parents:
diff changeset
150 }
320f0205ad45 [svn] Initial fileinfo box, loosely based around the mpg123-clone one.
nenolod
parents:
diff changeset
151
320f0205ad45 [svn] Initial fileinfo box, loosely based around the mpg123-clone one.
nenolod
parents:
diff changeset
152 return TRUE;
320f0205ad45 [svn] Initial fileinfo box, loosely based around the mpg123-clone one.
nenolod
parents:
diff changeset
153 }
320f0205ad45 [svn] Initial fileinfo box, loosely based around the mpg123-clone one.
nenolod
parents:
diff changeset
154
387
7f0e78f42032 [svn] Disable adplug if the includes are missing (or in a very lame place). Stop blowing holes in my ship.
chainsaw
parents: 342
diff changeset
155 #if 0
342
320f0205ad45 [svn] Initial fileinfo box, loosely based around the mpg123-clone one.
nenolod
parents:
diff changeset
156 static void
320f0205ad45 [svn] Initial fileinfo box, loosely based around the mpg123-clone one.
nenolod
parents:
diff changeset
157 label_set_text(GtkWidget * label, gchar * str, ...)
320f0205ad45 [svn] Initial fileinfo box, loosely based around the mpg123-clone one.
nenolod
parents:
diff changeset
158 {
320f0205ad45 [svn] Initial fileinfo box, loosely based around the mpg123-clone one.
nenolod
parents:
diff changeset
159 va_list args;
320f0205ad45 [svn] Initial fileinfo box, loosely based around the mpg123-clone one.
nenolod
parents:
diff changeset
160 gchar tempstr[MAX_STR_LEN];
320f0205ad45 [svn] Initial fileinfo box, loosely based around the mpg123-clone one.
nenolod
parents:
diff changeset
161
320f0205ad45 [svn] Initial fileinfo box, loosely based around the mpg123-clone one.
nenolod
parents:
diff changeset
162 va_start(args, str);
320f0205ad45 [svn] Initial fileinfo box, loosely based around the mpg123-clone one.
nenolod
parents:
diff changeset
163 g_vsnprintf(tempstr, MAX_STR_LEN, str, args);
320f0205ad45 [svn] Initial fileinfo box, loosely based around the mpg123-clone one.
nenolod
parents:
diff changeset
164 va_end(args);
320f0205ad45 [svn] Initial fileinfo box, loosely based around the mpg123-clone one.
nenolod
parents:
diff changeset
165
320f0205ad45 [svn] Initial fileinfo box, loosely based around the mpg123-clone one.
nenolod
parents:
diff changeset
166 gtk_label_set_text(GTK_LABEL(label), tempstr);
320f0205ad45 [svn] Initial fileinfo box, loosely based around the mpg123-clone one.
nenolod
parents:
diff changeset
167 }
387
7f0e78f42032 [svn] Disable adplug if the includes are missing (or in a very lame place). Stop blowing holes in my ship.
chainsaw
parents: 342
diff changeset
168 #endif
342
320f0205ad45 [svn] Initial fileinfo box, loosely based around the mpg123-clone one.
nenolod
parents:
diff changeset
169
320f0205ad45 [svn] Initial fileinfo box, loosely based around the mpg123-clone one.
nenolod
parents:
diff changeset
170 static void
320f0205ad45 [svn] Initial fileinfo box, loosely based around the mpg123-clone one.
nenolod
parents:
diff changeset
171 change_buttons(GtkObject * object)
320f0205ad45 [svn] Initial fileinfo box, loosely based around the mpg123-clone one.
nenolod
parents:
diff changeset
172 {
320f0205ad45 [svn] Initial fileinfo box, loosely based around the mpg123-clone one.
nenolod
parents:
diff changeset
173 gtk_widget_set_sensitive(GTK_WIDGET(object), TRUE);
320f0205ad45 [svn] Initial fileinfo box, loosely based around the mpg123-clone one.
nenolod
parents:
diff changeset
174 }
320f0205ad45 [svn] Initial fileinfo box, loosely based around the mpg123-clone one.
nenolod
parents:
diff changeset
175
320f0205ad45 [svn] Initial fileinfo box, loosely based around the mpg123-clone one.
nenolod
parents:
diff changeset
176 void
320f0205ad45 [svn] Initial fileinfo box, loosely based around the mpg123-clone one.
nenolod
parents:
diff changeset
177 audmp4_file_info_box(gchar * filename)
320f0205ad45 [svn] Initial fileinfo box, loosely based around the mpg123-clone one.
nenolod
parents:
diff changeset
178 {
320f0205ad45 [svn] Initial fileinfo box, loosely based around the mpg123-clone one.
nenolod
parents:
diff changeset
179 gint i;
320f0205ad45 [svn] Initial fileinfo box, loosely based around the mpg123-clone one.
nenolod
parents:
diff changeset
180 gchar *title, *filename_utf8;
320f0205ad45 [svn] Initial fileinfo box, loosely based around the mpg123-clone one.
nenolod
parents:
diff changeset
181 MP4FileHandle mp4file;
320f0205ad45 [svn] Initial fileinfo box, loosely based around the mpg123-clone one.
nenolod
parents:
diff changeset
182
320f0205ad45 [svn] Initial fileinfo box, loosely based around the mpg123-clone one.
nenolod
parents:
diff changeset
183 emphasis[0] = _("None");
320f0205ad45 [svn] Initial fileinfo box, loosely based around the mpg123-clone one.
nenolod
parents:
diff changeset
184 emphasis[1] = _("50/15 ms");
320f0205ad45 [svn] Initial fileinfo box, loosely based around the mpg123-clone one.
nenolod
parents:
diff changeset
185 emphasis[2] = "";
320f0205ad45 [svn] Initial fileinfo box, loosely based around the mpg123-clone one.
nenolod
parents:
diff changeset
186 emphasis[3] = _("CCIT J.17");
320f0205ad45 [svn] Initial fileinfo box, loosely based around the mpg123-clone one.
nenolod
parents:
diff changeset
187 bool_label[0] = _("No");
320f0205ad45 [svn] Initial fileinfo box, loosely based around the mpg123-clone one.
nenolod
parents:
diff changeset
188 bool_label[1] = _("Yes");
320f0205ad45 [svn] Initial fileinfo box, loosely based around the mpg123-clone one.
nenolod
parents:
diff changeset
189
320f0205ad45 [svn] Initial fileinfo box, loosely based around the mpg123-clone one.
nenolod
parents:
diff changeset
190 if (!window) {
320f0205ad45 [svn] Initial fileinfo box, loosely based around the mpg123-clone one.
nenolod
parents:
diff changeset
191 GtkWidget *pixmapwid;
320f0205ad45 [svn] Initial fileinfo box, loosely based around the mpg123-clone one.
nenolod
parents:
diff changeset
192 GdkPixbuf *pixbuf;
320f0205ad45 [svn] Initial fileinfo box, loosely based around the mpg123-clone one.
nenolod
parents:
diff changeset
193 PangoAttrList *attrs;
320f0205ad45 [svn] Initial fileinfo box, loosely based around the mpg123-clone one.
nenolod
parents:
diff changeset
194 PangoAttribute *attr;
320f0205ad45 [svn] Initial fileinfo box, loosely based around the mpg123-clone one.
nenolod
parents:
diff changeset
195
320f0205ad45 [svn] Initial fileinfo box, loosely based around the mpg123-clone one.
nenolod
parents:
diff changeset
196 window = gtk_window_new(GTK_WINDOW_TOPLEVEL);
320f0205ad45 [svn] Initial fileinfo box, loosely based around the mpg123-clone one.
nenolod
parents:
diff changeset
197 gtk_window_set_type_hint(GTK_WINDOW(window),
320f0205ad45 [svn] Initial fileinfo box, loosely based around the mpg123-clone one.
nenolod
parents:
diff changeset
198 GDK_WINDOW_TYPE_HINT_DIALOG);
320f0205ad45 [svn] Initial fileinfo box, loosely based around the mpg123-clone one.
nenolod
parents:
diff changeset
199 gtk_window_set_resizable(GTK_WINDOW(window), TRUE);
320f0205ad45 [svn] Initial fileinfo box, loosely based around the mpg123-clone one.
nenolod
parents:
diff changeset
200 gtk_window_set_position(GTK_WINDOW(window), GTK_WIN_POS_CENTER);
320f0205ad45 [svn] Initial fileinfo box, loosely based around the mpg123-clone one.
nenolod
parents:
diff changeset
201 g_signal_connect(G_OBJECT(window), "destroy",
320f0205ad45 [svn] Initial fileinfo box, loosely based around the mpg123-clone one.
nenolod
parents:
diff changeset
202 G_CALLBACK(gtk_widget_destroyed), &window);
320f0205ad45 [svn] Initial fileinfo box, loosely based around the mpg123-clone one.
nenolod
parents:
diff changeset
203 gtk_container_set_border_width(GTK_CONTAINER(window), 10);
320f0205ad45 [svn] Initial fileinfo box, loosely based around the mpg123-clone one.
nenolod
parents:
diff changeset
204
320f0205ad45 [svn] Initial fileinfo box, loosely based around the mpg123-clone one.
nenolod
parents:
diff changeset
205 vbox = gtk_vbox_new(FALSE, 10);
320f0205ad45 [svn] Initial fileinfo box, loosely based around the mpg123-clone one.
nenolod
parents:
diff changeset
206 gtk_container_add(GTK_CONTAINER(window), vbox);
320f0205ad45 [svn] Initial fileinfo box, loosely based around the mpg123-clone one.
nenolod
parents:
diff changeset
207
320f0205ad45 [svn] Initial fileinfo box, loosely based around the mpg123-clone one.
nenolod
parents:
diff changeset
208
320f0205ad45 [svn] Initial fileinfo box, loosely based around the mpg123-clone one.
nenolod
parents:
diff changeset
209 filename_vbox = gtk_hbox_new(FALSE, 5);
320f0205ad45 [svn] Initial fileinfo box, loosely based around the mpg123-clone one.
nenolod
parents:
diff changeset
210 gtk_box_pack_start(GTK_BOX(vbox), filename_vbox, FALSE, TRUE, 0);
320f0205ad45 [svn] Initial fileinfo box, loosely based around the mpg123-clone one.
nenolod
parents:
diff changeset
211
320f0205ad45 [svn] Initial fileinfo box, loosely based around the mpg123-clone one.
nenolod
parents:
diff changeset
212 pixbuf = gdk_pixbuf_new_from_xpm_data((const gchar **)
320f0205ad45 [svn] Initial fileinfo box, loosely based around the mpg123-clone one.
nenolod
parents:
diff changeset
213 gnome_mime_audio_xpm);
320f0205ad45 [svn] Initial fileinfo box, loosely based around the mpg123-clone one.
nenolod
parents:
diff changeset
214 pixmapwid = gtk_image_new_from_pixbuf(pixbuf);
320f0205ad45 [svn] Initial fileinfo box, loosely based around the mpg123-clone one.
nenolod
parents:
diff changeset
215 g_object_unref(pixbuf);
320f0205ad45 [svn] Initial fileinfo box, loosely based around the mpg123-clone one.
nenolod
parents:
diff changeset
216 gtk_misc_set_alignment(GTK_MISC(pixmapwid), 0, 0);
320f0205ad45 [svn] Initial fileinfo box, loosely based around the mpg123-clone one.
nenolod
parents:
diff changeset
217 gtk_box_pack_start(GTK_BOX(filename_vbox), pixmapwid, FALSE, FALSE,
320f0205ad45 [svn] Initial fileinfo box, loosely based around the mpg123-clone one.
nenolod
parents:
diff changeset
218 0);
320f0205ad45 [svn] Initial fileinfo box, loosely based around the mpg123-clone one.
nenolod
parents:
diff changeset
219
320f0205ad45 [svn] Initial fileinfo box, loosely based around the mpg123-clone one.
nenolod
parents:
diff changeset
220 label = gtk_label_new(NULL);
320f0205ad45 [svn] Initial fileinfo box, loosely based around the mpg123-clone one.
nenolod
parents:
diff changeset
221
320f0205ad45 [svn] Initial fileinfo box, loosely based around the mpg123-clone one.
nenolod
parents:
diff changeset
222 attrs = pango_attr_list_new();
320f0205ad45 [svn] Initial fileinfo box, loosely based around the mpg123-clone one.
nenolod
parents:
diff changeset
223
320f0205ad45 [svn] Initial fileinfo box, loosely based around the mpg123-clone one.
nenolod
parents:
diff changeset
224 attr = pango_attr_weight_new(PANGO_WEIGHT_BOLD);
320f0205ad45 [svn] Initial fileinfo box, loosely based around the mpg123-clone one.
nenolod
parents:
diff changeset
225 attr->start_index = 0;
320f0205ad45 [svn] Initial fileinfo box, loosely based around the mpg123-clone one.
nenolod
parents:
diff changeset
226 attr->end_index = -1;
320f0205ad45 [svn] Initial fileinfo box, loosely based around the mpg123-clone one.
nenolod
parents:
diff changeset
227 pango_attr_list_insert(attrs, attr);
320f0205ad45 [svn] Initial fileinfo box, loosely based around the mpg123-clone one.
nenolod
parents:
diff changeset
228
320f0205ad45 [svn] Initial fileinfo box, loosely based around the mpg123-clone one.
nenolod
parents:
diff changeset
229 gtk_label_set_attributes(GTK_LABEL(label), attrs);
320f0205ad45 [svn] Initial fileinfo box, loosely based around the mpg123-clone one.
nenolod
parents:
diff changeset
230 gtk_label_set_text(GTK_LABEL(label), _("Name:"));
320f0205ad45 [svn] Initial fileinfo box, loosely based around the mpg123-clone one.
nenolod
parents:
diff changeset
231 gtk_box_pack_start(GTK_BOX(filename_vbox), label, FALSE, FALSE, 0);
320f0205ad45 [svn] Initial fileinfo box, loosely based around the mpg123-clone one.
nenolod
parents:
diff changeset
232
320f0205ad45 [svn] Initial fileinfo box, loosely based around the mpg123-clone one.
nenolod
parents:
diff changeset
233 filename_entry = gtk_entry_new();
320f0205ad45 [svn] Initial fileinfo box, loosely based around the mpg123-clone one.
nenolod
parents:
diff changeset
234 gtk_editable_set_editable(GTK_EDITABLE(filename_entry), FALSE);
320f0205ad45 [svn] Initial fileinfo box, loosely based around the mpg123-clone one.
nenolod
parents:
diff changeset
235 gtk_box_pack_start(GTK_BOX(filename_vbox), filename_entry, TRUE,
320f0205ad45 [svn] Initial fileinfo box, loosely based around the mpg123-clone one.
nenolod
parents:
diff changeset
236 TRUE, 0);
320f0205ad45 [svn] Initial fileinfo box, loosely based around the mpg123-clone one.
nenolod
parents:
diff changeset
237
320f0205ad45 [svn] Initial fileinfo box, loosely based around the mpg123-clone one.
nenolod
parents:
diff changeset
238 hbox = gtk_hbox_new(FALSE, 0);
320f0205ad45 [svn] Initial fileinfo box, loosely based around the mpg123-clone one.
nenolod
parents:
diff changeset
239 gtk_box_pack_start(GTK_BOX(vbox), hbox, FALSE, TRUE, 0);
320f0205ad45 [svn] Initial fileinfo box, loosely based around the mpg123-clone one.
nenolod
parents:
diff changeset
240
320f0205ad45 [svn] Initial fileinfo box, loosely based around the mpg123-clone one.
nenolod
parents:
diff changeset
241 /* tagging information */
320f0205ad45 [svn] Initial fileinfo box, loosely based around the mpg123-clone one.
nenolod
parents:
diff changeset
242 id3_frame = gtk_frame_new(_("Song Metadata"));
320f0205ad45 [svn] Initial fileinfo box, loosely based around the mpg123-clone one.
nenolod
parents:
diff changeset
243 gtk_box_pack_start(GTK_BOX(vbox), id3_frame, FALSE, TRUE, 0);
320f0205ad45 [svn] Initial fileinfo box, loosely based around the mpg123-clone one.
nenolod
parents:
diff changeset
244
320f0205ad45 [svn] Initial fileinfo box, loosely based around the mpg123-clone one.
nenolod
parents:
diff changeset
245 table = gtk_table_new(7, 5, FALSE);
320f0205ad45 [svn] Initial fileinfo box, loosely based around the mpg123-clone one.
nenolod
parents:
diff changeset
246 gtk_container_set_border_width(GTK_CONTAINER(table), 5);
320f0205ad45 [svn] Initial fileinfo box, loosely based around the mpg123-clone one.
nenolod
parents:
diff changeset
247 gtk_container_add(GTK_CONTAINER(id3_frame), table);
320f0205ad45 [svn] Initial fileinfo box, loosely based around the mpg123-clone one.
nenolod
parents:
diff changeset
248
320f0205ad45 [svn] Initial fileinfo box, loosely based around the mpg123-clone one.
nenolod
parents:
diff changeset
249 label = gtk_label_new(_("Title:"));
320f0205ad45 [svn] Initial fileinfo box, loosely based around the mpg123-clone one.
nenolod
parents:
diff changeset
250 gtk_misc_set_alignment(GTK_MISC(label), 1, 0.5);
320f0205ad45 [svn] Initial fileinfo box, loosely based around the mpg123-clone one.
nenolod
parents:
diff changeset
251 gtk_label_set_attributes(GTK_LABEL(label), attrs);
320f0205ad45 [svn] Initial fileinfo box, loosely based around the mpg123-clone one.
nenolod
parents:
diff changeset
252 gtk_table_attach(GTK_TABLE(table), label, 0, 1, 0, 1, GTK_FILL,
320f0205ad45 [svn] Initial fileinfo box, loosely based around the mpg123-clone one.
nenolod
parents:
diff changeset
253 GTK_FILL, 5, 5);
320f0205ad45 [svn] Initial fileinfo box, loosely based around the mpg123-clone one.
nenolod
parents:
diff changeset
254
320f0205ad45 [svn] Initial fileinfo box, loosely based around the mpg123-clone one.
nenolod
parents:
diff changeset
255 title_entry = gtk_entry_new();
320f0205ad45 [svn] Initial fileinfo box, loosely based around the mpg123-clone one.
nenolod
parents:
diff changeset
256 gtk_table_attach(GTK_TABLE(table), title_entry, 1, 6, 0, 1,
320f0205ad45 [svn] Initial fileinfo box, loosely based around the mpg123-clone one.
nenolod
parents:
diff changeset
257 GTK_FILL | GTK_EXPAND | GTK_SHRINK,
320f0205ad45 [svn] Initial fileinfo box, loosely based around the mpg123-clone one.
nenolod
parents:
diff changeset
258 GTK_FILL | GTK_EXPAND | GTK_SHRINK, 0, 5);
320f0205ad45 [svn] Initial fileinfo box, loosely based around the mpg123-clone one.
nenolod
parents:
diff changeset
259
320f0205ad45 [svn] Initial fileinfo box, loosely based around the mpg123-clone one.
nenolod
parents:
diff changeset
260 label = gtk_label_new(_("Artist:"));
320f0205ad45 [svn] Initial fileinfo box, loosely based around the mpg123-clone one.
nenolod
parents:
diff changeset
261 gtk_misc_set_alignment(GTK_MISC(label), 1, 0.5);
320f0205ad45 [svn] Initial fileinfo box, loosely based around the mpg123-clone one.
nenolod
parents:
diff changeset
262 gtk_label_set_attributes(GTK_LABEL(label), attrs);
320f0205ad45 [svn] Initial fileinfo box, loosely based around the mpg123-clone one.
nenolod
parents:
diff changeset
263 gtk_table_attach(GTK_TABLE(table), label, 0, 1, 1, 2, GTK_FILL,
320f0205ad45 [svn] Initial fileinfo box, loosely based around the mpg123-clone one.
nenolod
parents:
diff changeset
264 GTK_FILL, 5, 5);
320f0205ad45 [svn] Initial fileinfo box, loosely based around the mpg123-clone one.
nenolod
parents:
diff changeset
265
320f0205ad45 [svn] Initial fileinfo box, loosely based around the mpg123-clone one.
nenolod
parents:
diff changeset
266 artist_entry = gtk_entry_new();
320f0205ad45 [svn] Initial fileinfo box, loosely based around the mpg123-clone one.
nenolod
parents:
diff changeset
267 gtk_table_attach(GTK_TABLE(table), artist_entry, 1, 6, 1, 2,
320f0205ad45 [svn] Initial fileinfo box, loosely based around the mpg123-clone one.
nenolod
parents:
diff changeset
268 GTK_FILL | GTK_EXPAND | GTK_SHRINK,
320f0205ad45 [svn] Initial fileinfo box, loosely based around the mpg123-clone one.
nenolod
parents:
diff changeset
269 GTK_FILL | GTK_EXPAND | GTK_SHRINK, 0, 5);
320f0205ad45 [svn] Initial fileinfo box, loosely based around the mpg123-clone one.
nenolod
parents:
diff changeset
270
320f0205ad45 [svn] Initial fileinfo box, loosely based around the mpg123-clone one.
nenolod
parents:
diff changeset
271 label = gtk_label_new(_("Album:"));
320f0205ad45 [svn] Initial fileinfo box, loosely based around the mpg123-clone one.
nenolod
parents:
diff changeset
272 gtk_misc_set_alignment(GTK_MISC(label), 1, 0.5);
320f0205ad45 [svn] Initial fileinfo box, loosely based around the mpg123-clone one.
nenolod
parents:
diff changeset
273 gtk_label_set_attributes(GTK_LABEL(label), attrs);
320f0205ad45 [svn] Initial fileinfo box, loosely based around the mpg123-clone one.
nenolod
parents:
diff changeset
274 gtk_table_attach(GTK_TABLE(table), label, 0, 1, 2, 3, GTK_FILL,
320f0205ad45 [svn] Initial fileinfo box, loosely based around the mpg123-clone one.
nenolod
parents:
diff changeset
275 GTK_FILL, 5, 5);
320f0205ad45 [svn] Initial fileinfo box, loosely based around the mpg123-clone one.
nenolod
parents:
diff changeset
276
320f0205ad45 [svn] Initial fileinfo box, loosely based around the mpg123-clone one.
nenolod
parents:
diff changeset
277 album_entry = gtk_entry_new();
320f0205ad45 [svn] Initial fileinfo box, loosely based around the mpg123-clone one.
nenolod
parents:
diff changeset
278 gtk_table_attach(GTK_TABLE(table), album_entry, 1, 6, 2, 3,
320f0205ad45 [svn] Initial fileinfo box, loosely based around the mpg123-clone one.
nenolod
parents:
diff changeset
279 GTK_FILL | GTK_EXPAND | GTK_SHRINK,
320f0205ad45 [svn] Initial fileinfo box, loosely based around the mpg123-clone one.
nenolod
parents:
diff changeset
280 GTK_FILL | GTK_EXPAND | GTK_SHRINK, 0, 5);
320f0205ad45 [svn] Initial fileinfo box, loosely based around the mpg123-clone one.
nenolod
parents:
diff changeset
281
320f0205ad45 [svn] Initial fileinfo box, loosely based around the mpg123-clone one.
nenolod
parents:
diff changeset
282 label = gtk_label_new(_("Comment:"));
320f0205ad45 [svn] Initial fileinfo box, loosely based around the mpg123-clone one.
nenolod
parents:
diff changeset
283 gtk_misc_set_alignment(GTK_MISC(label), 1, 0.5);
320f0205ad45 [svn] Initial fileinfo box, loosely based around the mpg123-clone one.
nenolod
parents:
diff changeset
284 gtk_label_set_attributes(GTK_LABEL(label), attrs);
320f0205ad45 [svn] Initial fileinfo box, loosely based around the mpg123-clone one.
nenolod
parents:
diff changeset
285 gtk_table_attach(GTK_TABLE(table), label, 0, 1, 3, 4, GTK_FILL,
320f0205ad45 [svn] Initial fileinfo box, loosely based around the mpg123-clone one.
nenolod
parents:
diff changeset
286 GTK_FILL, 5, 5);
320f0205ad45 [svn] Initial fileinfo box, loosely based around the mpg123-clone one.
nenolod
parents:
diff changeset
287
320f0205ad45 [svn] Initial fileinfo box, loosely based around the mpg123-clone one.
nenolod
parents:
diff changeset
288 comment_entry = gtk_entry_new();
320f0205ad45 [svn] Initial fileinfo box, loosely based around the mpg123-clone one.
nenolod
parents:
diff changeset
289 gtk_table_attach(GTK_TABLE(table), comment_entry, 1, 6, 3, 4,
320f0205ad45 [svn] Initial fileinfo box, loosely based around the mpg123-clone one.
nenolod
parents:
diff changeset
290 GTK_FILL | GTK_EXPAND | GTK_SHRINK,
320f0205ad45 [svn] Initial fileinfo box, loosely based around the mpg123-clone one.
nenolod
parents:
diff changeset
291 GTK_FILL | GTK_EXPAND | GTK_SHRINK, 0, 5);
320f0205ad45 [svn] Initial fileinfo box, loosely based around the mpg123-clone one.
nenolod
parents:
diff changeset
292
320f0205ad45 [svn] Initial fileinfo box, loosely based around the mpg123-clone one.
nenolod
parents:
diff changeset
293 label = gtk_label_new(_("Year:"));
320f0205ad45 [svn] Initial fileinfo box, loosely based around the mpg123-clone one.
nenolod
parents:
diff changeset
294 gtk_misc_set_alignment(GTK_MISC(label), 1, 0.5);
320f0205ad45 [svn] Initial fileinfo box, loosely based around the mpg123-clone one.
nenolod
parents:
diff changeset
295 gtk_label_set_attributes(GTK_LABEL(label), attrs);
320f0205ad45 [svn] Initial fileinfo box, loosely based around the mpg123-clone one.
nenolod
parents:
diff changeset
296 gtk_table_attach(GTK_TABLE(table), label, 0, 1, 4, 5, GTK_FILL,
320f0205ad45 [svn] Initial fileinfo box, loosely based around the mpg123-clone one.
nenolod
parents:
diff changeset
297 GTK_FILL, 5, 5);
320f0205ad45 [svn] Initial fileinfo box, loosely based around the mpg123-clone one.
nenolod
parents:
diff changeset
298
320f0205ad45 [svn] Initial fileinfo box, loosely based around the mpg123-clone one.
nenolod
parents:
diff changeset
299 year_entry = gtk_entry_new();
320f0205ad45 [svn] Initial fileinfo box, loosely based around the mpg123-clone one.
nenolod
parents:
diff changeset
300 gtk_entry_set_width_chars(GTK_ENTRY(year_entry),4);
320f0205ad45 [svn] Initial fileinfo box, loosely based around the mpg123-clone one.
nenolod
parents:
diff changeset
301 gtk_table_attach(GTK_TABLE(table), year_entry, 1, 2, 4, 5,
320f0205ad45 [svn] Initial fileinfo box, loosely based around the mpg123-clone one.
nenolod
parents:
diff changeset
302 GTK_FILL | GTK_EXPAND | GTK_SHRINK,
320f0205ad45 [svn] Initial fileinfo box, loosely based around the mpg123-clone one.
nenolod
parents:
diff changeset
303 GTK_FILL | GTK_EXPAND | GTK_SHRINK, 0, 5);
320f0205ad45 [svn] Initial fileinfo box, loosely based around the mpg123-clone one.
nenolod
parents:
diff changeset
304
320f0205ad45 [svn] Initial fileinfo box, loosely based around the mpg123-clone one.
nenolod
parents:
diff changeset
305 label = gtk_label_new(_("Track number:"));
320f0205ad45 [svn] Initial fileinfo box, loosely based around the mpg123-clone one.
nenolod
parents:
diff changeset
306 gtk_misc_set_alignment(GTK_MISC(label), 1, 0.5);
320f0205ad45 [svn] Initial fileinfo box, loosely based around the mpg123-clone one.
nenolod
parents:
diff changeset
307 gtk_label_set_attributes(GTK_LABEL(label), attrs);
320f0205ad45 [svn] Initial fileinfo box, loosely based around the mpg123-clone one.
nenolod
parents:
diff changeset
308 gtk_table_attach(GTK_TABLE(table), label, 2, 3, 4, 5, GTK_FILL,
320f0205ad45 [svn] Initial fileinfo box, loosely based around the mpg123-clone one.
nenolod
parents:
diff changeset
309 GTK_FILL, 5, 5);
320f0205ad45 [svn] Initial fileinfo box, loosely based around the mpg123-clone one.
nenolod
parents:
diff changeset
310
320f0205ad45 [svn] Initial fileinfo box, loosely based around the mpg123-clone one.
nenolod
parents:
diff changeset
311 tracknum_entry = gtk_entry_new();
320f0205ad45 [svn] Initial fileinfo box, loosely based around the mpg123-clone one.
nenolod
parents:
diff changeset
312 gtk_widget_set_usize(tracknum_entry, 40, -1);
320f0205ad45 [svn] Initial fileinfo box, loosely based around the mpg123-clone one.
nenolod
parents:
diff changeset
313 gtk_table_attach(GTK_TABLE(table), tracknum_entry, 3, 4, 4, 5,
320f0205ad45 [svn] Initial fileinfo box, loosely based around the mpg123-clone one.
nenolod
parents:
diff changeset
314 GTK_FILL | GTK_EXPAND | GTK_SHRINK,
320f0205ad45 [svn] Initial fileinfo box, loosely based around the mpg123-clone one.
nenolod
parents:
diff changeset
315 GTK_FILL | GTK_EXPAND | GTK_SHRINK, 0, 5);
320f0205ad45 [svn] Initial fileinfo box, loosely based around the mpg123-clone one.
nenolod
parents:
diff changeset
316
320f0205ad45 [svn] Initial fileinfo box, loosely based around the mpg123-clone one.
nenolod
parents:
diff changeset
317 pango_attr_list_unref(attrs);
320f0205ad45 [svn] Initial fileinfo box, loosely based around the mpg123-clone one.
nenolod
parents:
diff changeset
318
320f0205ad45 [svn] Initial fileinfo box, loosely based around the mpg123-clone one.
nenolod
parents:
diff changeset
319 label = gtk_label_new(_("Genre:"));
320f0205ad45 [svn] Initial fileinfo box, loosely based around the mpg123-clone one.
nenolod
parents:
diff changeset
320 gtk_misc_set_alignment(GTK_MISC(label), 1, 0.5);
320f0205ad45 [svn] Initial fileinfo box, loosely based around the mpg123-clone one.
nenolod
parents:
diff changeset
321 gtk_label_set_attributes(GTK_LABEL(label), attrs);
320f0205ad45 [svn] Initial fileinfo box, loosely based around the mpg123-clone one.
nenolod
parents:
diff changeset
322 gtk_table_attach(GTK_TABLE(table), label, 0, 1, 5, 6, GTK_FILL,
320f0205ad45 [svn] Initial fileinfo box, loosely based around the mpg123-clone one.
nenolod
parents:
diff changeset
323 GTK_FILL, 5, 5);
320f0205ad45 [svn] Initial fileinfo box, loosely based around the mpg123-clone one.
nenolod
parents:
diff changeset
324
320f0205ad45 [svn] Initial fileinfo box, loosely based around the mpg123-clone one.
nenolod
parents:
diff changeset
325 genre_combo = gtk_combo_new();
320f0205ad45 [svn] Initial fileinfo box, loosely based around the mpg123-clone one.
nenolod
parents:
diff changeset
326 gtk_entry_set_editable(GTK_ENTRY(GTK_COMBO(genre_combo)->entry),
320f0205ad45 [svn] Initial fileinfo box, loosely based around the mpg123-clone one.
nenolod
parents:
diff changeset
327 FALSE);
320f0205ad45 [svn] Initial fileinfo box, loosely based around the mpg123-clone one.
nenolod
parents:
diff changeset
328 if (!genre_list) {
320f0205ad45 [svn] Initial fileinfo box, loosely based around the mpg123-clone one.
nenolod
parents:
diff changeset
329 for (i = 0; i < GENRE_MAX; i++)
320f0205ad45 [svn] Initial fileinfo box, loosely based around the mpg123-clone one.
nenolod
parents:
diff changeset
330 genre_list =
320f0205ad45 [svn] Initial fileinfo box, loosely based around the mpg123-clone one.
nenolod
parents:
diff changeset
331 g_list_prepend(genre_list,
387
7f0e78f42032 [svn] Disable adplug if the includes are missing (or in a very lame place). Stop blowing holes in my ship.
chainsaw
parents: 342
diff changeset
332 (gchar *) audmp4_id3_genres[i]);
342
320f0205ad45 [svn] Initial fileinfo box, loosely based around the mpg123-clone one.
nenolod
parents:
diff changeset
333 genre_list = g_list_prepend(genre_list, "");
320f0205ad45 [svn] Initial fileinfo box, loosely based around the mpg123-clone one.
nenolod
parents:
diff changeset
334 genre_list = g_list_sort(genre_list, genre_comp_func);
320f0205ad45 [svn] Initial fileinfo box, loosely based around the mpg123-clone one.
nenolod
parents:
diff changeset
335 }
320f0205ad45 [svn] Initial fileinfo box, loosely based around the mpg123-clone one.
nenolod
parents:
diff changeset
336 gtk_combo_set_popdown_strings(GTK_COMBO(genre_combo), genre_list);
320f0205ad45 [svn] Initial fileinfo box, loosely based around the mpg123-clone one.
nenolod
parents:
diff changeset
337
320f0205ad45 [svn] Initial fileinfo box, loosely based around the mpg123-clone one.
nenolod
parents:
diff changeset
338 gtk_table_attach(GTK_TABLE(table), genre_combo, 1, 6, 5, 6,
320f0205ad45 [svn] Initial fileinfo box, loosely based around the mpg123-clone one.
nenolod
parents:
diff changeset
339 GTK_FILL | GTK_EXPAND | GTK_SHRINK,
320f0205ad45 [svn] Initial fileinfo box, loosely based around the mpg123-clone one.
nenolod
parents:
diff changeset
340 GTK_FILL | GTK_EXPAND | GTK_SHRINK, 0, 5);
320f0205ad45 [svn] Initial fileinfo box, loosely based around the mpg123-clone one.
nenolod
parents:
diff changeset
341
320f0205ad45 [svn] Initial fileinfo box, loosely based around the mpg123-clone one.
nenolod
parents:
diff changeset
342 boxx = gtk_hbutton_box_new();
320f0205ad45 [svn] Initial fileinfo box, loosely based around the mpg123-clone one.
nenolod
parents:
diff changeset
343 gtk_hbutton_box_set_layout_default(GTK_BUTTONBOX_SPREAD);
320f0205ad45 [svn] Initial fileinfo box, loosely based around the mpg123-clone one.
nenolod
parents:
diff changeset
344
320f0205ad45 [svn] Initial fileinfo box, loosely based around the mpg123-clone one.
nenolod
parents:
diff changeset
345 bbox = gtk_hbutton_box_new();
320f0205ad45 [svn] Initial fileinfo box, loosely based around the mpg123-clone one.
nenolod
parents:
diff changeset
346 gtk_button_box_set_layout(GTK_BUTTON_BOX(bbox), GTK_BUTTONBOX_END);
320f0205ad45 [svn] Initial fileinfo box, loosely based around the mpg123-clone one.
nenolod
parents:
diff changeset
347 gtk_button_box_set_spacing(GTK_BUTTON_BOX(bbox), 5);
320f0205ad45 [svn] Initial fileinfo box, loosely based around the mpg123-clone one.
nenolod
parents:
diff changeset
348 gtk_box_pack_start(GTK_BOX(vbox), bbox, FALSE, TRUE, 0);
320f0205ad45 [svn] Initial fileinfo box, loosely based around the mpg123-clone one.
nenolod
parents:
diff changeset
349
320f0205ad45 [svn] Initial fileinfo box, loosely based around the mpg123-clone one.
nenolod
parents:
diff changeset
350 cancel = gtk_button_new_from_stock(GTK_STOCK_CLOSE);
320f0205ad45 [svn] Initial fileinfo box, loosely based around the mpg123-clone one.
nenolod
parents:
diff changeset
351 g_signal_connect_swapped(G_OBJECT(cancel), "clicked",
320f0205ad45 [svn] Initial fileinfo box, loosely based around the mpg123-clone one.
nenolod
parents:
diff changeset
352 G_CALLBACK(gtk_widget_destroy),
320f0205ad45 [svn] Initial fileinfo box, loosely based around the mpg123-clone one.
nenolod
parents:
diff changeset
353 G_OBJECT(window));
320f0205ad45 [svn] Initial fileinfo box, loosely based around the mpg123-clone one.
nenolod
parents:
diff changeset
354 GTK_WIDGET_SET_FLAGS(cancel, GTK_CAN_DEFAULT);
320f0205ad45 [svn] Initial fileinfo box, loosely based around the mpg123-clone one.
nenolod
parents:
diff changeset
355 gtk_box_pack_start(GTK_BOX(bbox), cancel, FALSE, FALSE, 0);
320f0205ad45 [svn] Initial fileinfo box, loosely based around the mpg123-clone one.
nenolod
parents:
diff changeset
356 gtk_widget_grab_default(cancel);
320f0205ad45 [svn] Initial fileinfo box, loosely based around the mpg123-clone one.
nenolod
parents:
diff changeset
357
320f0205ad45 [svn] Initial fileinfo box, loosely based around the mpg123-clone one.
nenolod
parents:
diff changeset
358
320f0205ad45 [svn] Initial fileinfo box, loosely based around the mpg123-clone one.
nenolod
parents:
diff changeset
359 gtk_table_set_col_spacing(GTK_TABLE(left_vbox), 1, 10);
320f0205ad45 [svn] Initial fileinfo box, loosely based around the mpg123-clone one.
nenolod
parents:
diff changeset
360
320f0205ad45 [svn] Initial fileinfo box, loosely based around the mpg123-clone one.
nenolod
parents:
diff changeset
361
320f0205ad45 [svn] Initial fileinfo box, loosely based around the mpg123-clone one.
nenolod
parents:
diff changeset
362 g_signal_connect_swapped(G_OBJECT(title_entry), "changed",
320f0205ad45 [svn] Initial fileinfo box, loosely based around the mpg123-clone one.
nenolod
parents:
diff changeset
363 G_CALLBACK(change_buttons), save);
320f0205ad45 [svn] Initial fileinfo box, loosely based around the mpg123-clone one.
nenolod
parents:
diff changeset
364 g_signal_connect_swapped(G_OBJECT(artist_entry), "changed",
320f0205ad45 [svn] Initial fileinfo box, loosely based around the mpg123-clone one.
nenolod
parents:
diff changeset
365 G_CALLBACK(change_buttons), save);
320f0205ad45 [svn] Initial fileinfo box, loosely based around the mpg123-clone one.
nenolod
parents:
diff changeset
366 g_signal_connect_swapped(G_OBJECT(album_entry), "changed",
320f0205ad45 [svn] Initial fileinfo box, loosely based around the mpg123-clone one.
nenolod
parents:
diff changeset
367 G_CALLBACK(change_buttons), save);
320f0205ad45 [svn] Initial fileinfo box, loosely based around the mpg123-clone one.
nenolod
parents:
diff changeset
368 g_signal_connect_swapped(G_OBJECT(year_entry), "changed",
320f0205ad45 [svn] Initial fileinfo box, loosely based around the mpg123-clone one.
nenolod
parents:
diff changeset
369 G_CALLBACK(change_buttons), save);
320f0205ad45 [svn] Initial fileinfo box, loosely based around the mpg123-clone one.
nenolod
parents:
diff changeset
370 g_signal_connect_swapped(G_OBJECT(comment_entry), "changed",
320f0205ad45 [svn] Initial fileinfo box, loosely based around the mpg123-clone one.
nenolod
parents:
diff changeset
371 G_CALLBACK(change_buttons), save);
320f0205ad45 [svn] Initial fileinfo box, loosely based around the mpg123-clone one.
nenolod
parents:
diff changeset
372 g_signal_connect_swapped(G_OBJECT(tracknum_entry), "changed",
320f0205ad45 [svn] Initial fileinfo box, loosely based around the mpg123-clone one.
nenolod
parents:
diff changeset
373 G_CALLBACK(change_buttons), save);
320f0205ad45 [svn] Initial fileinfo box, loosely based around the mpg123-clone one.
nenolod
parents:
diff changeset
374 g_signal_connect_swapped(G_OBJECT(GTK_COMBO(genre_combo)->entry), "changed",
320f0205ad45 [svn] Initial fileinfo box, loosely based around the mpg123-clone one.
nenolod
parents:
diff changeset
375 G_CALLBACK(change_buttons), save);
320f0205ad45 [svn] Initial fileinfo box, loosely based around the mpg123-clone one.
nenolod
parents:
diff changeset
376 g_signal_connect(G_OBJECT(window), "key_press_event",
320f0205ad45 [svn] Initial fileinfo box, loosely based around the mpg123-clone one.
nenolod
parents:
diff changeset
377 G_CALLBACK(fileinfo_keypress_cb), NULL);
320f0205ad45 [svn] Initial fileinfo box, loosely based around the mpg123-clone one.
nenolod
parents:
diff changeset
378 }
320f0205ad45 [svn] Initial fileinfo box, loosely based around the mpg123-clone one.
nenolod
parents:
diff changeset
379
320f0205ad45 [svn] Initial fileinfo box, loosely based around the mpg123-clone one.
nenolod
parents:
diff changeset
380 g_free(current_filename);
320f0205ad45 [svn] Initial fileinfo box, loosely based around the mpg123-clone one.
nenolod
parents:
diff changeset
381 current_filename = g_strdup(filename);
320f0205ad45 [svn] Initial fileinfo box, loosely based around the mpg123-clone one.
nenolod
parents:
diff changeset
382
320f0205ad45 [svn] Initial fileinfo box, loosely based around the mpg123-clone one.
nenolod
parents:
diff changeset
383 filename_utf8 = filename_to_utf8(filename);
320f0205ad45 [svn] Initial fileinfo box, loosely based around the mpg123-clone one.
nenolod
parents:
diff changeset
384
320f0205ad45 [svn] Initial fileinfo box, loosely based around the mpg123-clone one.
nenolod
parents:
diff changeset
385 title = g_strdup_printf(_("%s - Audacious"), g_basename(filename_utf8));
320f0205ad45 [svn] Initial fileinfo box, loosely based around the mpg123-clone one.
nenolod
parents:
diff changeset
386 gtk_window_set_title(GTK_WINDOW(window), title);
320f0205ad45 [svn] Initial fileinfo box, loosely based around the mpg123-clone one.
nenolod
parents:
diff changeset
387 g_free(title);
320f0205ad45 [svn] Initial fileinfo box, loosely based around the mpg123-clone one.
nenolod
parents:
diff changeset
388
320f0205ad45 [svn] Initial fileinfo box, loosely based around the mpg123-clone one.
nenolod
parents:
diff changeset
389 gtk_entry_set_text(GTK_ENTRY(filename_entry), filename_utf8);
320f0205ad45 [svn] Initial fileinfo box, loosely based around the mpg123-clone one.
nenolod
parents:
diff changeset
390 g_free(filename_utf8);
320f0205ad45 [svn] Initial fileinfo box, loosely based around the mpg123-clone one.
nenolod
parents:
diff changeset
391
320f0205ad45 [svn] Initial fileinfo box, loosely based around the mpg123-clone one.
nenolod
parents:
diff changeset
392 gtk_editable_set_position(GTK_EDITABLE(filename_entry), -1);
320f0205ad45 [svn] Initial fileinfo box, loosely based around the mpg123-clone one.
nenolod
parents:
diff changeset
393
320f0205ad45 [svn] Initial fileinfo box, loosely based around the mpg123-clone one.
nenolod
parents:
diff changeset
394 gtk_entry_set_text(GTK_ENTRY(artist_entry), "");
320f0205ad45 [svn] Initial fileinfo box, loosely based around the mpg123-clone one.
nenolod
parents:
diff changeset
395 gtk_entry_set_text(GTK_ENTRY(album_entry), "");
320f0205ad45 [svn] Initial fileinfo box, loosely based around the mpg123-clone one.
nenolod
parents:
diff changeset
396 gtk_entry_set_text(GTK_ENTRY(year_entry), "");
320f0205ad45 [svn] Initial fileinfo box, loosely based around the mpg123-clone one.
nenolod
parents:
diff changeset
397 gtk_entry_set_text(GTK_ENTRY(tracknum_entry), "");
320f0205ad45 [svn] Initial fileinfo box, loosely based around the mpg123-clone one.
nenolod
parents:
diff changeset
398 gtk_entry_set_text(GTK_ENTRY(comment_entry), "");
320f0205ad45 [svn] Initial fileinfo box, loosely based around the mpg123-clone one.
nenolod
parents:
diff changeset
399
320f0205ad45 [svn] Initial fileinfo box, loosely based around the mpg123-clone one.
nenolod
parents:
diff changeset
400 gtk_list_select_item(GTK_LIST(GTK_COMBO(genre_combo)->list),
320f0205ad45 [svn] Initial fileinfo box, loosely based around the mpg123-clone one.
nenolod
parents:
diff changeset
401 g_list_index(genre_list, ""));
320f0205ad45 [svn] Initial fileinfo box, loosely based around the mpg123-clone one.
nenolod
parents:
diff changeset
402
320f0205ad45 [svn] Initial fileinfo box, loosely based around the mpg123-clone one.
nenolod
parents:
diff changeset
403 gtk_widget_set_sensitive(id3_frame,
320f0205ad45 [svn] Initial fileinfo box, loosely based around the mpg123-clone one.
nenolod
parents:
diff changeset
404 vfs_is_writeable(filename));
320f0205ad45 [svn] Initial fileinfo box, loosely based around the mpg123-clone one.
nenolod
parents:
diff changeset
405
320f0205ad45 [svn] Initial fileinfo box, loosely based around the mpg123-clone one.
nenolod
parents:
diff changeset
406 gtk_widget_set_sensitive(GTK_WIDGET(save), FALSE);
320f0205ad45 [svn] Initial fileinfo box, loosely based around the mpg123-clone one.
nenolod
parents:
diff changeset
407
320f0205ad45 [svn] Initial fileinfo box, loosely based around the mpg123-clone one.
nenolod
parents:
diff changeset
408 /* Ok! Lets set the information now. */
320f0205ad45 [svn] Initial fileinfo box, loosely based around the mpg123-clone one.
nenolod
parents:
diff changeset
409
320f0205ad45 [svn] Initial fileinfo box, loosely based around the mpg123-clone one.
nenolod
parents:
diff changeset
410 if ((mp4file = MP4Read(filename, 0)) != NULL)
320f0205ad45 [svn] Initial fileinfo box, loosely based around the mpg123-clone one.
nenolod
parents:
diff changeset
411 {
320f0205ad45 [svn] Initial fileinfo box, loosely based around the mpg123-clone one.
nenolod
parents:
diff changeset
412 gtk_entry_set_text(GTK_ENTRY(artist_entry), audmp4_get_artist(mp4file));
320f0205ad45 [svn] Initial fileinfo box, loosely based around the mpg123-clone one.
nenolod
parents:
diff changeset
413 gtk_entry_set_text(GTK_ENTRY(title_entry), audmp4_get_title(mp4file));
320f0205ad45 [svn] Initial fileinfo box, loosely based around the mpg123-clone one.
nenolod
parents:
diff changeset
414 gtk_entry_set_text(GTK_ENTRY(year_entry), g_strdup_printf("%d", audmp4_get_year(mp4file)));
320f0205ad45 [svn] Initial fileinfo box, loosely based around the mpg123-clone one.
nenolod
parents:
diff changeset
415 gtk_entry_set_text(GTK_ENTRY(album_entry), audmp4_get_album(mp4file));
320f0205ad45 [svn] Initial fileinfo box, loosely based around the mpg123-clone one.
nenolod
parents:
diff changeset
416 }
320f0205ad45 [svn] Initial fileinfo box, loosely based around the mpg123-clone one.
nenolod
parents:
diff changeset
417
320f0205ad45 [svn] Initial fileinfo box, loosely based around the mpg123-clone one.
nenolod
parents:
diff changeset
418 gtk_widget_show_all(window);
320f0205ad45 [svn] Initial fileinfo box, loosely based around the mpg123-clone one.
nenolod
parents:
diff changeset
419 }