[libpeas] Use the GQuark API for GObject data



commit 15fd57bb4715169570dddf2afedb2eeaac606d4b
Author: Garrett Regier <garrettregier gmail com>
Date:   Thu Dec 18 03:43:08 2014 -0800

    Use the GQuark API for GObject data

 libpeas/peas-extension.c                   |    7 +++++--
 libpeas/peas-plugin-loader-c.c             |    7 +++++--
 loaders/lua5.1/peas-plugin-loader-lua.c    |    7 +++++--
 loaders/python/peas-plugin-loader-python.c |    7 +++++--
 4 files changed, 20 insertions(+), 8 deletions(-)
---
diff --git a/libpeas/peas-extension.c b/libpeas/peas-extension.c
index 081f242..407dfa8 100644
--- a/libpeas/peas-extension.c
+++ b/libpeas/peas-extension.c
@@ -66,6 +66,9 @@ peas_extension_get_type (void)
   return G_TYPE_OBJECT;
 }
 
+static
+G_DEFINE_QUARK (peas-extension-type, extension_type)
+
 static GICallableInfo *
 get_method_info (PeasExtension *exten,
                  const gchar   *method_name,
@@ -123,8 +126,8 @@ get_method_info (PeasExtension *exten,
 GType
 peas_extension_get_extension_type (PeasExtension *exten)
 {
-  return GPOINTER_TO_SIZE (g_object_get_data (G_OBJECT (exten),
-                                              "peas-extension-type"));
+  return GPOINTER_TO_SIZE (g_object_get_qdata (G_OBJECT (exten),
+                                               extension_type_quark ()));
 }
 
 /**
diff --git a/libpeas/peas-plugin-loader-c.c b/libpeas/peas-plugin-loader-c.c
index 3961138..1ac9266 100644
--- a/libpeas/peas-plugin-loader-c.c
+++ b/libpeas/peas-plugin-loader-c.c
@@ -39,6 +39,9 @@ struct _PeasPluginLoaderCPrivate {
 
 G_DEFINE_TYPE (PeasPluginLoaderC, peas_plugin_loader_c, PEAS_TYPE_PLUGIN_LOADER)
 
+static
+G_DEFINE_QUARK (peas-extension-type, extension_type)
+
 static gboolean
 peas_plugin_loader_c_load (PeasPluginLoader *loader,
                            PeasPluginInfo   *info)
@@ -135,8 +138,8 @@ peas_plugin_loader_c_create_extension (PeasPluginLoader *loader,
   /* We have to remember which interface we are instantiating
    * for the deprecated peas_extension_get_extension_type().
    */
-  g_object_set_data (instance, "peas-extension-type",
-                     GSIZE_TO_POINTER (exten_type));
+  g_object_set_qdata (instance, extension_type_quark (),
+                      GSIZE_TO_POINTER (exten_type));
 
   return instance;
 }
diff --git a/loaders/lua5.1/peas-plugin-loader-lua.c b/loaders/lua5.1/peas-plugin-loader-lua.c
index 21208eb..9f08309 100644
--- a/loaders/lua5.1/peas-plugin-loader-lua.c
+++ b/loaders/lua5.1/peas-plugin-loader-lua.c
@@ -47,6 +47,9 @@ struct _PeasPluginLoaderLuaPrivate {
 
 G_DEFINE_TYPE (PeasPluginLoaderLua, peas_plugin_loader_lua, PEAS_TYPE_PLUGIN_LOADER)
 
+static
+G_DEFINE_QUARK (peas-extension-type, extension_type)
+
 G_MODULE_EXPORT void
 peas_register_types (PeasObjectModule *module)
 {
@@ -242,8 +245,8 @@ peas_plugin_loader_lua_create_extension (PeasPluginLoader *loader,
   /* We have to remember which interface we are instantiating
    * for the deprecated peas_extension_get_extension_type().
    */
-  g_object_set_data (object, "peas-extension-type",
-                     GSIZE_TO_POINTER (exten_type));
+  g_object_set_qdata (object, extension_type_quark (),
+                      GSIZE_TO_POINTER (exten_type));
 
   luaL_checkstack (L, 3, "");
 
diff --git a/loaders/python/peas-plugin-loader-python.c b/loaders/python/peas-plugin-loader-python.c
index 7f8d06c..6efbe0c 100644
--- a/loaders/python/peas-plugin-loader-python.c
+++ b/loaders/python/peas-plugin-loader-python.c
@@ -53,6 +53,9 @@ struct _PeasPluginLoaderPythonPrivate {
 
 G_DEFINE_TYPE (PeasPluginLoaderPython, peas_plugin_loader_python, PEAS_TYPE_PLUGIN_LOADER)
 
+static
+G_DEFINE_QUARK (peas-extension-type, extension_type)
+
 G_MODULE_EXPORT void
 peas_register_types (PeasObjectModule *module)
 {
@@ -227,8 +230,8 @@ peas_plugin_loader_python_create_extension (PeasPluginLoader *loader,
   /* We have to remember which interface we are instantiating
    * for the deprecated peas_extension_get_extension_type().
    */
-  g_object_set_data (object, "peas-extension-type",
-                     GSIZE_TO_POINTER (exten_type));
+  g_object_set_qdata (object, extension_type_quark (),
+                      GSIZE_TO_POINTER (exten_type));
 
   pyobject = pygobject_new (object);
   pyplinfo = pyg_boxed_new (PEAS_TYPE_PLUGIN_INFO, info, TRUE, TRUE);


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