1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
|
diff -dPNur xmms-1.2.11/libxmms/configure.in xmms-1.2.11-new/libxmms/configure.in
--- xmms-1.2.11/libxmms/configure.in 2007-11-16 22:51:24.000000000 +0100
+++ xmms-1.2.11-new/libxmms/configure.in 2007-11-25 17:38:56.000000000 +0100
@@ -57,6 +57,16 @@
AC_DEFINE([HAVE_CODESET],,[Define if nl_langinfo(CODESET) is available.])
fi
+AC_CHECK_LIB(rccgtk, rccUiInit,[
+ AC_CHECK_HEADERS(librcc.h librccui.h,[
+ LIBRCC_LIBS="-lrccgtk"
+ LIBRCC_INCLUDES=""
+ ],[
+ LIBRCC_LIBS=""
+ LIBRCC_INCLUDES=""
+])])
+AC_SUBST(LIBRCC_LIBS)
+AC_SUBST(LIBRCC_INCLUDES)
AC_OUTPUT([
Makefile
diff -dPNur xmms-1.2.11/libxmms/Makefile.am xmms-1.2.11-new/libxmms/Makefile.am
--- xmms-1.2.11/libxmms/Makefile.am 2004-04-04 10:51:20.000000000 +0200
+++ xmms-1.2.11-new/libxmms/Makefile.am 2007-11-25 17:38:56.000000000 +0100
@@ -4,10 +4,11 @@
lib_LTLIBRARIES = libxmms.la
libxmms_la_LDFLAGS = -export-dynamic -version-info $(LIBXMMS_MAJOR_VERSION):$(LIBXMMS_MINOR_VERSION):$(LIBXMMS_MICRO_VERSION)
-libxmms_la_LIBADD = @GTK_LIBS@ @POSIX_LIBS@
-INCLUDES = @GTK_CFLAGS@ -I../intl -I..
+libxmms_la_LIBADD = @LIBRCC_LIBS@ @GTK_LIBS@ @POSIX_LIBS@
+INCLUDES = @LIBRCC_INCLUDES@ @GTK_CFLAGS@ -I../intl -I..
libxmms_la_SOURCES = \
+rcc.c rcc.h rcc_langs.h \
configfile.c configfile.h \
xmmsctrl.c xmmsctrl.h \
dirbrowser.c dirbrowser.h \
diff -dPNur xmms-1.2.11/libxmms/titlestring.c xmms-1.2.11-new/libxmms/titlestring.c
--- xmms-1.2.11/libxmms/titlestring.c 2006-07-24 00:11:51.000000000 +0200
+++ xmms-1.2.11-new/libxmms/titlestring.c 2007-11-25 17:39:21.000000000 +0100
@@ -29,6 +29,7 @@
#include <string.h>
#include <ctype.h>
+#include "rcc.h"
#include "titlestring.h"
#include "../xmms/i18n.h"
@@ -42,8 +43,9 @@
PAD_SIDE_RIGHT,
};
+#define xmms_vputstr(out, pstr, pad) xmms_charset_vputstr(out, pstr, pad, from, pflag, c)
-static int xmms_vputstr(GString *output, char *pstr, struct padding *pad)
+static int xmms_orig_vputstr(GString *output, char *pstr, struct padding *pad)
{
int i;
/* Lenght of the string that is actually printed */
@@ -83,6 +85,22 @@
return TRUE;
}
+static int xmms_charset_vputstr(GString *output, char *pstr, struct padding *pad, int from, gint pflag, char c) {
+ int res;
+ gchar *cstring = NULL;
+
+ if ((pflag&1)&&((c=='f')||(c=='F'))) {
+ cstring = xmms_rcc_recode(XMMS_RCC_FS, XMMS_RCC_CTYPE, pstr);
+ }
+ if ((pflag&2)&&((c=='a')||(c=='c')||(c=='g')||(c=='p')||(c=='t'))) {
+ cstring = xmms_rcc_recode((xmms_rcc_class)from, XMMS_RCC_CTYPE, pstr);
+ }
+
+ res = xmms_orig_vputstr(output, cstring?cstring:pstr, pad);
+ if (cstring) g_free(cstring);
+
+ return res;
+}
static int xmms_vputnum(GString *output, int ival, struct padding *pad)
{
@@ -124,7 +142,7 @@
return TRUE;
}
-static int parse_variable(char **fmt, GString *string, TitleInput *input)
+static int parse_variable(char **fmt, GString *string, TitleInput *input, int from, gint pflag)
{
struct padding padding;
char *ptr = *fmt;
@@ -237,9 +255,33 @@
return exp;
}
+static int xmms_charset_analyze_fmt(gchar *fmt) {
+ int flag = 0;
+
+ if (!fmt) return 0;
+ for (;*fmt;fmt++) {
+ while ((*fmt != '%')&&(*fmt != 0)) fmt++;
+ if (!*fmt) break;
+ while ((*fmt == '-')||(*fmt == ' ')||(*fmt == '0')) fmt++;
+ while (*fmt >= '0' && *fmt <= '9') fmt++;
+ if (*fmt == '.') { fmt++; while (*fmt >= '0' && *fmt <= '9') fmt++; }
+ if ((*fmt=='a')||(*fmt=='c')||(*fmt=='g')||(*fmt=='p')||(*fmt=='t')) flag|=1;
+ if ((*fmt=='f')||(*fmt=='F')) flag|=2;
+ }
+
+ return flag;
+}
+
+gchar *xmms_charset_get_titlestring(gchar *fmt, TitleInput *input, int from);
char *xmms_get_titlestring(char *fmt, TitleInput *input)
{
+ return xmms_charset_get_titlestring(fmt, input, (xmms_rcc_class)-1);
+}
+
+gchar *xmms_charset_get_titlestring(gchar *fmt, TitleInput *input, int from) {
+ gint pflag;
+ gchar *cstring = NULL;
int f_output = 0;
GString *string;
char *strptr;
@@ -249,12 +291,14 @@
string = g_string_new("");
+ pflag = (from == (xmms_rcc_class)-1)?0:xmms_charset_analyze_fmt(fmt);
+
while (*fmt)
{
if (*fmt == '%')
{
fmt++;
- f_output += parse_variable(&fmt, string, input);
+ f_output += parse_variable(&fmt, string, input, from, pflag);
}
else
/* Normal character */
@@ -271,6 +315,19 @@
/* Return the result */
strptr = string->str;
g_string_free(string, FALSE);
+
+ if (pflag<3) {
+ if (pflag&2)
+ cstring = xmms_rcc_recode(XMMS_RCC_FS, XMMS_RCC_CTYPE, strptr);
+ else
+ cstring = xmms_rcc_recode((xmms_rcc_class)from, XMMS_RCC_CTYPE, strptr);
+
+ if (cstring) {
+ g_free(strptr);
+ return cstring;
+ }
+ }
+
return strptr;
}
diff -dPNur xmms-1.2.11/libxmms/titlestring.h xmms-1.2.11-new/libxmms/titlestring.h
--- xmms-1.2.11/libxmms/titlestring.h 2005-05-15 02:01:20.000000000 +0200
+++ xmms-1.2.11-new/libxmms/titlestring.h 2007-11-25 17:38:56.000000000 +0100
@@ -77,6 +77,7 @@
#endif
gchar *xmms_get_titlestring(gchar *fmt, TitleInput *input);
+gchar *xmms_charset_get_titlestring(gchar *fmt, TitleInput *input, int from);
GtkWidget* xmms_titlestring_descriptions(char* tags, int rows);
#ifdef __cplusplus
|