Mercurial > audlegacy
annotate src/audacious/ui_fileinfo.c @ 4010:ce791ae274aa
Codec info in fileinfo box moved to top
author | Eugene Zagidullin <e.asphyx@gmail.com> |
---|---|
date | Sun, 25 Nov 2007 04:32:09 +0300 |
parents | ba6258a39662 |
children | c19c8d47e221 |
rev | line source |
---|---|
2313 | 1 /* |
2 * Audacious: A cross-platform multimedia player | |
3 * Copyright (c) 2006 William Pitcock, Tony Vroon, George Averill, | |
4 * Giacomo Lozito, Derek Pomery and Yoshiki Yazawa. | |
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 | |
3121
3b6d316f8b09
GPL3 relicensing.
William Pitcock <nenolod@atheme-project.org>
parents:
3113
diff
changeset
|
8 * the Free Software Foundation; under version 3 of the License. |
2313 | 9 * |
10 * This program is distributed in the hope that it will be useful, | |
11 * but WITHOUT ANY WARRANTY; without even the implied warranty of | |
12 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the | |
13 * GNU General Public License for more details. | |
14 * | |
15 * You should have received a copy of the GNU General Public License | |
3121
3b6d316f8b09
GPL3 relicensing.
William Pitcock <nenolod@atheme-project.org>
parents:
3113
diff
changeset
|
16 * along with this program. If not, see <http://www.gnu.org/licenses>. |
3123
f1c756f39e6c
Invoke "Plugins are not derived work" clause provided by GPL3.
William Pitcock <nenolod@atheme-project.org>
parents:
3121
diff
changeset
|
17 * |
f1c756f39e6c
Invoke "Plugins are not derived work" clause provided by GPL3.
William Pitcock <nenolod@atheme-project.org>
parents:
3121
diff
changeset
|
18 * The Audacious team does not consider modular code linking to |
f1c756f39e6c
Invoke "Plugins are not derived work" clause provided by GPL3.
William Pitcock <nenolod@atheme-project.org>
parents:
3121
diff
changeset
|
19 * Audacious or using our public API to be a derived work. |
2313 | 20 */ |
21 | |
22 #ifdef HAVE_CONFIG_H | |
23 # include "config.h" | |
24 #endif | |
25 | |
26 #include <glib.h> | |
27 #include <glib/gi18n.h> | |
28 #include <gtk/gtk.h> | |
29 #include <string.h> | |
30 #include <stddef.h> | |
31 #include <stdio.h> | |
4009
ba6258a39662
icon, codec and quality info added to file info box. Added new tuple field FIELD_MIMETYPE used for icon resolving
Eugene Zagidullin <e.asphyx@gmail.com>
parents:
3988
diff
changeset
|
32 #include <stdarg.h> |
2313 | 33 #include <sys/types.h> |
34 #include <dirent.h> | |
35 #include <unistd.h> | |
36 #include <errno.h> | |
37 #include <sys/types.h> | |
38 #include <sys/stat.h> | |
39 | |
40 #include "plugin.h" | |
41 #include "pluginenum.h" | |
42 #include "input.h" | |
43 #include "effect.h" | |
2385
ab2b1b6f6179
[svn] - add missing inclusion of strings.h where necessary, do not export main.h and export strings.h
giacomo
parents:
2348
diff
changeset
|
44 #include "strings.h" |
2313 | 45 #include "general.h" |
46 #include "output.h" | |
47 #include "visualization.h" | |
48 | |
49 #include "main.h" | |
50 #include "util.h" | |
51 #include "dnd.h" | |
3298
f985357757e0
audacious-core: convert to tuple-ng, remove titlestring API.
William Pitcock <nenolod@atheme-project.org>
parents:
3123
diff
changeset
|
52 #include "tuple.h" |
2313 | 53 |
54 #include "playlist.h" | |
55 | |
56 #include "ui_main.h" | |
57 #include "ui_playlist.h" | |
58 #include "build_stamp.h" | |
59 #include "ui_fileinfo.h" | |
60 #include "ui_playlist.h" | |
61 | |
62 GtkWidget *fileinfo_win; | |
63 | |
3986 | 64 GtkWidget *entry_location; |
65 GtkWidget *entry_title; | |
66 GtkWidget *entry_artist; | |
67 GtkWidget *entry_album; | |
68 GtkWidget *entry_comment; | |
69 GtkWidget *entry_year; | |
70 GtkWidget *entry_track; | |
71 GtkWidget *entry_genre; | |
72 | |
73 GtkWidget *image_artwork; | |
74 | |
4009
ba6258a39662
icon, codec and quality info added to file info box. Added new tuple field FIELD_MIMETYPE used for icon resolving
Eugene Zagidullin <e.asphyx@gmail.com>
parents:
3988
diff
changeset
|
75 GtkWidget *image_fileicon; |
ba6258a39662
icon, codec and quality info added to file info box. Added new tuple field FIELD_MIMETYPE used for icon resolving
Eugene Zagidullin <e.asphyx@gmail.com>
parents:
3988
diff
changeset
|
76 GtkWidget *label_codec_name; |
ba6258a39662
icon, codec and quality info added to file info box. Added new tuple field FIELD_MIMETYPE used for icon resolving
Eugene Zagidullin <e.asphyx@gmail.com>
parents:
3988
diff
changeset
|
77 GtkWidget *label_quality; |
ba6258a39662
icon, codec and quality info added to file info box. Added new tuple field FIELD_MIMETYPE used for icon resolving
Eugene Zagidullin <e.asphyx@gmail.com>
parents:
3988
diff
changeset
|
78 |
2313 | 79 static void |
3986 | 80 fileinfo_entry_set_text(GtkWidget *widget, const char *text) |
2313 | 81 { |
3986 | 82 if (widget == NULL) |
83 return; | |
2313 | 84 |
3986 | 85 gtk_entry_set_text(GTK_ENTRY(widget), text); |
2313 | 86 } |
87 | |
88 static void | |
4009
ba6258a39662
icon, codec and quality info added to file info box. Added new tuple field FIELD_MIMETYPE used for icon resolving
Eugene Zagidullin <e.asphyx@gmail.com>
parents:
3988
diff
changeset
|
89 fileinfo_label_set_text(GtkWidget *widget, const char *text) |
ba6258a39662
icon, codec and quality info added to file info box. Added new tuple field FIELD_MIMETYPE used for icon resolving
Eugene Zagidullin <e.asphyx@gmail.com>
parents:
3988
diff
changeset
|
90 { |
ba6258a39662
icon, codec and quality info added to file info box. Added new tuple field FIELD_MIMETYPE used for icon resolving
Eugene Zagidullin <e.asphyx@gmail.com>
parents:
3988
diff
changeset
|
91 gchar *tmp; |
ba6258a39662
icon, codec and quality info added to file info box. Added new tuple field FIELD_MIMETYPE used for icon resolving
Eugene Zagidullin <e.asphyx@gmail.com>
parents:
3988
diff
changeset
|
92 |
ba6258a39662
icon, codec and quality info added to file info box. Added new tuple field FIELD_MIMETYPE used for icon resolving
Eugene Zagidullin <e.asphyx@gmail.com>
parents:
3988
diff
changeset
|
93 if (widget == NULL) |
ba6258a39662
icon, codec and quality info added to file info box. Added new tuple field FIELD_MIMETYPE used for icon resolving
Eugene Zagidullin <e.asphyx@gmail.com>
parents:
3988
diff
changeset
|
94 return; |
ba6258a39662
icon, codec and quality info added to file info box. Added new tuple field FIELD_MIMETYPE used for icon resolving
Eugene Zagidullin <e.asphyx@gmail.com>
parents:
3988
diff
changeset
|
95 |
ba6258a39662
icon, codec and quality info added to file info box. Added new tuple field FIELD_MIMETYPE used for icon resolving
Eugene Zagidullin <e.asphyx@gmail.com>
parents:
3988
diff
changeset
|
96 if (text) { |
ba6258a39662
icon, codec and quality info added to file info box. Added new tuple field FIELD_MIMETYPE used for icon resolving
Eugene Zagidullin <e.asphyx@gmail.com>
parents:
3988
diff
changeset
|
97 tmp = g_strdup_printf("<span size=\"small\">%s</span>", text); |
ba6258a39662
icon, codec and quality info added to file info box. Added new tuple field FIELD_MIMETYPE used for icon resolving
Eugene Zagidullin <e.asphyx@gmail.com>
parents:
3988
diff
changeset
|
98 gtk_label_set_text(GTK_LABEL(widget), tmp); |
ba6258a39662
icon, codec and quality info added to file info box. Added new tuple field FIELD_MIMETYPE used for icon resolving
Eugene Zagidullin <e.asphyx@gmail.com>
parents:
3988
diff
changeset
|
99 gtk_label_set_use_markup(GTK_LABEL(widget), TRUE); |
ba6258a39662
icon, codec and quality info added to file info box. Added new tuple field FIELD_MIMETYPE used for icon resolving
Eugene Zagidullin <e.asphyx@gmail.com>
parents:
3988
diff
changeset
|
100 g_free(tmp); |
ba6258a39662
icon, codec and quality info added to file info box. Added new tuple field FIELD_MIMETYPE used for icon resolving
Eugene Zagidullin <e.asphyx@gmail.com>
parents:
3988
diff
changeset
|
101 } else { |
ba6258a39662
icon, codec and quality info added to file info box. Added new tuple field FIELD_MIMETYPE used for icon resolving
Eugene Zagidullin <e.asphyx@gmail.com>
parents:
3988
diff
changeset
|
102 gtk_label_set_text(GTK_LABEL(widget), _("<span size=\"small\">n/a</span>")); |
ba6258a39662
icon, codec and quality info added to file info box. Added new tuple field FIELD_MIMETYPE used for icon resolving
Eugene Zagidullin <e.asphyx@gmail.com>
parents:
3988
diff
changeset
|
103 gtk_label_set_use_markup(GTK_LABEL(widget), TRUE); |
ba6258a39662
icon, codec and quality info added to file info box. Added new tuple field FIELD_MIMETYPE used for icon resolving
Eugene Zagidullin <e.asphyx@gmail.com>
parents:
3988
diff
changeset
|
104 } |
ba6258a39662
icon, codec and quality info added to file info box. Added new tuple field FIELD_MIMETYPE used for icon resolving
Eugene Zagidullin <e.asphyx@gmail.com>
parents:
3988
diff
changeset
|
105 } |
ba6258a39662
icon, codec and quality info added to file info box. Added new tuple field FIELD_MIMETYPE used for icon resolving
Eugene Zagidullin <e.asphyx@gmail.com>
parents:
3988
diff
changeset
|
106 |
ba6258a39662
icon, codec and quality info added to file info box. Added new tuple field FIELD_MIMETYPE used for icon resolving
Eugene Zagidullin <e.asphyx@gmail.com>
parents:
3988
diff
changeset
|
107 static void |
3986 | 108 fileinfo_entry_set_text_free(GtkWidget *widget, char *text) |
2313 | 109 { |
3986 | 110 if (widget == NULL) |
111 return; | |
2313 | 112 |
3986 | 113 gtk_entry_set_text(GTK_ENTRY(widget), text); |
2313 | 114 |
3986 | 115 g_free(text); |
2313 | 116 } |
117 | |
118 static void | |
3986 | 119 fileinfo_entry_set_image(GtkWidget *widget, const char *text) |
2313 | 120 { |
121 GdkPixbuf *pixbuf; | |
122 int width, height; | |
123 double aspect; | |
124 GdkPixbuf *pixbuf2; | |
125 | |
3986 | 126 if (widget == NULL) |
2313 | 127 return; |
128 | |
129 pixbuf = gdk_pixbuf_new_from_file(text, NULL); | |
130 | |
131 if (pixbuf == NULL) | |
132 return; | |
133 | |
134 width = gdk_pixbuf_get_width(GDK_PIXBUF(pixbuf)); | |
135 height = gdk_pixbuf_get_height(GDK_PIXBUF(pixbuf)); | |
136 | |
137 if(strcmp(DATA_DIR "/images/audio.png", text)) | |
138 { | |
139 if(width == 0) | |
140 width = 1; | |
141 aspect = (double)height / (double)width; | |
142 if(aspect > 1.0) { | |
143 height = (int)(cfg.filepopup_pixelsize * aspect); | |
144 width = cfg.filepopup_pixelsize; | |
145 } else { | |
146 height = cfg.filepopup_pixelsize; | |
147 width = (int)(cfg.filepopup_pixelsize / aspect); | |
148 } | |
149 pixbuf2 = gdk_pixbuf_scale_simple(GDK_PIXBUF(pixbuf), width, height, GDK_INTERP_BILINEAR); | |
150 g_object_unref(G_OBJECT(pixbuf)); | |
151 pixbuf = pixbuf2; | |
152 } | |
153 | |
154 gtk_image_set_from_pixbuf(GTK_IMAGE(widget), GDK_PIXBUF(pixbuf)); | |
155 g_object_unref(G_OBJECT(pixbuf)); | |
156 } | |
157 | |
158 void fileinfo_hide(gpointer unused) | |
159 { | |
3986 | 160 gtk_widget_hide(fileinfo_win); |
2313 | 161 |
3986 | 162 /* Clear it out. */ |
163 fileinfo_entry_set_text(entry_title, ""); | |
164 fileinfo_entry_set_text(entry_artist, ""); | |
165 fileinfo_entry_set_text(entry_album, ""); | |
166 fileinfo_entry_set_text(entry_comment, ""); | |
167 fileinfo_entry_set_text(entry_genre, ""); | |
168 fileinfo_entry_set_text(entry_year, ""); | |
169 fileinfo_entry_set_text(entry_track, ""); | |
170 fileinfo_entry_set_text(entry_location, ""); | |
2313 | 171 |
3986 | 172 fileinfo_entry_set_image(image_artwork, DATA_DIR "/images/audio.png"); |
2313 | 173 } |
174 | |
4009
ba6258a39662
icon, codec and quality info added to file info box. Added new tuple field FIELD_MIMETYPE used for icon resolving
Eugene Zagidullin <e.asphyx@gmail.com>
parents:
3988
diff
changeset
|
175 GdkPixbuf * |
ba6258a39662
icon, codec and quality info added to file info box. Added new tuple field FIELD_MIMETYPE used for icon resolving
Eugene Zagidullin <e.asphyx@gmail.com>
parents:
3988
diff
changeset
|
176 themed_icon_lookup(gint size, const gchar *name, ...) /* NULL-terminated list of icon names */ |
ba6258a39662
icon, codec and quality info added to file info box. Added new tuple field FIELD_MIMETYPE used for icon resolving
Eugene Zagidullin <e.asphyx@gmail.com>
parents:
3988
diff
changeset
|
177 { |
ba6258a39662
icon, codec and quality info added to file info box. Added new tuple field FIELD_MIMETYPE used for icon resolving
Eugene Zagidullin <e.asphyx@gmail.com>
parents:
3988
diff
changeset
|
178 GtkIconTheme *icon_theme; |
ba6258a39662
icon, codec and quality info added to file info box. Added new tuple field FIELD_MIMETYPE used for icon resolving
Eugene Zagidullin <e.asphyx@gmail.com>
parents:
3988
diff
changeset
|
179 GdkPixbuf *pixbuf; |
ba6258a39662
icon, codec and quality info added to file info box. Added new tuple field FIELD_MIMETYPE used for icon resolving
Eugene Zagidullin <e.asphyx@gmail.com>
parents:
3988
diff
changeset
|
180 GError *error = NULL; |
ba6258a39662
icon, codec and quality info added to file info box. Added new tuple field FIELD_MIMETYPE used for icon resolving
Eugene Zagidullin <e.asphyx@gmail.com>
parents:
3988
diff
changeset
|
181 gchar *n; |
ba6258a39662
icon, codec and quality info added to file info box. Added new tuple field FIELD_MIMETYPE used for icon resolving
Eugene Zagidullin <e.asphyx@gmail.com>
parents:
3988
diff
changeset
|
182 va_list par; |
ba6258a39662
icon, codec and quality info added to file info box. Added new tuple field FIELD_MIMETYPE used for icon resolving
Eugene Zagidullin <e.asphyx@gmail.com>
parents:
3988
diff
changeset
|
183 |
ba6258a39662
icon, codec and quality info added to file info box. Added new tuple field FIELD_MIMETYPE used for icon resolving
Eugene Zagidullin <e.asphyx@gmail.com>
parents:
3988
diff
changeset
|
184 icon_theme = gtk_icon_theme_get_default (); |
ba6258a39662
icon, codec and quality info added to file info box. Added new tuple field FIELD_MIMETYPE used for icon resolving
Eugene Zagidullin <e.asphyx@gmail.com>
parents:
3988
diff
changeset
|
185 //fprintf(stderr, "looking for %s\n", name); |
ba6258a39662
icon, codec and quality info added to file info box. Added new tuple field FIELD_MIMETYPE used for icon resolving
Eugene Zagidullin <e.asphyx@gmail.com>
parents:
3988
diff
changeset
|
186 pixbuf = gtk_icon_theme_load_icon (icon_theme, name, size, 0, &error); |
ba6258a39662
icon, codec and quality info added to file info box. Added new tuple field FIELD_MIMETYPE used for icon resolving
Eugene Zagidullin <e.asphyx@gmail.com>
parents:
3988
diff
changeset
|
187 if(pixbuf) return pixbuf; |
ba6258a39662
icon, codec and quality info added to file info box. Added new tuple field FIELD_MIMETYPE used for icon resolving
Eugene Zagidullin <e.asphyx@gmail.com>
parents:
3988
diff
changeset
|
188 |
ba6258a39662
icon, codec and quality info added to file info box. Added new tuple field FIELD_MIMETYPE used for icon resolving
Eugene Zagidullin <e.asphyx@gmail.com>
parents:
3988
diff
changeset
|
189 if(error != NULL) g_error_free(error); |
ba6258a39662
icon, codec and quality info added to file info box. Added new tuple field FIELD_MIMETYPE used for icon resolving
Eugene Zagidullin <e.asphyx@gmail.com>
parents:
3988
diff
changeset
|
190 |
ba6258a39662
icon, codec and quality info added to file info box. Added new tuple field FIELD_MIMETYPE used for icon resolving
Eugene Zagidullin <e.asphyx@gmail.com>
parents:
3988
diff
changeset
|
191 /* fallback */ |
ba6258a39662
icon, codec and quality info added to file info box. Added new tuple field FIELD_MIMETYPE used for icon resolving
Eugene Zagidullin <e.asphyx@gmail.com>
parents:
3988
diff
changeset
|
192 va_start(par, name); |
ba6258a39662
icon, codec and quality info added to file info box. Added new tuple field FIELD_MIMETYPE used for icon resolving
Eugene Zagidullin <e.asphyx@gmail.com>
parents:
3988
diff
changeset
|
193 while((n = (gchar*)va_arg(par, gchar *)) != NULL) { |
ba6258a39662
icon, codec and quality info added to file info box. Added new tuple field FIELD_MIMETYPE used for icon resolving
Eugene Zagidullin <e.asphyx@gmail.com>
parents:
3988
diff
changeset
|
194 //fprintf(stderr, "looking for %s\n", n); |
ba6258a39662
icon, codec and quality info added to file info box. Added new tuple field FIELD_MIMETYPE used for icon resolving
Eugene Zagidullin <e.asphyx@gmail.com>
parents:
3988
diff
changeset
|
195 error = NULL; |
ba6258a39662
icon, codec and quality info added to file info box. Added new tuple field FIELD_MIMETYPE used for icon resolving
Eugene Zagidullin <e.asphyx@gmail.com>
parents:
3988
diff
changeset
|
196 pixbuf = gtk_icon_theme_load_icon (icon_theme, n, size, 0, &error); |
ba6258a39662
icon, codec and quality info added to file info box. Added new tuple field FIELD_MIMETYPE used for icon resolving
Eugene Zagidullin <e.asphyx@gmail.com>
parents:
3988
diff
changeset
|
197 if(pixbuf) { |
ba6258a39662
icon, codec and quality info added to file info box. Added new tuple field FIELD_MIMETYPE used for icon resolving
Eugene Zagidullin <e.asphyx@gmail.com>
parents:
3988
diff
changeset
|
198 //fprintf(stderr, "%s is ok\n", n); |
ba6258a39662
icon, codec and quality info added to file info box. Added new tuple field FIELD_MIMETYPE used for icon resolving
Eugene Zagidullin <e.asphyx@gmail.com>
parents:
3988
diff
changeset
|
199 va_end(par); |
ba6258a39662
icon, codec and quality info added to file info box. Added new tuple field FIELD_MIMETYPE used for icon resolving
Eugene Zagidullin <e.asphyx@gmail.com>
parents:
3988
diff
changeset
|
200 return pixbuf; |
ba6258a39662
icon, codec and quality info added to file info box. Added new tuple field FIELD_MIMETYPE used for icon resolving
Eugene Zagidullin <e.asphyx@gmail.com>
parents:
3988
diff
changeset
|
201 } |
ba6258a39662
icon, codec and quality info added to file info box. Added new tuple field FIELD_MIMETYPE used for icon resolving
Eugene Zagidullin <e.asphyx@gmail.com>
parents:
3988
diff
changeset
|
202 if(error != NULL) g_error_free(error); |
ba6258a39662
icon, codec and quality info added to file info box. Added new tuple field FIELD_MIMETYPE used for icon resolving
Eugene Zagidullin <e.asphyx@gmail.com>
parents:
3988
diff
changeset
|
203 } |
ba6258a39662
icon, codec and quality info added to file info box. Added new tuple field FIELD_MIMETYPE used for icon resolving
Eugene Zagidullin <e.asphyx@gmail.com>
parents:
3988
diff
changeset
|
204 |
ba6258a39662
icon, codec and quality info added to file info box. Added new tuple field FIELD_MIMETYPE used for icon resolving
Eugene Zagidullin <e.asphyx@gmail.com>
parents:
3988
diff
changeset
|
205 return NULL; |
ba6258a39662
icon, codec and quality info added to file info box. Added new tuple field FIELD_MIMETYPE used for icon resolving
Eugene Zagidullin <e.asphyx@gmail.com>
parents:
3988
diff
changeset
|
206 } |
ba6258a39662
icon, codec and quality info added to file info box. Added new tuple field FIELD_MIMETYPE used for icon resolving
Eugene Zagidullin <e.asphyx@gmail.com>
parents:
3988
diff
changeset
|
207 |
ba6258a39662
icon, codec and quality info added to file info box. Added new tuple field FIELD_MIMETYPE used for icon resolving
Eugene Zagidullin <e.asphyx@gmail.com>
parents:
3988
diff
changeset
|
208 GdkPixbuf * |
ba6258a39662
icon, codec and quality info added to file info box. Added new tuple field FIELD_MIMETYPE used for icon resolving
Eugene Zagidullin <e.asphyx@gmail.com>
parents:
3988
diff
changeset
|
209 mime_icon_lookup(gint size, const gchar *mime_type) /* smart icon resolving routine :) */ |
ba6258a39662
icon, codec and quality info added to file info box. Added new tuple field FIELD_MIMETYPE used for icon resolving
Eugene Zagidullin <e.asphyx@gmail.com>
parents:
3988
diff
changeset
|
210 { |
ba6258a39662
icon, codec and quality info added to file info box. Added new tuple field FIELD_MIMETYPE used for icon resolving
Eugene Zagidullin <e.asphyx@gmail.com>
parents:
3988
diff
changeset
|
211 gchar *mime_as_is; /* audio-x-mp3 */ |
ba6258a39662
icon, codec and quality info added to file info box. Added new tuple field FIELD_MIMETYPE used for icon resolving
Eugene Zagidullin <e.asphyx@gmail.com>
parents:
3988
diff
changeset
|
212 gchar *mime_gnome; /* gnome-mime-audio-x-mp3 */ |
ba6258a39662
icon, codec and quality info added to file info box. Added new tuple field FIELD_MIMETYPE used for icon resolving
Eugene Zagidullin <e.asphyx@gmail.com>
parents:
3988
diff
changeset
|
213 gchar *mime_generic; /* audio-x-generic */ |
ba6258a39662
icon, codec and quality info added to file info box. Added new tuple field FIELD_MIMETYPE used for icon resolving
Eugene Zagidullin <e.asphyx@gmail.com>
parents:
3988
diff
changeset
|
214 gchar *mime_gnome_generic; /* gnome-mime-audio */ |
ba6258a39662
icon, codec and quality info added to file info box. Added new tuple field FIELD_MIMETYPE used for icon resolving
Eugene Zagidullin <e.asphyx@gmail.com>
parents:
3988
diff
changeset
|
215 |
ba6258a39662
icon, codec and quality info added to file info box. Added new tuple field FIELD_MIMETYPE used for icon resolving
Eugene Zagidullin <e.asphyx@gmail.com>
parents:
3988
diff
changeset
|
216 GdkPixbuf *icon = NULL; |
ba6258a39662
icon, codec and quality info added to file info box. Added new tuple field FIELD_MIMETYPE used for icon resolving
Eugene Zagidullin <e.asphyx@gmail.com>
parents:
3988
diff
changeset
|
217 |
ba6258a39662
icon, codec and quality info added to file info box. Added new tuple field FIELD_MIMETYPE used for icon resolving
Eugene Zagidullin <e.asphyx@gmail.com>
parents:
3988
diff
changeset
|
218 gchar **s = g_strsplit(mime_type, "/", 2); |
ba6258a39662
icon, codec and quality info added to file info box. Added new tuple field FIELD_MIMETYPE used for icon resolving
Eugene Zagidullin <e.asphyx@gmail.com>
parents:
3988
diff
changeset
|
219 if(s[1] != NULL) { |
ba6258a39662
icon, codec and quality info added to file info box. Added new tuple field FIELD_MIMETYPE used for icon resolving
Eugene Zagidullin <e.asphyx@gmail.com>
parents:
3988
diff
changeset
|
220 mime_as_is = g_strdup_printf("%s-%s", s[0], s[1]); |
ba6258a39662
icon, codec and quality info added to file info box. Added new tuple field FIELD_MIMETYPE used for icon resolving
Eugene Zagidullin <e.asphyx@gmail.com>
parents:
3988
diff
changeset
|
221 mime_gnome = g_strdup_printf("gnome-mime-%s-%s", s[0], s[1]); |
ba6258a39662
icon, codec and quality info added to file info box. Added new tuple field FIELD_MIMETYPE used for icon resolving
Eugene Zagidullin <e.asphyx@gmail.com>
parents:
3988
diff
changeset
|
222 mime_generic = g_strdup_printf("%s-x-generic", s[0]); |
ba6258a39662
icon, codec and quality info added to file info box. Added new tuple field FIELD_MIMETYPE used for icon resolving
Eugene Zagidullin <e.asphyx@gmail.com>
parents:
3988
diff
changeset
|
223 mime_gnome_generic = g_strdup_printf("gnome-mime-%s", s[0]); |
ba6258a39662
icon, codec and quality info added to file info box. Added new tuple field FIELD_MIMETYPE used for icon resolving
Eugene Zagidullin <e.asphyx@gmail.com>
parents:
3988
diff
changeset
|
224 //fprintf(stderr, "will look for %s, %s, %s, %s, %s\n", mime_as_is, mime_gnome, mime_generic, mime_gnome_generic, s[0]); |
ba6258a39662
icon, codec and quality info added to file info box. Added new tuple field FIELD_MIMETYPE used for icon resolving
Eugene Zagidullin <e.asphyx@gmail.com>
parents:
3988
diff
changeset
|
225 icon = themed_icon_lookup(size, mime_as_is, mime_gnome, mime_generic, mime_gnome_generic, s[0], NULL); /* s[0] is category */ |
ba6258a39662
icon, codec and quality info added to file info box. Added new tuple field FIELD_MIMETYPE used for icon resolving
Eugene Zagidullin <e.asphyx@gmail.com>
parents:
3988
diff
changeset
|
226 g_free(mime_gnome_generic); |
ba6258a39662
icon, codec and quality info added to file info box. Added new tuple field FIELD_MIMETYPE used for icon resolving
Eugene Zagidullin <e.asphyx@gmail.com>
parents:
3988
diff
changeset
|
227 g_free(mime_generic); |
ba6258a39662
icon, codec and quality info added to file info box. Added new tuple field FIELD_MIMETYPE used for icon resolving
Eugene Zagidullin <e.asphyx@gmail.com>
parents:
3988
diff
changeset
|
228 g_free(mime_gnome); |
ba6258a39662
icon, codec and quality info added to file info box. Added new tuple field FIELD_MIMETYPE used for icon resolving
Eugene Zagidullin <e.asphyx@gmail.com>
parents:
3988
diff
changeset
|
229 g_free(mime_as_is); |
ba6258a39662
icon, codec and quality info added to file info box. Added new tuple field FIELD_MIMETYPE used for icon resolving
Eugene Zagidullin <e.asphyx@gmail.com>
parents:
3988
diff
changeset
|
230 } |
ba6258a39662
icon, codec and quality info added to file info box. Added new tuple field FIELD_MIMETYPE used for icon resolving
Eugene Zagidullin <e.asphyx@gmail.com>
parents:
3988
diff
changeset
|
231 g_strfreev(s); |
ba6258a39662
icon, codec and quality info added to file info box. Added new tuple field FIELD_MIMETYPE used for icon resolving
Eugene Zagidullin <e.asphyx@gmail.com>
parents:
3988
diff
changeset
|
232 |
ba6258a39662
icon, codec and quality info added to file info box. Added new tuple field FIELD_MIMETYPE used for icon resolving
Eugene Zagidullin <e.asphyx@gmail.com>
parents:
3988
diff
changeset
|
233 return icon; |
ba6258a39662
icon, codec and quality info added to file info box. Added new tuple field FIELD_MIMETYPE used for icon resolving
Eugene Zagidullin <e.asphyx@gmail.com>
parents:
3988
diff
changeset
|
234 } |
ba6258a39662
icon, codec and quality info added to file info box. Added new tuple field FIELD_MIMETYPE used for icon resolving
Eugene Zagidullin <e.asphyx@gmail.com>
parents:
3988
diff
changeset
|
235 |
2313 | 236 void |
237 create_fileinfo_window(void) | |
238 { | |
3986 | 239 GtkWidget *hbox; |
240 GtkWidget *vbox1; | |
241 GtkWidget *vbox2; | |
242 GtkWidget *label_title; | |
243 GtkWidget *label_artist; | |
244 GtkWidget *label_album; | |
245 GtkWidget *label_comment; | |
246 GtkWidget *label_genre; | |
247 GtkWidget *label_year; | |
248 GtkWidget *label_track; | |
249 GtkWidget *label_location; | |
4009
ba6258a39662
icon, codec and quality info added to file info box. Added new tuple field FIELD_MIMETYPE used for icon resolving
Eugene Zagidullin <e.asphyx@gmail.com>
parents:
3988
diff
changeset
|
250 GtkWidget *label_codec; |
ba6258a39662
icon, codec and quality info added to file info box. Added new tuple field FIELD_MIMETYPE used for icon resolving
Eugene Zagidullin <e.asphyx@gmail.com>
parents:
3988
diff
changeset
|
251 GtkWidget *label_codec_label; |
ba6258a39662
icon, codec and quality info added to file info box. Added new tuple field FIELD_MIMETYPE used for icon resolving
Eugene Zagidullin <e.asphyx@gmail.com>
parents:
3988
diff
changeset
|
252 GtkWidget *label_quality_label; |
ba6258a39662
icon, codec and quality info added to file info box. Added new tuple field FIELD_MIMETYPE used for icon resolving
Eugene Zagidullin <e.asphyx@gmail.com>
parents:
3988
diff
changeset
|
253 GtkWidget *codec_hbox; |
ba6258a39662
icon, codec and quality info added to file info box. Added new tuple field FIELD_MIMETYPE used for icon resolving
Eugene Zagidullin <e.asphyx@gmail.com>
parents:
3988
diff
changeset
|
254 GtkWidget *codec_table; |
3986 | 255 GtkWidget *table1; |
256 GtkWidget *bbox_close; | |
257 GtkWidget *btn_close; | |
3988
ce1ce0a6cc74
bring back alignments - it looks nicer with those
Tomasz Mon <desowin@gmail.com>
parents:
3986
diff
changeset
|
258 GtkWidget *alignment; |
3986 | 259 |
260 fileinfo_win = gtk_window_new(GTK_WINDOW_TOPLEVEL); | |
261 gtk_container_set_border_width(GTK_CONTAINER(fileinfo_win), 6); | |
262 gtk_window_set_title(GTK_WINDOW(fileinfo_win), _("Track Information")); | |
263 gtk_window_set_position(GTK_WINDOW(fileinfo_win), GTK_WIN_POS_CENTER); | |
264 gtk_window_set_resizable(GTK_WINDOW(fileinfo_win), FALSE); | |
265 gtk_window_set_type_hint(GTK_WINDOW(fileinfo_win), GDK_WINDOW_TYPE_HINT_DIALOG); | |
266 gtk_window_set_transient_for(GTK_WINDOW(fileinfo_win), GTK_WINDOW(mainwin)); | |
267 | |
268 hbox = gtk_hbox_new(FALSE, 0); | |
269 gtk_container_add(GTK_CONTAINER(fileinfo_win), hbox); | |
2313 | 270 |
3986 | 271 image_artwork = gtk_image_new(); |
272 gtk_box_pack_start(GTK_BOX(hbox), image_artwork, FALSE, FALSE, 0); | |
273 gtk_misc_set_alignment(GTK_MISC(image_artwork), 0.5, 0); | |
274 gtk_image_set_from_file(GTK_IMAGE(image_artwork), DATA_DIR "/images/audio.png"); | |
275 | |
276 vbox1 = gtk_vbox_new(FALSE, 0); | |
277 gtk_box_pack_start(GTK_BOX(hbox), vbox1, TRUE, TRUE, 0); | |
278 | |
3988
ce1ce0a6cc74
bring back alignments - it looks nicer with those
Tomasz Mon <desowin@gmail.com>
parents:
3986
diff
changeset
|
279 alignment = gtk_alignment_new(0.5, 0.5, 1, 1); |
ce1ce0a6cc74
bring back alignments - it looks nicer with those
Tomasz Mon <desowin@gmail.com>
parents:
3986
diff
changeset
|
280 gtk_box_pack_start(GTK_BOX(vbox1), alignment, TRUE, TRUE, 0); |
3986 | 281 vbox2 = gtk_vbox_new(FALSE, 0); |
3988
ce1ce0a6cc74
bring back alignments - it looks nicer with those
Tomasz Mon <desowin@gmail.com>
parents:
3986
diff
changeset
|
282 gtk_container_add(GTK_CONTAINER(alignment), vbox2); |
4010
ce791ae274aa
Codec info in fileinfo box moved to top
Eugene Zagidullin <e.asphyx@gmail.com>
parents:
4009
diff
changeset
|
283 |
ce791ae274aa
Codec info in fileinfo box moved to top
Eugene Zagidullin <e.asphyx@gmail.com>
parents:
4009
diff
changeset
|
284 label_codec = gtk_label_new(_("<span size=\"small\">Codec</span>")); |
ce791ae274aa
Codec info in fileinfo box moved to top
Eugene Zagidullin <e.asphyx@gmail.com>
parents:
4009
diff
changeset
|
285 gtk_box_pack_start (GTK_BOX (vbox2), label_codec, FALSE, FALSE, 0); |
ce791ae274aa
Codec info in fileinfo box moved to top
Eugene Zagidullin <e.asphyx@gmail.com>
parents:
4009
diff
changeset
|
286 gtk_label_set_use_markup(GTK_LABEL(label_codec), TRUE); |
ce791ae274aa
Codec info in fileinfo box moved to top
Eugene Zagidullin <e.asphyx@gmail.com>
parents:
4009
diff
changeset
|
287 gtk_misc_set_alignment(GTK_MISC(label_codec), 0, 0.5); |
ce791ae274aa
Codec info in fileinfo box moved to top
Eugene Zagidullin <e.asphyx@gmail.com>
parents:
4009
diff
changeset
|
288 |
ce791ae274aa
Codec info in fileinfo box moved to top
Eugene Zagidullin <e.asphyx@gmail.com>
parents:
4009
diff
changeset
|
289 alignment = gtk_alignment_new (0.5, 0.5, 1, 1); |
ce791ae274aa
Codec info in fileinfo box moved to top
Eugene Zagidullin <e.asphyx@gmail.com>
parents:
4009
diff
changeset
|
290 gtk_alignment_set_padding (GTK_ALIGNMENT (alignment), 6, 6, 0, 0); |
ce791ae274aa
Codec info in fileinfo box moved to top
Eugene Zagidullin <e.asphyx@gmail.com>
parents:
4009
diff
changeset
|
291 gtk_box_pack_start (GTK_BOX (vbox2), alignment, FALSE, FALSE, 0); |
ce791ae274aa
Codec info in fileinfo box moved to top
Eugene Zagidullin <e.asphyx@gmail.com>
parents:
4009
diff
changeset
|
292 |
ce791ae274aa
Codec info in fileinfo box moved to top
Eugene Zagidullin <e.asphyx@gmail.com>
parents:
4009
diff
changeset
|
293 codec_hbox = gtk_hbox_new(FALSE, 6); |
ce791ae274aa
Codec info in fileinfo box moved to top
Eugene Zagidullin <e.asphyx@gmail.com>
parents:
4009
diff
changeset
|
294 gtk_container_add (GTK_CONTAINER(alignment), codec_hbox); |
ce791ae274aa
Codec info in fileinfo box moved to top
Eugene Zagidullin <e.asphyx@gmail.com>
parents:
4009
diff
changeset
|
295 |
ce791ae274aa
Codec info in fileinfo box moved to top
Eugene Zagidullin <e.asphyx@gmail.com>
parents:
4009
diff
changeset
|
296 image_fileicon = gtk_image_new_from_stock (GTK_STOCK_MISSING_IMAGE, GTK_ICON_SIZE_DIALOG); |
ce791ae274aa
Codec info in fileinfo box moved to top
Eugene Zagidullin <e.asphyx@gmail.com>
parents:
4009
diff
changeset
|
297 gtk_box_pack_start (GTK_BOX (codec_hbox), image_fileicon, FALSE, FALSE, 0); |
ce791ae274aa
Codec info in fileinfo box moved to top
Eugene Zagidullin <e.asphyx@gmail.com>
parents:
4009
diff
changeset
|
298 |
ce791ae274aa
Codec info in fileinfo box moved to top
Eugene Zagidullin <e.asphyx@gmail.com>
parents:
4009
diff
changeset
|
299 codec_table = gtk_table_new(2, 2, FALSE); |
ce791ae274aa
Codec info in fileinfo box moved to top
Eugene Zagidullin <e.asphyx@gmail.com>
parents:
4009
diff
changeset
|
300 gtk_table_set_row_spacings (GTK_TABLE(codec_table), 6); |
ce791ae274aa
Codec info in fileinfo box moved to top
Eugene Zagidullin <e.asphyx@gmail.com>
parents:
4009
diff
changeset
|
301 gtk_table_set_col_spacings (GTK_TABLE(codec_table), 12); |
ce791ae274aa
Codec info in fileinfo box moved to top
Eugene Zagidullin <e.asphyx@gmail.com>
parents:
4009
diff
changeset
|
302 gtk_box_pack_start (GTK_BOX (codec_hbox), codec_table, FALSE, FALSE, 0); |
ce791ae274aa
Codec info in fileinfo box moved to top
Eugene Zagidullin <e.asphyx@gmail.com>
parents:
4009
diff
changeset
|
303 |
ce791ae274aa
Codec info in fileinfo box moved to top
Eugene Zagidullin <e.asphyx@gmail.com>
parents:
4009
diff
changeset
|
304 label_codec_label = gtk_label_new(_("<span size=\"small\">Codec name:</span>")); |
ce791ae274aa
Codec info in fileinfo box moved to top
Eugene Zagidullin <e.asphyx@gmail.com>
parents:
4009
diff
changeset
|
305 gtk_label_set_use_markup(GTK_LABEL(label_codec_label), TRUE); |
ce791ae274aa
Codec info in fileinfo box moved to top
Eugene Zagidullin <e.asphyx@gmail.com>
parents:
4009
diff
changeset
|
306 gtk_misc_set_alignment(GTK_MISC(label_codec_label), 0, 0.5); |
ce791ae274aa
Codec info in fileinfo box moved to top
Eugene Zagidullin <e.asphyx@gmail.com>
parents:
4009
diff
changeset
|
307 label_quality_label = gtk_label_new(_("<span size=\"small\">Quality:</span>")); |
ce791ae274aa
Codec info in fileinfo box moved to top
Eugene Zagidullin <e.asphyx@gmail.com>
parents:
4009
diff
changeset
|
308 gtk_label_set_use_markup(GTK_LABEL(label_quality_label), TRUE); |
ce791ae274aa
Codec info in fileinfo box moved to top
Eugene Zagidullin <e.asphyx@gmail.com>
parents:
4009
diff
changeset
|
309 gtk_misc_set_alignment(GTK_MISC(label_quality_label), 0, 0.5); |
ce791ae274aa
Codec info in fileinfo box moved to top
Eugene Zagidullin <e.asphyx@gmail.com>
parents:
4009
diff
changeset
|
310 |
ce791ae274aa
Codec info in fileinfo box moved to top
Eugene Zagidullin <e.asphyx@gmail.com>
parents:
4009
diff
changeset
|
311 label_codec_name = gtk_label_new(_("<span size=\"small\">n/a</span>")); |
ce791ae274aa
Codec info in fileinfo box moved to top
Eugene Zagidullin <e.asphyx@gmail.com>
parents:
4009
diff
changeset
|
312 gtk_label_set_use_markup(GTK_LABEL(label_codec_name), TRUE); |
ce791ae274aa
Codec info in fileinfo box moved to top
Eugene Zagidullin <e.asphyx@gmail.com>
parents:
4009
diff
changeset
|
313 gtk_misc_set_alignment(GTK_MISC(label_codec_name), 0, 0.5); |
ce791ae274aa
Codec info in fileinfo box moved to top
Eugene Zagidullin <e.asphyx@gmail.com>
parents:
4009
diff
changeset
|
314 label_quality = gtk_label_new(_("<span size=\"small\">n/a</span>")); |
ce791ae274aa
Codec info in fileinfo box moved to top
Eugene Zagidullin <e.asphyx@gmail.com>
parents:
4009
diff
changeset
|
315 gtk_label_set_use_markup(GTK_LABEL(label_quality), TRUE); |
ce791ae274aa
Codec info in fileinfo box moved to top
Eugene Zagidullin <e.asphyx@gmail.com>
parents:
4009
diff
changeset
|
316 gtk_misc_set_alignment(GTK_MISC(label_quality), 0, 0.5); |
ce791ae274aa
Codec info in fileinfo box moved to top
Eugene Zagidullin <e.asphyx@gmail.com>
parents:
4009
diff
changeset
|
317 |
ce791ae274aa
Codec info in fileinfo box moved to top
Eugene Zagidullin <e.asphyx@gmail.com>
parents:
4009
diff
changeset
|
318 gtk_table_attach(GTK_TABLE(codec_table), label_codec_label, 0, 1, 0, 1, |
ce791ae274aa
Codec info in fileinfo box moved to top
Eugene Zagidullin <e.asphyx@gmail.com>
parents:
4009
diff
changeset
|
319 (GtkAttachOptions) (GTK_EXPAND | GTK_FILL), |
ce791ae274aa
Codec info in fileinfo box moved to top
Eugene Zagidullin <e.asphyx@gmail.com>
parents:
4009
diff
changeset
|
320 (GtkAttachOptions) (0), 0, 0); |
ce791ae274aa
Codec info in fileinfo box moved to top
Eugene Zagidullin <e.asphyx@gmail.com>
parents:
4009
diff
changeset
|
321 gtk_table_attach(GTK_TABLE(codec_table), label_codec_name, 1, 2, 0, 1, |
ce791ae274aa
Codec info in fileinfo box moved to top
Eugene Zagidullin <e.asphyx@gmail.com>
parents:
4009
diff
changeset
|
322 (GtkAttachOptions) (GTK_EXPAND | GTK_FILL), |
ce791ae274aa
Codec info in fileinfo box moved to top
Eugene Zagidullin <e.asphyx@gmail.com>
parents:
4009
diff
changeset
|
323 (GtkAttachOptions) (0), 0, 0); |
ce791ae274aa
Codec info in fileinfo box moved to top
Eugene Zagidullin <e.asphyx@gmail.com>
parents:
4009
diff
changeset
|
324 gtk_table_attach(GTK_TABLE(codec_table), label_quality_label, 0, 1, 1, 2, |
ce791ae274aa
Codec info in fileinfo box moved to top
Eugene Zagidullin <e.asphyx@gmail.com>
parents:
4009
diff
changeset
|
325 (GtkAttachOptions) (GTK_EXPAND | GTK_FILL), |
ce791ae274aa
Codec info in fileinfo box moved to top
Eugene Zagidullin <e.asphyx@gmail.com>
parents:
4009
diff
changeset
|
326 (GtkAttachOptions) (0), 0, 0); |
ce791ae274aa
Codec info in fileinfo box moved to top
Eugene Zagidullin <e.asphyx@gmail.com>
parents:
4009
diff
changeset
|
327 gtk_table_attach(GTK_TABLE(codec_table), label_quality, 1, 2, 1, 2, |
ce791ae274aa
Codec info in fileinfo box moved to top
Eugene Zagidullin <e.asphyx@gmail.com>
parents:
4009
diff
changeset
|
328 (GtkAttachOptions) (GTK_EXPAND | GTK_FILL), |
ce791ae274aa
Codec info in fileinfo box moved to top
Eugene Zagidullin <e.asphyx@gmail.com>
parents:
4009
diff
changeset
|
329 (GtkAttachOptions) (0), 0, 0); |
3986 | 330 |
331 label_title = gtk_label_new(_("<span size=\"small\">Title</span>")); | |
332 gtk_box_pack_start(GTK_BOX(vbox2), label_title, FALSE, FALSE, 0); | |
333 gtk_label_set_use_markup(GTK_LABEL(label_title), TRUE); | |
334 gtk_misc_set_alignment(GTK_MISC(label_title), 0, 0); | |
2313 | 335 |
3988
ce1ce0a6cc74
bring back alignments - it looks nicer with those
Tomasz Mon <desowin@gmail.com>
parents:
3986
diff
changeset
|
336 alignment = gtk_alignment_new(0.5, 0.5, 1, 1); |
ce1ce0a6cc74
bring back alignments - it looks nicer with those
Tomasz Mon <desowin@gmail.com>
parents:
3986
diff
changeset
|
337 gtk_box_pack_start(GTK_BOX(vbox2), alignment, FALSE, FALSE, 0); |
ce1ce0a6cc74
bring back alignments - it looks nicer with those
Tomasz Mon <desowin@gmail.com>
parents:
3986
diff
changeset
|
338 gtk_alignment_set_padding(GTK_ALIGNMENT(alignment), 0, 6, 0, 0); |
3986 | 339 entry_title = gtk_entry_new(); |
3988
ce1ce0a6cc74
bring back alignments - it looks nicer with those
Tomasz Mon <desowin@gmail.com>
parents:
3986
diff
changeset
|
340 gtk_container_add(GTK_CONTAINER(alignment), entry_title); |
3986 | 341 |
342 label_artist = gtk_label_new(_("<span size=\"small\">Artist</span>")); | |
343 gtk_box_pack_start(GTK_BOX(vbox2), label_artist, FALSE, FALSE, 0); | |
344 gtk_label_set_use_markup(GTK_LABEL(label_artist), TRUE); | |
345 gtk_misc_set_alignment(GTK_MISC(label_artist), 0, 0.5); | |
346 | |
3988
ce1ce0a6cc74
bring back alignments - it looks nicer with those
Tomasz Mon <desowin@gmail.com>
parents:
3986
diff
changeset
|
347 alignment = gtk_alignment_new(0.5, 0.5, 1, 1); |
ce1ce0a6cc74
bring back alignments - it looks nicer with those
Tomasz Mon <desowin@gmail.com>
parents:
3986
diff
changeset
|
348 gtk_box_pack_start(GTK_BOX(vbox2), alignment, FALSE, FALSE, 0); |
ce1ce0a6cc74
bring back alignments - it looks nicer with those
Tomasz Mon <desowin@gmail.com>
parents:
3986
diff
changeset
|
349 gtk_alignment_set_padding(GTK_ALIGNMENT(alignment), 0, 6, 0, 0); |
3986 | 350 entry_artist = gtk_entry_new(); |
3988
ce1ce0a6cc74
bring back alignments - it looks nicer with those
Tomasz Mon <desowin@gmail.com>
parents:
3986
diff
changeset
|
351 gtk_container_add(GTK_CONTAINER(alignment), entry_artist); |
3986 | 352 |
353 label_album = gtk_label_new(_("<span size=\"small\">Album</span>")); | |
354 gtk_box_pack_start(GTK_BOX(vbox2), label_album, FALSE, FALSE, 0); | |
355 gtk_label_set_use_markup(GTK_LABEL(label_album), TRUE); | |
356 gtk_misc_set_alignment(GTK_MISC(label_album), 0, 0.5); | |
357 | |
3988
ce1ce0a6cc74
bring back alignments - it looks nicer with those
Tomasz Mon <desowin@gmail.com>
parents:
3986
diff
changeset
|
358 alignment = gtk_alignment_new(0.5, 0.5, 1, 1); |
ce1ce0a6cc74
bring back alignments - it looks nicer with those
Tomasz Mon <desowin@gmail.com>
parents:
3986
diff
changeset
|
359 gtk_box_pack_start(GTK_BOX(vbox2), alignment, FALSE, FALSE, 0); |
ce1ce0a6cc74
bring back alignments - it looks nicer with those
Tomasz Mon <desowin@gmail.com>
parents:
3986
diff
changeset
|
360 gtk_alignment_set_padding(GTK_ALIGNMENT(alignment), 0, 6, 0, 0); |
3986 | 361 entry_album = gtk_entry_new(); |
3988
ce1ce0a6cc74
bring back alignments - it looks nicer with those
Tomasz Mon <desowin@gmail.com>
parents:
3986
diff
changeset
|
362 gtk_container_add(GTK_CONTAINER(alignment), entry_album); |
2313 | 363 |
3986 | 364 label_comment = gtk_label_new(_("<span size=\"small\">Comment</span>")); |
365 gtk_box_pack_start(GTK_BOX(vbox2), label_comment, FALSE, FALSE, 0); | |
366 gtk_label_set_use_markup(GTK_LABEL(label_comment), TRUE); | |
367 gtk_misc_set_alignment(GTK_MISC(label_comment), 0, 0.5); | |
368 | |
3988
ce1ce0a6cc74
bring back alignments - it looks nicer with those
Tomasz Mon <desowin@gmail.com>
parents:
3986
diff
changeset
|
369 alignment = gtk_alignment_new(0.5, 0.5, 1, 1); |
ce1ce0a6cc74
bring back alignments - it looks nicer with those
Tomasz Mon <desowin@gmail.com>
parents:
3986
diff
changeset
|
370 gtk_box_pack_start(GTK_BOX(vbox2), alignment, FALSE, FALSE, 0); |
ce1ce0a6cc74
bring back alignments - it looks nicer with those
Tomasz Mon <desowin@gmail.com>
parents:
3986
diff
changeset
|
371 gtk_alignment_set_padding(GTK_ALIGNMENT(alignment), 0, 6, 0, 0); |
3986 | 372 entry_comment = gtk_entry_new(); |
3988
ce1ce0a6cc74
bring back alignments - it looks nicer with those
Tomasz Mon <desowin@gmail.com>
parents:
3986
diff
changeset
|
373 gtk_container_add (GTK_CONTAINER(alignment), entry_comment); |
3986 | 374 |
375 label_genre = gtk_label_new(_("<span size=\"small\">Genre</span>")); | |
376 gtk_box_pack_start(GTK_BOX(vbox2), label_genre, FALSE, FALSE, 0); | |
377 gtk_label_set_use_markup(GTK_LABEL(label_genre), TRUE); | |
378 gtk_misc_set_alignment(GTK_MISC(label_genre), 0, 0.5); | |
379 | |
3988
ce1ce0a6cc74
bring back alignments - it looks nicer with those
Tomasz Mon <desowin@gmail.com>
parents:
3986
diff
changeset
|
380 alignment = gtk_alignment_new(0.5, 0.5, 1, 1); |
ce1ce0a6cc74
bring back alignments - it looks nicer with those
Tomasz Mon <desowin@gmail.com>
parents:
3986
diff
changeset
|
381 gtk_box_pack_start(GTK_BOX(vbox2), alignment, FALSE, FALSE, 0); |
ce1ce0a6cc74
bring back alignments - it looks nicer with those
Tomasz Mon <desowin@gmail.com>
parents:
3986
diff
changeset
|
382 gtk_alignment_set_padding(GTK_ALIGNMENT(alignment), 0, 6, 0, 0); |
3986 | 383 entry_genre = gtk_entry_new(); |
3988
ce1ce0a6cc74
bring back alignments - it looks nicer with those
Tomasz Mon <desowin@gmail.com>
parents:
3986
diff
changeset
|
384 gtk_container_add(GTK_CONTAINER(alignment), entry_genre); |
3986 | 385 |
3988
ce1ce0a6cc74
bring back alignments - it looks nicer with those
Tomasz Mon <desowin@gmail.com>
parents:
3986
diff
changeset
|
386 alignment = gtk_alignment_new(0.5, 0.5, 1, 1); |
ce1ce0a6cc74
bring back alignments - it looks nicer with those
Tomasz Mon <desowin@gmail.com>
parents:
3986
diff
changeset
|
387 gtk_box_pack_start(GTK_BOX(vbox2), alignment, FALSE, FALSE, 0); |
ce1ce0a6cc74
bring back alignments - it looks nicer with those
Tomasz Mon <desowin@gmail.com>
parents:
3986
diff
changeset
|
388 gtk_alignment_set_padding(GTK_ALIGNMENT(alignment), 0, 6, 0, 0); |
3986 | 389 table1 = gtk_table_new(2, 2, FALSE); |
3988
ce1ce0a6cc74
bring back alignments - it looks nicer with those
Tomasz Mon <desowin@gmail.com>
parents:
3986
diff
changeset
|
390 gtk_container_add(GTK_CONTAINER(alignment), table1); |
3986 | 391 gtk_table_set_col_spacings(GTK_TABLE(table1), 6); |
392 | |
393 label_year = gtk_label_new(_("<span size=\"small\">Year</span>")); | |
394 gtk_table_attach(GTK_TABLE(table1), label_year, 0, 1, 0, 1, | |
395 (GtkAttachOptions) (GTK_FILL), | |
396 (GtkAttachOptions) (0), 0, 0); | |
397 gtk_label_set_use_markup(GTK_LABEL(label_year), TRUE); | |
398 gtk_misc_set_alignment(GTK_MISC(label_year), 0, 0.5); | |
2313 | 399 |
3986 | 400 entry_year = gtk_entry_new(); |
401 gtk_table_attach(GTK_TABLE(table1), entry_year, 0, 1, 1, 2, | |
402 (GtkAttachOptions) (GTK_EXPAND | GTK_FILL), | |
403 (GtkAttachOptions) (0), 0, 0); | |
404 | |
405 label_track = gtk_label_new(_("<span size=\"small\">Track Number</span>")); | |
406 gtk_table_attach(GTK_TABLE(table1), label_track, 1, 2, 0, 1, | |
407 (GtkAttachOptions) (GTK_FILL), | |
408 (GtkAttachOptions) (0), 0, 0); | |
409 gtk_label_set_use_markup(GTK_LABEL(label_track), TRUE); | |
410 gtk_misc_set_alignment(GTK_MISC(label_track), 0, 0.5); | |
411 | |
412 entry_track = gtk_entry_new(); | |
413 gtk_table_attach(GTK_TABLE(table1), entry_track, 1, 2, 1, 2, | |
414 (GtkAttachOptions) (GTK_EXPAND | GTK_FILL), | |
415 (GtkAttachOptions) (0), 0, 0); | |
2313 | 416 |
3986 | 417 label_location = gtk_label_new(_("<span size=\"small\">Location</span>")); |
418 gtk_box_pack_start(GTK_BOX(vbox2), label_location, FALSE, FALSE, 0); | |
419 gtk_label_set_use_markup(GTK_LABEL(label_location), TRUE); | |
420 gtk_misc_set_alignment(GTK_MISC(label_location), 0, 0.5); | |
421 | |
3988
ce1ce0a6cc74
bring back alignments - it looks nicer with those
Tomasz Mon <desowin@gmail.com>
parents:
3986
diff
changeset
|
422 alignment = gtk_alignment_new (0.5, 0.5, 1, 1); |
ce1ce0a6cc74
bring back alignments - it looks nicer with those
Tomasz Mon <desowin@gmail.com>
parents:
3986
diff
changeset
|
423 gtk_box_pack_start (GTK_BOX (vbox2), alignment, FALSE, FALSE, 0); |
ce1ce0a6cc74
bring back alignments - it looks nicer with those
Tomasz Mon <desowin@gmail.com>
parents:
3986
diff
changeset
|
424 gtk_alignment_set_padding (GTK_ALIGNMENT (alignment), 0, 6, 0, 0); |
ce1ce0a6cc74
bring back alignments - it looks nicer with those
Tomasz Mon <desowin@gmail.com>
parents:
3986
diff
changeset
|
425 |
3986 | 426 entry_location = gtk_entry_new(); |
3988
ce1ce0a6cc74
bring back alignments - it looks nicer with those
Tomasz Mon <desowin@gmail.com>
parents:
3986
diff
changeset
|
427 gtk_container_add(GTK_CONTAINER(alignment), entry_location); |
4009
ba6258a39662
icon, codec and quality info added to file info box. Added new tuple field FIELD_MIMETYPE used for icon resolving
Eugene Zagidullin <e.asphyx@gmail.com>
parents:
3988
diff
changeset
|
428 |
3986 | 429 bbox_close = gtk_hbutton_box_new(); |
430 gtk_box_pack_start(GTK_BOX(vbox1), bbox_close, FALSE, FALSE, 0); | |
431 gtk_button_box_set_layout(GTK_BUTTON_BOX(bbox_close), GTK_BUTTONBOX_END); | |
432 | |
433 btn_close = gtk_button_new_from_stock("gtk-close"); | |
434 gtk_container_add(GTK_CONTAINER(bbox_close), btn_close); | |
435 GTK_WIDGET_SET_FLAGS(btn_close, GTK_CAN_DEFAULT); | |
436 g_signal_connect(G_OBJECT(btn_close), "clicked", (GCallback) fileinfo_hide, NULL); | |
437 | |
438 gtk_widget_show_all (hbox); | |
2313 | 439 } |
440 | |
441 void | |
3298
f985357757e0
audacious-core: convert to tuple-ng, remove titlestring API.
William Pitcock <nenolod@atheme-project.org>
parents:
3123
diff
changeset
|
442 fileinfo_show_for_tuple(Tuple *tuple) |
2313 | 443 { |
444 gchar *tmp = NULL; | |
4009
ba6258a39662
icon, codec and quality info added to file info box. Added new tuple field FIELD_MIMETYPE used for icon resolving
Eugene Zagidullin <e.asphyx@gmail.com>
parents:
3988
diff
changeset
|
445 GdkPixbuf *icon = NULL; |
2313 | 446 |
447 if (tuple == NULL) | |
448 return; | |
449 | |
450 gtk_widget_realize(fileinfo_win); | |
451 | |
3986 | 452 fileinfo_entry_set_text(entry_title, tuple_get_string(tuple, FIELD_TITLE, NULL)); |
453 fileinfo_entry_set_text(entry_artist, tuple_get_string(tuple, FIELD_ARTIST, NULL)); | |
454 fileinfo_entry_set_text(entry_album, tuple_get_string(tuple, FIELD_ALBUM, NULL)); | |
455 fileinfo_entry_set_text(entry_comment, tuple_get_string(tuple, FIELD_COMMENT, NULL)); | |
456 fileinfo_entry_set_text(entry_genre, tuple_get_string(tuple, FIELD_GENRE, NULL)); | |
2313 | 457 |
3490
602ec8c40d0d
Fixed to comply with the Tuple API changes.
Matti Hamalainen <ccr@tnsp.org>
parents:
3298
diff
changeset
|
458 tmp = g_strdup_printf("%s/%s", |
602ec8c40d0d
Fixed to comply with the Tuple API changes.
Matti Hamalainen <ccr@tnsp.org>
parents:
3298
diff
changeset
|
459 tuple_get_string(tuple, FIELD_FILE_PATH, NULL), |
602ec8c40d0d
Fixed to comply with the Tuple API changes.
Matti Hamalainen <ccr@tnsp.org>
parents:
3298
diff
changeset
|
460 tuple_get_string(tuple, FIELD_FILE_NAME, NULL)); |
2313 | 461 if(tmp){ |
3986 | 462 fileinfo_entry_set_text_free(entry_location, str_to_utf8(tmp)); |
2313 | 463 g_free(tmp); |
464 tmp = NULL; | |
465 } | |
466 | |
3490
602ec8c40d0d
Fixed to comply with the Tuple API changes.
Matti Hamalainen <ccr@tnsp.org>
parents:
3298
diff
changeset
|
467 if (tuple_get_int(tuple, FIELD_YEAR, NULL)) |
3986 | 468 fileinfo_entry_set_text_free(entry_year, |
3490
602ec8c40d0d
Fixed to comply with the Tuple API changes.
Matti Hamalainen <ccr@tnsp.org>
parents:
3298
diff
changeset
|
469 g_strdup_printf("%d", tuple_get_int(tuple, FIELD_YEAR, NULL))); |
2313 | 470 |
3490
602ec8c40d0d
Fixed to comply with the Tuple API changes.
Matti Hamalainen <ccr@tnsp.org>
parents:
3298
diff
changeset
|
471 if (tuple_get_int(tuple, FIELD_TRACK_NUMBER, NULL)) |
3986 | 472 fileinfo_entry_set_text_free(entry_track, |
3490
602ec8c40d0d
Fixed to comply with the Tuple API changes.
Matti Hamalainen <ccr@tnsp.org>
parents:
3298
diff
changeset
|
473 g_strdup_printf("%d", tuple_get_int(tuple, FIELD_TRACK_NUMBER, NULL))); |
2313 | 474 |
4009
ba6258a39662
icon, codec and quality info added to file info box. Added new tuple field FIELD_MIMETYPE used for icon resolving
Eugene Zagidullin <e.asphyx@gmail.com>
parents:
3988
diff
changeset
|
475 fileinfo_label_set_text(label_codec_name, tuple_get_string(tuple, FIELD_CODEC, NULL)); |
ba6258a39662
icon, codec and quality info added to file info box. Added new tuple field FIELD_MIMETYPE used for icon resolving
Eugene Zagidullin <e.asphyx@gmail.com>
parents:
3988
diff
changeset
|
476 fileinfo_label_set_text(label_quality, tuple_get_string(tuple, FIELD_QUALITY, NULL)); |
ba6258a39662
icon, codec and quality info added to file info box. Added new tuple field FIELD_MIMETYPE used for icon resolving
Eugene Zagidullin <e.asphyx@gmail.com>
parents:
3988
diff
changeset
|
477 |
ba6258a39662
icon, codec and quality info added to file info box. Added new tuple field FIELD_MIMETYPE used for icon resolving
Eugene Zagidullin <e.asphyx@gmail.com>
parents:
3988
diff
changeset
|
478 tmp = (gchar *)tuple_get_string(tuple, FIELD_MIMETYPE, NULL); |
ba6258a39662
icon, codec and quality info added to file info box. Added new tuple field FIELD_MIMETYPE used for icon resolving
Eugene Zagidullin <e.asphyx@gmail.com>
parents:
3988
diff
changeset
|
479 icon = mime_icon_lookup(48, tmp ? tmp : "audio/x-generic"); |
ba6258a39662
icon, codec and quality info added to file info box. Added new tuple field FIELD_MIMETYPE used for icon resolving
Eugene Zagidullin <e.asphyx@gmail.com>
parents:
3988
diff
changeset
|
480 if (icon) { |
ba6258a39662
icon, codec and quality info added to file info box. Added new tuple field FIELD_MIMETYPE used for icon resolving
Eugene Zagidullin <e.asphyx@gmail.com>
parents:
3988
diff
changeset
|
481 if (image_fileicon) gtk_image_set_from_pixbuf (GTK_IMAGE(image_fileicon), icon); |
ba6258a39662
icon, codec and quality info added to file info box. Added new tuple field FIELD_MIMETYPE used for icon resolving
Eugene Zagidullin <e.asphyx@gmail.com>
parents:
3988
diff
changeset
|
482 g_object_unref(icon); |
ba6258a39662
icon, codec and quality info added to file info box. Added new tuple field FIELD_MIMETYPE used for icon resolving
Eugene Zagidullin <e.asphyx@gmail.com>
parents:
3988
diff
changeset
|
483 } |
ba6258a39662
icon, codec and quality info added to file info box. Added new tuple field FIELD_MIMETYPE used for icon resolving
Eugene Zagidullin <e.asphyx@gmail.com>
parents:
3988
diff
changeset
|
484 |
3490
602ec8c40d0d
Fixed to comply with the Tuple API changes.
Matti Hamalainen <ccr@tnsp.org>
parents:
3298
diff
changeset
|
485 tmp = fileinfo_recursive_get_image( |
602ec8c40d0d
Fixed to comply with the Tuple API changes.
Matti Hamalainen <ccr@tnsp.org>
parents:
3298
diff
changeset
|
486 tuple_get_string(tuple, FIELD_FILE_PATH, NULL), |
602ec8c40d0d
Fixed to comply with the Tuple API changes.
Matti Hamalainen <ccr@tnsp.org>
parents:
3298
diff
changeset
|
487 tuple_get_string(tuple, FIELD_FILE_NAME, NULL), 0); |
2313 | 488 |
489 if(tmp) | |
490 { | |
3986 | 491 fileinfo_entry_set_image(image_artwork, tmp); |
2313 | 492 g_free(tmp); |
493 } | |
494 | |
495 gtk_widget_show(fileinfo_win); | |
496 } | |
497 | |
498 void | |
499 fileinfo_show_for_path(gchar *path) | |
500 { | |
3298
f985357757e0
audacious-core: convert to tuple-ng, remove titlestring API.
William Pitcock <nenolod@atheme-project.org>
parents:
3123
diff
changeset
|
501 Tuple *tuple = input_get_song_tuple(path); |
2313 | 502 |
503 if (tuple == NULL) | |
504 return input_file_info_box(path); | |
505 | |
506 fileinfo_show_for_tuple(tuple); | |
507 | |
3298
f985357757e0
audacious-core: convert to tuple-ng, remove titlestring API.
William Pitcock <nenolod@atheme-project.org>
parents:
3123
diff
changeset
|
508 mowgli_object_unref(tuple); |
2313 | 509 } |