[libpeas: 1/3] Drop peas_plugin_info_get_keys()



commit c74a811fe659a007a52ec83af4ca0d5545da56f2
Author: Garrett Regier <alias301 gmail com>
Date:   Sun Feb 13 08:59:14 2011 -0800

    Drop peas_plugin_info_get_keys()
    
    It is not used by anyone, is bad API and has only been used for Builtin
    plugins in Totem. But now that we have that it's no longer needed.

 libpeas/peas-plugin-info-priv.h |    1 -
 libpeas/peas-plugin-info.c      |  101 ---------------------------------------
 libpeas/peas-plugin-info.h      |    2 -
 3 files changed, 0 insertions(+), 104 deletions(-)
---
diff --git a/libpeas/peas-plugin-info-priv.h b/libpeas/peas-plugin-info-priv.h
index b617b84..245a8b7 100644
--- a/libpeas/peas-plugin-info-priv.h
+++ b/libpeas/peas-plugin-info-priv.h
@@ -46,7 +46,6 @@ struct _PeasPluginInfo {
   gchar *version;
   gchar *help_uri;
   guint iage;
-  GHashTable *keys;
 
   GError *error;
 
diff --git a/libpeas/peas-plugin-info.c b/libpeas/peas-plugin-info.c
index 553aaf2..d5538cb 100644
--- a/libpeas/peas-plugin-info.c
+++ b/libpeas/peas-plugin-info.c
@@ -73,8 +73,6 @@ _peas_plugin_info_unref (PeasPluginInfo *info)
   if (!g_atomic_int_dec_and_test (&info->refcount))
     return;
 
-  if (info->keys != NULL)
-    g_hash_table_destroy (info->keys);
   g_free (info->file);
   g_free (info->module_dir);
   g_free (info->data_dir);
@@ -120,78 +118,6 @@ peas_plugin_info_error_quark (void)
 	return quark;
 }
 
-static void
-value_free (GValue *value)
-{
-  g_value_unset (value);
-  g_free (value);
-}
-
-static void
-parse_extra_keys (PeasPluginInfo   *info,
-                  GKeyFile         *plugin_file,
-                  const gchar     **keys)
-{
-  guint i;
-
-  for (i = 0; keys[i] != NULL; i++)
-    {
-      GValue *value = NULL;
-      gboolean b;
-      GError *error = NULL;
-
-      if (g_str_equal (keys[i], "IAge") ||
-          g_str_equal (keys[i], "Module") ||
-          g_str_equal (keys[i], "Depends") ||
-          g_str_equal (keys[i], "Loader") ||
-          g_str_equal (keys[i], "Name") ||
-          g_str_has_prefix (keys[i], "Name[") ||
-          g_str_equal (keys[i], "Description") ||
-          g_str_has_prefix (keys[i], "Description[") ||
-          g_str_equal (keys[i], "Icon") ||
-          g_str_equal (keys[i], "Authors") ||
-          g_str_equal (keys[i], "Copyright") ||
-          g_str_equal (keys[i], "Website") ||
-          g_str_equal (keys[i], "Version") ||
-          g_str_has_prefix (keys[i], "Help") ||
-          g_str_equal (keys[i], "Builtin"))
-        continue;
-
-      b = g_key_file_get_boolean (plugin_file, "Plugin", keys[i], &error);
-      if (b == FALSE && error != NULL)
-        {
-          gchar *str;
-          g_error_free (error);
-          error = NULL;
-          str = g_key_file_get_string (plugin_file, "Plugin", keys[i], NULL);
-          if (str != NULL)
-            {
-              value = g_new0 (GValue, 1);
-              g_value_init (value, G_TYPE_STRING);
-              g_value_take_string (value, str);
-            }
-        }
-      else
-        {
-          value = g_new0 (GValue, 1);
-          g_value_init (value, G_TYPE_BOOLEAN);
-          g_value_set_boolean (value, b);
-        }
-
-      if (!value)
-        continue;
-
-      if (info->keys == NULL)
-        {
-          info->keys = g_hash_table_new_full (g_str_hash,
-                                              g_str_equal,
-                                              g_free,
-                                              (GDestroyNotify) value_free);
-        }
-      g_hash_table_insert (info->keys, g_strdup (keys[i]), value);
-    }
-}
-
 /*
  * _peas_plugin_info_new:
  * @filename: The filename where to read the plugin information.
@@ -210,7 +136,6 @@ _peas_plugin_info_new (const gchar *filename,
   PeasPluginInfo *info;
   GKeyFile *plugin_file = NULL;
   gchar *str;
-  gchar **keys;
   gint integer;
   gboolean b;
   GError *error = NULL;
@@ -330,11 +255,6 @@ _peas_plugin_info_new (const gchar *filename,
   else
     info->builtin = b;
 
-  /* Get extra keys */
-  keys = g_key_file_get_keys (plugin_file, "Plugin", NULL, NULL);
-  parse_extra_keys (info, plugin_file, (const gchar **) keys);
-  g_strfreev (keys);
-
   g_key_file_free (plugin_file);
 
   info->module_dir = g_strdup (module_dir);
@@ -717,24 +637,3 @@ peas_plugin_info_get_iage (const PeasPluginInfo *info)
 
   return info->iage;
 }
-
-/**
- * peas_plugin_info_get_keys:
- * @info: A #PeasPluginInfo.
- *
- * Gets a hash table of string keys present and #GValue values,
- * present in the plugin information file, but not handled
- * by libpeas. Note that libpeas only handles booleans and
- * strings, and that strings that are recognized as booleans,
- * as done by g_key_file_get_boolean(), will be of boolean type.
- *
- * Returns: a #GHashTable of string keys and #GValue values. Do
- * not free or destroy any data in this hashtable.
- **/
-const GHashTable *
-peas_plugin_info_get_keys (const PeasPluginInfo *info)
-{
-  g_return_val_if_fail (info != NULL, NULL);
-
-  return info->keys;
-}
diff --git a/libpeas/peas-plugin-info.h b/libpeas/peas-plugin-info.h
index 249d2d3..58bc78b 100644
--- a/libpeas/peas-plugin-info.h
+++ b/libpeas/peas-plugin-info.h
@@ -90,8 +90,6 @@ const gchar  *peas_plugin_info_get_version      (const PeasPluginInfo *info);
 const gchar  *peas_plugin_info_get_help_uri     (const PeasPluginInfo *info);
 
 gint          peas_plugin_info_get_iage         (const PeasPluginInfo *info);
-const GHashTable *
-              peas_plugin_info_get_keys         (const PeasPluginInfo *info);
 
 G_END_DECLS
 



[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]