Mercurial > audlegacy
annotate src/audacious/titlestring.c @ 2862:7dad846ec699 trunk
BSD relicensing (pass 3).
author | William Pitcock <nenolod@atheme.org> |
---|---|
date | Sat, 23 Jun 2007 22:38:15 -0500 |
parents | c0e5cf2273ad |
children |
rev | line source |
---|---|
2431
3ec22a11c83e
[svn] - moved titlestring.* and xconvert.* from libaudacious to audacious
mf0102
parents:
diff
changeset
|
1 /* |
3ec22a11c83e
[svn] - moved titlestring.* and xconvert.* from libaudacious to audacious
mf0102
parents:
diff
changeset
|
2 * Copyright (C) 2001, Espen Skoglund <esk@ira.uka.de> |
3ec22a11c83e
[svn] - moved titlestring.* and xconvert.* from libaudacious to audacious
mf0102
parents:
diff
changeset
|
3 * Copyright (C) 2001, Haavard Kvaalen <havardk@xmms.org> |
3ec22a11c83e
[svn] - moved titlestring.* and xconvert.* from libaudacious to audacious
mf0102
parents:
diff
changeset
|
4 * |
3ec22a11c83e
[svn] - moved titlestring.* and xconvert.* from libaudacious to audacious
mf0102
parents:
diff
changeset
|
5 * This program is free software; you can redistribute it and/or |
3ec22a11c83e
[svn] - moved titlestring.* and xconvert.* from libaudacious to audacious
mf0102
parents:
diff
changeset
|
6 * modify it under the terms of the GNU General Public License |
3ec22a11c83e
[svn] - moved titlestring.* and xconvert.* from libaudacious to audacious
mf0102
parents:
diff
changeset
|
7 * as published by the Free Software Foundation; either version 2 |
3ec22a11c83e
[svn] - moved titlestring.* and xconvert.* from libaudacious to audacious
mf0102
parents:
diff
changeset
|
8 * of the License, or (at your option) any later version. |
3ec22a11c83e
[svn] - moved titlestring.* and xconvert.* from libaudacious to audacious
mf0102
parents:
diff
changeset
|
9 * |
3ec22a11c83e
[svn] - moved titlestring.* and xconvert.* from libaudacious to audacious
mf0102
parents:
diff
changeset
|
10 * This program is distributed in the hope that it will be useful, |
3ec22a11c83e
[svn] - moved titlestring.* and xconvert.* from libaudacious to audacious
mf0102
parents:
diff
changeset
|
11 * but WITHOUT ANY WARRANTY; without even the implied warranty of |
3ec22a11c83e
[svn] - moved titlestring.* and xconvert.* from libaudacious to audacious
mf0102
parents:
diff
changeset
|
12 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the |
3ec22a11c83e
[svn] - moved titlestring.* and xconvert.* from libaudacious to audacious
mf0102
parents:
diff
changeset
|
13 * GNU General Public License for more details. |
3ec22a11c83e
[svn] - moved titlestring.* and xconvert.* from libaudacious to audacious
mf0102
parents:
diff
changeset
|
14 * |
3ec22a11c83e
[svn] - moved titlestring.* and xconvert.* from libaudacious to audacious
mf0102
parents:
diff
changeset
|
15 * You should have received a copy of the GNU General Public License |
3ec22a11c83e
[svn] - moved titlestring.* and xconvert.* from libaudacious to audacious
mf0102
parents:
diff
changeset
|
16 * along with this program; if not, write to the Free Software |
3ec22a11c83e
[svn] - moved titlestring.* and xconvert.* from libaudacious to audacious
mf0102
parents:
diff
changeset
|
17 * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA |
3ec22a11c83e
[svn] - moved titlestring.* and xconvert.* from libaudacious to audacious
mf0102
parents:
diff
changeset
|
18 * 02110-1301, USA. |
3ec22a11c83e
[svn] - moved titlestring.* and xconvert.* from libaudacious to audacious
mf0102
parents:
diff
changeset
|
19 * |
3ec22a11c83e
[svn] - moved titlestring.* and xconvert.* from libaudacious to audacious
mf0102
parents:
diff
changeset
|
20 */ |
3ec22a11c83e
[svn] - moved titlestring.* and xconvert.* from libaudacious to audacious
mf0102
parents:
diff
changeset
|
21 |
3ec22a11c83e
[svn] - moved titlestring.* and xconvert.* from libaudacious to audacious
mf0102
parents:
diff
changeset
|
22 #ifdef HAVE_CONFIG_H |
3ec22a11c83e
[svn] - moved titlestring.* and xconvert.* from libaudacious to audacious
mf0102
parents:
diff
changeset
|
23 # include "config.h" |
3ec22a11c83e
[svn] - moved titlestring.* and xconvert.* from libaudacious to audacious
mf0102
parents:
diff
changeset
|
24 #endif |
3ec22a11c83e
[svn] - moved titlestring.* and xconvert.* from libaudacious to audacious
mf0102
parents:
diff
changeset
|
25 |
3ec22a11c83e
[svn] - moved titlestring.* and xconvert.* from libaudacious to audacious
mf0102
parents:
diff
changeset
|
26 #define GETTEXT_PACKAGE PACKAGE_NAME |
3ec22a11c83e
[svn] - moved titlestring.* and xconvert.* from libaudacious to audacious
mf0102
parents:
diff
changeset
|
27 |
3ec22a11c83e
[svn] - moved titlestring.* and xconvert.* from libaudacious to audacious
mf0102
parents:
diff
changeset
|
28 #include <glib.h> |
3ec22a11c83e
[svn] - moved titlestring.* and xconvert.* from libaudacious to audacious
mf0102
parents:
diff
changeset
|
29 #include <glib/gi18n-lib.h> |
3ec22a11c83e
[svn] - moved titlestring.* and xconvert.* from libaudacious to audacious
mf0102
parents:
diff
changeset
|
30 #include <gtk/gtk.h> |
3ec22a11c83e
[svn] - moved titlestring.* and xconvert.* from libaudacious to audacious
mf0102
parents:
diff
changeset
|
31 #include <stdio.h> |
3ec22a11c83e
[svn] - moved titlestring.* and xconvert.* from libaudacious to audacious
mf0102
parents:
diff
changeset
|
32 #include <string.h> |
3ec22a11c83e
[svn] - moved titlestring.* and xconvert.* from libaudacious to audacious
mf0102
parents:
diff
changeset
|
33 |
3ec22a11c83e
[svn] - moved titlestring.* and xconvert.* from libaudacious to audacious
mf0102
parents:
diff
changeset
|
34 #include "titlestring.h" |
3ec22a11c83e
[svn] - moved titlestring.* and xconvert.* from libaudacious to audacious
mf0102
parents:
diff
changeset
|
35 |
3ec22a11c83e
[svn] - moved titlestring.* and xconvert.* from libaudacious to audacious
mf0102
parents:
diff
changeset
|
36 #define CHECK(input, field) \ |
3ec22a11c83e
[svn] - moved titlestring.* and xconvert.* from libaudacious to audacious
mf0102
parents:
diff
changeset
|
37 (((gchar *) &input->field - (gchar *) input) < input->__size) |
3ec22a11c83e
[svn] - moved titlestring.* and xconvert.* from libaudacious to audacious
mf0102
parents:
diff
changeset
|
38 |
3ec22a11c83e
[svn] - moved titlestring.* and xconvert.* from libaudacious to audacious
mf0102
parents:
diff
changeset
|
39 #define VS(input, field) (CHECK(input, field) ? input->field : NULL) |
3ec22a11c83e
[svn] - moved titlestring.* and xconvert.* from libaudacious to audacious
mf0102
parents:
diff
changeset
|
40 #define VI(input, field) (CHECK(input, field) ? input->field : 0) |
3ec22a11c83e
[svn] - moved titlestring.* and xconvert.* from libaudacious to audacious
mf0102
parents:
diff
changeset
|
41 |
3ec22a11c83e
[svn] - moved titlestring.* and xconvert.* from libaudacious to audacious
mf0102
parents:
diff
changeset
|
42 /** |
3ec22a11c83e
[svn] - moved titlestring.* and xconvert.* from libaudacious to audacious
mf0102
parents:
diff
changeset
|
43 * bmp_title_input_new: |
3ec22a11c83e
[svn] - moved titlestring.* and xconvert.* from libaudacious to audacious
mf0102
parents:
diff
changeset
|
44 * |
3ec22a11c83e
[svn] - moved titlestring.* and xconvert.* from libaudacious to audacious
mf0102
parents:
diff
changeset
|
45 * #BmpTitleInput tuple factory. |
3ec22a11c83e
[svn] - moved titlestring.* and xconvert.* from libaudacious to audacious
mf0102
parents:
diff
changeset
|
46 * |
3ec22a11c83e
[svn] - moved titlestring.* and xconvert.* from libaudacious to audacious
mf0102
parents:
diff
changeset
|
47 * Return value: A #BmpTitleInput object. |
3ec22a11c83e
[svn] - moved titlestring.* and xconvert.* from libaudacious to audacious
mf0102
parents:
diff
changeset
|
48 **/ |
3ec22a11c83e
[svn] - moved titlestring.* and xconvert.* from libaudacious to audacious
mf0102
parents:
diff
changeset
|
49 BmpTitleInput * |
3ec22a11c83e
[svn] - moved titlestring.* and xconvert.* from libaudacious to audacious
mf0102
parents:
diff
changeset
|
50 bmp_title_input_new() |
3ec22a11c83e
[svn] - moved titlestring.* and xconvert.* from libaudacious to audacious
mf0102
parents:
diff
changeset
|
51 { |
3ec22a11c83e
[svn] - moved titlestring.* and xconvert.* from libaudacious to audacious
mf0102
parents:
diff
changeset
|
52 BmpTitleInput *input; |
3ec22a11c83e
[svn] - moved titlestring.* and xconvert.* from libaudacious to audacious
mf0102
parents:
diff
changeset
|
53 input = g_new0(BmpTitleInput, 1); |
3ec22a11c83e
[svn] - moved titlestring.* and xconvert.* from libaudacious to audacious
mf0102
parents:
diff
changeset
|
54 input->__size = XMMS_TITLEINPUT_SIZE; |
3ec22a11c83e
[svn] - moved titlestring.* and xconvert.* from libaudacious to audacious
mf0102
parents:
diff
changeset
|
55 input->__version = XMMS_TITLEINPUT_VERSION; |
2550
864c12eafb49
[svn] - mtime should be initialized to -1, otherwise 0 will be recorded for not yet scanned entries. it means static and will suppress on-demand scanning.
yaz
parents:
2431
diff
changeset
|
56 input->mtime = -1; |
2431
3ec22a11c83e
[svn] - moved titlestring.* and xconvert.* from libaudacious to audacious
mf0102
parents:
diff
changeset
|
57 return input; |
3ec22a11c83e
[svn] - moved titlestring.* and xconvert.* from libaudacious to audacious
mf0102
parents:
diff
changeset
|
58 } |
3ec22a11c83e
[svn] - moved titlestring.* and xconvert.* from libaudacious to audacious
mf0102
parents:
diff
changeset
|
59 |
3ec22a11c83e
[svn] - moved titlestring.* and xconvert.* from libaudacious to audacious
mf0102
parents:
diff
changeset
|
60 /** |
3ec22a11c83e
[svn] - moved titlestring.* and xconvert.* from libaudacious to audacious
mf0102
parents:
diff
changeset
|
61 * bmp_title_input_free: |
3ec22a11c83e
[svn] - moved titlestring.* and xconvert.* from libaudacious to audacious
mf0102
parents:
diff
changeset
|
62 * @input: A #BmpTitleInput tuple to destroy. |
3ec22a11c83e
[svn] - moved titlestring.* and xconvert.* from libaudacious to audacious
mf0102
parents:
diff
changeset
|
63 * |
3ec22a11c83e
[svn] - moved titlestring.* and xconvert.* from libaudacious to audacious
mf0102
parents:
diff
changeset
|
64 * Destroys a #BmpTitleInput tuple. |
3ec22a11c83e
[svn] - moved titlestring.* and xconvert.* from libaudacious to audacious
mf0102
parents:
diff
changeset
|
65 **/ |
3ec22a11c83e
[svn] - moved titlestring.* and xconvert.* from libaudacious to audacious
mf0102
parents:
diff
changeset
|
66 void |
3ec22a11c83e
[svn] - moved titlestring.* and xconvert.* from libaudacious to audacious
mf0102
parents:
diff
changeset
|
67 bmp_title_input_free(BmpTitleInput * input) |
3ec22a11c83e
[svn] - moved titlestring.* and xconvert.* from libaudacious to audacious
mf0102
parents:
diff
changeset
|
68 { |
3ec22a11c83e
[svn] - moved titlestring.* and xconvert.* from libaudacious to audacious
mf0102
parents:
diff
changeset
|
69 if (input == NULL) |
3ec22a11c83e
[svn] - moved titlestring.* and xconvert.* from libaudacious to audacious
mf0102
parents:
diff
changeset
|
70 return; |
3ec22a11c83e
[svn] - moved titlestring.* and xconvert.* from libaudacious to audacious
mf0102
parents:
diff
changeset
|
71 |
3ec22a11c83e
[svn] - moved titlestring.* and xconvert.* from libaudacious to audacious
mf0102
parents:
diff
changeset
|
72 if (input->performer != NULL) |
3ec22a11c83e
[svn] - moved titlestring.* and xconvert.* from libaudacious to audacious
mf0102
parents:
diff
changeset
|
73 g_free(input->performer); |
3ec22a11c83e
[svn] - moved titlestring.* and xconvert.* from libaudacious to audacious
mf0102
parents:
diff
changeset
|
74 |
3ec22a11c83e
[svn] - moved titlestring.* and xconvert.* from libaudacious to audacious
mf0102
parents:
diff
changeset
|
75 if (input->album_name != NULL) |
3ec22a11c83e
[svn] - moved titlestring.* and xconvert.* from libaudacious to audacious
mf0102
parents:
diff
changeset
|
76 g_free(input->album_name); |
3ec22a11c83e
[svn] - moved titlestring.* and xconvert.* from libaudacious to audacious
mf0102
parents:
diff
changeset
|
77 |
3ec22a11c83e
[svn] - moved titlestring.* and xconvert.* from libaudacious to audacious
mf0102
parents:
diff
changeset
|
78 if (input->track_name != NULL) |
3ec22a11c83e
[svn] - moved titlestring.* and xconvert.* from libaudacious to audacious
mf0102
parents:
diff
changeset
|
79 g_free(input->track_name); |
3ec22a11c83e
[svn] - moved titlestring.* and xconvert.* from libaudacious to audacious
mf0102
parents:
diff
changeset
|
80 |
3ec22a11c83e
[svn] - moved titlestring.* and xconvert.* from libaudacious to audacious
mf0102
parents:
diff
changeset
|
81 if (input->date != NULL) |
3ec22a11c83e
[svn] - moved titlestring.* and xconvert.* from libaudacious to audacious
mf0102
parents:
diff
changeset
|
82 g_free(input->date); |
3ec22a11c83e
[svn] - moved titlestring.* and xconvert.* from libaudacious to audacious
mf0102
parents:
diff
changeset
|
83 |
3ec22a11c83e
[svn] - moved titlestring.* and xconvert.* from libaudacious to audacious
mf0102
parents:
diff
changeset
|
84 if (input->genre != NULL) |
3ec22a11c83e
[svn] - moved titlestring.* and xconvert.* from libaudacious to audacious
mf0102
parents:
diff
changeset
|
85 g_free(input->genre); |
3ec22a11c83e
[svn] - moved titlestring.* and xconvert.* from libaudacious to audacious
mf0102
parents:
diff
changeset
|
86 |
3ec22a11c83e
[svn] - moved titlestring.* and xconvert.* from libaudacious to audacious
mf0102
parents:
diff
changeset
|
87 if (input->comment != NULL) |
3ec22a11c83e
[svn] - moved titlestring.* and xconvert.* from libaudacious to audacious
mf0102
parents:
diff
changeset
|
88 g_free(input->comment); |
3ec22a11c83e
[svn] - moved titlestring.* and xconvert.* from libaudacious to audacious
mf0102
parents:
diff
changeset
|
89 |
3ec22a11c83e
[svn] - moved titlestring.* and xconvert.* from libaudacious to audacious
mf0102
parents:
diff
changeset
|
90 if (input->file_name != NULL) |
3ec22a11c83e
[svn] - moved titlestring.* and xconvert.* from libaudacious to audacious
mf0102
parents:
diff
changeset
|
91 g_free(input->file_name); |
3ec22a11c83e
[svn] - moved titlestring.* and xconvert.* from libaudacious to audacious
mf0102
parents:
diff
changeset
|
92 |
3ec22a11c83e
[svn] - moved titlestring.* and xconvert.* from libaudacious to audacious
mf0102
parents:
diff
changeset
|
93 if (input->file_path != NULL) |
3ec22a11c83e
[svn] - moved titlestring.* and xconvert.* from libaudacious to audacious
mf0102
parents:
diff
changeset
|
94 g_free(input->file_path); |
3ec22a11c83e
[svn] - moved titlestring.* and xconvert.* from libaudacious to audacious
mf0102
parents:
diff
changeset
|
95 |
2560
5511818eb9d3
[svn] - added custom field in tuple, for internal use by plugins or by whatever wanting to use it
giacomo
parents:
2550
diff
changeset
|
96 if (input->custom != NULL) |
5511818eb9d3
[svn] - added custom field in tuple, for internal use by plugins or by whatever wanting to use it
giacomo
parents:
2550
diff
changeset
|
97 g_free(input->custom); |
5511818eb9d3
[svn] - added custom field in tuple, for internal use by plugins or by whatever wanting to use it
giacomo
parents:
2550
diff
changeset
|
98 |
2431
3ec22a11c83e
[svn] - moved titlestring.* and xconvert.* from libaudacious to audacious
mf0102
parents:
diff
changeset
|
99 g_free(input); |
3ec22a11c83e
[svn] - moved titlestring.* and xconvert.* from libaudacious to audacious
mf0102
parents:
diff
changeset
|
100 } |
3ec22a11c83e
[svn] - moved titlestring.* and xconvert.* from libaudacious to audacious
mf0102
parents:
diff
changeset
|
101 |
3ec22a11c83e
[svn] - moved titlestring.* and xconvert.* from libaudacious to audacious
mf0102
parents:
diff
changeset
|
102 /** |
3ec22a11c83e
[svn] - moved titlestring.* and xconvert.* from libaudacious to audacious
mf0102
parents:
diff
changeset
|
103 * xmms_get_titlestring: |
3ec22a11c83e
[svn] - moved titlestring.* and xconvert.* from libaudacious to audacious
mf0102
parents:
diff
changeset
|
104 * @fmt: A format string. |
3ec22a11c83e
[svn] - moved titlestring.* and xconvert.* from libaudacious to audacious
mf0102
parents:
diff
changeset
|
105 * @input: A tuple to use for data. |
3ec22a11c83e
[svn] - moved titlestring.* and xconvert.* from libaudacious to audacious
mf0102
parents:
diff
changeset
|
106 * |
3ec22a11c83e
[svn] - moved titlestring.* and xconvert.* from libaudacious to audacious
mf0102
parents:
diff
changeset
|
107 * Generates a formatted string from a tuple. |
3ec22a11c83e
[svn] - moved titlestring.* and xconvert.* from libaudacious to audacious
mf0102
parents:
diff
changeset
|
108 * |
3ec22a11c83e
[svn] - moved titlestring.* and xconvert.* from libaudacious to audacious
mf0102
parents:
diff
changeset
|
109 * Return value: A formatted tuple string. |
3ec22a11c83e
[svn] - moved titlestring.* and xconvert.* from libaudacious to audacious
mf0102
parents:
diff
changeset
|
110 **/ |
3ec22a11c83e
[svn] - moved titlestring.* and xconvert.* from libaudacious to audacious
mf0102
parents:
diff
changeset
|
111 gchar * |
3ec22a11c83e
[svn] - moved titlestring.* and xconvert.* from libaudacious to audacious
mf0102
parents:
diff
changeset
|
112 xmms_get_titlestring(const gchar * fmt, TitleInput * input) |
3ec22a11c83e
[svn] - moved titlestring.* and xconvert.* from libaudacious to audacious
mf0102
parents:
diff
changeset
|
113 { |
3ec22a11c83e
[svn] - moved titlestring.* and xconvert.* from libaudacious to audacious
mf0102
parents:
diff
changeset
|
114 GString *outstr; |
3ec22a11c83e
[svn] - moved titlestring.* and xconvert.* from libaudacious to audacious
mf0102
parents:
diff
changeset
|
115 const gchar *string; |
3ec22a11c83e
[svn] - moved titlestring.* and xconvert.* from libaudacious to audacious
mf0102
parents:
diff
changeset
|
116 gchar c, convert[16]; |
3ec22a11c83e
[svn] - moved titlestring.* and xconvert.* from libaudacious to audacious
mf0102
parents:
diff
changeset
|
117 gint numdigits, numpr, val, i; |
3ec22a11c83e
[svn] - moved titlestring.* and xconvert.* from libaudacious to audacious
mf0102
parents:
diff
changeset
|
118 gint f_left, f_space, f_zero, someflag, width, precision; |
3ec22a11c83e
[svn] - moved titlestring.* and xconvert.* from libaudacious to audacious
mf0102
parents:
diff
changeset
|
119 gboolean did_output = FALSE; |
3ec22a11c83e
[svn] - moved titlestring.* and xconvert.* from libaudacious to audacious
mf0102
parents:
diff
changeset
|
120 gchar digits[] = "0123456789"; |
3ec22a11c83e
[svn] - moved titlestring.* and xconvert.* from libaudacious to audacious
mf0102
parents:
diff
changeset
|
121 |
3ec22a11c83e
[svn] - moved titlestring.* and xconvert.* from libaudacious to audacious
mf0102
parents:
diff
changeset
|
122 #define PUTCH(ch) g_string_append_c(outstr, ch) |
3ec22a11c83e
[svn] - moved titlestring.* and xconvert.* from libaudacious to audacious
mf0102
parents:
diff
changeset
|
123 |
3ec22a11c83e
[svn] - moved titlestring.* and xconvert.* from libaudacious to audacious
mf0102
parents:
diff
changeset
|
124 #define LEFTPAD(num) \ |
3ec22a11c83e
[svn] - moved titlestring.* and xconvert.* from libaudacious to audacious
mf0102
parents:
diff
changeset
|
125 G_STMT_START { \ |
3ec22a11c83e
[svn] - moved titlestring.* and xconvert.* from libaudacious to audacious
mf0102
parents:
diff
changeset
|
126 gint cnt = (num); \ |
3ec22a11c83e
[svn] - moved titlestring.* and xconvert.* from libaudacious to audacious
mf0102
parents:
diff
changeset
|
127 if ( ! f_left && cnt > 0 ) \ |
3ec22a11c83e
[svn] - moved titlestring.* and xconvert.* from libaudacious to audacious
mf0102
parents:
diff
changeset
|
128 while ( cnt-- > 0 ) \ |
3ec22a11c83e
[svn] - moved titlestring.* and xconvert.* from libaudacious to audacious
mf0102
parents:
diff
changeset
|
129 PUTCH(f_zero ? '0' : ' '); \ |
3ec22a11c83e
[svn] - moved titlestring.* and xconvert.* from libaudacious to audacious
mf0102
parents:
diff
changeset
|
130 } G_STMT_END; |
3ec22a11c83e
[svn] - moved titlestring.* and xconvert.* from libaudacious to audacious
mf0102
parents:
diff
changeset
|
131 |
3ec22a11c83e
[svn] - moved titlestring.* and xconvert.* from libaudacious to audacious
mf0102
parents:
diff
changeset
|
132 #define RIGHTPAD(num) \ |
3ec22a11c83e
[svn] - moved titlestring.* and xconvert.* from libaudacious to audacious
mf0102
parents:
diff
changeset
|
133 G_STMT_START { \ |
3ec22a11c83e
[svn] - moved titlestring.* and xconvert.* from libaudacious to audacious
mf0102
parents:
diff
changeset
|
134 gint cnt = (num); \ |
3ec22a11c83e
[svn] - moved titlestring.* and xconvert.* from libaudacious to audacious
mf0102
parents:
diff
changeset
|
135 if ( f_left && cnt > 0 ) \ |
3ec22a11c83e
[svn] - moved titlestring.* and xconvert.* from libaudacious to audacious
mf0102
parents:
diff
changeset
|
136 while ( cnt-- > 0 ) \ |
3ec22a11c83e
[svn] - moved titlestring.* and xconvert.* from libaudacious to audacious
mf0102
parents:
diff
changeset
|
137 PUTCH( ' ' ); \ |
3ec22a11c83e
[svn] - moved titlestring.* and xconvert.* from libaudacious to audacious
mf0102
parents:
diff
changeset
|
138 } G_STMT_END; |
3ec22a11c83e
[svn] - moved titlestring.* and xconvert.* from libaudacious to audacious
mf0102
parents:
diff
changeset
|
139 |
3ec22a11c83e
[svn] - moved titlestring.* and xconvert.* from libaudacious to audacious
mf0102
parents:
diff
changeset
|
140 if (fmt == NULL || input == NULL) |
3ec22a11c83e
[svn] - moved titlestring.* and xconvert.* from libaudacious to audacious
mf0102
parents:
diff
changeset
|
141 return NULL; |
3ec22a11c83e
[svn] - moved titlestring.* and xconvert.* from libaudacious to audacious
mf0102
parents:
diff
changeset
|
142 outstr = g_string_new(""); |
3ec22a11c83e
[svn] - moved titlestring.* and xconvert.* from libaudacious to audacious
mf0102
parents:
diff
changeset
|
143 |
3ec22a11c83e
[svn] - moved titlestring.* and xconvert.* from libaudacious to audacious
mf0102
parents:
diff
changeset
|
144 for (;;) { |
3ec22a11c83e
[svn] - moved titlestring.* and xconvert.* from libaudacious to audacious
mf0102
parents:
diff
changeset
|
145 /* Copy characters until we encounter '%'. */ |
3ec22a11c83e
[svn] - moved titlestring.* and xconvert.* from libaudacious to audacious
mf0102
parents:
diff
changeset
|
146 while ((c = *fmt++) != '%') { |
3ec22a11c83e
[svn] - moved titlestring.* and xconvert.* from libaudacious to audacious
mf0102
parents:
diff
changeset
|
147 if (c == '\0') |
3ec22a11c83e
[svn] - moved titlestring.* and xconvert.* from libaudacious to audacious
mf0102
parents:
diff
changeset
|
148 goto Done; |
3ec22a11c83e
[svn] - moved titlestring.* and xconvert.* from libaudacious to audacious
mf0102
parents:
diff
changeset
|
149 g_string_append_c(outstr, c); |
3ec22a11c83e
[svn] - moved titlestring.* and xconvert.* from libaudacious to audacious
mf0102
parents:
diff
changeset
|
150 } |
3ec22a11c83e
[svn] - moved titlestring.* and xconvert.* from libaudacious to audacious
mf0102
parents:
diff
changeset
|
151 |
3ec22a11c83e
[svn] - moved titlestring.* and xconvert.* from libaudacious to audacious
mf0102
parents:
diff
changeset
|
152 f_left = f_space = f_zero = 0; |
3ec22a11c83e
[svn] - moved titlestring.* and xconvert.* from libaudacious to audacious
mf0102
parents:
diff
changeset
|
153 someflag = 1; |
3ec22a11c83e
[svn] - moved titlestring.* and xconvert.* from libaudacious to audacious
mf0102
parents:
diff
changeset
|
154 |
3ec22a11c83e
[svn] - moved titlestring.* and xconvert.* from libaudacious to audacious
mf0102
parents:
diff
changeset
|
155 |
3ec22a11c83e
[svn] - moved titlestring.* and xconvert.* from libaudacious to audacious
mf0102
parents:
diff
changeset
|
156 /* Parse flags. */ |
3ec22a11c83e
[svn] - moved titlestring.* and xconvert.* from libaudacious to audacious
mf0102
parents:
diff
changeset
|
157 while (someflag) { |
3ec22a11c83e
[svn] - moved titlestring.* and xconvert.* from libaudacious to audacious
mf0102
parents:
diff
changeset
|
158 switch (*fmt) { |
3ec22a11c83e
[svn] - moved titlestring.* and xconvert.* from libaudacious to audacious
mf0102
parents:
diff
changeset
|
159 case '-': |
3ec22a11c83e
[svn] - moved titlestring.* and xconvert.* from libaudacious to audacious
mf0102
parents:
diff
changeset
|
160 f_left = 1; |
3ec22a11c83e
[svn] - moved titlestring.* and xconvert.* from libaudacious to audacious
mf0102
parents:
diff
changeset
|
161 fmt++; |
3ec22a11c83e
[svn] - moved titlestring.* and xconvert.* from libaudacious to audacious
mf0102
parents:
diff
changeset
|
162 break; |
3ec22a11c83e
[svn] - moved titlestring.* and xconvert.* from libaudacious to audacious
mf0102
parents:
diff
changeset
|
163 case ' ': |
3ec22a11c83e
[svn] - moved titlestring.* and xconvert.* from libaudacious to audacious
mf0102
parents:
diff
changeset
|
164 f_space = 1; |
3ec22a11c83e
[svn] - moved titlestring.* and xconvert.* from libaudacious to audacious
mf0102
parents:
diff
changeset
|
165 fmt++; |
3ec22a11c83e
[svn] - moved titlestring.* and xconvert.* from libaudacious to audacious
mf0102
parents:
diff
changeset
|
166 break; |
3ec22a11c83e
[svn] - moved titlestring.* and xconvert.* from libaudacious to audacious
mf0102
parents:
diff
changeset
|
167 case '0': |
3ec22a11c83e
[svn] - moved titlestring.* and xconvert.* from libaudacious to audacious
mf0102
parents:
diff
changeset
|
168 f_zero = 1; |
3ec22a11c83e
[svn] - moved titlestring.* and xconvert.* from libaudacious to audacious
mf0102
parents:
diff
changeset
|
169 fmt++; |
3ec22a11c83e
[svn] - moved titlestring.* and xconvert.* from libaudacious to audacious
mf0102
parents:
diff
changeset
|
170 break; |
3ec22a11c83e
[svn] - moved titlestring.* and xconvert.* from libaudacious to audacious
mf0102
parents:
diff
changeset
|
171 default: |
3ec22a11c83e
[svn] - moved titlestring.* and xconvert.* from libaudacious to audacious
mf0102
parents:
diff
changeset
|
172 someflag = 0; |
3ec22a11c83e
[svn] - moved titlestring.* and xconvert.* from libaudacious to audacious
mf0102
parents:
diff
changeset
|
173 break; |
3ec22a11c83e
[svn] - moved titlestring.* and xconvert.* from libaudacious to audacious
mf0102
parents:
diff
changeset
|
174 } |
3ec22a11c83e
[svn] - moved titlestring.* and xconvert.* from libaudacious to audacious
mf0102
parents:
diff
changeset
|
175 } |
3ec22a11c83e
[svn] - moved titlestring.* and xconvert.* from libaudacious to audacious
mf0102
parents:
diff
changeset
|
176 |
3ec22a11c83e
[svn] - moved titlestring.* and xconvert.* from libaudacious to audacious
mf0102
parents:
diff
changeset
|
177 |
3ec22a11c83e
[svn] - moved titlestring.* and xconvert.* from libaudacious to audacious
mf0102
parents:
diff
changeset
|
178 /* Parse field width. */ |
3ec22a11c83e
[svn] - moved titlestring.* and xconvert.* from libaudacious to audacious
mf0102
parents:
diff
changeset
|
179 if ((c = *fmt) >= '0' && c <= '9') { |
3ec22a11c83e
[svn] - moved titlestring.* and xconvert.* from libaudacious to audacious
mf0102
parents:
diff
changeset
|
180 width = 0; |
3ec22a11c83e
[svn] - moved titlestring.* and xconvert.* from libaudacious to audacious
mf0102
parents:
diff
changeset
|
181 while ((c = *fmt++) >= '0' && c <= '9') { |
3ec22a11c83e
[svn] - moved titlestring.* and xconvert.* from libaudacious to audacious
mf0102
parents:
diff
changeset
|
182 width *= 10; |
3ec22a11c83e
[svn] - moved titlestring.* and xconvert.* from libaudacious to audacious
mf0102
parents:
diff
changeset
|
183 width += c - '0'; |
3ec22a11c83e
[svn] - moved titlestring.* and xconvert.* from libaudacious to audacious
mf0102
parents:
diff
changeset
|
184 } |
3ec22a11c83e
[svn] - moved titlestring.* and xconvert.* from libaudacious to audacious
mf0102
parents:
diff
changeset
|
185 fmt--; |
3ec22a11c83e
[svn] - moved titlestring.* and xconvert.* from libaudacious to audacious
mf0102
parents:
diff
changeset
|
186 } |
3ec22a11c83e
[svn] - moved titlestring.* and xconvert.* from libaudacious to audacious
mf0102
parents:
diff
changeset
|
187 else |
3ec22a11c83e
[svn] - moved titlestring.* and xconvert.* from libaudacious to audacious
mf0102
parents:
diff
changeset
|
188 width = -1; |
3ec22a11c83e
[svn] - moved titlestring.* and xconvert.* from libaudacious to audacious
mf0102
parents:
diff
changeset
|
189 |
3ec22a11c83e
[svn] - moved titlestring.* and xconvert.* from libaudacious to audacious
mf0102
parents:
diff
changeset
|
190 |
3ec22a11c83e
[svn] - moved titlestring.* and xconvert.* from libaudacious to audacious
mf0102
parents:
diff
changeset
|
191 /* Parse precision. */ |
3ec22a11c83e
[svn] - moved titlestring.* and xconvert.* from libaudacious to audacious
mf0102
parents:
diff
changeset
|
192 if (*fmt == '.') { |
3ec22a11c83e
[svn] - moved titlestring.* and xconvert.* from libaudacious to audacious
mf0102
parents:
diff
changeset
|
193 if ((c = *++fmt) >= '0' && c <= '9') { |
3ec22a11c83e
[svn] - moved titlestring.* and xconvert.* from libaudacious to audacious
mf0102
parents:
diff
changeset
|
194 precision = 0; |
3ec22a11c83e
[svn] - moved titlestring.* and xconvert.* from libaudacious to audacious
mf0102
parents:
diff
changeset
|
195 while ((c = *fmt++) >= '0' && c <= '9') { |
3ec22a11c83e
[svn] - moved titlestring.* and xconvert.* from libaudacious to audacious
mf0102
parents:
diff
changeset
|
196 precision *= 10; |
3ec22a11c83e
[svn] - moved titlestring.* and xconvert.* from libaudacious to audacious
mf0102
parents:
diff
changeset
|
197 precision += c - '0'; |
3ec22a11c83e
[svn] - moved titlestring.* and xconvert.* from libaudacious to audacious
mf0102
parents:
diff
changeset
|
198 } |
3ec22a11c83e
[svn] - moved titlestring.* and xconvert.* from libaudacious to audacious
mf0102
parents:
diff
changeset
|
199 fmt--; |
3ec22a11c83e
[svn] - moved titlestring.* and xconvert.* from libaudacious to audacious
mf0102
parents:
diff
changeset
|
200 } |
3ec22a11c83e
[svn] - moved titlestring.* and xconvert.* from libaudacious to audacious
mf0102
parents:
diff
changeset
|
201 else |
3ec22a11c83e
[svn] - moved titlestring.* and xconvert.* from libaudacious to audacious
mf0102
parents:
diff
changeset
|
202 precision = -1; |
3ec22a11c83e
[svn] - moved titlestring.* and xconvert.* from libaudacious to audacious
mf0102
parents:
diff
changeset
|
203 } |
3ec22a11c83e
[svn] - moved titlestring.* and xconvert.* from libaudacious to audacious
mf0102
parents:
diff
changeset
|
204 else |
3ec22a11c83e
[svn] - moved titlestring.* and xconvert.* from libaudacious to audacious
mf0102
parents:
diff
changeset
|
205 precision = -1; |
3ec22a11c83e
[svn] - moved titlestring.* and xconvert.* from libaudacious to audacious
mf0102
parents:
diff
changeset
|
206 |
3ec22a11c83e
[svn] - moved titlestring.* and xconvert.* from libaudacious to audacious
mf0102
parents:
diff
changeset
|
207 |
3ec22a11c83e
[svn] - moved titlestring.* and xconvert.* from libaudacious to audacious
mf0102
parents:
diff
changeset
|
208 /* Parse format conversion. */ |
3ec22a11c83e
[svn] - moved titlestring.* and xconvert.* from libaudacious to audacious
mf0102
parents:
diff
changeset
|
209 switch (c = *fmt++) { |
3ec22a11c83e
[svn] - moved titlestring.* and xconvert.* from libaudacious to audacious
mf0102
parents:
diff
changeset
|
210 case '}': /* close optional, just ignore */ |
3ec22a11c83e
[svn] - moved titlestring.* and xconvert.* from libaudacious to audacious
mf0102
parents:
diff
changeset
|
211 continue; |
3ec22a11c83e
[svn] - moved titlestring.* and xconvert.* from libaudacious to audacious
mf0102
parents:
diff
changeset
|
212 |
3ec22a11c83e
[svn] - moved titlestring.* and xconvert.* from libaudacious to audacious
mf0102
parents:
diff
changeset
|
213 case '{':{ /* optional entry: %{n:...%} */ |
3ec22a11c83e
[svn] - moved titlestring.* and xconvert.* from libaudacious to audacious
mf0102
parents:
diff
changeset
|
214 char n = *fmt++; |
3ec22a11c83e
[svn] - moved titlestring.* and xconvert.* from libaudacious to audacious
mf0102
parents:
diff
changeset
|
215 if (!((n == 'a' && VS(input, album_name)) || |
3ec22a11c83e
[svn] - moved titlestring.* and xconvert.* from libaudacious to audacious
mf0102
parents:
diff
changeset
|
216 (n == 'c' && VS(input, comment)) || |
2590
c0e5cf2273ad
[svn] - Add support for the custom tuple field. Patch by Christian Birchinger (joker).
nenolod
parents:
2560
diff
changeset
|
217 (n == 'C' && VS(input, custom)) || |
2431
3ec22a11c83e
[svn] - moved titlestring.* and xconvert.* from libaudacious to audacious
mf0102
parents:
diff
changeset
|
218 (n == 'd' && VS(input, date)) || |
3ec22a11c83e
[svn] - moved titlestring.* and xconvert.* from libaudacious to audacious
mf0102
parents:
diff
changeset
|
219 (n == 'e' && VS(input, file_ext)) || |
3ec22a11c83e
[svn] - moved titlestring.* and xconvert.* from libaudacious to audacious
mf0102
parents:
diff
changeset
|
220 (n == 'f' && VS(input, file_name)) || |
3ec22a11c83e
[svn] - moved titlestring.* and xconvert.* from libaudacious to audacious
mf0102
parents:
diff
changeset
|
221 (n == 'F' && VS(input, file_path)) || |
3ec22a11c83e
[svn] - moved titlestring.* and xconvert.* from libaudacious to audacious
mf0102
parents:
diff
changeset
|
222 (n == 'g' && VS(input, genre)) || |
3ec22a11c83e
[svn] - moved titlestring.* and xconvert.* from libaudacious to audacious
mf0102
parents:
diff
changeset
|
223 (n == 'n' && VI(input, track_number)) || |
3ec22a11c83e
[svn] - moved titlestring.* and xconvert.* from libaudacious to audacious
mf0102
parents:
diff
changeset
|
224 (n == 'p' && VS(input, performer)) || |
3ec22a11c83e
[svn] - moved titlestring.* and xconvert.* from libaudacious to audacious
mf0102
parents:
diff
changeset
|
225 (n == 't' && VS(input, track_name)) || |
3ec22a11c83e
[svn] - moved titlestring.* and xconvert.* from libaudacious to audacious
mf0102
parents:
diff
changeset
|
226 (n == 'y' && VI(input, year)))) { |
3ec22a11c83e
[svn] - moved titlestring.* and xconvert.* from libaudacious to audacious
mf0102
parents:
diff
changeset
|
227 int nl = 0; |
3ec22a11c83e
[svn] - moved titlestring.* and xconvert.* from libaudacious to audacious
mf0102
parents:
diff
changeset
|
228 char c; |
3ec22a11c83e
[svn] - moved titlestring.* and xconvert.* from libaudacious to audacious
mf0102
parents:
diff
changeset
|
229 while ((c = *fmt++)) /* until end of string */ |
3ec22a11c83e
[svn] - moved titlestring.* and xconvert.* from libaudacious to audacious
mf0102
parents:
diff
changeset
|
230 if (c == '}') /* if end of opt */ |
3ec22a11c83e
[svn] - moved titlestring.* and xconvert.* from libaudacious to audacious
mf0102
parents:
diff
changeset
|
231 if (!nl) |
3ec22a11c83e
[svn] - moved titlestring.* and xconvert.* from libaudacious to audacious
mf0102
parents:
diff
changeset
|
232 break; /* if outmost indent level */ |
3ec22a11c83e
[svn] - moved titlestring.* and xconvert.* from libaudacious to audacious
mf0102
parents:
diff
changeset
|
233 else |
3ec22a11c83e
[svn] - moved titlestring.* and xconvert.* from libaudacious to audacious
mf0102
parents:
diff
changeset
|
234 --nl; /* else reduce indent */ |
3ec22a11c83e
[svn] - moved titlestring.* and xconvert.* from libaudacious to audacious
mf0102
parents:
diff
changeset
|
235 else if (c == '{') |
3ec22a11c83e
[svn] - moved titlestring.* and xconvert.* from libaudacious to audacious
mf0102
parents:
diff
changeset
|
236 ++nl; /* increase indent */ |
3ec22a11c83e
[svn] - moved titlestring.* and xconvert.* from libaudacious to audacious
mf0102
parents:
diff
changeset
|
237 } |
3ec22a11c83e
[svn] - moved titlestring.* and xconvert.* from libaudacious to audacious
mf0102
parents:
diff
changeset
|
238 else |
3ec22a11c83e
[svn] - moved titlestring.* and xconvert.* from libaudacious to audacious
mf0102
parents:
diff
changeset
|
239 ++fmt; |
3ec22a11c83e
[svn] - moved titlestring.* and xconvert.* from libaudacious to audacious
mf0102
parents:
diff
changeset
|
240 break; |
3ec22a11c83e
[svn] - moved titlestring.* and xconvert.* from libaudacious to audacious
mf0102
parents:
diff
changeset
|
241 } |
3ec22a11c83e
[svn] - moved titlestring.* and xconvert.* from libaudacious to audacious
mf0102
parents:
diff
changeset
|
242 |
3ec22a11c83e
[svn] - moved titlestring.* and xconvert.* from libaudacious to audacious
mf0102
parents:
diff
changeset
|
243 case 'a': |
3ec22a11c83e
[svn] - moved titlestring.* and xconvert.* from libaudacious to audacious
mf0102
parents:
diff
changeset
|
244 string = VS(input, album_name); |
3ec22a11c83e
[svn] - moved titlestring.* and xconvert.* from libaudacious to audacious
mf0102
parents:
diff
changeset
|
245 goto Print_string; |
3ec22a11c83e
[svn] - moved titlestring.* and xconvert.* from libaudacious to audacious
mf0102
parents:
diff
changeset
|
246 case 'c': |
3ec22a11c83e
[svn] - moved titlestring.* and xconvert.* from libaudacious to audacious
mf0102
parents:
diff
changeset
|
247 string = VS(input, comment); |
3ec22a11c83e
[svn] - moved titlestring.* and xconvert.* from libaudacious to audacious
mf0102
parents:
diff
changeset
|
248 goto Print_string; |
2590
c0e5cf2273ad
[svn] - Add support for the custom tuple field. Patch by Christian Birchinger (joker).
nenolod
parents:
2560
diff
changeset
|
249 case 'C': |
c0e5cf2273ad
[svn] - Add support for the custom tuple field. Patch by Christian Birchinger (joker).
nenolod
parents:
2560
diff
changeset
|
250 string = VS(input, custom); |
c0e5cf2273ad
[svn] - Add support for the custom tuple field. Patch by Christian Birchinger (joker).
nenolod
parents:
2560
diff
changeset
|
251 goto Print_string; |
2431
3ec22a11c83e
[svn] - moved titlestring.* and xconvert.* from libaudacious to audacious
mf0102
parents:
diff
changeset
|
252 case 'd': |
3ec22a11c83e
[svn] - moved titlestring.* and xconvert.* from libaudacious to audacious
mf0102
parents:
diff
changeset
|
253 string = VS(input, date); |
3ec22a11c83e
[svn] - moved titlestring.* and xconvert.* from libaudacious to audacious
mf0102
parents:
diff
changeset
|
254 goto Print_string; |
3ec22a11c83e
[svn] - moved titlestring.* and xconvert.* from libaudacious to audacious
mf0102
parents:
diff
changeset
|
255 case 'e': |
3ec22a11c83e
[svn] - moved titlestring.* and xconvert.* from libaudacious to audacious
mf0102
parents:
diff
changeset
|
256 string = VS(input, file_ext); |
3ec22a11c83e
[svn] - moved titlestring.* and xconvert.* from libaudacious to audacious
mf0102
parents:
diff
changeset
|
257 goto Print_string; |
3ec22a11c83e
[svn] - moved titlestring.* and xconvert.* from libaudacious to audacious
mf0102
parents:
diff
changeset
|
258 case 'f': |
3ec22a11c83e
[svn] - moved titlestring.* and xconvert.* from libaudacious to audacious
mf0102
parents:
diff
changeset
|
259 string = VS(input, file_name); |
3ec22a11c83e
[svn] - moved titlestring.* and xconvert.* from libaudacious to audacious
mf0102
parents:
diff
changeset
|
260 goto Print_string; |
3ec22a11c83e
[svn] - moved titlestring.* and xconvert.* from libaudacious to audacious
mf0102
parents:
diff
changeset
|
261 case 'F': |
3ec22a11c83e
[svn] - moved titlestring.* and xconvert.* from libaudacious to audacious
mf0102
parents:
diff
changeset
|
262 string = VS(input, file_path); |
3ec22a11c83e
[svn] - moved titlestring.* and xconvert.* from libaudacious to audacious
mf0102
parents:
diff
changeset
|
263 goto Print_string; |
3ec22a11c83e
[svn] - moved titlestring.* and xconvert.* from libaudacious to audacious
mf0102
parents:
diff
changeset
|
264 case 'g': |
3ec22a11c83e
[svn] - moved titlestring.* and xconvert.* from libaudacious to audacious
mf0102
parents:
diff
changeset
|
265 string = VS(input, genre); |
3ec22a11c83e
[svn] - moved titlestring.* and xconvert.* from libaudacious to audacious
mf0102
parents:
diff
changeset
|
266 goto Print_string; |
3ec22a11c83e
[svn] - moved titlestring.* and xconvert.* from libaudacious to audacious
mf0102
parents:
diff
changeset
|
267 case 'n': |
3ec22a11c83e
[svn] - moved titlestring.* and xconvert.* from libaudacious to audacious
mf0102
parents:
diff
changeset
|
268 val = VI(input, track_number); |
3ec22a11c83e
[svn] - moved titlestring.* and xconvert.* from libaudacious to audacious
mf0102
parents:
diff
changeset
|
269 goto Print_number; |
3ec22a11c83e
[svn] - moved titlestring.* and xconvert.* from libaudacious to audacious
mf0102
parents:
diff
changeset
|
270 case 'p': |
3ec22a11c83e
[svn] - moved titlestring.* and xconvert.* from libaudacious to audacious
mf0102
parents:
diff
changeset
|
271 string = VS(input, performer); |
3ec22a11c83e
[svn] - moved titlestring.* and xconvert.* from libaudacious to audacious
mf0102
parents:
diff
changeset
|
272 goto Print_string; |
3ec22a11c83e
[svn] - moved titlestring.* and xconvert.* from libaudacious to audacious
mf0102
parents:
diff
changeset
|
273 case 't': |
3ec22a11c83e
[svn] - moved titlestring.* and xconvert.* from libaudacious to audacious
mf0102
parents:
diff
changeset
|
274 string = VS(input, track_name); |
3ec22a11c83e
[svn] - moved titlestring.* and xconvert.* from libaudacious to audacious
mf0102
parents:
diff
changeset
|
275 goto Print_string; |
3ec22a11c83e
[svn] - moved titlestring.* and xconvert.* from libaudacious to audacious
mf0102
parents:
diff
changeset
|
276 case 'y': |
3ec22a11c83e
[svn] - moved titlestring.* and xconvert.* from libaudacious to audacious
mf0102
parents:
diff
changeset
|
277 val = VI(input, year); |
3ec22a11c83e
[svn] - moved titlestring.* and xconvert.* from libaudacious to audacious
mf0102
parents:
diff
changeset
|
278 goto Print_number; |
3ec22a11c83e
[svn] - moved titlestring.* and xconvert.* from libaudacious to audacious
mf0102
parents:
diff
changeset
|
279 |
3ec22a11c83e
[svn] - moved titlestring.* and xconvert.* from libaudacious to audacious
mf0102
parents:
diff
changeset
|
280 Print_string: |
3ec22a11c83e
[svn] - moved titlestring.* and xconvert.* from libaudacious to audacious
mf0102
parents:
diff
changeset
|
281 if (string == NULL) |
3ec22a11c83e
[svn] - moved titlestring.* and xconvert.* from libaudacious to audacious
mf0102
parents:
diff
changeset
|
282 break; |
3ec22a11c83e
[svn] - moved titlestring.* and xconvert.* from libaudacious to audacious
mf0102
parents:
diff
changeset
|
283 did_output = TRUE; |
3ec22a11c83e
[svn] - moved titlestring.* and xconvert.* from libaudacious to audacious
mf0102
parents:
diff
changeset
|
284 |
3ec22a11c83e
[svn] - moved titlestring.* and xconvert.* from libaudacious to audacious
mf0102
parents:
diff
changeset
|
285 numpr = 0; |
3ec22a11c83e
[svn] - moved titlestring.* and xconvert.* from libaudacious to audacious
mf0102
parents:
diff
changeset
|
286 if (width > 0) { |
3ec22a11c83e
[svn] - moved titlestring.* and xconvert.* from libaudacious to audacious
mf0102
parents:
diff
changeset
|
287 /* Calculate printed size. */ |
3ec22a11c83e
[svn] - moved titlestring.* and xconvert.* from libaudacious to audacious
mf0102
parents:
diff
changeset
|
288 numpr = strlen(string); |
3ec22a11c83e
[svn] - moved titlestring.* and xconvert.* from libaudacious to audacious
mf0102
parents:
diff
changeset
|
289 if (precision >= 0 && precision < numpr) |
3ec22a11c83e
[svn] - moved titlestring.* and xconvert.* from libaudacious to audacious
mf0102
parents:
diff
changeset
|
290 numpr = precision; |
3ec22a11c83e
[svn] - moved titlestring.* and xconvert.* from libaudacious to audacious
mf0102
parents:
diff
changeset
|
291 |
3ec22a11c83e
[svn] - moved titlestring.* and xconvert.* from libaudacious to audacious
mf0102
parents:
diff
changeset
|
292 LEFTPAD(width - numpr); |
3ec22a11c83e
[svn] - moved titlestring.* and xconvert.* from libaudacious to audacious
mf0102
parents:
diff
changeset
|
293 } |
3ec22a11c83e
[svn] - moved titlestring.* and xconvert.* from libaudacious to audacious
mf0102
parents:
diff
changeset
|
294 |
3ec22a11c83e
[svn] - moved titlestring.* and xconvert.* from libaudacious to audacious
mf0102
parents:
diff
changeset
|
295 /* Insert string. */ |
3ec22a11c83e
[svn] - moved titlestring.* and xconvert.* from libaudacious to audacious
mf0102
parents:
diff
changeset
|
296 if (precision >= 0) { |
3ec22a11c83e
[svn] - moved titlestring.* and xconvert.* from libaudacious to audacious
mf0102
parents:
diff
changeset
|
297 glong offset_max = precision, offset; |
3ec22a11c83e
[svn] - moved titlestring.* and xconvert.* from libaudacious to audacious
mf0102
parents:
diff
changeset
|
298 gchar *uptr = NULL; |
3ec22a11c83e
[svn] - moved titlestring.* and xconvert.* from libaudacious to audacious
mf0102
parents:
diff
changeset
|
299 const gchar *tmpstring = string; |
3ec22a11c83e
[svn] - moved titlestring.* and xconvert.* from libaudacious to audacious
mf0102
parents:
diff
changeset
|
300 while (precision > 0) { |
3ec22a11c83e
[svn] - moved titlestring.* and xconvert.* from libaudacious to audacious
mf0102
parents:
diff
changeset
|
301 offset = offset_max - precision; |
3ec22a11c83e
[svn] - moved titlestring.* and xconvert.* from libaudacious to audacious
mf0102
parents:
diff
changeset
|
302 uptr = g_utf8_offset_to_pointer(tmpstring, offset); |
3ec22a11c83e
[svn] - moved titlestring.* and xconvert.* from libaudacious to audacious
mf0102
parents:
diff
changeset
|
303 if (*uptr == '\0') |
3ec22a11c83e
[svn] - moved titlestring.* and xconvert.* from libaudacious to audacious
mf0102
parents:
diff
changeset
|
304 break; |
3ec22a11c83e
[svn] - moved titlestring.* and xconvert.* from libaudacious to audacious
mf0102
parents:
diff
changeset
|
305 g_string_append_unichar(outstr, g_utf8_get_char(uptr)); |
3ec22a11c83e
[svn] - moved titlestring.* and xconvert.* from libaudacious to audacious
mf0102
parents:
diff
changeset
|
306 precision--; |
3ec22a11c83e
[svn] - moved titlestring.* and xconvert.* from libaudacious to audacious
mf0102
parents:
diff
changeset
|
307 } |
3ec22a11c83e
[svn] - moved titlestring.* and xconvert.* from libaudacious to audacious
mf0102
parents:
diff
changeset
|
308 } |
3ec22a11c83e
[svn] - moved titlestring.* and xconvert.* from libaudacious to audacious
mf0102
parents:
diff
changeset
|
309 else { |
3ec22a11c83e
[svn] - moved titlestring.* and xconvert.* from libaudacious to audacious
mf0102
parents:
diff
changeset
|
310 while ((c = *string++) != '\0') |
3ec22a11c83e
[svn] - moved titlestring.* and xconvert.* from libaudacious to audacious
mf0102
parents:
diff
changeset
|
311 PUTCH(c); |
3ec22a11c83e
[svn] - moved titlestring.* and xconvert.* from libaudacious to audacious
mf0102
parents:
diff
changeset
|
312 } |
3ec22a11c83e
[svn] - moved titlestring.* and xconvert.* from libaudacious to audacious
mf0102
parents:
diff
changeset
|
313 |
3ec22a11c83e
[svn] - moved titlestring.* and xconvert.* from libaudacious to audacious
mf0102
parents:
diff
changeset
|
314 RIGHTPAD(width - numpr); |
3ec22a11c83e
[svn] - moved titlestring.* and xconvert.* from libaudacious to audacious
mf0102
parents:
diff
changeset
|
315 break; |
3ec22a11c83e
[svn] - moved titlestring.* and xconvert.* from libaudacious to audacious
mf0102
parents:
diff
changeset
|
316 |
3ec22a11c83e
[svn] - moved titlestring.* and xconvert.* from libaudacious to audacious
mf0102
parents:
diff
changeset
|
317 Print_number: |
3ec22a11c83e
[svn] - moved titlestring.* and xconvert.* from libaudacious to audacious
mf0102
parents:
diff
changeset
|
318 if (val == 0) |
3ec22a11c83e
[svn] - moved titlestring.* and xconvert.* from libaudacious to audacious
mf0102
parents:
diff
changeset
|
319 break; |
3ec22a11c83e
[svn] - moved titlestring.* and xconvert.* from libaudacious to audacious
mf0102
parents:
diff
changeset
|
320 if (c != 'N') |
3ec22a11c83e
[svn] - moved titlestring.* and xconvert.* from libaudacious to audacious
mf0102
parents:
diff
changeset
|
321 did_output = TRUE; |
3ec22a11c83e
[svn] - moved titlestring.* and xconvert.* from libaudacious to audacious
mf0102
parents:
diff
changeset
|
322 |
3ec22a11c83e
[svn] - moved titlestring.* and xconvert.* from libaudacious to audacious
mf0102
parents:
diff
changeset
|
323 /* Create reversed number string. */ |
3ec22a11c83e
[svn] - moved titlestring.* and xconvert.* from libaudacious to audacious
mf0102
parents:
diff
changeset
|
324 numdigits = 0; |
3ec22a11c83e
[svn] - moved titlestring.* and xconvert.* from libaudacious to audacious
mf0102
parents:
diff
changeset
|
325 do { |
3ec22a11c83e
[svn] - moved titlestring.* and xconvert.* from libaudacious to audacious
mf0102
parents:
diff
changeset
|
326 convert[numdigits++] = digits[val % 10]; |
3ec22a11c83e
[svn] - moved titlestring.* and xconvert.* from libaudacious to audacious
mf0102
parents:
diff
changeset
|
327 val /= 10; |
3ec22a11c83e
[svn] - moved titlestring.* and xconvert.* from libaudacious to audacious
mf0102
parents:
diff
changeset
|
328 } |
3ec22a11c83e
[svn] - moved titlestring.* and xconvert.* from libaudacious to audacious
mf0102
parents:
diff
changeset
|
329 while (val > 0); |
3ec22a11c83e
[svn] - moved titlestring.* and xconvert.* from libaudacious to audacious
mf0102
parents:
diff
changeset
|
330 |
3ec22a11c83e
[svn] - moved titlestring.* and xconvert.* from libaudacious to audacious
mf0102
parents:
diff
changeset
|
331 numpr = numdigits > precision ? numdigits : precision; |
3ec22a11c83e
[svn] - moved titlestring.* and xconvert.* from libaudacious to audacious
mf0102
parents:
diff
changeset
|
332 |
3ec22a11c83e
[svn] - moved titlestring.* and xconvert.* from libaudacious to audacious
mf0102
parents:
diff
changeset
|
333 /* Insert left padding. */ |
3ec22a11c83e
[svn] - moved titlestring.* and xconvert.* from libaudacious to audacious
mf0102
parents:
diff
changeset
|
334 if (!f_left && width > numpr) { |
3ec22a11c83e
[svn] - moved titlestring.* and xconvert.* from libaudacious to audacious
mf0102
parents:
diff
changeset
|
335 if (f_zero) |
3ec22a11c83e
[svn] - moved titlestring.* and xconvert.* from libaudacious to audacious
mf0102
parents:
diff
changeset
|
336 numpr = width; |
3ec22a11c83e
[svn] - moved titlestring.* and xconvert.* from libaudacious to audacious
mf0102
parents:
diff
changeset
|
337 else |
3ec22a11c83e
[svn] - moved titlestring.* and xconvert.* from libaudacious to audacious
mf0102
parents:
diff
changeset
|
338 for (i = width - numpr; i-- > 0;) |
3ec22a11c83e
[svn] - moved titlestring.* and xconvert.* from libaudacious to audacious
mf0102
parents:
diff
changeset
|
339 PUTCH(' '); |
3ec22a11c83e
[svn] - moved titlestring.* and xconvert.* from libaudacious to audacious
mf0102
parents:
diff
changeset
|
340 } |
3ec22a11c83e
[svn] - moved titlestring.* and xconvert.* from libaudacious to audacious
mf0102
parents:
diff
changeset
|
341 |
3ec22a11c83e
[svn] - moved titlestring.* and xconvert.* from libaudacious to audacious
mf0102
parents:
diff
changeset
|
342 /* Insert zero padding. */ |
3ec22a11c83e
[svn] - moved titlestring.* and xconvert.* from libaudacious to audacious
mf0102
parents:
diff
changeset
|
343 for (i = numpr - numdigits; i-- > 0;) |
3ec22a11c83e
[svn] - moved titlestring.* and xconvert.* from libaudacious to audacious
mf0102
parents:
diff
changeset
|
344 PUTCH('0'); |
3ec22a11c83e
[svn] - moved titlestring.* and xconvert.* from libaudacious to audacious
mf0102
parents:
diff
changeset
|
345 |
3ec22a11c83e
[svn] - moved titlestring.* and xconvert.* from libaudacious to audacious
mf0102
parents:
diff
changeset
|
346 /* Insert number. */ |
3ec22a11c83e
[svn] - moved titlestring.* and xconvert.* from libaudacious to audacious
mf0102
parents:
diff
changeset
|
347 while (numdigits > 0) |
3ec22a11c83e
[svn] - moved titlestring.* and xconvert.* from libaudacious to audacious
mf0102
parents:
diff
changeset
|
348 PUTCH(convert[--numdigits]); |
3ec22a11c83e
[svn] - moved titlestring.* and xconvert.* from libaudacious to audacious
mf0102
parents:
diff
changeset
|
349 |
3ec22a11c83e
[svn] - moved titlestring.* and xconvert.* from libaudacious to audacious
mf0102
parents:
diff
changeset
|
350 RIGHTPAD(width - numpr); |
3ec22a11c83e
[svn] - moved titlestring.* and xconvert.* from libaudacious to audacious
mf0102
parents:
diff
changeset
|
351 break; |
3ec22a11c83e
[svn] - moved titlestring.* and xconvert.* from libaudacious to audacious
mf0102
parents:
diff
changeset
|
352 |
3ec22a11c83e
[svn] - moved titlestring.* and xconvert.* from libaudacious to audacious
mf0102
parents:
diff
changeset
|
353 case '%': |
3ec22a11c83e
[svn] - moved titlestring.* and xconvert.* from libaudacious to audacious
mf0102
parents:
diff
changeset
|
354 PUTCH('%'); |
3ec22a11c83e
[svn] - moved titlestring.* and xconvert.* from libaudacious to audacious
mf0102
parents:
diff
changeset
|
355 break; |
3ec22a11c83e
[svn] - moved titlestring.* and xconvert.* from libaudacious to audacious
mf0102
parents:
diff
changeset
|
356 |
3ec22a11c83e
[svn] - moved titlestring.* and xconvert.* from libaudacious to audacious
mf0102
parents:
diff
changeset
|
357 default: |
3ec22a11c83e
[svn] - moved titlestring.* and xconvert.* from libaudacious to audacious
mf0102
parents:
diff
changeset
|
358 PUTCH('%'); |
3ec22a11c83e
[svn] - moved titlestring.* and xconvert.* from libaudacious to audacious
mf0102
parents:
diff
changeset
|
359 PUTCH(c); |
3ec22a11c83e
[svn] - moved titlestring.* and xconvert.* from libaudacious to audacious
mf0102
parents:
diff
changeset
|
360 break; |
3ec22a11c83e
[svn] - moved titlestring.* and xconvert.* from libaudacious to audacious
mf0102
parents:
diff
changeset
|
361 } |
3ec22a11c83e
[svn] - moved titlestring.* and xconvert.* from libaudacious to audacious
mf0102
parents:
diff
changeset
|
362 } |
3ec22a11c83e
[svn] - moved titlestring.* and xconvert.* from libaudacious to audacious
mf0102
parents:
diff
changeset
|
363 |
3ec22a11c83e
[svn] - moved titlestring.* and xconvert.* from libaudacious to audacious
mf0102
parents:
diff
changeset
|
364 Done: |
3ec22a11c83e
[svn] - moved titlestring.* and xconvert.* from libaudacious to audacious
mf0102
parents:
diff
changeset
|
365 if (did_output) |
3ec22a11c83e
[svn] - moved titlestring.* and xconvert.* from libaudacious to audacious
mf0102
parents:
diff
changeset
|
366 return g_string_free(outstr, FALSE); |
3ec22a11c83e
[svn] - moved titlestring.* and xconvert.* from libaudacious to audacious
mf0102
parents:
diff
changeset
|
367 else |
3ec22a11c83e
[svn] - moved titlestring.* and xconvert.* from libaudacious to audacious
mf0102
parents:
diff
changeset
|
368 return NULL; |
3ec22a11c83e
[svn] - moved titlestring.* and xconvert.* from libaudacious to audacious
mf0102
parents:
diff
changeset
|
369 } |
3ec22a11c83e
[svn] - moved titlestring.* and xconvert.* from libaudacious to audacious
mf0102
parents:
diff
changeset
|
370 |
3ec22a11c83e
[svn] - moved titlestring.* and xconvert.* from libaudacious to audacious
mf0102
parents:
diff
changeset
|
371 struct _TagDescription { |
3ec22a11c83e
[svn] - moved titlestring.* and xconvert.* from libaudacious to audacious
mf0102
parents:
diff
changeset
|
372 gchar tag; |
3ec22a11c83e
[svn] - moved titlestring.* and xconvert.* from libaudacious to audacious
mf0102
parents:
diff
changeset
|
373 gchar *description; |
3ec22a11c83e
[svn] - moved titlestring.* and xconvert.* from libaudacious to audacious
mf0102
parents:
diff
changeset
|
374 }; |
3ec22a11c83e
[svn] - moved titlestring.* and xconvert.* from libaudacious to audacious
mf0102
parents:
diff
changeset
|
375 |
3ec22a11c83e
[svn] - moved titlestring.* and xconvert.* from libaudacious to audacious
mf0102
parents:
diff
changeset
|
376 typedef struct _TagDescription TagDescription; |
3ec22a11c83e
[svn] - moved titlestring.* and xconvert.* from libaudacious to audacious
mf0102
parents:
diff
changeset
|
377 |
3ec22a11c83e
[svn] - moved titlestring.* and xconvert.* from libaudacious to audacious
mf0102
parents:
diff
changeset
|
378 static TagDescription tag_descriptions[] = { |
3ec22a11c83e
[svn] - moved titlestring.* and xconvert.* from libaudacious to audacious
mf0102
parents:
diff
changeset
|
379 {'p', N_("Performer/Artist")}, |
3ec22a11c83e
[svn] - moved titlestring.* and xconvert.* from libaudacious to audacious
mf0102
parents:
diff
changeset
|
380 {'a', N_("Album")}, |
3ec22a11c83e
[svn] - moved titlestring.* and xconvert.* from libaudacious to audacious
mf0102
parents:
diff
changeset
|
381 {'g', N_("Genre")}, |
3ec22a11c83e
[svn] - moved titlestring.* and xconvert.* from libaudacious to audacious
mf0102
parents:
diff
changeset
|
382 {'f', N_("File name")}, |
3ec22a11c83e
[svn] - moved titlestring.* and xconvert.* from libaudacious to audacious
mf0102
parents:
diff
changeset
|
383 {'F', N_("File path")}, |
3ec22a11c83e
[svn] - moved titlestring.* and xconvert.* from libaudacious to audacious
mf0102
parents:
diff
changeset
|
384 {'e', N_("File extension")}, |
3ec22a11c83e
[svn] - moved titlestring.* and xconvert.* from libaudacious to audacious
mf0102
parents:
diff
changeset
|
385 {'t', N_("Track name")}, |
3ec22a11c83e
[svn] - moved titlestring.* and xconvert.* from libaudacious to audacious
mf0102
parents:
diff
changeset
|
386 {'n', N_("Track number")}, |
3ec22a11c83e
[svn] - moved titlestring.* and xconvert.* from libaudacious to audacious
mf0102
parents:
diff
changeset
|
387 {'d', N_("Date")}, |
3ec22a11c83e
[svn] - moved titlestring.* and xconvert.* from libaudacious to audacious
mf0102
parents:
diff
changeset
|
388 {'y', N_("Year")}, |
3ec22a11c83e
[svn] - moved titlestring.* and xconvert.* from libaudacious to audacious
mf0102
parents:
diff
changeset
|
389 {'c', N_("Comment")} |
3ec22a11c83e
[svn] - moved titlestring.* and xconvert.* from libaudacious to audacious
mf0102
parents:
diff
changeset
|
390 }; |
3ec22a11c83e
[svn] - moved titlestring.* and xconvert.* from libaudacious to audacious
mf0102
parents:
diff
changeset
|
391 |
3ec22a11c83e
[svn] - moved titlestring.* and xconvert.* from libaudacious to audacious
mf0102
parents:
diff
changeset
|
392 gint tag_descriptions_length = |
3ec22a11c83e
[svn] - moved titlestring.* and xconvert.* from libaudacious to audacious
mf0102
parents:
diff
changeset
|
393 sizeof(tag_descriptions) / sizeof(TagDescription); |
3ec22a11c83e
[svn] - moved titlestring.* and xconvert.* from libaudacious to audacious
mf0102
parents:
diff
changeset
|
394 |
3ec22a11c83e
[svn] - moved titlestring.* and xconvert.* from libaudacious to audacious
mf0102
parents:
diff
changeset
|
395 /** |
3ec22a11c83e
[svn] - moved titlestring.* and xconvert.* from libaudacious to audacious
mf0102
parents:
diff
changeset
|
396 * xmms_titlestring_descriptions: |
3ec22a11c83e
[svn] - moved titlestring.* and xconvert.* from libaudacious to audacious
mf0102
parents:
diff
changeset
|
397 * @tags: A list of formatters to provide. |
3ec22a11c83e
[svn] - moved titlestring.* and xconvert.* from libaudacious to audacious
mf0102
parents:
diff
changeset
|
398 * @columns: A number of columns to arrange them in. |
3ec22a11c83e
[svn] - moved titlestring.* and xconvert.* from libaudacious to audacious
mf0102
parents:
diff
changeset
|
399 * |
3ec22a11c83e
[svn] - moved titlestring.* and xconvert.* from libaudacious to audacious
mf0102
parents:
diff
changeset
|
400 * Generates a box explaining how to use the formatters. |
3ec22a11c83e
[svn] - moved titlestring.* and xconvert.* from libaudacious to audacious
mf0102
parents:
diff
changeset
|
401 * |
3ec22a11c83e
[svn] - moved titlestring.* and xconvert.* from libaudacious to audacious
mf0102
parents:
diff
changeset
|
402 * Return value: A GtkWidget containing the table. |
3ec22a11c83e
[svn] - moved titlestring.* and xconvert.* from libaudacious to audacious
mf0102
parents:
diff
changeset
|
403 **/ |
3ec22a11c83e
[svn] - moved titlestring.* and xconvert.* from libaudacious to audacious
mf0102
parents:
diff
changeset
|
404 GtkWidget * |
3ec22a11c83e
[svn] - moved titlestring.* and xconvert.* from libaudacious to audacious
mf0102
parents:
diff
changeset
|
405 xmms_titlestring_descriptions(gchar * tags, gint columns) |
3ec22a11c83e
[svn] - moved titlestring.* and xconvert.* from libaudacious to audacious
mf0102
parents:
diff
changeset
|
406 { |
3ec22a11c83e
[svn] - moved titlestring.* and xconvert.* from libaudacious to audacious
mf0102
parents:
diff
changeset
|
407 GtkWidget *table, *label; |
3ec22a11c83e
[svn] - moved titlestring.* and xconvert.* from libaudacious to audacious
mf0102
parents:
diff
changeset
|
408 gchar tag_str[5]; |
3ec22a11c83e
[svn] - moved titlestring.* and xconvert.* from libaudacious to audacious
mf0102
parents:
diff
changeset
|
409 gint num = strlen(tags); |
3ec22a11c83e
[svn] - moved titlestring.* and xconvert.* from libaudacious to audacious
mf0102
parents:
diff
changeset
|
410 gint r = 0, c, i; |
3ec22a11c83e
[svn] - moved titlestring.* and xconvert.* from libaudacious to audacious
mf0102
parents:
diff
changeset
|
411 |
3ec22a11c83e
[svn] - moved titlestring.* and xconvert.* from libaudacious to audacious
mf0102
parents:
diff
changeset
|
412 g_return_val_if_fail(tags != NULL, NULL); |
3ec22a11c83e
[svn] - moved titlestring.* and xconvert.* from libaudacious to audacious
mf0102
parents:
diff
changeset
|
413 g_return_val_if_fail(columns <= num, NULL); |
3ec22a11c83e
[svn] - moved titlestring.* and xconvert.* from libaudacious to audacious
mf0102
parents:
diff
changeset
|
414 |
3ec22a11c83e
[svn] - moved titlestring.* and xconvert.* from libaudacious to audacious
mf0102
parents:
diff
changeset
|
415 table = gtk_table_new((num + columns - 1) / columns, columns * 2, FALSE); |
3ec22a11c83e
[svn] - moved titlestring.* and xconvert.* from libaudacious to audacious
mf0102
parents:
diff
changeset
|
416 gtk_table_set_row_spacings(GTK_TABLE(table), 2); |
3ec22a11c83e
[svn] - moved titlestring.* and xconvert.* from libaudacious to audacious
mf0102
parents:
diff
changeset
|
417 gtk_table_set_col_spacings(GTK_TABLE(table), 5); |
3ec22a11c83e
[svn] - moved titlestring.* and xconvert.* from libaudacious to audacious
mf0102
parents:
diff
changeset
|
418 |
3ec22a11c83e
[svn] - moved titlestring.* and xconvert.* from libaudacious to audacious
mf0102
parents:
diff
changeset
|
419 for (c = 0; c < columns; c++) { |
3ec22a11c83e
[svn] - moved titlestring.* and xconvert.* from libaudacious to audacious
mf0102
parents:
diff
changeset
|
420 for (r = 0; r < (num + columns - 1 - c) / columns; r++) { |
3ec22a11c83e
[svn] - moved titlestring.* and xconvert.* from libaudacious to audacious
mf0102
parents:
diff
changeset
|
421 g_snprintf(tag_str, sizeof(tag_str), "%%%c:", *tags); |
3ec22a11c83e
[svn] - moved titlestring.* and xconvert.* from libaudacious to audacious
mf0102
parents:
diff
changeset
|
422 label = gtk_label_new(tag_str); |
3ec22a11c83e
[svn] - moved titlestring.* and xconvert.* from libaudacious to audacious
mf0102
parents:
diff
changeset
|
423 gtk_misc_set_alignment(GTK_MISC(label), 0.0, 0.5); |
3ec22a11c83e
[svn] - moved titlestring.* and xconvert.* from libaudacious to audacious
mf0102
parents:
diff
changeset
|
424 gtk_table_attach(GTK_TABLE(table), label, 2 * c, 2 * c + 1, r, |
3ec22a11c83e
[svn] - moved titlestring.* and xconvert.* from libaudacious to audacious
mf0102
parents:
diff
changeset
|
425 r + 1, GTK_FILL, GTK_FILL, 0, 0); |
3ec22a11c83e
[svn] - moved titlestring.* and xconvert.* from libaudacious to audacious
mf0102
parents:
diff
changeset
|
426 gtk_widget_show(label); |
3ec22a11c83e
[svn] - moved titlestring.* and xconvert.* from libaudacious to audacious
mf0102
parents:
diff
changeset
|
427 |
3ec22a11c83e
[svn] - moved titlestring.* and xconvert.* from libaudacious to audacious
mf0102
parents:
diff
changeset
|
428 for (i = 0; i < tag_descriptions_length; i++) { |
3ec22a11c83e
[svn] - moved titlestring.* and xconvert.* from libaudacious to audacious
mf0102
parents:
diff
changeset
|
429 if (*tags == tag_descriptions[i].tag) { |
3ec22a11c83e
[svn] - moved titlestring.* and xconvert.* from libaudacious to audacious
mf0102
parents:
diff
changeset
|
430 label = gtk_label_new(_(tag_descriptions[i].description)); |
3ec22a11c83e
[svn] - moved titlestring.* and xconvert.* from libaudacious to audacious
mf0102
parents:
diff
changeset
|
431 gtk_misc_set_alignment(GTK_MISC(label), 0.0, 0.5); |
3ec22a11c83e
[svn] - moved titlestring.* and xconvert.* from libaudacious to audacious
mf0102
parents:
diff
changeset
|
432 gtk_table_attach(GTK_TABLE(table), label, 2 * c + 1, |
3ec22a11c83e
[svn] - moved titlestring.* and xconvert.* from libaudacious to audacious
mf0102
parents:
diff
changeset
|
433 2 * c + 2, r, r + 1, |
3ec22a11c83e
[svn] - moved titlestring.* and xconvert.* from libaudacious to audacious
mf0102
parents:
diff
changeset
|
434 GTK_EXPAND | GTK_FILL, |
3ec22a11c83e
[svn] - moved titlestring.* and xconvert.* from libaudacious to audacious
mf0102
parents:
diff
changeset
|
435 GTK_EXPAND | GTK_FILL, 0, 0); |
3ec22a11c83e
[svn] - moved titlestring.* and xconvert.* from libaudacious to audacious
mf0102
parents:
diff
changeset
|
436 gtk_widget_show(label); |
3ec22a11c83e
[svn] - moved titlestring.* and xconvert.* from libaudacious to audacious
mf0102
parents:
diff
changeset
|
437 break; |
3ec22a11c83e
[svn] - moved titlestring.* and xconvert.* from libaudacious to audacious
mf0102
parents:
diff
changeset
|
438 } |
3ec22a11c83e
[svn] - moved titlestring.* and xconvert.* from libaudacious to audacious
mf0102
parents:
diff
changeset
|
439 } |
3ec22a11c83e
[svn] - moved titlestring.* and xconvert.* from libaudacious to audacious
mf0102
parents:
diff
changeset
|
440 |
3ec22a11c83e
[svn] - moved titlestring.* and xconvert.* from libaudacious to audacious
mf0102
parents:
diff
changeset
|
441 if (i == tag_descriptions_length) |
3ec22a11c83e
[svn] - moved titlestring.* and xconvert.* from libaudacious to audacious
mf0102
parents:
diff
changeset
|
442 g_warning("Invalid tag: %c", *tags); |
3ec22a11c83e
[svn] - moved titlestring.* and xconvert.* from libaudacious to audacious
mf0102
parents:
diff
changeset
|
443 |
3ec22a11c83e
[svn] - moved titlestring.* and xconvert.* from libaudacious to audacious
mf0102
parents:
diff
changeset
|
444 tags++; |
3ec22a11c83e
[svn] - moved titlestring.* and xconvert.* from libaudacious to audacious
mf0102
parents:
diff
changeset
|
445 } |
3ec22a11c83e
[svn] - moved titlestring.* and xconvert.* from libaudacious to audacious
mf0102
parents:
diff
changeset
|
446 |
3ec22a11c83e
[svn] - moved titlestring.* and xconvert.* from libaudacious to audacious
mf0102
parents:
diff
changeset
|
447 } |
3ec22a11c83e
[svn] - moved titlestring.* and xconvert.* from libaudacious to audacious
mf0102
parents:
diff
changeset
|
448 |
3ec22a11c83e
[svn] - moved titlestring.* and xconvert.* from libaudacious to audacious
mf0102
parents:
diff
changeset
|
449 label = gtk_label_new(_("%{n:...%}: Display \"...\" only if element " |
3ec22a11c83e
[svn] - moved titlestring.* and xconvert.* from libaudacious to audacious
mf0102
parents:
diff
changeset
|
450 "%n is present")); |
3ec22a11c83e
[svn] - moved titlestring.* and xconvert.* from libaudacious to audacious
mf0102
parents:
diff
changeset
|
451 gtk_misc_set_alignment(GTK_MISC(label), 0.0, 0.5); |
3ec22a11c83e
[svn] - moved titlestring.* and xconvert.* from libaudacious to audacious
mf0102
parents:
diff
changeset
|
452 gtk_table_attach(GTK_TABLE(table), label, 0, r + 1, |
3ec22a11c83e
[svn] - moved titlestring.* and xconvert.* from libaudacious to audacious
mf0102
parents:
diff
changeset
|
453 r + 1, r + 2, GTK_FILL, GTK_FILL, 0, 0); |
3ec22a11c83e
[svn] - moved titlestring.* and xconvert.* from libaudacious to audacious
mf0102
parents:
diff
changeset
|
454 gtk_widget_show(label); |
3ec22a11c83e
[svn] - moved titlestring.* and xconvert.* from libaudacious to audacious
mf0102
parents:
diff
changeset
|
455 |
3ec22a11c83e
[svn] - moved titlestring.* and xconvert.* from libaudacious to audacious
mf0102
parents:
diff
changeset
|
456 return table; |
3ec22a11c83e
[svn] - moved titlestring.* and xconvert.* from libaudacious to audacious
mf0102
parents:
diff
changeset
|
457 } |