Mercurial > audlegacy
annotate audacious/ui_fileinfo.c @ 1810:df23110701d0 trunk
[svn] - load skins before creating the UI
author | nenolod |
---|---|
date | Wed, 04 Oct 2006 23:11:06 -0700 |
parents | 7d32dff734da |
children | 0f39dea9f26e |
rev | line source |
---|---|
1262 | 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 | |
8 * the Free Software Foundation; either version 2 of the License, or | |
9 * (at your option) any later version. | |
10 * | |
11 * This program is distributed in the hope that it will be useful, | |
12 * but WITHOUT ANY WARRANTY; without even the implied warranty of | |
13 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the | |
14 * GNU General Public License for more details. | |
15 * | |
16 * You should have received a copy of the GNU General Public License | |
17 * along with this program; if not, write to the Free Software | |
1459 | 18 * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. |
1262 | 19 */ |
20 | |
21 #ifdef HAVE_CONFIG_H | |
22 # include "config.h" | |
23 #endif | |
24 | |
25 #include <glib.h> | |
26 #include <glib/gi18n.h> | |
27 #include <gtk/gtk.h> | |
28 #include <glade/glade.h> | |
29 #include <string.h> | |
30 #include <stddef.h> | |
31 #include <stdio.h> | |
32 #include <sys/types.h> | |
33 #include <dirent.h> | |
34 #include <unistd.h> | |
35 #include <errno.h> | |
36 #include <sys/types.h> | |
37 #include <sys/stat.h> | |
38 | |
39 #include "glade.h" | |
40 | |
41 #include "plugin.h" | |
42 #include "pluginenum.h" | |
43 #include "input.h" | |
44 #include "effect.h" | |
45 #include "general.h" | |
46 #include "output.h" | |
47 #include "visualization.h" | |
48 | |
49 #include "main.h" | |
50 #include "urldecode.h" | |
51 #include "util.h" | |
52 #include "dnd.h" | |
1755 | 53 #include "titlestring.h" |
54 | |
1262 | 55 #include "libaudacious/configdb.h" |
56 | |
1283
19b1d3f22e10
[svn] - when hovering over a playlist tuple, describe the tuple via a tooltip-like popup
nenolod
parents:
1270
diff
changeset
|
57 #include "playlist.h" |
19b1d3f22e10
[svn] - when hovering over a playlist tuple, describe the tuple via a tooltip-like popup
nenolod
parents:
1270
diff
changeset
|
58 |
1262 | 59 #include "mainwin.h" |
60 #include "ui_playlist.h" | |
61 #include "skinwin.h" | |
62 #include "build_stamp.h" | |
63 #include "ui_fileinfo.h" | |
1284 | 64 #include "ui_playlist.h" |
1262 | 65 |
66 GtkWidget *fileinfo_win; | |
1283
19b1d3f22e10
[svn] - when hovering over a playlist tuple, describe the tuple via a tooltip-like popup
nenolod
parents:
1270
diff
changeset
|
67 GtkWidget *filepopup_win; |
1341 | 68 GdkPixbuf *filepopup_pixbuf; |
1262 | 69 |
70 static void | |
71 fileinfo_entry_set_text(const char *entry, const char *text) | |
72 { | |
73 GladeXML *xml = g_object_get_data(G_OBJECT(fileinfo_win), "glade-xml"); | |
74 GtkWidget *widget = glade_xml_get_widget(xml, entry); | |
75 | |
76 if (xml == NULL || widget == NULL) | |
77 return; | |
78 | |
79 gtk_entry_set_text(GTK_ENTRY(widget), text); | |
80 } | |
81 | |
82 static void | |
83 fileinfo_entry_set_text_free(const char *entry, char *text) | |
84 { | |
85 GladeXML *xml = g_object_get_data(G_OBJECT(fileinfo_win), "glade-xml"); | |
86 GtkWidget *widget = glade_xml_get_widget(xml, entry); | |
87 | |
88 if (xml == NULL || widget == NULL) | |
89 return; | |
90 | |
91 gtk_entry_set_text(GTK_ENTRY(widget), text); | |
92 | |
93 g_free(text); | |
94 } | |
95 | |
1283
19b1d3f22e10
[svn] - when hovering over a playlist tuple, describe the tuple via a tooltip-like popup
nenolod
parents:
1270
diff
changeset
|
96 static void |
1296 | 97 fileinfo_entry_set_image(const char *entry, const char *text) |
98 { | |
99 GladeXML *xml = g_object_get_data(G_OBJECT(fileinfo_win), "glade-xml"); | |
100 GtkWidget *widget = glade_xml_get_widget(xml, entry); | |
1299 | 101 GdkPixbuf *pixbuf; |
1710 | 102 int width, height; |
103 double aspect; | |
1296 | 104 |
105 if (xml == NULL || widget == NULL) | |
106 return; | |
107 | |
1299 | 108 pixbuf = gdk_pixbuf_new_from_file(text, NULL); |
109 | |
110 if (pixbuf == NULL) | |
111 return; | |
112 | |
1710 | 113 width = gdk_pixbuf_get_width(GDK_PIXBUF(pixbuf)); |
114 height = gdk_pixbuf_get_height(GDK_PIXBUF(pixbuf)); | |
115 | |
116 if(strcmp(DATA_DIR "/images/audio.png", text)) | |
1299 | 117 { |
1710 | 118 if(width == 0) |
119 width = 1; | |
120 aspect = (double)height / (double)width; | |
121 if(aspect > 1.0) { | |
122 height = (int)(cfg.filepopup_pixelsize * aspect); | |
123 width = cfg.filepopup_pixelsize; | |
124 } else { | |
125 height = cfg.filepopup_pixelsize; | |
126 width = (int)(cfg.filepopup_pixelsize / aspect); | |
127 } | |
128 GdkPixbuf *pixbuf2 = gdk_pixbuf_scale_simple(GDK_PIXBUF(pixbuf), width, height, GDK_INTERP_BILINEAR); | |
1299 | 129 g_object_unref(G_OBJECT(pixbuf)); |
130 pixbuf = pixbuf2; | |
131 } | |
132 | |
133 gtk_image_set_from_pixbuf(GTK_IMAGE(widget), GDK_PIXBUF(pixbuf)); | |
1326 | 134 g_object_unref(G_OBJECT(pixbuf)); |
1296 | 135 } |
136 | |
137 static void | |
1283
19b1d3f22e10
[svn] - when hovering over a playlist tuple, describe the tuple via a tooltip-like popup
nenolod
parents:
1270
diff
changeset
|
138 filepopup_entry_set_text(const char *entry, const char *text) |
19b1d3f22e10
[svn] - when hovering over a playlist tuple, describe the tuple via a tooltip-like popup
nenolod
parents:
1270
diff
changeset
|
139 { |
19b1d3f22e10
[svn] - when hovering over a playlist tuple, describe the tuple via a tooltip-like popup
nenolod
parents:
1270
diff
changeset
|
140 GladeXML *xml = g_object_get_data(G_OBJECT(filepopup_win), "glade-xml"); |
19b1d3f22e10
[svn] - when hovering over a playlist tuple, describe the tuple via a tooltip-like popup
nenolod
parents:
1270
diff
changeset
|
141 GtkWidget *widget = glade_xml_get_widget(xml, entry); |
19b1d3f22e10
[svn] - when hovering over a playlist tuple, describe the tuple via a tooltip-like popup
nenolod
parents:
1270
diff
changeset
|
142 |
19b1d3f22e10
[svn] - when hovering over a playlist tuple, describe the tuple via a tooltip-like popup
nenolod
parents:
1270
diff
changeset
|
143 if (xml == NULL || widget == NULL) |
19b1d3f22e10
[svn] - when hovering over a playlist tuple, describe the tuple via a tooltip-like popup
nenolod
parents:
1270
diff
changeset
|
144 return; |
19b1d3f22e10
[svn] - when hovering over a playlist tuple, describe the tuple via a tooltip-like popup
nenolod
parents:
1270
diff
changeset
|
145 |
19b1d3f22e10
[svn] - when hovering over a playlist tuple, describe the tuple via a tooltip-like popup
nenolod
parents:
1270
diff
changeset
|
146 gtk_label_set_text(GTK_LABEL(widget), text); |
19b1d3f22e10
[svn] - when hovering over a playlist tuple, describe the tuple via a tooltip-like popup
nenolod
parents:
1270
diff
changeset
|
147 } |
19b1d3f22e10
[svn] - when hovering over a playlist tuple, describe the tuple via a tooltip-like popup
nenolod
parents:
1270
diff
changeset
|
148 |
19b1d3f22e10
[svn] - when hovering over a playlist tuple, describe the tuple via a tooltip-like popup
nenolod
parents:
1270
diff
changeset
|
149 static void |
1296 | 150 filepopup_entry_set_image(const char *entry, const char *text) |
151 { | |
152 GladeXML *xml = g_object_get_data(G_OBJECT(filepopup_win), "glade-xml"); | |
153 GtkWidget *widget = glade_xml_get_widget(xml, entry); | |
1299 | 154 GdkPixbuf *pixbuf; |
1710 | 155 int width, height; |
156 double aspect; | |
1296 | 157 |
158 if (xml == NULL || widget == NULL) | |
159 return; | |
160 | |
1299 | 161 pixbuf = gdk_pixbuf_new_from_file(text, NULL); |
162 | |
163 if (pixbuf == NULL) | |
164 return; | |
165 | |
1710 | 166 width = gdk_pixbuf_get_width(GDK_PIXBUF(pixbuf)); |
167 height = gdk_pixbuf_get_height(GDK_PIXBUF(pixbuf)); | |
168 | |
169 if(strcmp(DATA_DIR "/images/audio.png", text)) | |
1299 | 170 { |
1710 | 171 if(width == 0) |
172 width = 1; | |
173 aspect = (double)height / (double)width; | |
174 if(aspect > 1.0) { | |
175 height = (int)(cfg.filepopup_pixelsize * aspect); | |
176 width = cfg.filepopup_pixelsize; | |
177 } else { | |
178 height = cfg.filepopup_pixelsize; | |
179 width = (int)(cfg.filepopup_pixelsize / aspect); | |
180 } | |
181 GdkPixbuf *pixbuf2 = gdk_pixbuf_scale_simple(GDK_PIXBUF(pixbuf), width, height, GDK_INTERP_BILINEAR); | |
1299 | 182 g_object_unref(G_OBJECT(pixbuf)); |
183 pixbuf = pixbuf2; | |
184 } | |
185 | |
186 gtk_image_set_from_pixbuf(GTK_IMAGE(widget), GDK_PIXBUF(pixbuf)); | |
1326 | 187 g_object_unref(G_OBJECT(pixbuf)); |
1296 | 188 } |
189 | |
190 static void | |
1283
19b1d3f22e10
[svn] - when hovering over a playlist tuple, describe the tuple via a tooltip-like popup
nenolod
parents:
1270
diff
changeset
|
191 filepopup_entry_set_text_free(const char *entry, char *text) |
19b1d3f22e10
[svn] - when hovering over a playlist tuple, describe the tuple via a tooltip-like popup
nenolod
parents:
1270
diff
changeset
|
192 { |
19b1d3f22e10
[svn] - when hovering over a playlist tuple, describe the tuple via a tooltip-like popup
nenolod
parents:
1270
diff
changeset
|
193 GladeXML *xml = g_object_get_data(G_OBJECT(filepopup_win), "glade-xml"); |
19b1d3f22e10
[svn] - when hovering over a playlist tuple, describe the tuple via a tooltip-like popup
nenolod
parents:
1270
diff
changeset
|
194 GtkWidget *widget = glade_xml_get_widget(xml, entry); |
19b1d3f22e10
[svn] - when hovering over a playlist tuple, describe the tuple via a tooltip-like popup
nenolod
parents:
1270
diff
changeset
|
195 |
19b1d3f22e10
[svn] - when hovering over a playlist tuple, describe the tuple via a tooltip-like popup
nenolod
parents:
1270
diff
changeset
|
196 if (xml == NULL || widget == NULL) |
19b1d3f22e10
[svn] - when hovering over a playlist tuple, describe the tuple via a tooltip-like popup
nenolod
parents:
1270
diff
changeset
|
197 return; |
19b1d3f22e10
[svn] - when hovering over a playlist tuple, describe the tuple via a tooltip-like popup
nenolod
parents:
1270
diff
changeset
|
198 |
19b1d3f22e10
[svn] - when hovering over a playlist tuple, describe the tuple via a tooltip-like popup
nenolod
parents:
1270
diff
changeset
|
199 gtk_label_set_text(GTK_LABEL(widget), text); |
19b1d3f22e10
[svn] - when hovering over a playlist tuple, describe the tuple via a tooltip-like popup
nenolod
parents:
1270
diff
changeset
|
200 |
19b1d3f22e10
[svn] - when hovering over a playlist tuple, describe the tuple via a tooltip-like popup
nenolod
parents:
1270
diff
changeset
|
201 g_free(text); |
19b1d3f22e10
[svn] - when hovering over a playlist tuple, describe the tuple via a tooltip-like popup
nenolod
parents:
1270
diff
changeset
|
202 } |
19b1d3f22e10
[svn] - when hovering over a playlist tuple, describe the tuple via a tooltip-like popup
nenolod
parents:
1270
diff
changeset
|
203 |
19b1d3f22e10
[svn] - when hovering over a playlist tuple, describe the tuple via a tooltip-like popup
nenolod
parents:
1270
diff
changeset
|
204 static gboolean |
19b1d3f22e10
[svn] - when hovering over a playlist tuple, describe the tuple via a tooltip-like popup
nenolod
parents:
1270
diff
changeset
|
205 filepopup_pointer_check_iter(gpointer unused) |
19b1d3f22e10
[svn] - when hovering over a playlist tuple, describe the tuple via a tooltip-like popup
nenolod
parents:
1270
diff
changeset
|
206 { |
1312 | 207 gint x, y, pos; |
1283
19b1d3f22e10
[svn] - when hovering over a playlist tuple, describe the tuple via a tooltip-like popup
nenolod
parents:
1270
diff
changeset
|
208 TitleInput *tuple; |
1605
ce3ce44d6814
[svn] - filepopup follows change of pointed song, i.e. it will hide while scrolling.
yaz
parents:
1588
diff
changeset
|
209 static gint prev_x = 0, prev_y = 0, ctr = 0, prev_pos = -1; |
1775 | 210 static gint shaded_pos = -1, shaded_prev_pos = -1; |
1300
a5c4e748d557
[svn] - don't call filepopup_show_for_tuple() more than once
nenolod
parents:
1299
diff
changeset
|
211 gboolean skip = FALSE; |
1605
ce3ce44d6814
[svn] - filepopup follows change of pointed song, i.e. it will hide while scrolling.
yaz
parents:
1588
diff
changeset
|
212 GdkWindow *win; |
ce3ce44d6814
[svn] - filepopup follows change of pointed song, i.e. it will hide while scrolling.
yaz
parents:
1588
diff
changeset
|
213 |
ce3ce44d6814
[svn] - filepopup follows change of pointed song, i.e. it will hide while scrolling.
yaz
parents:
1588
diff
changeset
|
214 win = gdk_window_at_pointer(NULL, NULL); |
ce3ce44d6814
[svn] - filepopup follows change of pointed song, i.e. it will hide while scrolling.
yaz
parents:
1588
diff
changeset
|
215 gdk_window_get_pointer(GDK_WINDOW(playlistwin->window), &x, &y, NULL); |
ce3ce44d6814
[svn] - filepopup follows change of pointed song, i.e. it will hide while scrolling.
yaz
parents:
1588
diff
changeset
|
216 pos = playlist_list_get_playlist_position(playlistwin_list, x, y); |
1283
19b1d3f22e10
[svn] - when hovering over a playlist tuple, describe the tuple via a tooltip-like popup
nenolod
parents:
1270
diff
changeset
|
217 |
1605
ce3ce44d6814
[svn] - filepopup follows change of pointed song, i.e. it will hide while scrolling.
yaz
parents:
1588
diff
changeset
|
218 if (win == NULL |
ce3ce44d6814
[svn] - filepopup follows change of pointed song, i.e. it will hide while scrolling.
yaz
parents:
1588
diff
changeset
|
219 || cfg.show_filepopup_for_tuple == FALSE |
1401
3bc53d7f9012
[svn] - now filepopup_pointer_check_iter() returns immediately if cfg.show_filepopup_for_tuple is FALSE.
yaz
parents:
1389
diff
changeset
|
220 || playlistwin_list->pl_tooltips == FALSE |
1605
ce3ce44d6814
[svn] - filepopup follows change of pointed song, i.e. it will hide while scrolling.
yaz
parents:
1588
diff
changeset
|
221 || pos != prev_pos |
1775 | 222 || win != GDK_WINDOW(playlistwin->window)) |
1284 | 223 { |
1605
ce3ce44d6814
[svn] - filepopup follows change of pointed song, i.e. it will hide while scrolling.
yaz
parents:
1588
diff
changeset
|
224 prev_pos = pos; |
1284 | 225 ctr = 0; |
1389
c19443be579d
[svn] ensure that the fileinfo popup in playlist disappears when the cursor is moved again
giacomo
parents:
1371
diff
changeset
|
226 if ( filepopup_win->window != NULL && |
c19443be579d
[svn] ensure that the fileinfo popup in playlist disappears when the cursor is moved again
giacomo
parents:
1371
diff
changeset
|
227 gdk_window_is_viewable(GDK_WINDOW(filepopup_win->window)) ) |
c19443be579d
[svn] ensure that the fileinfo popup in playlist disappears when the cursor is moved again
giacomo
parents:
1371
diff
changeset
|
228 filepopup_hide(NULL); |
1284 | 229 return TRUE; |
230 } | |
231 | |
1283
19b1d3f22e10
[svn] - when hovering over a playlist tuple, describe the tuple via a tooltip-like popup
nenolod
parents:
1270
diff
changeset
|
232 if (prev_x == x && prev_y == y) |
19b1d3f22e10
[svn] - when hovering over a playlist tuple, describe the tuple via a tooltip-like popup
nenolod
parents:
1270
diff
changeset
|
233 ctr++; |
19b1d3f22e10
[svn] - when hovering over a playlist tuple, describe the tuple via a tooltip-like popup
nenolod
parents:
1270
diff
changeset
|
234 else |
19b1d3f22e10
[svn] - when hovering over a playlist tuple, describe the tuple via a tooltip-like popup
nenolod
parents:
1270
diff
changeset
|
235 { |
19b1d3f22e10
[svn] - when hovering over a playlist tuple, describe the tuple via a tooltip-like popup
nenolod
parents:
1270
diff
changeset
|
236 ctr = 0; |
19b1d3f22e10
[svn] - when hovering over a playlist tuple, describe the tuple via a tooltip-like popup
nenolod
parents:
1270
diff
changeset
|
237 prev_x = x; |
19b1d3f22e10
[svn] - when hovering over a playlist tuple, describe the tuple via a tooltip-like popup
nenolod
parents:
1270
diff
changeset
|
238 prev_y = y; |
19b1d3f22e10
[svn] - when hovering over a playlist tuple, describe the tuple via a tooltip-like popup
nenolod
parents:
1270
diff
changeset
|
239 filepopup_hide(NULL); |
19b1d3f22e10
[svn] - when hovering over a playlist tuple, describe the tuple via a tooltip-like popup
nenolod
parents:
1270
diff
changeset
|
240 return TRUE; |
19b1d3f22e10
[svn] - when hovering over a playlist tuple, describe the tuple via a tooltip-like popup
nenolod
parents:
1270
diff
changeset
|
241 } |
19b1d3f22e10
[svn] - when hovering over a playlist tuple, describe the tuple via a tooltip-like popup
nenolod
parents:
1270
diff
changeset
|
242 |
1300
a5c4e748d557
[svn] - don't call filepopup_show_for_tuple() more than once
nenolod
parents:
1299
diff
changeset
|
243 if (filepopup_win->window == NULL) |
a5c4e748d557
[svn] - don't call filepopup_show_for_tuple() more than once
nenolod
parents:
1299
diff
changeset
|
244 skip = TRUE; |
a5c4e748d557
[svn] - don't call filepopup_show_for_tuple() more than once
nenolod
parents:
1299
diff
changeset
|
245 |
1775 | 246 if (playlistwin_is_shaded()) { |
247 shaded_pos = playlist_get_position(); | |
248 if (shaded_prev_pos != shaded_pos) | |
249 skip = TRUE; | |
250 } | |
251 | |
252 if (ctr >= cfg.filepopup_delay && (skip == TRUE || gdk_window_is_viewable(GDK_WINDOW(filepopup_win->window)) != TRUE)) { | |
253 if (pos == -1 && !playlistwin_is_shaded()) { | |
1283
19b1d3f22e10
[svn] - when hovering over a playlist tuple, describe the tuple via a tooltip-like popup
nenolod
parents:
1270
diff
changeset
|
254 filepopup_hide(NULL); |
19b1d3f22e10
[svn] - when hovering over a playlist tuple, describe the tuple via a tooltip-like popup
nenolod
parents:
1270
diff
changeset
|
255 return TRUE; |
19b1d3f22e10
[svn] - when hovering over a playlist tuple, describe the tuple via a tooltip-like popup
nenolod
parents:
1270
diff
changeset
|
256 } |
1775 | 257 else { /* shaded mode */ |
258 tuple = playlist_get_tuple(shaded_pos); | |
259 filepopup_hide(NULL); | |
260 filepopup_show_for_tuple(tuple); | |
261 shaded_prev_pos = shaded_pos; | |
262 } | |
1283
19b1d3f22e10
[svn] - when hovering over a playlist tuple, describe the tuple via a tooltip-like popup
nenolod
parents:
1270
diff
changeset
|
263 |
1605
ce3ce44d6814
[svn] - filepopup follows change of pointed song, i.e. it will hide while scrolling.
yaz
parents:
1588
diff
changeset
|
264 prev_pos = pos; |
ce3ce44d6814
[svn] - filepopup follows change of pointed song, i.e. it will hide while scrolling.
yaz
parents:
1588
diff
changeset
|
265 |
1283
19b1d3f22e10
[svn] - when hovering over a playlist tuple, describe the tuple via a tooltip-like popup
nenolod
parents:
1270
diff
changeset
|
266 tuple = playlist_get_tuple(pos); |
1401
3bc53d7f9012
[svn] - now filepopup_pointer_check_iter() returns immediately if cfg.show_filepopup_for_tuple is FALSE.
yaz
parents:
1389
diff
changeset
|
267 filepopup_show_for_tuple(tuple); |
1283
19b1d3f22e10
[svn] - when hovering over a playlist tuple, describe the tuple via a tooltip-like popup
nenolod
parents:
1270
diff
changeset
|
268 } |
19b1d3f22e10
[svn] - when hovering over a playlist tuple, describe the tuple via a tooltip-like popup
nenolod
parents:
1270
diff
changeset
|
269 |
19b1d3f22e10
[svn] - when hovering over a playlist tuple, describe the tuple via a tooltip-like popup
nenolod
parents:
1270
diff
changeset
|
270 return TRUE; |
19b1d3f22e10
[svn] - when hovering over a playlist tuple, describe the tuple via a tooltip-like popup
nenolod
parents:
1270
diff
changeset
|
271 } |
19b1d3f22e10
[svn] - when hovering over a playlist tuple, describe the tuple via a tooltip-like popup
nenolod
parents:
1270
diff
changeset
|
272 |
1267 | 273 void fileinfo_hide(gpointer unused) |
274 { | |
275 gtk_widget_hide(fileinfo_win); | |
276 | |
277 /* Clear it out. */ | |
278 fileinfo_entry_set_text("entry_title", ""); | |
279 fileinfo_entry_set_text("entry_artist", ""); | |
280 fileinfo_entry_set_text("entry_album", ""); | |
281 fileinfo_entry_set_text("entry_comment", ""); | |
282 fileinfo_entry_set_text("entry_genre", ""); | |
283 fileinfo_entry_set_text("entry_year", ""); | |
284 fileinfo_entry_set_text("entry_track", ""); | |
285 fileinfo_entry_set_text("entry_location", ""); | |
1307
63d30ae1db33
[svn] - reset the album art back to the default icon
nenolod
parents:
1306
diff
changeset
|
286 |
63d30ae1db33
[svn] - reset the album art back to the default icon
nenolod
parents:
1306
diff
changeset
|
287 fileinfo_entry_set_image("image_artwork", DATA_DIR "/images/audio.png"); |
1267 | 288 } |
289 | |
1283
19b1d3f22e10
[svn] - when hovering over a playlist tuple, describe the tuple via a tooltip-like popup
nenolod
parents:
1270
diff
changeset
|
290 void filepopup_hide(gpointer unused) |
19b1d3f22e10
[svn] - when hovering over a playlist tuple, describe the tuple via a tooltip-like popup
nenolod
parents:
1270
diff
changeset
|
291 { |
19b1d3f22e10
[svn] - when hovering over a playlist tuple, describe the tuple via a tooltip-like popup
nenolod
parents:
1270
diff
changeset
|
292 gtk_widget_hide(filepopup_win); |
19b1d3f22e10
[svn] - when hovering over a playlist tuple, describe the tuple via a tooltip-like popup
nenolod
parents:
1270
diff
changeset
|
293 |
19b1d3f22e10
[svn] - when hovering over a playlist tuple, describe the tuple via a tooltip-like popup
nenolod
parents:
1270
diff
changeset
|
294 filepopup_entry_set_text("label_title", ""); |
19b1d3f22e10
[svn] - when hovering over a playlist tuple, describe the tuple via a tooltip-like popup
nenolod
parents:
1270
diff
changeset
|
295 filepopup_entry_set_text("label_artist", ""); |
19b1d3f22e10
[svn] - when hovering over a playlist tuple, describe the tuple via a tooltip-like popup
nenolod
parents:
1270
diff
changeset
|
296 filepopup_entry_set_text("label_album", ""); |
1296 | 297 filepopup_entry_set_text("label_genre", ""); |
298 filepopup_entry_set_text("label_track", ""); | |
299 filepopup_entry_set_text("label_year", ""); | |
300 filepopup_entry_set_text("label_length", ""); | |
1297 | 301 |
1307
63d30ae1db33
[svn] - reset the album art back to the default icon
nenolod
parents:
1306
diff
changeset
|
302 |
1297 | 303 gtk_window_resize(GTK_WINDOW(filepopup_win), 1, 1); |
1283
19b1d3f22e10
[svn] - when hovering over a playlist tuple, describe the tuple via a tooltip-like popup
nenolod
parents:
1270
diff
changeset
|
304 } |
19b1d3f22e10
[svn] - when hovering over a playlist tuple, describe the tuple via a tooltip-like popup
nenolod
parents:
1270
diff
changeset
|
305 |
1262 | 306 void |
307 create_fileinfo_window(void) | |
308 { | |
1263 | 309 const gchar *glade_file = DATA_DIR "/glade/fileinfo.glade"; |
1262 | 310 GladeXML *xml; |
311 GtkWidget *widget; | |
312 | |
313 xml = glade_xml_new_or_die(_("Track Information Window"), glade_file, NULL, NULL); | |
314 | |
315 glade_xml_signal_autoconnect(xml); | |
316 | |
317 fileinfo_win = glade_xml_get_widget(xml, "fileinfo_win"); | |
318 g_object_set_data(G_OBJECT(fileinfo_win), "glade-xml", xml); | |
319 gtk_window_set_transient_for(GTK_WINDOW(fileinfo_win), GTK_WINDOW(mainwin)); | |
320 | |
321 widget = glade_xml_get_widget(xml, "image_artwork"); | |
322 gtk_image_set_from_file(GTK_IMAGE(widget), DATA_DIR "/images/audio.png"); | |
1267 | 323 |
324 widget = glade_xml_get_widget(xml, "btn_close"); | |
325 g_signal_connect(G_OBJECT(widget), "clicked", (GCallback) fileinfo_hide, NULL); | |
1262 | 326 } |
327 | |
328 void | |
1283
19b1d3f22e10
[svn] - when hovering over a playlist tuple, describe the tuple via a tooltip-like popup
nenolod
parents:
1270
diff
changeset
|
329 create_filepopup_window(void) |
19b1d3f22e10
[svn] - when hovering over a playlist tuple, describe the tuple via a tooltip-like popup
nenolod
parents:
1270
diff
changeset
|
330 { |
19b1d3f22e10
[svn] - when hovering over a playlist tuple, describe the tuple via a tooltip-like popup
nenolod
parents:
1270
diff
changeset
|
331 const gchar *glade_file = DATA_DIR "/glade/fileinfo_popup.glade"; |
19b1d3f22e10
[svn] - when hovering over a playlist tuple, describe the tuple via a tooltip-like popup
nenolod
parents:
1270
diff
changeset
|
332 GladeXML *xml; |
19b1d3f22e10
[svn] - when hovering over a playlist tuple, describe the tuple via a tooltip-like popup
nenolod
parents:
1270
diff
changeset
|
333 GtkWidget *widget; |
1287
e778f43a74fb
[svn] - make tuples more verbose (they might be a bit big though)
nenolod
parents:
1286
diff
changeset
|
334 |
1283
19b1d3f22e10
[svn] - when hovering over a playlist tuple, describe the tuple via a tooltip-like popup
nenolod
parents:
1270
diff
changeset
|
335 xml = glade_xml_new_or_die(_("Track Information Popup"), glade_file, NULL, NULL); |
19b1d3f22e10
[svn] - when hovering over a playlist tuple, describe the tuple via a tooltip-like popup
nenolod
parents:
1270
diff
changeset
|
336 |
19b1d3f22e10
[svn] - when hovering over a playlist tuple, describe the tuple via a tooltip-like popup
nenolod
parents:
1270
diff
changeset
|
337 glade_xml_signal_autoconnect(xml); |
19b1d3f22e10
[svn] - when hovering over a playlist tuple, describe the tuple via a tooltip-like popup
nenolod
parents:
1270
diff
changeset
|
338 |
19b1d3f22e10
[svn] - when hovering over a playlist tuple, describe the tuple via a tooltip-like popup
nenolod
parents:
1270
diff
changeset
|
339 filepopup_win = glade_xml_get_widget(xml, "win_pl_popup"); |
19b1d3f22e10
[svn] - when hovering over a playlist tuple, describe the tuple via a tooltip-like popup
nenolod
parents:
1270
diff
changeset
|
340 g_object_set_data(G_OBJECT(filepopup_win), "glade-xml", xml); |
19b1d3f22e10
[svn] - when hovering over a playlist tuple, describe the tuple via a tooltip-like popup
nenolod
parents:
1270
diff
changeset
|
341 gtk_window_set_transient_for(GTK_WINDOW(filepopup_win), GTK_WINDOW(mainwin)); |
19b1d3f22e10
[svn] - when hovering over a playlist tuple, describe the tuple via a tooltip-like popup
nenolod
parents:
1270
diff
changeset
|
342 |
19b1d3f22e10
[svn] - when hovering over a playlist tuple, describe the tuple via a tooltip-like popup
nenolod
parents:
1270
diff
changeset
|
343 widget = glade_xml_get_widget(xml, "image_artwork"); |
19b1d3f22e10
[svn] - when hovering over a playlist tuple, describe the tuple via a tooltip-like popup
nenolod
parents:
1270
diff
changeset
|
344 gtk_image_set_from_file(GTK_IMAGE(widget), DATA_DIR "/images/audio.png"); |
19b1d3f22e10
[svn] - when hovering over a playlist tuple, describe the tuple via a tooltip-like popup
nenolod
parents:
1270
diff
changeset
|
345 |
19b1d3f22e10
[svn] - when hovering over a playlist tuple, describe the tuple via a tooltip-like popup
nenolod
parents:
1270
diff
changeset
|
346 g_timeout_add(50, filepopup_pointer_check_iter, NULL); |
19b1d3f22e10
[svn] - when hovering over a playlist tuple, describe the tuple via a tooltip-like popup
nenolod
parents:
1270
diff
changeset
|
347 } |
19b1d3f22e10
[svn] - when hovering over a playlist tuple, describe the tuple via a tooltip-like popup
nenolod
parents:
1270
diff
changeset
|
348 |
19b1d3f22e10
[svn] - when hovering over a playlist tuple, describe the tuple via a tooltip-like popup
nenolod
parents:
1270
diff
changeset
|
349 void |
1262 | 350 fileinfo_show_for_tuple(TitleInput *tuple) |
351 { | |
1402
1abfc389ecc6
[svn] fileinfo_show_for_tuple() sometimes causes "Invalid UTF-8 string"
yaz
parents:
1401
diff
changeset
|
352 gchar *tmp = NULL; |
1296 | 353 |
1262 | 354 if (tuple == NULL) |
355 return; | |
356 | |
357 gtk_widget_realize(fileinfo_win); | |
358 | |
359 fileinfo_entry_set_text("entry_title", tuple->track_name); | |
360 fileinfo_entry_set_text("entry_artist", tuple->performer); | |
361 fileinfo_entry_set_text("entry_album", tuple->album_name); | |
362 fileinfo_entry_set_text("entry_comment", tuple->comment); | |
363 fileinfo_entry_set_text("entry_genre", tuple->genre); | |
1402
1abfc389ecc6
[svn] fileinfo_show_for_tuple() sometimes causes "Invalid UTF-8 string"
yaz
parents:
1401
diff
changeset
|
364 |
1abfc389ecc6
[svn] fileinfo_show_for_tuple() sometimes causes "Invalid UTF-8 string"
yaz
parents:
1401
diff
changeset
|
365 tmp = g_strdup_printf("%s/%s", tuple->file_path, tuple->file_name); |
1abfc389ecc6
[svn] fileinfo_show_for_tuple() sometimes causes "Invalid UTF-8 string"
yaz
parents:
1401
diff
changeset
|
366 if(tmp){ |
1abfc389ecc6
[svn] fileinfo_show_for_tuple() sometimes causes "Invalid UTF-8 string"
yaz
parents:
1401
diff
changeset
|
367 fileinfo_entry_set_text_free("entry_location", str_to_utf8(tmp)); |
1abfc389ecc6
[svn] fileinfo_show_for_tuple() sometimes causes "Invalid UTF-8 string"
yaz
parents:
1401
diff
changeset
|
368 g_free(tmp); |
1abfc389ecc6
[svn] fileinfo_show_for_tuple() sometimes causes "Invalid UTF-8 string"
yaz
parents:
1401
diff
changeset
|
369 tmp = NULL; |
1abfc389ecc6
[svn] fileinfo_show_for_tuple() sometimes causes "Invalid UTF-8 string"
yaz
parents:
1401
diff
changeset
|
370 } |
1262 | 371 |
372 if (tuple->year != 0) | |
373 fileinfo_entry_set_text_free("entry_year", g_strdup_printf("%d", tuple->year)); | |
374 | |
375 if (tuple->track_number != 0) | |
376 fileinfo_entry_set_text_free("entry_track", g_strdup_printf("%d", tuple->track_number)); | |
377 | |
1371
ca4f3115d33c
[svn] - recursively locate album art, by external contributor Oliver Lumpton.
nenolod
parents:
1358
diff
changeset
|
378 tmp = fileinfo_recursive_get_image(tuple->file_path, 0); |
ca4f3115d33c
[svn] - recursively locate album art, by external contributor Oliver Lumpton.
nenolod
parents:
1358
diff
changeset
|
379 |
ca4f3115d33c
[svn] - recursively locate album art, by external contributor Oliver Lumpton.
nenolod
parents:
1358
diff
changeset
|
380 if(tmp) |
ca4f3115d33c
[svn] - recursively locate album art, by external contributor Oliver Lumpton.
nenolod
parents:
1358
diff
changeset
|
381 { |
ca4f3115d33c
[svn] - recursively locate album art, by external contributor Oliver Lumpton.
nenolod
parents:
1358
diff
changeset
|
382 fileinfo_entry_set_image("image_artwork", tmp); |
ca4f3115d33c
[svn] - recursively locate album art, by external contributor Oliver Lumpton.
nenolod
parents:
1358
diff
changeset
|
383 g_free(tmp); |
ca4f3115d33c
[svn] - recursively locate album art, by external contributor Oliver Lumpton.
nenolod
parents:
1358
diff
changeset
|
384 } |
ca4f3115d33c
[svn] - recursively locate album art, by external contributor Oliver Lumpton.
nenolod
parents:
1358
diff
changeset
|
385 |
ca4f3115d33c
[svn] - recursively locate album art, by external contributor Oliver Lumpton.
nenolod
parents:
1358
diff
changeset
|
386 gtk_widget_show(fileinfo_win); |
ca4f3115d33c
[svn] - recursively locate album art, by external contributor Oliver Lumpton.
nenolod
parents:
1358
diff
changeset
|
387 } |
ca4f3115d33c
[svn] - recursively locate album art, by external contributor Oliver Lumpton.
nenolod
parents:
1358
diff
changeset
|
388 |
1413 | 389 static gboolean |
390 cover_name_filter(const gchar *name, const gchar *filter, const gboolean ret_on_empty) | |
391 { | |
392 gboolean result = FALSE; | |
393 gchar **splitted; | |
394 gchar *current; | |
395 gchar *lname; | |
396 gint i; | |
397 | |
398 if (!filter || strlen(filter) == 0) { | |
399 return ret_on_empty; | |
400 } | |
401 | |
402 splitted = g_strsplit(filter, ",", 0); | |
403 | |
404 lname = g_strdup(name); | |
405 g_strdown(lname); | |
406 | |
407 for (i = 0; !result && (current = splitted[i]); i++) { | |
408 gchar *stripped = g_strstrip(g_strdup(current)); | |
409 g_strdown(stripped); | |
410 | |
411 result = result || strstr(lname, stripped); | |
412 | |
413 g_free(stripped); | |
414 } | |
415 | |
416 g_free(lname); | |
417 g_strfreev(splitted); | |
418 | |
419 return result; | |
420 } | |
421 | |
422 /* Check wether it's an image we want */ | |
423 static gboolean | |
424 is_front_cover_image(const gchar *name) | |
425 { | |
426 char *ext; | |
427 | |
428 ext = strrchr(name, '.'); | |
429 if (!ext) { | |
430 /* No file extension */ | |
431 return FALSE; | |
432 } | |
433 | |
434 if (g_strcasecmp(ext, ".jpg") != 0 && | |
435 g_strcasecmp(ext, ".jpeg") != 0 && | |
436 g_strcasecmp(ext, ".png") != 0) { | |
437 /* No recognized file extension */ | |
438 return FALSE; | |
439 } | |
440 | |
441 return cover_name_filter(name, cfg.cover_name_include, TRUE) && | |
442 !cover_name_filter(name, cfg.cover_name_exclude, FALSE); | |
443 } | |
444 | |
1371
ca4f3115d33c
[svn] - recursively locate album art, by external contributor Oliver Lumpton.
nenolod
parents:
1358
diff
changeset
|
445 gchar* |
ca4f3115d33c
[svn] - recursively locate album art, by external contributor Oliver Lumpton.
nenolod
parents:
1358
diff
changeset
|
446 fileinfo_recursive_get_image(const gchar* path, gint depth) |
ca4f3115d33c
[svn] - recursively locate album art, by external contributor Oliver Lumpton.
nenolod
parents:
1358
diff
changeset
|
447 { |
ca4f3115d33c
[svn] - recursively locate album art, by external contributor Oliver Lumpton.
nenolod
parents:
1358
diff
changeset
|
448 GDir *d; |
ca4f3115d33c
[svn] - recursively locate album art, by external contributor Oliver Lumpton.
nenolod
parents:
1358
diff
changeset
|
449 |
1429
a360afd8df52
[svn] Make annoying recursion that consistently returns wrong art, optional.
nemo
parents:
1413
diff
changeset
|
450 if (cfg.recurse_for_cover && depth > cfg.recurse_for_cover_depth) |
1371
ca4f3115d33c
[svn] - recursively locate album art, by external contributor Oliver Lumpton.
nenolod
parents:
1358
diff
changeset
|
451 return NULL; |
ca4f3115d33c
[svn] - recursively locate album art, by external contributor Oliver Lumpton.
nenolod
parents:
1358
diff
changeset
|
452 |
ca4f3115d33c
[svn] - recursively locate album art, by external contributor Oliver Lumpton.
nenolod
parents:
1358
diff
changeset
|
453 d = g_dir_open(path, 0, NULL); |
ca4f3115d33c
[svn] - recursively locate album art, by external contributor Oliver Lumpton.
nenolod
parents:
1358
diff
changeset
|
454 |
1666
77baac5f7439
[svn] - make fileinfo_recursive_get_image() breadth first search.
yaz
parents:
1611
diff
changeset
|
455 if (d) { |
1306
d44e5df149dc
[svn] - not sure what all of that cur_dir stuff was, but I think somebody was smoking crack
nenolod
parents:
1304
diff
changeset
|
456 const gchar *f = g_dir_read_name(d); |
1371
ca4f3115d33c
[svn] - recursively locate album art, by external contributor Oliver Lumpton.
nenolod
parents:
1358
diff
changeset
|
457 |
1666
77baac5f7439
[svn] - make fileinfo_recursive_get_image() breadth first search.
yaz
parents:
1611
diff
changeset
|
458 /* first pass only searches for files. */ |
77baac5f7439
[svn] - make fileinfo_recursive_get_image() breadth first search.
yaz
parents:
1611
diff
changeset
|
459 while(f) { |
1371
ca4f3115d33c
[svn] - recursively locate album art, by external contributor Oliver Lumpton.
nenolod
parents:
1358
diff
changeset
|
460 gchar *newpath = g_strdup_printf("%s/%s", path, f); |
1413 | 461 |
1666
77baac5f7439
[svn] - make fileinfo_recursive_get_image() breadth first search.
yaz
parents:
1611
diff
changeset
|
462 if(!g_file_test(newpath, G_FILE_TEST_IS_DIR)) { |
77baac5f7439
[svn] - make fileinfo_recursive_get_image() breadth first search.
yaz
parents:
1611
diff
changeset
|
463 if(is_front_cover_image(f)) { |
77baac5f7439
[svn] - make fileinfo_recursive_get_image() breadth first search.
yaz
parents:
1611
diff
changeset
|
464 g_dir_close(d); |
77baac5f7439
[svn] - make fileinfo_recursive_get_image() breadth first search.
yaz
parents:
1611
diff
changeset
|
465 return newpath; |
1371
ca4f3115d33c
[svn] - recursively locate album art, by external contributor Oliver Lumpton.
nenolod
parents:
1358
diff
changeset
|
466 } |
1306
d44e5df149dc
[svn] - not sure what all of that cur_dir stuff was, but I think somebody was smoking crack
nenolod
parents:
1304
diff
changeset
|
467 } |
1666
77baac5f7439
[svn] - make fileinfo_recursive_get_image() breadth first search.
yaz
parents:
1611
diff
changeset
|
468 g_free(newpath); |
77baac5f7439
[svn] - make fileinfo_recursive_get_image() breadth first search.
yaz
parents:
1611
diff
changeset
|
469 f = g_dir_read_name(d); |
1303 | 470 } |
1666
77baac5f7439
[svn] - make fileinfo_recursive_get_image() breadth first search.
yaz
parents:
1611
diff
changeset
|
471 |
77baac5f7439
[svn] - make fileinfo_recursive_get_image() breadth first search.
yaz
parents:
1611
diff
changeset
|
472 /* checks whether recursive or not. */ |
77baac5f7439
[svn] - make fileinfo_recursive_get_image() breadth first search.
yaz
parents:
1611
diff
changeset
|
473 if(!cfg.recurse_for_cover) { |
77baac5f7439
[svn] - make fileinfo_recursive_get_image() breadth first search.
yaz
parents:
1611
diff
changeset
|
474 g_dir_close(d); |
77baac5f7439
[svn] - make fileinfo_recursive_get_image() breadth first search.
yaz
parents:
1611
diff
changeset
|
475 return NULL; |
77baac5f7439
[svn] - make fileinfo_recursive_get_image() breadth first search.
yaz
parents:
1611
diff
changeset
|
476 } |
77baac5f7439
[svn] - make fileinfo_recursive_get_image() breadth first search.
yaz
parents:
1611
diff
changeset
|
477 |
77baac5f7439
[svn] - make fileinfo_recursive_get_image() breadth first search.
yaz
parents:
1611
diff
changeset
|
478 /* second pass descends directory recursively. */ |
77baac5f7439
[svn] - make fileinfo_recursive_get_image() breadth first search.
yaz
parents:
1611
diff
changeset
|
479 g_dir_rewind(d); |
77baac5f7439
[svn] - make fileinfo_recursive_get_image() breadth first search.
yaz
parents:
1611
diff
changeset
|
480 f = g_dir_read_name(d); |
77baac5f7439
[svn] - make fileinfo_recursive_get_image() breadth first search.
yaz
parents:
1611
diff
changeset
|
481 |
77baac5f7439
[svn] - make fileinfo_recursive_get_image() breadth first search.
yaz
parents:
1611
diff
changeset
|
482 while(f) { |
77baac5f7439
[svn] - make fileinfo_recursive_get_image() breadth first search.
yaz
parents:
1611
diff
changeset
|
483 gchar *newpath = g_strdup_printf("%s/%s", path, f); |
77baac5f7439
[svn] - make fileinfo_recursive_get_image() breadth first search.
yaz
parents:
1611
diff
changeset
|
484 |
77baac5f7439
[svn] - make fileinfo_recursive_get_image() breadth first search.
yaz
parents:
1611
diff
changeset
|
485 if(g_file_test(newpath, G_FILE_TEST_IS_DIR)) { |
77baac5f7439
[svn] - make fileinfo_recursive_get_image() breadth first search.
yaz
parents:
1611
diff
changeset
|
486 gchar *tmp = fileinfo_recursive_get_image(newpath, depth+1); |
77baac5f7439
[svn] - make fileinfo_recursive_get_image() breadth first search.
yaz
parents:
1611
diff
changeset
|
487 if(tmp) { |
77baac5f7439
[svn] - make fileinfo_recursive_get_image() breadth first search.
yaz
parents:
1611
diff
changeset
|
488 g_free(newpath); |
77baac5f7439
[svn] - make fileinfo_recursive_get_image() breadth first search.
yaz
parents:
1611
diff
changeset
|
489 g_dir_close(d); |
77baac5f7439
[svn] - make fileinfo_recursive_get_image() breadth first search.
yaz
parents:
1611
diff
changeset
|
490 return tmp; |
77baac5f7439
[svn] - make fileinfo_recursive_get_image() breadth first search.
yaz
parents:
1611
diff
changeset
|
491 } |
77baac5f7439
[svn] - make fileinfo_recursive_get_image() breadth first search.
yaz
parents:
1611
diff
changeset
|
492 } |
77baac5f7439
[svn] - make fileinfo_recursive_get_image() breadth first search.
yaz
parents:
1611
diff
changeset
|
493 g_free(newpath); |
77baac5f7439
[svn] - make fileinfo_recursive_get_image() breadth first search.
yaz
parents:
1611
diff
changeset
|
494 f = g_dir_read_name(d); |
77baac5f7439
[svn] - make fileinfo_recursive_get_image() breadth first search.
yaz
parents:
1611
diff
changeset
|
495 } |
77baac5f7439
[svn] - make fileinfo_recursive_get_image() breadth first search.
yaz
parents:
1611
diff
changeset
|
496 |
1306
d44e5df149dc
[svn] - not sure what all of that cur_dir stuff was, but I think somebody was smoking crack
nenolod
parents:
1304
diff
changeset
|
497 g_dir_close(d); |
1666
77baac5f7439
[svn] - make fileinfo_recursive_get_image() breadth first search.
yaz
parents:
1611
diff
changeset
|
498 } |
1371
ca4f3115d33c
[svn] - recursively locate album art, by external contributor Oliver Lumpton.
nenolod
parents:
1358
diff
changeset
|
499 return NULL; |
1262 | 500 } |
1267 | 501 |
502 void | |
1283
19b1d3f22e10
[svn] - when hovering over a playlist tuple, describe the tuple via a tooltip-like popup
nenolod
parents:
1270
diff
changeset
|
503 filepopup_show_for_tuple(TitleInput *tuple) |
19b1d3f22e10
[svn] - when hovering over a playlist tuple, describe the tuple via a tooltip-like popup
nenolod
parents:
1270
diff
changeset
|
504 { |
1710 | 505 gchar *tmp = NULL; |
1312 | 506 gint x, y, x_off = 3, y_off = 3, h, w; |
1296 | 507 |
1710 | 508 static gchar *lastpath = NULL; |
509 | |
1283
19b1d3f22e10
[svn] - when hovering over a playlist tuple, describe the tuple via a tooltip-like popup
nenolod
parents:
1270
diff
changeset
|
510 if (tuple == NULL) |
19b1d3f22e10
[svn] - when hovering over a playlist tuple, describe the tuple via a tooltip-like popup
nenolod
parents:
1270
diff
changeset
|
511 return; |
19b1d3f22e10
[svn] - when hovering over a playlist tuple, describe the tuple via a tooltip-like popup
nenolod
parents:
1270
diff
changeset
|
512 |
19b1d3f22e10
[svn] - when hovering over a playlist tuple, describe the tuple via a tooltip-like popup
nenolod
parents:
1270
diff
changeset
|
513 gtk_widget_realize(filepopup_win); |
19b1d3f22e10
[svn] - when hovering over a playlist tuple, describe the tuple via a tooltip-like popup
nenolod
parents:
1270
diff
changeset
|
514 |
19b1d3f22e10
[svn] - when hovering over a playlist tuple, describe the tuple via a tooltip-like popup
nenolod
parents:
1270
diff
changeset
|
515 filepopup_entry_set_text("label_title", tuple->track_name); |
19b1d3f22e10
[svn] - when hovering over a playlist tuple, describe the tuple via a tooltip-like popup
nenolod
parents:
1270
diff
changeset
|
516 filepopup_entry_set_text("label_artist", tuple->performer); |
19b1d3f22e10
[svn] - when hovering over a playlist tuple, describe the tuple via a tooltip-like popup
nenolod
parents:
1270
diff
changeset
|
517 filepopup_entry_set_text("label_album", tuple->album_name); |
1287
e778f43a74fb
[svn] - make tuples more verbose (they might be a bit big though)
nenolod
parents:
1286
diff
changeset
|
518 filepopup_entry_set_text("label_genre", tuple->genre); |
1309
816ea8bbde1c
[svn] - if tuple->length == -1 then don't show a length
nenolod
parents:
1307
diff
changeset
|
519 |
816ea8bbde1c
[svn] - if tuple->length == -1 then don't show a length
nenolod
parents:
1307
diff
changeset
|
520 if (tuple->length != -1) |
816ea8bbde1c
[svn] - if tuple->length == -1 then don't show a length
nenolod
parents:
1307
diff
changeset
|
521 filepopup_entry_set_text_free("label_length", g_strdup_printf("%d:%02d", tuple->length / 60000, (tuple->length / 1000) % 60)); |
1287
e778f43a74fb
[svn] - make tuples more verbose (they might be a bit big though)
nenolod
parents:
1286
diff
changeset
|
522 |
e778f43a74fb
[svn] - make tuples more verbose (they might be a bit big though)
nenolod
parents:
1286
diff
changeset
|
523 if (tuple->year != 0) |
e778f43a74fb
[svn] - make tuples more verbose (they might be a bit big though)
nenolod
parents:
1286
diff
changeset
|
524 filepopup_entry_set_text_free("label_year", g_strdup_printf("%d", tuple->year)); |
e778f43a74fb
[svn] - make tuples more verbose (they might be a bit big though)
nenolod
parents:
1286
diff
changeset
|
525 |
e778f43a74fb
[svn] - make tuples more verbose (they might be a bit big though)
nenolod
parents:
1286
diff
changeset
|
526 if (tuple->track_number != 0) |
e778f43a74fb
[svn] - make tuples more verbose (they might be a bit big though)
nenolod
parents:
1286
diff
changeset
|
527 filepopup_entry_set_text_free("label_track", g_strdup_printf("%d", tuple->track_number)); |
1283
19b1d3f22e10
[svn] - when hovering over a playlist tuple, describe the tuple via a tooltip-like popup
nenolod
parents:
1270
diff
changeset
|
528 |
1710 | 529 if(strcmp(lastpath?lastpath:"", tuple->file_path)){ |
530 tmp = fileinfo_recursive_get_image(tuple->file_path, 0); | |
1371
ca4f3115d33c
[svn] - recursively locate album art, by external contributor Oliver Lumpton.
nenolod
parents:
1358
diff
changeset
|
531 |
1710 | 532 if(tmp) |
533 { | |
534 filepopup_entry_set_image("image_artwork", tmp); | |
535 g_free(tmp); | |
536 g_free(lastpath); | |
537 lastpath = g_strdup(tuple->file_path); | |
538 } else { | |
539 filepopup_entry_set_image("image_artwork", DATA_DIR "/images/audio.png"); | |
540 g_free(lastpath); | |
541 lastpath = g_strdup(tuple->file_path); | |
542 } | |
1296 | 543 } |
1312 | 544 gdk_window_get_pointer(NULL, &x, &y, NULL); |
545 gtk_window_get_size(GTK_WINDOW(filepopup_win), &w, &h); | |
546 if (gdk_screen_width()-(w+3) < x) x_off = (w*-1)-3; | |
547 if (gdk_screen_height()-(h+3) < y) y_off = (h*-1)-3; | |
548 gtk_window_move(GTK_WINDOW(filepopup_win), x + x_off, y + y_off); | |
549 | |
1283
19b1d3f22e10
[svn] - when hovering over a playlist tuple, describe the tuple via a tooltip-like popup
nenolod
parents:
1270
diff
changeset
|
550 gtk_widget_show(filepopup_win); |
19b1d3f22e10
[svn] - when hovering over a playlist tuple, describe the tuple via a tooltip-like popup
nenolod
parents:
1270
diff
changeset
|
551 } |
19b1d3f22e10
[svn] - when hovering over a playlist tuple, describe the tuple via a tooltip-like popup
nenolod
parents:
1270
diff
changeset
|
552 |
19b1d3f22e10
[svn] - when hovering over a playlist tuple, describe the tuple via a tooltip-like popup
nenolod
parents:
1270
diff
changeset
|
553 void |
1269 | 554 fileinfo_show_for_path(gchar *path) |
1267 | 555 { |
556 TitleInput *tuple = input_get_song_tuple(path); | |
557 | |
558 if (tuple == NULL) | |
1268 | 559 return input_file_info_box(path); |
1267 | 560 |
561 fileinfo_show_for_tuple(tuple); | |
562 | |
563 bmp_title_input_free(tuple); | |
1588
15d92c51bde6
[svn] - modified time (mtime) has been introduced into tuple
yaz
parents:
1541
diff
changeset
|
564 tuple = NULL; |
1267 | 565 } |