summaryrefslogtreecommitdiff
path: root/src/plugins
diff options
context:
space:
mode:
Diffstat (limited to 'src/plugins')
-rw-r--r--src/plugins/Makefile.am11
-rw-r--r--src/plugins/dt.c33
-rw-r--r--src/plugins/pglist.c14
-rw-r--r--src/plugins/pglist.h4
-rw-r--r--src/plugins/plugin-int.h6
-rw-r--r--src/plugins/plugin.c21
-rw-r--r--src/plugins/plugin.h8
-rw-r--r--src/plugins/self.h3
8 files changed, 81 insertions, 19 deletions
diff --git a/src/plugins/Makefile.am b/src/plugins/Makefile.am
index b4ac1d5..6cb8d34 100644
--- a/src/plugins/Makefile.am
+++ b/src/plugins/Makefile.am
@@ -11,18 +11,9 @@ libplugins_la_SOURCES = \
plugin.h plugin.c \
self.h
-libplugins_la_CFLAGS = $(AM_CFLAGS)
-
-libplugins_la_LDFLAGS =
+libplugins_la_CFLAGS = $(TOOLKIT_CFLAGS) $(LIBXML_CFLAGS)
devdir = $(includedir)/chrysalide/$(subdir:src/%=core/%)
dev_HEADERS = $(libplugins_la_SOURCES:%c=)
-
-
-AM_CPPFLAGS = $(LIBGTK_CFLAGS) $(LIBXML_CFLAGS)
-
-AM_CFLAGS = $(DEBUG_CFLAGS) $(WARNING_FLAGS) $(COMPLIANCE_FLAGS)
-
-SUBDIRS =
diff --git a/src/plugins/dt.c b/src/plugins/dt.c
index c476dde..d678637 100644
--- a/src/plugins/dt.c
+++ b/src/plugins/dt.c
@@ -204,6 +204,25 @@ static void g_dynamic_types_interface_init(GTypePluginClass *iface)
static void g_dynamic_types_dispose(GDynamicTypes *types)
{
+ size_t i; /* Boucle de parcours */
+ type_dyn_info_t *info; /* Information à exploiter */
+ gpointer g_class; /* Classe à oublier */
+
+ for (i = 0; i < types->count; i++)
+ {
+ info = types->info[i];
+
+ if (info->type != G_TYPE_INVALID)
+ {
+ g_class = g_type_class_peek(info->type);
+ g_type_class_unref(g_class);
+
+ info->type = G_TYPE_INVALID;
+
+ }
+
+ }
+
G_OBJECT_CLASS(g_dynamic_types_parent_class)->dispose(G_OBJECT(types));
}
@@ -223,6 +242,14 @@ static void g_dynamic_types_dispose(GDynamicTypes *types)
static void g_dynamic_types_finalize(GDynamicTypes *types)
{
+ size_t i; /* Boucle de parcours */
+
+ for (i = 0; i < types->count; i++)
+ free(types->info[i]);
+
+ if (types->info != NULL)
+ free(types->info);
+
G_OBJECT_CLASS(g_dynamic_types_parent_class)->finalize(G_OBJECT(types));
}
@@ -367,7 +394,7 @@ static type_dyn_info_t *g_dynamic_types_find(const GDynamicTypes *types, GType t
* *
* Description : Fournit un identifiant GLib pour un nouveau type. *
* *
-* Retour : identifiant d'un nouveau type valide, ou 0. *
+* Retour : identifiant d'un nouveau type valide, ou G_TYPE_INVALID. *
* *
* Remarques : - *
* *
@@ -382,7 +409,7 @@ static GType g_dynamic_types_register_type(GDynamicTypes *types, GType parent, c
result = g_type_register_dynamic(parent, name, G_TYPE_PLUGIN(types), 0);
- if (result == 0)
+ if (result == G_TYPE_INVALID)
goto exit;
new = malloc(sizeof(type_dyn_info_t));
@@ -467,7 +494,7 @@ void exit_chrysalide_dynamic_types(void)
* *
* Description : Fournit un identifiant GLib pour un nouveau type. *
* *
-* Retour : Identifiant d'un nouveau type valide, ou 0. *
+* Retour : Identifiant d'un nouveau type valide, ou G_TYPE_INVALID. *
* *
* Remarques : - *
* *
diff --git a/src/plugins/pglist.c b/src/plugins/pglist.c
index bacb3ac..6b36d2f 100644
--- a/src/plugins/pglist.c
+++ b/src/plugins/pglist.c
@@ -35,6 +35,7 @@
#include <i18n.h>
+#include "dt.h"
#include "plugin-int.h"
#include "../common/extstr.h"
#include "../core/logs.h"
@@ -75,11 +76,15 @@ static void on_plugin_ref_toggle(gpointer, GPluginModule *, gboolean);
bool init_all_plugins(bool load)
{
+ bool result; /* Bilan à retourner */
char *edir; /* Répertoire de base effectif */
char *env; /* Contenu environnemental */
char *saveptr; /* Sauvegarde pour parcours */
char *udir; /* Répertoire supplémentaire ? */
+ result = init_chrysalide_dynamic_types();
+ if (!result) goto exit;
+
g_rw_lock_init(&_pg_lock);
edir = get_effective_directory_new(TDT_PLUGINS_LIB);
@@ -102,7 +107,9 @@ bool init_all_plugins(bool load)
if (load)
load_remaning_plugins();
- return true;
+ exit:
+
+ return result;
}
@@ -178,6 +185,8 @@ void exit_all_plugins(void)
g_rw_lock_clear(&_pg_lock);
+ exit_chrysalide_dynamic_types();
+
}
@@ -342,6 +351,9 @@ void _register_plugin(GPluginModule *plugin)
}
+ else
+ /* FIXME : leak(plugin); */;
+
}
diff --git a/src/plugins/pglist.h b/src/plugins/pglist.h
index e0aec3f..9063e78 100644
--- a/src/plugins/pglist.h
+++ b/src/plugins/pglist.h
@@ -27,7 +27,9 @@
#include <stdbool.h>
-#include <gtk/gtk.h>
+#ifdef INCLUDE_GTK_SUPPORT
+# include <gtk/gtk.h>
+#endif
#include "plugin-def.h"
diff --git a/src/plugins/plugin-int.h b/src/plugins/plugin-int.h
index 88e0fbb..067edcb 100644
--- a/src/plugins/plugin-int.h
+++ b/src/plugins/plugin-int.h
@@ -57,6 +57,8 @@ typedef void (* pg_handle_content_fc) (const GPluginModule *, PluginAction, GBin
/* Procède à une opération liée à un contenu chargé. */
typedef void (* pg_handle_loaded_fc) (const GPluginModule *, PluginAction, GLoadedContent *, wgroup_id_t, GtkStatusStack *);
+#ifdef INCLUDE_GTK_SUPPORT
+
/* Complète une liste de resources pour thème. */
typedef void (* pg_include_theme_fc) (const GPluginModule *, PluginAction, gboolean, char ***, size_t *);
@@ -66,6 +68,8 @@ typedef void (* pg_notify_panel_fc) (const GPluginModule *, PluginAction, GPanel
/* Rend compte d'un affichage ou d'un retrait de panneau. */
typedef void (* pg_notify_docking_fc) (const GPluginModule *, PluginAction, GPanelItem *, bool);
+#endif
+
/* Assure l'interprétation d'un format en différé. */
typedef bool (* pg_handle_format_analysis_fc) (const GPluginModule *, PluginAction, GKnownFormat *, wgroup_id_t, GtkStatusStack *);
@@ -115,9 +119,11 @@ struct _GPluginModuleClass
pg_get_modname_fc get_modname; /* Fourniture du nom brut */
+#ifdef INCLUDE_GTK_SUPPORT
pg_include_theme_fc include_theme; /* Extension d'un thème */
pg_notify_panel_fc notify_panel; /* Création de panneau */
pg_notify_docking_fc notify_docking; /* Affichage ou retrait */
+#endif
pg_handle_content_fc handle_content; /* Explorations ou résolutions */
pg_handle_loaded_fc handle_loaded; /* Traitement de contenu chargé*/
diff --git a/src/plugins/plugin.c b/src/plugins/plugin.c
index e563817..b96decd 100644
--- a/src/plugins/plugin.c
+++ b/src/plugins/plugin.c
@@ -669,8 +669,10 @@ static void g_plugin_module_init_gclass(GPluginModuleClass *class, GModule *modu
switch (action)
{
case PGA_GUI_THEME:
+#ifdef INCLUDE_GTK_SUPPORT
load_plugin_symbol(module, "chrysalide_plugin_include_theme",
&class->include_theme);
+#endif
break;
default:
@@ -686,13 +688,17 @@ static void g_plugin_module_init_gclass(GPluginModuleClass *class, GModule *modu
switch (action)
{
case PGA_PANEL_CREATION:
+#ifdef INCLUDE_GTK_SUPPORT
load_plugin_symbol(module, "chrysalide_plugin_on_panel_creation",
&class->notify_panel);
+#endif
break;
case PGA_PANEL_DOCKING:
+#ifdef INCLUDE_GTK_SUPPORT
load_plugin_symbol(module, "chrysalide_plugin_on_panel_docking",
&class->notify_docking);
+#endif
break;
default:
@@ -814,6 +820,15 @@ char *g_plugin_module_get_modname(const GPluginModule *plugin)
result = class->get_modname(plugin);
+ /**
+ * Tente une opération de la dernière chance.
+ *
+ * Dans le cas d'un module Python, la fonction de classe peut ne pas
+ * trouver de support si l'extension Python n'est pas au point.
+ */
+ if (result == NULL && class->get_modname != _g_plugin_module_get_modname)
+ result = _g_plugin_module_get_modname(plugin);
+
return result;
}
@@ -1423,6 +1438,9 @@ gpointer g_plugin_module_build_type_instance(GPluginModule *plugin, PluginAction
}
+#ifdef INCLUDE_GTK_SUPPORT
+
+
/******************************************************************************
* *
* Paramètres : plugin = greffon à manipuler. *
@@ -1501,6 +1519,9 @@ void g_plugin_module_notify_panel_docking(const GPluginModule *plugin, PluginAct
}
+#endif
+
+
/******************************************************************************
* *
* Paramètres : plugin = greffon à manipuler. *
diff --git a/src/plugins/plugin.h b/src/plugins/plugin.h
index ff456b3..b13608f 100644
--- a/src/plugins/plugin.h
+++ b/src/plugins/plugin.h
@@ -36,8 +36,10 @@
#include "../format/known.h"
#include "../format/preload.h"
#include "../glibext/configuration.h"
-#include "../gtkext/gtkstatusstack.h"
+#include "../glibext/notifier.h"
+#ifdef INCLUDE_GTK_SUPPORT
#include "../gui/panel.h"
+#endif
@@ -119,6 +121,8 @@ void g_plugin_module_notify_plugins_loaded(GPluginModule *, PluginAction, void *
/* Crée une instance à partir d'un type dynamique externe. */
gpointer g_plugin_module_build_type_instance(GPluginModule *, PluginAction, GType);
+#ifdef INCLUDE_GTK_SUPPORT
+
/* Complète une liste de resources pour thème. */
void g_plugin_module_include_theme(const GPluginModule *, PluginAction, gboolean, char ***, size_t *);
@@ -128,6 +132,8 @@ void g_plugin_module_notify_panel_creation(const GPluginModule *, PluginAction,
/* Rend compte d'un affichage ou d'un retrait de panneau. */
void g_plugin_module_notify_panel_docking(const GPluginModule *, PluginAction, GPanelItem *, bool);
+#endif
+
/* Procède à une opération liée à un contenu binaire. */
void g_plugin_module_handle_binary_content(const GPluginModule *, PluginAction, GBinContent *, wgroup_id_t, GtkStatusStack *);
diff --git a/src/plugins/self.h b/src/plugins/self.h
index 6a2e12d..3c14a0a 100644
--- a/src/plugins/self.h
+++ b/src/plugins/self.h
@@ -26,9 +26,6 @@
#define _PLUGINS_SELF_H
-#include <config.h>
-
-
#ifndef _PLUGINS_PLUGIN_H
# include "plugin.h"
#endif