1 /* -*- Mode: C; indent-tabs-mode: t; c-basic-offset: 4; tab-width: 4 -*- */
3 * anjuta-plugin-manager.h
4 * Copyright (C) Naba Kumar <naba@gnome.org>
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.
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.
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
21 #ifndef _ANJUTA_PLUGIN_MANAGER_H_
22 #define _ANJUTA_PLUGIN_MANAGER_H_
24 #include <glib-object.h>
25 #include <libanjuta/anjuta-status.h>
26 #include <libanjuta/anjuta-plugin-description.h>
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())
40 ANJUTA_PLUGIN_MANAGER_MISSING_FACTORY
,
41 ANJUTA_PLUGIN_MANAGER_ERROR_UNKNOWN
42 } AnjutaPluginManagerError
;
45 typedef struct _AnjutaPluginManagerClass AnjutaPluginManagerClass
;
46 typedef struct _AnjutaPluginManager AnjutaPluginManager
;
47 typedef struct _AnjutaPluginManagerPriv AnjutaPluginManagerPriv
;
49 struct _AnjutaPluginManagerClass
51 GObjectClass parent_class
;
54 void(* plugin_activated
) (AnjutaPluginManager
*self
,
55 AnjutaPluginDescription
* plugin_desc
,
57 void(* plugin_deactivated
) (AnjutaPluginManager
*self
,
58 AnjutaPluginDescription
* plugin_desc
,
62 struct _AnjutaPluginManager
64 GObject parent_instance
;
65 AnjutaPluginManagerPriv
*priv
;
68 GQuark
anjuta_plugin_manager_error_quark (void);
69 GType
anjuta_plugin_manager_get_type (void) G_GNUC_CONST
;
70 AnjutaPluginManager
* anjuta_plugin_manager_new (GObject
*shell
,
72 GList
* plugin_search_paths
);
74 /* Plugin activation, deactivation and retrival */
75 gboolean
anjuta_plugin_manager_is_active_plugin (AnjutaPluginManager
*plugin_manager
,
76 const gchar
*iface_name
);
77 GObject
* anjuta_plugin_manager_get_plugin (AnjutaPluginManager
*plugin_manager
,
78 const gchar
*iface_name
);
79 GObject
* anjuta_plugin_manager_get_plugin_by_id (AnjutaPluginManager
*plugin_manager
,
80 const gchar
*plugin_id
);
81 gboolean
anjuta_plugin_manager_unload_plugin (AnjutaPluginManager
*plugin_manager
,
83 gboolean
anjuta_plugin_manager_unload_plugin_by_id (AnjutaPluginManager
*plugin_manager
,
84 const gchar
*plugin_id
);
85 GList
* anjuta_plugin_manager_get_active_plugins (AnjutaPluginManager
*plugin_manager
);
86 GList
* anjuta_plugin_manager_get_active_plugin_objects (AnjutaPluginManager
*plugin_manager
);
88 /* Selection dialogs */
89 GtkWidget
* anjuta_plugin_manager_get_plugins_page (AnjutaPluginManager
*plugin_manager
);
90 GtkWidget
* anjuta_plugin_manager_get_remembered_plugins_page (AnjutaPluginManager
*plugin_manager
);
92 /* Plugin queries based on meta-data */
93 /* Returns a list of plugin Descriptions */
94 GList
* anjuta_plugin_manager_query (AnjutaPluginManager
*plugin_manager
,
95 const gchar
*section_name
,
96 const gchar
*attribute_name
,
97 const gchar
*attribute_value
,
100 /* Returns the plugin description that has been selected from the list */
101 AnjutaPluginDescription
* anjuta_plugin_manager_select (AnjutaPluginManager
*plugin_manager
,
102 gchar
*title
, gchar
*description
,
103 GList
*plugin_descriptions
);
105 /* Returns the plugin that has been selected and activated */
106 GObject
* anjuta_plugin_manager_select_and_activate (AnjutaPluginManager
*plugin_manager
,
109 GList
*plugin_descriptions
);
111 void anjuta_plugin_manager_activate_plugins (AnjutaPluginManager
*plugin_manager
,
112 GList
*plugin_descs
);
114 void anjuta_plugin_manager_unload_all_plugins (AnjutaPluginManager
*plugin_manager
);
116 gchar
* anjuta_plugin_manager_get_remembered_plugins (AnjutaPluginManager
*plugin_manager
);
117 void anjuta_plugin_manager_set_remembered_plugins (AnjutaPluginManager
*plugin_manager
,
118 const gchar
*remembered_plugins
);
121 * anjuta_plugin_manager_get_interface:
122 * @plugin_manager: A #AnjutaPluginManager object
123 * @iface_type: The interface type implemented by the object to be found
124 * @error: Error propagation object.
126 * Equivalent to anjuta_plugin_manager_get_object(), but additionally
127 * typecasts returned object to the interface type. It also takes
128 * interface type directly. A usage of this function is:
130 * IAnjutaDocumentManager *docman =
131 * anjuta_plugin_manager_get_interface (plugin_manager, IAnjutaDocumentManager, error);
134 #define anjuta_plugin_manager_get_interface(plugin_manager, iface_type, error) \
135 (((iface_type*) anjuta_plugin_manager_get_plugin((plugin_manager), #iface_type, (error)))
139 #endif /* _ANJUTA_PLUGIN_MANAGER_H_ */