[beast/devel: 3/26] BSE: allow resident type registration from plugins
- From: Tim Janik <timj src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [beast/devel: 3/26] BSE: allow resident type registration from plugins
- Date: Tue, 18 Dec 2012 02:44:14 +0000 (UTC)
commit 73c64180bd303eccc9ab480c3204745b860fc9a9
Author: Tim Janik <timj gnu org>
Date: Mon Dec 17 19:56:48 2012 +0100
BSE: allow resident type registration from plugins
bse/bsecategories.h | 2 --
bse/bseplugin.cc | 18 +++++++++++++++++-
bse/bseplugin.h | 3 ++-
3 files changed, 19 insertions(+), 4 deletions(-)
---
diff --git a/bse/bsecategories.h b/bse/bsecategories.h
index 117bbbb..c8835bb 100644
--- a/bse/bsecategories.h
+++ b/bse/bsecategories.h
@@ -40,11 +40,9 @@ BseCategorySeq* bse_categories_match_typed (const gchar *pattern,
GType base_type);
BseCategorySeq* bse_categories_from_type (GType type);
BseCategory* bse_category_from_id (guint id);
-#ifdef BSE_COMPILATION
void bse_categories_register_stock_module (const gchar *untranslated_category_trunk,
GType type,
const guint8 *pixstream);
-#endif
/* --- implementation --- */
diff --git a/bse/bseplugin.cc b/bse/bseplugin.cc
index 8c432e3..87db882 100644
--- a/bse/bseplugin.cc
+++ b/bse/bseplugin.cc
@@ -129,6 +129,7 @@ bse_plugin_init (BsePlugin *plugin)
plugin->use_count = 0;
plugin->version_match = 1;
plugin->force_clean = 0;
+ plugin->resident_types = 0;
plugin->n_types = 0;
plugin->types = NULL;
}
@@ -204,6 +205,13 @@ runtime_export_config (void)
static BsePlugin *startup_plugin = NULL;
+void
+bse_plugin_make_resident()
+{
+ g_assert (startup_plugin != NULL);
+ startup_plugin->resident_types = TRUE;
+}
+
BsePlugin*
bse_exports__add_node (const BseExportIdentity *identity,
BseExportNode *enode)
@@ -307,6 +315,7 @@ bse_plugin_unload (BsePlugin *plugin)
{
g_return_if_fail (plugin->gmodule != NULL && plugin->fname != NULL);
g_return_if_fail (plugin->use_count == 0);
+ g_return_if_fail (plugin->resident_types == 0);
bse_plugin_uninit_types (plugin);
g_module_close ((GModule*) plugin->gmodule);
@@ -682,7 +691,7 @@ bse_plugin_check_load (const gchar *const_file_name)
{
plugin->fname = file_name;
plugin->gmodule = gmodule;
-
+
/* register BSE module types */
bse_plugin_init_types (plugin);
@@ -690,6 +699,13 @@ bse_plugin_check_load (const gchar *const_file_name)
if (plugin->use_count == 0)
bse_plugin_unload (plugin);
}
+ else if (plugin->resident_types)
+ {
+ plugin->use_count += 1; // make plugin resident
+ plugin->fname = file_name;
+ plugin->gmodule = gmodule;
+ bse_plugins = g_slist_prepend (bse_plugins, plugin);
+ }
else
{
g_module_close (gmodule);
diff --git a/bse/bseplugin.h b/bse/bseplugin.h
index 31897dd..5e9e6a6 100644
--- a/bse/bseplugin.h
+++ b/bse/bseplugin.h
@@ -43,6 +43,7 @@ struct _BsePlugin
guint use_count : 16;
guint version_match : 1;
guint force_clean : 1;
+ guint resident_types : 1;
BseExportNode *chain;
guint n_types;
@@ -58,7 +59,7 @@ struct _BsePluginClass
SfiRing* bse_plugin_path_list_files (gboolean include_drivers,
gboolean include_plugins);
const gchar* bse_plugin_check_load (const gchar *file_name);
-
+void bse_plugin_make_resident ();
/* --- registration macros --- */
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]