Mercurial > audlegacy
annotate audacious/ui_fileinfo.c @ 1713:a4d7227231e3 trunk
[svn] More .cpp -> .cxx. Noticed by Chainsaw. Shame on me that I forgot some ;).
author | js |
---|---|
date | Sat, 16 Sep 2006 07:33:28 -0700 |
parents | 43ae2a1bfdee |
children | 3434eb44b304 |
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" | |
53 #include "libaudacious/configdb.h" | |
54 #include "libaudacious/titlestring.h" | |
55 | |
1283
19b1d3f22e10
[svn] - when hovering over a playlist tuple, describe the tuple via a tooltip-like popup
nenolod
parents:
1270
diff
changeset
|
56 #include "playlist.h" |
19b1d3f22e10
[svn] - when hovering over a playlist tuple, describe the tuple via a tooltip-like popup
nenolod
parents:
1270
diff
changeset
|
57 |
1262 | 58 #include "mainwin.h" |
59 #include "ui_playlist.h" | |
60 #include "skinwin.h" | |
61 #include "build_stamp.h" | |
62 #include "ui_fileinfo.h" | |
1284 | 63 #include "ui_playlist.h" |
1262 | 64 |
65 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
|
66 GtkWidget *filepopup_win; |
1341 | 67 GdkPixbuf *filepopup_pixbuf; |
1262 | 68 |
69 static void | |
70 fileinfo_entry_set_text(const char *entry, const char *text) | |
71 { | |
72 GladeXML *xml = g_object_get_data(G_OBJECT(fileinfo_win), "glade-xml"); | |
73 GtkWidget *widget = glade_xml_get_widget(xml, entry); | |
74 | |
75 if (xml == NULL || widget == NULL) | |
76 return; | |
77 | |
78 gtk_entry_set_text(GTK_ENTRY(widget), text); | |
79 } | |
80 | |
81 static void | |
82 fileinfo_entry_set_text_free(const char *entry, char *text) | |
83 { | |
84 GladeXML *xml = g_object_get_data(G_OBJECT(fileinfo_win), "glade-xml"); | |
85 GtkWidget *widget = glade_xml_get_widget(xml, entry); | |
86 | |
87 if (xml == NULL || widget == NULL) | |
88 return; | |
89 | |
90 gtk_entry_set_text(GTK_ENTRY(widget), text); | |
91 | |
92 g_free(text); | |
93 } | |
94 | |
1283
19b1d3f22e10
[svn] - when hovering over a playlist tuple, describe the tuple via a tooltip-like popup
nenolod
parents:
1270
diff
changeset
|
95 static void |
1296 | 96 fileinfo_entry_set_image(const char *entry, const char *text) |
97 { | |
98 GladeXML *xml = g_object_get_data(G_OBJECT(fileinfo_win), "glade-xml"); | |
99 GtkWidget *widget = glade_xml_get_widget(xml, entry); | |
1299 | 100 GdkPixbuf *pixbuf; |
1710 | 101 int width, height; |
102 double aspect; | |
1296 | 103 |
104 if (xml == NULL || widget == NULL) | |
105 return; | |
106 | |
1299 | 107 pixbuf = gdk_pixbuf_new_from_file(text, NULL); |
108 | |
109 if (pixbuf == NULL) | |
110 return; | |
111 | |
1710 | 112 width = gdk_pixbuf_get_width(GDK_PIXBUF(pixbuf)); |
113 height = gdk_pixbuf_get_height(GDK_PIXBUF(pixbuf)); | |
114 | |
115 if(strcmp(DATA_DIR "/images/audio.png", text)) | |
1299 | 116 { |
1710 | 117 if(width == 0) |
118 width = 1; | |
119 aspect = (double)height / (double)width; | |
120 if(aspect > 1.0) { | |
121 height = (int)(cfg.filepopup_pixelsize * aspect); | |
122 width = cfg.filepopup_pixelsize; | |
123 } else { | |
124 height = cfg.filepopup_pixelsize; | |
125 width = (int)(cfg.filepopup_pixelsize / aspect); | |
126 } | |
127 GdkPixbuf *pixbuf2 = gdk_pixbuf_scale_simple(GDK_PIXBUF(pixbuf), width, height, GDK_INTERP_BILINEAR); | |
1299 | 128 g_object_unref(G_OBJECT(pixbuf)); |
129 pixbuf = pixbuf2; | |
130 } | |
131 | |
132 gtk_image_set_from_pixbuf(GTK_IMAGE(widget), GDK_PIXBUF(pixbuf)); | |
1326 | 133 g_object_unref(G_OBJECT(pixbuf)); |
1296 | 134 } |
135 | |
136 static void | |
1283
19b1d3f22e10
[svn] - when hovering over a playlist tuple, describe the tuple via a tooltip-like popup
nenolod
parents:
1270
diff
changeset
|
137 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
|
138 { |
19b1d3f22e10
[svn] - when hovering over a playlist tuple, describe the tuple via a tooltip-like popup
nenolod
parents:
1270
diff
changeset
|
139 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
|
140 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
|
141 |
19b1d3f22e10
[svn] - when hovering over a playlist tuple, describe the tuple via a tooltip-like popup
nenolod
parents:
1270
diff
changeset
|
142 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
|
143 return; |
19b1d3f22e10
[svn] - when hovering over a playlist tuple, describe the tuple via a tooltip-like popup
nenolod
parents:
1270
diff
changeset
|
144 |
19b1d3f22e10
[svn] - when hovering over a playlist tuple, describe the tuple via a tooltip-like popup
nenolod
parents:
1270
diff
changeset
|
145 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
|
146 } |
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 static void |
1296 | 149 filepopup_entry_set_image(const char *entry, const char *text) |
150 { | |
151 GladeXML *xml = g_object_get_data(G_OBJECT(filepopup_win), "glade-xml"); | |
152 GtkWidget *widget = glade_xml_get_widget(xml, entry); | |
1299 | 153 GdkPixbuf *pixbuf; |
1710 | 154 int width, height; |
155 double aspect; | |
1296 | 156 |
157 if (xml == NULL || widget == NULL) | |
158 return; | |
159 | |
1299 | 160 pixbuf = gdk_pixbuf_new_from_file(text, NULL); |
161 | |
162 if (pixbuf == NULL) | |
163 return; | |
164 | |
1710 | 165 width = gdk_pixbuf_get_width(GDK_PIXBUF(pixbuf)); |
166 height = gdk_pixbuf_get_height(GDK_PIXBUF(pixbuf)); | |
167 | |
168 if(strcmp(DATA_DIR "/images/audio.png", text)) | |
1299 | 169 { |
1710 | 170 if(width == 0) |
171 width = 1; | |
172 aspect = (double)height / (double)width; | |
173 if(aspect > 1.0) { | |
174 height = (int)(cfg.filepopup_pixelsize * aspect); | |
175 width = cfg.filepopup_pixelsize; | |
176 } else { | |
177 height = cfg.filepopup_pixelsize; | |
178 width = (int)(cfg.filepopup_pixelsize / aspect); | |
179 } | |
180 GdkPixbuf *pixbuf2 = gdk_pixbuf_scale_simple(GDK_PIXBUF(pixbuf), width, height, GDK_INTERP_BILINEAR); | |
1299 | 181 g_object_unref(G_OBJECT(pixbuf)); |
182 pixbuf = pixbuf2; | |
183 } | |
184 | |
185 gtk_image_set_from_pixbuf(GTK_IMAGE(widget), GDK_PIXBUF(pixbuf)); | |
1326 | 186 g_object_unref(G_OBJECT(pixbuf)); |
1296 | 187 } |
188 | |
189 static void | |
1283
19b1d3f22e10
[svn] - when hovering over a playlist tuple, describe the tuple via a tooltip-like popup
nenolod
parents:
1270
diff
changeset
|
190 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
|
191 { |
19b1d3f22e10
[svn] - when hovering over a playlist tuple, describe the tuple via a tooltip-like popup
nenolod
parents:
1270
diff
changeset
|
192 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
|
193 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
|
194 |
19b1d3f22e10
[svn] - when hovering over a playlist tuple, describe the tuple via a tooltip-like popup
nenolod
parents:
1270
diff
changeset
|
195 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
|
196 return; |
19b1d3f22e10
[svn] - when hovering over a playlist tuple, describe the tuple via a tooltip-like popup
nenolod
parents:
1270
diff
changeset
|
197 |
19b1d3f22e10
[svn] - when hovering over a playlist tuple, describe the tuple via a tooltip-like popup
nenolod
parents:
1270
diff
changeset
|
198 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
|
199 |
19b1d3f22e10
[svn] - when hovering over a playlist tuple, describe the tuple via a tooltip-like popup
nenolod
parents:
1270
diff
changeset
|
200 g_free(text); |
19b1d3f22e10
[svn] - when hovering over a playlist tuple, describe the tuple via a tooltip-like popup
nenolod
parents:
1270
diff
changeset
|
201 } |
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 static gboolean |
19b1d3f22e10
[svn] - when hovering over a playlist tuple, describe the tuple via a tooltip-like popup
nenolod
parents:
1270
diff
changeset
|
204 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
|
205 { |
1312 | 206 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
|
207 TitleInput *tuple; |
1605
ce3ce44d6814
[svn] - filepopup follows change of pointed song, i.e. it will hide while scrolling.
yaz
parents:
1588
diff
changeset
|
208 static gint prev_x = 0, prev_y = 0, ctr = 0, prev_pos = -1; |
1300
a5c4e748d557
[svn] - don't call filepopup_show_for_tuple() more than once
nenolod
parents:
1299
diff
changeset
|
209 gboolean skip = FALSE; |
1605
ce3ce44d6814
[svn] - filepopup follows change of pointed song, i.e. it will hide while scrolling.
yaz
parents:
1588
diff
changeset
|
210 GdkWindow *win; |
ce3ce44d6814
[svn] - filepopup follows change of pointed song, i.e. it will hide while scrolling.
yaz
parents:
1588
diff
changeset
|
211 |
ce3ce44d6814
[svn] - filepopup follows change of pointed song, i.e. it will hide while scrolling.
yaz
parents:
1588
diff
changeset
|
212 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
|
213 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
|
214 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
|
215 |
1605
ce3ce44d6814
[svn] - filepopup follows change of pointed song, i.e. it will hide while scrolling.
yaz
parents:
1588
diff
changeset
|
216 if (win == NULL |
ce3ce44d6814
[svn] - filepopup follows change of pointed song, i.e. it will hide while scrolling.
yaz
parents:
1588
diff
changeset
|
217 || 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
|
218 || 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
|
219 || pos != prev_pos |
ce3ce44d6814
[svn] - filepopup follows change of pointed song, i.e. it will hide while scrolling.
yaz
parents:
1588
diff
changeset
|
220 || win != GDK_WINDOW(playlistwin->window) |
ce3ce44d6814
[svn] - filepopup follows change of pointed song, i.e. it will hide while scrolling.
yaz
parents:
1588
diff
changeset
|
221 || playlistwin_is_shaded()) |
1284 | 222 { |
1605
ce3ce44d6814
[svn] - filepopup follows change of pointed song, i.e. it will hide while scrolling.
yaz
parents:
1588
diff
changeset
|
223 prev_pos = pos; |
1284 | 224 ctr = 0; |
1389
c19443be579d
[svn] ensure that the fileinfo popup in playlist disappears when the cursor is moved again
giacomo
parents:
1371
diff
changeset
|
225 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
|
226 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
|
227 filepopup_hide(NULL); |
1284 | 228 return TRUE; |
229 } | |
230 | |
1283
19b1d3f22e10
[svn] - when hovering over a playlist tuple, describe the tuple via a tooltip-like popup
nenolod
parents:
1270
diff
changeset
|
231 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
|
232 ctr++; |
19b1d3f22e10
[svn] - when hovering over a playlist tuple, describe the tuple via a tooltip-like popup
nenolod
parents:
1270
diff
changeset
|
233 else |
19b1d3f22e10
[svn] - when hovering over a playlist tuple, describe the tuple via a tooltip-like popup
nenolod
parents:
1270
diff
changeset
|
234 { |
19b1d3f22e10
[svn] - when hovering over a playlist tuple, describe the tuple via a tooltip-like popup
nenolod
parents:
1270
diff
changeset
|
235 ctr = 0; |
19b1d3f22e10
[svn] - when hovering over a playlist tuple, describe the tuple via a tooltip-like popup
nenolod
parents:
1270
diff
changeset
|
236 prev_x = x; |
19b1d3f22e10
[svn] - when hovering over a playlist tuple, describe the tuple via a tooltip-like popup
nenolod
parents:
1270
diff
changeset
|
237 prev_y = y; |
19b1d3f22e10
[svn] - when hovering over a playlist tuple, describe the tuple via a tooltip-like popup
nenolod
parents:
1270
diff
changeset
|
238 filepopup_hide(NULL); |
19b1d3f22e10
[svn] - when hovering over a playlist tuple, describe the tuple via a tooltip-like popup
nenolod
parents:
1270
diff
changeset
|
239 return TRUE; |
19b1d3f22e10
[svn] - when hovering over a playlist tuple, describe the tuple via a tooltip-like popup
nenolod
parents:
1270
diff
changeset
|
240 } |
19b1d3f22e10
[svn] - when hovering over a playlist tuple, describe the tuple via a tooltip-like popup
nenolod
parents:
1270
diff
changeset
|
241 |
1300
a5c4e748d557
[svn] - don't call filepopup_show_for_tuple() more than once
nenolod
parents:
1299
diff
changeset
|
242 if (filepopup_win->window == NULL) |
a5c4e748d557
[svn] - don't call filepopup_show_for_tuple() more than once
nenolod
parents:
1299
diff
changeset
|
243 skip = TRUE; |
a5c4e748d557
[svn] - don't call filepopup_show_for_tuple() more than once
nenolod
parents:
1299
diff
changeset
|
244 |
1710 | 245 if (ctr >= cfg.filepopup_delay && (skip == TRUE || gdk_window_is_viewable(GDK_WINDOW(filepopup_win->window)) != TRUE)) |
1283
19b1d3f22e10
[svn] - when hovering over a playlist tuple, describe the tuple via a tooltip-like popup
nenolod
parents:
1270
diff
changeset
|
246 { |
19b1d3f22e10
[svn] - when hovering over a playlist tuple, describe the tuple via a tooltip-like popup
nenolod
parents:
1270
diff
changeset
|
247 if (pos == -1) |
19b1d3f22e10
[svn] - when hovering over a playlist tuple, describe the tuple via a tooltip-like popup
nenolod
parents:
1270
diff
changeset
|
248 { |
19b1d3f22e10
[svn] - when hovering over a playlist tuple, describe the tuple via a tooltip-like popup
nenolod
parents:
1270
diff
changeset
|
249 filepopup_hide(NULL); |
19b1d3f22e10
[svn] - when hovering over a playlist tuple, describe the tuple via a tooltip-like popup
nenolod
parents:
1270
diff
changeset
|
250 return TRUE; |
19b1d3f22e10
[svn] - when hovering over a playlist tuple, describe the tuple via a tooltip-like popup
nenolod
parents:
1270
diff
changeset
|
251 } |
19b1d3f22e10
[svn] - when hovering over a playlist tuple, describe the tuple via a tooltip-like popup
nenolod
parents:
1270
diff
changeset
|
252 |
1605
ce3ce44d6814
[svn] - filepopup follows change of pointed song, i.e. it will hide while scrolling.
yaz
parents:
1588
diff
changeset
|
253 prev_pos = pos; |
ce3ce44d6814
[svn] - filepopup follows change of pointed song, i.e. it will hide while scrolling.
yaz
parents:
1588
diff
changeset
|
254 |
1283
19b1d3f22e10
[svn] - when hovering over a playlist tuple, describe the tuple via a tooltip-like popup
nenolod
parents:
1270
diff
changeset
|
255 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
|
256 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
|
257 } |
19b1d3f22e10
[svn] - when hovering over a playlist tuple, describe the tuple via a tooltip-like popup
nenolod
parents:
1270
diff
changeset
|
258 |
19b1d3f22e10
[svn] - when hovering over a playlist tuple, describe the tuple via a tooltip-like popup
nenolod
parents:
1270
diff
changeset
|
259 return TRUE; |
19b1d3f22e10
[svn] - when hovering over a playlist tuple, describe the tuple via a tooltip-like popup
nenolod
parents:
1270
diff
changeset
|
260 } |
19b1d3f22e10
[svn] - when hovering over a playlist tuple, describe the tuple via a tooltip-like popup
nenolod
parents:
1270
diff
changeset
|
261 |
1267 | 262 void fileinfo_hide(gpointer unused) |
263 { | |
264 gtk_widget_hide(fileinfo_win); | |
265 | |
266 /* Clear it out. */ | |
267 fileinfo_entry_set_text("entry_title", ""); | |
268 fileinfo_entry_set_text("entry_artist", ""); | |
269 fileinfo_entry_set_text("entry_album", ""); | |
270 fileinfo_entry_set_text("entry_comment", ""); | |
271 fileinfo_entry_set_text("entry_genre", ""); | |
272 fileinfo_entry_set_text("entry_year", ""); | |
273 fileinfo_entry_set_text("entry_track", ""); | |
274 fileinfo_entry_set_text("entry_location", ""); | |
1307
63d30ae1db33
[svn] - reset the album art back to the default icon
nenolod
parents:
1306
diff
changeset
|
275 |
63d30ae1db33
[svn] - reset the album art back to the default icon
nenolod
parents:
1306
diff
changeset
|
276 fileinfo_entry_set_image("image_artwork", DATA_DIR "/images/audio.png"); |
1267 | 277 } |
278 | |
1283
19b1d3f22e10
[svn] - when hovering over a playlist tuple, describe the tuple via a tooltip-like popup
nenolod
parents:
1270
diff
changeset
|
279 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
|
280 { |
19b1d3f22e10
[svn] - when hovering over a playlist tuple, describe the tuple via a tooltip-like popup
nenolod
parents:
1270
diff
changeset
|
281 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
|
282 |
19b1d3f22e10
[svn] - when hovering over a playlist tuple, describe the tuple via a tooltip-like popup
nenolod
parents:
1270
diff
changeset
|
283 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
|
284 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
|
285 filepopup_entry_set_text("label_album", ""); |
1296 | 286 filepopup_entry_set_text("label_genre", ""); |
287 filepopup_entry_set_text("label_track", ""); | |
288 filepopup_entry_set_text("label_year", ""); | |
289 filepopup_entry_set_text("label_length", ""); | |
1297 | 290 |
1307
63d30ae1db33
[svn] - reset the album art back to the default icon
nenolod
parents:
1306
diff
changeset
|
291 |
1297 | 292 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
|
293 } |
19b1d3f22e10
[svn] - when hovering over a playlist tuple, describe the tuple via a tooltip-like popup
nenolod
parents:
1270
diff
changeset
|
294 |
1262 | 295 void |
296 create_fileinfo_window(void) | |
297 { | |
1263 | 298 const gchar *glade_file = DATA_DIR "/glade/fileinfo.glade"; |
1262 | 299 GladeXML *xml; |
300 GtkWidget *widget; | |
301 | |
302 xml = glade_xml_new_or_die(_("Track Information Window"), glade_file, NULL, NULL); | |
303 | |
304 glade_xml_signal_autoconnect(xml); | |
305 | |
306 fileinfo_win = glade_xml_get_widget(xml, "fileinfo_win"); | |
307 g_object_set_data(G_OBJECT(fileinfo_win), "glade-xml", xml); | |
308 gtk_window_set_transient_for(GTK_WINDOW(fileinfo_win), GTK_WINDOW(mainwin)); | |
309 | |
310 widget = glade_xml_get_widget(xml, "image_artwork"); | |
311 gtk_image_set_from_file(GTK_IMAGE(widget), DATA_DIR "/images/audio.png"); | |
1267 | 312 |
313 widget = glade_xml_get_widget(xml, "btn_close"); | |
314 g_signal_connect(G_OBJECT(widget), "clicked", (GCallback) fileinfo_hide, NULL); | |
1262 | 315 } |
316 | |
317 void | |
1283
19b1d3f22e10
[svn] - when hovering over a playlist tuple, describe the tuple via a tooltip-like popup
nenolod
parents:
1270
diff
changeset
|
318 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
|
319 { |
19b1d3f22e10
[svn] - when hovering over a playlist tuple, describe the tuple via a tooltip-like popup
nenolod
parents:
1270
diff
changeset
|
320 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
|
321 GladeXML *xml; |
19b1d3f22e10
[svn] - when hovering over a playlist tuple, describe the tuple via a tooltip-like popup
nenolod
parents:
1270
diff
changeset
|
322 GtkWidget *widget; |
1287
e778f43a74fb
[svn] - make tuples more verbose (they might be a bit big though)
nenolod
parents:
1286
diff
changeset
|
323 |
1283
19b1d3f22e10
[svn] - when hovering over a playlist tuple, describe the tuple via a tooltip-like popup
nenolod
parents:
1270
diff
changeset
|
324 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
|
325 |
19b1d3f22e10
[svn] - when hovering over a playlist tuple, describe the tuple via a tooltip-like popup
nenolod
parents:
1270
diff
changeset
|
326 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
|
327 |
19b1d3f22e10
[svn] - when hovering over a playlist tuple, describe the tuple via a tooltip-like popup
nenolod
parents:
1270
diff
changeset
|
328 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
|
329 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
|
330 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
|
331 |
19b1d3f22e10
[svn] - when hovering over a playlist tuple, describe the tuple via a tooltip-like popup
nenolod
parents:
1270
diff
changeset
|
332 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
|
333 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
|
334 |
19b1d3f22e10
[svn] - when hovering over a playlist tuple, describe the tuple via a tooltip-like popup
nenolod
parents:
1270
diff
changeset
|
335 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
|
336 } |
19b1d3f22e10
[svn] - when hovering over a playlist tuple, describe the tuple via a tooltip-like popup
nenolod
parents:
1270
diff
changeset
|
337 |
19b1d3f22e10
[svn] - when hovering over a playlist tuple, describe the tuple via a tooltip-like popup
nenolod
parents:
1270
diff
changeset
|
338 void |
1262 | 339 fileinfo_show_for_tuple(TitleInput *tuple) |
340 { | |
1402
1abfc389ecc6
[svn] fileinfo_show_for_tuple() sometimes causes "Invalid UTF-8 string"
yaz
parents:
1401
diff
changeset
|
341 gchar *tmp = NULL; |
1296 | 342 |
1262 | 343 if (tuple == NULL) |
344 return; | |
345 | |
346 gtk_widget_realize(fileinfo_win); | |
347 | |
348 fileinfo_entry_set_text("entry_title", tuple->track_name); | |
349 fileinfo_entry_set_text("entry_artist", tuple->performer); | |
350 fileinfo_entry_set_text("entry_album", tuple->album_name); | |
351 fileinfo_entry_set_text("entry_comment", tuple->comment); | |
352 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
|
353 |
1abfc389ecc6
[svn] fileinfo_show_for_tuple() sometimes causes "Invalid UTF-8 string"
yaz
parents:
1401
diff
changeset
|
354 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
|
355 if(tmp){ |
1abfc389ecc6
[svn] fileinfo_show_for_tuple() sometimes causes "Invalid UTF-8 string"
yaz
parents:
1401
diff
changeset
|
356 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
|
357 g_free(tmp); |
1abfc389ecc6
[svn] fileinfo_show_for_tuple() sometimes causes "Invalid UTF-8 string"
yaz
parents:
1401
diff
changeset
|
358 tmp = NULL; |
1abfc389ecc6
[svn] fileinfo_show_for_tuple() sometimes causes "Invalid UTF-8 string"
yaz
parents:
1401
diff
changeset
|
359 } |
1262 | 360 |
361 if (tuple->year != 0) | |
362 fileinfo_entry_set_text_free("entry_year", g_strdup_printf("%d", tuple->year)); | |
363 | |
364 if (tuple->track_number != 0) | |
365 fileinfo_entry_set_text_free("entry_track", g_strdup_printf("%d", tuple->track_number)); | |
366 | |
1371
ca4f3115d33c
[svn] - recursively locate album art, by external contributor Oliver Lumpton.
nenolod
parents:
1358
diff
changeset
|
367 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
|
368 |
ca4f3115d33c
[svn] - recursively locate album art, by external contributor Oliver Lumpton.
nenolod
parents:
1358
diff
changeset
|
369 if(tmp) |
ca4f3115d33c
[svn] - recursively locate album art, by external contributor Oliver Lumpton.
nenolod
parents:
1358
diff
changeset
|
370 { |
ca4f3115d33c
[svn] - recursively locate album art, by external contributor Oliver Lumpton.
nenolod
parents:
1358
diff
changeset
|
371 fileinfo_entry_set_image("image_artwork", tmp); |
ca4f3115d33c
[svn] - recursively locate album art, by external contributor Oliver Lumpton.
nenolod
parents:
1358
diff
changeset
|
372 g_free(tmp); |
ca4f3115d33c
[svn] - recursively locate album art, by external contributor Oliver Lumpton.
nenolod
parents:
1358
diff
changeset
|
373 } |
ca4f3115d33c
[svn] - recursively locate album art, by external contributor Oliver Lumpton.
nenolod
parents:
1358
diff
changeset
|
374 |
ca4f3115d33c
[svn] - recursively locate album art, by external contributor Oliver Lumpton.
nenolod
parents:
1358
diff
changeset
|
375 gtk_widget_show(fileinfo_win); |
ca4f3115d33c
[svn] - recursively locate album art, by external contributor Oliver Lumpton.
nenolod
parents:
1358
diff
changeset
|
376 } |
ca4f3115d33c
[svn] - recursively locate album art, by external contributor Oliver Lumpton.
nenolod
parents:
1358
diff
changeset
|
377 |
1413 | 378 static gboolean |
379 cover_name_filter(const gchar *name, const gchar *filter, const gboolean ret_on_empty) | |
380 { | |
381 gboolean result = FALSE; | |
382 gchar **splitted; | |
383 gchar *current; | |
384 gchar *lname; | |
385 gint i; | |
386 | |
387 if (!filter || strlen(filter) == 0) { | |
388 return ret_on_empty; | |
389 } | |
390 | |
391 splitted = g_strsplit(filter, ",", 0); | |
392 | |
393 lname = g_strdup(name); | |
394 g_strdown(lname); | |
395 | |
396 for (i = 0; !result && (current = splitted[i]); i++) { | |
397 gchar *stripped = g_strstrip(g_strdup(current)); | |
398 g_strdown(stripped); | |
399 | |
400 result = result || strstr(lname, stripped); | |
401 | |
402 g_free(stripped); | |
403 } | |
404 | |
405 g_free(lname); | |
406 g_strfreev(splitted); | |
407 | |
408 return result; | |
409 } | |
410 | |
411 /* Check wether it's an image we want */ | |
412 static gboolean | |
413 is_front_cover_image(const gchar *name) | |
414 { | |
415 char *ext; | |
416 | |
417 ext = strrchr(name, '.'); | |
418 if (!ext) { | |
419 /* No file extension */ | |
420 return FALSE; | |
421 } | |
422 | |
423 if (g_strcasecmp(ext, ".jpg") != 0 && | |
424 g_strcasecmp(ext, ".jpeg") != 0 && | |
425 g_strcasecmp(ext, ".png") != 0) { | |
426 /* No recognized file extension */ | |
427 return FALSE; | |
428 } | |
429 | |
430 return cover_name_filter(name, cfg.cover_name_include, TRUE) && | |
431 !cover_name_filter(name, cfg.cover_name_exclude, FALSE); | |
432 } | |
433 | |
1371
ca4f3115d33c
[svn] - recursively locate album art, by external contributor Oliver Lumpton.
nenolod
parents:
1358
diff
changeset
|
434 gchar* |
ca4f3115d33c
[svn] - recursively locate album art, by external contributor Oliver Lumpton.
nenolod
parents:
1358
diff
changeset
|
435 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
|
436 { |
ca4f3115d33c
[svn] - recursively locate album art, by external contributor Oliver Lumpton.
nenolod
parents:
1358
diff
changeset
|
437 GDir *d; |
ca4f3115d33c
[svn] - recursively locate album art, by external contributor Oliver Lumpton.
nenolod
parents:
1358
diff
changeset
|
438 |
1429
a360afd8df52
[svn] Make annoying recursion that consistently returns wrong art, optional.
nemo
parents:
1413
diff
changeset
|
439 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
|
440 return NULL; |
ca4f3115d33c
[svn] - recursively locate album art, by external contributor Oliver Lumpton.
nenolod
parents:
1358
diff
changeset
|
441 |
ca4f3115d33c
[svn] - recursively locate album art, by external contributor Oliver Lumpton.
nenolod
parents:
1358
diff
changeset
|
442 d = g_dir_open(path, 0, NULL); |
ca4f3115d33c
[svn] - recursively locate album art, by external contributor Oliver Lumpton.
nenolod
parents:
1358
diff
changeset
|
443 |
1666
77baac5f7439
[svn] - make fileinfo_recursive_get_image() breadth first search.
yaz
parents:
1611
diff
changeset
|
444 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
|
445 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
|
446 |
1666
77baac5f7439
[svn] - make fileinfo_recursive_get_image() breadth first search.
yaz
parents:
1611
diff
changeset
|
447 /* first pass only searches for files. */ |
77baac5f7439
[svn] - make fileinfo_recursive_get_image() breadth first search.
yaz
parents:
1611
diff
changeset
|
448 while(f) { |
1371
ca4f3115d33c
[svn] - recursively locate album art, by external contributor Oliver Lumpton.
nenolod
parents:
1358
diff
changeset
|
449 gchar *newpath = g_strdup_printf("%s/%s", path, f); |
1413 | 450 |
1666
77baac5f7439
[svn] - make fileinfo_recursive_get_image() breadth first search.
yaz
parents:
1611
diff
changeset
|
451 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
|
452 if(is_front_cover_image(f)) { |
77baac5f7439
[svn] - make fileinfo_recursive_get_image() breadth first search.
yaz
parents:
1611
diff
changeset
|
453 g_dir_close(d); |
77baac5f7439
[svn] - make fileinfo_recursive_get_image() breadth first search.
yaz
parents:
1611
diff
changeset
|
454 return newpath; |
1371
ca4f3115d33c
[svn] - recursively locate album art, by external contributor Oliver Lumpton.
nenolod
parents:
1358
diff
changeset
|
455 } |
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 } |
1666
77baac5f7439
[svn] - make fileinfo_recursive_get_image() breadth first search.
yaz
parents:
1611
diff
changeset
|
457 g_free(newpath); |
77baac5f7439
[svn] - make fileinfo_recursive_get_image() breadth first search.
yaz
parents:
1611
diff
changeset
|
458 f = g_dir_read_name(d); |
1303 | 459 } |
1666
77baac5f7439
[svn] - make fileinfo_recursive_get_image() breadth first search.
yaz
parents:
1611
diff
changeset
|
460 |
77baac5f7439
[svn] - make fileinfo_recursive_get_image() breadth first search.
yaz
parents:
1611
diff
changeset
|
461 /* checks whether recursive or not. */ |
77baac5f7439
[svn] - make fileinfo_recursive_get_image() breadth first search.
yaz
parents:
1611
diff
changeset
|
462 if(!cfg.recurse_for_cover) { |
77baac5f7439
[svn] - make fileinfo_recursive_get_image() breadth first search.
yaz
parents:
1611
diff
changeset
|
463 g_dir_close(d); |
77baac5f7439
[svn] - make fileinfo_recursive_get_image() breadth first search.
yaz
parents:
1611
diff
changeset
|
464 return NULL; |
77baac5f7439
[svn] - make fileinfo_recursive_get_image() breadth first search.
yaz
parents:
1611
diff
changeset
|
465 } |
77baac5f7439
[svn] - make fileinfo_recursive_get_image() breadth first search.
yaz
parents:
1611
diff
changeset
|
466 |
77baac5f7439
[svn] - make fileinfo_recursive_get_image() breadth first search.
yaz
parents:
1611
diff
changeset
|
467 /* second pass descends directory recursively. */ |
77baac5f7439
[svn] - make fileinfo_recursive_get_image() breadth first search.
yaz
parents:
1611
diff
changeset
|
468 g_dir_rewind(d); |
77baac5f7439
[svn] - make fileinfo_recursive_get_image() breadth first search.
yaz
parents:
1611
diff
changeset
|
469 f = g_dir_read_name(d); |
77baac5f7439
[svn] - make fileinfo_recursive_get_image() breadth first search.
yaz
parents:
1611
diff
changeset
|
470 |
77baac5f7439
[svn] - make fileinfo_recursive_get_image() breadth first search.
yaz
parents:
1611
diff
changeset
|
471 while(f) { |
77baac5f7439
[svn] - make fileinfo_recursive_get_image() breadth first search.
yaz
parents:
1611
diff
changeset
|
472 gchar *newpath = g_strdup_printf("%s/%s", path, f); |
77baac5f7439
[svn] - make fileinfo_recursive_get_image() breadth first search.
yaz
parents:
1611
diff
changeset
|
473 |
77baac5f7439
[svn] - make fileinfo_recursive_get_image() breadth first search.
yaz
parents:
1611
diff
changeset
|
474 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
|
475 gchar *tmp = fileinfo_recursive_get_image(newpath, depth+1); |
77baac5f7439
[svn] - make fileinfo_recursive_get_image() breadth first search.
yaz
parents:
1611
diff
changeset
|
476 if(tmp) { |
77baac5f7439
[svn] - make fileinfo_recursive_get_image() breadth first search.
yaz
parents:
1611
diff
changeset
|
477 g_free(newpath); |
77baac5f7439
[svn] - make fileinfo_recursive_get_image() breadth first search.
yaz
parents:
1611
diff
changeset
|
478 g_dir_close(d); |
77baac5f7439
[svn] - make fileinfo_recursive_get_image() breadth first search.
yaz
parents:
1611
diff
changeset
|
479 return tmp; |
77baac5f7439
[svn] - make fileinfo_recursive_get_image() breadth first search.
yaz
parents:
1611
diff
changeset
|
480 } |
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 g_free(newpath); |
77baac5f7439
[svn] - make fileinfo_recursive_get_image() breadth first search.
yaz
parents:
1611
diff
changeset
|
483 f = g_dir_read_name(d); |
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 |
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
|
486 g_dir_close(d); |
1666
77baac5f7439
[svn] - make fileinfo_recursive_get_image() breadth first search.
yaz
parents:
1611
diff
changeset
|
487 } |
1371
ca4f3115d33c
[svn] - recursively locate album art, by external contributor Oliver Lumpton.
nenolod
parents:
1358
diff
changeset
|
488 return NULL; |
1262 | 489 } |
1267 | 490 |
491 void | |
1283
19b1d3f22e10
[svn] - when hovering over a playlist tuple, describe the tuple via a tooltip-like popup
nenolod
parents:
1270
diff
changeset
|
492 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
|
493 { |
1710 | 494 gchar *tmp = NULL; |
1312 | 495 gint x, y, x_off = 3, y_off = 3, h, w; |
1296 | 496 |
1710 | 497 static gchar *lastpath = NULL; |
498 | |
1283
19b1d3f22e10
[svn] - when hovering over a playlist tuple, describe the tuple via a tooltip-like popup
nenolod
parents:
1270
diff
changeset
|
499 if (tuple == NULL) |
19b1d3f22e10
[svn] - when hovering over a playlist tuple, describe the tuple via a tooltip-like popup
nenolod
parents:
1270
diff
changeset
|
500 return; |
19b1d3f22e10
[svn] - when hovering over a playlist tuple, describe the tuple via a tooltip-like popup
nenolod
parents:
1270
diff
changeset
|
501 |
19b1d3f22e10
[svn] - when hovering over a playlist tuple, describe the tuple via a tooltip-like popup
nenolod
parents:
1270
diff
changeset
|
502 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
|
503 |
19b1d3f22e10
[svn] - when hovering over a playlist tuple, describe the tuple via a tooltip-like popup
nenolod
parents:
1270
diff
changeset
|
504 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
|
505 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
|
506 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
|
507 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
|
508 |
816ea8bbde1c
[svn] - if tuple->length == -1 then don't show a length
nenolod
parents:
1307
diff
changeset
|
509 if (tuple->length != -1) |
816ea8bbde1c
[svn] - if tuple->length == -1 then don't show a length
nenolod
parents:
1307
diff
changeset
|
510 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
|
511 |
e778f43a74fb
[svn] - make tuples more verbose (they might be a bit big though)
nenolod
parents:
1286
diff
changeset
|
512 if (tuple->year != 0) |
e778f43a74fb
[svn] - make tuples more verbose (they might be a bit big though)
nenolod
parents:
1286
diff
changeset
|
513 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
|
514 |
e778f43a74fb
[svn] - make tuples more verbose (they might be a bit big though)
nenolod
parents:
1286
diff
changeset
|
515 if (tuple->track_number != 0) |
e778f43a74fb
[svn] - make tuples more verbose (they might be a bit big though)
nenolod
parents:
1286
diff
changeset
|
516 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
|
517 |
1710 | 518 if(strcmp(lastpath?lastpath:"", tuple->file_path)){ |
519 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
|
520 |
1710 | 521 if(tmp) |
522 { | |
523 filepopup_entry_set_image("image_artwork", tmp); | |
524 g_free(tmp); | |
525 g_free(lastpath); | |
526 lastpath = g_strdup(tuple->file_path); | |
527 } else { | |
528 filepopup_entry_set_image("image_artwork", DATA_DIR "/images/audio.png"); | |
529 g_free(lastpath); | |
530 lastpath = g_strdup(tuple->file_path); | |
531 } | |
1296 | 532 } |
1312 | 533 gdk_window_get_pointer(NULL, &x, &y, NULL); |
534 gtk_window_get_size(GTK_WINDOW(filepopup_win), &w, &h); | |
535 if (gdk_screen_width()-(w+3) < x) x_off = (w*-1)-3; | |
536 if (gdk_screen_height()-(h+3) < y) y_off = (h*-1)-3; | |
537 gtk_window_move(GTK_WINDOW(filepopup_win), x + x_off, y + y_off); | |
538 | |
1283
19b1d3f22e10
[svn] - when hovering over a playlist tuple, describe the tuple via a tooltip-like popup
nenolod
parents:
1270
diff
changeset
|
539 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
|
540 } |
19b1d3f22e10
[svn] - when hovering over a playlist tuple, describe the tuple via a tooltip-like popup
nenolod
parents:
1270
diff
changeset
|
541 |
19b1d3f22e10
[svn] - when hovering over a playlist tuple, describe the tuple via a tooltip-like popup
nenolod
parents:
1270
diff
changeset
|
542 void |
1269 | 543 fileinfo_show_for_path(gchar *path) |
1267 | 544 { |
545 TitleInput *tuple = input_get_song_tuple(path); | |
546 | |
547 if (tuple == NULL) | |
1268 | 548 return input_file_info_box(path); |
1267 | 549 |
550 fileinfo_show_for_tuple(tuple); | |
551 | |
552 bmp_title_input_free(tuple); | |
1588
15d92c51bde6
[svn] - modified time (mtime) has been introduced into tuple
yaz
parents:
1541
diff
changeset
|
553 tuple = NULL; |
1267 | 554 } |