1 /* 2 * peas-engine.h 3 * This file is part of libpeas 4 * 5 * Copyright (C) 2002-2005 - Paolo Maggi 6 * 7 * libpeas is free software; you can redistribute it and/or 8 * modify it under the terms of the GNU Lesser General Public 9 * License as published by the Free Software Foundation; either 10 * version 2.1 of the License, or (at your option) any later version. 11 * 12 * libpeas is distributed in the hope that it will be useful, 13 * but WITHOUT ANY WARRANTY; without even the implied warranty of 14 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU 15 * Lesser General Public License for more details. 16 * 17 * You should have received a copy of the GNU Lesser General Public 18 * License along with this library; if not, write to the Free Software 19 * Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA. 20 */ 21 22 #ifndef __PEAS_ENGINE_H__ 23 #define __PEAS_ENGINE_H__ 24 25 #include <glib.h> 26 27 #include "peas-plugin-info.h" 28 #include "peas-extension.h" 29 #include "peas-version-macros.h" 30 31 G_BEGIN_DECLS 32 33 #define PEAS_TYPE_ENGINE (peas_engine_get_type ()) 34 #define PEAS_ENGINE(obj) (G_TYPE_CHECK_INSTANCE_CAST((obj), PEAS_TYPE_ENGINE, PeasEngine)) 35 #define PEAS_ENGINE_CLASS(klass) (G_TYPE_CHECK_CLASS_CAST((klass), PEAS_TYPE_ENGINE, PeasEngineClass)) 36 #define PEAS_IS_ENGINE(obj) (G_TYPE_CHECK_INSTANCE_TYPE((obj), PEAS_TYPE_ENGINE)) 37 #define PEAS_IS_ENGINE_CLASS(klass) (G_TYPE_CHECK_CLASS_TYPE ((klass), PEAS_TYPE_ENGINE)) 38 #define PEAS_ENGINE_GET_CLASS(obj) (G_TYPE_INSTANCE_GET_CLASS((obj), PEAS_TYPE_ENGINE, PeasEngineClass)) 39 40 typedef struct _PeasEngine PeasEngine; 41 typedef struct _PeasEngineClass PeasEngineClass; 42 typedef struct _PeasEnginePrivate PeasEnginePrivate; 43 44 /** 45 * PeasEngine: 46 * 47 * The #PeasEngine structure contains only private data and should only be 48 * accessed using the provided API. 49 */ 50 struct _PeasEngine { 51 GObject parent; 52 53 /*< private > */ 54 PeasEnginePrivate *priv; 55 }; 56 57 /** 58 * PeasEngineClass: 59 * @parent_class: The parent class. 60 * @load_plugin: Signal class handler for the #PeasEngine::load-plugin signal. 61 * @unload_plugin: Signal class handler for the #PeasEngine::unload-plugin signal. 62 * 63 * Class structure for #PeasEngine. 64 */ 65 struct _PeasEngineClass { 66 GObjectClass parent_class; 67 68 void (*load_plugin) (PeasEngine *engine, 69 PeasPluginInfo *info); 70 71 void (*unload_plugin) (PeasEngine *engine, 72 PeasPluginInfo *info); 73 74 /*< private >*/ 75 gpointer padding[8]; 76 }; 77 78 PEAS_AVAILABLE_IN_ALL 79 GType peas_engine_get_type (void) G_GNUC_CONST; 80 PEAS_AVAILABLE_IN_ALL 81 PeasEngine *peas_engine_new (void); 82 PEAS_AVAILABLE_IN_ALL 83 PeasEngine *peas_engine_new_with_nonglobal_loaders 84 (void); 85 PEAS_AVAILABLE_IN_ALL 86 PeasEngine *peas_engine_get_default (void); 87 88 PEAS_AVAILABLE_IN_ALL 89 void peas_engine_add_search_path (PeasEngine *engine, 90 const gchar *module_dir, 91 const gchar *data_dir); 92 PEAS_AVAILABLE_IN_ALL 93 void peas_engine_prepend_search_path (PeasEngine *engine, 94 const gchar *module_dir, 95 const gchar *data_dir); 96 97 /* plugin management */ 98 PEAS_AVAILABLE_IN_ALL 99 void peas_engine_enable_loader (PeasEngine *engine, 100 const gchar *loader_name); 101 PEAS_AVAILABLE_IN_ALL 102 void peas_engine_rescan_plugins (PeasEngine *engine); 103 PEAS_AVAILABLE_IN_ALL 104 const GList *peas_engine_get_plugin_list (PeasEngine *engine); 105 PEAS_AVAILABLE_IN_ALL 106 gchar **peas_engine_get_loaded_plugins (PeasEngine *engine); 107 PEAS_AVAILABLE_IN_ALL 108 void peas_engine_set_loaded_plugins (PeasEngine *engine, 109 const gchar **plugin_names); 110 PEAS_AVAILABLE_IN_ALL 111 PeasPluginInfo *peas_engine_get_plugin_info (PeasEngine *engine, 112 const gchar *plugin_name); 113 114 /* plugin loading and unloading */ 115 PEAS_AVAILABLE_IN_ALL 116 gboolean peas_engine_load_plugin (PeasEngine *engine, 117 PeasPluginInfo *info); 118 PEAS_AVAILABLE_IN_ALL 119 gboolean peas_engine_unload_plugin (PeasEngine *engine, 120 PeasPluginInfo *info); 121 PEAS_AVAILABLE_IN_ALL 122 void peas_engine_garbage_collect (PeasEngine *engine); 123 124 PEAS_AVAILABLE_IN_ALL 125 gboolean peas_engine_provides_extension (PeasEngine *engine, 126 PeasPluginInfo *info, 127 GType extension_type); 128 129 130 G_GNUC_BEGIN_IGNORE_DEPRECATIONS 131 PEAS_AVAILABLE_IN_ALL 132 PeasExtension *peas_engine_create_extensionv (PeasEngine *engine, 133 PeasPluginInfo *info, 134 GType extension_type, 135 guint n_parameters, 136 GParameter *parameters); 137 G_GNUC_END_IGNORE_DEPRECATIONS 138 139 PEAS_AVAILABLE_IN_1_24 140 PeasExtension *peas_engine_create_extension_with_properties 141 (PeasEngine *engine, 142 PeasPluginInfo *info, 143 GType extension_type, 144 guint n_properties, 145 const gchar **prop_names, 146 const GValue *prop_values); 147 148 PEAS_AVAILABLE_IN_ALL 149 PeasExtension *peas_engine_create_extension_valist 150 (PeasEngine *engine, 151 PeasPluginInfo *info, 152 GType extension_type, 153 const gchar *first_property, 154 va_list var_args); 155 PEAS_AVAILABLE_IN_ALL 156 PeasExtension *peas_engine_create_extension (PeasEngine *engine, 157 PeasPluginInfo *info, 158 GType extension_type, 159 const gchar *first_property, 160 ...); 161 162 163 G_END_DECLS 164 165 #endif /* __PEAS_ENGINE_H__ */ 166