annotate gui/app/cfg-old.c @ 35871:8f49b68dd955

Add a function converting into locale encoding. This is for compatibility reasons, because the content of the history file will change from UTF-8 encoded filenames to filenames in their original byte sequence. (The cfg-old.c file is meant to save the user the effort of manually changing any settings or options that have become obsolete. The file will be subject to removal some day. It will be included where necessary.)
author ib
date Fri, 15 Mar 2013 03:42:57 +0000
parents
children 93ab56bda68a
Ignore whitespace changes - Everywhere: Within whitespace: At end of lines:
rev   line source
35871
8f49b68dd955 Add a function converting into locale encoding.
ib
parents:
diff changeset
1 /*
8f49b68dd955 Add a function converting into locale encoding.
ib
parents:
diff changeset
2 * This file is part of MPlayer.
8f49b68dd955 Add a function converting into locale encoding.
ib
parents:
diff changeset
3 *
8f49b68dd955 Add a function converting into locale encoding.
ib
parents:
diff changeset
4 * MPlayer is free software; you can redistribute it and/or modify
8f49b68dd955 Add a function converting into locale encoding.
ib
parents:
diff changeset
5 * it under the terms of the GNU General Public License as published by
8f49b68dd955 Add a function converting into locale encoding.
ib
parents:
diff changeset
6 * the Free Software Foundation; either version 2 of the License, or
8f49b68dd955 Add a function converting into locale encoding.
ib
parents:
diff changeset
7 * (at your option) any later version.
8f49b68dd955 Add a function converting into locale encoding.
ib
parents:
diff changeset
8 *
8f49b68dd955 Add a function converting into locale encoding.
ib
parents:
diff changeset
9 * MPlayer is distributed in the hope that it will be useful,
8f49b68dd955 Add a function converting into locale encoding.
ib
parents:
diff changeset
10 * but WITHOUT ANY WARRANTY; without even the implied warranty of
8f49b68dd955 Add a function converting into locale encoding.
ib
parents:
diff changeset
11 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
8f49b68dd955 Add a function converting into locale encoding.
ib
parents:
diff changeset
12 * GNU General Public License for more details.
8f49b68dd955 Add a function converting into locale encoding.
ib
parents:
diff changeset
13 *
8f49b68dd955 Add a function converting into locale encoding.
ib
parents:
diff changeset
14 * You should have received a copy of the GNU General Public License along
8f49b68dd955 Add a function converting into locale encoding.
ib
parents:
diff changeset
15 * with MPlayer; if not, write to the Free Software Foundation, Inc.,
8f49b68dd955 Add a function converting into locale encoding.
ib
parents:
diff changeset
16 * 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA.
8f49b68dd955 Add a function converting into locale encoding.
ib
parents:
diff changeset
17 */
8f49b68dd955 Add a function converting into locale encoding.
ib
parents:
diff changeset
18
8f49b68dd955 Add a function converting into locale encoding.
ib
parents:
diff changeset
19 /**
8f49b68dd955 Add a function converting into locale encoding.
ib
parents:
diff changeset
20 * @file
8f49b68dd955 Add a function converting into locale encoding.
ib
parents:
diff changeset
21 * @brief Translation of old settings or old configure options
8f49b68dd955 Add a function converting into locale encoding.
ib
parents:
diff changeset
22 */
8f49b68dd955 Add a function converting into locale encoding.
ib
parents:
diff changeset
23
8f49b68dd955 Add a function converting into locale encoding.
ib
parents:
diff changeset
24 /**
8f49b68dd955 Add a function converting into locale encoding.
ib
parents:
diff changeset
25 * @brief Convert a filename which is either in UTF-8
8f49b68dd955 Add a function converting into locale encoding.
ib
parents:
diff changeset
26 * or in an encoding specified in G_FILENAME_ENCODING.
8f49b68dd955 Add a function converting into locale encoding.
ib
parents:
diff changeset
27 *
8f49b68dd955 Add a function converting into locale encoding.
ib
parents:
diff changeset
28 * @param fname filename
8f49b68dd955 Add a function converting into locale encoding.
ib
parents:
diff changeset
29 *
8f49b68dd955 Add a function converting into locale encoding.
ib
parents:
diff changeset
30 * @return converted filename
8f49b68dd955 Add a function converting into locale encoding.
ib
parents:
diff changeset
31 */
8f49b68dd955 Add a function converting into locale encoding.
ib
parents:
diff changeset
32 static const gchar *cfg_old_filename_from_utf8(const gchar *fname)
8f49b68dd955 Add a function converting into locale encoding.
ib
parents:
diff changeset
33 {
8f49b68dd955 Add a function converting into locale encoding.
ib
parents:
diff changeset
34 static gchar *name;
8f49b68dd955 Add a function converting into locale encoding.
ib
parents:
diff changeset
35
8f49b68dd955 Add a function converting into locale encoding.
ib
parents:
diff changeset
36 if (g_utf8_validate(fname, -1, NULL)) {
8f49b68dd955 Add a function converting into locale encoding.
ib
parents:
diff changeset
37 free(name);
8f49b68dd955 Add a function converting into locale encoding.
ib
parents:
diff changeset
38 name = g_filename_from_utf8(fname, -1, NULL, NULL, NULL);
8f49b68dd955 Add a function converting into locale encoding.
ib
parents:
diff changeset
39
8f49b68dd955 Add a function converting into locale encoding.
ib
parents:
diff changeset
40 return name;
8f49b68dd955 Add a function converting into locale encoding.
ib
parents:
diff changeset
41 }
8f49b68dd955 Add a function converting into locale encoding.
ib
parents:
diff changeset
42
8f49b68dd955 Add a function converting into locale encoding.
ib
parents:
diff changeset
43 return fname;
8f49b68dd955 Add a function converting into locale encoding.
ib
parents:
diff changeset
44 }