a bunch more work on the ruby stuff
--- a/ruby/CMakeLists.txt Wed Dec 10 01:05:11 2014 -0600
+++ b/ruby/CMakeLists.txt Wed Dec 10 01:05:43 2014 -0600
@@ -13,13 +13,11 @@
pkg_check_modules(RUBY REQUIRED ruby-2.1)
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/ruby/gplugin-ruby-core.c Wed Dec 10 01:05:43 2014 -0600
@@ -0,0 +1,67 @@
+ * Copyright (C) 2011-2014 Gary Kramlich <grim@reaperworld.com> + * This library is free software; you can redistribute it and/or + * modify it under the terms of the GNU Lesser General Public + * License as published by the Free Software Foundation; either + * version 2 of the License, or (at your option) any later version. + * This library is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU + * Lesser General Public License for more details. + * You should have received a copy of the GNU Lesser General Public + * License along with this library; if not, see <http://www.gnu.org/licenses/>. +#include <gplugin-native.h> +#include "gplugin-ruby-loader.h" +#include "gplugin-ruby-plugin.h" +G_MODULE_EXPORT GPluginPluginInfo * +gplugin_query(GPLUGIN_UNUSED GError **error) { + const gchar * const authors[] = { + "Gary Kramlich <grim@reaperworld.com>", + return gplugin_plugin_info_new( + GPLUGIN_NATIVE_PLUGIN_ABI_VERSION, + "name", "Ruby Plugin Loader", + "version", GPLUGIN_VERSION, + "summary", "A plugin that can load ruby plugins", + "description", "This plugin allows the loading of plugins written in " + "the ruby programming language.", + "website", GPLUGIN_WEBSITE, +G_MODULE_EXPORT gboolean +gplugin_load(GPluginNativePlugin *plugin, + GPLUGIN_UNUSED GError **error) + gplugin_ruby_plugin_register(plugin); + gplugin_ruby_loader_register(plugin); + gplugin_manager_register_loader(GPLUGIN_TYPE_RUBY_LOADER); +G_MODULE_EXPORT gboolean +gplugin_unload(GPLUGIN_UNUSED GPluginNativePlugin *plugin, + GPLUGIN_UNUSED GError **error) --- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/ruby/gplugin-ruby-loader.c Wed Dec 10 01:05:43 2014 -0600
@@ -0,0 +1,152 @@
+ * Copyright (C) 2011-2014 Gary Kramlich <grim@reaperworld.com> + * This library is free software; you can redistribute it and/or + * modify it under the terms of the GNU Lesser General Public + * License as published by the Free Software Foundation; either + * version 2 of the License, or (at your option) any later version. + * This library is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU + * Lesser General Public License for more details. + * You should have received a copy of the GNU Lesser General Public + * License along with this library; if not, see <http://www.gnu.org/licenses/>. +#include "gplugin-ruby-loader.h" +#include "gplugin-ruby-plugin.h" +#define GPLUGIN_RUBY_LOADER_GET_PRIVATE(obj) \ + (G_TYPE_INSTANCE_GET_PRIVATE((obj), GPLUGIN_TYPE_RUBY_LOADER, GPluginRubyLoaderPrivate)) +/****************************************************************************** + *****************************************************************************/ +} GPluginRubyLoaderPrivate; +/****************************************************************************** + *****************************************************************************/ +static GObjectClass *parent_class = NULL; +static GType type_real = 0; +/****************************************************************************** + * GPluginLoaderInterface API + *****************************************************************************/ +gplugin_ruby_loader_class_supported_extensions(GPLUGIN_UNUSED const GPluginLoaderClass *klass) { + return g_slist_append(NULL, "rb"); +gplugin_ruby_loader_query(GPLUGIN_UNUSED GPluginLoader *loader, + GPLUGIN_UNUSED GError **error) + GPluginPlugin *plugin = NULL; +gplugin_ruby_loader_load(GPLUGIN_UNUSED GPluginLoader *loader, +gplugin_ruby_loader_unload(GPLUGIN_UNUSED GPluginLoader *loader, +/****************************************************************************** + *****************************************************************************/ +gplugin_ruby_loader_init_ruby(void) { +/****************************************************************************** + *****************************************************************************/ +gplugin_ruby_loader_finalize(GObject *obj) { + G_OBJECT_CLASS(parent_class)->finalize(obj); +gplugin_ruby_loader_class_init(GPluginRubyLoaderClass *klass) { + GObjectClass *obj_class = G_OBJECT_CLASS(klass); + GPluginLoaderClass *loader_class = + GPLUGIN_LOADER_CLASS(klass); + parent_class = g_type_class_peek_parent(klass); + g_type_class_add_private(klass, sizeof(GPluginRubyLoaderPrivate)); + obj_class->finalize = gplugin_ruby_loader_finalize; + loader_class->supported_extensions = + gplugin_ruby_loader_class_supported_extensions; + loader_class->query = gplugin_ruby_loader_query; + loader_class->load = gplugin_ruby_loader_load; + loader_class->unload = gplugin_ruby_loader_unload; +/****************************************************************************** + *****************************************************************************/ +gplugin_ruby_loader_register(GPluginNativePlugin *plugin) { + if(g_once_init_enter(&type_real)) { + static const GTypeInfo info = { + .class_size = sizeof(GPluginRubyLoaderClass), + .class_init = (GClassInitFunc)gplugin_ruby_loader_class_init, + .instance_size = sizeof(GPluginRubyLoader), + type = gplugin_native_plugin_register_type(plugin, + gplugin_ruby_loader_init_ruby(); + g_once_init_leave(&type_real, type); +gplugin_ruby_loader_get_type(void) { + if(G_UNLIKELY(type_real == 0)) { + g_warning("gplugin_ruby_loader_get_type was called before " + "the type was registered!\n"); --- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/ruby/gplugin-ruby-loader.h Wed Dec 10 01:05:43 2014 -0600
@@ -0,0 +1,60 @@
+ * Copyright (C) 2011-2014 Gary Kramlich <grim@reaperworld.com> + * This library is free software; you can redistribute it and/or + * modify it under the terms of the GNU Lesser General Public + * License as published by the Free Software Foundation; either + * version 2 of the License, or (at your option) any later version. + * This library is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU + * Lesser General Public License for more details. + * You should have received a copy of the GNU Lesser General Public + * License along with this library; if not, see <http://www.gnu.org/licenses/>. +#ifndef GPLUGIN_RUBY_LOADER_H +#define GPLUGIN_RUBY_LOADER_H +#define GPLUGIN_TYPE_RUBY_LOADER (gplugin_ruby_loader_get_type()) +#define GPLUGIN_RUBY_LOADER(obj) (G_TYPE_CHECK_INSTANCE_CAST((obj), GPLUGIN_TYPE_RUBY_LOADER, GPluginRubyLoader)) +#define GPLUGIN_RUBY_LOADER_CLASS(klass) (G_TYPE_CHECK_CLASS_CAST((obj), GPLUGIN_TYPE_RUBY_LOADER, GPluginRubyLoaderClass)) +#define GPLUGIN_IS_RUBY_LOADER(obj) (G_TYPE_CHECK_INSTANCE_TYPE((obj), GPLUGIN_TYPE_RUBY_LOADER)) +#define GPLUGIN_IS_RUBY_LOADER_CLASS(klass) (G_TYPE_CHECK_CLASS_TYPE((obj), GPLUGIN_TYPE_RUBY_LOADER)) +#define GPLUGIN_RUBY_LOADER_GET_CLASS(obj) (G_TYPE_INSTANCE_GET_CLASS((obj), GPLUGIN_TYPE_RUBY_LOADER, GPluginRubyLoaderClass)) +typedef struct _GPluginRubyLoader GPluginRubyLoader; +typedef struct _GPluginRubyLoaderClass GPluginRubyLoaderClass; +#include <gplugin-native.h> +struct _GPluginRubyLoader { + void (*_gplugin_reserved_1)(void); + void (*_gplugin_reserved_2)(void); + void (*_gplugin_reserved_3)(void); + void (*_gplugin_reserved_4)(void); +struct _GPluginRubyLoaderClass { + GPluginLoaderClass parent; + void (*_gplugin_reserved_1)(void); + void (*_gplugin_reserved_2)(void); + void (*_gplugin_reserved_3)(void); + void (*_gplugin_reserved_4)(void); +void gplugin_ruby_loader_register(GPluginNativePlugin *plugin); +GType gplugin_ruby_loader_get_type(void); +#endif /* GPLUGIN_RUBY_LOADER_H */ --- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/ruby/gplugin-ruby-plugin.c Wed Dec 10 01:05:43 2014 -0600
@@ -0,0 +1,161 @@
+ * Copyright (C) 2011-2014 Gary Kramlich <grim@reaperworld.com> + * This library is free software; you can redistribute it and/or + * modify it under the terms of the GNU Lesser General Public + * License as published by the Free Software Foundation; either + * version 2 of the License, or (at your option) any later version. + * This library is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU + * Lesser General Public License for more details. + * You should have received a copy of the GNU Lesser General Public + * License along with this library; if not, see <http://www.gnu.org/licenses/>. +#include "gplugin-ruby-plugin.h" +#define GPLUGIN_RUBY_PLUGIN_GET_PRIVATE(obj) \ + (G_TYPE_INSTANCE_GET_PRIVATE((obj), GPLUGIN_TYPE_RUBY_PLUGIN, GPluginRubyPluginPrivate)) +/****************************************************************************** + *****************************************************************************/ +} GPluginRubyPluginPrivate; +/****************************************************************************** + *****************************************************************************/ +/****************************************************************************** + *****************************************************************************/ +static GObjectClass *parent_class = NULL; +static GType type_real = 0; +/****************************************************************************** + *****************************************************************************/ +gplugin_ruby_plugin_get_node(const GPluginRubyPlugin *plugin) { + GPluginRubyPluginPrivate *priv = GPLUGIN_RUBY_PLUGIN_GET_PRIVATE(plugin); +gplugin_ruby_plugin_set_node(GPluginRubyPlugin *plugin, void *node) { + GPluginRubyPluginPrivate *priv = GPLUGIN_RUBY_PLUGIN_GET_PRIVATE(plugin); +/****************************************************************************** + *****************************************************************************/ +gplugin_ruby_plugin_get_property(GObject *obj, guint param_id, GValue *value, + GPluginRubyPlugin *plugin = GPLUGIN_RUBY_PLUGIN(obj); + g_value_set_pointer(value, gplugin_ruby_plugin_get_node(plugin)); + G_OBJECT_WARN_INVALID_PROPERTY_ID(obj, param_id, pspec); +gplugin_ruby_plugin_set_property(GObject *obj, guint param_id, + const GValue *value, GParamSpec *pspec) + GPluginRubyPlugin *plugin = GPLUGIN_RUBY_PLUGIN(obj); + gplugin_ruby_plugin_set_node(plugin, g_value_get_pointer(value)); + G_OBJECT_WARN_INVALID_PROPERTY_ID(obj, param_id, pspec); +gplugin_ruby_plugin_finalize(GObject *obj) { + GPluginRubyPluginPrivate *priv = + GPLUGIN_RUBY_PLUGIN_GET_PRIVATE(obj); + G_OBJECT_CLASS(parent_class)->finalize(obj); +gplugin_ruby_plugin_class_init(GPluginRubyPluginClass *klass) { + GObjectClass *obj_class = G_OBJECT_CLASS(klass); + parent_class = g_type_class_peek_parent(klass); + g_type_class_add_private(klass, sizeof(GPluginRubyPluginPrivate)); + obj_class->get_property = gplugin_ruby_plugin_get_property; + obj_class->set_property = gplugin_ruby_plugin_set_property; + obj_class->finalize = gplugin_ruby_plugin_finalize; + g_object_class_install_property(obj_class, PROP_NODE, + g_param_spec_pointer("node", "node", + "The ruby node object", + G_PARAM_READWRITE | G_PARAM_CONSTRUCT_ONLY)); +/****************************************************************************** + *****************************************************************************/ +gplugin_ruby_plugin_register(GPluginNativePlugin *plugin) { + if(g_once_init_enter(&type_real)) { + static const GTypeInfo info = { + .class_size = sizeof(GPluginRubyPluginClass), + .class_init = (GClassInitFunc)gplugin_ruby_plugin_class_init, + .instance_size = sizeof(GPluginRubyPlugin), + type = gplugin_native_plugin_register_type(plugin, + g_once_init_leave(&type_real, type); +gplugin_ruby_plugin_get_type(void) { + if(G_UNLIKELY(type_real == 0)) { + g_warning("gplugin_ruby_plugin_get_type was called before " + "the type was registered!\n"); --- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/ruby/gplugin-ruby-plugin.h Wed Dec 10 01:05:43 2014 -0600
@@ -0,0 +1,55 @@
+ * Copyright (C) 2011-2014 Gary Kramlich <grim@reaperworld.com> + * This library is free software; you can redistribute it and/or + * modify it under the terms of the GNU Lesser General Public + * License as published by the Free Software Foundation; either + * version 2 of the License, or (at your option) any later version. + * This library is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU + * Lesser General Public License for more details. + * You should have received a copy of the GNU Lesser General Public + * License along with this library; if not, see <http://www.gnu.org/licenses/>. +#ifndef GPLUGIN_RUBY_PLUGIN_H +#define GPLUGIN_RUBY_PLUGIN_H +#define GPLUGIN_TYPE_RUBY_PLUGIN (gplugin_ruby_plugin_get_type()) +#define GPLUGIN_RUBY_PLUGIN(obj) (G_TYPE_CHECK_INSTANCE_CAST((obj), GPLUGIN_TYPE_RUBY_PLUGIN, GPluginRubyPlugin)) +#define GPLUGIN_RUBY_PLUGIN_CLASS(klass) (G_TYPE_CHECK_CLASS_CAST((obj), GPLUGIN_TYPE_RUBY_PLUGIN, GPluginRubyPluginClass)) +#define GPLUGIN_IS_RUBY_PLUGIN(obj) (G_TYPE_CHECK_INSTANCE_TYPE((obj), GPLUGIN_TYPE_RUBY_PLUGIN)) +#define GPLUGIN_IS_RUBY_PLUGIN_CLASS(klass) (G_TYPE_CHECK_CLASS_TYPE((obj), GPLUGIN_TYPE_RUBY_PLUGIN)) +#define GPLUGIN_RUBY_PLUGIN_GET_CLASS(obj) (G_TYPE_INSTANCE_GET_CLASS((obj), GPLUGIN_TYPE_RUBY_PLUGIN, GPluginRubyPluginClass)) +typedef struct _GPluginRubyPlugin GPluginRubyPlugin; +typedef struct _GPluginRubyPluginClass GPluginRubyPluginClass; +#include <gplugin-native.h> +struct _GPluginRubyPlugin { +struct _GPluginRubyPluginClass { + GPluginPluginClass parent; + void (*_gplugin_reserved_1)(void); + void (*_gplugin_reserved_2)(void); + void (*_gplugin_reserved_3)(void); + void (*_gplugin_reserved_4)(void); +void gplugin_ruby_plugin_register(GPluginNativePlugin *plugin); +GType gplugin_ruby_plugin_get_type(void); +#endif /* GPLUGIN_RUBY_PLUGIN_H */ --- a/ruby/tests/plugins/basic.rb Wed Dec 10 01:05:11 2014 -0600
+++ b/ruby/tests/plugins/basic.rb Wed Dec 10 01:05:43 2014 -0600
@@ -4,8 +4,7 @@
return GPlugin::PluginInfo.new(
- 'ruby/ruby-basic-plugin',
+ GPlugin::PluginInfo, ['id' => 'ruby/ruby-basic-plugin', "abi_version" => 0x01020304]