Mercurial > audlegacy
annotate src/audacious/util.c @ 2494:59661bd074b4 trunk
[svn] Try to put some skinned window code in a common place.
author | nenolod |
---|---|
date | Sat, 10 Feb 2007 17:01:44 -0800 |
parents | 5b1b26db3a37 |
children | 7934ac463591 |
rev | line source |
---|---|
2313 | 1 /* Audacious - Cross-platform multimedia player |
2 * Copyright (C) 2005-2007 Audacious development team | |
3 * | |
4 * Based on BMP: | |
5 * Copyright (C) 2003-2004 BMP development team. | |
6 * | |
7 * Based on XMMS: | |
8 * Copyright (C) 1998-2003 XMMS development team. | |
9 * | |
10 * This program is free software; you can redistribute it and/or modify | |
11 * it under the terms of the GNU General Public License as published by | |
12 * the Free Software Foundation; under version 2 of the License. | |
13 * | |
14 * This program is distributed in the hope that it will be useful, | |
15 * but WITHOUT ANY WARRANTY; without even the implied warranty of | |
16 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the | |
17 * GNU General Public License for more details. | |
18 * | |
19 * You should have received a copy of the GNU General Public License | |
20 * along with this program; if not, write to the Free Software | |
21 * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. | |
22 */ | |
23 | |
24 #ifdef HAVE_CONFIG_H | |
25 # include "config.h" | |
26 #endif | |
27 | |
28 #define NEED_GLADE | |
29 #include "util.h" | |
30 | |
31 #include <glib.h> | |
32 #include <glib/gi18n.h> | |
33 #include <glade/glade.h> | |
34 #include <gtk/gtk.h> | |
35 #include <stdlib.h> | |
36 #include <string.h> | |
37 #include <ctype.h> | |
38 | |
39 #include "platform/smartinclude.h" | |
40 #include <errno.h> | |
41 | |
42 #ifdef HAVE_FTS_H | |
43 # include <fts.h> | |
44 #endif | |
45 | |
46 #include "glade.h" | |
47 #include "input.h" | |
48 #include "main.h" | |
49 #include "playback.h" | |
2373
ad1d7687814c
[svn] made strings.h for existing strings.c, cleanups
mf0102
parents:
2365
diff
changeset
|
50 #include "strings.h" |
2313 | 51 #include "ui_playlist.h" |
52 | |
53 #ifdef USE_CHARDET | |
54 #include "../librcd/librcd.h" | |
55 #ifdef HAVE_UDET | |
56 #include <libudet_c.h> | |
57 #endif | |
58 #endif | |
59 | |
60 /* | |
61 * find <file> in directory <dirname> or subdirectories. return | |
62 * pointer to complete filename which has to be freed by calling | |
63 * "g_free()" after use. Returns NULL if file could not be found. | |
64 */ | |
65 | |
66 typedef struct { | |
67 const gchar *to_match; | |
68 gchar *match; | |
69 gboolean found; | |
70 } FindFileContext; | |
71 | |
72 static gboolean | |
73 find_file_func(const gchar * path, const gchar * basename, gpointer data) | |
74 { | |
75 FindFileContext *context = data; | |
76 | |
77 if (strlen(path) > FILENAME_MAX) { | |
78 g_warning("Ignoring path: name too long (%s)", path); | |
79 return TRUE; | |
80 } | |
81 | |
82 if (g_file_test(path, G_FILE_TEST_IS_REGULAR)) { | |
83 if (!strcasecmp(basename, context->to_match)) { | |
84 context->match = g_strdup(path); | |
85 context->found = TRUE; | |
86 return TRUE; | |
87 } | |
88 } | |
89 else if (g_file_test(path, G_FILE_TEST_IS_DIR)) { | |
90 dir_foreach(path, find_file_func, context, NULL); | |
91 if (context->found) | |
92 return TRUE; | |
93 } | |
94 | |
95 return FALSE; | |
96 } | |
97 | |
98 gchar * | |
99 find_file_recursively(const gchar * path, const gchar * filename) | |
100 { | |
101 FindFileContext context; | |
102 | |
103 context.to_match = filename; | |
104 context.match = NULL; | |
105 context.found = FALSE; | |
106 | |
107 dir_foreach(path, find_file_func, &context, NULL); | |
108 return context.match; | |
109 } | |
110 | |
111 | |
112 typedef enum { | |
113 ARCHIVE_UNKNOWN = 0, | |
114 ARCHIVE_DIR, | |
115 ARCHIVE_TAR, | |
116 ARCHIVE_TGZ, | |
117 ARCHIVE_ZIP, | |
118 ARCHIVE_TBZ2 | |
119 } ArchiveType; | |
120 | |
121 typedef gchar *(*ArchiveExtractFunc) (const gchar *, const gchar *); | |
122 | |
123 typedef struct { | |
124 ArchiveType type; | |
125 const gchar *ext; | |
126 } ArchiveExtensionType; | |
127 | |
128 static ArchiveExtensionType archive_extensions[] = { | |
129 {ARCHIVE_TAR, ".tar"}, | |
130 {ARCHIVE_ZIP, ".wsz"}, | |
131 {ARCHIVE_ZIP, ".zip"}, | |
132 {ARCHIVE_TGZ, ".tar.gz"}, | |
133 {ARCHIVE_TGZ, ".tgz"}, | |
134 {ARCHIVE_TBZ2, ".tar.bz2"}, | |
135 {ARCHIVE_TBZ2, ".bz2"}, | |
136 {ARCHIVE_UNKNOWN, NULL} | |
137 }; | |
138 | |
139 static gchar *archive_extract_tar(const gchar * archive, const gchar * dest); | |
140 static gchar *archive_extract_zip(const gchar * archive, const gchar * dest); | |
141 static gchar *archive_extract_tgz(const gchar * archive, const gchar * dest); | |
142 static gchar *archive_extract_tbz2(const gchar * archive, const gchar * dest); | |
143 | |
144 static ArchiveExtractFunc archive_extract_funcs[] = { | |
145 NULL, | |
146 NULL, | |
147 archive_extract_tar, | |
148 archive_extract_tgz, | |
149 archive_extract_zip, | |
150 archive_extract_tbz2 | |
151 }; | |
152 | |
153 | |
154 /* FIXME: these functions can be generalised into a function using a | |
155 * command lookup table */ | |
156 | |
157 static const gchar * | |
158 get_tar_command(void) | |
159 { | |
160 static const gchar *command = NULL; | |
161 | |
162 if (!command) { | |
163 if (!(command = getenv("TARCMD"))) | |
164 command = "tar"; | |
165 } | |
166 | |
167 return command; | |
168 } | |
169 | |
170 static const gchar * | |
171 get_unzip_command(void) | |
172 { | |
173 static const gchar *command = NULL; | |
174 | |
175 if (!command) { | |
176 if (!(command = getenv("UNZIPCMD"))) | |
177 command = "unzip"; | |
178 } | |
179 | |
180 return command; | |
181 } | |
182 | |
183 | |
184 static gchar * | |
185 archive_extract_tar(const gchar * archive, const gchar * dest) | |
186 { | |
187 return g_strdup_printf("%s >/dev/null xf \"%s\" -C %s", | |
188 get_tar_command(), archive, dest); | |
189 } | |
190 | |
191 static gchar * | |
192 archive_extract_zip(const gchar * archive, const gchar * dest) | |
193 { | |
194 return g_strdup_printf("%s >/dev/null -o -j \"%s\" -d %s", | |
195 get_unzip_command(), archive, dest); | |
196 } | |
197 | |
198 static gchar * | |
199 archive_extract_tgz(const gchar * archive, const gchar * dest) | |
200 { | |
201 return g_strdup_printf("%s >/dev/null xzf \"%s\" -C %s", | |
202 get_tar_command(), archive, dest); | |
203 } | |
204 | |
205 static gchar * | |
206 archive_extract_tbz2(const gchar * archive, const gchar * dest) | |
207 { | |
208 return g_strdup_printf("bzip2 -dc \"%s\" | %s >/dev/null xf - -C %s", | |
209 archive, get_tar_command(), dest); | |
210 } | |
211 | |
212 | |
213 ArchiveType | |
214 archive_get_type(const gchar * filename) | |
215 { | |
216 gint i = 0; | |
217 | |
218 if (g_file_test(filename, G_FILE_TEST_IS_DIR)) | |
219 return ARCHIVE_DIR; | |
220 | |
221 while (archive_extensions[i].ext) { | |
222 if (g_str_has_suffix(filename, archive_extensions[i].ext)) { | |
223 return archive_extensions[i].type; | |
224 } | |
225 i++; | |
226 } | |
227 | |
228 return ARCHIVE_UNKNOWN; | |
229 } | |
230 | |
231 gboolean | |
232 file_is_archive(const gchar * filename) | |
233 { | |
234 return (archive_get_type(filename) > ARCHIVE_DIR); | |
235 } | |
236 | |
237 gchar * | |
238 archive_basename(const gchar * str) | |
239 { | |
240 gint i = 0; | |
241 | |
242 while (archive_extensions[i].ext) { | |
243 if (str_has_suffix_nocase(str, archive_extensions[i].ext)) { | |
244 const gchar *end = g_strrstr(str, archive_extensions[i].ext); | |
245 if (end) { | |
246 return g_strndup(str, end - str); | |
247 } | |
248 break; | |
249 } | |
250 i++; | |
251 } | |
252 | |
253 return NULL; | |
254 } | |
255 | |
256 /* | |
257 decompress_archive | |
258 | |
259 Decompresses the archive "filename" to a temporary directory, | |
260 returns the path to the temp dir, or NULL if failed, | |
261 watch out tho, doesn't actually check if the system command succeeds :-| | |
262 */ | |
263 | |
264 gchar * | |
265 archive_decompress(const gchar * filename) | |
266 { | |
267 gchar *tmpdir, *cmd, *escaped_filename; | |
268 ArchiveType type; | |
2328 | 269 #ifndef HAVE_MKDTEMP |
2313 | 270 mode_t mode755 = S_IRWXU | S_IRGRP | S_IXGRP | S_IROTH | S_IXOTH; |
2328 | 271 #endif |
2313 | 272 |
273 if ((type = archive_get_type(filename)) <= ARCHIVE_DIR) | |
274 return NULL; | |
275 | |
276 #ifdef HAVE_MKDTEMP | |
277 tmpdir = g_build_filename(g_get_tmp_dir(), "audacious.XXXXXXXX", NULL); | |
278 if (!mkdtemp(tmpdir)) { | |
279 g_free(tmpdir); | |
280 g_message("Unable to load skin: Failed to create temporary " | |
281 "directory: %s", g_strerror(errno)); | |
282 return NULL; | |
283 } | |
284 #else | |
285 tmpdir = g_strdup_printf("%s/audacious.%ld", g_get_tmp_dir(), rand()); | |
286 make_directory(tmpdir, mode755); | |
287 #endif | |
288 | |
289 escaped_filename = escape_shell_chars(filename); | |
290 cmd = archive_extract_funcs[type] (escaped_filename, tmpdir); | |
291 g_free(escaped_filename); | |
292 | |
293 if (!cmd) { | |
294 g_message("extraction function is NULL!"); | |
295 g_free(tmpdir); | |
296 return NULL; | |
297 } | |
298 | |
2361
f24ae4f40e29
[svn] - security and warning fixes from ssommer@suse
nenolod
parents:
2332
diff
changeset
|
299 if(system(cmd) == -1) |
f24ae4f40e29
[svn] - security and warning fixes from ssommer@suse
nenolod
parents:
2332
diff
changeset
|
300 { |
f24ae4f40e29
[svn] - security and warning fixes from ssommer@suse
nenolod
parents:
2332
diff
changeset
|
301 g_message("could not execute cmd %s",cmd); |
f24ae4f40e29
[svn] - security and warning fixes from ssommer@suse
nenolod
parents:
2332
diff
changeset
|
302 g_free(cmd); |
f24ae4f40e29
[svn] - security and warning fixes from ssommer@suse
nenolod
parents:
2332
diff
changeset
|
303 return NULL; |
f24ae4f40e29
[svn] - security and warning fixes from ssommer@suse
nenolod
parents:
2332
diff
changeset
|
304 } |
2313 | 305 g_free(cmd); |
306 | |
307 return tmpdir; | |
308 } | |
309 | |
310 | |
311 #ifdef HAVE_FTS_H | |
312 | |
313 void | |
314 del_directory(const gchar * dirname) | |
315 { | |
316 gchar *const argv[2] = { (gchar *) dirname, NULL }; | |
317 FTS *fts; | |
318 FTSENT *p; | |
319 | |
320 fts = fts_open(argv, FTS_PHYSICAL, (gint(*)())NULL); | |
321 while ((p = fts_read(fts))) { | |
322 switch (p->fts_info) { | |
323 case FTS_D: | |
324 break; | |
325 case FTS_DNR: | |
326 case FTS_ERR: | |
327 break; | |
328 case FTS_DP: | |
329 rmdir(p->fts_accpath); | |
330 break; | |
331 default: | |
332 unlink(p->fts_accpath); | |
333 break; | |
334 } | |
335 } | |
336 fts_close(fts); | |
337 } | |
338 | |
339 #else /* !HAVE_FTS */ | |
340 | |
341 gboolean | |
342 del_directory_func(const gchar * path, const gchar * basename, | |
343 gpointer params) | |
344 { | |
345 if (!strcmp(basename, ".") || !strcmp(path, "..")) | |
346 return FALSE; | |
347 | |
348 if (g_file_test(path, G_FILE_TEST_IS_DIR)) { | |
349 dir_foreach(path, del_directory_func, NULL, NULL); | |
350 rmdir(path); | |
351 return FALSE; | |
352 } | |
353 | |
354 unlink(path); | |
355 | |
356 return FALSE; | |
357 } | |
358 | |
359 void | |
360 del_directory(const gchar * path) | |
361 { | |
362 dir_foreach(path, del_directory_func, NULL, NULL); | |
363 rmdir(path); | |
364 } | |
365 | |
366 #endif /* ifdef HAVE_FTS */ | |
367 | |
368 gchar * | |
369 read_ini_string(const gchar * filename, const gchar * section, | |
370 const gchar * key) | |
371 { | |
372 static gchar *buffer = NULL; | |
373 static gchar *open_buffer = NULL; | |
374 gchar *ret_buffer = NULL; | |
375 gint found_section = 0, len = 0; | |
376 static gsize filesize = 0; | |
377 gsize off = 0; | |
378 gchar *outbuf; | |
379 unsigned char x[] = { 0xff, 0xfe, 0x00 }; | |
380 guint counter; | |
381 | |
382 if (!filename) | |
383 return NULL; | |
384 | |
385 /* | |
386 * We optimise for the condition that we may be reading from the | |
387 * same ini-file multiple times. This is fairly common; it happens | |
388 * on .pls playlist loads. To do otherwise would take entirely too | |
389 * long, as fstat() can be very slow when done 21,000 times too many. | |
390 * | |
391 * Therefore, we optimise by keeping the last ini file in memory. | |
392 * Yes, this is a memory leak, but it is not too bad, hopefully. | |
393 * - nenolod | |
394 */ | |
395 if (open_buffer == NULL || strcasecmp(filename, open_buffer)) | |
396 { | |
397 if (buffer != NULL) | |
2423 | 398 { |
2313 | 399 g_free(buffer); |
400 buffer = NULL; | |
401 } | |
402 | |
2423 | 403 if (open_buffer != NULL) |
2313 | 404 { |
2423 | 405 g_free(open_buffer); |
2313 | 406 open_buffer = NULL; |
407 } | |
408 | |
2425 | 409 vfs_file_get_contents(filename, &buffer, &filesize); |
410 | |
411 if (buffer == NULL) | |
2313 | 412 return NULL; |
413 | |
414 open_buffer = g_strdup(filename); | |
415 } | |
416 | |
417 /* | |
418 * Convert UTF-16 into something useful. Original implementation | |
419 * by incomp@#audacious. Cleanups \nenolod | |
420 */ | |
421 if (!memcmp(&buffer[0],&x,2)) { | |
2402 | 422 outbuf = g_malloc (filesize); /* it's safe to waste memory. */ |
2313 | 423 |
424 for (counter = 2; counter < filesize; counter += 2) | |
425 if (!memcmp(&buffer[counter+1], &x[2], 1)) | |
426 outbuf[(counter-2)/2] = buffer[counter]; | |
427 else | |
2402 | 428 return NULL; |
2313 | 429 |
430 outbuf[(counter-2)/2] = '\0'; | |
431 | |
432 if ((filesize - 2) / 2 == (counter - 2) / 2) { | |
433 g_free(buffer); | |
434 buffer = outbuf; | |
435 } else { | |
436 g_free(outbuf); | |
2402 | 437 return NULL; /* XXX wrong encoding */ |
2313 | 438 } |
439 } | |
440 | |
441 while (!ret_buffer && off < filesize) { | |
442 while (off < filesize && | |
443 (buffer[off] == '\r' || buffer[off] == '\n' || | |
444 buffer[off] == ' ' || buffer[off] == '\t')) | |
445 off++; | |
446 if (off >= filesize) | |
447 break; | |
448 if (buffer[off] == '[') { | |
449 gint slen = strlen(section); | |
450 off++; | |
451 found_section = 0; | |
452 if (off + slen + 1 < filesize && | |
453 !strncasecmp(section, &buffer[off], slen)) { | |
454 off += slen; | |
455 if (buffer[off] == ']') { | |
456 off++; | |
457 found_section = 1; | |
458 } | |
459 } | |
460 } | |
461 else if (found_section && off + strlen(key) < filesize && | |
462 !strncasecmp(key, &buffer[off], strlen(key))) { | |
463 off += strlen(key); | |
464 while (off < filesize && | |
465 (buffer[off] == ' ' || buffer[off] == '\t')) | |
466 off++; | |
467 if (off >= filesize) | |
468 break; | |
469 if (buffer[off] == '=') { | |
470 off++; | |
471 while (off < filesize && | |
472 (buffer[off] == ' ' || buffer[off] == '\t')) | |
473 off++; | |
474 if (off >= filesize) | |
475 break; | |
476 len = 0; | |
477 while (off + len < filesize && | |
478 buffer[off + len] != '\r' && | |
479 buffer[off + len] != '\n' && buffer[off + len] != ';') | |
480 len++; | |
481 ret_buffer = g_strndup(&buffer[off], len); | |
482 off += len; | |
483 } | |
484 } | |
485 while (off < filesize && buffer[off] != '\r' && buffer[off] != '\n') | |
486 off++; | |
487 } | |
488 | |
489 return ret_buffer; | |
490 } | |
491 | |
492 GArray * | |
493 string_to_garray(const gchar * str) | |
494 { | |
495 GArray *array; | |
496 gint temp; | |
497 const gchar *ptr = str; | |
498 gchar *endptr; | |
499 | |
500 array = g_array_new(FALSE, TRUE, sizeof(gint)); | |
501 for (;;) { | |
502 temp = strtol(ptr, &endptr, 10); | |
503 if (ptr == endptr) | |
504 break; | |
505 g_array_append_val(array, temp); | |
506 ptr = endptr; | |
507 while (!isdigit((int) *ptr) && (*ptr) != '\0') | |
508 ptr++; | |
509 if (*ptr == '\0') | |
510 break; | |
511 } | |
512 return (array); | |
513 } | |
514 | |
515 GArray * | |
516 read_ini_array(const gchar * filename, const gchar * section, | |
517 const gchar * key) | |
518 { | |
519 gchar *temp; | |
520 GArray *a; | |
521 | |
522 if ((temp = read_ini_string(filename, section, key)) == NULL) { | |
523 g_free(temp); | |
524 return NULL; | |
525 } | |
526 a = string_to_garray(temp); | |
527 g_free(temp); | |
528 return a; | |
529 } | |
530 | |
531 void | |
532 glist_movedown(GList * list) | |
533 { | |
534 gpointer temp; | |
535 | |
536 if (g_list_next(list)) { | |
537 temp = list->data; | |
538 list->data = list->next->data; | |
539 list->next->data = temp; | |
540 } | |
541 } | |
542 | |
543 void | |
544 glist_moveup(GList * list) | |
545 { | |
546 gpointer temp; | |
547 | |
548 if (g_list_previous(list)) { | |
549 temp = list->data; | |
550 list->data = list->prev->data; | |
551 list->prev->data = temp; | |
552 } | |
553 } | |
554 | |
555 | |
556 void | |
557 util_menu_position(GtkMenu * menu, gint * x, gint * y, | |
558 gboolean * push_in, gpointer data) | |
559 { | |
560 GtkRequisition requisition; | |
561 gint screen_width; | |
562 gint screen_height; | |
563 MenuPos *pos = data; | |
564 | |
565 gtk_widget_size_request(GTK_WIDGET(menu), &requisition); | |
566 | |
567 screen_width = gdk_screen_width(); | |
568 screen_height = gdk_screen_height(); | |
569 | |
570 *x = CLAMP(pos->x - 2, 0, MAX(0, screen_width - requisition.width)); | |
571 *y = CLAMP(pos->y - 2, 0, MAX(0, screen_height - requisition.height)); | |
572 } | |
573 | |
574 GdkFont * | |
575 util_font_load(const gchar * name) | |
576 { | |
577 GdkFont *font; | |
578 PangoFontDescription *desc; | |
579 | |
580 desc = pango_font_description_from_string(name); | |
581 font = gdk_font_from_description(desc); | |
582 | |
583 return font; | |
584 } | |
585 | |
586 #ifdef ENABLE_NLS | |
587 gchar * | |
588 bmp_menu_translate(const gchar * path, gpointer func_data) | |
589 { | |
590 gchar *translation = gettext(path); | |
591 | |
592 if (!translation || *translation != '/') { | |
593 g_warning("Bad translation for menupath: %s", path); | |
594 translation = (gchar *) path; | |
595 } | |
596 | |
597 return translation; | |
598 } | |
599 #endif | |
600 | |
601 /* text_get_extents() taken from The GIMP (C) Spencer Kimball, Peter | |
602 * Mattis et al */ | |
603 gboolean | |
604 text_get_extents(const gchar * fontname, | |
605 const gchar * text, | |
606 gint * width, gint * height, gint * ascent, gint * descent) | |
607 { | |
608 PangoFontDescription *font_desc; | |
609 PangoLayout *layout; | |
610 PangoRectangle rect; | |
611 | |
612 g_return_val_if_fail(fontname != NULL, FALSE); | |
613 g_return_val_if_fail(text != NULL, FALSE); | |
614 | |
615 /* FIXME: resolution */ | |
616 layout = gtk_widget_create_pango_layout(GTK_WIDGET(mainwin), text); | |
617 | |
618 font_desc = pango_font_description_from_string(fontname); | |
619 pango_layout_set_font_description(layout, font_desc); | |
620 pango_font_description_free(font_desc); | |
621 pango_layout_get_pixel_extents(layout, NULL, &rect); | |
622 | |
623 if (width) | |
624 *width = rect.width; | |
625 if (height) | |
626 *height = rect.height; | |
627 | |
628 if (ascent || descent) { | |
629 PangoLayoutIter *iter; | |
630 PangoLayoutLine *line; | |
631 | |
632 iter = pango_layout_get_iter(layout); | |
633 line = pango_layout_iter_get_line(iter); | |
634 pango_layout_iter_free(iter); | |
635 | |
636 pango_layout_line_get_pixel_extents(line, NULL, &rect); | |
637 | |
638 if (ascent) | |
639 *ascent = PANGO_ASCENT(rect); | |
640 if (descent) | |
641 *descent = -PANGO_DESCENT(rect); | |
642 } | |
643 | |
644 g_object_unref(layout); | |
645 | |
646 return TRUE; | |
647 } | |
648 | |
649 /* counts number of digits in a gint */ | |
650 guint | |
651 gint_count_digits(gint n) | |
652 { | |
653 guint count = 0; | |
654 | |
655 n = ABS(n); | |
656 do { | |
657 count++; | |
658 n /= 10; | |
659 } while (n > 0); | |
660 | |
661 return count; | |
662 } | |
663 | |
664 gboolean | |
665 dir_foreach(const gchar * path, DirForeachFunc function, | |
666 gpointer user_data, GError ** error) | |
667 { | |
668 GError *error_out = NULL; | |
669 GDir *dir; | |
670 const gchar *entry; | |
671 gchar *entry_fullpath; | |
672 | |
673 if (!(dir = g_dir_open(path, 0, &error_out))) { | |
674 g_propagate_error(error, error_out); | |
675 return FALSE; | |
676 } | |
677 | |
678 while ((entry = g_dir_read_name(dir))) { | |
679 entry_fullpath = g_build_filename(path, entry, NULL); | |
680 | |
681 if ((*function) (entry_fullpath, entry, user_data)) { | |
682 g_free(entry_fullpath); | |
683 break; | |
684 } | |
685 | |
686 g_free(entry_fullpath); | |
687 } | |
688 | |
689 g_dir_close(dir); | |
690 | |
691 return TRUE; | |
692 } | |
693 | |
694 GtkWidget * | |
695 make_filebrowser(const gchar * title, | |
696 gboolean save) | |
697 { | |
698 GtkWidget *dialog; | |
699 GtkWidget *button; | |
700 GtkWidget *button_close; | |
701 | |
702 g_return_val_if_fail(title != NULL, NULL); | |
703 | |
704 dialog = gtk_file_chooser_dialog_new(title, GTK_WINDOW(mainwin), | |
705 GTK_FILE_CHOOSER_ACTION_OPEN, NULL, NULL); | |
706 if (save) | |
707 gtk_file_chooser_set_action(GTK_FILE_CHOOSER(dialog), | |
708 GTK_FILE_CHOOSER_ACTION_SAVE); | |
709 | |
710 if (!save) | |
711 gtk_file_chooser_set_select_multiple(GTK_FILE_CHOOSER(dialog), TRUE); | |
712 | |
713 g_signal_connect(dialog, "destroy", | |
714 G_CALLBACK(gtk_widget_destroyed), &dialog); | |
715 | |
716 button_close = gtk_dialog_add_button(GTK_DIALOG(dialog), GTK_STOCK_CANCEL, | |
717 GTK_RESPONSE_REJECT); | |
718 gtk_button_set_use_stock(GTK_BUTTON(button_close), TRUE); | |
719 GTK_WIDGET_SET_FLAGS(button_close, GTK_CAN_DEFAULT); | |
720 g_signal_connect_swapped(button_close, "clicked", | |
721 G_CALLBACK(gtk_widget_destroy), dialog); | |
722 | |
723 button = gtk_dialog_add_button(GTK_DIALOG(dialog), save ? | |
724 GTK_STOCK_SAVE : GTK_STOCK_OPEN, | |
725 GTK_RESPONSE_ACCEPT); | |
726 gtk_button_set_use_stock(GTK_BUTTON(button), TRUE); | |
727 GTK_WIDGET_SET_FLAGS(button, GTK_CAN_DEFAULT); | |
728 gtk_window_set_default(GTK_WINDOW(dialog), button); | |
729 | |
730 gtk_widget_show(dialog); | |
731 | |
732 return dialog; | |
733 } | |
734 | |
735 /* | |
736 * Resizes a GDK pixmap. | |
737 */ | |
738 GdkPixmap *audacious_pixmap_resize(GdkWindow *src, GdkGC *src_gc, GdkPixmap *in, gint width, gint height) | |
739 { | |
2402 | 740 GdkPixmap *out; |
741 gint owidth, oheight; | |
2313 | 742 |
2402 | 743 g_return_val_if_fail(src != NULL, NULL); |
744 g_return_val_if_fail(src_gc != NULL, NULL); | |
745 g_return_val_if_fail(in != NULL, NULL); | |
746 g_return_val_if_fail(width > 0 && height > 0, NULL); | |
2313 | 747 |
2402 | 748 gdk_drawable_get_size(in, &owidth, &oheight); |
2313 | 749 |
2402 | 750 if (oheight == height && owidth == width) |
751 return NULL; | |
2313 | 752 |
2402 | 753 out = gdk_pixmap_new(src, width, height, -1); |
2313 | 754 |
2402 | 755 gdk_draw_rectangle(out, src_gc, TRUE, 0, 0, width, height); |
2313 | 756 |
2402 | 757 gdk_window_copy_area(out, src_gc, 0, 0, in, 0, 0, owidth, oheight); |
758 g_object_unref(src); | |
2313 | 759 |
2402 | 760 return out; |
2313 | 761 } |
762 | |
763 GdkImage *create_dblsize_image(GdkImage * img) | |
764 { | |
765 GdkImage *dblimg; | |
766 register guint x, y; | |
767 | |
768 /* | |
769 * This needs to be optimized | |
770 */ | |
771 | |
772 dblimg = | |
2402 | 773 gdk_image_new(GDK_IMAGE_NORMAL, gdk_visual_get_system(), |
774 img->width << 1, img->height << 1); | |
2313 | 775 if (dblimg->bpp == 1) { |
2402 | 776 register guint8 *srcptr, *ptr, *ptr2, pix; |
2313 | 777 |
2402 | 778 srcptr = GDK_IMAGE(img)->mem; |
779 ptr = GDK_IMAGE(dblimg)->mem; | |
780 ptr2 = ptr + dblimg->bpl; | |
2313 | 781 |
2402 | 782 for (y = 0; y < img->height; y++) { |
783 for (x = 0; x < img->width; x++) { | |
784 pix = *srcptr++; | |
785 *ptr++ = pix; | |
786 *ptr++ = pix; | |
787 *ptr2++ = pix; | |
788 *ptr2++ = pix; | |
789 } | |
790 srcptr += img->bpl - img->width; | |
791 ptr += (dblimg->bpl << 1) - dblimg->width; | |
792 ptr2 += (dblimg->bpl << 1) - dblimg->width; | |
793 } | |
2313 | 794 } |
795 if (dblimg->bpp == 2) { | |
2402 | 796 guint16 *srcptr, *ptr, *ptr2, pix; |
2313 | 797 |
2402 | 798 srcptr = (guint16 *) GDK_IMAGE_XIMAGE(img)->data; |
799 ptr = (guint16 *) GDK_IMAGE_XIMAGE(dblimg)->data; | |
800 ptr2 = ptr + (dblimg->bpl >> 1); | |
2313 | 801 |
2402 | 802 for (y = 0; y < img->height; y++) { |
803 for (x = 0; x < img->width; x++) { | |
804 pix = *srcptr++; | |
805 *ptr++ = pix; | |
806 *ptr++ = pix; | |
807 *ptr2++ = pix; | |
808 *ptr2++ = pix; | |
809 } | |
810 srcptr += (img->bpl >> 1) - img->width; | |
811 ptr += (dblimg->bpl) - dblimg->width; | |
812 ptr2 += (dblimg->bpl) - dblimg->width; | |
813 } | |
2313 | 814 } |
815 if (dblimg->bpp == 3) { | |
2402 | 816 register guint8 *srcptr, *ptr, *ptr2, pix1, pix2, pix3; |
2313 | 817 |
2402 | 818 srcptr = GDK_IMAGE(img)->mem; |
819 ptr = GDK_IMAGE(dblimg)->mem; | |
820 ptr2 = ptr + dblimg->bpl; | |
2313 | 821 |
2402 | 822 for (y = 0; y < img->height; y++) { |
823 for (x = 0; x < img->width; x++) { | |
824 pix1 = *srcptr++; | |
825 pix2 = *srcptr++; | |
826 pix3 = *srcptr++; | |
827 *ptr++ = pix1; | |
828 *ptr++ = pix2; | |
829 *ptr++ = pix3; | |
830 *ptr++ = pix1; | |
831 *ptr++ = pix2; | |
832 *ptr++ = pix3; | |
833 *ptr2++ = pix1; | |
834 *ptr2++ = pix2; | |
835 *ptr2++ = pix3; | |
836 *ptr2++ = pix1; | |
837 *ptr2++ = pix2; | |
838 *ptr2++ = pix3; | |
2313 | 839 |
2402 | 840 } |
841 srcptr += img->bpl - (img->width * 3); | |
842 ptr += (dblimg->bpl << 1) - (dblimg->width * 3); | |
843 ptr2 += (dblimg->bpl << 1) - (dblimg->width * 3); | |
844 } | |
2313 | 845 } |
846 if (dblimg->bpp == 4) { | |
2402 | 847 register guint32 *srcptr, *ptr, *ptr2, pix; |
2313 | 848 |
2402 | 849 srcptr = (guint32 *) GDK_IMAGE(img)->mem; |
850 ptr = (guint32 *) GDK_IMAGE(dblimg)->mem; | |
851 ptr2 = ptr + (dblimg->bpl >> 2); | |
2313 | 852 |
2402 | 853 for (y = 0; y < img->height; y++) { |
854 for (x = 0; x < img->width; x++) { | |
855 pix = *srcptr++; | |
856 *ptr++ = pix; | |
857 *ptr++ = pix; | |
858 *ptr2++ = pix; | |
859 *ptr2++ = pix; | |
860 } | |
861 srcptr += (img->bpl >> 2) - img->width; | |
862 ptr += (dblimg->bpl >> 1) - dblimg->width; | |
863 ptr2 += (dblimg->bpl >> 1) - dblimg->width; | |
864 } | |
2313 | 865 } |
866 return dblimg; | |
867 } | |
868 | |
869 /* URL-decode a file: URL path, return NULL if it's not what we expect */ | |
870 gchar * | |
871 xmms_urldecode_path(const gchar * encoded_path) | |
872 { | |
873 const gchar *cur, *ext; | |
874 gchar *path, *tmp; | |
875 gint realchar; | |
876 | |
877 if (!encoded_path) | |
878 return NULL; | |
879 | |
880 if (!str_has_prefix_nocase(encoded_path, "file:")) | |
881 return NULL; | |
882 | |
883 cur = encoded_path + 5; | |
884 | |
885 if (str_has_prefix_nocase(cur, "//localhost")) | |
886 cur += 11; | |
887 | |
888 if (*cur == '/') | |
889 while (cur[1] == '/') | |
890 cur++; | |
891 | |
892 tmp = g_malloc0(strlen(cur) + 1); | |
893 | |
894 while ((ext = strchr(cur, '%')) != NULL) { | |
895 strncat(tmp, cur, ext - cur); | |
896 ext++; | |
897 cur = ext + 2; | |
898 if (!sscanf(ext, "%2x", &realchar)) { | |
899 /* Assume it is a literal '%'. Several file | |
900 * managers send unencoded file: urls on drag | |
901 * and drop. */ | |
902 realchar = '%'; | |
903 cur -= 2; | |
904 } | |
905 tmp[strlen(tmp)] = realchar; | |
906 } | |
907 | |
908 path = g_strconcat(tmp, cur, NULL); | |
909 g_free(tmp); | |
910 return path; | |
911 } | |
912 | |
2421
74ec16ef847b
[svn] - fix accidental removal of xmms_show_message
nenolod
parents:
2416
diff
changeset
|
913 /** |
74ec16ef847b
[svn] - fix accidental removal of xmms_show_message
nenolod
parents:
2416
diff
changeset
|
914 * xmms_show_message: |
74ec16ef847b
[svn] - fix accidental removal of xmms_show_message
nenolod
parents:
2416
diff
changeset
|
915 * @title: The title of the message to show. |
74ec16ef847b
[svn] - fix accidental removal of xmms_show_message
nenolod
parents:
2416
diff
changeset
|
916 * @text: The text of the message to show. |
74ec16ef847b
[svn] - fix accidental removal of xmms_show_message
nenolod
parents:
2416
diff
changeset
|
917 * @button_text: The text of the button which will close the messagebox. |
74ec16ef847b
[svn] - fix accidental removal of xmms_show_message
nenolod
parents:
2416
diff
changeset
|
918 * @modal: Whether or not the messagebox should be modal. |
74ec16ef847b
[svn] - fix accidental removal of xmms_show_message
nenolod
parents:
2416
diff
changeset
|
919 * @button_action: Code to execute on when the messagebox is closed, or %NULL. |
74ec16ef847b
[svn] - fix accidental removal of xmms_show_message
nenolod
parents:
2416
diff
changeset
|
920 * @action_data: Optional opaque data to pass to @button_action. |
74ec16ef847b
[svn] - fix accidental removal of xmms_show_message
nenolod
parents:
2416
diff
changeset
|
921 * |
74ec16ef847b
[svn] - fix accidental removal of xmms_show_message
nenolod
parents:
2416
diff
changeset
|
922 * Displays a message box. |
74ec16ef847b
[svn] - fix accidental removal of xmms_show_message
nenolod
parents:
2416
diff
changeset
|
923 * |
74ec16ef847b
[svn] - fix accidental removal of xmms_show_message
nenolod
parents:
2416
diff
changeset
|
924 * Return value: A GTK widget handle for the message box. |
74ec16ef847b
[svn] - fix accidental removal of xmms_show_message
nenolod
parents:
2416
diff
changeset
|
925 **/ |
74ec16ef847b
[svn] - fix accidental removal of xmms_show_message
nenolod
parents:
2416
diff
changeset
|
926 GtkWidget * |
74ec16ef847b
[svn] - fix accidental removal of xmms_show_message
nenolod
parents:
2416
diff
changeset
|
927 xmms_show_message(const gchar * title, const gchar * text, |
74ec16ef847b
[svn] - fix accidental removal of xmms_show_message
nenolod
parents:
2416
diff
changeset
|
928 const gchar * button_text, gboolean modal, |
74ec16ef847b
[svn] - fix accidental removal of xmms_show_message
nenolod
parents:
2416
diff
changeset
|
929 GtkSignalFunc button_action, gpointer action_data) |
74ec16ef847b
[svn] - fix accidental removal of xmms_show_message
nenolod
parents:
2416
diff
changeset
|
930 { |
74ec16ef847b
[svn] - fix accidental removal of xmms_show_message
nenolod
parents:
2416
diff
changeset
|
931 GtkWidget *dialog; |
74ec16ef847b
[svn] - fix accidental removal of xmms_show_message
nenolod
parents:
2416
diff
changeset
|
932 GtkWidget *dialog_vbox, *dialog_hbox, *dialog_bbox; |
74ec16ef847b
[svn] - fix accidental removal of xmms_show_message
nenolod
parents:
2416
diff
changeset
|
933 GtkWidget *dialog_bbox_b1; |
74ec16ef847b
[svn] - fix accidental removal of xmms_show_message
nenolod
parents:
2416
diff
changeset
|
934 GtkWidget *dialog_textlabel; |
74ec16ef847b
[svn] - fix accidental removal of xmms_show_message
nenolod
parents:
2416
diff
changeset
|
935 GtkWidget *dialog_icon; |
74ec16ef847b
[svn] - fix accidental removal of xmms_show_message
nenolod
parents:
2416
diff
changeset
|
936 |
74ec16ef847b
[svn] - fix accidental removal of xmms_show_message
nenolod
parents:
2416
diff
changeset
|
937 dialog = gtk_window_new(GTK_WINDOW_TOPLEVEL); |
74ec16ef847b
[svn] - fix accidental removal of xmms_show_message
nenolod
parents:
2416
diff
changeset
|
938 gtk_window_set_type_hint( GTK_WINDOW(dialog) , GDK_WINDOW_TYPE_HINT_DIALOG ); |
74ec16ef847b
[svn] - fix accidental removal of xmms_show_message
nenolod
parents:
2416
diff
changeset
|
939 gtk_window_set_modal( GTK_WINDOW(dialog) , modal ); |
74ec16ef847b
[svn] - fix accidental removal of xmms_show_message
nenolod
parents:
2416
diff
changeset
|
940 gtk_window_set_title( GTK_WINDOW(dialog) , title ); |
74ec16ef847b
[svn] - fix accidental removal of xmms_show_message
nenolod
parents:
2416
diff
changeset
|
941 gtk_container_set_border_width( GTK_CONTAINER(dialog) , 10 ); |
74ec16ef847b
[svn] - fix accidental removal of xmms_show_message
nenolod
parents:
2416
diff
changeset
|
942 |
74ec16ef847b
[svn] - fix accidental removal of xmms_show_message
nenolod
parents:
2416
diff
changeset
|
943 dialog_vbox = gtk_vbox_new( FALSE , 0 ); |
74ec16ef847b
[svn] - fix accidental removal of xmms_show_message
nenolod
parents:
2416
diff
changeset
|
944 dialog_hbox = gtk_hbox_new( FALSE , 0 ); |
74ec16ef847b
[svn] - fix accidental removal of xmms_show_message
nenolod
parents:
2416
diff
changeset
|
945 |
74ec16ef847b
[svn] - fix accidental removal of xmms_show_message
nenolod
parents:
2416
diff
changeset
|
946 /* icon */ |
74ec16ef847b
[svn] - fix accidental removal of xmms_show_message
nenolod
parents:
2416
diff
changeset
|
947 dialog_icon = gtk_image_new_from_stock( GTK_STOCK_DIALOG_INFO , GTK_ICON_SIZE_DIALOG ); |
74ec16ef847b
[svn] - fix accidental removal of xmms_show_message
nenolod
parents:
2416
diff
changeset
|
948 gtk_box_pack_start( GTK_BOX(dialog_hbox) , dialog_icon , FALSE , FALSE , 2 ); |
74ec16ef847b
[svn] - fix accidental removal of xmms_show_message
nenolod
parents:
2416
diff
changeset
|
949 |
74ec16ef847b
[svn] - fix accidental removal of xmms_show_message
nenolod
parents:
2416
diff
changeset
|
950 /* label */ |
74ec16ef847b
[svn] - fix accidental removal of xmms_show_message
nenolod
parents:
2416
diff
changeset
|
951 dialog_textlabel = gtk_label_new( text ); |
74ec16ef847b
[svn] - fix accidental removal of xmms_show_message
nenolod
parents:
2416
diff
changeset
|
952 /* gtk_label_set_selectable( GTK_LABEL(dialog_textlabel) , TRUE ); */ |
74ec16ef847b
[svn] - fix accidental removal of xmms_show_message
nenolod
parents:
2416
diff
changeset
|
953 gtk_box_pack_start( GTK_BOX(dialog_hbox) , dialog_textlabel , TRUE , TRUE , 2 ); |
74ec16ef847b
[svn] - fix accidental removal of xmms_show_message
nenolod
parents:
2416
diff
changeset
|
954 |
74ec16ef847b
[svn] - fix accidental removal of xmms_show_message
nenolod
parents:
2416
diff
changeset
|
955 gtk_box_pack_start( GTK_BOX(dialog_vbox) , dialog_hbox , FALSE , FALSE , 2 ); |
74ec16ef847b
[svn] - fix accidental removal of xmms_show_message
nenolod
parents:
2416
diff
changeset
|
956 gtk_box_pack_start( GTK_BOX(dialog_vbox) , gtk_hseparator_new() , FALSE , FALSE , 4 ); |
74ec16ef847b
[svn] - fix accidental removal of xmms_show_message
nenolod
parents:
2416
diff
changeset
|
957 |
74ec16ef847b
[svn] - fix accidental removal of xmms_show_message
nenolod
parents:
2416
diff
changeset
|
958 dialog_bbox = gtk_hbutton_box_new(); |
74ec16ef847b
[svn] - fix accidental removal of xmms_show_message
nenolod
parents:
2416
diff
changeset
|
959 gtk_button_box_set_layout( GTK_BUTTON_BOX(dialog_bbox) , GTK_BUTTONBOX_END ); |
74ec16ef847b
[svn] - fix accidental removal of xmms_show_message
nenolod
parents:
2416
diff
changeset
|
960 dialog_bbox_b1 = gtk_button_new_with_label( button_text ); |
74ec16ef847b
[svn] - fix accidental removal of xmms_show_message
nenolod
parents:
2416
diff
changeset
|
961 g_signal_connect_swapped( G_OBJECT(dialog_bbox_b1) , "clicked" , |
74ec16ef847b
[svn] - fix accidental removal of xmms_show_message
nenolod
parents:
2416
diff
changeset
|
962 G_CALLBACK(gtk_widget_destroy) , dialog ); |
74ec16ef847b
[svn] - fix accidental removal of xmms_show_message
nenolod
parents:
2416
diff
changeset
|
963 if ( button_action ) |
74ec16ef847b
[svn] - fix accidental removal of xmms_show_message
nenolod
parents:
2416
diff
changeset
|
964 g_signal_connect( G_OBJECT(dialog_bbox_b1) , "clicked" , |
74ec16ef847b
[svn] - fix accidental removal of xmms_show_message
nenolod
parents:
2416
diff
changeset
|
965 button_action , action_data ); |
74ec16ef847b
[svn] - fix accidental removal of xmms_show_message
nenolod
parents:
2416
diff
changeset
|
966 GTK_WIDGET_SET_FLAGS( dialog_bbox_b1 , GTK_CAN_DEFAULT); |
74ec16ef847b
[svn] - fix accidental removal of xmms_show_message
nenolod
parents:
2416
diff
changeset
|
967 gtk_widget_grab_default( dialog_bbox_b1 ); |
74ec16ef847b
[svn] - fix accidental removal of xmms_show_message
nenolod
parents:
2416
diff
changeset
|
968 |
74ec16ef847b
[svn] - fix accidental removal of xmms_show_message
nenolod
parents:
2416
diff
changeset
|
969 gtk_container_add( GTK_CONTAINER(dialog_bbox) , dialog_bbox_b1 ); |
74ec16ef847b
[svn] - fix accidental removal of xmms_show_message
nenolod
parents:
2416
diff
changeset
|
970 gtk_box_pack_start( GTK_BOX(dialog_vbox) , dialog_bbox , FALSE , FALSE , 0 ); |
74ec16ef847b
[svn] - fix accidental removal of xmms_show_message
nenolod
parents:
2416
diff
changeset
|
971 |
74ec16ef847b
[svn] - fix accidental removal of xmms_show_message
nenolod
parents:
2416
diff
changeset
|
972 gtk_container_add( GTK_CONTAINER(dialog) , dialog_vbox ); |
74ec16ef847b
[svn] - fix accidental removal of xmms_show_message
nenolod
parents:
2416
diff
changeset
|
973 gtk_widget_show_all(dialog); |
74ec16ef847b
[svn] - fix accidental removal of xmms_show_message
nenolod
parents:
2416
diff
changeset
|
974 |
74ec16ef847b
[svn] - fix accidental removal of xmms_show_message
nenolod
parents:
2416
diff
changeset
|
975 return dialog; |
74ec16ef847b
[svn] - fix accidental removal of xmms_show_message
nenolod
parents:
2416
diff
changeset
|
976 } |
74ec16ef847b
[svn] - fix accidental removal of xmms_show_message
nenolod
parents:
2416
diff
changeset
|
977 |
74ec16ef847b
[svn] - fix accidental removal of xmms_show_message
nenolod
parents:
2416
diff
changeset
|
978 |
74ec16ef847b
[svn] - fix accidental removal of xmms_show_message
nenolod
parents:
2416
diff
changeset
|
979 /** |
74ec16ef847b
[svn] - fix accidental removal of xmms_show_message
nenolod
parents:
2416
diff
changeset
|
980 * audacious_get_localdir: |
74ec16ef847b
[svn] - fix accidental removal of xmms_show_message
nenolod
parents:
2416
diff
changeset
|
981 * |
74ec16ef847b
[svn] - fix accidental removal of xmms_show_message
nenolod
parents:
2416
diff
changeset
|
982 * Returns a string with the full path of Audacious local datadir (where config files are placed). |
74ec16ef847b
[svn] - fix accidental removal of xmms_show_message
nenolod
parents:
2416
diff
changeset
|
983 * It's useful in order to put in the right place custom config files for audacious plugins. |
74ec16ef847b
[svn] - fix accidental removal of xmms_show_message
nenolod
parents:
2416
diff
changeset
|
984 * |
74ec16ef847b
[svn] - fix accidental removal of xmms_show_message
nenolod
parents:
2416
diff
changeset
|
985 * Return value: a string with full path of Audacious local datadir (should be freed after use) |
74ec16ef847b
[svn] - fix accidental removal of xmms_show_message
nenolod
parents:
2416
diff
changeset
|
986 **/ |
74ec16ef847b
[svn] - fix accidental removal of xmms_show_message
nenolod
parents:
2416
diff
changeset
|
987 gchar* |
74ec16ef847b
[svn] - fix accidental removal of xmms_show_message
nenolod
parents:
2416
diff
changeset
|
988 audacious_get_localdir(void) |
74ec16ef847b
[svn] - fix accidental removal of xmms_show_message
nenolod
parents:
2416
diff
changeset
|
989 { |
74ec16ef847b
[svn] - fix accidental removal of xmms_show_message
nenolod
parents:
2416
diff
changeset
|
990 gchar *datadir; |
74ec16ef847b
[svn] - fix accidental removal of xmms_show_message
nenolod
parents:
2416
diff
changeset
|
991 gchar *tmp; |
74ec16ef847b
[svn] - fix accidental removal of xmms_show_message
nenolod
parents:
2416
diff
changeset
|
992 |
74ec16ef847b
[svn] - fix accidental removal of xmms_show_message
nenolod
parents:
2416
diff
changeset
|
993 if ( (tmp = getenv("XDG_CONFIG_HOME")) == NULL ) |
74ec16ef847b
[svn] - fix accidental removal of xmms_show_message
nenolod
parents:
2416
diff
changeset
|
994 datadir = g_build_filename( g_get_home_dir() , ".config" , "audacious" , NULL ); |
74ec16ef847b
[svn] - fix accidental removal of xmms_show_message
nenolod
parents:
2416
diff
changeset
|
995 else |
74ec16ef847b
[svn] - fix accidental removal of xmms_show_message
nenolod
parents:
2416
diff
changeset
|
996 datadir = g_build_filename( tmp , "audacious" , NULL ); |
74ec16ef847b
[svn] - fix accidental removal of xmms_show_message
nenolod
parents:
2416
diff
changeset
|
997 |
74ec16ef847b
[svn] - fix accidental removal of xmms_show_message
nenolod
parents:
2416
diff
changeset
|
998 return datadir; |
74ec16ef847b
[svn] - fix accidental removal of xmms_show_message
nenolod
parents:
2416
diff
changeset
|
999 } |
74ec16ef847b
[svn] - fix accidental removal of xmms_show_message
nenolod
parents:
2416
diff
changeset
|
1000 |
74ec16ef847b
[svn] - fix accidental removal of xmms_show_message
nenolod
parents:
2416
diff
changeset
|
1001 |
74ec16ef847b
[svn] - fix accidental removal of xmms_show_message
nenolod
parents:
2416
diff
changeset
|
1002 /** |
74ec16ef847b
[svn] - fix accidental removal of xmms_show_message
nenolod
parents:
2416
diff
changeset
|
1003 * xmms_check_realtime_priority: |
74ec16ef847b
[svn] - fix accidental removal of xmms_show_message
nenolod
parents:
2416
diff
changeset
|
1004 * |
74ec16ef847b
[svn] - fix accidental removal of xmms_show_message
nenolod
parents:
2416
diff
changeset
|
1005 * Legacy function included for compatibility with XMMS. |
74ec16ef847b
[svn] - fix accidental removal of xmms_show_message
nenolod
parents:
2416
diff
changeset
|
1006 * |
74ec16ef847b
[svn] - fix accidental removal of xmms_show_message
nenolod
parents:
2416
diff
changeset
|
1007 * Return value: FALSE |
74ec16ef847b
[svn] - fix accidental removal of xmms_show_message
nenolod
parents:
2416
diff
changeset
|
1008 **/ |
74ec16ef847b
[svn] - fix accidental removal of xmms_show_message
nenolod
parents:
2416
diff
changeset
|
1009 gboolean |
74ec16ef847b
[svn] - fix accidental removal of xmms_show_message
nenolod
parents:
2416
diff
changeset
|
1010 xmms_check_realtime_priority(void) |
74ec16ef847b
[svn] - fix accidental removal of xmms_show_message
nenolod
parents:
2416
diff
changeset
|
1011 { |
74ec16ef847b
[svn] - fix accidental removal of xmms_show_message
nenolod
parents:
2416
diff
changeset
|
1012 return FALSE; |
74ec16ef847b
[svn] - fix accidental removal of xmms_show_message
nenolod
parents:
2416
diff
changeset
|
1013 } |
74ec16ef847b
[svn] - fix accidental removal of xmms_show_message
nenolod
parents:
2416
diff
changeset
|
1014 |
74ec16ef847b
[svn] - fix accidental removal of xmms_show_message
nenolod
parents:
2416
diff
changeset
|
1015 /** |
74ec16ef847b
[svn] - fix accidental removal of xmms_show_message
nenolod
parents:
2416
diff
changeset
|
1016 * xmms_usleep: |
74ec16ef847b
[svn] - fix accidental removal of xmms_show_message
nenolod
parents:
2416
diff
changeset
|
1017 * @usec: The amount of microseconds to sleep. |
74ec16ef847b
[svn] - fix accidental removal of xmms_show_message
nenolod
parents:
2416
diff
changeset
|
1018 * |
74ec16ef847b
[svn] - fix accidental removal of xmms_show_message
nenolod
parents:
2416
diff
changeset
|
1019 * Legacy function included for compatibility with XMMS. |
74ec16ef847b
[svn] - fix accidental removal of xmms_show_message
nenolod
parents:
2416
diff
changeset
|
1020 **/ |
74ec16ef847b
[svn] - fix accidental removal of xmms_show_message
nenolod
parents:
2416
diff
changeset
|
1021 void |
74ec16ef847b
[svn] - fix accidental removal of xmms_show_message
nenolod
parents:
2416
diff
changeset
|
1022 xmms_usleep(gint usec) |
74ec16ef847b
[svn] - fix accidental removal of xmms_show_message
nenolod
parents:
2416
diff
changeset
|
1023 { |
74ec16ef847b
[svn] - fix accidental removal of xmms_show_message
nenolod
parents:
2416
diff
changeset
|
1024 g_usleep(usec); |
74ec16ef847b
[svn] - fix accidental removal of xmms_show_message
nenolod
parents:
2416
diff
changeset
|
1025 } |