gplugin/gplugin

Parents 1a7534be6b29
Children d13d1a0842bd
Bunch of random updates, mostly G_DEFINE_TYPE stuff and cleaning up reserved pointers in structs
--- a/gplugin-gtk-viewer/gplugin-gtk-viewer-window.h Sat Nov 24 02:35:36 2018 -0600
+++ b/gplugin-gtk-viewer/gplugin-gtk-viewer-window.h Sat Nov 24 22:07:46 2018 -0600
@@ -39,19 +39,13 @@
struct _GPluginGtkViewerWindow {
GtkWindow parent;
- void (*_gplugin_gtk_reserved1)(void);
- void (*_gplugin_gtk_reserved2)(void);
- void (*_gplugin_gtk_reserved3)(void);
- void (*_gplugin_gtk_reserved4)(void);
+ gpointer reserved[4];
};
struct _GPluginGtkViewerWindowClass {
GtkWindowClass parent;
- void (*_gplugin_gtk_reserved1)(void);
- void (*_gplugin_gtk_reserved2)(void);
- void (*_gplugin_gtk_reserved3)(void);
- void (*_gplugin_gtk_reserved4)(void);
+ gpointer reserved[4];
};
G_BEGIN_DECLS
--- a/gplugin-gtk/gplugin-gtk-plugin-info.h Sat Nov 24 02:35:36 2018 -0600
+++ b/gplugin-gtk/gplugin-gtk-plugin-info.h Sat Nov 24 22:07:46 2018 -0600
@@ -43,15 +43,14 @@
struct _GPluginGtkPluginInfo {
GtkFrame parent;
+
+ gpointer reserved[4];
};
struct _GPluginGtkPluginInfoClass {
GtkFrameClass parent;
- void (*_gplugin_reserved1)(void);
- void (*_gplugin_reserved2)(void);
- void (*_gplugin_reserved3)(void);
- void (*_gplugin_reserved4)(void);
+ gpointer reserved[4];
};
G_BEGIN_DECLS
--- a/gplugin-gtk/gplugin-gtk-store.h Sat Nov 24 02:35:36 2018 -0600
+++ b/gplugin-gtk/gplugin-gtk-store.h Sat Nov 24 22:07:46 2018 -0600
@@ -42,19 +42,13 @@
struct _GPluginGtkStore {
GtkListStore parent;
- void (*_gplugin_reserved1)(void);
- void (*_gplugin_reserved2)(void);
- void (*_gplugin_reserved3)(void);
- void (*_gplugin_reserved4)(void);
+ gpointer reserved[4];
};
struct _GPluginGtkStoreClass {
GtkListStoreClass parent;
- void (*_gplugin_reserved1)(void);
- void (*_gplugin_reserved2)(void);
- void (*_gplugin_reserved3)(void);
- void (*_gplugin_reserved4)(void);
+ gpointer reserved[4];
};
typedef enum {
--- a/gplugin/gplugin-loader.c Sat Nov 24 02:35:36 2018 -0600
+++ b/gplugin/gplugin-loader.c Sat Nov 24 22:07:46 2018 -0600
@@ -29,29 +29,21 @@
*/
/******************************************************************************
+ * GObject Stuff
+ *****************************************************************************/
+G_DEFINE_ABSTRACT_TYPE(GPluginLoader, gplugin_loader, G_TYPE_OBJECT);
+
+static void
+gplugin_loader_init(GPluginLoader *loader) {
+}
+
+static void
+gplugin_loader_class_init(GPluginLoaderClass *klass) {
+}
+
+/******************************************************************************
* API
*****************************************************************************/
-GType
-gplugin_loader_get_type(void) {
- static volatile gsize type_volatile = 0;
-
- if(g_once_init_enter(&type_volatile)) {
- GType type = 0;
-
- static const GTypeInfo info = {
- .class_size = sizeof(GPluginLoaderClass),
- .instance_size = sizeof(GPluginLoader),
- };
-
- type = g_type_register_static(G_TYPE_OBJECT,
- "GPluginLoader",
- &info, G_TYPE_FLAG_ABSTRACT);
-
- g_once_init_leave(&type_volatile, type);
- }
-
- return type_volatile;
-}
/**
* gplugin_loader_query_plugin:
--- a/gplugin/gplugin-loader.h Sat Nov 24 02:35:36 2018 -0600
+++ b/gplugin/gplugin-loader.h Sat Nov 24 22:07:46 2018 -0600
@@ -42,10 +42,7 @@
struct _GPluginLoader {
GObject gparent;
- void (*_gplugin_reserved_1)(void);
- void (*_gplugin_reserved_2)(void);
- void (*_gplugin_reserved_3)(void);
- void (*_gplugin_reserved_4)(void);
+ gpointer reserved[4];
};
struct _GPluginLoaderClass {
@@ -58,10 +55,7 @@
gboolean (*load)(GPluginLoader *loader, GPluginPlugin *plugin, GError **error);
gboolean (*unload)(GPluginLoader *loader, GPluginPlugin *plugin, GError **error);
- void (*_gplugin_reserved_1)(void);
- void (*_gplugin_reserved_2)(void);
- void (*_gplugin_reserved_3)(void);
- void (*_gplugin_reserved_4)(void);
+ gpointer reserved[4];
};
G_BEGIN_DECLS
--- a/gplugin/gplugin-native-loader.c Sat Nov 24 02:35:36 2018 -0600
+++ b/gplugin/gplugin-native-loader.c Sat Nov 24 22:07:46 2018 -0600
@@ -38,6 +38,15 @@
* Basic API for the native plugin loader.
*/
+/**
+ * GPLUGIN_NATIVE_PLUGIN_ABI_VERSION:
+ *
+ * The ABI version of the #GPluginNativeLoader. Your plugin should use this
+ * as the value for %abi_version when call #gplugin_plugin_info_new.
+ */
+
+G_DEFINE_TYPE(GPluginNativeLoader, gplugin_native_loader, GPLUGIN_TYPE_LOADER);
+
/******************************************************************************
* Helpers
*****************************************************************************/
@@ -272,6 +281,10 @@
}
static void
+gplugin_native_loader_init(GPluginNativeLoader *loader) {
+}
+
+static void
gplugin_native_loader_class_init(GPluginNativeLoaderClass *klass) {
GPluginLoaderClass *loader_class =
GPLUGIN_LOADER_CLASS(klass);
@@ -282,39 +295,3 @@
loader_class->load = gplugin_native_loader_load;
loader_class->unload = gplugin_native_loader_unload;
}
-
-/******************************************************************************
- * API
- *****************************************************************************/
-
-/**
- * GPLUGIN_NATIVE_PLUGIN_ABI_VERSION:
- *
- * The ABI version of the #GPluginNativeLoader. Your plugin should use this
- * as the value for %abi_version when call #gplugin_plugin_info_new.
- */
-
-GType
-gplugin_native_loader_get_type(void) {
- static volatile gsize type_volatile = 0;
-
- if(g_once_init_enter(&type_volatile)) {
- GType type = 0;
-
- static const GTypeInfo info = {
- .class_size = sizeof(GPluginNativeLoaderClass),
- .class_init = (GClassInitFunc)gplugin_native_loader_class_init,
- .instance_size = sizeof(GPluginNativeLoader),
- };
-
- type = g_type_register_static(GPLUGIN_TYPE_LOADER,
- "GPluginNativeLoader",
- &info, 0);
-
- g_once_init_leave(&type_volatile, type);
- }
-
- return type_volatile;
-}
-
-
--- a/gplugin/gplugin-native-loader.h Sat Nov 24 02:35:36 2018 -0600
+++ b/gplugin/gplugin-native-loader.h Sat Nov 24 22:07:46 2018 -0600
@@ -43,15 +43,14 @@
struct _GPluginNativeLoader {
GPluginLoader parent;
+
+ gpointer reserved[4];
};
struct _GPluginNativeLoaderClass {
GPluginLoaderClass parent;
- void (*_gplugin_reserved_1)(void);
- void (*_gplugin_reserved_2)(void);
- void (*_gplugin_reserved_3)(void);
- void (*_gplugin_reserved_4)(void);
+ gpointer reserved[4];
};
G_BEGIN_DECLS
--- a/gplugin/gplugin-native-plugin.c Sat Nov 24 02:35:36 2018 -0600
+++ b/gplugin/gplugin-native-plugin.c Sat Nov 24 22:07:46 2018 -0600
@@ -67,45 +67,19 @@
};
static GParamSpec *properties[N_PROPERTIES] = {NULL,};
-/* I hate forward declarations... */
-static void gplugin_native_plugin_iface_init(GPluginPluginInterface *iface);
-
-G_DEFINE_TYPE_WITH_CODE(
- GPluginNativePlugin,
- gplugin_native_plugin,
- G_TYPE_TYPE_MODULE,
- G_ADD_PRIVATE(GPluginNativePlugin)
- G_IMPLEMENT_INTERFACE(GPLUGIN_TYPE_PLUGIN, gplugin_native_plugin_iface_init)
-);
-
/******************************************************************************
* GPluginPlugin Implementation
*****************************************************************************/
static void
gplugin_native_plugin_iface_init(GPluginPluginInterface *iface) {
+ /* we just override properites from GPluginPlugin */
}
/******************************************************************************
- * GPluginPlugin Implementation
+ * GTypeModule Implementation
*****************************************************************************/
static gboolean
gplugin_native_plugin_load(GTypeModule *module) {
- // GPluginNativePlugin *native = GPLUGIN_NATIVE_PLUGIN(module);
- // GPluginNativePluginPrivate *priv = gplugin_native_plugin_get_instance_private(native);
- // GError *error = NULL;
- // GPluginNativePluginLoadFunc func;
- // gboolean ret = FALSE;
-
- // func = (GPluginNativePluginLoadFunc)priv->load_func;
-
- // ret = func(native, &error);
-
- // if(error != NULL) {
- // g_warning("failed to load plugin: %s", error->message);
- // }
-
- // return ret;
-
return TRUE;
}
@@ -116,6 +90,14 @@
/******************************************************************************
* GObject Implementation
*****************************************************************************/
+G_DEFINE_TYPE_WITH_CODE(
+ GPluginNativePlugin,
+ gplugin_native_plugin,
+ G_TYPE_TYPE_MODULE,
+ G_ADD_PRIVATE(GPluginNativePlugin)
+ G_IMPLEMENT_INTERFACE(GPLUGIN_TYPE_PLUGIN, gplugin_native_plugin_iface_init)
+);
+
static void
gplugin_native_plugin_get_property(GObject *obj, guint param_id, GValue *value,
GParamSpec *pspec)
--- a/lua/gplugin-lua-test-lgi.c Sat Nov 24 02:35:36 2018 -0600
+++ b/lua/gplugin-lua-test-lgi.c Sat Nov 24 22:07:46 2018 -0600
@@ -33,7 +33,7 @@
memset(buff, 0, sizeof(buff));
snprintf(buff, sizeof(buff), "%s;%s", pkg_path, path);
-
+
lua_pop(L, 1); // pop off the path field
lua_pushstring(L, buff); // push the new one
lua_setfield(L, -2, "path"); // set the field "path" in table at -2 with value at top of stack