[gedit/eggplugins: 3/6] [libplugins] Rename GeditPlugin* Into EggPlugins*
- From: Steve Frécinaux <sfre src gnome org>
- To: svn-commits-list gnome org
- Cc:
- Subject: [gedit/eggplugins: 3/6] [libplugins] Rename GeditPlugin* Into EggPlugins*
- Date: Fri, 9 Oct 2009 18:02:49 +0000 (UTC)
commit fbc943e3f8c57a6e220de7fcee69ddbf9dbe9f46
Author: Steve Frécinaux <code istique net>
Date: Fri Oct 9 10:51:08 2009 +0200
[libplugins] Rename GeditPlugin* Into EggPlugins*
This is necessary if we want to be able to inherit these to implement
gedit-specific stuff, as a GeditPluginsEngine and GeditPlugin.
Also fix trailing whitespaces.
Note: python bindings are not converted yet.
gedit/gedit-dirs.c | 2 +-
gedit/gedit-dirs.h | 2 +-
gedit/gedit-plugin-manager.c | 112 +++---
gedit/gedit-prefs-manager-app.c | 8 +-
gedit/gedit-session.c | 2 +-
gedit/gedit-window.c | 24 +-
gedit/gedit.c | 6 +-
libplugins/Makefile.am | 22 +-
...gedit-plugins-engine.c => egg-plugins-engine.c} | 388 ++++++++++----------
libplugins/egg-plugins-engine.h | 108 ++++++
...-plugin-info-priv.h => egg-plugins-info-priv.h} | 30 +-
.../{gedit-plugin-info.c => egg-plugins-info.c} | 94 +++---
libplugins/egg-plugins-info.h | 63 ++++
...{gedit-plugin-loader.c => egg-plugins-loader.c} | 84 +++---
libplugins/egg-plugins-loader.h | 106 ++++++
...object-module.c => egg-plugins-object-module.c} | 120 +++---
libplugins/egg-plugins-object-module.h | 96 +++++
.../{gedit-plugin.c => egg-plugins-plugin.c} | 166 +++++-----
.../{gedit-plugin.h => egg-plugins-plugin.h} | 114 +++---
libplugins/gedit-object-module.h | 94 -----
libplugins/gedit-plugin-info.h | 63 ----
libplugins/gedit-plugin-loader.h | 106 ------
libplugins/gedit-plugins-engine.h | 107 ------
plugin-loaders/c/Makefile.am | 4 +-
plugin-loaders/c/egg-plugins-loader-c.c | 182 +++++++++
plugin-loaders/c/egg-plugins-loader-c.h | 60 +++
plugin-loaders/c/gedit-plugin-loader-c.c | 182 ---------
plugin-loaders/c/gedit-plugin-loader-c.h | 60 ---
plugin-loaders/python/Makefile.am | 8 +-
...loader-python.c => egg-plugins-loader-python.c} | 241 ++++++------
plugin-loaders/python/egg-plugins-loader-python.h | 61 +++
...plugin-python.c => egg-plugins-plugin-python.c} | 116 +++---
plugin-loaders/python/egg-plugins-plugin-python.h | 88 +++++
plugin-loaders/python/gedit-plugin-loader-python.h | 61 ---
plugin-loaders/python/gedit-plugin-python.h | 88 -----
35 files changed, 1536 insertions(+), 1532 deletions(-)
---
diff --git a/gedit/gedit-dirs.c b/gedit/gedit-dirs.c
index da9fec5..3cbcc8f 100644
--- a/gedit/gedit-dirs.c
+++ b/gedit/gedit-dirs.c
@@ -206,7 +206,7 @@ gedit_dirs_get_gedit_plugins_dir (void)
}
gchar *
-gedit_dirs_get_gedit_plugin_loaders_dir (void)
+gedit_dirs_get_gedit_plugins_loaders_dir (void)
{
gchar *lib_dir;
gchar *loader_dir;
diff --git a/gedit/gedit-dirs.h b/gedit/gedit-dirs.h
index eddd00d..202f1e2 100644
--- a/gedit/gedit-dirs.h
+++ b/gedit/gedit-dirs.h
@@ -44,7 +44,7 @@ gchar *gedit_dirs_get_gedit_lib_dir (void);
gchar *gedit_dirs_get_gedit_plugins_dir (void);
-gchar *gedit_dirs_get_gedit_plugin_loaders_dir
+gchar *gedit_dirs_get_gedit_plugins_loaders_dir
(void);
gchar *gedit_dirs_get_ui_file (const gchar *file);
diff --git a/gedit/gedit-plugin-manager.c b/gedit/gedit-plugin-manager.c
index 30941ad..a2b7a10 100644
--- a/gedit/gedit-plugin-manager.c
+++ b/gedit/gedit-plugin-manager.c
@@ -39,8 +39,8 @@
#include "gedit-plugin-manager.h"
#include "gedit-utils.h"
-#include <libplugins/gedit-plugins-engine.h>
-#include <libplugins/gedit-plugin.h>
+#include <libplugins/egg-plugins-engine.h>
+#include <libplugins/egg-plugins-plugin.h>
#include "gedit-debug.h"
enum
@@ -63,7 +63,7 @@ struct _GeditPluginManagerPrivate
GtkWidget *about_button;
GtkWidget *configure_button;
- GeditPluginsEngine *engine;
+ EggPluginsEngine *engine;
GtkWidget *about;
@@ -72,7 +72,7 @@ struct _GeditPluginManagerPrivate
G_DEFINE_TYPE(GeditPluginManager, gedit_plugin_manager, GTK_TYPE_VBOX)
-static GeditPluginInfo *plugin_manager_get_selected_plugin (GeditPluginManager *pm);
+static EggPluginsInfo *plugin_manager_get_selected_plugin (GeditPluginManager *pm);
static void plugin_manager_toggle_active (GeditPluginManager *pm, GtkTreeIter *iter, GtkTreeModel *model);
static void gedit_plugin_manager_finalize (GObject *object);
@@ -90,7 +90,7 @@ static void
about_button_cb (GtkWidget *button,
GeditPluginManager *pm)
{
- GeditPluginInfo *info;
+ EggPluginsInfo *info;
gedit_debug (DEBUG_PLUGINS);
@@ -103,13 +103,13 @@ about_button_cb (GtkWidget *button,
gtk_widget_destroy (pm->priv->about);
pm->priv->about = g_object_new (GTK_TYPE_ABOUT_DIALOG,
- "program-name", gedit_plugin_info_get_name (info),
- "copyright", gedit_plugin_info_get_copyright (info),
- "authors", gedit_plugin_info_get_authors (info),
- "comments", gedit_plugin_info_get_description (info),
- "website", gedit_plugin_info_get_website (info),
- "logo-icon-name", gedit_plugin_info_get_icon_name (info),
- "version", gedit_plugin_info_get_version (info),
+ "program-name", egg_plugins_info_get_name (info),
+ "copyright", egg_plugins_info_get_copyright (info),
+ "authors", egg_plugins_info_get_authors (info),
+ "comments", egg_plugins_info_get_description (info),
+ "website", egg_plugins_info_get_website (info),
+ "logo-icon-name", egg_plugins_info_get_icon_name (info),
+ "version", egg_plugins_info_get_version (info),
NULL);
gtk_window_set_destroy_with_parent (GTK_WINDOW (pm->priv->about),
@@ -133,7 +133,7 @@ static void
configure_button_cb (GtkWidget *button,
GeditPluginManager *pm)
{
- GeditPluginInfo *info;
+ EggPluginsInfo *info;
GtkWindow *toplevel;
gedit_debug (DEBUG_PLUGINS);
@@ -143,11 +143,11 @@ configure_button_cb (GtkWidget *button,
g_return_if_fail (info != NULL);
gedit_debug_message (DEBUG_PLUGINS, "Configuring: %s\n",
- gedit_plugin_info_get_name (info));
+ egg_plugins_info_get_name (info));
toplevel = GTK_WINDOW (gtk_widget_get_toplevel (GTK_WIDGET(pm)));
- gedit_plugins_engine_configure_plugin (pm->priv->engine,
+ egg_plugins_engine_configure_plugin (pm->priv->engine,
info, toplevel);
gedit_debug_message (DEBUG_PLUGINS, "Done");
@@ -160,7 +160,7 @@ plugin_manager_view_info_cell_cb (GtkTreeViewColumn *tree_column,
GtkTreeIter *iter,
gpointer data)
{
- GeditPluginInfo *info;
+ EggPluginsInfo *info;
gchar *text;
g_return_if_fail (tree_model != NULL);
@@ -172,11 +172,11 @@ plugin_manager_view_info_cell_cb (GtkTreeViewColumn *tree_column,
return;
text = g_markup_printf_escaped ("<b>%s</b>\n%s",
- gedit_plugin_info_get_name (info),
- gedit_plugin_info_get_description (info));
+ egg_plugins_info_get_name (info),
+ egg_plugins_info_get_description (info));
g_object_set (G_OBJECT (cell),
"markup", text,
- "sensitive", gedit_plugin_info_is_available (info),
+ "sensitive", egg_plugins_info_is_available (info),
NULL);
g_free (text);
@@ -189,7 +189,7 @@ plugin_manager_view_icon_cell_cb (GtkTreeViewColumn *tree_column,
GtkTreeIter *iter,
gpointer data)
{
- GeditPluginInfo *info;
+ EggPluginsInfo *info;
g_return_if_fail (tree_model != NULL);
g_return_if_fail (tree_column != NULL);
@@ -200,8 +200,8 @@ plugin_manager_view_icon_cell_cb (GtkTreeViewColumn *tree_column,
return;
g_object_set (G_OBJECT (cell),
- "icon-name", gedit_plugin_info_get_icon_name (info),
- "sensitive", gedit_plugin_info_is_available (info),
+ "icon-name", egg_plugins_info_get_icon_name (info),
+ "sensitive", egg_plugins_info_is_available (info),
NULL);
}
@@ -235,7 +235,7 @@ cursor_changed_cb (GtkTreeView *view,
gpointer data)
{
GeditPluginManager *pm = data;
- GeditPluginInfo *info;
+ EggPluginsInfo *info;
gedit_debug (DEBUG_PLUGINS);
@@ -245,7 +245,7 @@ cursor_changed_cb (GtkTreeView *view,
info != NULL);
gtk_widget_set_sensitive (GTK_WIDGET (pm->priv->configure_button),
(info != NULL) &&
- gedit_plugin_info_is_configurable (info));
+ egg_plugins_info_is_configurable (info));
}
static void
@@ -280,19 +280,19 @@ plugin_manager_populate_lists (GeditPluginManager *pm)
gedit_debug (DEBUG_PLUGINS);
- plugins = gedit_plugins_engine_get_plugin_list (pm->priv->engine);
+ plugins = egg_plugins_engine_get_plugin_list (pm->priv->engine);
model = GTK_LIST_STORE (gtk_tree_view_get_model (GTK_TREE_VIEW (pm->priv->tree)));
while (plugins)
{
- GeditPluginInfo *info;
- info = (GeditPluginInfo *)plugins->data;
+ EggPluginsInfo *info;
+ info = (EggPluginsInfo *)plugins->data;
gtk_list_store_append (model, &iter);
gtk_list_store_set (model, &iter,
- ACTIVE_COLUMN, gedit_plugin_info_is_active (info),
- AVAILABLE_COLUMN, gedit_plugin_info_is_available (info),
+ ACTIVE_COLUMN, egg_plugins_info_is_active (info),
+ AVAILABLE_COLUMN, egg_plugins_info_is_available (info),
INFO_COLUMN, info,
-1);
@@ -302,7 +302,7 @@ plugin_manager_populate_lists (GeditPluginManager *pm)
if (gtk_tree_model_get_iter_first (GTK_TREE_MODEL (model), &iter))
{
GtkTreeSelection *selection;
- GeditPluginInfo* info;
+ EggPluginsInfo* info;
selection = gtk_tree_view_get_selection (GTK_TREE_VIEW (pm->priv->tree));
g_return_if_fail (selection != NULL);
@@ -313,7 +313,7 @@ plugin_manager_populate_lists (GeditPluginManager *pm)
INFO_COLUMN, &info, -1);
gtk_widget_set_sensitive (GTK_WIDGET (pm->priv->configure_button),
- gedit_plugin_info_is_configurable (info));
+ egg_plugins_info_is_configurable (info));
}
}
@@ -323,7 +323,7 @@ plugin_manager_set_active (GeditPluginManager *pm,
GtkTreeModel *model,
gboolean active)
{
- GeditPluginInfo *info;
+ EggPluginsInfo *info;
gboolean res = TRUE;
gedit_debug (DEBUG_PLUGINS);
@@ -335,9 +335,9 @@ plugin_manager_set_active (GeditPluginManager *pm,
if (active)
{
/* activate the plugin */
- if (!gedit_plugins_engine_activate_plugin (pm->priv->engine, info)) {
+ if (!egg_plugins_engine_activate_plugin (pm->priv->engine, info)) {
gedit_debug_message (DEBUG_PLUGINS, "Could not activate %s.\n",
- gedit_plugin_info_get_name (info));
+ egg_plugins_info_get_name (info));
res = FALSE;
}
@@ -345,9 +345,9 @@ plugin_manager_set_active (GeditPluginManager *pm,
else
{
/* deactivate the plugin */
- if (!gedit_plugins_engine_deactivate_plugin (pm->priv->engine, info)) {
+ if (!egg_plugins_engine_deactivate_plugin (pm->priv->engine, info)) {
gedit_debug_message (DEBUG_PLUGINS, "Could not deactivate %s.\n",
- gedit_plugin_info_get_name (info));
+ egg_plugins_info_get_name (info));
res = FALSE;
}
@@ -372,10 +372,10 @@ plugin_manager_toggle_active (GeditPluginManager *pm,
plugin_manager_set_active (pm, iter, model, active);
}
-static GeditPluginInfo *
+static EggPluginsInfo *
plugin_manager_get_selected_plugin (GeditPluginManager *pm)
{
- GeditPluginInfo *info = NULL;
+ EggPluginsInfo *info = NULL;
GtkTreeModel *model;
GtkTreeIter iter;
GtkTreeSelection *selection;
@@ -425,7 +425,7 @@ name_search_cb (GtkTreeModel *model,
GtkTreeIter *iter,
gpointer data)
{
- GeditPluginInfo *info;
+ EggPluginsInfo *info;
gchar *normalized_string;
gchar *normalized_key;
gchar *case_normalized_string;
@@ -437,7 +437,7 @@ name_search_cb (GtkTreeModel *model,
if (!info)
return FALSE;
- normalized_string = g_utf8_normalize (gedit_plugin_info_get_name (info), -1, G_NORMALIZE_ALL);
+ normalized_string = g_utf8_normalize (egg_plugins_info_get_name (info), -1, G_NORMALIZE_ALL);
normalized_key = g_utf8_normalize (key, -1, G_NORMALIZE_ALL);
case_normalized_string = g_utf8_casefold (normalized_string, -1);
case_normalized_key = g_utf8_casefold (normalized_key, -1);
@@ -495,7 +495,7 @@ create_tree_popup_menu (GeditPluginManager *pm)
GtkWidget *menu;
GtkWidget *item;
GtkWidget *image;
- GeditPluginInfo *info;
+ EggPluginsInfo *info;
info = plugin_manager_get_selected_plugin (pm);
@@ -515,13 +515,13 @@ create_tree_popup_menu (GeditPluginManager *pm)
gtk_image_menu_item_set_image (GTK_IMAGE_MENU_ITEM (item), image);
g_signal_connect (item, "activate",
G_CALLBACK (configure_button_cb), pm);
- gtk_widget_set_sensitive (item, gedit_plugin_info_is_configurable (info));
+ gtk_widget_set_sensitive (item, egg_plugins_info_is_configurable (info));
gtk_menu_shell_append (GTK_MENU_SHELL (menu), item);
item = gtk_check_menu_item_new_with_mnemonic (_("A_ctivate"));
- gtk_widget_set_sensitive (item, gedit_plugin_info_is_available (info));
+ gtk_widget_set_sensitive (item, egg_plugins_info_is_available (info));
gtk_check_menu_item_set_active (GTK_CHECK_MENU_ITEM (item),
- gedit_plugin_info_is_active (info));
+ egg_plugins_info_is_active (info));
g_signal_connect (item, "toggled",
G_CALLBACK (enable_plugin_menu_cb), pm);
gtk_menu_shell_append (GTK_MENU_SHELL (menu), item);
@@ -628,13 +628,13 @@ model_name_sort_func (GtkTreeModel *model,
GtkTreeIter *iter2,
gpointer user_data)
{
- GeditPluginInfo *info1, *info2;
+ EggPluginsInfo *info1, *info2;
gtk_tree_model_get (model, iter1, INFO_COLUMN, &info1, -1);
gtk_tree_model_get (model, iter2, INFO_COLUMN, &info2, -1);
- return g_utf8_collate (gedit_plugin_info_get_name (info1),
- gedit_plugin_info_get_name (info2));
+ return g_utf8_collate (egg_plugins_info_get_name (info1),
+ egg_plugins_info_get_name (info2));
}
static void
@@ -737,8 +737,8 @@ plugin_manager_construct_tree (GeditPluginManager *pm)
}
static void
-plugin_toggled_cb (GeditPluginsEngine *engine,
- GeditPluginInfo *info,
+plugin_toggled_cb (EggPluginsEngine *engine,
+ EggPluginsInfo *info,
GeditPluginManager *pm)
{
GtkTreeSelection *selection;
@@ -751,7 +751,7 @@ plugin_toggled_cb (GeditPluginsEngine *engine,
if (gtk_tree_selection_get_selected (selection, &model, &iter))
{
/* There is an item selected: it's probably the one we want! */
- GeditPluginInfo *tinfo;
+ EggPluginsInfo *tinfo;
gtk_tree_model_get (model, &iter, INFO_COLUMN, &tinfo, -1);
info_found = info == tinfo;
}
@@ -762,7 +762,7 @@ plugin_toggled_cb (GeditPluginsEngine *engine,
do
{
- GeditPluginInfo *tinfo;
+ EggPluginsInfo *tinfo;
gtk_tree_model_get (model, &iter, INFO_COLUMN, &tinfo, -1);
info_found = info == tinfo;
}
@@ -772,11 +772,11 @@ plugin_toggled_cb (GeditPluginsEngine *engine,
if (!info_found)
{
g_warning ("GeditPluginManager: plugin '%s' not found in the tree model",
- gedit_plugin_info_get_name (info));
+ egg_plugins_info_get_name (info));
return;
}
- gtk_list_store_set (GTK_LIST_STORE (model), &iter, ACTIVE_COLUMN, gedit_plugin_info_is_active (info), -1);
+ gtk_list_store_set (GTK_LIST_STORE (model), &iter, ACTIVE_COLUMN, egg_plugins_info_is_active (info), -1);
}
static void
@@ -793,7 +793,7 @@ gedit_plugin_manager_init (GeditPluginManager *pm)
/*
* Always we create the manager, firstly we rescan the plugins directory
*/
- gedit_plugins_engine_rescan_plugins (gedit_plugins_engine_get_default ());
+ egg_plugins_engine_rescan_plugins (egg_plugins_engine_get_default ());
gtk_box_set_spacing (GTK_BOX (pm), 6);
@@ -845,7 +845,7 @@ gedit_plugin_manager_init (GeditPluginManager *pm)
plugin_manager_construct_tree (pm);
/* get the plugin engine and populate the treeview */
- pm->priv->engine = gedit_plugins_engine_get_default ();
+ pm->priv->engine = egg_plugins_engine_get_default ();
g_signal_connect_after (pm->priv->engine,
"activate-plugin",
@@ -856,7 +856,7 @@ gedit_plugin_manager_init (GeditPluginManager *pm)
G_CALLBACK (plugin_toggled_cb),
pm);
- if (gedit_plugins_engine_get_plugin_list (pm->priv->engine) != NULL)
+ if (egg_plugins_engine_get_plugin_list (pm->priv->engine) != NULL)
{
plugin_manager_populate_lists (pm);
}
diff --git a/gedit/gedit-prefs-manager-app.c b/gedit/gedit-prefs-manager-app.c
index 355dc11..7ff746a 100644
--- a/gedit/gedit-prefs-manager-app.c
+++ b/gedit/gedit-prefs-manager-app.c
@@ -43,7 +43,7 @@
#include "gedit-view.h"
#include "gedit-window.h"
#include "gedit-window-private.h"
-#include <libplugins/gedit-plugins-engine.h>
+#include <libplugins/egg-plugins-engine.h>
#include "gedit-style-scheme-manager.h"
#include "gedit-dirs.h"
@@ -1568,11 +1568,11 @@ gedit_prefs_manager_active_plugins_changed (GConfClient *client,
if ((entry->value->type == GCONF_VALUE_LIST) &&
(gconf_value_get_list_type (entry->value) == GCONF_VALUE_STRING))
{
- GeditPluginsEngine *engine;
+ EggPluginsEngine *engine;
- engine = gedit_plugins_engine_get_default ();
+ engine = egg_plugins_engine_get_default ();
- gedit_plugins_engine_active_plugins_changed (engine);
+ egg_plugins_engine_active_plugins_changed (engine);
}
}
}
diff --git a/gedit/gedit-session.c b/gedit/gedit-session.c
index 5c2fed5..9053ca0 100644
--- a/gedit/gedit-session.c
+++ b/gedit/gedit-session.c
@@ -45,7 +45,7 @@
#include "gedit-session.h"
#include "gedit-debug.h"
-#include <libplugins/gedit-plugins-engine.h>
+#include <libplugins/egg-plugins-engine.h>
#include "gedit-prefs-manager-app.h"
#include "gedit-metadata-manager.h"
#include "gedit-window.h"
diff --git a/gedit/gedit-window.c b/gedit/gedit-window.c
index d571409..1ff8ac8 100644
--- a/gedit/gedit-window.c
+++ b/gedit/gedit-window.c
@@ -52,7 +52,7 @@
#include "gedit-prefs-manager-app.h"
#include "gedit-panel.h"
#include "gedit-documents-panel.h"
-#include <libplugins/gedit-plugins-engine.h>
+#include <libplugins/egg-plugins-engine.h>
#include "gedit-enum-types.h"
#include "gedit-dirs.h"
#include "gedit-status-combo-box.h"
@@ -173,7 +173,7 @@ gedit_window_dispose (GObject *object)
/* First of all, force collection so that plugins
* really drop some of the references.
*/
- gedit_plugins_engine_garbage_collect (gedit_plugins_engine_get_default ());
+ egg_plugins_engine_garbage_collect (egg_plugins_engine_get_default ());
/* save the panes position and make sure to deactivate plugins
* for this window, but only once */
@@ -181,7 +181,7 @@ gedit_window_dispose (GObject *object)
{
save_panes_state (window);
- gedit_plugins_engine_deactivate_plugins (gedit_plugins_engine_get_default (),
+ egg_plugins_engine_deactivate_plugins (egg_plugins_engine_get_default (),
window);
window->priv->dispose_has_run = TRUE;
}
@@ -230,7 +230,7 @@ gedit_window_dispose (GObject *object)
/* Now that there have broken some reference loops,
* force collection again.
*/
- gedit_plugins_engine_garbage_collect (gedit_plugins_engine_get_default ());
+ egg_plugins_engine_garbage_collect (egg_plugins_engine_get_default ());
G_OBJECT_CLASS (gedit_window_parent_class)->dispose (object);
}
@@ -323,7 +323,7 @@ static void
gedit_window_tab_removed (GeditWindow *window,
GeditTab *tab)
{
- gedit_plugins_engine_garbage_collect (gedit_plugins_engine_get_default ());
+ egg_plugins_engine_garbage_collect (egg_plugins_engine_get_default ());
}
static void
@@ -825,7 +825,7 @@ set_sensitivity_according_to_tab (GeditWindow *window,
update_next_prev_doc_sensitivity (window, tab);
- gedit_plugins_engine_update_plugins_ui (gedit_plugins_engine_get_default (),
+ egg_plugins_engine_update_plugins_ui (egg_plugins_engine_get_default (),
window);
}
@@ -2695,7 +2695,7 @@ sync_name (GeditTab *tab,
g_free (escaped_name);
g_free (tip);
- gedit_plugins_engine_update_plugins_ui (gedit_plugins_engine_get_default (),
+ egg_plugins_engine_update_plugins_ui (egg_plugins_engine_get_default (),
window);
}
@@ -3089,7 +3089,7 @@ selection_changed (GeditDocument *doc,
editable &&
gtk_text_buffer_get_has_selection (GTK_TEXT_BUFFER (doc)));
- gedit_plugins_engine_update_plugins_ui (gedit_plugins_engine_get_default (),
+ egg_plugins_engine_update_plugins_ui (egg_plugins_engine_get_default (),
window);
}
@@ -3099,7 +3099,7 @@ sync_languages_menu (GeditDocument *doc,
GeditWindow *window)
{
update_languages_menu (window);
- gedit_plugins_engine_update_plugins_ui (gedit_plugins_engine_get_default (),
+ egg_plugins_engine_update_plugins_ui (egg_plugins_engine_get_default (),
window);
}
@@ -3108,7 +3108,7 @@ editable_changed (GeditView *view,
GParamSpec *arg1,
GeditWindow *window)
{
- gedit_plugins_engine_update_plugins_ui (gedit_plugins_engine_get_default (),
+ egg_plugins_engine_update_plugins_ui (egg_plugins_engine_get_default (),
window);
}
@@ -3313,7 +3313,7 @@ notebook_tab_removed (GeditNotebook *notebook,
"ViewHighlightMode");
gtk_action_set_sensitive (action, FALSE);
- gedit_plugins_engine_update_plugins_ui (gedit_plugins_engine_get_default (),
+ egg_plugins_engine_update_plugins_ui (egg_plugins_engine_get_default (),
window);
}
@@ -3906,7 +3906,7 @@ gedit_window_init (GeditWindow *window)
gedit_debug_message (DEBUG_WINDOW, "Update plugins ui");
- gedit_plugins_engine_activate_plugins (gedit_plugins_engine_get_default (),
+ egg_plugins_engine_activate_plugins (egg_plugins_engine_get_default (),
window);
/* set visibility of panes.
diff --git a/gedit/gedit.c b/gedit/gedit.c
index 951194e..76ef16b 100644
--- a/gedit/gedit.c
+++ b/gedit/gedit.c
@@ -51,7 +51,7 @@
#include "gedit-dirs.h"
#include "gedit-encodings.h"
#include "gedit-metadata-manager.h"
-#include <libplugins/gedit-plugins-engine.h>
+#include <libplugins/egg-plugins-engine.h>
#include "gedit-prefs-manager-app.h"
#include "gedit-session.h"
#include "gedit-utils.h"
@@ -540,7 +540,7 @@ int
main (int argc, char *argv[])
{
GOptionContext *context;
- GeditPluginsEngine *engine;
+ EggPluginsEngine *engine;
GeditWindow *window;
GeditApp *app;
gboolean restored = FALSE;
@@ -678,7 +678,7 @@ main (int argc, char *argv[])
/* Init plugins engine */
gedit_debug_message (DEBUG_APP, "Init plugins");
- engine = gedit_plugins_engine_get_default ();
+ engine = egg_plugins_engine_get_default ();
gtk_about_dialog_set_url_hook (gedit_utils_activate_url, NULL, NULL);
diff --git a/libplugins/Makefile.am b/libplugins/Makefile.am
index f08db3c..e17a6bb 100644
--- a/libplugins/Makefile.am
+++ b/libplugins/Makefile.am
@@ -12,19 +12,19 @@ libplugins_la_LDFLAGS = -export-dynamic -no-undefined -export-symbols-regex "^[[
libplugins_la_LIBADD = $(GEDIT_LIBS)
NOINST_H_FILES = \
- gedit-plugin.h \
- gedit-plugin-info.h \
- gedit-plugin-info-priv.h \
- gedit-plugins-engine.h \
- gedit-plugin-loader.h \
- gedit-object-module.h
+ egg-plugins-plugin.h \
+ egg-plugins-info.h \
+ egg-plugins-info-priv.h \
+ egg-plugins-engine.h \
+ egg-plugins-loader.h \
+ egg-plugins-object-module.h
libplugins_la_SOURCES = \
- gedit-plugin.c \
- gedit-plugin-info.c \
- gedit-plugins-engine.c \
- gedit-plugin-loader.c \
- gedit-object-module.c \
+ egg-plugins-plugin.c \
+ egg-plugins-info.c \
+ egg-plugins-engine.c \
+ egg-plugins-loader.c \
+ egg-plugins-object-module.c \
$(NOINST_H_FILES)
-include $(top_srcdir)/git.mk
diff --git a/libplugins/gedit-plugins-engine.c b/libplugins/egg-plugins-engine.c
similarity index 60%
rename from libplugins/gedit-plugins-engine.c
rename to libplugins/egg-plugins-engine.c
index 4cfc32d..be64baa 100644
--- a/libplugins/gedit-plugins-engine.c
+++ b/libplugins/egg-plugins-engine.c
@@ -2,7 +2,7 @@
* gedit-plugins-engine.c
* This file is part of gedit
*
- * Copyright (C) 2002-2005 Paolo Maggi
+ * Copyright (C) 2002-2005 Paolo Maggi
*
* This program is free software; you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
@@ -16,14 +16,14 @@
*
* You should have received a copy of the GNU General Public License
* along with this program; if not, write to the Free Software
- * Foundation, Inc., 59 Temple Place, Suite 330,
- * Boston, MA 02111-1307, USA.
+ * Foundation, Inc., 59 Temple Place, Suite 330,
+ * Boston, MA 02111-1307, USA.
*/
/*
- * Modified by the gedit Team, 2002-2005. See the AUTHORS file for a
- * list of people on the gedit Team.
- * See the ChangeLog files for a list of changes.
+ * Modified by the gedit Team, 2002-2005. See the AUTHORS file for a
+ * list of people on the gedit Team.
+ * See the ChangeLog files for a list of changes.
*
* $Id$
*/
@@ -36,26 +36,26 @@
#include <glib/gi18n.h>
-#include "gedit-plugins-engine.h"
-#include "gedit-plugin-info-priv.h"
-#include "gedit-plugin-loader.h"
-#include "gedit-object-module.h"
-#include "gedit-plugin.h"
+#include "egg-plugins-engine.h"
+#include "egg-plugins-info-priv.h"
+#include "egg-plugins-loader.h"
+#include "egg-plugins-object-module.h"
+#include "egg-plugins-plugin.h"
#include <gedit/gedit-app.h>
#include <gedit/gedit-window.h>
#include <gedit/gedit-prefs-manager.h>
#include <gedit/gedit-dirs.h>
-#define GEDIT_PLUGINS_ENGINE_BASE_KEY "/apps/gedit-2/plugins"
-#define GEDIT_PLUGINS_ENGINE_KEY GEDIT_PLUGINS_ENGINE_BASE_KEY "/active-plugins"
+#define EGG_PLUGINS_ENGINE_BASE_KEY "/apps/gedit-2/plugins"
+#define EGG_PLUGINS_ENGINE_KEY EGG_PLUGINS_ENGINE_BASE_KEY "/active-plugins"
#define PLUGIN_EXT ".gedit-plugin"
#define LOADER_EXT G_MODULE_SUFFIX
typedef struct
{
- GeditPluginLoader *loader;
- GeditObjectModule *module;
+ EggPluginsLoader *loader;
+ EggPluginsObjectModule *module;
} LoaderInfo;
/* Signals */
@@ -68,27 +68,29 @@ enum
static guint signals[LAST_SIGNAL];
-G_DEFINE_TYPE(GeditPluginsEngine, gedit_plugins_engine, G_TYPE_OBJECT)
+G_DEFINE_TYPE(EggPluginsEngine, egg_plugins_engine, G_TYPE_OBJECT)
-struct _GeditPluginsEnginePrivate
+struct _EggPluginsEnginePrivate
{
+ gchar **plugins_dirs;
+
GList *plugin_list;
GHashTable *loaders;
gboolean activate_from_prefs;
};
-GeditPluginsEngine *default_engine = NULL;
+EggPluginsEngine *default_engine = NULL;
-static void gedit_plugins_engine_activate_plugin_real (GeditPluginsEngine *engine,
- GeditPluginInfo *info);
-static void gedit_plugins_engine_deactivate_plugin_real (GeditPluginsEngine *engine,
- GeditPluginInfo *info);
+static void egg_plugins_engine_activate_plugin_real (EggPluginsEngine *engine,
+ EggPluginsInfo *info);
+static void egg_plugins_engine_deactivate_plugin_real (EggPluginsEngine *engine,
+ EggPluginsInfo *info);
-typedef gboolean (*LoadDirCallback)(GeditPluginsEngine *engine, const gchar *filename, gpointer userdata);
+typedef gboolean (*LoadDirCallback)(EggPluginsEngine *engine, const gchar *filename, gpointer userdata);
static gboolean
-load_dir_real (GeditPluginsEngine *engine,
+load_dir_real (EggPluginsEngine *engine,
const gchar *dir,
const gchar *suffix,
LoadDirCallback callback,
@@ -108,7 +110,7 @@ load_dir_real (GeditPluginsEngine *engine,
g_error_free (error);
return TRUE;
}
-
+
while ((dirent = g_dir_read_name (d)))
{
gchar *filename;
@@ -131,22 +133,22 @@ load_dir_real (GeditPluginsEngine *engine,
}
static gboolean
-load_plugin_info (GeditPluginsEngine *engine,
+load_plugin_info (EggPluginsEngine *engine,
const gchar *filename,
gpointer userdata)
{
- GeditPluginInfo *info;
-
- info = _gedit_plugin_info_new (filename);
+ EggPluginsInfo *info;
+
+ info = _egg_plugins_info_new (filename);
if (info == NULL)
return TRUE;
/* If a plugin with this name has already been loaded
* drop this one (user plugins override system plugins) */
- if (gedit_plugins_engine_get_plugin_info (engine, gedit_plugin_info_get_module_name (info)) != NULL)
+ if (egg_plugins_engine_get_plugin_info (engine, egg_plugins_info_get_module_name (info)) != NULL)
{
- _gedit_plugin_info_unref (info);
+ _egg_plugins_info_unref (info);
return TRUE;
}
@@ -157,7 +159,7 @@ load_plugin_info (GeditPluginsEngine *engine,
}
static void
-load_all_plugins (GeditPluginsEngine *engine)
+load_all_plugins (EggPluginsEngine *engine)
{
gchar *plugin_dir;
const gchar *pdirs_env = NULL;
@@ -176,7 +178,7 @@ load_all_plugins (GeditPluginsEngine *engine)
g_free (plugin_dir);
/* load system plugins */
- pdirs_env = g_getenv ("GEDIT_PLUGINS_PATH");
+ pdirs_env = g_getenv ("EGG_PLUGINS_PLUGINS_PATH");
if (pdirs_env != NULL)
{
@@ -218,11 +220,11 @@ hash_lowercase (gconstpointer data)
{
gchar *lowercase;
guint ret;
-
+
lowercase = g_ascii_strdown ((const gchar *)data, -1);
ret = g_str_hash (lowercase);
g_free (lowercase);
-
+
return ret;
}
@@ -237,17 +239,17 @@ loader_destroy (LoaderInfo *info)
{
if (!info)
return;
-
+
if (info->loader)
g_object_unref (info->loader);
-
+
g_free (info);
}
static void
-add_loader (GeditPluginsEngine *engine,
+add_loader (EggPluginsEngine *engine,
const gchar *loader_id,
- GeditObjectModule *module)
+ EggPluginsObjectModule *module)
{
LoaderInfo *info;
@@ -259,7 +261,7 @@ add_loader (GeditPluginsEngine *engine,
}
static void
-gedit_plugins_engine_init (GeditPluginsEngine *engine)
+egg_plugins_engine_init (EggPluginsEngine *engine)
{
if (!g_module_supported ())
{
@@ -268,8 +270,8 @@ gedit_plugins_engine_init (GeditPluginsEngine *engine)
}
engine->priv = G_TYPE_INSTANCE_GET_PRIVATE (engine,
- GEDIT_TYPE_PLUGINS_ENGINE,
- GeditPluginsEnginePrivate);
+ EGG_PLUGINS_TYPE_ENGINE,
+ EggPluginsEnginePrivate);
load_all_plugins (engine);
@@ -288,11 +290,11 @@ static void
loader_garbage_collect (const char *id, LoaderInfo *info)
{
if (info->loader)
- gedit_plugin_loader_garbage_collect (info->loader);
+ egg_plugins_loader_garbage_collect (info->loader);
}
void
-gedit_plugins_engine_garbage_collect (GeditPluginsEngine *engine)
+egg_plugins_engine_garbage_collect (EggPluginsEngine *engine)
{
g_hash_table_foreach (engine->priv->loaders,
(GHFunc) loader_garbage_collect,
@@ -300,90 +302,90 @@ gedit_plugins_engine_garbage_collect (GeditPluginsEngine *engine)
}
static void
-gedit_plugins_engine_finalize (GObject *object)
+egg_plugins_engine_finalize (GObject *object)
{
- GeditPluginsEngine *engine = GEDIT_PLUGINS_ENGINE (object);
+ EggPluginsEngine *engine = EGG_PLUGINS_ENGINE (object);
GList *item;
-
+
/* Firs deactivate all plugins */
for (item = engine->priv->plugin_list; item; item = item->next)
{
- GeditPluginInfo *info = GEDIT_PLUGIN_INFO (item->data);
-
- if (gedit_plugin_info_is_active (info))
- gedit_plugins_engine_deactivate_plugin_real (engine, info);
+ EggPluginsInfo *info = EGG_PLUGINS_INFO (item->data);
+
+ if (egg_plugins_info_is_active (info))
+ egg_plugins_engine_deactivate_plugin_real (engine, info);
}
-
- /* unref the loaders */
+
+ /* unref the loaders */
g_hash_table_destroy (engine->priv->loaders);
/* and finally free the infos */
for (item = engine->priv->plugin_list; item; item = item->next)
{
- GeditPluginInfo *info = GEDIT_PLUGIN_INFO (item->data);
+ EggPluginsInfo *info = EGG_PLUGINS_INFO (item->data);
- _gedit_plugin_info_unref (info);
+ _egg_plugins_info_unref (info);
}
g_list_free (engine->priv->plugin_list);
- G_OBJECT_CLASS (gedit_plugins_engine_parent_class)->finalize (object);
+ G_OBJECT_CLASS (egg_plugins_engine_parent_class)->finalize (object);
}
static void
-gedit_plugins_engine_class_init (GeditPluginsEngineClass *klass)
+egg_plugins_engine_class_init (EggPluginsEngineClass *klass)
{
GType the_type = G_TYPE_FROM_CLASS (klass);
GObjectClass *object_class = G_OBJECT_CLASS (klass);
- object_class->finalize = gedit_plugins_engine_finalize;
- klass->activate_plugin = gedit_plugins_engine_activate_plugin_real;
- klass->deactivate_plugin = gedit_plugins_engine_deactivate_plugin_real;
+ object_class->finalize = egg_plugins_engine_finalize;
+ klass->activate_plugin = egg_plugins_engine_activate_plugin_real;
+ klass->deactivate_plugin = egg_plugins_engine_deactivate_plugin_real;
signals[ACTIVATE_PLUGIN] =
g_signal_new ("activate-plugin",
the_type,
G_SIGNAL_RUN_LAST,
- G_STRUCT_OFFSET (GeditPluginsEngineClass, activate_plugin),
+ G_STRUCT_OFFSET (EggPluginsEngineClass, activate_plugin),
NULL, NULL,
g_cclosure_marshal_VOID__BOXED,
G_TYPE_NONE,
1,
- GEDIT_TYPE_PLUGIN_INFO | G_SIGNAL_TYPE_STATIC_SCOPE);
+ EGG_PLUGINS_TYPE_INFO | G_SIGNAL_TYPE_STATIC_SCOPE);
signals[DEACTIVATE_PLUGIN] =
g_signal_new ("deactivate-plugin",
the_type,
G_SIGNAL_RUN_LAST,
- G_STRUCT_OFFSET (GeditPluginsEngineClass, deactivate_plugin),
+ G_STRUCT_OFFSET (EggPluginsEngineClass, deactivate_plugin),
NULL, NULL,
g_cclosure_marshal_VOID__BOXED,
G_TYPE_NONE,
1,
- GEDIT_TYPE_PLUGIN_INFO | G_SIGNAL_TYPE_STATIC_SCOPE);
+ EGG_PLUGINS_TYPE_INFO | G_SIGNAL_TYPE_STATIC_SCOPE);
- g_type_class_add_private (klass, sizeof (GeditPluginsEnginePrivate));
+ g_type_class_add_private (klass, sizeof (EggPluginsEnginePrivate));
}
static gboolean
-load_loader (GeditPluginsEngine *engine,
- const gchar *filename,
- gpointer data)
+load_loader (EggPluginsEngine *engine,
+ const gchar *filename,
+ gpointer data)
{
- GeditObjectModule *module;
+ EggPluginsObjectModule *module;
gchar *base;
gchar *path;
const gchar *id;
GType type;
-
+
/* try to load in the module */
path = g_path_get_dirname (filename);
base = g_path_get_basename (filename);
/* for now they are all resident */
- module = gedit_object_module_new (base,
+ module = egg_plugins_object_module_new (base,
path,
- "register_gedit_plugin_loader",
+ "register_egg_plugins_loader",
TRUE);
g_free (base);
@@ -398,12 +400,12 @@ load_loader (GeditPluginsEngine *engine,
return TRUE;
}
- /* get the exported type and check the name as exported by the
+ /* get the exported type and check the name as exported by the
* loader interface */
- type = gedit_object_module_get_object_type (module);
- id = gedit_plugin_loader_type_get_id (type);
-
- add_loader (engine, id, module);
+ type = egg_plugins_object_module_get_object_type (module);
+ id = egg_plugins_loader_type_get_id (type);
+
+ add_loader (engine, id, module);
g_type_module_unuse (G_TYPE_MODULE (module));
return TRUE;
@@ -415,13 +417,13 @@ ensure_loader (LoaderInfo *info)
if (info->loader == NULL && info->module != NULL)
{
/* create a new loader object */
- GeditPluginLoader *loader;
- loader = (GeditPluginLoader *)gedit_object_module_new_object (info->module, NULL);
-
- if (loader == NULL || !GEDIT_IS_PLUGIN_LOADER (loader))
+ EggPluginsLoader *loader;
+ loader = (EggPluginsLoader *)egg_plugins_object_module_new_object (info->module, NULL);
+
+ if (loader == NULL || !EGG_PLUGINS_IS_LOADER (loader))
{
- g_warning ("Loader object is not a valid GeditPluginLoader instance");
-
+ g_warning ("Loader object is not a valid EggPluginsLoader instance");
+
if (loader != NULL && G_IS_OBJECT (loader))
g_object_unref (loader);
}
@@ -432,8 +434,8 @@ ensure_loader (LoaderInfo *info)
}
}
-static GeditPluginLoader *
-get_plugin_loader (GeditPluginsEngine *engine, GeditPluginInfo *info)
+static EggPluginsLoader *
+get_plugin_loader (EggPluginsEngine *engine, EggPluginsInfo *info)
{
const gchar *loader_id;
LoaderInfo *loader_info;
@@ -441,26 +443,26 @@ get_plugin_loader (GeditPluginsEngine *engine, GeditPluginInfo *info)
loader_id = info->loader;
loader_info = (LoaderInfo *)g_hash_table_lookup (
- engine->priv->loaders,
+ engine->priv->loaders,
loader_id);
if (loader_info == NULL)
{
gchar *loader_dir;
- loader_dir = gedit_dirs_get_gedit_plugin_loaders_dir ();
+ loader_dir = gedit_dirs_get_gedit_plugins_loaders_dir ();
- /* loader could not be found in the hash, try to find it by
+ /* loader could not be found in the hash, try to find it by
scanning */
- load_dir_real (engine,
+ load_dir_real (engine,
loader_dir,
LOADER_EXT,
(LoadDirCallback)load_loader,
NULL);
g_free (loader_dir);
-
+
loader_info = (LoaderInfo *)g_hash_table_lookup (
- engine->priv->loaders,
+ engine->priv->loaders,
loader_id);
}
@@ -470,61 +472,61 @@ get_plugin_loader (GeditPluginsEngine *engine, GeditPluginInfo *info)
add_loader (engine, loader_id, NULL);
return NULL;
}
-
+
ensure_loader (loader_info);
return loader_info->loader;
}
-GeditPluginsEngine *
-gedit_plugins_engine_get_default (void)
+EggPluginsEngine *
+egg_plugins_engine_get_default (void)
{
if (default_engine != NULL)
return default_engine;
- default_engine = GEDIT_PLUGINS_ENGINE (g_object_new (GEDIT_TYPE_PLUGINS_ENGINE, NULL));
+ default_engine = EGG_PLUGINS_ENGINE (g_object_new (EGG_PLUGINS_TYPE_ENGINE, NULL));
g_object_add_weak_pointer (G_OBJECT (default_engine),
(gpointer) &default_engine);
return default_engine;
}
const GList *
-gedit_plugins_engine_get_plugin_list (GeditPluginsEngine *engine)
+egg_plugins_engine_get_plugin_list (EggPluginsEngine *engine)
{
return engine->priv->plugin_list;
}
static gint
-compare_plugin_info_and_name (GeditPluginInfo *info,
+compare_plugin_info_and_name (EggPluginsInfo *info,
const gchar *module_name)
{
- return strcmp (gedit_plugin_info_get_module_name (info), module_name);
+ return strcmp (egg_plugins_info_get_module_name (info), module_name);
}
-GeditPluginInfo *
-gedit_plugins_engine_get_plugin_info (GeditPluginsEngine *engine,
+EggPluginsInfo *
+egg_plugins_engine_get_plugin_info (EggPluginsEngine *engine,
const gchar *name)
{
GList *l = g_list_find_custom (engine->priv->plugin_list,
name,
(GCompareFunc) compare_plugin_info_and_name);
- return l == NULL ? NULL : (GeditPluginInfo *) l->data;
+ return l == NULL ? NULL : (EggPluginsInfo *) l->data;
}
static void
-save_active_plugin_list (GeditPluginsEngine *engine)
+save_active_plugin_list (EggPluginsEngine *engine)
{
GSList *active_plugins = NULL;
GList *l;
for (l = engine->priv->plugin_list; l != NULL; l = l->next)
{
- GeditPluginInfo *info = (GeditPluginInfo *) l->data;
+ EggPluginsInfo *info = (EggPluginsInfo *) l->data;
- if (gedit_plugin_info_is_active (info))
+ if (egg_plugins_info_is_active (info))
{
active_plugins = g_slist_prepend (active_plugins,
- (gpointer)gedit_plugin_info_get_module_name (info));
+ (gpointer)egg_plugins_info_get_module_name (info));
}
}
@@ -534,47 +536,47 @@ save_active_plugin_list (GeditPluginsEngine *engine)
}
static gboolean
-load_plugin (GeditPluginsEngine *engine,
- GeditPluginInfo *info)
+load_plugin (EggPluginsEngine *engine,
+ EggPluginsInfo *info)
{
- GeditPluginLoader *loader;
+ EggPluginsLoader *loader;
gchar *path;
- if (gedit_plugin_info_is_active (info))
+ if (egg_plugins_info_is_active (info))
return TRUE;
-
- if (!gedit_plugin_info_is_available (info))
+
+ if (!egg_plugins_info_is_available (info))
return FALSE;
loader = get_plugin_loader (engine, info);
-
+
if (loader == NULL)
{
g_warning ("Could not find loader `%s' for plugin `%s'", info->loader, info->name);
info->available = FALSE;
return FALSE;
}
-
+
path = g_path_get_dirname (info->file);
g_return_val_if_fail (path != NULL, FALSE);
- info->plugin = gedit_plugin_loader_load (loader, info, path);
-
+ info->plugin = egg_plugins_loader_load (loader, info, path);
+
g_free (path);
-
+
if (info->plugin == NULL)
{
g_warning ("Error loading plugin '%s'", info->name);
info->available = FALSE;
return FALSE;
}
-
+
return TRUE;
}
static void
-gedit_plugins_engine_activate_plugin_real (GeditPluginsEngine *engine,
- GeditPluginInfo *info)
+egg_plugins_engine_activate_plugin_real (EggPluginsEngine *engine,
+ EggPluginsInfo *info)
{
const GList *wins;
@@ -585,35 +587,35 @@ gedit_plugins_engine_activate_plugin_real (GeditPluginsEngine *engine,
wins != NULL;
wins = wins->next)
{
- gedit_plugin_activate (info->plugin, GTK_WINDOW (wins->data));
+ egg_plugins_plugin_activate (info->plugin, GTK_WINDOW (wins->data));
}
}
gboolean
-gedit_plugins_engine_activate_plugin (GeditPluginsEngine *engine,
- GeditPluginInfo *info)
+egg_plugins_engine_activate_plugin (EggPluginsEngine *engine,
+ EggPluginsInfo *info)
{
g_return_val_if_fail (info != NULL, FALSE);
- if (!gedit_plugin_info_is_available (info))
+ if (!egg_plugins_info_is_available (info))
return FALSE;
-
- if (gedit_plugin_info_is_active (info))
+
+ if (egg_plugins_info_is_active (info))
return TRUE;
g_signal_emit (engine, signals[ACTIVATE_PLUGIN], 0, info);
- if (gedit_plugin_info_is_active (info))
+ if (egg_plugins_info_is_active (info))
save_active_plugin_list (engine);
- return gedit_plugin_info_is_active (info);
+ return egg_plugins_info_is_active (info);
}
static void
-call_plugin_deactivate (GeditPlugin *plugin,
+call_plugin_deactivate (EggPluginsPlugin *plugin,
GtkWindow *window)
{
- gedit_plugin_deactivate (plugin, window);
+ egg_plugins_plugin_deactivate (plugin, window);
/* ensure update of ui manager, because we suspect it does something
with expected static strings in the type module (when unloaded the
@@ -623,14 +625,14 @@ call_plugin_deactivate (GeditPlugin *plugin,
}
static void
-gedit_plugins_engine_deactivate_plugin_real (GeditPluginsEngine *engine,
- GeditPluginInfo *info)
+egg_plugins_engine_deactivate_plugin_real (EggPluginsEngine *engine,
+ EggPluginsInfo *info)
{
const GList *wins;
- GeditPluginLoader *loader;
+ EggPluginsLoader *loader;
- if (!gedit_plugin_info_is_active (info) ||
- !gedit_plugin_info_is_available (info))
+ if (!egg_plugins_info_is_active (info) ||
+ !egg_plugins_info_is_available (info))
return;
for (wins = gedit_app_get_windows (gedit_app_get_default ());
@@ -642,40 +644,40 @@ gedit_plugins_engine_deactivate_plugin_real (GeditPluginsEngine *engine,
/* first unref the plugin (the loader still has one) */
g_object_unref (info->plugin);
-
+
/* find the loader and tell it to gc and unload the plugin */
loader = get_plugin_loader (engine, info);
-
- gedit_plugin_loader_garbage_collect (loader);
- gedit_plugin_loader_unload (loader, info);
-
+
+ egg_plugins_loader_garbage_collect (loader);
+ egg_plugins_loader_unload (loader, info);
+
info->plugin = NULL;
}
gboolean
-gedit_plugins_engine_deactivate_plugin (GeditPluginsEngine *engine,
- GeditPluginInfo *info)
+egg_plugins_engine_deactivate_plugin (EggPluginsEngine *engine,
+ EggPluginsInfo *info)
{
g_return_val_if_fail (info != NULL, FALSE);
- if (!gedit_plugin_info_is_active (info))
+ if (!egg_plugins_info_is_active (info))
return TRUE;
g_signal_emit (engine, signals[DEACTIVATE_PLUGIN], 0, info);
- if (!gedit_plugin_info_is_active (info))
+ if (!egg_plugins_info_is_active (info))
save_active_plugin_list (engine);
- return !gedit_plugin_info_is_active (info);
+ return !egg_plugins_info_is_active (info);
}
void
-gedit_plugins_engine_activate_plugins (GeditPluginsEngine *engine,
- GtkWindow *window)
+egg_plugins_engine_activate_plugins (EggPluginsEngine *engine,
+ GtkWindow *window)
{
GSList *active_plugins = NULL;
GList *pl;
- g_return_if_fail (GEDIT_IS_PLUGINS_ENGINE (engine));
+ g_return_if_fail (EGG_PLUGINS_IS_ENGINE (engine));
g_return_if_fail (GTK_IS_WINDOW (window));
/* the first time, we get the 'active' plugins from gconf */
@@ -686,90 +688,90 @@ gedit_plugins_engine_activate_plugins (GeditPluginsEngine *engine,
for (pl = engine->priv->plugin_list; pl; pl = pl->next)
{
- GeditPluginInfo *info = (GeditPluginInfo*)pl->data;
-
- if (engine->priv->activate_from_prefs &&
+ EggPluginsInfo *info = (EggPluginsInfo*)pl->data;
+
+ if (engine->priv->activate_from_prefs &&
g_slist_find_custom (active_plugins,
- gedit_plugin_info_get_module_name (info),
+ egg_plugins_info_get_module_name (info),
(GCompareFunc)strcmp) == NULL)
continue;
-
+
/* If plugin is not active, don't try to activate/load it */
- if (!engine->priv->activate_from_prefs &&
- !gedit_plugin_info_is_active (info))
+ if (!engine->priv->activate_from_prefs &&
+ !egg_plugins_info_is_active (info))
continue;
if (load_plugin (engine, info))
- gedit_plugin_activate (info->plugin,
+ egg_plugins_plugin_activate (info->plugin,
window);
}
-
+
if (engine->priv->activate_from_prefs)
{
g_slist_foreach (active_plugins, (GFunc) g_free, NULL);
g_slist_free (active_plugins);
engine->priv->activate_from_prefs = FALSE;
}
-
+
/* also call update_ui after activation */
- gedit_plugins_engine_update_plugins_ui (engine, window);
+ egg_plugins_engine_update_plugins_ui (engine, window);
}
void
-gedit_plugins_engine_deactivate_plugins (GeditPluginsEngine *engine,
- GtkWindow *window)
+egg_plugins_engine_deactivate_plugins (EggPluginsEngine *engine,
+ GtkWindow *window)
{
GList *pl;
-
- g_return_if_fail (GEDIT_IS_PLUGINS_ENGINE (engine));
+
+ g_return_if_fail (EGG_PLUGINS_IS_ENGINE (engine));
g_return_if_fail (GTK_IS_WINDOW (window));
-
+
for (pl = engine->priv->plugin_list; pl; pl = pl->next)
{
- GeditPluginInfo *info = (GeditPluginInfo*)pl->data;
-
+ EggPluginsInfo *info = (EggPluginsInfo*)pl->data;
+
/* check if the plugin is actually active */
- if (!gedit_plugin_info_is_active (info))
+ if (!egg_plugins_info_is_active (info))
continue;
-
+
/* call deactivate for the plugin for this window */
- gedit_plugin_deactivate (info->plugin, window);
+ egg_plugins_plugin_deactivate (info->plugin, window);
}
}
void
-gedit_plugins_engine_update_plugins_ui (GeditPluginsEngine *engine,
- GtkWindow *window)
+egg_plugins_engine_update_plugins_ui (EggPluginsEngine *engine,
+ GtkWindow *window)
{
GList *pl;
- g_return_if_fail (GEDIT_IS_PLUGINS_ENGINE (engine));
+ g_return_if_fail (EGG_PLUGINS_IS_ENGINE (engine));
g_return_if_fail (GTK_IS_WINDOW (window));
/* call update_ui for all active plugins */
for (pl = engine->priv->plugin_list; pl; pl = pl->next)
{
- GeditPluginInfo *info = (GeditPluginInfo*)pl->data;
+ EggPluginsInfo *info = (EggPluginsInfo*)pl->data;
- if (!gedit_plugin_info_is_active (info))
+ if (!egg_plugins_info_is_active (info))
continue;
-
- gedit_plugin_update_ui (info->plugin, window);
+
+ egg_plugins_plugin_update_ui (info->plugin, window);
}
}
-void
-gedit_plugins_engine_configure_plugin (GeditPluginsEngine *engine,
- GeditPluginInfo *info,
- GtkWindow *parent)
+void
+egg_plugins_engine_configure_plugin (EggPluginsEngine *engine,
+ EggPluginsInfo *info,
+ GtkWindow *parent)
{
GtkWidget *conf_dlg;
-
+
GtkWindowGroup *wg;
-
+
g_return_if_fail (info != NULL);
- conf_dlg = gedit_plugin_create_configure_dialog (info->plugin);
+ conf_dlg = egg_plugins_plugin_create_configure_dialog (info->plugin);
g_return_if_fail (conf_dlg != NULL);
gtk_window_set_transient_for (GTK_WINDOW (conf_dlg),
parent);
@@ -780,16 +782,16 @@ gedit_plugins_engine_configure_plugin (GeditPluginsEngine *engine,
wg = gtk_window_group_new ();
gtk_window_group_add_window (wg, parent);
}
-
+
gtk_window_group_add_window (wg,
GTK_WINDOW (conf_dlg));
-
- gtk_window_set_modal (GTK_WINDOW (conf_dlg), TRUE);
+
+ gtk_window_set_modal (GTK_WINDOW (conf_dlg), TRUE);
gtk_widget_show (conf_dlg);
}
-void
-gedit_plugins_engine_active_plugins_changed (GeditPluginsEngine *engine)
+void
+egg_plugins_engine_active_plugins_changed (EggPluginsEngine *engine)
{
gboolean to_activate;
GSList *active_plugins;
@@ -799,18 +801,18 @@ gedit_plugins_engine_active_plugins_changed (GeditPluginsEngine *engine)
for (pl = engine->priv->plugin_list; pl; pl = pl->next)
{
- GeditPluginInfo *info = (GeditPluginInfo*)pl->data;
+ EggPluginsInfo *info = (EggPluginsInfo*)pl->data;
- if (!gedit_plugin_info_is_available (info))
+ if (!egg_plugins_info_is_available (info))
continue;
to_activate = (g_slist_find_custom (active_plugins,
- gedit_plugin_info_get_module_name (info),
+ egg_plugins_info_get_module_name (info),
(GCompareFunc)strcmp) != NULL);
- if (!gedit_plugin_info_is_active (info) && to_activate)
+ if (!egg_plugins_info_is_active (info) && to_activate)
g_signal_emit (engine, signals[ACTIVATE_PLUGIN], 0, info);
- else if (gedit_plugin_info_is_active (info) && !to_activate)
+ else if (egg_plugins_info_is_active (info) && !to_activate)
g_signal_emit (engine, signals[DEACTIVATE_PLUGIN], 0, info);
}
@@ -819,7 +821,7 @@ gedit_plugins_engine_active_plugins_changed (GeditPluginsEngine *engine)
}
void
-gedit_plugins_engine_rescan_plugins (GeditPluginsEngine *engine)
+egg_plugins_engine_rescan_plugins (EggPluginsEngine *engine)
{
load_all_plugins (engine);
}
diff --git a/libplugins/egg-plugins-engine.h b/libplugins/egg-plugins-engine.h
new file mode 100644
index 0000000..6dba29e
--- /dev/null
+++ b/libplugins/egg-plugins-engine.h
@@ -0,0 +1,108 @@
+/*
+ * egg-plugins-engine.h
+ * This file is part of gedit
+ *
+ * Copyright (C) 2002-2005 - Paolo Maggi
+ *
+ * This program is free software; you can redistribute it and/or modify
+ * it under the terms of the GNU General Public License as published by
+ * the Free Software Foundation; either version 2 of the License, or
+ * (at your option) any later version.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with this program; if not, write to the Free Software
+ * Foundation, Inc., 59 Temple Place, Suite 330,
+ * Boston, MA 02111-1307, USA.
+ */
+
+/*
+ * Modified by the gedit Team, 2002-2005. See the AUTHORS file for a
+ * list of people on the gedit Team.
+ * See the ChangeLog files for a list of changes.
+ *
+ * $Id$
+ */
+
+#ifndef __EGG_PLUGINS_ENGINE_H__
+#define __EGG_PLUGINS_ENGINE_H__
+
+#include <glib.h>
+#include <gtk/gtk.h>
+#include "egg-plugins-info.h"
+#include "egg-plugins-plugin.h"
+
+G_BEGIN_DECLS
+
+#define EGG_PLUGINS_TYPE_ENGINE (egg_plugins_engine_get_type ())
+#define EGG_PLUGINS_ENGINE(obj) (G_TYPE_CHECK_INSTANCE_CAST((obj), EGG_PLUGINS_TYPE_ENGINE, EggPluginsEngine))
+#define EGG_PLUGINS_ENGINE_CLASS(klass) (G_TYPE_CHECK_CLASS_CAST((klass), EGG_PLUGINS_TYPE_ENGINE, EggPluginsEngineClass))
+#define EGG_PLUGINS_IS_ENGINE(obj) (G_TYPE_CHECK_INSTANCE_TYPE((obj), EGG_PLUGINS_TYPE_ENGINE))
+#define EGG_PLUGINS_IS_ENGINE_CLASS(klass) (G_TYPE_CHECK_CLASS_TYPE ((klass), EGG_PLUGINS_TYPE_ENGINE))
+#define EGG_PLUGINS_ENGINE_GET_CLASS(obj) (G_TYPE_INSTANCE_GET_CLASS((obj), EGG_PLUGINS_TYPE_ENGINE, EggPluginsEngineClass))
+
+typedef struct _EggPluginsEngine EggPluginsEngine;
+typedef struct _EggPluginsEnginePrivate EggPluginsEnginePrivate;
+
+struct _EggPluginsEngine
+{
+ GObject parent;
+ EggPluginsEnginePrivate *priv;
+};
+
+typedef struct _EggPluginsEngineClass EggPluginsEngineClass;
+
+struct _EggPluginsEngineClass
+{
+ GObjectClass parent_class;
+
+ void (* activate_plugin) (EggPluginsEngine *engine,
+ EggPluginsInfo *info);
+
+ void (* deactivate_plugin) (EggPluginsEngine *engine,
+ EggPluginsInfo *info);
+};
+
+GType egg_plugins_engine_get_type (void) G_GNUC_CONST;
+
+EggPluginsEngine
+ *egg_plugins_engine_get_default (void);
+
+void egg_plugins_engine_garbage_collect (EggPluginsEngine *engine);
+
+const GList *egg_plugins_engine_get_plugin_list (EggPluginsEngine *engine);
+
+EggPluginsInfo *egg_plugins_engine_get_plugin_info (EggPluginsEngine *engine,
+ const gchar *name);
+
+/* plugin load and unloading (overall, for all windows) */
+gboolean egg_plugins_engine_activate_plugin (EggPluginsEngine *engine,
+ EggPluginsInfo *info);
+gboolean egg_plugins_engine_deactivate_plugin (EggPluginsEngine *engine,
+ EggPluginsInfo *info);
+
+void egg_plugins_engine_configure_plugin (EggPluginsEngine *engine,
+ EggPluginsInfo *info,
+ GtkWindow *parent);
+
+/* plugin activation/deactivation per window, private to GtkWindow */
+void egg_plugins_engine_activate_plugins (EggPluginsEngine *engine,
+ GtkWindow *window);
+void egg_plugins_engine_deactivate_plugins (EggPluginsEngine *engine,
+ GtkWindow *window);
+void egg_plugins_engine_update_plugins_ui (EggPluginsEngine *engine,
+ GtkWindow *window);
+
+/* private for gconf notification */
+void egg_plugins_engine_active_plugins_changed
+ (EggPluginsEngine *engine);
+
+void egg_plugins_engine_rescan_plugins (EggPluginsEngine *engine);
+
+G_END_DECLS
+
+#endif /* __EGG_PLUGINS_ENGINE_H__ */
diff --git a/libplugins/gedit-plugin-info-priv.h b/libplugins/egg-plugins-info-priv.h
similarity index 72%
rename from libplugins/gedit-plugin-info-priv.h
rename to libplugins/egg-plugins-info-priv.h
index 247b51c..c2a35c2 100644
--- a/libplugins/gedit-plugin-info-priv.h
+++ b/libplugins/egg-plugins-info-priv.h
@@ -1,8 +1,8 @@
/*
- * gedit-plugin-info-priv.h
+ * egg-plugins-info-priv.h
* This file is part of gedit
*
- * Copyright (C) 2002-2005 - Paolo Maggi
+ * Copyright (C) 2002-2005 - Paolo Maggi
* Copyright (C) 2007 - Paolo Maggi, Steve Frécinaux
*
* This program is free software; you can redistribute it and/or modify
@@ -17,10 +17,10 @@
*
* You should have received a copy of the GNU General Public License
* along with this program; if not, write to the Free Software
- * Foundation, Inc., 59 Temple Place, Suite 330,
- * Boston, MA 02111-1307, USA.
+ * Foundation, Inc., 59 Temple Place, Suite 330,
+ * Boston, MA 02111-1307, USA.
*/
-
+
/*
* Modified by the gedit Team, 2002-2007. See the AUTHORS file for a
* list of people on the gedit Team.
@@ -29,17 +29,17 @@
* $Id$
*/
-#ifndef __GEDIT_PLUGIN_INFO_PRIV_H__
-#define __GEDIT_PLUGIN_INFO_PRIV_H__
+#ifndef __EGG_PLUGINS_INFO_PRIV_H__
+#define __EGG_PLUGINS_INFO_PRIV_H__
-#include "gedit-plugin-info.h"
-#include "gedit-plugin.h"
+#include "egg-plugins-info.h"
+#include "egg-plugins-plugin.h"
-struct _GeditPluginInfo
+struct _EggPluginsInfo
{
gint refcount;
- GeditPlugin *plugin;
+ EggPluginsPlugin *plugin;
gchar *file;
gchar *module_name;
@@ -60,9 +60,9 @@ struct _GeditPluginInfo
gint available : 1;
};
-GeditPluginInfo *_gedit_plugin_info_new (const gchar *file);
-void _gedit_plugin_info_ref (GeditPluginInfo *info);
-void _gedit_plugin_info_unref (GeditPluginInfo *info);
+EggPluginsInfo *_egg_plugins_info_new (const gchar *file);
+void _egg_plugins_info_ref (EggPluginsInfo *info);
+void _egg_plugins_info_unref (EggPluginsInfo *info);
-#endif /* __GEDIT_PLUGIN_INFO_PRIV_H__ */
+#endif /* __EGG_PLUGINS_INFO_PRIV_H__ */
diff --git a/libplugins/gedit-plugin-info.c b/libplugins/egg-plugins-info.c
similarity index 77%
rename from libplugins/gedit-plugin-info.c
rename to libplugins/egg-plugins-info.c
index de3ea06..efec98e 100644
--- a/libplugins/gedit-plugin-info.c
+++ b/libplugins/egg-plugins-info.c
@@ -1,8 +1,8 @@
/*
- * gedit-plugin-info.c
+ * egg-plugins-info.c
* This file is part of gedit
*
- * Copyright (C) 2002-2005 - Paolo Maggi
+ * Copyright (C) 2002-2005 - Paolo Maggi
* Copyright (C) 2007 - Paolo Maggi, Steve Frécinaux
*
* This program is free software; you can redistribute it and/or modify
@@ -17,10 +17,10 @@
*
* You should have received a copy of the GNU General Public License
* along with this program; if not, write to the Free Software
- * Foundation, Inc., 59 Temple Place, Suite 330,
- * Boston, MA 02111-1307, USA.
+ * Foundation, Inc., 59 Temple Place, Suite 330,
+ * Boston, MA 02111-1307, USA.
*/
-
+
/*
* Modified by the gedit Team, 2002-2007. See the AUTHORS file for a
* list of people on the gedit Team.
@@ -37,25 +37,25 @@
#include <glib/gi18n.h>
#include <glib.h>
-#include "gedit-plugin-info.h"
-#include "gedit-plugin-info-priv.h"
-#include "gedit-plugin.h"
+#include "egg-plugins-info.h"
+#include "egg-plugins-info-priv.h"
+#include "egg-plugins-plugin.h"
void
-_gedit_plugin_info_ref (GeditPluginInfo *info)
+_egg_plugins_info_ref (EggPluginsInfo *info)
{
g_atomic_int_inc (&info->refcount);
}
-static GeditPluginInfo *
-gedit_plugin_info_copy (GeditPluginInfo *info)
+static EggPluginsInfo *
+egg_plugins_info_copy (EggPluginsInfo *info)
{
- _gedit_plugin_info_ref (info);
+ _egg_plugins_info_ref (info);
return info;
}
void
-_gedit_plugin_info_unref (GeditPluginInfo *info)
+_egg_plugins_info_unref (EggPluginsInfo *info)
{
if (!g_atomic_int_dec_and_test (&info->refcount))
return;
@@ -79,45 +79,45 @@ _gedit_plugin_info_unref (GeditPluginInfo *info)
}
/**
- * gedit_plugin_info_get_type:
+ * egg_plugins_info_get_type:
*
- * Retrieves the #GType object which is associated with the #GeditPluginInfo
+ * Retrieves the #GType object which is associated with the #EggPluginsInfo
* class.
*
- * Return value: the GType associated with #GeditPluginInfo.
+ * Return value: the GType associated with #EggPluginsInfo.
**/
GType
-gedit_plugin_info_get_type (void)
+egg_plugins_info_get_type (void)
{
static GType the_type = 0;
if (G_UNLIKELY (!the_type))
the_type = g_boxed_type_register_static (
- "GeditPluginInfo",
- (GBoxedCopyFunc) gedit_plugin_info_copy,
- (GBoxedFreeFunc) _gedit_plugin_info_unref);
+ "EggPluginsInfo",
+ (GBoxedCopyFunc) egg_plugins_info_copy,
+ (GBoxedFreeFunc) _egg_plugins_info_unref);
return the_type;
-}
+}
/**
- * gedit_plugin_info_new:
+ * egg_plugins_info_new:
* @filename: the filename where to read the plugin information
*
- * Creates a new #GeditPluginInfo from a file on the disk.
+ * Creates a new #EggPluginsInfo from a file on the disk.
*
- * Return value: a newly created #GeditPluginInfo.
+ * Return value: a newly created #EggPluginsInfo.
*/
-GeditPluginInfo *
-_gedit_plugin_info_new (const gchar *file)
+EggPluginsInfo *
+_egg_plugins_info_new (const gchar *file)
{
- GeditPluginInfo *info;
+ EggPluginsInfo *info;
GKeyFile *plugin_file = NULL;
gchar *str;
g_return_val_if_fail (file != NULL, NULL);
- info = g_new0 (GeditPluginInfo, 1);
+ info = g_new0 (EggPluginsInfo, 1);
info->refcount = 1;
info->file = g_strdup (file);
@@ -130,7 +130,7 @@ _gedit_plugin_info_new (const gchar *file)
if (!g_key_file_has_key (plugin_file, "Gedit Plugin", "IAge", NULL))
goto error;
-
+
/* Check IAge=2 */
if (g_key_file_get_integer (plugin_file, "Gedit Plugin", "IAge", NULL) != 2)
goto error;
@@ -165,7 +165,7 @@ _gedit_plugin_info_new (const gchar *file)
"Gedit Plugin",
"Loader",
NULL);
-
+
if ((str != NULL) && (*str != '\0'))
{
info->loader = str;
@@ -227,7 +227,7 @@ _gedit_plugin_info_new (const gchar *file)
NULL);
if (str)
info->website = str;
-
+
/* Get Version */
str = g_key_file_get_string (plugin_file,
"Gedit Plugin",
@@ -235,13 +235,13 @@ _gedit_plugin_info_new (const gchar *file)
NULL);
if (str)
info->version = str;
-
+
g_key_file_free (plugin_file);
-
+
/* If we know nothing about the availability of the plugin,
set it as available */
info->available = TRUE;
-
+
return info;
error:
@@ -256,7 +256,7 @@ error:
}
gboolean
-gedit_plugin_info_is_active (GeditPluginInfo *info)
+egg_plugins_info_is_active (EggPluginsInfo *info)
{
g_return_val_if_fail (info != NULL, FALSE);
@@ -264,7 +264,7 @@ gedit_plugin_info_is_active (GeditPluginInfo *info)
}
gboolean
-gedit_plugin_info_is_available (GeditPluginInfo *info)
+egg_plugins_info_is_available (EggPluginsInfo *info)
{
g_return_val_if_fail (info != NULL, FALSE);
@@ -272,18 +272,18 @@ gedit_plugin_info_is_available (GeditPluginInfo *info)
}
gboolean
-gedit_plugin_info_is_configurable (GeditPluginInfo *info)
+egg_plugins_info_is_configurable (EggPluginsInfo *info)
{
g_return_val_if_fail (info != NULL, FALSE);
if (info->plugin == NULL || !info->available)
return FALSE;
- return gedit_plugin_is_configurable (info->plugin);
+ return egg_plugins_plugin_is_configurable (info->plugin);
}
const gchar *
-gedit_plugin_info_get_module_name (GeditPluginInfo *info)
+egg_plugins_info_get_module_name (EggPluginsInfo *info)
{
g_return_val_if_fail (info != NULL, NULL);
@@ -291,7 +291,7 @@ gedit_plugin_info_get_module_name (GeditPluginInfo *info)
}
const gchar *
-gedit_plugin_info_get_name (GeditPluginInfo *info)
+egg_plugins_info_get_name (EggPluginsInfo *info)
{
g_return_val_if_fail (info != NULL, NULL);
@@ -299,7 +299,7 @@ gedit_plugin_info_get_name (GeditPluginInfo *info)
}
const gchar *
-gedit_plugin_info_get_description (GeditPluginInfo *info)
+egg_plugins_info_get_description (EggPluginsInfo *info)
{
g_return_val_if_fail (info != NULL, NULL);
@@ -307,13 +307,13 @@ gedit_plugin_info_get_description (GeditPluginInfo *info)
}
const gchar *
-gedit_plugin_info_get_icon_name (GeditPluginInfo *info)
+egg_plugins_info_get_icon_name (EggPluginsInfo *info)
{
g_return_val_if_fail (info != NULL, NULL);
/* use the gedit-plugin icon as a default if the plugin does not
have its own */
- if (info->icon_name != NULL &&
+ if (info->icon_name != NULL &&
gtk_icon_theme_has_icon (gtk_icon_theme_get_default (),
info->icon_name))
return info->icon_name;
@@ -322,7 +322,7 @@ gedit_plugin_info_get_icon_name (GeditPluginInfo *info)
}
const gchar **
-gedit_plugin_info_get_authors (GeditPluginInfo *info)
+egg_plugins_info_get_authors (EggPluginsInfo *info)
{
g_return_val_if_fail (info != NULL, (const gchar **)NULL);
@@ -330,7 +330,7 @@ gedit_plugin_info_get_authors (GeditPluginInfo *info)
}
const gchar *
-gedit_plugin_info_get_website (GeditPluginInfo *info)
+egg_plugins_info_get_website (EggPluginsInfo *info)
{
g_return_val_if_fail (info != NULL, NULL);
@@ -338,7 +338,7 @@ gedit_plugin_info_get_website (GeditPluginInfo *info)
}
const gchar *
-gedit_plugin_info_get_copyright (GeditPluginInfo *info)
+egg_plugins_info_get_copyright (EggPluginsInfo *info)
{
g_return_val_if_fail (info != NULL, NULL);
@@ -346,7 +346,7 @@ gedit_plugin_info_get_copyright (GeditPluginInfo *info)
}
const gchar *
-gedit_plugin_info_get_version (GeditPluginInfo *info)
+egg_plugins_info_get_version (EggPluginsInfo *info)
{
g_return_val_if_fail (info != NULL, NULL);
diff --git a/libplugins/egg-plugins-info.h b/libplugins/egg-plugins-info.h
new file mode 100644
index 0000000..b396153
--- /dev/null
+++ b/libplugins/egg-plugins-info.h
@@ -0,0 +1,63 @@
+/*
+ * egg-plugins-info.h
+ * This file is part of gedit
+ *
+ * Copyright (C) 2002-2005 - Paolo Maggi
+ * Copyright (C) 2007 - Paolo Maggi, Steve Frécinaux
+ *
+ * This program is free software; you can redistribute it and/or modify
+ * it under the terms of the GNU General Public License as published by
+ * the Free Software Foundation; either version 2 of the License, or
+ * (at your option) any later version.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with this program; if not, write to the Free Software
+ * Foundation, Inc., 59 Temple Place, Suite 330,
+ * Boston, MA 02111-1307, USA.
+ */
+
+/*
+ * Modified by the gedit Team, 2002-2007. See the AUTHORS file for a
+ * list of people on the gedit Team.
+ * See the ChangeLog files for a list of changes.
+ *
+ * $Id$
+ */
+
+#ifndef __EGG_PLUGINS_INFO_H__
+#define __EGG_PLUGINS_INFO_H__
+
+#include <glib-object.h>
+
+G_BEGIN_DECLS
+
+#define EGG_PLUGINS_TYPE_INFO (egg_plugins_info_get_type ())
+#define EGG_PLUGINS_INFO(obj) ((EggPluginsInfo *) (obj))
+
+typedef struct _EggPluginsInfo EggPluginsInfo;
+
+GType egg_plugins_info_get_type (void) G_GNUC_CONST;
+
+gboolean egg_plugins_info_is_active (EggPluginsInfo *info);
+gboolean egg_plugins_info_is_available (EggPluginsInfo *info);
+gboolean egg_plugins_info_is_configurable (EggPluginsInfo *info);
+
+const gchar *egg_plugins_info_get_module_name (EggPluginsInfo *info);
+
+const gchar *egg_plugins_info_get_name (EggPluginsInfo *info);
+const gchar *egg_plugins_info_get_description (EggPluginsInfo *info);
+const gchar *egg_plugins_info_get_icon_name (EggPluginsInfo *info);
+const gchar **egg_plugins_info_get_authors (EggPluginsInfo *info);
+const gchar *egg_plugins_info_get_website (EggPluginsInfo *info);
+const gchar *egg_plugins_info_get_copyright (EggPluginsInfo *info);
+const gchar *egg_plugins_info_get_version (EggPluginsInfo *info);
+
+G_END_DECLS
+
+#endif /* __EGG_PLUGINS_INFO_H__ */
+
diff --git a/libplugins/gedit-plugin-loader.c b/libplugins/egg-plugins-loader.c
similarity index 59%
rename from libplugins/gedit-plugin-loader.c
rename to libplugins/egg-plugins-loader.c
index 2dccde4..d853571 100644
--- a/libplugins/gedit-plugin-loader.c
+++ b/libplugins/egg-plugins-loader.c
@@ -16,14 +16,14 @@
*
* You should have received a copy of the GNU General Public License
* along with this program; if not, write to the Free Software
- * Foundation, Inc., 59 Temple Place, Suite 330,
- * Boston, MA 02111-1307, USA.
+ * Foundation, Inc., 59 Temple Place, Suite 330,
+ * Boston, MA 02111-1307, USA.
*/
-#include "gedit-plugin-loader.h"
+#include "egg-plugins-loader.h"
static void
-gedit_plugin_loader_base_init (gpointer g_class)
+egg_plugins_loader_base_init (gpointer g_class)
{
static gboolean initialized = FALSE;
@@ -35,7 +35,7 @@ gedit_plugin_loader_base_init (gpointer g_class)
}
GType
-gedit_plugin_loader_get_type (void)
+egg_plugins_loader_get_type (void)
{
static GType type = 0;
@@ -43,8 +43,8 @@ gedit_plugin_loader_get_type (void)
{
static const GTypeInfo info =
{
- sizeof (GeditPluginLoaderInterface),
- gedit_plugin_loader_base_init, /* base_init */
+ sizeof (EggPluginsLoaderInterface),
+ egg_plugins_loader_base_init, /* base_init */
NULL, /* base_finalize */
NULL, /* class_init */
NULL, /* class_finalize */
@@ -53,79 +53,79 @@ gedit_plugin_loader_get_type (void)
0, /* n_preallocs */
NULL /* instance_init */
};
-
- type = g_type_register_static (G_TYPE_INTERFACE, "GeditPluginLoader", &info, 0);
+
+ type = g_type_register_static (G_TYPE_INTERFACE, "EggPluginsLoader", &info, 0);
}
return type;
}
const gchar *
-gedit_plugin_loader_type_get_id (GType type)
+egg_plugins_loader_type_get_id (GType type)
{
GTypeClass *klass;
- GeditPluginLoaderInterface *iface;
-
+ EggPluginsLoaderInterface *iface;
+
klass = g_type_class_ref (type);
-
+
if (klass == NULL)
{
g_warning ("Could not get class info for plugin loader");
return NULL;
}
- iface = g_type_interface_peek (klass, GEDIT_TYPE_PLUGIN_LOADER);
-
+ iface = g_type_interface_peek (klass, EGG_PLUGINS_TYPE_LOADER);
+
if (iface == NULL)
{
g_warning ("Could not get plugin loader interface");
g_type_class_unref (klass);
-
+
return NULL;
}
-
+
g_return_val_if_fail (iface->get_id != NULL, NULL);
return iface->get_id ();
}
-GeditPlugin *
-gedit_plugin_loader_load (GeditPluginLoader *loader,
- GeditPluginInfo *info,
- const gchar *path)
+EggPluginsPlugin *
+egg_plugins_loader_load (EggPluginsLoader *loader,
+ EggPluginsInfo *info,
+ const gchar *path)
{
- GeditPluginLoaderInterface *iface;
-
- g_return_val_if_fail (GEDIT_IS_PLUGIN_LOADER (loader), NULL);
-
- iface = GEDIT_PLUGIN_LOADER_GET_INTERFACE (loader);
+ EggPluginsLoaderInterface *iface;
+
+ g_return_val_if_fail (EGG_PLUGINS_IS_LOADER (loader), NULL);
+
+ iface = EGG_PLUGINS_LOADER_GET_INTERFACE (loader);
g_return_val_if_fail (iface->load != NULL, NULL);
-
+
return iface->load (loader, info, path);
}
void
-gedit_plugin_loader_unload (GeditPluginLoader *loader,
- GeditPluginInfo *info)
+egg_plugins_loader_unload (EggPluginsLoader *loader,
+ EggPluginsInfo *info)
{
- GeditPluginLoaderInterface *iface;
-
- g_return_if_fail (GEDIT_IS_PLUGIN_LOADER (loader));
-
- iface = GEDIT_PLUGIN_LOADER_GET_INTERFACE (loader);
+ EggPluginsLoaderInterface *iface;
+
+ g_return_if_fail (EGG_PLUGINS_IS_LOADER (loader));
+
+ iface = EGG_PLUGINS_LOADER_GET_INTERFACE (loader);
g_return_if_fail (iface->unload != NULL);
-
+
iface->unload (loader, info);
}
void
-gedit_plugin_loader_garbage_collect (GeditPluginLoader *loader)
+egg_plugins_loader_garbage_collect (EggPluginsLoader *loader)
{
- GeditPluginLoaderInterface *iface;
-
- g_return_if_fail (GEDIT_IS_PLUGIN_LOADER (loader));
-
- iface = GEDIT_PLUGIN_LOADER_GET_INTERFACE (loader);
-
+ EggPluginsLoaderInterface *iface;
+
+ g_return_if_fail (EGG_PLUGINS_IS_LOADER (loader));
+
+ iface = EGG_PLUGINS_LOADER_GET_INTERFACE (loader);
+
if (iface->garbage_collect != NULL)
iface->garbage_collect (loader);
}
diff --git a/libplugins/egg-plugins-loader.h b/libplugins/egg-plugins-loader.h
new file mode 100644
index 0000000..0e517a3
--- /dev/null
+++ b/libplugins/egg-plugins-loader.h
@@ -0,0 +1,106 @@
+/*
+ * egg-plugins-loader.h
+ * This file is part of gedit
+ *
+ * Copyright (C) 2008 - Jesse van den Kieboom
+ *
+ * This program is free software; you can redistribute it and/or modify
+ * it under the terms of the GNU General Public License as published by
+ * the Free Software Foundation; either version 2 of the License, or
+ * (at your option) any later version.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with this program; if not, write to the Free Software
+ * Foundation, Inc., 59 Temple Place, Suite 330,
+ * Boston, MA 02111-1307, USA.
+ */
+
+#ifndef __EGG_PLUGINS_LOADER_H__
+#define __EGG_PLUGINS_LOADER_H__
+
+#include <glib-object.h>
+#include "egg-plugins-plugin.h"
+#include "egg-plugins-info.h"
+
+G_BEGIN_DECLS
+
+#define EGG_PLUGINS_TYPE_LOADER (egg_plugins_loader_get_type ())
+#define EGG_PLUGINS_LOADER(obj) (G_TYPE_CHECK_INSTANCE_CAST ((obj), EGG_PLUGINS_TYPE_LOADER, EggPluginsLoader))
+#define EGG_PLUGINS_IS_LOADER(obj) (G_TYPE_CHECK_INSTANCE_TYPE ((obj), EGG_PLUGINS_TYPE_LOADER))
+#define EGG_PLUGINS_LOADER_GET_INTERFACE(inst) (G_TYPE_INSTANCE_GET_INTERFACE ((inst), EGG_PLUGINS_TYPE_LOADER, EggPluginsLoaderInterface))
+
+typedef struct _EggPluginsLoader EggPluginsLoader; /* dummy object */
+typedef struct _EggPluginsLoaderInterface EggPluginsLoaderInterface;
+
+struct _EggPluginsLoaderInterface {
+ GTypeInterface parent;
+
+ const gchar *(*get_id) (void);
+
+ EggPluginsPlugin *(*load) (EggPluginsLoader *loader,
+ EggPluginsInfo *info,
+ const gchar *path);
+
+ void (*unload) (EggPluginsLoader *loader,
+ EggPluginsInfo *info);
+
+ void (*garbage_collect) (EggPluginsLoader *loader);
+};
+
+GType egg_plugins_loader_get_type (void);
+
+const gchar *egg_plugins_loader_type_get_id (GType type);
+EggPluginsPlugin *egg_plugins_loader_load (EggPluginsLoader *loader,
+ EggPluginsInfo *info,
+ const gchar *path);
+void egg_plugins_loader_unload (EggPluginsLoader *loader,
+ EggPluginsInfo *info);
+void egg_plugins_loader_garbage_collect (EggPluginsLoader *loader);
+
+/**
+ * EGG_PLUGINS_LOADER_IMPLEMENT_INTERFACE(TYPE_IFACE, iface_init):
+ *
+ * Utility macro used to register interfaces for gobject types in plugin loaders.
+ */
+#define EGG_PLUGINS_LOADER_IMPLEMENT_INTERFACE(TYPE_IFACE, iface_init) \
+ const GInterfaceInfo g_implement_interface_info = \
+ { \
+ (GInterfaceInitFunc) iface_init, \
+ NULL, \
+ NULL \
+ }; \
+ \
+ g_type_module_add_interface (type_module, \
+ g_define_type_id, \
+ TYPE_IFACE, \
+ &g_implement_interface_info);
+
+/**
+ * EGG_PLUGINS_LOADER_REGISTER_TYPE(PluginLoaderName, plugin_loader_name, PARENT_TYPE, loader_interface_init):
+ *
+ * Utility macro used to register plugin loaders.
+ */
+#define EGG_PLUGINS_LOADER_REGISTER_TYPE(PluginLoaderName, plugin_loader_name, PARENT_TYPE, loader_iface_init) \
+ G_DEFINE_DYNAMIC_TYPE_EXTENDED (PluginLoaderName, \
+ plugin_loader_name, \
+ PARENT_TYPE, \
+ 0, \
+ EGG_PLUGINS_LOADER_IMPLEMENT_INTERFACE(EGG_PLUGINS_TYPE_LOADER, loader_iface_init)); \
+ \
+ \
+G_MODULE_EXPORT GType \
+register_egg_plugins_loader (GTypeModule *type_module) \
+{ \
+ plugin_loader_name##_register_type (type_module); \
+ \
+ return plugin_loader_name##_get_type(); \
+}
+
+G_END_DECLS
+
+#endif /* __EGG_PLUGINS_LOADER_H__ */
diff --git a/libplugins/gedit-object-module.c b/libplugins/egg-plugins-object-module.c
similarity index 65%
rename from libplugins/gedit-object-module.c
rename to libplugins/egg-plugins-object-module.c
index 40c797f..e41930d 100644
--- a/libplugins/gedit-object-module.c
+++ b/libplugins/egg-plugins-object-module.c
@@ -17,10 +17,10 @@
*
* You should have received a copy of the GNU General Public License
* along with this program; if not, write to the Free Software
- * Foundation, Inc., 59 Temple Place, Suite 330,
- * Boston, MA 02111-1307, USA.
+ * Foundation, Inc., 59 Temple Place, Suite 330,
+ * Boston, MA 02111-1307, USA.
*/
-
+
/* This is a modified version of ephy-module.c from Epiphany source code.
* Here the original copyright assignment:
*
@@ -30,18 +30,18 @@
*/
/*
- * Modified by the gedit Team, 2005. See the AUTHORS file for a
- * list of people on the gedit Team.
- * See the ChangeLog files for a list of changes.
+ * Modified by the gedit Team, 2005. See the AUTHORS file for a
+ * list of people on the gedit Team.
+ * See the ChangeLog files for a list of changes.
*
* $Id: gedit-module.c 6314 2008-06-05 12:57:53Z pborelli $
*/
#include "config.h"
-#include "gedit-object-module.h"
+#include "egg-plugins-object-module.h"
-typedef GType (*GeditObjectModuleRegisterFunc) (GTypeModule *);
+typedef GType (*EggPluginsObjectModuleRegisterFunc) (GTypeModule *);
enum {
PROP_0,
@@ -51,7 +51,7 @@ enum {
PROP_RESIDENT
};
-struct _GeditObjectModulePrivate
+struct _EggPluginsObjectModulePrivate
{
GModule *library;
@@ -63,19 +63,19 @@ struct _GeditObjectModulePrivate
gboolean resident;
};
-G_DEFINE_TYPE (GeditObjectModule, gedit_object_module, G_TYPE_TYPE_MODULE);
+G_DEFINE_TYPE (EggPluginsObjectModule, egg_plugins_object_module, G_TYPE_TYPE_MODULE);
static gboolean
-gedit_object_module_load (GTypeModule *gmodule)
+egg_plugins_object_module_load (GTypeModule *gmodule)
{
- GeditObjectModule *module = GEDIT_OBJECT_MODULE (gmodule);
- GeditObjectModuleRegisterFunc register_func;
+ EggPluginsObjectModule *module = EGG_PLUGINS_OBJECT_MODULE (gmodule);
+ EggPluginsObjectModuleRegisterFunc register_func;
gchar *path;
path = g_module_build_path (module->priv->path, module->priv->module_name);
g_return_val_if_fail (path != NULL, FALSE);
- module->priv->library = g_module_open (path,
+ module->priv->library = g_module_open (path,
G_MODULE_BIND_LAZY);
g_free (path);
@@ -123,9 +123,9 @@ gedit_object_module_load (GTypeModule *gmodule)
}
static void
-gedit_object_module_unload (GTypeModule *gmodule)
+egg_plugins_object_module_unload (GTypeModule *gmodule)
{
- GeditObjectModule *module = GEDIT_OBJECT_MODULE (gmodule);
+ EggPluginsObjectModule *module = EGG_PLUGINS_OBJECT_MODULE (gmodule);
g_module_close (module->priv->library);
@@ -134,32 +134,32 @@ gedit_object_module_unload (GTypeModule *gmodule)
}
static void
-gedit_object_module_init (GeditObjectModule *module)
+egg_plugins_object_module_init (EggPluginsObjectModule *module)
{
module->priv = G_TYPE_INSTANCE_GET_PRIVATE (module,
- GEDIT_TYPE_OBJECT_MODULE,
- GeditObjectModulePrivate);
+ EGG_PLUGINS_TYPE_OBJECT_MODULE,
+ EggPluginsObjectModulePrivate);
}
static void
-gedit_object_module_finalize (GObject *object)
+egg_plugins_object_module_finalize (GObject *object)
{
- GeditObjectModule *module = GEDIT_OBJECT_MODULE (object);
+ EggPluginsObjectModule *module = EGG_PLUGINS_OBJECT_MODULE (object);
g_free (module->priv->path);
g_free (module->priv->module_name);
g_free (module->priv->type_registration);
- G_OBJECT_CLASS (gedit_object_module_parent_class)->finalize (object);
+ G_OBJECT_CLASS (egg_plugins_object_module_parent_class)->finalize (object);
}
static void
-gedit_object_module_get_property (GObject *object,
- guint prop_id,
- GValue *value,
- GParamSpec *pspec)
+egg_plugins_object_module_get_property (GObject *object,
+ guint prop_id,
+ GValue *value,
+ GParamSpec *pspec)
{
- GeditObjectModule *module = GEDIT_OBJECT_MODULE (object);
+ EggPluginsObjectModule *module = EGG_PLUGINS_OBJECT_MODULE (object);
switch (prop_id)
{
@@ -181,12 +181,12 @@ gedit_object_module_get_property (GObject *object,
}
static void
-gedit_object_module_set_property (GObject *object,
- guint prop_id,
- const GValue *value,
- GParamSpec *pspec)
+egg_plugins_object_module_set_property (GObject *object,
+ guint prop_id,
+ const GValue *value,
+ GParamSpec *pspec)
{
- GeditObjectModule *module = GEDIT_OBJECT_MODULE (object);
+ EggPluginsObjectModule *module = EGG_PLUGINS_OBJECT_MODULE (object);
switch (prop_id)
{
@@ -210,17 +210,17 @@ gedit_object_module_set_property (GObject *object,
}
static void
-gedit_object_module_class_init (GeditObjectModuleClass *klass)
+egg_plugins_object_module_class_init (EggPluginsObjectModuleClass *klass)
{
GObjectClass *object_class = G_OBJECT_CLASS (klass);
GTypeModuleClass *module_class = G_TYPE_MODULE_CLASS (klass);
- object_class->set_property = gedit_object_module_set_property;
- object_class->get_property = gedit_object_module_get_property;
- object_class->finalize = gedit_object_module_finalize;
+ object_class->set_property = egg_plugins_object_module_set_property;
+ object_class->get_property = egg_plugins_object_module_get_property;
+ object_class->finalize = egg_plugins_object_module_finalize;
- module_class->load = gedit_object_module_load;
- module_class->unload = gedit_object_module_unload;
+ module_class->load = egg_plugins_object_module_load;
+ module_class->unload = egg_plugins_object_module_unload;
g_object_class_install_property (object_class,
PROP_MODULE_NAME,
@@ -239,7 +239,7 @@ gedit_object_module_class_init (GeditObjectModuleClass *klass)
NULL,
G_PARAM_READWRITE |
G_PARAM_CONSTRUCT_ONLY));
-
+
g_object_class_install_property (object_class,
PROP_TYPE_REGISTRATION,
g_param_spec_string ("type-registration",
@@ -258,16 +258,16 @@ gedit_object_module_class_init (GeditObjectModuleClass *klass)
G_PARAM_READWRITE |
G_PARAM_CONSTRUCT_ONLY));
- g_type_class_add_private (klass, sizeof (GeditObjectModulePrivate));
+ g_type_class_add_private (klass, sizeof (EggPluginsObjectModulePrivate));
}
-GeditObjectModule *
-gedit_object_module_new (const gchar *module_name,
- const gchar *path,
- const gchar *type_registration,
- gboolean resident)
+EggPluginsObjectModule *
+egg_plugins_object_module_new (const gchar *module_name,
+ const gchar *path,
+ const gchar *type_registration,
+ gboolean resident)
{
- return (GeditObjectModule *)g_object_new (GEDIT_TYPE_OBJECT_MODULE,
+ return (EggPluginsObjectModule *)g_object_new (EGG_PLUGINS_TYPE_OBJECT_MODULE,
"module-name",
module_name,
"path",
@@ -280,50 +280,50 @@ gedit_object_module_new (const gchar *module_name,
}
GObject *
-gedit_object_module_new_object (GeditObjectModule *module,
- const gchar *first_property_name,
- ...)
+egg_plugins_object_module_new_object (EggPluginsObjectModule *module,
+ const gchar *first_property_name,
+ ...)
{
va_list var_args;
GObject *result;
-
+
g_return_val_if_fail (module->priv->type != 0, NULL);
va_start (var_args, first_property_name);
result = g_object_new_valist (module->priv->type, first_property_name, var_args);
va_end (var_args);
-
+
return result;
}
const gchar *
-gedit_object_module_get_path (GeditObjectModule *module)
+egg_plugins_object_module_get_path (EggPluginsObjectModule *module)
{
- g_return_val_if_fail (GEDIT_IS_OBJECT_MODULE (module), NULL);
+ g_return_val_if_fail (EGG_PLUGINS_IS_OBJECT_MODULE (module), NULL);
return module->priv->path;
}
const gchar *
-gedit_object_module_get_module_name (GeditObjectModule *module)
+egg_plugins_object_module_get_module_name (EggPluginsObjectModule *module)
{
- g_return_val_if_fail (GEDIT_IS_OBJECT_MODULE (module), NULL);
+ g_return_val_if_fail (EGG_PLUGINS_IS_OBJECT_MODULE (module), NULL);
return module->priv->module_name;
}
const gchar *
-gedit_object_module_get_type_registration (GeditObjectModule *module)
+egg_plugins_object_module_get_type_registration (EggPluginsObjectModule *module)
{
- g_return_val_if_fail (GEDIT_IS_OBJECT_MODULE (module), NULL);
+ g_return_val_if_fail (EGG_PLUGINS_IS_OBJECT_MODULE (module), NULL);
return module->priv->type_registration;
}
GType
-gedit_object_module_get_object_type (GeditObjectModule *module)
+egg_plugins_object_module_get_object_type (EggPluginsObjectModule *module)
{
- g_return_val_if_fail (GEDIT_IS_OBJECT_MODULE (module), 0);
-
+ g_return_val_if_fail (EGG_PLUGINS_IS_OBJECT_MODULE (module), 0);
+
return module->priv->type;
}
diff --git a/libplugins/egg-plugins-object-module.h b/libplugins/egg-plugins-object-module.h
new file mode 100644
index 0000000..1f82c23
--- /dev/null
+++ b/libplugins/egg-plugins-object-module.h
@@ -0,0 +1,96 @@
+/*
+ * gedit-object-module.h
+ * This file is part of gedit
+ *
+ * Copyright (C) 2005 - Paolo Maggi
+ * Copyright (C) 2008 - Jesse van den Kieboom
+ *
+ * This program is free software; you can redistribute it and/or modify
+ * it under the terms of the GNU General Public License as published by
+ * the Free Software Foundation; either version 2 of the License, or
+ * (at your option) any later version.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with this program; if not, write to the Free Software
+ * Foundation, Inc., 59 Temple Place, Suite 330,
+ * Boston, MA 02111-1307, USA.
+ */
+
+/* This is a modified version of gedit-module.h from Epiphany source code.
+ * Here the original copyright assignment:
+ *
+ * Copyright (C) 2003 Marco Pesenti Gritti
+ * Copyright (C) 2003, 2004 Christian Persch
+ *
+ */
+
+/*
+ * Modified by the gedit Team, 2005. See the AUTHORS file for a
+ * list of people on the gedit Team.
+ * See the ChangeLog files for a list of changes.
+ *
+ * $Id: gedit-module.h 6263 2008-05-05 10:52:10Z sfre $
+ */
+
+#ifndef __EGG_PLUGINS_OBJECT_MODULE_H__
+#define __EGG_PLUGINS_OBJECT_MODULE_H__
+
+#include <glib-object.h>
+#include <gmodule.h>
+#include <stdarg.h>
+
+G_BEGIN_DECLS
+
+#define EGG_PLUGINS_TYPE_OBJECT_MODULE (egg_plugins_object_module_get_type ())
+#define EGG_PLUGINS_OBJECT_MODULE(obj) (G_TYPE_CHECK_INSTANCE_CAST ((obj), EGG_PLUGINS_TYPE_OBJECT_MODULE, EggPluginsObjectModule))
+#define EGG_PLUGINS_OBJECT_MODULE_CLASS(klass) (G_TYPE_CHECK_CLASS_CAST ((klass), EGG_PLUGINS_TYPE_OBJECT_MODULE, EggPluginsObjectModuleClass))
+#define EGG_PLUGINS_IS_OBJECT_MODULE(obj) (G_TYPE_CHECK_INSTANCE_TYPE ((obj), EGG_PLUGINS_TYPE_OBJECT_MODULE))
+#define EGG_PLUGINS_IS_OBJECT_MODULE_CLASS(klass) (G_TYPE_CHECK_CLASS_TYPE ((klass), EGG_PLUGINS_TYPE_OBJECT_MODULE))
+#define EGG_PLUGINS_OBJECT_MODULE_GET_CLASS(obj) (G_TYPE_INSTANCE_GET_CLASS((obj), EGG_PLUGINS_TYPE_OBJECT_MODULE, EggPluginsObjectModuleClass))
+
+typedef struct _EggPluginsObjectModule EggPluginsObjectModule;
+typedef struct _EggPluginsObjectModulePrivate EggPluginsObjectModulePrivate;
+
+struct _EggPluginsObjectModule
+{
+ GTypeModule parent;
+
+ EggPluginsObjectModulePrivate *priv;
+};
+
+typedef struct _EggPluginsObjectModuleClass EggPluginsObjectModuleClass;
+
+struct _EggPluginsObjectModuleClass
+{
+ GTypeModuleClass parent_class;
+
+ /* Virtual class methods */
+ void (* garbage_collect) ();
+};
+
+GType egg_plugins_object_module_get_type (void) G_GNUC_CONST;
+
+EggPluginsObjectModule
+ *egg_plugins_object_module_new (const gchar *module_name,
+ const gchar *path,
+ const gchar *type_registration,
+ gboolean resident);
+
+GObject *egg_plugins_object_module_new_object (EggPluginsObjectModule *module,
+ const gchar *first_property_name,
+ ...);
+
+GType egg_plugins_object_module_get_object_type (EggPluginsObjectModule *module);
+const gchar *egg_plugins_object_module_get_path (EggPluginsObjectModule *module);
+const gchar *egg_plugins_object_module_get_module_name (EggPluginsObjectModule *module);
+const gchar *egg_plugins_object_module_get_type_registration
+ (EggPluginsObjectModule *module);
+
+G_END_DECLS
+
+#endif
diff --git a/libplugins/gedit-plugin.c b/libplugins/egg-plugins-plugin.c
similarity index 56%
rename from libplugins/gedit-plugin.c
rename to libplugins/egg-plugins-plugin.c
index 29ae67a..605333e 100644
--- a/libplugins/gedit-plugin.c
+++ b/libplugins/egg-plugins-plugin.c
@@ -1,8 +1,8 @@
/*
- * gedit-plugin.h
+ * egg-plugins-plugin.h
* This file is part of gedit
*
- * Copyright (C) 2002-2005 Paolo Maggi
+ * Copyright (C) 2002-2005 Paolo Maggi
*
* This program is free software; you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
@@ -16,14 +16,14 @@
*
* You should have received a copy of the GNU General Public License
* along with this program; if not, write to the Free Software
- * Foundation, Inc., 59 Temple Place, Suite 330,
- * Boston, MA 02111-1307, USA.
+ * Foundation, Inc., 59 Temple Place, Suite 330,
+ * Boston, MA 02111-1307, USA.
*/
-
+
/*
- * Modified by the gedit Team, 2002-2005. See the AUTHORS file for a
- * list of people on the gedit Team.
- * See the ChangeLog files for a list of changes.
+ * Modified by the gedit Team, 2002-2005. See the AUTHORS file for a
+ * list of people on the gedit Team.
+ * See the ChangeLog files for a list of changes.
*
* $Id$
*/
@@ -32,7 +32,7 @@
#include <config.h>
#endif
-#include "gedit-plugin.h"
+#include "egg-plugins-plugin.h"
#include <gedit/gedit-dirs.h>
/* properties */
@@ -43,50 +43,50 @@ enum {
PROP_DATA_DIR
};
-typedef struct _GeditPluginPrivate GeditPluginPrivate;
+typedef struct _EggPluginsPluginPrivate EggPluginsPluginPrivate;
-struct _GeditPluginPrivate
+struct _EggPluginsPluginPrivate
{
gchar *install_dir;
gchar *data_dir_name;
};
-#define GEDIT_PLUGIN_GET_PRIVATE(object)(G_TYPE_INSTANCE_GET_PRIVATE ((object), GEDIT_TYPE_PLUGIN, GeditPluginPrivate))
+#define EGG_PLUGINS_PLUGIN_GET_PRIVATE(object)(G_TYPE_INSTANCE_GET_PRIVATE ((object), EGG_PLUGINS_TYPE_PLUGIN, EggPluginsPluginPrivate))
-G_DEFINE_TYPE(GeditPlugin, gedit_plugin, G_TYPE_OBJECT)
+G_DEFINE_TYPE(EggPluginsPlugin, egg_plugins_plugin, G_TYPE_OBJECT)
static void
-dummy (GeditPlugin *plugin, GtkWindow *window)
+dummy (EggPluginsPlugin *plugin, GtkWindow *window)
{
/* Empty */
}
static GtkWidget *
-create_configure_dialog (GeditPlugin *plugin)
+create_configure_dialog (EggPluginsPlugin *plugin)
{
return NULL;
}
static gboolean
-is_configurable (GeditPlugin *plugin)
+is_configurable (EggPluginsPlugin *plugin)
{
- return (GEDIT_PLUGIN_GET_CLASS (plugin)->create_configure_dialog !=
+ return (EGG_PLUGINS_PLUGIN_GET_CLASS (plugin)->create_configure_dialog !=
create_configure_dialog);
}
static void
-gedit_plugin_get_property (GObject *object,
- guint prop_id,
- GValue *value,
- GParamSpec *pspec)
+egg_plugins_plugin_get_property (GObject *object,
+ guint prop_id,
+ GValue *value,
+ GParamSpec *pspec)
{
switch (prop_id)
{
case PROP_INSTALL_DIR:
- g_value_take_string (value, gedit_plugin_get_install_dir (GEDIT_PLUGIN (object)));
+ g_value_take_string (value, egg_plugins_plugin_get_install_dir (EGG_PLUGINS_PLUGIN (object)));
break;
case PROP_DATA_DIR:
- g_value_take_string (value, gedit_plugin_get_data_dir (GEDIT_PLUGIN (object)));
+ g_value_take_string (value, egg_plugins_plugin_get_data_dir (EGG_PLUGINS_PLUGIN (object)));
break;
default:
g_return_if_reached ();
@@ -94,12 +94,12 @@ gedit_plugin_get_property (GObject *object,
}
static void
-gedit_plugin_set_property (GObject *object,
- guint prop_id,
- const GValue *value,
- GParamSpec *pspec)
+egg_plugins_plugin_set_property (GObject *object,
+ guint prop_id,
+ const GValue *value,
+ GParamSpec *pspec)
{
- GeditPluginPrivate *priv = GEDIT_PLUGIN_GET_PRIVATE (object);
+ EggPluginsPluginPrivate *priv = EGG_PLUGINS_PLUGIN_GET_PRIVATE (object);
switch (prop_id)
{
@@ -115,31 +115,31 @@ gedit_plugin_set_property (GObject *object,
}
static void
-gedit_plugin_finalize (GObject *object)
+egg_plugins_plugin_finalize (GObject *object)
{
- GeditPluginPrivate *priv = GEDIT_PLUGIN_GET_PRIVATE (object);
+ EggPluginsPluginPrivate *priv = EGG_PLUGINS_PLUGIN_GET_PRIVATE (object);
g_free (priv->install_dir);
g_free (priv->data_dir_name);
- G_OBJECT_CLASS (gedit_plugin_parent_class)->finalize (object);
+ G_OBJECT_CLASS (egg_plugins_plugin_parent_class)->finalize (object);
}
-static void
-gedit_plugin_class_init (GeditPluginClass *klass)
+static void
+egg_plugins_plugin_class_init (EggPluginsPluginClass *klass)
{
GObjectClass *object_class = G_OBJECT_CLASS (klass);
klass->activate = dummy;
klass->deactivate = dummy;
klass->update_ui = dummy;
-
+
klass->create_configure_dialog = create_configure_dialog;
klass->is_configurable = is_configurable;
- object_class->get_property = gedit_plugin_get_property;
- object_class->set_property = gedit_plugin_set_property;
- object_class->finalize = gedit_plugin_finalize;
+ object_class->get_property = egg_plugins_plugin_get_property;
+ object_class->set_property = egg_plugins_plugin_set_property;
+ object_class->finalize = egg_plugins_plugin_finalize;
g_object_class_install_property (object_class,
PROP_INSTALL_DIR,
@@ -167,18 +167,18 @@ gedit_plugin_class_init (GeditPluginClass *klass)
NULL,
G_PARAM_READABLE));
- g_type_class_add_private (klass, sizeof (GeditPluginPrivate));
+ g_type_class_add_private (klass, sizeof (EggPluginsPluginPrivate));
}
static void
-gedit_plugin_init (GeditPlugin *plugin)
+egg_plugins_plugin_init (EggPluginsPlugin *plugin)
{
/* Empty */
}
/**
- * gedit_plugin_get_install_dir:
- * @plugin: a #GeditPlugin
+ * egg_plugins_plugin_get_install_dir:
+ * @plugin: a #EggPluginsPlugin
*
* Get the path of the directory where the plugin is installed.
*
@@ -186,16 +186,16 @@ gedit_plugin_init (GeditPlugin *plugin)
* directory where the plugin is installed
*/
gchar *
-gedit_plugin_get_install_dir (GeditPlugin *plugin)
+egg_plugins_plugin_get_install_dir (EggPluginsPlugin *plugin)
{
- g_return_val_if_fail (GEDIT_IS_PLUGIN (plugin), NULL);
+ g_return_val_if_fail (EGG_PLUGINS_IS_PLUGIN (plugin), NULL);
- return g_strdup (GEDIT_PLUGIN_GET_PRIVATE (plugin)->install_dir);
+ return g_strdup (EGG_PLUGINS_PLUGIN_GET_PRIVATE (plugin)->install_dir);
}
/**
- * gedit_plugin_get_data_dir:
- * @plugin: a #GeditPlugin
+ * egg_plugins_plugin_get_data_dir:
+ * @plugin: a #EggPluginsPlugin
*
* Get the path of the directory where the plugin should look for
* its data files.
@@ -204,15 +204,15 @@ gedit_plugin_get_install_dir (GeditPlugin *plugin)
* directory where the plugin should look for its data files
*/
gchar *
-gedit_plugin_get_data_dir (GeditPlugin *plugin)
+egg_plugins_plugin_get_data_dir (EggPluginsPlugin *plugin)
{
- GeditPluginPrivate *priv;
+ EggPluginsPluginPrivate *priv;
gchar *gedit_lib_dir;
gchar *data_dir;
- g_return_val_if_fail (GEDIT_IS_PLUGIN (plugin), NULL);
+ g_return_val_if_fail (EGG_PLUGINS_IS_PLUGIN (plugin), NULL);
- priv = GEDIT_PLUGIN_GET_PRIVATE (plugin);
+ priv = EGG_PLUGINS_PLUGIN_GET_PRIVATE (plugin);
/* If it's a "user" plugin the data dir is
* install_dir/data_dir_name if instead it's a
@@ -250,85 +250,85 @@ gedit_plugin_get_data_dir (GeditPlugin *plugin)
}
/**
- * gedit_plugin_activate:
- * @plugin: a #GeditPlugin
+ * egg_plugins_plugin_activate:
+ * @plugin: a #EggPluginsPlugin
* @window: a #GtkWindow
- *
+ *
* Activates the plugin.
*/
void
-gedit_plugin_activate (GeditPlugin *plugin,
- GtkWindow *window)
+egg_plugins_plugin_activate (EggPluginsPlugin *plugin,
+ GtkWindow *window)
{
- g_return_if_fail (GEDIT_IS_PLUGIN (plugin));
+ g_return_if_fail (EGG_PLUGINS_IS_PLUGIN (plugin));
g_return_if_fail (GTK_IS_WINDOW (window));
-
- GEDIT_PLUGIN_GET_CLASS (plugin)->activate (plugin, window);
+
+ EGG_PLUGINS_PLUGIN_GET_CLASS (plugin)->activate (plugin, window);
}
/**
- * gedit_plugin_deactivate:
- * @plugin: a #GeditPlugin
+ * egg_plugins_plugin_deactivate:
+ * @plugin: a #EggPluginsPlugin
* @window: a #GtkWindow
- *
+ *
* Deactivates the plugin.
*/
void
-gedit_plugin_deactivate (GeditPlugin *plugin,
- GtkWindow *window)
+egg_plugins_plugin_deactivate (EggPluginsPlugin *plugin,
+ GtkWindow *window)
{
- g_return_if_fail (GEDIT_IS_PLUGIN (plugin));
+ g_return_if_fail (EGG_PLUGINS_IS_PLUGIN (plugin));
g_return_if_fail (GTK_IS_WINDOW (window));
- GEDIT_PLUGIN_GET_CLASS (plugin)->deactivate (plugin, window);
+ EGG_PLUGINS_PLUGIN_GET_CLASS (plugin)->deactivate (plugin, window);
}
/**
- * gedit_plugin_update_ui:
- * @plugin: a #GeditPlugin
+ * egg_plugins_plugin_update_ui:
+ * @plugin: a #EggPluginsPlugin
* @window: a #GtkWindow
*
* Triggers an update of the user interface to take into account state changes
* caused by the plugin.
- */
+ */
void
-gedit_plugin_update_ui (GeditPlugin *plugin,
- GtkWindow *window)
+egg_plugins_plugin_update_ui (EggPluginsPlugin *plugin,
+ GtkWindow *window)
{
- g_return_if_fail (GEDIT_IS_PLUGIN (plugin));
+ g_return_if_fail (EGG_PLUGINS_IS_PLUGIN (plugin));
g_return_if_fail (GTK_IS_WINDOW (window));
- GEDIT_PLUGIN_GET_CLASS (plugin)->update_ui (plugin, window);
+ EGG_PLUGINS_PLUGIN_GET_CLASS (plugin)->update_ui (plugin, window);
}
/**
- * gedit_plugin_is_configurable:
- * @plugin: a #GeditPlugin
+ * egg_plugins_plugin_is_configurable:
+ * @plugin: a #EggPluginsPlugin
*
* Whether the plugin is configurable.
*
* Returns: TRUE if the plugin is configurable:
*/
gboolean
-gedit_plugin_is_configurable (GeditPlugin *plugin)
+egg_plugins_plugin_is_configurable (EggPluginsPlugin *plugin)
{
- g_return_val_if_fail (GEDIT_IS_PLUGIN (plugin), FALSE);
+ g_return_val_if_fail (EGG_PLUGINS_IS_PLUGIN (plugin), FALSE);
- return GEDIT_PLUGIN_GET_CLASS (plugin)->is_configurable (plugin);
+ return EGG_PLUGINS_PLUGIN_GET_CLASS (plugin)->is_configurable (plugin);
}
/**
- * gedit_plugin_create_configure_dialog:
- * @plugin: a #GeditPlugin
+ * egg_plugins_plugin_create_configure_dialog:
+ * @plugin: a #EggPluginsPlugin
*
* Creates the configure dialog widget for the plugin.
*
* Returns: the configure dialog widget for the plugin.
*/
GtkWidget *
-gedit_plugin_create_configure_dialog (GeditPlugin *plugin)
+egg_plugins_plugin_create_configure_dialog (EggPluginsPlugin *plugin)
{
- g_return_val_if_fail (GEDIT_IS_PLUGIN (plugin), NULL);
-
- return GEDIT_PLUGIN_GET_CLASS (plugin)->create_configure_dialog (plugin);
+ g_return_val_if_fail (EGG_PLUGINS_IS_PLUGIN (plugin), NULL);
+
+ return EGG_PLUGINS_PLUGIN_GET_CLASS (plugin)->create_configure_dialog (plugin);
}
diff --git a/libplugins/gedit-plugin.h b/libplugins/egg-plugins-plugin.h
similarity index 58%
rename from libplugins/gedit-plugin.h
rename to libplugins/egg-plugins-plugin.h
index a3345a0..58fba35 100644
--- a/libplugins/gedit-plugin.h
+++ b/libplugins/egg-plugins-plugin.h
@@ -1,8 +1,8 @@
/*
- * gedit-plugin.h
+ * egg-plugins-plugin.h
* This file is part of gedit
*
- * Copyright (C) 2002-2005 - Paolo Maggi
+ * Copyright (C) 2002-2005 - Paolo Maggi
*
* This program is free software; you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
@@ -16,46 +16,46 @@
*
* You should have received a copy of the GNU General Public License
* along with this program; if not, write to the Free Software
- * Foundation, Inc., 59 Temple Place, Suite 330,
- * Boston, MA 02111-1307, USA.
+ * Foundation, Inc., 59 Temple Place, Suite 330,
+ * Boston, MA 02111-1307, USA.
*/
-
+
/*
- * Modified by the gedit Team, 2002-2005. See the AUTHORS file for a
- * list of people on the gedit Team.
- * See the ChangeLog files for a list of changes.
+ * Modified by the gedit Team, 2002-2005. See the AUTHORS file for a
+ * list of people on the gedit Team.
+ * See the ChangeLog files for a list of changes.
*
* $Id$
*/
-#ifndef __GEDIT_PLUGIN_H__
-#define __GEDIT_PLUGIN_H__
+#ifndef __EGG_PLUGINS_PLUGIN_H__
+#define __EGG_PLUGINS_PLUGIN_H__
#include <glib-object.h>
#include <gtk/gtk.h>
/* TODO: add a .h file that includes all the .h files normally needed to
- * develop a plugin */
+ * develop a plugin */
G_BEGIN_DECLS
/*
* Type checking and casting macros
*/
-#define GEDIT_TYPE_PLUGIN (gedit_plugin_get_type())
-#define GEDIT_PLUGIN(obj) (G_TYPE_CHECK_INSTANCE_CAST((obj), GEDIT_TYPE_PLUGIN, GeditPlugin))
-#define GEDIT_PLUGIN_CLASS(klass) (G_TYPE_CHECK_CLASS_CAST((klass), GEDIT_TYPE_PLUGIN, GeditPluginClass))
-#define GEDIT_IS_PLUGIN(obj) (G_TYPE_CHECK_INSTANCE_TYPE((obj), GEDIT_TYPE_PLUGIN))
-#define GEDIT_IS_PLUGIN_CLASS(klass) (G_TYPE_CHECK_CLASS_TYPE ((klass), GEDIT_TYPE_PLUGIN))
-#define GEDIT_PLUGIN_GET_CLASS(obj) (G_TYPE_INSTANCE_GET_CLASS((obj), GEDIT_TYPE_PLUGIN, GeditPluginClass))
+#define EGG_PLUGINS_TYPE_PLUGIN (egg_plugins_plugin_get_type())
+#define EGG_PLUGINS_PLUGIN(obj) (G_TYPE_CHECK_INSTANCE_CAST((obj), EGG_PLUGINS_TYPE_PLUGIN, EggPluginsPlugin))
+#define EGG_PLUGINS_PLUGIN_CLASS(klass) (G_TYPE_CHECK_CLASS_CAST((klass), EGG_PLUGINS_TYPE_PLUGIN, EggPluginsPluginClass))
+#define EGG_PLUGINS_IS_PLUGIN(obj) (G_TYPE_CHECK_INSTANCE_TYPE((obj), EGG_PLUGINS_TYPE_PLUGIN))
+#define EGG_PLUGINS_IS_PLUGIN_CLASS(klass) (G_TYPE_CHECK_CLASS_TYPE ((klass), EGG_PLUGINS_TYPE_PLUGIN))
+#define EGG_PLUGINS_PLUGIN_GET_CLASS(obj) (G_TYPE_INSTANCE_GET_CLASS((obj), EGG_PLUGINS_TYPE_PLUGIN, EggPluginsPluginClass))
/*
* Main object structure
*/
-typedef struct _GeditPlugin GeditPlugin;
+typedef struct _EggPluginsPlugin EggPluginsPlugin;
-struct _GeditPlugin
+struct _EggPluginsPlugin
{
GObject parent;
};
@@ -63,29 +63,29 @@ struct _GeditPlugin
/*
* Class definition
*/
-typedef struct _GeditPluginClass GeditPluginClass;
+typedef struct _EggPluginsPluginClass EggPluginsPluginClass;
-struct _GeditPluginClass
+struct _EggPluginsPluginClass
{
GObjectClass parent_class;
/* Virtual public methods */
-
- void (*activate) (GeditPlugin *plugin,
+
+ void (*activate) (EggPluginsPlugin *plugin,
GtkWindow *window);
- void (*deactivate) (GeditPlugin *plugin,
+ void (*deactivate) (EggPluginsPlugin *plugin,
GtkWindow *window);
- void (*update_ui) (GeditPlugin *plugin,
+ void (*update_ui) (EggPluginsPlugin *plugin,
GtkWindow *window);
GtkWidget *(*create_configure_dialog)
- (GeditPlugin *plugin);
+ (EggPluginsPlugin *plugin);
/* Plugins should not override this, it's handled automatically by
- the GeditPluginClass */
+ the EggPluginsPluginClass */
gboolean (*is_configurable)
- (GeditPlugin *plugin);
+ (EggPluginsPlugin *plugin);
/* Padding for future expansion */
void (*_gedit_reserved1) (void);
@@ -97,32 +97,32 @@ struct _GeditPluginClass
/*
* Public methods
*/
-GType gedit_plugin_get_type (void) G_GNUC_CONST;
+GType egg_plugins_plugin_get_type (void) G_GNUC_CONST;
-gchar *gedit_plugin_get_install_dir (GeditPlugin *plugin);
-gchar *gedit_plugin_get_data_dir (GeditPlugin *plugin);
+gchar *egg_plugins_plugin_get_install_dir (EggPluginsPlugin *plugin);
+gchar *egg_plugins_plugin_get_data_dir (EggPluginsPlugin *plugin);
-void gedit_plugin_activate (GeditPlugin *plugin,
- GtkWindow *window);
-void gedit_plugin_deactivate (GeditPlugin *plugin,
- GtkWindow *window);
-
-void gedit_plugin_update_ui (GeditPlugin *plugin,
- GtkWindow *window);
+void egg_plugins_plugin_activate (EggPluginsPlugin *plugin,
+ GtkWindow *window);
+void egg_plugins_plugin_deactivate (EggPluginsPlugin *plugin,
+ GtkWindow *window);
+
+void egg_plugins_plugin_update_ui (EggPluginsPlugin *plugin,
+ GtkWindow *window);
-gboolean gedit_plugin_is_configurable (GeditPlugin *plugin);
-GtkWidget *gedit_plugin_create_configure_dialog
- (GeditPlugin *plugin);
+gboolean egg_plugins_plugin_is_configurable (EggPluginsPlugin *plugin);
+GtkWidget *egg_plugins_plugin_create_configure_dialog
+ (EggPluginsPlugin *plugin);
/**
- * GEDIT_PLUGIN_REGISTER_TYPE_WITH_CODE(PluginName, plugin_name, CODE):
+ * EGG_PLUGINS_PLUGIN_REGISTER_TYPE_WITH_CODE(PluginName, plugin_name, CODE):
*
* Utility macro used to register plugins with additional code.
*/
-#define GEDIT_PLUGIN_REGISTER_TYPE_WITH_CODE(PluginName, plugin_name, CODE) \
+#define EGG_PLUGINS_PLUGIN_REGISTER_TYPE_WITH_CODE(PluginName, plugin_name, CODE) \
G_DEFINE_DYNAMIC_TYPE_EXTENDED (PluginName, \
plugin_name, \
- GEDIT_TYPE_PLUGIN, \
+ EGG_PLUGINS_TYPE_PLUGIN, \
0, \
GTypeModule *module G_GNUC_UNUSED = type_module; /* back compat */ \
CODE) \
@@ -136,7 +136,7 @@ plugin_name##_class_finalize (PluginName##Class *klass) \
\
\
G_MODULE_EXPORT GType \
-register_gedit_plugin (GTypeModule *type_module) \
+register_egg_plugins_plugin (GTypeModule *type_module) \
{ \
plugin_name##_register_type (type_module); \
\
@@ -144,21 +144,21 @@ register_gedit_plugin (GTypeModule *type_module) \
}
/**
- * GEDIT_PLUGIN_REGISTER_TYPE(PluginName, plugin_name):
- *
+ * EGG_PLUGINS_REGISTER_TYPE(PluginName, plugin_name):
+ *
* Utility macro used to register plugins.
*/
-#define GEDIT_PLUGIN_REGISTER_TYPE(PluginName, plugin_name) \
- GEDIT_PLUGIN_REGISTER_TYPE_WITH_CODE(PluginName, plugin_name, ;)
+#define EGG_PLUGINS_PLUGIN_REGISTER_TYPE(PluginName, plugin_name) \
+ EGG_PLUGINS_PLUGIN_REGISTER_TYPE_WITH_CODE(PluginName, plugin_name, ;)
/**
- * GEDIT_PLUGIN_DEFINE_TYPE_WITH_CODE(ObjectName, object_name, PARENT_TYPE, CODE):
+ * EGG_PLUGINS_DEFINE_TYPE_WITH_CODE(ObjectName, object_name, PARENT_TYPE, CODE):
*
* Utility macro used to register gobject types in plugins with additional code.
*
* Deprecated: use G_DEFINE_DYNAMIC_TYPE_EXTENDED instead
*/
-#define GEDIT_PLUGIN_DEFINE_TYPE_WITH_CODE(ObjectName, object_name, PARENT_TYPE, CODE) \
+#define EGG_PLUGINS_DEFINE_TYPE_WITH_CODE(ObjectName, object_name, PARENT_TYPE, CODE) \
\
static GType g_define_type_id = 0; \
\
@@ -207,21 +207,21 @@ object_name##_register_type (GTypeModule *type_module) \
/**
- * GEDIT_PLUGIN_DEFINE_TYPE(ObjectName, object_name, PARENT_TYPE):
+ * EGG_PLUGINS_DEFINE_TYPE(ObjectName, object_name, PARENT_TYPE):
*
* Utility macro used to register gobject types in plugins.
*
* Deprecated: use G_DEFINE_DYNAMIC instead
*/
-#define GEDIT_PLUGIN_DEFINE_TYPE(ObjectName, object_name, PARENT_TYPE) \
- GEDIT_PLUGIN_DEFINE_TYPE_WITH_CODE(ObjectName, object_name, PARENT_TYPE, ;)
+#define EGG_PLUGINS_DEFINE_TYPE(ObjectName, object_name, PARENT_TYPE) \
+ EGG_PLUGINS_DEFINE_TYPE_WITH_CODE(ObjectName, object_name, PARENT_TYPE, ;)
/**
- * GEDIT_PLUGIN_IMPLEMENT_INTERFACE(TYPE_IFACE, iface_init):
+ * EGG_PLUGINS_IMPLEMENT_INTERFACE(TYPE_IFACE, iface_init):
*
* Utility macro used to register interfaces for gobject types in plugins.
*/
-#define GEDIT_PLUGIN_IMPLEMENT_INTERFACE(object_name, TYPE_IFACE, iface_init) \
+#define EGG_PLUGINS_IMPLEMENT_INTERFACE(object_name, TYPE_IFACE, iface_init) \
const GInterfaceInfo object_name##_interface_info = \
{ \
(GInterfaceInitFunc) iface_init, \
@@ -236,4 +236,4 @@ object_name##_register_type (GTypeModule *type_module) \
G_END_DECLS
-#endif /* __GEDIT_PLUGIN_H__ */
+#endif /* __EGG_PLUGINS_PLUGIN_H__ */
diff --git a/plugin-loaders/c/Makefile.am b/plugin-loaders/c/Makefile.am
index 7760aef..bf9718a 100644
--- a/plugin-loaders/c/Makefile.am
+++ b/plugin-loaders/c/Makefile.am
@@ -12,10 +12,10 @@ INCLUDES = \
loader_LTLIBRARIES = libcloader.la
NOINST_H_FILES = \
- gedit-plugin-loader-c.h
+ egg-plugins-loader-c.h
libcloader_la_SOURCES = \
- gedit-plugin-loader-c.c \
+ egg-plugins-loader-c.c \
$(NOINST_H_FILES)
libcloader_la_LDFLAGS = $(LOADER_LIBTOOL_FLAGS)
diff --git a/plugin-loaders/c/egg-plugins-loader-c.c b/plugin-loaders/c/egg-plugins-loader-c.c
new file mode 100644
index 0000000..eab15df
--- /dev/null
+++ b/plugin-loaders/c/egg-plugins-loader-c.c
@@ -0,0 +1,182 @@
+/*
+ * gedit-plugin-loader-c.c
+ * This file is part of gedit
+ *
+ * Copyright (C) 2008 - Jesse van den Kieboom
+ *
+ * This program is free software; you can redistribute it and/or modify
+ * it under the terms of the GNU General Public License as published by
+ * the Free Software Foundation; either version 2 of the License, or
+ * (at your option) any later version.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with this program; if not, write to the Free Software
+ * Foundation, Inc., 59 Temple Place, Suite 330,
+ * Boston, MA 02111-1307, USA.
+ */
+
+#include "egg-plugins-loader-c.h"
+#include <libplugins/egg-plugins-object-module.h>
+
+#define EGG_PLUGINS_LOADER_C_GET_PRIVATE(object)(G_TYPE_INSTANCE_GET_PRIVATE((object), EGG_PLUGINS_TYPE_LOADER_C, EggPluginsLoaderCPrivate))
+
+struct _EggPluginsLoaderCPrivate
+{
+ GHashTable *loaded_plugins;
+};
+
+static void egg_plugins_loader_iface_init (gpointer g_iface, gpointer iface_data);
+
+EGG_PLUGINS_LOADER_REGISTER_TYPE (EggPluginsLoaderC, egg_plugins_loader_c, G_TYPE_OBJECT, egg_plugins_loader_iface_init);
+
+
+static const gchar *
+egg_plugins_loader_iface_get_id (void)
+{
+ return "C";
+}
+
+static EggPluginsPlugin *
+egg_plugins_loader_iface_load (EggPluginsLoader *loader,
+ EggPluginsInfo *info,
+ const gchar *path)
+{
+ EggPluginsLoaderC *cloader = EGG_PLUGINS_LOADER_C (loader);
+ EggPluginsObjectModule *module;
+ const gchar *module_name;
+ EggPluginsPlugin *result;
+
+ module = (EggPluginsObjectModule *)g_hash_table_lookup (cloader->priv->loaded_plugins, info);
+ module_name = egg_plugins_info_get_module_name (info);
+
+ if (module == NULL)
+ {
+ /* For now we force all modules to be resident */
+ module = egg_plugins_object_module_new (module_name,
+ path,
+ "register_gedit_plugin",
+ TRUE);
+
+ /* Infos are available for all the lifetime of the loader.
+ * If this changes, we should use weak refs or something */
+
+ g_hash_table_insert (cloader->priv->loaded_plugins, info, module);
+ }
+
+ if (!g_type_module_use (G_TYPE_MODULE (module)))
+ {
+ g_warning ("Could not load plugin module: %s", egg_plugins_info_get_name (info));
+
+ return NULL;
+ }
+
+ /* TODO: for now we force data-dir-name = module-name... if needed we can
+ * add a datadir field to the plugin descriptor file.
+ */
+ result = (EggPluginsPlugin *) egg_plugins_object_module_new_object (module,
+ "install-dir", path,
+ "data-dir-name", module_name,
+ NULL);
+
+ if (!result)
+ {
+ g_warning ("Could not create plugin object: %s", egg_plugins_info_get_name (info));
+ g_type_module_unuse (G_TYPE_MODULE (module));
+
+ return NULL;
+ }
+
+ g_type_module_unuse (G_TYPE_MODULE (module));
+
+ return result;
+}
+
+static void
+egg_plugins_loader_iface_unload (EggPluginsLoader *loader,
+ EggPluginsInfo *info)
+{
+ //EggPluginsLoaderC *cloader = EGG_PLUGINS_LOADER_C (loader);
+
+ /* this is a no-op, since the type module will be properly unused as
+ the last reference to the plugin dies. When the plugin is activated
+ again, the library will be reloaded */
+}
+
+static void
+egg_plugins_loader_iface_init (gpointer g_iface,
+ gpointer iface_data)
+{
+ EggPluginsLoaderInterface *iface = (EggPluginsLoaderInterface *)g_iface;
+
+ iface->get_id = egg_plugins_loader_iface_get_id;
+ iface->load = egg_plugins_loader_iface_load;
+ iface->unload = egg_plugins_loader_iface_unload;
+}
+
+static void
+egg_plugins_loader_c_finalize (GObject *object)
+{
+ EggPluginsLoaderC *cloader = EGG_PLUGINS_LOADER_C (object);
+ GList *infos;
+ GList *item;
+
+ /* FIXME: this sanity check it's not efficient. Let's remove it
+ * once we are confident with the code */
+
+ infos = g_hash_table_get_keys (cloader->priv->loaded_plugins);
+
+ for (item = infos; item; item = item->next)
+ {
+ EggPluginsInfo *info = (EggPluginsInfo *)item->data;
+
+ if (egg_plugins_info_is_active (info))
+ {
+ g_warning ("There are still C plugins loaded during destruction");
+ break;
+ }
+ }
+
+ g_list_free (infos);
+
+ g_hash_table_destroy (cloader->priv->loaded_plugins);
+
+ G_OBJECT_CLASS (egg_plugins_loader_c_parent_class)->finalize (object);
+}
+
+static void
+egg_plugins_loader_c_class_init (EggPluginsLoaderCClass *klass)
+{
+ GObjectClass *object_class = G_OBJECT_CLASS (klass);
+
+ object_class->finalize = egg_plugins_loader_c_finalize;
+
+ g_type_class_add_private (object_class, sizeof (EggPluginsLoaderCPrivate));
+}
+
+static void
+egg_plugins_loader_c_class_finalize (EggPluginsLoaderCClass *klass)
+{
+}
+
+static void
+egg_plugins_loader_c_init (EggPluginsLoaderC *self)
+{
+ self->priv = EGG_PLUGINS_LOADER_C_GET_PRIVATE (self);
+
+ /* loaded_plugins maps EggPluginsInfo to a EggPluginsObjectModule */
+ self->priv->loaded_plugins = g_hash_table_new (g_direct_hash,
+ g_direct_equal);
+}
+
+EggPluginsLoaderC *
+egg_plugins_loader_c_new ()
+{
+ GObject *loader = g_object_new (EGG_PLUGINS_TYPE_LOADER_C, NULL);
+
+ return EGG_PLUGINS_LOADER_C (loader);
+}
diff --git a/plugin-loaders/c/egg-plugins-loader-c.h b/plugin-loaders/c/egg-plugins-loader-c.h
new file mode 100644
index 0000000..d7fa07c
--- /dev/null
+++ b/plugin-loaders/c/egg-plugins-loader-c.h
@@ -0,0 +1,60 @@
+/*
+ * gedit-plugin-loader-c.h
+ * This file is part of gedit
+ *
+ * Copyright (C) 2008 - Jesse van den Kieboom
+ *
+ * This program is free software; you can redistribute it and/or modify
+ * it under the terms of the GNU General Public License as published by
+ * the Free Software Foundation; either version 2 of the License, or
+ * (at your option) any later version.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with this program; if not, write to the Free Software
+ * Foundation, Inc., 59 Temple Place, Suite 330,
+ * Boston, MA 02111-1307, USA.
+ */
+
+#ifndef __EGG_PLUGINS_LOADER_C_H__
+#define __EGG_PLUGINS_LOADER_C_H__
+
+#include <libplugins/egg-plugins-loader.h>
+
+G_BEGIN_DECLS
+
+#define EGG_PLUGINS_TYPE_LOADER_C (egg_plugins_loader_c_get_type ())
+#define EGG_PLUGINS_LOADER_C(obj) (G_TYPE_CHECK_INSTANCE_CAST ((obj), EGG_PLUGINS_TYPE_LOADER_C, EggPluginsLoaderC))
+#define EGG_PLUGINS_LOADER_C_CONST(obj) (G_TYPE_CHECK_INSTANCE_CAST ((obj), EGG_PLUGINS_TYPE_LOADER_C, EggPluginsLoaderC const))
+#define EGG_PLUGINS_LOADER_C_CLASS(klass) (G_TYPE_CHECK_CLASS_CAST ((klass), EGG_PLUGINS_TYPE_LOADER_C, EggPluginsLoaderCClass))
+#define EGG_PLUGINS_IS_LOADER_C(obj) (G_TYPE_CHECK_INSTANCE_TYPE ((obj), EGG_PLUGINS_TYPE_LOADER_C))
+#define EGG_PLUGINS_IS_LOADER_C_CLASS(klass) (G_TYPE_CHECK_CLASS_TYPE ((klass), EGG_PLUGINS_TYPE_LOADER_C))
+#define EGG_PLUGINS_LOADER_C_GET_CLASS(obj) (G_TYPE_INSTANCE_GET_CLASS ((obj), EGG_PLUGINS_TYPE_LOADER_C, EggPluginsLoaderCClass))
+
+typedef struct _EggPluginsLoaderC EggPluginsLoaderC;
+typedef struct _EggPluginsLoaderCClass EggPluginsLoaderCClass;
+typedef struct _EggPluginsLoaderCPrivate EggPluginsLoaderCPrivate;
+
+struct _EggPluginsLoaderC {
+ GObject parent;
+
+ EggPluginsLoaderCPrivate *priv;
+};
+
+struct _EggPluginsLoaderCClass {
+ GObjectClass parent_class;
+};
+
+GType egg_plugins_loader_c_get_type (void) G_GNUC_CONST;
+EggPluginsLoaderC *egg_plugins_loader_c_new(void);
+
+/* All the loaders must implement this function */
+G_MODULE_EXPORT GType register_egg_plugins_loader (GTypeModule * module);
+
+G_END_DECLS
+
+#endif /* __EGG_PLUGINS_LOADER_C_H__ */
diff --git a/plugin-loaders/python/Makefile.am b/plugin-loaders/python/Makefile.am
index b9b4096..c1f3263 100644
--- a/plugin-loaders/python/Makefile.am
+++ b/plugin-loaders/python/Makefile.am
@@ -19,12 +19,12 @@ loader_LTLIBRARIES = libpythonloader.la
NOINST_H_FILES = \
- gedit-plugin-loader-python.h \
- gedit-plugin-python.h
+ egg-plugins-loader-python.h \
+ egg-plugins-plugin-python.h
libpythonloader_la_SOURCES = \
- gedit-plugin-loader-python.c \
- gedit-plugin-python.c \
+ egg-plugins-loader-python.c \
+ egg-plugins-plugin-python.c \
$(NOINST_H_FILES)
libpythonloader_la_LDFLAGS = $(LOADER_LIBTOOL_FLAGS)
diff --git a/plugin-loaders/python/gedit-plugin-loader-python.c b/plugin-loaders/python/egg-plugins-loader-python.c
similarity index 76%
rename from plugin-loaders/python/gedit-plugin-loader-python.c
rename to plugin-loaders/python/egg-plugins-loader-python.c
index 4d411aa..f6a82ae 100644
--- a/plugin-loaders/python/gedit-plugin-loader-python.c
+++ b/plugin-loaders/python/egg-plugins-loader-python.c
@@ -16,13 +16,12 @@
*
* You should have received a copy of the GNU General Public License
* along with this program; if not, write to the Free Software
- * Foundation, Inc., 59 Temple Place, Suite 330,
- * Boston, MA 02111-1307, USA.
+ * Foundation, Inc., 59 Temple Place, Suite 330,
+ * Boston, MA 02111-1307, USA.
*/
-#include "gedit-plugin-loader-python.h"
+#include "egg-plugins-loader-python.h"
#include "gedit-plugin-python.h"
-#include <libplugins/gedit-object-module.h>
#define NO_IMPORT_PYGOBJECT
#define NO_IMPORT_PYGTK
@@ -39,9 +38,9 @@ typedef int Py_ssize_t;
#define PY_SSIZE_T_MIN INT_MIN
#endif
-#define GEDIT_PLUGIN_LOADER_PYTHON_GET_PRIVATE(object)(G_TYPE_INSTANCE_GET_PRIVATE((object), GEDIT_TYPE_PLUGIN_LOADER_PYTHON, GeditPluginLoaderPythonPrivate))
+#define EGG_PLUGINS_LOADER_PYTHON_GET_PRIVATE(object)(G_TYPE_INSTANCE_GET_PRIVATE((object), EGG_PLUGINS_TYPE_LOADER_PYTHON, EggPluginsLoaderPythonPrivate))
-struct _GeditPluginLoaderPythonPrivate
+struct _EggPluginsLoaderPythonPrivate
{
GHashTable *loaded_plugins;
guint idle_gc;
@@ -55,7 +54,7 @@ typedef struct
gchar *path;
} PythonInfo;
-static void gedit_plugin_loader_iface_init (gpointer g_iface, gpointer iface_data);
+static void egg_plugins_loader_iface_init (gpointer g_iface, gpointer iface_data);
/* Exported by pygedit module */
void pygedit_register_classes (PyObject *d);
@@ -71,18 +70,18 @@ void pygeditcommands_register_classes (PyObject *d);
extern PyMethodDef pygeditcommands_functions[];
/* We retreive this to check for correct class hierarchy */
-static PyTypeObject *PyGeditPlugin_Type;
+static PyTypeObject *PyEggPluginsPlugin_Type;
-GEDIT_PLUGIN_LOADER_REGISTER_TYPE (GeditPluginLoaderPython, gedit_plugin_loader_python, G_TYPE_OBJECT, gedit_plugin_loader_iface_init);
+EGG_PLUGINS_LOADER_REGISTER_TYPE (EggPluginsLoaderPython, egg_plugins_loader_python, G_TYPE_OBJECT, egg_plugins_loader_iface_init);
static PyObject *
-find_python_plugin_type (GeditPluginInfo *info,
- PyObject *pymodule)
+find_python_plugin_type (EggPluginsInfo *info,
+ PyObject *pymodule)
{
PyObject *locals, *key, *value;
Py_ssize_t pos = 0;
-
+
locals = PyModule_GetDict (pymodule);
while (PyDict_Next (locals, &pos, &key, &value))
@@ -90,70 +89,70 @@ find_python_plugin_type (GeditPluginInfo *info,
if (!PyType_Check(value))
continue;
- if (PyObject_IsSubclass (value, (PyObject*) PyGeditPlugin_Type))
+ if (PyObject_IsSubclass (value, (PyObject*) PyEggPluginsPlugin_Type))
return value;
}
-
- g_warning ("No GeditPlugin derivative found in Python plugin '%s'",
- gedit_plugin_info_get_name (info));
+
+ g_warning ("No EggPluginsPlugin derivative found in Python plugin '%s'",
+ egg_plugins_info_get_name (info));
return NULL;
}
-static GeditPlugin *
-new_plugin_from_info (GeditPluginLoaderPython *loader,
- GeditPluginInfo *info)
+static EggPluginsPlugin *
+new_plugin_from_info (EggPluginsLoaderPython *loader,
+ EggPluginsInfo *info)
{
PythonInfo *pyinfo;
PyTypeObject *pytype;
PyObject *pyobject;
PyGObject *pygobject;
- GeditPlugin *instance;
+ EggPluginsPlugin *instance;
PyObject *emptyarg;
pyinfo = (PythonInfo *)g_hash_table_lookup (loader->priv->loaded_plugins, info);
-
+
if (pyinfo == NULL)
return NULL;
-
+
pytype = (PyTypeObject *)pyinfo->type;
-
+
if (pytype->tp_new == NULL)
return NULL;
emptyarg = PyTuple_New(0);
pyobject = pytype->tp_new (pytype, emptyarg, NULL);
Py_DECREF (emptyarg);
-
+
if (pyobject == NULL)
{
- g_error ("Could not create instance for %s.", gedit_plugin_info_get_name (info));
+ g_error ("Could not create instance for %s.", egg_plugins_info_get_name (info));
return NULL;
}
pygobject = (PyGObject *)pyobject;
-
+
if (pygobject->obj != NULL)
{
Py_DECREF (pyobject);
- g_error ("Could not create instance for %s (GObject already initialized).", gedit_plugin_info_get_name (info));
+ g_error ("Could not create instance for %s (GObject already initialized).", egg_plugins_info_get_name (info));
return NULL;
}
-
+
pygobject_construct (pygobject,
"install-dir", pyinfo->path,
- "data-dir-name", gedit_plugin_info_get_module_name (info),
+ "data-dir-name", egg_plugins_info_get_module_name (info),
NULL);
-
+
if (pygobject->obj == NULL)
{
- g_error ("Could not create instance for %s (GObject not constructed).", gedit_plugin_info_get_name (info));
+ g_error ("Could not create instance for %s (GObject not constructed).", egg_plugins_info_get_name (info));
Py_DECREF (pyobject);
return NULL;
}
/* now call tp_init manually */
- if (PyType_IsSubtype (pyobject->ob_type, pytype) &&
+ if (PyType_IsSubtype (pyobject->ob_type, pytype) &&
pyobject->ob_type->tp_init != NULL)
{
emptyarg = PyTuple_New(0);
@@ -161,75 +160,75 @@ new_plugin_from_info (GeditPluginLoaderPython *loader,
Py_DECREF (emptyarg);
}
- instance = GEDIT_PLUGIN (pygobject->obj);
+ instance = EGG_PLUGINS_PLUGIN (pygobject->obj);
pyinfo->instance = (PyObject *)pygobject;
- /* make sure to register the python instance for the GeditPluginPython
+ /* make sure to register the python instance for the EggPluginsPluginPython
object to it can wrap the virtual gedit plugin funcs back to python */
- _gedit_plugin_python_set_instance (GEDIT_PLUGIN_PYTHON (instance), (PyObject *)pygobject);
-
+ _egg_plugins_plugin_python_set_instance (EGG_PLUGINS_PLUGIN_PYTHON (instance), (PyObject *)pygobject);
+
/* we return a reference here because the other is owned by python */
- return GEDIT_PLUGIN (g_object_ref (instance));
+ return EGG_PLUGINS_PLUGIN (g_object_ref (instance));
}
-static GeditPlugin *
-add_python_info (GeditPluginLoaderPython *loader,
- GeditPluginInfo *info,
+static EggPluginsPlugin *
+add_python_info (EggPluginsLoaderPython *loader,
+ EggPluginsInfo *info,
PyObject *module,
const gchar *path,
PyObject *type)
{
PythonInfo *pyinfo;
-
+
pyinfo = g_new (PythonInfo, 1);
pyinfo->path = g_strdup (path);
pyinfo->type = type;
Py_INCREF (pyinfo->type);
-
+
g_hash_table_insert (loader->priv->loaded_plugins, info, pyinfo);
-
+
return new_plugin_from_info (loader, info);
}
static const gchar *
-gedit_plugin_loader_iface_get_id (void)
+egg_plugins_loader_iface_get_id (void)
{
return "Python";
}
-static GeditPlugin *
-gedit_plugin_loader_iface_load (GeditPluginLoader *loader,
- GeditPluginInfo *info,
+static EggPluginsPlugin *
+egg_plugins_loader_iface_load (EggPluginsLoader *loader,
+ EggPluginsInfo *info,
const gchar *path)
{
- GeditPluginLoaderPython *pyloader = GEDIT_PLUGIN_LOADER_PYTHON (loader);
+ EggPluginsLoaderPython *pyloader = EGG_PLUGINS_LOADER_PYTHON (loader);
PyObject *main_module, *main_locals, *pytype;
PyObject *pymodule, *fromlist;
gchar *module_name;
- GeditPlugin *result;
-
+ EggPluginsPlugin *result;
+
if (pyloader->priv->init_failed)
{
g_warning ("Cannot load python plugin Python '%s' since gedit was"
"not able to initialize the Python interpreter.",
- gedit_plugin_info_get_name (info));
+ egg_plugins_info_get_name (info));
return NULL;
}
-
+
/* see if py definition for the plugin is already loaded */
result = new_plugin_from_info (pyloader, info);
-
+
if (result != NULL)
return result;
-
+
main_module = PyImport_AddModule ("gedit.plugins");
if (main_module == NULL)
{
g_warning ("Could not get gedit.plugins.");
return NULL;
}
-
+
/* If we have a special path, we register it */
if (path != NULL)
{
@@ -241,19 +240,19 @@ gedit_plugin_loader_iface_load (GeditPluginLoader *loader,
Py_DECREF (pypath);
}
-
+
main_locals = PyModule_GetDict (main_module);
-
+
/* we need a fromlist to be able to import modules with a '.' in the
name. */
fromlist = PyTuple_New(0);
- module_name = g_strdup (gedit_plugin_info_get_module_name (info));
-
- pymodule = PyImport_ImportModuleEx (module_name,
- main_locals,
- main_locals,
+ module_name = g_strdup (egg_plugins_info_get_module_name (info));
+
+ pymodule = PyImport_ImportModuleEx (module_name,
+ main_locals,
+ main_locals,
fromlist);
-
+
Py_DECREF(fromlist);
if (!pymodule)
@@ -265,9 +264,9 @@ gedit_plugin_loader_iface_load (GeditPluginLoader *loader,
PyDict_SetItemString (main_locals, module_name, pymodule);
g_free (module_name);
-
+
pytype = find_python_plugin_type (info, pymodule);
-
+
if (pytype)
return add_python_info (pyloader, info, pymodule, path, pytype);
@@ -275,27 +274,27 @@ gedit_plugin_loader_iface_load (GeditPluginLoader *loader,
}
static void
-gedit_plugin_loader_iface_unload (GeditPluginLoader *loader,
- GeditPluginInfo *info)
+egg_plugins_loader_iface_unload (EggPluginsLoader *loader,
+ EggPluginsInfo *info)
{
- GeditPluginLoaderPython *pyloader = GEDIT_PLUGIN_LOADER_PYTHON (loader);
+ EggPluginsLoaderPython *pyloader = EGG_PLUGINS_LOADER_PYTHON (loader);
PythonInfo *pyinfo;
PyGILState_STATE state;
-
+
pyinfo = (PythonInfo *)g_hash_table_lookup (pyloader->priv->loaded_plugins, info);
-
+
if (!pyinfo)
return;
-
+
state = pyg_gil_state_ensure ();
Py_XDECREF (pyinfo->instance);
pyg_gil_state_release (state);
-
+
pyinfo->instance = NULL;
}
static gboolean
-run_gc (GeditPluginLoaderPython *loader)
+run_gc (EggPluginsLoaderPython *loader)
{
while (PyGC_Collect ())
;
@@ -305,14 +304,14 @@ run_gc (GeditPluginLoaderPython *loader)
}
static void
-gedit_plugin_loader_iface_garbage_collect (GeditPluginLoader *loader)
+egg_plugins_loader_iface_garbage_collect (EggPluginsLoader *loader)
{
- GeditPluginLoaderPython *pyloader;
-
+ EggPluginsLoaderPython *pyloader;
+
if (!Py_IsInitialized())
return;
- pyloader = GEDIT_PLUGIN_LOADER_PYTHON (loader);
+ pyloader = EGG_PLUGINS_LOADER_PYTHON (loader);
/*
* We both run the GC right now and we schedule
@@ -327,19 +326,19 @@ gedit_plugin_loader_iface_garbage_collect (GeditPluginLoader *loader)
}
static void
-gedit_plugin_loader_iface_init (gpointer g_iface,
+egg_plugins_loader_iface_init (gpointer g_iface,
gpointer iface_data)
{
- GeditPluginLoaderInterface *iface = (GeditPluginLoaderInterface *)g_iface;
-
- iface->get_id = gedit_plugin_loader_iface_get_id;
- iface->load = gedit_plugin_loader_iface_load;
- iface->unload = gedit_plugin_loader_iface_unload;
- iface->garbage_collect = gedit_plugin_loader_iface_garbage_collect;
+ EggPluginsLoaderInterface *iface = (EggPluginsLoaderInterface *)g_iface;
+
+ iface->get_id = egg_plugins_loader_iface_get_id;
+ iface->load = egg_plugins_loader_iface_load;
+ iface->unload = egg_plugins_loader_iface_unload;
+ iface->garbage_collect = egg_plugins_loader_iface_garbage_collect;
}
static void
-gedit_python_shutdown (GeditPluginLoaderPython *loader)
+gedit_python_shutdown (EggPluginsLoaderPython *loader)
{
if (!Py_IsInitialized ())
return;
@@ -351,7 +350,7 @@ gedit_python_shutdown (GeditPluginLoaderPython *loader)
}
while (PyGC_Collect ())
- ;
+ ;
Py_Finalize ();
}
@@ -481,7 +480,7 @@ gedit_init_pygtksourceview (void)
}
static gboolean
-gedit_python_init (GeditPluginLoaderPython *loader)
+gedit_python_init (EggPluginsLoaderPython *loader)
{
PyObject *mdict, *tuple;
PyObject *gedit, *geditutils, *geditcommands, *geditplugins;
@@ -496,7 +495,7 @@ gedit_python_init (GeditPluginLoaderPython *loader)
* retry again */
return FALSE;
}
-
+
if (Py_IsInitialized ())
{
/* Python has already been successfully initialized */
@@ -515,7 +514,7 @@ gedit_python_init (GeditPluginLoaderPython *loader)
to avoid to manage signal handlers ? - Paolo (Dec. 31, 2006) */
/* Save old handler */
- res = sigaction (SIGINT, NULL, &old_sigint);
+ res = sigaction (SIGINT, NULL, &old_sigint);
if (res != 0)
{
g_warning ("Error initializing Python interpreter: cannot get "
@@ -547,13 +546,13 @@ gedit_python_init (GeditPluginLoaderPython *loader)
goto python_init_error;
}
- /* import gobject */
+ /* import gobject */
gedit_init_pygobject ();
if (PyErr_Occurred ())
{
g_warning ("Error initializing Python interpreter: could not import pygobject.");
- goto python_init_error;
+ goto python_init_error;
}
/* import gtk */
@@ -564,7 +563,7 @@ gedit_python_init (GeditPluginLoaderPython *loader)
goto python_init_error;
}
-
+
/* import gtksourceview */
gedit_init_pygtksourceview ();
if (PyErr_Occurred ())
@@ -574,8 +573,8 @@ gedit_python_init (GeditPluginLoaderPython *loader)
g_warning ("Error initializing Python interpreter: could not import pygtksourceview.");
goto python_init_error;
- }
-
+ }
+
/* import gedit */
gedit = Py_InitModule ("gedit", pygedit_functions);
mdict = PyModule_GetDict (gedit);
@@ -584,16 +583,16 @@ gedit_python_init (GeditPluginLoaderPython *loader)
pygedit_add_constants (gedit, "GEDIT_");
/* gedit version */
- tuple = Py_BuildValue("(iii)",
+ tuple = Py_BuildValue("(iii)",
GEDIT_MAJOR_VERSION,
GEDIT_MINOR_VERSION,
GEDIT_MICRO_VERSION);
PyDict_SetItemString(mdict, "version", tuple);
Py_DECREF(tuple);
-
+
/* Retrieve the Python type for gedit.Plugin */
- PyGeditPlugin_Type = (PyTypeObject *) PyDict_GetItemString (mdict, "Plugin");
- if (PyGeditPlugin_Type == NULL)
+ PyEggPluginsPlugin_Type = (PyTypeObject *) PyDict_GetItemString (mdict, "Plugin");
+ if (PyEggPluginsPlugin_Type == NULL)
{
PyErr_Print ();
@@ -614,7 +613,7 @@ gedit_python_init (GeditPluginLoaderPython *loader)
mdict = PyModule_GetDict (geditutils);
pygeditutils_register_classes (mdict);
-
+
mdict = PyModule_GetDict (geditcommands);
pygeditcommands_register_classes (mdict);
@@ -632,12 +631,12 @@ gedit_python_init (GeditPluginLoaderPython *loader)
gettext_args = Py_BuildValue ("ss", GETTEXT_PACKAGE, GEDIT_LOCALEDIR);
PyObject_CallObject (install, gettext_args);
Py_DECREF (gettext_args);
-
+
/* Python has been successfully initialized */
loader->priv->init_failed = FALSE;
-
+
return TRUE;
-
+
python_init_error:
g_warning ("Please check the installation of all the Python related packages required "
@@ -651,28 +650,28 @@ python_init_error:
}
static void
-gedit_plugin_loader_python_finalize (GObject *object)
+egg_plugins_loader_python_finalize (GObject *object)
{
- GeditPluginLoaderPython *pyloader = GEDIT_PLUGIN_LOADER_PYTHON (object);
-
+ EggPluginsLoaderPython *pyloader = EGG_PLUGINS_LOADER_PYTHON (object);
+
g_hash_table_destroy (pyloader->priv->loaded_plugins);
gedit_python_shutdown (pyloader);
- G_OBJECT_CLASS (gedit_plugin_loader_python_parent_class)->finalize (object);
+ G_OBJECT_CLASS (egg_plugins_loader_python_parent_class)->finalize (object);
}
static void
-gedit_plugin_loader_python_class_init (GeditPluginLoaderPythonClass *klass)
+egg_plugins_loader_python_class_init (EggPluginsLoaderPythonClass *klass)
{
GObjectClass *object_class = G_OBJECT_CLASS (klass);
-
- object_class->finalize = gedit_plugin_loader_python_finalize;
- g_type_class_add_private (object_class, sizeof (GeditPluginLoaderPythonPrivate));
+ object_class->finalize = egg_plugins_loader_python_finalize;
+
+ g_type_class_add_private (object_class, sizeof (EggPluginsLoaderPythonPrivate));
}
static void
-gedit_plugin_loader_python_class_finalize (GeditPluginLoaderPythonClass *klass)
+egg_plugins_loader_python_class_finalize (EggPluginsLoaderPythonClass *klass)
{
}
@@ -680,33 +679,33 @@ static void
destroy_python_info (PythonInfo *info)
{
PyGILState_STATE state = pyg_gil_state_ensure ();
- Py_XDECREF (info->type);
+ Py_XDECREF (info->type);
pyg_gil_state_release (state);
-
+
g_free (info->path);
g_free (info);
}
static void
-gedit_plugin_loader_python_init (GeditPluginLoaderPython *self)
+egg_plugins_loader_python_init (EggPluginsLoaderPython *self)
{
- self->priv = GEDIT_PLUGIN_LOADER_PYTHON_GET_PRIVATE (self);
-
+ self->priv = EGG_PLUGINS_LOADER_PYTHON_GET_PRIVATE (self);
+
/* initialize python interpreter */
gedit_python_init (self);
- /* loaded_plugins maps GeditPluginInfo to a PythonInfo */
+ /* loaded_plugins maps EggPluginsInfo to a PythonInfo */
self->priv->loaded_plugins = g_hash_table_new_full (g_direct_hash,
g_direct_equal,
NULL,
(GDestroyNotify)destroy_python_info);
}
-GeditPluginLoaderPython *
-gedit_plugin_loader_python_new ()
+EggPluginsLoaderPython *
+egg_plugins_loader_python_new ()
{
- GObject *loader = g_object_new (GEDIT_TYPE_PLUGIN_LOADER_PYTHON, NULL);
+ GObject *loader = g_object_new (EGG_PLUGINS_TYPE_LOADER_PYTHON, NULL);
- return GEDIT_PLUGIN_LOADER_PYTHON (loader);
+ return EGG_PLUGINS_LOADER_PYTHON (loader);
}
diff --git a/plugin-loaders/python/egg-plugins-loader-python.h b/plugin-loaders/python/egg-plugins-loader-python.h
new file mode 100644
index 0000000..817e3bc
--- /dev/null
+++ b/plugin-loaders/python/egg-plugins-loader-python.h
@@ -0,0 +1,61 @@
+/*
+ * gedit-plugin-loader-python.h
+ * This file is part of gedit
+ *
+ * Copyright (C) 2008 - Jesse van den Kieboom
+ *
+ * This program is free software; you can redistribute it and/or modify
+ * it under the terms of the GNU General Public License as published by
+ * the Free Software Foundation; either version 2 of the License, or
+ * (at your option) any later version.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with this program; if not, write to the Free Software
+ * Foundation, Inc., 59 Temple Place, Suite 330,
+ * Boston, MA 02111-1307, USA.
+ */
+
+#ifndef __EGG_PLUGINS_LOADER_PYTHON_H__
+#define __EGG_PLUGINS_LOADER_PYTHON_H__
+
+#include <libplugins/egg-plugins-loader.h>
+
+G_BEGIN_DECLS
+
+#define EGG_PLUGINS_TYPE_LOADER_PYTHON (egg_plugins_loader_python_get_type ())
+#define EGG_PLUGINS_LOADER_PYTHON(obj) (G_TYPE_CHECK_INSTANCE_CAST ((obj), EGG_PLUGINS_TYPE_LOADER_PYTHON, EggPluginsLoaderPython))
+#define EGG_PLUGINS_LOADER_PYTHON_CONST(obj) (G_TYPE_CHECK_INSTANCE_CAST ((obj), EGG_PLUGINS_TYPE_LOADER_PYTHON, EggPluginsLoaderPython const))
+#define EGG_PLUGINS_LOADER_PYTHON_CLASS(klass) (G_TYPE_CHECK_CLASS_CAST ((klass), EGG_PLUGINS_TYPE_LOADER_PYTHON, EggPluginsLoaderPythonClass))
+#define EGG_PLUGINS_IS_LOADER_PYTHON(obj) (G_TYPE_CHECK_INSTANCE_TYPE ((obj), EGG_PLUGINS_TYPE_LOADER_PYTHON))
+#define EGG_PLUGINS_IS_LOADER_PYTHON_CLASS(klass) (G_TYPE_CHECK_CLASS_TYPE ((klass), EGG_PLUGINS_TYPE_LOADER_PYTHON))
+#define EGG_PLUGINS_LOADER_PYTHON_GET_CLASS(obj) (G_TYPE_INSTANCE_GET_CLASS ((obj), EGG_PLUGINS_TYPE_LOADER_PYTHON, EggPluginsLoaderPythonClass))
+
+typedef struct _EggPluginsLoaderPython EggPluginsLoaderPython;
+typedef struct _EggPluginsLoaderPythonClass EggPluginsLoaderPythonClass;
+typedef struct _EggPluginsLoaderPythonPrivate EggPluginsLoaderPythonPrivate;
+
+struct _EggPluginsLoaderPython {
+ GObject parent;
+
+ EggPluginsLoaderPythonPrivate *priv;
+};
+
+struct _EggPluginsLoaderPythonClass {
+ GObjectClass parent_class;
+};
+
+GType egg_plugins_loader_python_get_type (void) G_GNUC_CONST;
+EggPluginsLoaderPython *egg_plugins_loader_python_new(void);
+
+/* All the loaders must implement this function */
+G_MODULE_EXPORT GType register_egg_plugins_loader (GTypeModule * module);
+
+G_END_DECLS
+
+#endif /* __EGG_PLUGINS_LOADER_PYTHON_H__ */
+
diff --git a/plugin-loaders/python/gedit-plugin-python.c b/plugin-loaders/python/egg-plugins-plugin-python.c
similarity index 66%
rename from plugin-loaders/python/gedit-plugin-python.c
rename to plugin-loaders/python/egg-plugins-plugin-python.c
index f85c689..c2d4c2c 100644
--- a/plugin-loaders/python/gedit-plugin-python.c
+++ b/plugin-loaders/python/egg-plugins-plugin-python.c
@@ -17,8 +17,8 @@
*
* You should have received a copy of the GNU General Public License
* along with this program; if not, write to the Free Software
- * Foundation, Inc., 59 Temple Place, Suite 330,
- * Boston, MA 02111-1307, USA.
+ * Foundation, Inc., 59 Temple Place, Suite 330,
+ * Boston, MA 02111-1307, USA.
*/
#include <config.h>
@@ -27,27 +27,27 @@
#include <libplugins/gedit-plugin.h>
#include <gedit/gedit-debug.h>
-#include <gedit/gedit-window.h>
+#include <gtk/gtk.h>
#include <pygobject.h>
#include <string.h>
-#define GEDIT_PLUGIN_PYTHON_GET_PRIVATE(object)(G_TYPE_INSTANCE_GET_PRIVATE ((object), GEDIT_TYPE_PLUGIN_PYTHON, GeditPluginPythonPrivate))
+#define EGG_PLUGINS_PLUGIN_PYTHON_GET_PRIVATE(object)(G_TYPE_INSTANCE_GET_PRIVATE ((object), EGG_PLUGINS_TYPE_PLUGIN_PYTHON, EggPluginsPluginPythonPrivate))
static GObjectClass *parent_class;
-struct _GeditPluginPythonPrivate
+struct _EggPluginsPluginPythonPrivate
{
PyObject *instance;
};
-static void gedit_plugin_python_class_init (GeditPluginPythonClass *klass);
-static void gedit_plugin_python_init (GeditPluginPython *plugin);
+static void egg_plugins_plugin_python_class_init (EggPluginsPluginPythonClass *klass);
+static void egg_plugins_plugin_python_init (EggPluginsPluginPython *plugin);
-G_DEFINE_TYPE (GeditPluginPython, gedit_plugin_python, GEDIT_TYPE_PLUGIN)
+G_DEFINE_TYPE (EggPluginsPluginPython, egg_plugins_plugin_python, EGG_PLUGINS_TYPE_PLUGIN)
static PyObject *
-call_python_method (GeditPluginPythonPrivate *priv,
- GeditWindow *window,
+call_python_method (EggPluginsPluginPythonPrivate *priv,
+ GtkWindow *window,
gchar *method)
{
PyObject *py_ret = NULL;
@@ -67,7 +67,7 @@ call_python_method (GeditPluginPythonPrivate *priv,
"(N)",
pygobject_new (G_OBJECT (window)));
}
-
+
if (!py_ret)
PyErr_Print ();
@@ -102,56 +102,56 @@ check_py_object_is_gtk_widget (PyObject *py_obj)
}
static void
-impl_update_ui (GeditPlugin *plugin,
- GeditWindow *window)
+impl_update_ui (EggPluginsPlugin *plugin,
+ GtkWindow *window)
{
PyGILState_STATE state = pyg_gil_state_ensure ();
- GeditPluginPythonPrivate *priv = GEDIT_PLUGIN_PYTHON(plugin)->priv;
-
+ EggPluginsPluginPythonPrivate *priv = EGG_PLUGINS_PLUGIN_PYTHON(plugin)->priv;
+
if (PyObject_HasAttrString (priv->instance, "update_ui"))
- {
+ {
PyObject *py_ret = call_python_method (priv, window, "update_ui");
-
+
if (py_ret)
{
Py_XDECREF (py_ret);
}
}
else
- GEDIT_PLUGIN_CLASS (parent_class)->update_ui (plugin, window);
+ EGG_PLUGINS_PLUGIN_CLASS (parent_class)->update_ui (plugin, window);
pyg_gil_state_release (state);
}
static void
-impl_deactivate (GeditPlugin *plugin,
- GeditWindow *window)
+impl_deactivate (EggPluginsPlugin *plugin,
+ GtkWindow *window)
{
PyGILState_STATE state = pyg_gil_state_ensure ();
- GeditPluginPythonPrivate *priv = GEDIT_PLUGIN_PYTHON(plugin)->priv;
-
+ EggPluginsPluginPythonPrivate *priv = EGG_PLUGINS_PLUGIN_PYTHON(plugin)->priv;
+
if (PyObject_HasAttrString (priv->instance, "deactivate"))
- {
+ {
PyObject *py_ret = call_python_method (priv, window, "deactivate");
-
+
if (py_ret)
{
Py_XDECREF (py_ret);
}
}
else
- GEDIT_PLUGIN_CLASS (parent_class)->deactivate (plugin, window);
+ EGG_PLUGINS_PLUGIN_CLASS (parent_class)->deactivate (plugin, window);
pyg_gil_state_release (state);
}
static void
-impl_activate (GeditPlugin *plugin,
- GeditWindow *window)
+impl_activate (EggPluginsPlugin *plugin,
+ GtkWindow *window)
{
PyGILState_STATE state = pyg_gil_state_ensure ();
- GeditPluginPythonPrivate *priv = GEDIT_PLUGIN_PYTHON(plugin)->priv;
-
+ EggPluginsPluginPythonPrivate *priv = EGG_PLUGINS_PLUGIN_PYTHON(plugin)->priv;
+
if (PyObject_HasAttrString (priv->instance, "activate"))
{
PyObject *py_ret = call_python_method (priv, window, "activate");
@@ -162,22 +162,22 @@ impl_activate (GeditPlugin *plugin,
}
}
else
- GEDIT_PLUGIN_CLASS (parent_class)->activate (plugin, window);
-
+ EGG_PLUGINS_PLUGIN_CLASS (parent_class)->activate (plugin, window);
+
pyg_gil_state_release (state);
}
static GtkWidget *
-impl_create_configure_dialog (GeditPlugin *plugin)
+impl_create_configure_dialog (EggPluginsPlugin *plugin)
{
PyGILState_STATE state = pyg_gil_state_ensure ();
- GeditPluginPythonPrivate *priv = GEDIT_PLUGIN_PYTHON(plugin)->priv;
+ EggPluginsPluginPythonPrivate *priv = EGG_PLUGINS_PLUGIN_PYTHON(plugin)->priv;
GtkWidget *ret = NULL;
-
+
if (PyObject_HasAttrString (priv->instance, "create_configure_dialog"))
{
PyObject *py_ret = call_python_method (priv, NULL, "create_configure_dialog");
-
+
if (py_ret)
{
if (check_py_object_is_gtk_widget (py_ret))
@@ -190,44 +190,44 @@ impl_create_configure_dialog (GeditPlugin *plugin)
PyErr_SetString(PyExc_TypeError, "return value for create_configure_dialog is not a GtkWidget");
PyErr_Print();
}
-
+
Py_DECREF (py_ret);
}
}
else
- ret = GEDIT_PLUGIN_CLASS (parent_class)->create_configure_dialog (plugin);
-
+ ret = EGG_PLUGINS_PLUGIN_CLASS (parent_class)->create_configure_dialog (plugin);
+
pyg_gil_state_release (state);
-
+
return ret;
}
static gboolean
-impl_is_configurable (GeditPlugin *plugin)
+impl_is_configurable (EggPluginsPlugin *plugin)
{
PyGILState_STATE state = pyg_gil_state_ensure ();
- GeditPluginPythonPrivate *priv = GEDIT_PLUGIN_PYTHON(plugin)->priv;
- PyObject *dict = priv->instance->ob_type->tp_dict;
+ EggPluginsPluginPythonPrivate *priv = EGG_PLUGINS_PLUGIN_PYTHON(plugin)->priv;
+ PyObject *dict = priv->instance->ob_type->tp_dict;
gboolean result;
-
+
if (dict == NULL)
result = FALSE;
else if (!PyDict_Check(dict))
result = FALSE;
- else
+ else
result = PyDict_GetItemString(dict, "create_configure_dialog") != NULL;
pyg_gil_state_release (state);
-
+
return result;
}
void
-_gedit_plugin_python_set_instance (GeditPluginPython *plugin,
+_egg_plugins_plugin_python_set_instance (EggPluginsPluginPython *plugin,
PyObject *instance)
{
PyGILState_STATE state = pyg_gil_state_ensure ();
-
+
/* we don't increment the instance here because we are the instance,
when it dies, we also die */
plugin->priv->instance = instance;
@@ -235,43 +235,43 @@ _gedit_plugin_python_set_instance (GeditPluginPython *plugin,
}
PyObject *
-_gedit_plugin_python_get_instance (GeditPluginPython *plugin)
+_egg_plugins_plugin_python_get_instance (EggPluginsPluginPython *plugin)
{
return plugin->priv->instance;
}
static void
-gedit_plugin_python_init (GeditPluginPython *plugin)
+egg_plugins_plugin_python_init (EggPluginsPluginPython *plugin)
{
- plugin->priv = GEDIT_PLUGIN_PYTHON_GET_PRIVATE(plugin);
+ plugin->priv = EGG_PLUGINS_PLUGIN_PYTHON_GET_PRIVATE(plugin);
gedit_debug_message (DEBUG_PLUGINS, "Creating Python plugin instance");
plugin->priv->instance = 0;
}
static void
-gedit_plugin_python_finalize (GObject *object)
+egg_plugins_plugin_python_finalize (GObject *object)
{
PyGILState_STATE state;
-
+
gedit_debug_message (DEBUG_PLUGINS, "Finalizing Python plugin instance");
state = pyg_gil_state_ensure ();
- Py_XDECREF (GEDIT_PLUGIN_PYTHON(object)->priv->instance);
+ Py_XDECREF (EGG_PLUGINS_PLUGIN_PYTHON(object)->priv->instance);
pyg_gil_state_release (state);
-
+
G_OBJECT_CLASS (parent_class)->finalize (object);
}
static void
-gedit_plugin_python_class_init (GeditPluginPythonClass *klass)
+egg_plugins_plugin_python_class_init (EggPluginsPluginPythonClass *klass)
{
- GeditPluginClass *plugin_class = GEDIT_PLUGIN_CLASS (klass);
+ EggPluginsPluginClass *plugin_class = EGG_PLUGINS_PLUGIN_CLASS (klass);
parent_class = g_type_class_peek_parent (klass);
- g_type_class_add_private (klass, sizeof (GeditPluginPythonPrivate));
- G_OBJECT_CLASS (klass)->finalize = gedit_plugin_python_finalize;
+ g_type_class_add_private (klass, sizeof (EggPluginsPluginPythonPrivate));
+ G_OBJECT_CLASS (klass)->finalize = egg_plugins_plugin_python_finalize;
plugin_class->activate = impl_activate;
plugin_class->deactivate = impl_deactivate;
diff --git a/plugin-loaders/python/egg-plugins-plugin-python.h b/plugin-loaders/python/egg-plugins-plugin-python.h
new file mode 100644
index 0000000..8e06837
--- /dev/null
+++ b/plugin-loaders/python/egg-plugins-plugin-python.h
@@ -0,0 +1,88 @@
+/*
+ * gedit-plugin-python.h
+ * This file is part of gedit
+ *
+ * Copyright (C) 2005 - Raphael Slinckx
+ * Copyright (C) 2008 - Jesse van den Kieboom
+ *
+ * This program is free software; you can redistribute it and/or modify
+ * it under the terms of the GNU General Public License as published by
+ * the Free Software Foundation; either version 2 of the License, or
+ * (at your option) any later version.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with this program; if not, write to the Free Software
+ * Foundation, Inc., 59 Temple Place, Suite 330,
+ * Boston, MA 02111-1307, USA.
+ */
+
+#ifndef __EGG_PLUGINS_PLUGIN_PYTHON_H__
+#define __EGG_PLUGINS_PLUGIN_PYTHON_H__
+
+#define NO_IMPORT_PYGOBJECT
+
+#include <glib-object.h>
+#include <pygobject.h>
+
+#include <libplugins/gedit-plugin.h>
+
+G_BEGIN_DECLS
+
+/*
+ * Type checking and casting macros
+ */
+#define EGG_PLUGINS_TYPE_PLUGIN_PYTHON (egg_plugins_plugin_python_get_type())
+#define EGG_PLUGINS_PLUGIN_PYTHON(obj) (G_TYPE_CHECK_INSTANCE_CAST((obj), EGG_PLUGINS_TYPE_PLUGIN_PYTHON, EggPluginsPluginPython))
+#define EGG_PLUGINS_PLUGIN_PYTHON_CLASS(klass) (G_TYPE_CHECK_CLASS_CAST((klass), EGG_PLUGINS_TYPE_PLUGIN_PYTHON, EggPluginsPluginPythonClass))
+#define GEDIT_IS_PLUGIN_PYTHON(obj) (G_TYPE_CHECK_INSTANCE_TYPE((obj), EGG_PLUGINS_TYPE_PLUGIN_PYTHON))
+#define GEDIT_IS_PLUGIN_PYTHON_CLASS(klass) (G_TYPE_CHECK_CLASS_TYPE ((klass), EGG_PLUGINS_TYPE_PLUGIN_PYTHON))
+#define EGG_PLUGINS_PLUGIN_PYTHON_GET_CLASS(obj) (G_TYPE_INSTANCE_GET_CLASS((obj), EGG_PLUGINS_TYPE_PLUGIN_PYTHON, EggPluginsPluginPythonClass))
+
+/* Private structure type */
+typedef struct _EggPluginsPluginPythonPrivate EggPluginsPluginPythonPrivate;
+
+/*
+ * Main object structure
+ */
+typedef struct _EggPluginsPluginPython EggPluginsPluginPython;
+
+struct _EggPluginsPluginPython
+{
+ EggPluginsPlugin parent;
+
+ /*< private > */
+ EggPluginsPluginPythonPrivate *priv;
+};
+
+/*
+ * Class definition
+ */
+typedef struct _EggPluginsPluginPythonClass EggPluginsPluginPythonClass;
+
+struct _EggPluginsPluginPythonClass
+{
+ EggPluginsPluginClass parent_class;
+};
+
+/*
+ * Public methods
+ */
+GType egg_plugins_plugin_python_get_type (void) G_GNUC_CONST;
+
+
+/*
+ * Private methods
+ */
+void _egg_plugins_plugin_python_set_instance (EggPluginsPluginPython *plugin,
+ PyObject *instance);
+PyObject *_egg_plugins_plugin_python_get_instance (EggPluginsPluginPython *plugin);
+
+G_END_DECLS
+
+#endif /* __EGG_PLUGINS_PLUGIN_PYTHON_H__ */
+
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]