[eel] remove unused eel_get_filename_charset()

This commit is contained in:
Cosimo Cecchi 2010-11-01 03:21:02 +01:00
parent 31dfbdc190
commit 00c0b9daa2
2 changed files with 0 additions and 100 deletions

View file

@ -726,103 +726,6 @@ eel_remove_weak_pointer (gpointer pointer_location)
*object_location = NULL;
}
/* Get the filename encoding, returns TRUE if utf8 */
typedef struct _EelFilenameCharsetCache EelFilenameCharsetCache;
struct _EelFilenameCharsetCache {
gboolean is_utf8;
gchar *charset;
gchar *filename_charset;
};
static void
filename_charset_cache_free (gpointer data)
{
EelFilenameCharsetCache *cache = data;
g_free (cache->charset);
g_free (cache->filename_charset);
g_free (cache);
}
/*
* eel_get_filename_charset:
* @charset: return location for the name of the filename encoding
*
* Determines the character set used for filenames by consulting the
* environment variables G_FILENAME_ENCODING and G_BROKEN_FILENAMES.
*
* G_FILENAME_ENCODING may be set to a comma-separated list of character
* set names. The special token "@locale" is taken to mean the character set
* for the current locale. The first character set from the list is taken
* as the filename encoding.
* If G_FILENAME_ENCODING is not set, but G_BROKEN_FILENAMES is, the
* character set of the current locale is taken as the filename encoding.
*
* The returned @charset belongs to Eel and must not be freed.
*
* Return value: %TRUE if the charset used for filename is UTF-8.
*/
gboolean
eel_get_filename_charset (const gchar **filename_charset)
{
static GStaticPrivate cache_private = G_STATIC_PRIVATE_INIT;
EelFilenameCharsetCache *cache = g_static_private_get (&cache_private);
const gchar *charset;
if (!cache)
{
cache = g_new0 (EelFilenameCharsetCache, 1);
g_static_private_set (&cache_private, cache, filename_charset_cache_free);
}
g_get_charset (&charset);
if (!(cache->charset && strcmp (cache->charset, charset) == 0))
{
const gchar *new_charset;
gchar *p, *q;
g_free (cache->charset);
g_free (cache->filename_charset);
cache->charset = g_strdup (charset);
p = getenv ("G_FILENAME_ENCODING");
if (p != NULL)
{
q = strchr (p, ',');
if (!q)
q = p + strlen (p);
if (strncmp ("@locale", p, q - p) == 0)
{
cache->is_utf8 = g_get_charset (&new_charset);
cache->filename_charset = g_strdup (new_charset);
}
else
{
cache->filename_charset = g_strndup (p, q - p);
cache->is_utf8 = (strcmp (cache->filename_charset, "UTF-8") == 0);
}
}
else if (getenv ("G_BROKEN_FILENAMES") != NULL)
{
cache->is_utf8 = g_get_charset (&new_charset);
cache->filename_charset = g_strdup (new_charset);
}
else
{
cache->filename_charset = g_strdup ("UTF-8");
cache->is_utf8 = TRUE;
}
}
if (filename_charset)
*filename_charset = cache->filename_charset;
return cache->is_utf8;
}
static void
update_auto_boolean (GSettings *settings,
const gchar *key,

View file

@ -90,9 +90,6 @@ int eel_round (double
void eel_add_weak_pointer (gpointer pointer_location);
void eel_remove_weak_pointer (gpointer pointer_location);
/* Get the filename encoding, returns TRUE if utf8 */
gboolean eel_get_filename_charset (const gchar **filename_charset);
void eel_g_settings_add_auto_enum (GSettings *settings,
const char *key,
int *storage);