Mercurial > audlegacy
annotate src/audacious/titlestring.c @ 2437:62d8f9c05832 trunk
[svn] More input plugin API work
author | iabervon |
---|---|
date | Sun, 28 Jan 2007 21:08:08 -0800 |
parents | 3ec22a11c83e |
children | 864c12eafb49 |
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; |
3ec22a11c83e
[svn] - moved titlestring.* and xconvert.* from libaudacious to audacious
mf0102
parents:
diff
changeset
|
56 return input; |
3ec22a11c83e
[svn] - moved titlestring.* and xconvert.* from libaudacious to audacious
mf0102
parents:
diff
changeset
|
57 } |
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 * bmp_title_input_free: |
3ec22a11c83e
[svn] - moved titlestring.* and xconvert.* from libaudacious to audacious
mf0102
parents:
diff
changeset
|
61 * @input: A #BmpTitleInput tuple to destroy. |
3ec22a11c83e
[svn] - moved titlestring.* and xconvert.* from libaudacious to audacious
mf0102
parents:
diff
changeset
|
62 * |
3ec22a11c83e
[svn] - moved titlestring.* and xconvert.* from libaudacious to audacious
mf0102
parents:
diff
changeset
|
63 * Destroys a #BmpTitleInput tuple. |
3ec22a11c83e
[svn] - moved titlestring.* and xconvert.* from libaudacious to audacious
mf0102
parents:
diff
changeset
|
64 **/ |
3ec22a11c83e
[svn] - moved titlestring.* and xconvert.* from libaudacious to audacious
mf0102
parents:
diff
changeset
|
65 void |
3ec22a11c83e
[svn] - moved titlestring.* and xconvert.* from libaudacious to audacious
mf0102
parents:
diff
changeset
|
66 bmp_title_input_free(BmpTitleInput * input) |
3ec22a11c83e
[svn] - moved titlestring.* and xconvert.* from libaudacious to audacious
mf0102
parents:
diff
changeset
|
67 { |
3ec22a11c83e
[svn] - moved titlestring.* and xconvert.* from libaudacious to audacious
mf0102
parents:
diff
changeset
|
68 if (input == NULL) |
3ec22a11c83e
[svn] - moved titlestring.* and xconvert.* from libaudacious to audacious
mf0102
parents:
diff
changeset
|
69 return; |
3ec22a11c83e
[svn] - moved titlestring.* and xconvert.* from libaudacious to audacious
mf0102
parents:
diff
changeset
|
70 |
3ec22a11c83e
[svn] - moved titlestring.* and xconvert.* from libaudacious to audacious
mf0102
parents:
diff
changeset
|
71 if (input->performer != NULL) |
3ec22a11c83e
[svn] - moved titlestring.* and xconvert.* from libaudacious to audacious
mf0102
parents:
diff
changeset
|
72 g_free(input->performer); |
3ec22a11c83e
[svn] - moved titlestring.* and xconvert.* from libaudacious to audacious
mf0102
parents:
diff
changeset
|
73 |
3ec22a11c83e
[svn] - moved titlestring.* and xconvert.* from libaudacious to audacious
mf0102
parents:
diff
changeset
|
74 if (input->album_name != NULL) |
3ec22a11c83e
[svn] - moved titlestring.* and xconvert.* from libaudacious to audacious
mf0102
parents:
diff
changeset
|
75 g_free(input->album_name); |
3ec22a11c83e
[svn] - moved titlestring.* and xconvert.* from libaudacious to audacious
mf0102
parents:
diff
changeset
|
76 |
3ec22a11c83e
[svn] - moved titlestring.* and xconvert.* from libaudacious to audacious
mf0102
parents:
diff
changeset
|
77 if (input->track_name != NULL) |
3ec22a11c83e
[svn] - moved titlestring.* and xconvert.* from libaudacious to audacious
mf0102
parents:
diff
changeset
|
78 g_free(input->track_name); |
3ec22a11c83e
[svn] - moved titlestring.* and xconvert.* from libaudacious to audacious
mf0102
parents:
diff
changeset
|
79 |
3ec22a11c83e
[svn] - moved titlestring.* and xconvert.* from libaudacious to audacious
mf0102
parents:
diff
changeset
|
80 if (input->date != NULL) |
3ec22a11c83e
[svn] - moved titlestring.* and xconvert.* from libaudacious to audacious
mf0102
parents:
diff
changeset
|
81 g_free(input->date); |
3ec22a11c83e
[svn] - moved titlestring.* and xconvert.* from libaudacious to audacious
mf0102
parents:
diff
changeset
|
82 |
3ec22a11c83e
[svn] - moved titlestring.* and xconvert.* from libaudacious to audacious
mf0102
parents:
diff
changeset
|
83 if (input->genre != NULL) |
3ec22a11c83e
[svn] - moved titlestring.* and xconvert.* from libaudacious to audacious
mf0102
parents:
diff
changeset
|
84 g_free(input->genre); |
3ec22a11c83e
[svn] - moved titlestring.* and xconvert.* from libaudacious to audacious
mf0102
parents:
diff
changeset
|
85 |
3ec22a11c83e
[svn] - moved titlestring.* and xconvert.* from libaudacious to audacious
mf0102
parents:
diff
changeset
|
86 if (input->comment != NULL) |
3ec22a11c83e
[svn] - moved titlestring.* and xconvert.* from libaudacious to audacious
mf0102
parents:
diff
changeset
|
87 g_free(input->comment); |
3ec22a11c83e
[svn] - moved titlestring.* and xconvert.* from libaudacious to audacious
mf0102
parents:
diff
changeset
|
88 |
3ec22a11c83e
[svn] - moved titlestring.* and xconvert.* from libaudacious to audacious
mf0102
parents:
diff
changeset
|
89 if (input->file_name != NULL) |
3ec22a11c83e
[svn] - moved titlestring.* and xconvert.* from libaudacious to audacious
mf0102
parents:
diff
changeset
|
90 g_free(input->file_name); |
3ec22a11c83e
[svn] - moved titlestring.* and xconvert.* from libaudacious to audacious
mf0102
parents:
diff
changeset
|
91 |
3ec22a11c83e
[svn] - moved titlestring.* and xconvert.* from libaudacious to audacious
mf0102
parents:
diff
changeset
|
92 if (input->file_path != NULL) |
3ec22a11c83e
[svn] - moved titlestring.* and xconvert.* from libaudacious to audacious
mf0102
parents:
diff
changeset
|
93 g_free(input->file_path); |
3ec22a11c83e
[svn] - moved titlestring.* and xconvert.* from libaudacious to audacious
mf0102
parents:
diff
changeset
|
94 |
3ec22a11c83e
[svn] - moved titlestring.* and xconvert.* from libaudacious to audacious
mf0102
parents:
diff
changeset
|
95 g_free(input); |
3ec22a11c83e
[svn] - moved titlestring.* and xconvert.* from libaudacious to audacious
mf0102
parents:
diff
changeset
|
96 } |
3ec22a11c83e
[svn] - moved titlestring.* and xconvert.* from libaudacious to audacious
mf0102
parents:
diff
changeset
|
97 |
3ec22a11c83e
[svn] - moved titlestring.* and xconvert.* from libaudacious to audacious
mf0102
parents:
diff
changeset
|
98 /** |
3ec22a11c83e
[svn] - moved titlestring.* and xconvert.* from libaudacious to audacious
mf0102
parents:
diff
changeset
|
99 * xmms_get_titlestring: |
3ec22a11c83e
[svn] - moved titlestring.* and xconvert.* from libaudacious to audacious
mf0102
parents:
diff
changeset
|
100 * @fmt: A format string. |
3ec22a11c83e
[svn] - moved titlestring.* and xconvert.* from libaudacious to audacious
mf0102
parents:
diff
changeset
|
101 * @input: A tuple to use for data. |
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 * Generates a formatted string from a tuple. |
3ec22a11c83e
[svn] - moved titlestring.* and xconvert.* from libaudacious to audacious
mf0102
parents:
diff
changeset
|
104 * |
3ec22a11c83e
[svn] - moved titlestring.* and xconvert.* from libaudacious to audacious
mf0102
parents:
diff
changeset
|
105 * Return value: A formatted tuple string. |
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 gchar * |
3ec22a11c83e
[svn] - moved titlestring.* and xconvert.* from libaudacious to audacious
mf0102
parents:
diff
changeset
|
108 xmms_get_titlestring(const gchar * fmt, TitleInput * input) |
3ec22a11c83e
[svn] - moved titlestring.* and xconvert.* from libaudacious to audacious
mf0102
parents:
diff
changeset
|
109 { |
3ec22a11c83e
[svn] - moved titlestring.* and xconvert.* from libaudacious to audacious
mf0102
parents:
diff
changeset
|
110 GString *outstr; |
3ec22a11c83e
[svn] - moved titlestring.* and xconvert.* from libaudacious to audacious
mf0102
parents:
diff
changeset
|
111 const gchar *string; |
3ec22a11c83e
[svn] - moved titlestring.* and xconvert.* from libaudacious to audacious
mf0102
parents:
diff
changeset
|
112 gchar c, convert[16]; |
3ec22a11c83e
[svn] - moved titlestring.* and xconvert.* from libaudacious to audacious
mf0102
parents:
diff
changeset
|
113 gint numdigits, numpr, val, i; |
3ec22a11c83e
[svn] - moved titlestring.* and xconvert.* from libaudacious to audacious
mf0102
parents:
diff
changeset
|
114 gint f_left, f_space, f_zero, someflag, width, precision; |
3ec22a11c83e
[svn] - moved titlestring.* and xconvert.* from libaudacious to audacious
mf0102
parents:
diff
changeset
|
115 gboolean did_output = FALSE; |
3ec22a11c83e
[svn] - moved titlestring.* and xconvert.* from libaudacious to audacious
mf0102
parents:
diff
changeset
|
116 gchar digits[] = "0123456789"; |
3ec22a11c83e
[svn] - moved titlestring.* and xconvert.* from libaudacious to audacious
mf0102
parents:
diff
changeset
|
117 |
3ec22a11c83e
[svn] - moved titlestring.* and xconvert.* from libaudacious to audacious
mf0102
parents:
diff
changeset
|
118 #define PUTCH(ch) g_string_append_c(outstr, ch) |
3ec22a11c83e
[svn] - moved titlestring.* and xconvert.* from libaudacious to audacious
mf0102
parents:
diff
changeset
|
119 |
3ec22a11c83e
[svn] - moved titlestring.* and xconvert.* from libaudacious to audacious
mf0102
parents:
diff
changeset
|
120 #define LEFTPAD(num) \ |
3ec22a11c83e
[svn] - moved titlestring.* and xconvert.* from libaudacious to audacious
mf0102
parents:
diff
changeset
|
121 G_STMT_START { \ |
3ec22a11c83e
[svn] - moved titlestring.* and xconvert.* from libaudacious to audacious
mf0102
parents:
diff
changeset
|
122 gint cnt = (num); \ |
3ec22a11c83e
[svn] - moved titlestring.* and xconvert.* from libaudacious to audacious
mf0102
parents:
diff
changeset
|
123 if ( ! f_left && cnt > 0 ) \ |
3ec22a11c83e
[svn] - moved titlestring.* and xconvert.* from libaudacious to audacious
mf0102
parents:
diff
changeset
|
124 while ( cnt-- > 0 ) \ |
3ec22a11c83e
[svn] - moved titlestring.* and xconvert.* from libaudacious to audacious
mf0102
parents:
diff
changeset
|
125 PUTCH(f_zero ? '0' : ' '); \ |
3ec22a11c83e
[svn] - moved titlestring.* and xconvert.* from libaudacious to audacious
mf0102
parents:
diff
changeset
|
126 } G_STMT_END; |
3ec22a11c83e
[svn] - moved titlestring.* and xconvert.* from libaudacious to audacious
mf0102
parents:
diff
changeset
|
127 |
3ec22a11c83e
[svn] - moved titlestring.* and xconvert.* from libaudacious to audacious
mf0102
parents:
diff
changeset
|
128 #define RIGHTPAD(num) \ |
3ec22a11c83e
[svn] - moved titlestring.* and xconvert.* from libaudacious to audacious
mf0102
parents:
diff
changeset
|
129 G_STMT_START { \ |
3ec22a11c83e
[svn] - moved titlestring.* and xconvert.* from libaudacious to audacious
mf0102
parents:
diff
changeset
|
130 gint cnt = (num); \ |
3ec22a11c83e
[svn] - moved titlestring.* and xconvert.* from libaudacious to audacious
mf0102
parents:
diff
changeset
|
131 if ( f_left && cnt > 0 ) \ |
3ec22a11c83e
[svn] - moved titlestring.* and xconvert.* from libaudacious to audacious
mf0102
parents:
diff
changeset
|
132 while ( cnt-- > 0 ) \ |
3ec22a11c83e
[svn] - moved titlestring.* and xconvert.* from libaudacious to audacious
mf0102
parents:
diff
changeset
|
133 PUTCH( ' ' ); \ |
3ec22a11c83e
[svn] - moved titlestring.* and xconvert.* from libaudacious to audacious
mf0102
parents:
diff
changeset
|
134 } G_STMT_END; |
3ec22a11c83e
[svn] - moved titlestring.* and xconvert.* from libaudacious to audacious
mf0102
parents:
diff
changeset
|
135 |
3ec22a11c83e
[svn] - moved titlestring.* and xconvert.* from libaudacious to audacious
mf0102
parents:
diff
changeset
|
136 if (fmt == NULL || input == NULL) |
3ec22a11c83e
[svn] - moved titlestring.* and xconvert.* from libaudacious to audacious
mf0102
parents:
diff
changeset
|
137 return NULL; |
3ec22a11c83e
[svn] - moved titlestring.* and xconvert.* from libaudacious to audacious
mf0102
parents:
diff
changeset
|
138 outstr = g_string_new(""); |
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 for (;;) { |
3ec22a11c83e
[svn] - moved titlestring.* and xconvert.* from libaudacious to audacious
mf0102
parents:
diff
changeset
|
141 /* Copy characters until we encounter '%'. */ |
3ec22a11c83e
[svn] - moved titlestring.* and xconvert.* from libaudacious to audacious
mf0102
parents:
diff
changeset
|
142 while ((c = *fmt++) != '%') { |
3ec22a11c83e
[svn] - moved titlestring.* and xconvert.* from libaudacious to audacious
mf0102
parents:
diff
changeset
|
143 if (c == '\0') |
3ec22a11c83e
[svn] - moved titlestring.* and xconvert.* from libaudacious to audacious
mf0102
parents:
diff
changeset
|
144 goto Done; |
3ec22a11c83e
[svn] - moved titlestring.* and xconvert.* from libaudacious to audacious
mf0102
parents:
diff
changeset
|
145 g_string_append_c(outstr, c); |
3ec22a11c83e
[svn] - moved titlestring.* and xconvert.* from libaudacious to audacious
mf0102
parents:
diff
changeset
|
146 } |
3ec22a11c83e
[svn] - moved titlestring.* and xconvert.* from libaudacious to audacious
mf0102
parents:
diff
changeset
|
147 |
3ec22a11c83e
[svn] - moved titlestring.* and xconvert.* from libaudacious to audacious
mf0102
parents:
diff
changeset
|
148 f_left = f_space = f_zero = 0; |
3ec22a11c83e
[svn] - moved titlestring.* and xconvert.* from libaudacious to audacious
mf0102
parents:
diff
changeset
|
149 someflag = 1; |
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 /* Parse flags. */ |
3ec22a11c83e
[svn] - moved titlestring.* and xconvert.* from libaudacious to audacious
mf0102
parents:
diff
changeset
|
153 while (someflag) { |
3ec22a11c83e
[svn] - moved titlestring.* and xconvert.* from libaudacious to audacious
mf0102
parents:
diff
changeset
|
154 switch (*fmt) { |
3ec22a11c83e
[svn] - moved titlestring.* and xconvert.* from libaudacious to audacious
mf0102
parents:
diff
changeset
|
155 case '-': |
3ec22a11c83e
[svn] - moved titlestring.* and xconvert.* from libaudacious to audacious
mf0102
parents:
diff
changeset
|
156 f_left = 1; |
3ec22a11c83e
[svn] - moved titlestring.* and xconvert.* from libaudacious to audacious
mf0102
parents:
diff
changeset
|
157 fmt++; |
3ec22a11c83e
[svn] - moved titlestring.* and xconvert.* from libaudacious to audacious
mf0102
parents:
diff
changeset
|
158 break; |
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_space = 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 '0': |
3ec22a11c83e
[svn] - moved titlestring.* and xconvert.* from libaudacious to audacious
mf0102
parents:
diff
changeset
|
164 f_zero = 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 default: |
3ec22a11c83e
[svn] - moved titlestring.* and xconvert.* from libaudacious to audacious
mf0102
parents:
diff
changeset
|
168 someflag = 0; |
3ec22a11c83e
[svn] - moved titlestring.* and xconvert.* from libaudacious to audacious
mf0102
parents:
diff
changeset
|
169 break; |
3ec22a11c83e
[svn] - moved titlestring.* and xconvert.* from libaudacious to audacious
mf0102
parents:
diff
changeset
|
170 } |
3ec22a11c83e
[svn] - moved titlestring.* and xconvert.* from libaudacious to audacious
mf0102
parents:
diff
changeset
|
171 } |
3ec22a11c83e
[svn] - moved titlestring.* and xconvert.* from libaudacious to audacious
mf0102
parents:
diff
changeset
|
172 |
3ec22a11c83e
[svn] - moved titlestring.* and xconvert.* from libaudacious to audacious
mf0102
parents:
diff
changeset
|
173 |
3ec22a11c83e
[svn] - moved titlestring.* and xconvert.* from libaudacious to audacious
mf0102
parents:
diff
changeset
|
174 /* Parse field width. */ |
3ec22a11c83e
[svn] - moved titlestring.* and xconvert.* from libaudacious to audacious
mf0102
parents:
diff
changeset
|
175 if ((c = *fmt) >= '0' && c <= '9') { |
3ec22a11c83e
[svn] - moved titlestring.* and xconvert.* from libaudacious to audacious
mf0102
parents:
diff
changeset
|
176 width = 0; |
3ec22a11c83e
[svn] - moved titlestring.* and xconvert.* from libaudacious to audacious
mf0102
parents:
diff
changeset
|
177 while ((c = *fmt++) >= '0' && c <= '9') { |
3ec22a11c83e
[svn] - moved titlestring.* and xconvert.* from libaudacious to audacious
mf0102
parents:
diff
changeset
|
178 width *= 10; |
3ec22a11c83e
[svn] - moved titlestring.* and xconvert.* from libaudacious to audacious
mf0102
parents:
diff
changeset
|
179 width += c - '0'; |
3ec22a11c83e
[svn] - moved titlestring.* and xconvert.* from libaudacious to audacious
mf0102
parents:
diff
changeset
|
180 } |
3ec22a11c83e
[svn] - moved titlestring.* and xconvert.* from libaudacious to audacious
mf0102
parents:
diff
changeset
|
181 fmt--; |
3ec22a11c83e
[svn] - moved titlestring.* and xconvert.* from libaudacious to audacious
mf0102
parents:
diff
changeset
|
182 } |
3ec22a11c83e
[svn] - moved titlestring.* and xconvert.* from libaudacious to audacious
mf0102
parents:
diff
changeset
|
183 else |
3ec22a11c83e
[svn] - moved titlestring.* and xconvert.* from libaudacious to audacious
mf0102
parents:
diff
changeset
|
184 width = -1; |
3ec22a11c83e
[svn] - moved titlestring.* and xconvert.* from libaudacious to audacious
mf0102
parents:
diff
changeset
|
185 |
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 /* Parse precision. */ |
3ec22a11c83e
[svn] - moved titlestring.* and xconvert.* from libaudacious to audacious
mf0102
parents:
diff
changeset
|
188 if (*fmt == '.') { |
3ec22a11c83e
[svn] - moved titlestring.* and xconvert.* from libaudacious to audacious
mf0102
parents:
diff
changeset
|
189 if ((c = *++fmt) >= '0' && c <= '9') { |
3ec22a11c83e
[svn] - moved titlestring.* and xconvert.* from libaudacious to audacious
mf0102
parents:
diff
changeset
|
190 precision = 0; |
3ec22a11c83e
[svn] - moved titlestring.* and xconvert.* from libaudacious to audacious
mf0102
parents:
diff
changeset
|
191 while ((c = *fmt++) >= '0' && c <= '9') { |
3ec22a11c83e
[svn] - moved titlestring.* and xconvert.* from libaudacious to audacious
mf0102
parents:
diff
changeset
|
192 precision *= 10; |
3ec22a11c83e
[svn] - moved titlestring.* and xconvert.* from libaudacious to audacious
mf0102
parents:
diff
changeset
|
193 precision += c - '0'; |
3ec22a11c83e
[svn] - moved titlestring.* and xconvert.* from libaudacious to audacious
mf0102
parents:
diff
changeset
|
194 } |
3ec22a11c83e
[svn] - moved titlestring.* and xconvert.* from libaudacious to audacious
mf0102
parents:
diff
changeset
|
195 fmt--; |
3ec22a11c83e
[svn] - moved titlestring.* and xconvert.* from libaudacious to audacious
mf0102
parents:
diff
changeset
|
196 } |
3ec22a11c83e
[svn] - moved titlestring.* and xconvert.* from libaudacious to audacious
mf0102
parents:
diff
changeset
|
197 else |
3ec22a11c83e
[svn] - moved titlestring.* and xconvert.* from libaudacious to audacious
mf0102
parents:
diff
changeset
|
198 precision = -1; |
3ec22a11c83e
[svn] - moved titlestring.* and xconvert.* from libaudacious to audacious
mf0102
parents:
diff
changeset
|
199 } |
3ec22a11c83e
[svn] - moved titlestring.* and xconvert.* from libaudacious to audacious
mf0102
parents:
diff
changeset
|
200 else |
3ec22a11c83e
[svn] - moved titlestring.* and xconvert.* from libaudacious to audacious
mf0102
parents:
diff
changeset
|
201 precision = -1; |
3ec22a11c83e
[svn] - moved titlestring.* and xconvert.* from libaudacious to audacious
mf0102
parents:
diff
changeset
|
202 |
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 /* Parse format conversion. */ |
3ec22a11c83e
[svn] - moved titlestring.* and xconvert.* from libaudacious to audacious
mf0102
parents:
diff
changeset
|
205 switch (c = *fmt++) { |
3ec22a11c83e
[svn] - moved titlestring.* and xconvert.* from libaudacious to audacious
mf0102
parents:
diff
changeset
|
206 case '}': /* close optional, just ignore */ |
3ec22a11c83e
[svn] - moved titlestring.* and xconvert.* from libaudacious to audacious
mf0102
parents:
diff
changeset
|
207 continue; |
3ec22a11c83e
[svn] - moved titlestring.* and xconvert.* from libaudacious to audacious
mf0102
parents:
diff
changeset
|
208 |
3ec22a11c83e
[svn] - moved titlestring.* and xconvert.* from libaudacious to audacious
mf0102
parents:
diff
changeset
|
209 case '{':{ /* optional entry: %{n:...%} */ |
3ec22a11c83e
[svn] - moved titlestring.* and xconvert.* from libaudacious to audacious
mf0102
parents:
diff
changeset
|
210 char n = *fmt++; |
3ec22a11c83e
[svn] - moved titlestring.* and xconvert.* from libaudacious to audacious
mf0102
parents:
diff
changeset
|
211 if (!((n == 'a' && VS(input, album_name)) || |
3ec22a11c83e
[svn] - moved titlestring.* and xconvert.* from libaudacious to audacious
mf0102
parents:
diff
changeset
|
212 (n == 'c' && VS(input, comment)) || |
3ec22a11c83e
[svn] - moved titlestring.* and xconvert.* from libaudacious to audacious
mf0102
parents:
diff
changeset
|
213 (n == 'd' && VS(input, date)) || |
3ec22a11c83e
[svn] - moved titlestring.* and xconvert.* from libaudacious to audacious
mf0102
parents:
diff
changeset
|
214 (n == 'e' && VS(input, file_ext)) || |
3ec22a11c83e
[svn] - moved titlestring.* and xconvert.* from libaudacious to audacious
mf0102
parents:
diff
changeset
|
215 (n == 'f' && VS(input, file_name)) || |
3ec22a11c83e
[svn] - moved titlestring.* and xconvert.* from libaudacious to audacious
mf0102
parents:
diff
changeset
|
216 (n == 'F' && VS(input, file_path)) || |
3ec22a11c83e
[svn] - moved titlestring.* and xconvert.* from libaudacious to audacious
mf0102
parents:
diff
changeset
|
217 (n == 'g' && VS(input, genre)) || |
3ec22a11c83e
[svn] - moved titlestring.* and xconvert.* from libaudacious to audacious
mf0102
parents:
diff
changeset
|
218 (n == 'n' && VI(input, track_number)) || |
3ec22a11c83e
[svn] - moved titlestring.* and xconvert.* from libaudacious to audacious
mf0102
parents:
diff
changeset
|
219 (n == 'p' && VS(input, performer)) || |
3ec22a11c83e
[svn] - moved titlestring.* and xconvert.* from libaudacious to audacious
mf0102
parents:
diff
changeset
|
220 (n == 't' && VS(input, track_name)) || |
3ec22a11c83e
[svn] - moved titlestring.* and xconvert.* from libaudacious to audacious
mf0102
parents:
diff
changeset
|
221 (n == 'y' && VI(input, year)))) { |
3ec22a11c83e
[svn] - moved titlestring.* and xconvert.* from libaudacious to audacious
mf0102
parents:
diff
changeset
|
222 int nl = 0; |
3ec22a11c83e
[svn] - moved titlestring.* and xconvert.* from libaudacious to audacious
mf0102
parents:
diff
changeset
|
223 char c; |
3ec22a11c83e
[svn] - moved titlestring.* and xconvert.* from libaudacious to audacious
mf0102
parents:
diff
changeset
|
224 while ((c = *fmt++)) /* until end of string */ |
3ec22a11c83e
[svn] - moved titlestring.* and xconvert.* from libaudacious to audacious
mf0102
parents:
diff
changeset
|
225 if (c == '}') /* if end of opt */ |
3ec22a11c83e
[svn] - moved titlestring.* and xconvert.* from libaudacious to audacious
mf0102
parents:
diff
changeset
|
226 if (!nl) |
3ec22a11c83e
[svn] - moved titlestring.* and xconvert.* from libaudacious to audacious
mf0102
parents:
diff
changeset
|
227 break; /* if outmost indent level */ |
3ec22a11c83e
[svn] - moved titlestring.* and xconvert.* from libaudacious to audacious
mf0102
parents:
diff
changeset
|
228 else |
3ec22a11c83e
[svn] - moved titlestring.* and xconvert.* from libaudacious to audacious
mf0102
parents:
diff
changeset
|
229 --nl; /* else reduce indent */ |
3ec22a11c83e
[svn] - moved titlestring.* and xconvert.* from libaudacious to audacious
mf0102
parents:
diff
changeset
|
230 else if (c == '{') |
3ec22a11c83e
[svn] - moved titlestring.* and xconvert.* from libaudacious to audacious
mf0102
parents:
diff
changeset
|
231 ++nl; /* increase indent */ |
3ec22a11c83e
[svn] - moved titlestring.* and xconvert.* from libaudacious to audacious
mf0102
parents:
diff
changeset
|
232 } |
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 ++fmt; |
3ec22a11c83e
[svn] - moved titlestring.* and xconvert.* from libaudacious to audacious
mf0102
parents:
diff
changeset
|
235 break; |
3ec22a11c83e
[svn] - moved titlestring.* and xconvert.* from libaudacious to audacious
mf0102
parents:
diff
changeset
|
236 } |
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 case 'a': |
3ec22a11c83e
[svn] - moved titlestring.* and xconvert.* from libaudacious to audacious
mf0102
parents:
diff
changeset
|
239 string = VS(input, album_name); |
3ec22a11c83e
[svn] - moved titlestring.* and xconvert.* from libaudacious to audacious
mf0102
parents:
diff
changeset
|
240 goto Print_string; |
3ec22a11c83e
[svn] - moved titlestring.* and xconvert.* from libaudacious to audacious
mf0102
parents:
diff
changeset
|
241 case 'c': |
3ec22a11c83e
[svn] - moved titlestring.* and xconvert.* from libaudacious to audacious
mf0102
parents:
diff
changeset
|
242 string = VS(input, comment); |
3ec22a11c83e
[svn] - moved titlestring.* and xconvert.* from libaudacious to audacious
mf0102
parents:
diff
changeset
|
243 goto Print_string; |
3ec22a11c83e
[svn] - moved titlestring.* and xconvert.* from libaudacious to audacious
mf0102
parents:
diff
changeset
|
244 case 'd': |
3ec22a11c83e
[svn] - moved titlestring.* and xconvert.* from libaudacious to audacious
mf0102
parents:
diff
changeset
|
245 string = VS(input, date); |
3ec22a11c83e
[svn] - moved titlestring.* and xconvert.* from libaudacious to audacious
mf0102
parents:
diff
changeset
|
246 goto Print_string; |
3ec22a11c83e
[svn] - moved titlestring.* and xconvert.* from libaudacious to audacious
mf0102
parents:
diff
changeset
|
247 case 'e': |
3ec22a11c83e
[svn] - moved titlestring.* and xconvert.* from libaudacious to audacious
mf0102
parents:
diff
changeset
|
248 string = VS(input, file_ext); |
3ec22a11c83e
[svn] - moved titlestring.* and xconvert.* from libaudacious to audacious
mf0102
parents:
diff
changeset
|
249 goto Print_string; |
3ec22a11c83e
[svn] - moved titlestring.* and xconvert.* from libaudacious to audacious
mf0102
parents:
diff
changeset
|
250 case 'f': |
3ec22a11c83e
[svn] - moved titlestring.* and xconvert.* from libaudacious to audacious
mf0102
parents:
diff
changeset
|
251 string = VS(input, file_name); |
3ec22a11c83e
[svn] - moved titlestring.* and xconvert.* from libaudacious to audacious
mf0102
parents:
diff
changeset
|
252 goto Print_string; |
3ec22a11c83e
[svn] - moved titlestring.* and xconvert.* from libaudacious to audacious
mf0102
parents:
diff
changeset
|
253 case 'F': |
3ec22a11c83e
[svn] - moved titlestring.* and xconvert.* from libaudacious to audacious
mf0102
parents:
diff
changeset
|
254 string = VS(input, file_path); |
3ec22a11c83e
[svn] - moved titlestring.* and xconvert.* from libaudacious to audacious
mf0102
parents:
diff
changeset
|
255 goto Print_string; |
3ec22a11c83e
[svn] - moved titlestring.* and xconvert.* from libaudacious to audacious
mf0102
parents:
diff
changeset
|
256 case 'g': |
3ec22a11c83e
[svn] - moved titlestring.* and xconvert.* from libaudacious to audacious
mf0102
parents:
diff
changeset
|
257 string = VS(input, genre); |
3ec22a11c83e
[svn] - moved titlestring.* and xconvert.* from libaudacious to audacious
mf0102
parents:
diff
changeset
|
258 goto Print_string; |
3ec22a11c83e
[svn] - moved titlestring.* and xconvert.* from libaudacious to audacious
mf0102
parents:
diff
changeset
|
259 case 'n': |
3ec22a11c83e
[svn] - moved titlestring.* and xconvert.* from libaudacious to audacious
mf0102
parents:
diff
changeset
|
260 val = VI(input, track_number); |
3ec22a11c83e
[svn] - moved titlestring.* and xconvert.* from libaudacious to audacious
mf0102
parents:
diff
changeset
|
261 goto Print_number; |
3ec22a11c83e
[svn] - moved titlestring.* and xconvert.* from libaudacious to audacious
mf0102
parents:
diff
changeset
|
262 case 'p': |
3ec22a11c83e
[svn] - moved titlestring.* and xconvert.* from libaudacious to audacious
mf0102
parents:
diff
changeset
|
263 string = VS(input, performer); |
3ec22a11c83e
[svn] - moved titlestring.* and xconvert.* from libaudacious to audacious
mf0102
parents:
diff
changeset
|
264 goto Print_string; |
3ec22a11c83e
[svn] - moved titlestring.* and xconvert.* from libaudacious to audacious
mf0102
parents:
diff
changeset
|
265 case 't': |
3ec22a11c83e
[svn] - moved titlestring.* and xconvert.* from libaudacious to audacious
mf0102
parents:
diff
changeset
|
266 string = VS(input, track_name); |
3ec22a11c83e
[svn] - moved titlestring.* and xconvert.* from libaudacious to audacious
mf0102
parents:
diff
changeset
|
267 goto Print_string; |
3ec22a11c83e
[svn] - moved titlestring.* and xconvert.* from libaudacious to audacious
mf0102
parents:
diff
changeset
|
268 case 'y': |
3ec22a11c83e
[svn] - moved titlestring.* and xconvert.* from libaudacious to audacious
mf0102
parents:
diff
changeset
|
269 val = VI(input, year); |
3ec22a11c83e
[svn] - moved titlestring.* and xconvert.* from libaudacious to audacious
mf0102
parents:
diff
changeset
|
270 goto Print_number; |
3ec22a11c83e
[svn] - moved titlestring.* and xconvert.* from libaudacious to audacious
mf0102
parents:
diff
changeset
|
271 |
3ec22a11c83e
[svn] - moved titlestring.* and xconvert.* from libaudacious to audacious
mf0102
parents:
diff
changeset
|
272 Print_string: |
3ec22a11c83e
[svn] - moved titlestring.* and xconvert.* from libaudacious to audacious
mf0102
parents:
diff
changeset
|
273 if (string == NULL) |
3ec22a11c83e
[svn] - moved titlestring.* and xconvert.* from libaudacious to audacious
mf0102
parents:
diff
changeset
|
274 break; |
3ec22a11c83e
[svn] - moved titlestring.* and xconvert.* from libaudacious to audacious
mf0102
parents:
diff
changeset
|
275 did_output = TRUE; |
3ec22a11c83e
[svn] - moved titlestring.* and xconvert.* from libaudacious to audacious
mf0102
parents:
diff
changeset
|
276 |
3ec22a11c83e
[svn] - moved titlestring.* and xconvert.* from libaudacious to audacious
mf0102
parents:
diff
changeset
|
277 numpr = 0; |
3ec22a11c83e
[svn] - moved titlestring.* and xconvert.* from libaudacious to audacious
mf0102
parents:
diff
changeset
|
278 if (width > 0) { |
3ec22a11c83e
[svn] - moved titlestring.* and xconvert.* from libaudacious to audacious
mf0102
parents:
diff
changeset
|
279 /* Calculate printed size. */ |
3ec22a11c83e
[svn] - moved titlestring.* and xconvert.* from libaudacious to audacious
mf0102
parents:
diff
changeset
|
280 numpr = strlen(string); |
3ec22a11c83e
[svn] - moved titlestring.* and xconvert.* from libaudacious to audacious
mf0102
parents:
diff
changeset
|
281 if (precision >= 0 && precision < numpr) |
3ec22a11c83e
[svn] - moved titlestring.* and xconvert.* from libaudacious to audacious
mf0102
parents:
diff
changeset
|
282 numpr = precision; |
3ec22a11c83e
[svn] - moved titlestring.* and xconvert.* from libaudacious to audacious
mf0102
parents:
diff
changeset
|
283 |
3ec22a11c83e
[svn] - moved titlestring.* and xconvert.* from libaudacious to audacious
mf0102
parents:
diff
changeset
|
284 LEFTPAD(width - numpr); |
3ec22a11c83e
[svn] - moved titlestring.* and xconvert.* from libaudacious to audacious
mf0102
parents:
diff
changeset
|
285 } |
3ec22a11c83e
[svn] - moved titlestring.* and xconvert.* from libaudacious to audacious
mf0102
parents:
diff
changeset
|
286 |
3ec22a11c83e
[svn] - moved titlestring.* and xconvert.* from libaudacious to audacious
mf0102
parents:
diff
changeset
|
287 /* Insert string. */ |
3ec22a11c83e
[svn] - moved titlestring.* and xconvert.* from libaudacious to audacious
mf0102
parents:
diff
changeset
|
288 if (precision >= 0) { |
3ec22a11c83e
[svn] - moved titlestring.* and xconvert.* from libaudacious to audacious
mf0102
parents:
diff
changeset
|
289 glong offset_max = precision, offset; |
3ec22a11c83e
[svn] - moved titlestring.* and xconvert.* from libaudacious to audacious
mf0102
parents:
diff
changeset
|
290 gchar *uptr = NULL; |
3ec22a11c83e
[svn] - moved titlestring.* and xconvert.* from libaudacious to audacious
mf0102
parents:
diff
changeset
|
291 const gchar *tmpstring = string; |
3ec22a11c83e
[svn] - moved titlestring.* and xconvert.* from libaudacious to audacious
mf0102
parents:
diff
changeset
|
292 while (precision > 0) { |
3ec22a11c83e
[svn] - moved titlestring.* and xconvert.* from libaudacious to audacious
mf0102
parents:
diff
changeset
|
293 offset = offset_max - precision; |
3ec22a11c83e
[svn] - moved titlestring.* and xconvert.* from libaudacious to audacious
mf0102
parents:
diff
changeset
|
294 uptr = g_utf8_offset_to_pointer(tmpstring, offset); |
3ec22a11c83e
[svn] - moved titlestring.* and xconvert.* from libaudacious to audacious
mf0102
parents:
diff
changeset
|
295 if (*uptr == '\0') |
3ec22a11c83e
[svn] - moved titlestring.* and xconvert.* from libaudacious to audacious
mf0102
parents:
diff
changeset
|
296 break; |
3ec22a11c83e
[svn] - moved titlestring.* and xconvert.* from libaudacious to audacious
mf0102
parents:
diff
changeset
|
297 g_string_append_unichar(outstr, g_utf8_get_char(uptr)); |
3ec22a11c83e
[svn] - moved titlestring.* and xconvert.* from libaudacious to audacious
mf0102
parents:
diff
changeset
|
298 precision--; |
3ec22a11c83e
[svn] - moved titlestring.* and xconvert.* from libaudacious to audacious
mf0102
parents:
diff
changeset
|
299 } |
3ec22a11c83e
[svn] - moved titlestring.* and xconvert.* from libaudacious to audacious
mf0102
parents:
diff
changeset
|
300 } |
3ec22a11c83e
[svn] - moved titlestring.* and xconvert.* from libaudacious to audacious
mf0102
parents:
diff
changeset
|
301 else { |
3ec22a11c83e
[svn] - moved titlestring.* and xconvert.* from libaudacious to audacious
mf0102
parents:
diff
changeset
|
302 while ((c = *string++) != '\0') |
3ec22a11c83e
[svn] - moved titlestring.* and xconvert.* from libaudacious to audacious
mf0102
parents:
diff
changeset
|
303 PUTCH(c); |
3ec22a11c83e
[svn] - moved titlestring.* and xconvert.* from libaudacious to audacious
mf0102
parents:
diff
changeset
|
304 } |
3ec22a11c83e
[svn] - moved titlestring.* and xconvert.* from libaudacious to audacious
mf0102
parents:
diff
changeset
|
305 |
3ec22a11c83e
[svn] - moved titlestring.* and xconvert.* from libaudacious to audacious
mf0102
parents:
diff
changeset
|
306 RIGHTPAD(width - numpr); |
3ec22a11c83e
[svn] - moved titlestring.* and xconvert.* from libaudacious to audacious
mf0102
parents:
diff
changeset
|
307 break; |
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 Print_number: |
3ec22a11c83e
[svn] - moved titlestring.* and xconvert.* from libaudacious to audacious
mf0102
parents:
diff
changeset
|
310 if (val == 0) |
3ec22a11c83e
[svn] - moved titlestring.* and xconvert.* from libaudacious to audacious
mf0102
parents:
diff
changeset
|
311 break; |
3ec22a11c83e
[svn] - moved titlestring.* and xconvert.* from libaudacious to audacious
mf0102
parents:
diff
changeset
|
312 if (c != 'N') |
3ec22a11c83e
[svn] - moved titlestring.* and xconvert.* from libaudacious to audacious
mf0102
parents:
diff
changeset
|
313 did_output = TRUE; |
3ec22a11c83e
[svn] - moved titlestring.* and xconvert.* from libaudacious to audacious
mf0102
parents:
diff
changeset
|
314 |
3ec22a11c83e
[svn] - moved titlestring.* and xconvert.* from libaudacious to audacious
mf0102
parents:
diff
changeset
|
315 /* Create reversed number string. */ |
3ec22a11c83e
[svn] - moved titlestring.* and xconvert.* from libaudacious to audacious
mf0102
parents:
diff
changeset
|
316 numdigits = 0; |
3ec22a11c83e
[svn] - moved titlestring.* and xconvert.* from libaudacious to audacious
mf0102
parents:
diff
changeset
|
317 do { |
3ec22a11c83e
[svn] - moved titlestring.* and xconvert.* from libaudacious to audacious
mf0102
parents:
diff
changeset
|
318 convert[numdigits++] = digits[val % 10]; |
3ec22a11c83e
[svn] - moved titlestring.* and xconvert.* from libaudacious to audacious
mf0102
parents:
diff
changeset
|
319 val /= 10; |
3ec22a11c83e
[svn] - moved titlestring.* and xconvert.* from libaudacious to audacious
mf0102
parents:
diff
changeset
|
320 } |
3ec22a11c83e
[svn] - moved titlestring.* and xconvert.* from libaudacious to audacious
mf0102
parents:
diff
changeset
|
321 while (val > 0); |
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 numpr = numdigits > precision ? numdigits : precision; |
3ec22a11c83e
[svn] - moved titlestring.* and xconvert.* from libaudacious to audacious
mf0102
parents:
diff
changeset
|
324 |
3ec22a11c83e
[svn] - moved titlestring.* and xconvert.* from libaudacious to audacious
mf0102
parents:
diff
changeset
|
325 /* Insert left padding. */ |
3ec22a11c83e
[svn] - moved titlestring.* and xconvert.* from libaudacious to audacious
mf0102
parents:
diff
changeset
|
326 if (!f_left && width > numpr) { |
3ec22a11c83e
[svn] - moved titlestring.* and xconvert.* from libaudacious to audacious
mf0102
parents:
diff
changeset
|
327 if (f_zero) |
3ec22a11c83e
[svn] - moved titlestring.* and xconvert.* from libaudacious to audacious
mf0102
parents:
diff
changeset
|
328 numpr = width; |
3ec22a11c83e
[svn] - moved titlestring.* and xconvert.* from libaudacious to audacious
mf0102
parents:
diff
changeset
|
329 else |
3ec22a11c83e
[svn] - moved titlestring.* and xconvert.* from libaudacious to audacious
mf0102
parents:
diff
changeset
|
330 for (i = width - numpr; i-- > 0;) |
3ec22a11c83e
[svn] - moved titlestring.* and xconvert.* from libaudacious to audacious
mf0102
parents:
diff
changeset
|
331 PUTCH(' '); |
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 |
3ec22a11c83e
[svn] - moved titlestring.* and xconvert.* from libaudacious to audacious
mf0102
parents:
diff
changeset
|
334 /* Insert zero padding. */ |
3ec22a11c83e
[svn] - moved titlestring.* and xconvert.* from libaudacious to audacious
mf0102
parents:
diff
changeset
|
335 for (i = numpr - numdigits; i-- > 0;) |
3ec22a11c83e
[svn] - moved titlestring.* and xconvert.* from libaudacious to audacious
mf0102
parents:
diff
changeset
|
336 PUTCH('0'); |
3ec22a11c83e
[svn] - moved titlestring.* and xconvert.* from libaudacious to audacious
mf0102
parents:
diff
changeset
|
337 |
3ec22a11c83e
[svn] - moved titlestring.* and xconvert.* from libaudacious to audacious
mf0102
parents:
diff
changeset
|
338 /* Insert number. */ |
3ec22a11c83e
[svn] - moved titlestring.* and xconvert.* from libaudacious to audacious
mf0102
parents:
diff
changeset
|
339 while (numdigits > 0) |
3ec22a11c83e
[svn] - moved titlestring.* and xconvert.* from libaudacious to audacious
mf0102
parents:
diff
changeset
|
340 PUTCH(convert[--numdigits]); |
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 RIGHTPAD(width - numpr); |
3ec22a11c83e
[svn] - moved titlestring.* and xconvert.* from libaudacious to audacious
mf0102
parents:
diff
changeset
|
343 break; |
3ec22a11c83e
[svn] - moved titlestring.* and xconvert.* from libaudacious to audacious
mf0102
parents:
diff
changeset
|
344 |
3ec22a11c83e
[svn] - moved titlestring.* and xconvert.* from libaudacious to audacious
mf0102
parents:
diff
changeset
|
345 case '%': |
3ec22a11c83e
[svn] - moved titlestring.* and xconvert.* from libaudacious to audacious
mf0102
parents:
diff
changeset
|
346 PUTCH('%'); |
3ec22a11c83e
[svn] - moved titlestring.* and xconvert.* from libaudacious to audacious
mf0102
parents:
diff
changeset
|
347 break; |
3ec22a11c83e
[svn] - moved titlestring.* and xconvert.* from libaudacious to audacious
mf0102
parents:
diff
changeset
|
348 |
3ec22a11c83e
[svn] - moved titlestring.* and xconvert.* from libaudacious to audacious
mf0102
parents:
diff
changeset
|
349 default: |
3ec22a11c83e
[svn] - moved titlestring.* and xconvert.* from libaudacious to audacious
mf0102
parents:
diff
changeset
|
350 PUTCH('%'); |
3ec22a11c83e
[svn] - moved titlestring.* and xconvert.* from libaudacious to audacious
mf0102
parents:
diff
changeset
|
351 PUTCH(c); |
3ec22a11c83e
[svn] - moved titlestring.* and xconvert.* from libaudacious to audacious
mf0102
parents:
diff
changeset
|
352 break; |
3ec22a11c83e
[svn] - moved titlestring.* and xconvert.* from libaudacious to audacious
mf0102
parents:
diff
changeset
|
353 } |
3ec22a11c83e
[svn] - moved titlestring.* and xconvert.* from libaudacious to audacious
mf0102
parents:
diff
changeset
|
354 } |
3ec22a11c83e
[svn] - moved titlestring.* and xconvert.* from libaudacious to audacious
mf0102
parents:
diff
changeset
|
355 |
3ec22a11c83e
[svn] - moved titlestring.* and xconvert.* from libaudacious to audacious
mf0102
parents:
diff
changeset
|
356 Done: |
3ec22a11c83e
[svn] - moved titlestring.* and xconvert.* from libaudacious to audacious
mf0102
parents:
diff
changeset
|
357 if (did_output) |
3ec22a11c83e
[svn] - moved titlestring.* and xconvert.* from libaudacious to audacious
mf0102
parents:
diff
changeset
|
358 return g_string_free(outstr, FALSE); |
3ec22a11c83e
[svn] - moved titlestring.* and xconvert.* from libaudacious to audacious
mf0102
parents:
diff
changeset
|
359 else |
3ec22a11c83e
[svn] - moved titlestring.* and xconvert.* from libaudacious to audacious
mf0102
parents:
diff
changeset
|
360 return NULL; |
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 struct _TagDescription { |
3ec22a11c83e
[svn] - moved titlestring.* and xconvert.* from libaudacious to audacious
mf0102
parents:
diff
changeset
|
364 gchar tag; |
3ec22a11c83e
[svn] - moved titlestring.* and xconvert.* from libaudacious to audacious
mf0102
parents:
diff
changeset
|
365 gchar *description; |
3ec22a11c83e
[svn] - moved titlestring.* and xconvert.* from libaudacious to audacious
mf0102
parents:
diff
changeset
|
366 }; |
3ec22a11c83e
[svn] - moved titlestring.* and xconvert.* from libaudacious to audacious
mf0102
parents:
diff
changeset
|
367 |
3ec22a11c83e
[svn] - moved titlestring.* and xconvert.* from libaudacious to audacious
mf0102
parents:
diff
changeset
|
368 typedef struct _TagDescription TagDescription; |
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 static TagDescription tag_descriptions[] = { |
3ec22a11c83e
[svn] - moved titlestring.* and xconvert.* from libaudacious to audacious
mf0102
parents:
diff
changeset
|
371 {'p', N_("Performer/Artist")}, |
3ec22a11c83e
[svn] - moved titlestring.* and xconvert.* from libaudacious to audacious
mf0102
parents:
diff
changeset
|
372 {'a', N_("Album")}, |
3ec22a11c83e
[svn] - moved titlestring.* and xconvert.* from libaudacious to audacious
mf0102
parents:
diff
changeset
|
373 {'g', N_("Genre")}, |
3ec22a11c83e
[svn] - moved titlestring.* and xconvert.* from libaudacious to audacious
mf0102
parents:
diff
changeset
|
374 {'f', N_("File name")}, |
3ec22a11c83e
[svn] - moved titlestring.* and xconvert.* from libaudacious to audacious
mf0102
parents:
diff
changeset
|
375 {'F', N_("File path")}, |
3ec22a11c83e
[svn] - moved titlestring.* and xconvert.* from libaudacious to audacious
mf0102
parents:
diff
changeset
|
376 {'e', N_("File extension")}, |
3ec22a11c83e
[svn] - moved titlestring.* and xconvert.* from libaudacious to audacious
mf0102
parents:
diff
changeset
|
377 {'t', N_("Track name")}, |
3ec22a11c83e
[svn] - moved titlestring.* and xconvert.* from libaudacious to audacious
mf0102
parents:
diff
changeset
|
378 {'n', N_("Track number")}, |
3ec22a11c83e
[svn] - moved titlestring.* and xconvert.* from libaudacious to audacious
mf0102
parents:
diff
changeset
|
379 {'d', N_("Date")}, |
3ec22a11c83e
[svn] - moved titlestring.* and xconvert.* from libaudacious to audacious
mf0102
parents:
diff
changeset
|
380 {'y', N_("Year")}, |
3ec22a11c83e
[svn] - moved titlestring.* and xconvert.* from libaudacious to audacious
mf0102
parents:
diff
changeset
|
381 {'c', N_("Comment")} |
3ec22a11c83e
[svn] - moved titlestring.* and xconvert.* from libaudacious to audacious
mf0102
parents:
diff
changeset
|
382 }; |
3ec22a11c83e
[svn] - moved titlestring.* and xconvert.* from libaudacious to audacious
mf0102
parents:
diff
changeset
|
383 |
3ec22a11c83e
[svn] - moved titlestring.* and xconvert.* from libaudacious to audacious
mf0102
parents:
diff
changeset
|
384 gint tag_descriptions_length = |
3ec22a11c83e
[svn] - moved titlestring.* and xconvert.* from libaudacious to audacious
mf0102
parents:
diff
changeset
|
385 sizeof(tag_descriptions) / sizeof(TagDescription); |
3ec22a11c83e
[svn] - moved titlestring.* and xconvert.* from libaudacious to audacious
mf0102
parents:
diff
changeset
|
386 |
3ec22a11c83e
[svn] - moved titlestring.* and xconvert.* from libaudacious to audacious
mf0102
parents:
diff
changeset
|
387 /** |
3ec22a11c83e
[svn] - moved titlestring.* and xconvert.* from libaudacious to audacious
mf0102
parents:
diff
changeset
|
388 * xmms_titlestring_descriptions: |
3ec22a11c83e
[svn] - moved titlestring.* and xconvert.* from libaudacious to audacious
mf0102
parents:
diff
changeset
|
389 * @tags: A list of formatters to provide. |
3ec22a11c83e
[svn] - moved titlestring.* and xconvert.* from libaudacious to audacious
mf0102
parents:
diff
changeset
|
390 * @columns: A number of columns to arrange them in. |
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 * Generates a box explaining how to use the formatters. |
3ec22a11c83e
[svn] - moved titlestring.* and xconvert.* from libaudacious to audacious
mf0102
parents:
diff
changeset
|
393 * |
3ec22a11c83e
[svn] - moved titlestring.* and xconvert.* from libaudacious to audacious
mf0102
parents:
diff
changeset
|
394 * Return value: A GtkWidget containing the table. |
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 GtkWidget * |
3ec22a11c83e
[svn] - moved titlestring.* and xconvert.* from libaudacious to audacious
mf0102
parents:
diff
changeset
|
397 xmms_titlestring_descriptions(gchar * tags, gint columns) |
3ec22a11c83e
[svn] - moved titlestring.* and xconvert.* from libaudacious to audacious
mf0102
parents:
diff
changeset
|
398 { |
3ec22a11c83e
[svn] - moved titlestring.* and xconvert.* from libaudacious to audacious
mf0102
parents:
diff
changeset
|
399 GtkWidget *table, *label; |
3ec22a11c83e
[svn] - moved titlestring.* and xconvert.* from libaudacious to audacious
mf0102
parents:
diff
changeset
|
400 gchar tag_str[5]; |
3ec22a11c83e
[svn] - moved titlestring.* and xconvert.* from libaudacious to audacious
mf0102
parents:
diff
changeset
|
401 gint num = strlen(tags); |
3ec22a11c83e
[svn] - moved titlestring.* and xconvert.* from libaudacious to audacious
mf0102
parents:
diff
changeset
|
402 gint r = 0, c, i; |
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 g_return_val_if_fail(tags != NULL, NULL); |
3ec22a11c83e
[svn] - moved titlestring.* and xconvert.* from libaudacious to audacious
mf0102
parents:
diff
changeset
|
405 g_return_val_if_fail(columns <= num, NULL); |
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 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
|
408 gtk_table_set_row_spacings(GTK_TABLE(table), 2); |
3ec22a11c83e
[svn] - moved titlestring.* and xconvert.* from libaudacious to audacious
mf0102
parents:
diff
changeset
|
409 gtk_table_set_col_spacings(GTK_TABLE(table), 5); |
3ec22a11c83e
[svn] - moved titlestring.* and xconvert.* from libaudacious to audacious
mf0102
parents:
diff
changeset
|
410 |
3ec22a11c83e
[svn] - moved titlestring.* and xconvert.* from libaudacious to audacious
mf0102
parents:
diff
changeset
|
411 for (c = 0; c < columns; c++) { |
3ec22a11c83e
[svn] - moved titlestring.* and xconvert.* from libaudacious to audacious
mf0102
parents:
diff
changeset
|
412 for (r = 0; r < (num + columns - 1 - c) / columns; r++) { |
3ec22a11c83e
[svn] - moved titlestring.* and xconvert.* from libaudacious to audacious
mf0102
parents:
diff
changeset
|
413 g_snprintf(tag_str, sizeof(tag_str), "%%%c:", *tags); |
3ec22a11c83e
[svn] - moved titlestring.* and xconvert.* from libaudacious to audacious
mf0102
parents:
diff
changeset
|
414 label = gtk_label_new(tag_str); |
3ec22a11c83e
[svn] - moved titlestring.* and xconvert.* from libaudacious to audacious
mf0102
parents:
diff
changeset
|
415 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
|
416 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
|
417 r + 1, GTK_FILL, GTK_FILL, 0, 0); |
3ec22a11c83e
[svn] - moved titlestring.* and xconvert.* from libaudacious to audacious
mf0102
parents:
diff
changeset
|
418 gtk_widget_show(label); |
3ec22a11c83e
[svn] - moved titlestring.* and xconvert.* from libaudacious to audacious
mf0102
parents:
diff
changeset
|
419 |
3ec22a11c83e
[svn] - moved titlestring.* and xconvert.* from libaudacious to audacious
mf0102
parents:
diff
changeset
|
420 for (i = 0; i < tag_descriptions_length; i++) { |
3ec22a11c83e
[svn] - moved titlestring.* and xconvert.* from libaudacious to audacious
mf0102
parents:
diff
changeset
|
421 if (*tags == tag_descriptions[i].tag) { |
3ec22a11c83e
[svn] - moved titlestring.* and xconvert.* from libaudacious to audacious
mf0102
parents:
diff
changeset
|
422 label = gtk_label_new(_(tag_descriptions[i].description)); |
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 + 1, |
3ec22a11c83e
[svn] - moved titlestring.* and xconvert.* from libaudacious to audacious
mf0102
parents:
diff
changeset
|
425 2 * c + 2, r, r + 1, |
3ec22a11c83e
[svn] - moved titlestring.* and xconvert.* from libaudacious to audacious
mf0102
parents:
diff
changeset
|
426 GTK_EXPAND | GTK_FILL, |
3ec22a11c83e
[svn] - moved titlestring.* and xconvert.* from libaudacious to audacious
mf0102
parents:
diff
changeset
|
427 GTK_EXPAND | GTK_FILL, 0, 0); |
3ec22a11c83e
[svn] - moved titlestring.* and xconvert.* from libaudacious to audacious
mf0102
parents:
diff
changeset
|
428 gtk_widget_show(label); |
3ec22a11c83e
[svn] - moved titlestring.* and xconvert.* from libaudacious to audacious
mf0102
parents:
diff
changeset
|
429 break; |
3ec22a11c83e
[svn] - moved titlestring.* and xconvert.* from libaudacious to audacious
mf0102
parents:
diff
changeset
|
430 } |
3ec22a11c83e
[svn] - moved titlestring.* and xconvert.* from libaudacious to audacious
mf0102
parents:
diff
changeset
|
431 } |
3ec22a11c83e
[svn] - moved titlestring.* and xconvert.* from libaudacious to audacious
mf0102
parents:
diff
changeset
|
432 |
3ec22a11c83e
[svn] - moved titlestring.* and xconvert.* from libaudacious to audacious
mf0102
parents:
diff
changeset
|
433 if (i == tag_descriptions_length) |
3ec22a11c83e
[svn] - moved titlestring.* and xconvert.* from libaudacious to audacious
mf0102
parents:
diff
changeset
|
434 g_warning("Invalid tag: %c", *tags); |
3ec22a11c83e
[svn] - moved titlestring.* and xconvert.* from libaudacious to audacious
mf0102
parents:
diff
changeset
|
435 |
3ec22a11c83e
[svn] - moved titlestring.* and xconvert.* from libaudacious to audacious
mf0102
parents:
diff
changeset
|
436 tags++; |
3ec22a11c83e
[svn] - moved titlestring.* and xconvert.* from libaudacious to audacious
mf0102
parents:
diff
changeset
|
437 } |
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 label = gtk_label_new(_("%{n:...%}: Display \"...\" only if element " |
3ec22a11c83e
[svn] - moved titlestring.* and xconvert.* from libaudacious to audacious
mf0102
parents:
diff
changeset
|
442 "%n is present")); |
3ec22a11c83e
[svn] - moved titlestring.* and xconvert.* from libaudacious to audacious
mf0102
parents:
diff
changeset
|
443 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
|
444 gtk_table_attach(GTK_TABLE(table), label, 0, r + 1, |
3ec22a11c83e
[svn] - moved titlestring.* and xconvert.* from libaudacious to audacious
mf0102
parents:
diff
changeset
|
445 r + 1, r + 2, GTK_FILL, GTK_FILL, 0, 0); |
3ec22a11c83e
[svn] - moved titlestring.* and xconvert.* from libaudacious to audacious
mf0102
parents:
diff
changeset
|
446 gtk_widget_show(label); |
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 return table; |
3ec22a11c83e
[svn] - moved titlestring.* and xconvert.* from libaudacious to audacious
mf0102
parents:
diff
changeset
|
449 } |