1 /* -*- Mode: C; indent-tabs-mode: t; c-basic-offset: 4; tab-width: 4 -*- */ 2 /* 3 * anjuta-plugin-manager.h 4 * Copyright (C) Naba Kumar <naba@gnome.org> 5 * 6 * This program is free software; you can redistribute it and/or modify 7 * it under the terms of the GNU General Public License as published by 8 * the Free Software Foundation; either version 2 of the License, or 9 * (at your option) any later version. 10 * 11 * This program is distributed in the hope that it will be useful, 12 * but WITHOUT ANY WARRANTY; without even the implied warranty of 13 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 14 * GNU General Public License for more details. 15 * 16 * You should have received a copy of the GNU General Public License 17 * along with this program; if not, write to the Free Software 18 * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA 19 */ 20 21 #ifndef _ANJUTA_PLUGIN_MANAGER_H_ 22 #define _ANJUTA_PLUGIN_MANAGER_H_ 23 24 #include <glib-object.h> 25 #include <libanjuta/anjuta-status.h> 26 #include <libanjuta/anjuta-plugin-handle.h> 27 28 G_BEGIN_DECLS 29 30 #define ANJUTA_TYPE_PLUGIN_MANAGER (anjuta_plugin_manager_get_type ()) 31 #define ANJUTA_PLUGIN_MANAGER(obj) (G_TYPE_CHECK_INSTANCE_CAST ((obj), ANJUTA_TYPE_PLUGIN_MANAGER, AnjutaPluginManager)) 32 #define ANJUTA_PLUGIN_MANAGER_CLASS(klass) (G_TYPE_CHECK_CLASS_CAST ((klass), ANJUTA_TYPE_PLUGIN_MANAGER, AnjutaPluginManagerClass)) 33 #define ANJUTA_IS_PLUGIN_MANAGER(obj) (G_TYPE_CHECK_INSTANCE_TYPE ((obj), ANJUTA_TYPE_PLUGIN_MANAGER)) 34 #define ANJUTA_IS_PLUGIN_MANAGER_CLASS(klass) (G_TYPE_CHECK_CLASS_TYPE ((klass), ANJUTA_TYPE_PLUGIN_MANAGER)) 35 #define ANJUTA_PLUGIN_MANAGER_GET_CLASS(obj) (G_TYPE_INSTANCE_GET_CLASS ((obj), ANJUTA_TYPE_PLUGIN_MANAGER, AnjutaPluginManagerClass)) 36 #define ANJUTA_PLUGIN_MANAGER_ERROR (anjuta_plugin_manager_error_quark()) 37 38 /** 39 * AnjutaPluginManagerError: 40 * @ANJUTA_PLUGIN_MANAGER_MISSING_FACTORY: The factory for the plugin couldn't be found 41 * @ANJUTA_PLUGIN_MANAGER_ERROR_UNKNOWN: Unknown error 42 */ 43 typedef enum 44 { 45 ANJUTA_PLUGIN_MANAGER_MISSING_FACTORY, 46 ANJUTA_PLUGIN_MANAGER_ERROR_UNKNOWN 47 } AnjutaPluginManagerError; 48 49 50 typedef struct _AnjutaPluginManagerClass AnjutaPluginManagerClass; 51 typedef struct _AnjutaPluginManager AnjutaPluginManager; 52 typedef struct _AnjutaPluginManagerPriv AnjutaPluginManagerPriv; 53 54 struct _AnjutaPluginManagerClass 55 { 56 GObjectClass parent_class; 57 58 /* Signals */ 59 void(* plugin_activated) (AnjutaPluginManager *self, 60 AnjutaPluginHandle* handle, 61 GObject *plugin); 62 void(* plugin_deactivated) (AnjutaPluginManager *self, 63 AnjutaPluginHandle* handle, 64 GObject *plugin); 65 }; 66 67 struct _AnjutaPluginManager 68 { 69 GObject parent_instance; 70 AnjutaPluginManagerPriv *priv; 71 }; 72 73 GQuark anjuta_plugin_manager_error_quark (void); 74 GType anjuta_plugin_manager_get_type (void) G_GNUC_CONST; 75 AnjutaPluginManager* anjuta_plugin_manager_new (GObject *shell, 76 AnjutaStatus *status, 77 GList* plugin_search_paths); 78 79 /* Plugin activation, deactivation and retrival */ 80 gboolean anjuta_plugin_manager_is_active_plugin (AnjutaPluginManager *plugin_manager, 81 const gchar *iface_name); 82 GObject* anjuta_plugin_manager_get_plugin (AnjutaPluginManager *plugin_manager, 83 const gchar *iface_name); 84 GObject* anjuta_plugin_manager_get_plugin_by_handle (AnjutaPluginManager *plugin_manager, 85 AnjutaPluginHandle *handle); 86 gboolean anjuta_plugin_manager_unload_plugin (AnjutaPluginManager *plugin_manager, 87 GObject *plugin_object); 88 gboolean anjuta_plugin_manager_unload_plugin_by_handle (AnjutaPluginManager *plugin_manager, 89 AnjutaPluginHandle *handle); 90 GList* anjuta_plugin_manager_get_active_plugins (AnjutaPluginManager *plugin_manager); 91 GList* anjuta_plugin_manager_get_active_plugin_objects (AnjutaPluginManager *plugin_manager); 92 93 /* Selection dialogs */ 94 GtkWidget* anjuta_plugin_manager_get_plugins_page (AnjutaPluginManager *plugin_manager); 95 GtkWidget* anjuta_plugin_manager_get_remembered_plugins_page (AnjutaPluginManager *plugin_manager); 96 97 /* Plugin queries based on meta-data */ 98 /* Returns a list of plugin Descriptions */ 99 GList* anjuta_plugin_manager_query (AnjutaPluginManager *plugin_manager, 100 const gchar *section_names, 101 const gchar *attribute_names, 102 const gchar *attribute_values, 103 ...); 104 GList* anjuta_plugin_manager_list_query (AnjutaPluginManager *plugin_manager, 105 GList *section_names, 106 GList *attribute_names, 107 GList *attribute_values); 108 109 /* Returns the plugin description that has been selected from the list */ 110 AnjutaPluginHandle* anjuta_plugin_manager_select (AnjutaPluginManager *plugin_manager, 111 gchar *title, gchar *description, 112 GList *plugin_handles); 113 114 GObject* anjuta_plugin_manager_select_and_activate (AnjutaPluginManager *plugin_manager, 115 gchar *title, gchar *description, 116 GList *plugin_handles); 117 118 AnjutaPluginHandle* anjuta_plugin_manager_get_plugin_handle (AnjutaPluginManager *plugin_manager, 119 GObject *plugin); 120 121 122 void anjuta_plugin_manager_activate_plugins (AnjutaPluginManager *plugin_manager, 123 GList *plugin_handles); 124 125 void anjuta_plugin_manager_unload_all_plugins (AnjutaPluginManager *plugin_manager); 126 127 gchar* anjuta_plugin_manager_get_remembered_plugins (AnjutaPluginManager *plugin_manager); 128 void anjuta_plugin_manager_set_remembered_plugins (AnjutaPluginManager *plugin_manager, 129 const gchar *remembered_plugins); 130 void anjuta_plugin_manager_set_disable_plugins (AnjutaPluginManager *plugin_manager, 131 GList *plugin_handles, 132 gboolean disable); 133 134 /** 135 * anjuta_plugin_manager_get_interface: 136 * @plugin_manager: A #AnjutaPluginManager object 137 * @iface_type: The interface type implemented by the object to be found 138 * @error: Error propagation object. 139 * 140 * Equivalent to anjuta_plugin_manager_get_object(), but additionally 141 * typecasts returned object to the interface type. It also takes 142 * interface type directly. A usage of this function is: 143 * <programlisting> 144 * IAnjutaDocumentManager *docman = 145 * anjuta_plugin_manager_get_interface (plugin_manager, IAnjutaDocumentManager, error); 146 * </programlisting> 147 */ 148 #define anjuta_plugin_manager_get_interface(plugin_manager, iface_type, error) \ 149 (((iface_type*) anjuta_plugin_manager_get_plugin((plugin_manager), #iface_type, (error))) 150 151 G_END_DECLS 152 153 #endif /* _ANJUTA_PLUGIN_MANAGER_H_ */ 154