--- a/gplugin/gplugin-plugin-info.c Wed Dec 10 01:02:35 2014 -0600
+++ b/gplugin/gplugin-plugin-info.c Wed Dec 10 01:03:13 2014 -0600
@@ -15,6 +15,8 @@
* License along with this library; if not, see <http://www.gnu.org/licenses/>.
+#include <gobject/gvaluecollector.h> #include <gplugin/gplugin-plugin-info.h>
#include <gplugin/gplugin-core.h>
@@ -768,7 +770,7 @@
- * gplugin_plugin_info_new: (skip)
+ * gplugin_plugin_info_new: * @id: The id of the plugin
* @abi_version: The GPlugin ABI version that the plugin uses
* @...: name/value pairs of properties to set, followed by %NULL.
@@ -777,6 +779,84 @@
* Returns: The new GPluginPluginInfo instance.
+gplugin_plugin_info_new(const gchar *id, guint32 abi_version, ...) { + GObjectClass *obj_class = NULL; + GPluginPluginInfo *info = NULL; + GParameter *param = NULL, *params = NULL; + GSList *l = NULL, *ll = NULL; + const gchar *name = NULL; + /* create the GParameter for the id */ + param = g_new0(GParameter, 1); + g_value_init(¶m->value, G_TYPE_STRING); + g_value_set_string(¶m->value, id); + l = g_slist_prepend(l, param); + /* create the GParameter for the abi_version */ + param = g_new0(GParameter, 1); + param->name = "abi_version"; + g_value_init(¶m->value, G_TYPE_UINT); + g_value_set_uint(¶m->value, abi_version); + l = g_slist_prepend(l, param); + /* now run through all of the properties and build the rest of the + obj_class = g_type_class_ref(GPLUGIN_TYPE_PLUGIN_INFO); + va_start(vargs, abi_version); + while((name = va_arg(vargs, const gchar *))) { + GParamSpec *pspec = NULL; + param = g_new0(GParameter, 1); + pspec = g_object_class_find_property(obj_class, name); + G_VALUE_COLLECT_INIT(¶m->value, pspec->value_type, vargs, 0, &error); + g_critical("%s: %s", G_STRFUNC, error); + g_value_unset(¶m->value); + l = g_slist_prepend(l, param); + g_type_class_unref(obj_class); + /* now allocate params and copy everything into it */ + n_params = g_slist_length(l); + params = g_new0(GParameter, n_params); + for(ll = l, i = 0; ll; ll = ll->next, i++) { + params[i] = *(GParameter *)ll->data; + info = g_object_newv(GPLUGIN_TYPE_PLUGIN_INFO, n_params, params); + for(ll = l; ll; ll = ll->next) { * gplugin_plugin_info_get_id:
--- a/gplugin/gplugin-plugin-info.h Wed Dec 10 01:02:35 2014 -0600
+++ b/gplugin/gplugin-plugin-info.h Wed Dec 10 01:03:13 2014 -0600
@@ -57,6 +57,17 @@
GType gplugin_plugin_info_get_type(void);
+ * gplugin_plugin_info_new: + * @id: The ID of the plugin + * @abi_version: The ABI version of the plugin + * @...: Additional values to set + * Creates a new PluginInfo instance. + * Returns: (transfer full): The new PluginInfo instance. #define gplugin_plugin_info_new(id, abi_version, ...) \
g_object_new(GPLUGIN_TYPE_PLUGIN_INFO, \
@@ -64,7 +75,9 @@
"abi-version", (abi_version), \
+GPluginPluginInfo *gplugin_plugin_info_new(const gchar *id, guint32 abi_version, ...); const gchar *gplugin_plugin_info_get_id(const GPluginPluginInfo *info);
guint32 gplugin_plugin_info_get_abi_version(const GPluginPluginInfo *info);
gboolean gplugin_plugin_info_get_internal(const GPluginPluginInfo *info);