diff options
author | Khaled Hosny <khaledhosny@eglug.org> | 2014-07-26 09:57:03 +0200 |
---|---|---|
committer | Behdad Esfahbod <behdad@behdad.org> | 2015-04-04 16:13:07 -0700 |
commit | 81904127fe1107b6c0db4ce50c3d44cdf63b7f67 (patch) | |
tree | 3337935e75c6f99852dfff60c31531b873606537 /pango/pango-utils.c | |
parent | bc88f6809a6befdbb9a59b628ecc84901ab9d486 (diff) | |
download | pango-81904127fe1107b6c0db4ce50c3d44cdf63b7f67.tar.gz |
Deprecate pango_config_key_get*
The config file was used solely for dynamic module paths, but they have
been killed.
Diffstat (limited to 'pango/pango-utils.c')
-rw-r--r-- | pango/pango-utils.c | 142 |
1 files changed, 6 insertions, 136 deletions
diff --git a/pango/pango-utils.c b/pango/pango-utils.c index 591ac5bd..e8f70906 100644 --- a/pango/pango-utils.c +++ b/pango/pango-utils.c @@ -540,125 +540,6 @@ pango_scan_int (const char **pos, int *out) } -static void -read_config_file (const char *filename, gboolean enoent_error, GHashTable *ht) -{ - GKeyFile *key_file = g_key_file_new(); - GError *key_file_error = NULL; - gchar **groups; - gsize groups_count = 0; - guint group_index; - - if (!g_key_file_load_from_file(key_file,filename, 0, &key_file_error)) - { - if (key_file_error) - { - if (key_file_error->domain != G_FILE_ERROR || key_file_error->code != G_FILE_ERROR_NOENT || enoent_error) - { - g_warning ("error opening config file '%s': %s\n", - filename, key_file_error->message); - } - g_error_free(key_file_error); - } - g_key_file_free(key_file); - return; - } - - groups = g_key_file_get_groups (key_file, &groups_count); - for (group_index = 0; group_index < groups_count; group_index++) - { - gsize keys_count = 0; - const gchar *group = groups[group_index]; - GError *keys_error = NULL; - gchar **keys; - - keys = g_key_file_get_keys(key_file, group, &keys_count, &keys_error); - - if (keys) - { - guint key_index; - - for (key_index = 0; key_index < keys_count; key_index++) - { - const gchar *key = keys[key_index]; - GError *key_error = NULL; - gchar *value = g_key_file_get_value(key_file, group, key, &key_error); - if (value != NULL) - { - g_hash_table_insert (ht, - g_strdup_printf ("%s/%s", group, key), - value); - } - if (key_error) - { - g_warning ("error getting key '%s/%s' in config file '%s'\n", - group, key, filename); - g_error_free(key_error); - } - } - g_strfreev(keys); - } - - if (keys_error) - { - g_warning ("error getting keys in group '%s' of config file '%s'\n", - filename, group); - g_error_free(keys_error); - } - } - g_strfreev(groups); - g_key_file_free(key_file); -} - -static GHashTable * -read_config_system (void) -{ - char *filename; - GHashTable *config_hash; - - config_hash = g_hash_table_new_full (g_str_hash, g_str_equal, - (GDestroyNotify)g_free, - (GDestroyNotify)g_free); - - filename = g_build_filename (pango_get_sysconf_subdirectory (), - "pangorc", - NULL); - read_config_file (filename, FALSE, config_hash); - g_free (filename); - - return config_hash; -} - -static GHashTable * -read_config (void) -{ - static GHashTable *config_hash = NULL; - - if (g_once_init_enter (&config_hash)) - { - GHashTable *tmp_hash; - char *filename; - const char *envvar; - - tmp_hash = read_config_system (); - - filename = g_build_filename (g_get_user_config_dir (), - "pango", - "pangorc", - NULL); - read_config_file (filename, FALSE, tmp_hash); - g_free (filename); - - envvar = g_getenv ("PANGO_RC_FILE"); - if (envvar) - read_config_file (envvar, TRUE, tmp_hash); - - g_once_init_leave (&config_hash, tmp_hash); - } - - return config_hash; -} - /** * pango_config_key_get_system: * @key: Key to look up, in the form "SECTION/KEY". @@ -668,20 +549,13 @@ read_config (void) * * Return value: (nullable): the value, if found, otherwise %NULL. The * value is a newly-allocated string and must be freed with g_free(). + * + * Deprecated: 1.37: **/ char * pango_config_key_get_system (const char *key) { - GHashTable *config_hash; - gchar *ret; - - g_return_val_if_fail (key != NULL, NULL); - - config_hash = read_config_system (); - ret = g_strdup (g_hash_table_lookup (config_hash, key)); - g_hash_table_unref (config_hash); - - return ret; + return NULL; } /** @@ -694,17 +568,13 @@ pango_config_key_get_system (const char *key) * * Return value: (nullable): the value, if found, otherwise %NULL. The * value is a newly-allocated string and must be freed with g_free(). + * + * Deprecated: 1.37: **/ char * pango_config_key_get (const char *key) { - GHashTable *config_hash; - - g_return_val_if_fail (key != NULL, NULL); - - config_hash = read_config (); - - return g_strdup (g_hash_table_lookup (config_hash, key)); + return NULL; } #ifdef G_OS_WIN32 |