[gedit/libgpe: 1/21] Initial port to libgpe.
- From: Steve Frécinaux <sfre src gnome org>
- To: svn-commits-list gnome org
- Cc:
- Subject: [gedit/libgpe: 1/21] Initial port to libgpe.
- Date: Thu, 5 Nov 2009 07:43:56 +0000 (UTC)
commit 95d65d5f192a00fd8956d80c8a7c0347ef727c27
Author: Steve Frécinaux <code istique net>
Date: Sun Nov 1 14:15:32 2009 +0100
Initial port to libgpe.
- plugins and python bindings are not yet updated.
- $HOME plugins and env vars are not supported yet.
Makefile.am | 2 +-
configure.ac | 9 +-
gedit/Makefile.am | 7 -
gedit/dialogs/gedit-preferences-dialog.c | 5 +-
gedit/gedit-plugin-info-priv.h | 68 ---
gedit/gedit-plugin-info.c | 394 -------------
gedit/gedit-plugin-info.h | 63 ---
gedit/gedit-plugin-loader.c | 131 -----
gedit/gedit-plugin-loader.h | 106 ----
gedit/gedit-plugin-manager.c | 889 ------------------------------
gedit/gedit-plugin-manager.h | 83 ---
gedit/gedit-plugin.c | 293 +----------
gedit/gedit-plugin.h | 51 +--
gedit/gedit-plugins-engine.c | 748 +------------------------
gedit/gedit-plugins-engine.h | 50 +--
gedit/gedit-prefs-manager-app.c | 2 +-
gedit/gedit-window.c | 38 +-
gedit/gedit.c | 2 +-
18 files changed, 73 insertions(+), 2868 deletions(-)
---
diff --git a/Makefile.am b/Makefile.am
index 9d771ea..7bf86ee 100644
--- a/Makefile.am
+++ b/Makefile.am
@@ -1,7 +1,7 @@
## Process this file with automake to produce Makefile.in
ACLOCAL_AMFLAGS = -I m4
-SUBDIRS = gedit pixmaps po help data plugin-loaders plugins docs win32
+SUBDIRS = gedit pixmaps po help data plugins docs win32
distuninstallcheck_listfiles = find . -type f -print | grep -v scrollkeeper
diff --git a/configure.ac b/configure.ac
index 42dcbab..3be6d6a 100644
--- a/configure.ac
+++ b/configure.ac
@@ -116,6 +116,9 @@ AC_DEFUN([GEDIT_FULLPATH], [
$3=`eval echo [$]ac_expand`
])
+dnl Have a constant GEDIT_PREFIX available in config.h
+AC_DEFINE_UNQUOTED(GEDIT_PREFIX,"$prefix", [gedit installation prefix])
+
dnl FULL_LIBEXECDIR is used for X-GNOME-Bugzilla-ExtraInfoScript expansion
dnl in data/gedit.desktop.in.in
GEDIT_FULLPATH(libexecdir, NONE, FULL_LIBEXECDIR)
@@ -249,6 +252,8 @@ PKG_CHECK_MODULES(GEDIT, [
gtk+-2.0 >= 2.16.0
gtksourceview-2.0 >= 2.4.0
gconf-2.0 >= 1.1.11
+ libgpe-2.0 >= 2.18.0
+ libgpeui-2.0 >= 2.18.0
])
dnl FIXME: Remove this when removing gedit-message-area
@@ -459,10 +464,6 @@ gedit/smclient/Makefile
gedit/Makefile
help/Makefile
pixmaps/Makefile
-plugin-loaders/Makefile
-plugin-loaders/c/Makefile
-plugin-loaders/python/Makefile
-plugin-loaders/python/bindings/Makefile
plugins/Makefile
plugins/changecase/Makefile
plugins/checkupdate/Makefile
diff --git a/gedit/Makefile.am b/gedit/Makefile.am
index 40f64f1..d187b22 100644
--- a/gedit/Makefile.am
+++ b/gedit/Makefile.am
@@ -55,9 +55,6 @@ endif
NOINST_H_FILES = \
gedit-language-manager.h \
gedit-style-scheme-manager.h \
- gedit-plugin-info.h \
- gedit-plugin-info-priv.h \
- gedit-plugin-manager.h \
gedit-plugins-engine.h \
gedit-object-module.h \
gedit-ui.h \
@@ -94,7 +91,6 @@ INST_H_FILES = \
gedit-notebook.h \
gedit-panel.h \
gedit-plugin.h \
- gedit-plugin-loader.h \
gedit-prefs-manager-app.h \
gedit-prefs-manager.h \
gedit-progress-message-area.h \
@@ -153,10 +149,7 @@ libgedit_la_SOURCES = \
gedit-object-module.c \
gedit-notebook.c \
gedit-panel.c \
- gedit-plugin-info.c \
gedit-plugin.c \
- gedit-plugin-loader.c \
- gedit-plugin-manager.c \
gedit-plugins-engine.c \
gedit-prefs-manager-app.c \
gedit-prefs-manager.c \
diff --git a/gedit/dialogs/gedit-preferences-dialog.c b/gedit/dialogs/gedit-preferences-dialog.c
index 252ed38..a6c7bb9 100644
--- a/gedit/dialogs/gedit-preferences-dialog.c
+++ b/gedit/dialogs/gedit-preferences-dialog.c
@@ -38,6 +38,7 @@
#include <glib/gi18n.h>
#include <gconf/gconf-client.h>
+#include <libgpeui/gpe-plugin-manager.h>
#include <gedit/gedit-prefs-manager.h>
@@ -45,8 +46,8 @@
#include "gedit-utils.h"
#include "gedit-debug.h"
#include "gedit-document.h"
+#include "gedit-plugins-engine.h"
#include "gedit-style-scheme-manager.h"
-#include "gedit-plugin-manager.h"
#include "gedit-help.h"
#include "gedit-dirs.h"
@@ -1046,7 +1047,7 @@ setup_plugins_page (GeditPreferencesDialog *dlg)
gedit_debug (DEBUG_PREFS);
- page_content = gedit_plugin_manager_new ();
+ page_content = gpe_plugin_manager_new (GPE_ENGINE (gedit_plugins_engine_get_default ()));
g_return_if_fail (page_content != NULL);
gtk_box_pack_start (GTK_BOX (dlg->priv->plugin_manager_place_holder),
diff --git a/gedit/gedit-plugin.c b/gedit/gedit-plugin.c
index 2b00e3f..f7f6be8 100644
--- a/gedit/gedit-plugin.c
+++ b/gedit/gedit-plugin.c
@@ -1,8 +1,9 @@
/*
- * gedit-plugin.h
+ * gedit-plugin.c
* This file is part of gedit
*
* Copyright (C) 2002-2005 Paolo Maggi
+ * Copyright (C) 2009 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
@@ -24,8 +25,6 @@
* 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$
*/
#ifdef HAVE_CONFIG_H
@@ -35,139 +34,12 @@
#include "gedit-plugin.h"
#include "gedit-dirs.h"
-/* properties */
-enum {
- PROP_0,
- PROP_INSTALL_DIR,
- PROP_DATA_DIR_NAME,
- PROP_DATA_DIR
-};
-
-typedef struct _GeditPluginPrivate GeditPluginPrivate;
-
-struct _GeditPluginPrivate
-{
- gchar *install_dir;
- gchar *data_dir_name;
-};
-
-#define GEDIT_PLUGIN_GET_PRIVATE(object)(G_TYPE_INSTANCE_GET_PRIVATE ((object), GEDIT_TYPE_PLUGIN, GeditPluginPrivate))
-
-G_DEFINE_TYPE(GeditPlugin, gedit_plugin, G_TYPE_OBJECT)
-
-static void
-dummy (GeditPlugin *plugin, GeditWindow *window)
-{
- /* Empty */
-}
-
-static GtkWidget *
-create_configure_dialog (GeditPlugin *plugin)
-{
- return NULL;
-}
-
-static gboolean
-is_configurable (GeditPlugin *plugin)
-{
- return (GEDIT_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)
-{
- switch (prop_id)
- {
- case PROP_INSTALL_DIR:
- g_value_take_string (value, gedit_plugin_get_install_dir (GEDIT_PLUGIN (object)));
- break;
- case PROP_DATA_DIR:
- g_value_take_string (value, gedit_plugin_get_data_dir (GEDIT_PLUGIN (object)));
- break;
- default:
- g_return_if_reached ();
- }
-}
-
-static void
-gedit_plugin_set_property (GObject *object,
- guint prop_id,
- const GValue *value,
- GParamSpec *pspec)
-{
- GeditPluginPrivate *priv = GEDIT_PLUGIN_GET_PRIVATE (object);
-
- switch (prop_id)
- {
- case PROP_INSTALL_DIR:
- priv->install_dir = g_value_dup_string (value);
- break;
- case PROP_DATA_DIR_NAME:
- priv->data_dir_name = g_value_dup_string (value);
- break;
- default:
- g_return_if_reached ();
- }
-}
-
-static void
-gedit_plugin_finalize (GObject *object)
-{
- GeditPluginPrivate *priv = GEDIT_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_DEFINE_TYPE(GeditPlugin, gedit_plugin, GPE_TYPE_PLUGIN)
static void
gedit_plugin_class_init (GeditPluginClass *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;
-
- g_object_class_install_property (object_class,
- PROP_INSTALL_DIR,
- g_param_spec_string ("install-dir",
- "Install Directory",
- "The directory where the plugin is installed",
- NULL,
- G_PARAM_READWRITE | G_PARAM_CONSTRUCT_ONLY));
-
- /* the basename of the data dir is set at construction time by the plugin loader
- * while the full path is constructed on the fly to take into account relocability
- * that's why we have a writeonly prop and a readonly prop */
- g_object_class_install_property (object_class,
- PROP_DATA_DIR_NAME,
- g_param_spec_string ("data-dir-name",
- "Basename of the data directory",
- "The basename of the directory where the plugin should look for its data files",
- NULL,
- G_PARAM_WRITABLE | G_PARAM_CONSTRUCT_ONLY));
- g_object_class_install_property (object_class,
- PROP_DATA_DIR,
- g_param_spec_string ("data-dir",
- "Data Directory",
- "The full path of the directory where the plugin should look for its data files",
- NULL,
- G_PARAM_READABLE));
-
- g_type_class_add_private (klass, sizeof (GeditPluginPrivate));
+ /* Empty */
}
static void
@@ -175,160 +47,3 @@ gedit_plugin_init (GeditPlugin *plugin)
{
/* Empty */
}
-
-/**
- * gedit_plugin_get_install_dir:
- * @plugin: a #GeditPlugin
- *
- * Get the path of the directory where the plugin is installed.
- *
- * Return value: a newly allocated string with the path of the
- * directory where the plugin is installed
- */
-gchar *
-gedit_plugin_get_install_dir (GeditPlugin *plugin)
-{
- g_return_val_if_fail (GEDIT_IS_PLUGIN (plugin), NULL);
-
- return g_strdup (GEDIT_PLUGIN_GET_PRIVATE (plugin)->install_dir);
-}
-
-/**
- * gedit_plugin_get_data_dir:
- * @plugin: a #GeditPlugin
- *
- * Get the path of the directory where the plugin should look for
- * its data files.
- *
- * Return value: a newly allocated string with the path of the
- * directory where the plugin should look for its data files
- */
-gchar *
-gedit_plugin_get_data_dir (GeditPlugin *plugin)
-{
- GeditPluginPrivate *priv;
- gchar *gedit_lib_dir;
- gchar *data_dir;
-
- g_return_val_if_fail (GEDIT_IS_PLUGIN (plugin), NULL);
-
- priv = GEDIT_PLUGIN_GET_PRIVATE (plugin);
-
- /* If it's a "user" plugin the data dir is
- * install_dir/data_dir_name if instead it's a
- * "system" plugin the data dir is under gedit_data_dir,
- * so it's under $prefix/share/gedit-2/plugins/data_dir_name
- * where data_dir_name usually it's the name of the plugin
- */
- gedit_lib_dir = gedit_dirs_get_gedit_lib_dir ();
-
- /* CHECK: is checking the prefix enough or should we be more
- * careful about normalizing paths etc? */
- if (g_str_has_prefix (priv->install_dir, gedit_lib_dir))
- {
- gchar *gedit_data_dir;
-
- gedit_data_dir = gedit_dirs_get_gedit_data_dir ();
-
- data_dir = g_build_filename (gedit_data_dir,
- "plugins",
- priv->data_dir_name,
- NULL);
-
- g_free (gedit_data_dir);
- }
- else
- {
- data_dir = g_build_filename (priv->install_dir,
- priv->data_dir_name,
- NULL);
- }
-
- g_free (gedit_lib_dir);
-
- return data_dir;
-}
-
-/**
- * gedit_plugin_activate:
- * @plugin: a #GeditPlugin
- * @window: a #GeditWindow
- *
- * Activates the plugin.
- */
-void
-gedit_plugin_activate (GeditPlugin *plugin,
- GeditWindow *window)
-{
- g_return_if_fail (GEDIT_IS_PLUGIN (plugin));
- g_return_if_fail (GEDIT_IS_WINDOW (window));
-
- GEDIT_PLUGIN_GET_CLASS (plugin)->activate (plugin, window);
-}
-
-/**
- * gedit_plugin_deactivate:
- * @plugin: a #GeditPlugin
- * @window: a #GeditWindow
- *
- * Deactivates the plugin.
- */
-void
-gedit_plugin_deactivate (GeditPlugin *plugin,
- GeditWindow *window)
-{
- g_return_if_fail (GEDIT_IS_PLUGIN (plugin));
- g_return_if_fail (GEDIT_IS_WINDOW (window));
-
- GEDIT_PLUGIN_GET_CLASS (plugin)->deactivate (plugin, window);
-}
-
-/**
- * gedit_plugin_update_ui:
- * @plugin: a #GeditPlugin
- * @window: a #GeditWindow
- *
- * Triggers an update of the user interface to take into account state changes
- * caused by the plugin.
- */
-void
-gedit_plugin_update_ui (GeditPlugin *plugin,
- GeditWindow *window)
-{
- g_return_if_fail (GEDIT_IS_PLUGIN (plugin));
- g_return_if_fail (GEDIT_IS_WINDOW (window));
-
- GEDIT_PLUGIN_GET_CLASS (plugin)->update_ui (plugin, window);
-}
-
-/**
- * gedit_plugin_is_configurable:
- * @plugin: a #GeditPlugin
- *
- * Whether the plugin is configurable.
- *
- * Returns: TRUE if the plugin is configurable:
- */
-gboolean
-gedit_plugin_is_configurable (GeditPlugin *plugin)
-{
- g_return_val_if_fail (GEDIT_IS_PLUGIN (plugin), FALSE);
-
- return GEDIT_PLUGIN_GET_CLASS (plugin)->is_configurable (plugin);
-}
-
-/**
- * gedit_plugin_create_configure_dialog:
- * @plugin: a #GeditPlugin
- *
- * Creates the configure dialog widget for the plugin.
- *
- * Returns: the configure dialog widget for the plugin.
- */
-GtkWidget *
-gedit_plugin_create_configure_dialog (GeditPlugin *plugin)
-{
- g_return_val_if_fail (GEDIT_IS_PLUGIN (plugin), NULL);
-
- return GEDIT_PLUGIN_GET_CLASS (plugin)->create_configure_dialog (plugin);
-}
diff --git a/gedit/gedit-plugin.h b/gedit/gedit-plugin.h
index 8cf41d8..2176252 100644
--- a/gedit/gedit-plugin.h
+++ b/gedit/gedit-plugin.h
@@ -3,6 +3,7 @@
* This file is part of gedit
*
* Copyright (C) 2002-2005 - Paolo Maggi
+ * Copyright (C) 2009 - 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
@@ -32,12 +33,7 @@
#define __GEDIT_PLUGIN_H__
#include <glib-object.h>
-
-#include <gedit/gedit-window.h>
-#include <gedit/gedit-debug.h>
-
-/* TODO: add a .h file that includes all the .h files normally needed to
- * develop a plugin */
+#include <libgpe/gpe-plugin.h>
G_BEGIN_DECLS
@@ -58,7 +54,7 @@ typedef struct _GeditPlugin GeditPlugin;
struct _GeditPlugin
{
- GObject parent;
+ GPEPlugin parent;
};
/*
@@ -68,31 +64,7 @@ typedef struct _GeditPluginClass GeditPluginClass;
struct _GeditPluginClass
{
- GObjectClass parent_class;
-
- /* Virtual public methods */
-
- void (*activate) (GeditPlugin *plugin,
- GeditWindow *window);
- void (*deactivate) (GeditPlugin *plugin,
- GeditWindow *window);
-
- void (*update_ui) (GeditPlugin *plugin,
- GeditWindow *window);
-
- GtkWidget *(*create_configure_dialog)
- (GeditPlugin *plugin);
-
- /* Plugins should not override this, it's handled automatically by
- the GeditPluginClass */
- gboolean (*is_configurable)
- (GeditPlugin *plugin);
-
- /* Padding for future expansion */
- void (*_gedit_reserved1) (void);
- void (*_gedit_reserved2) (void);
- void (*_gedit_reserved3) (void);
- void (*_gedit_reserved4) (void);
+ GPEPluginClass parent_class;
};
/*
@@ -100,21 +72,6 @@ struct _GeditPluginClass
*/
GType gedit_plugin_get_type (void) G_GNUC_CONST;
-gchar *gedit_plugin_get_install_dir (GeditPlugin *plugin);
-gchar *gedit_plugin_get_data_dir (GeditPlugin *plugin);
-
-void gedit_plugin_activate (GeditPlugin *plugin,
- GeditWindow *window);
-void gedit_plugin_deactivate (GeditPlugin *plugin,
- GeditWindow *window);
-
-void gedit_plugin_update_ui (GeditPlugin *plugin,
- GeditWindow *window);
-
-gboolean gedit_plugin_is_configurable (GeditPlugin *plugin);
-GtkWidget *gedit_plugin_create_configure_dialog
- (GeditPlugin *plugin);
-
/**
* GEDIT_PLUGIN_REGISTER_TYPE_WITH_CODE(PluginName, plugin_name, CODE):
*
diff --git a/gedit/gedit-plugins-engine.c b/gedit/gedit-plugins-engine.c
index 3f020d3..fcf55d0 100644
--- a/gedit/gedit-plugins-engine.c
+++ b/gedit/gedit-plugins-engine.c
@@ -3,6 +3,7 @@
* This file is part of gedit
*
* Copyright (C) 2002-2005 Paolo Maggi
+ * Copyright (C) 2009 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
@@ -37,495 +38,78 @@
#include <glib/gi18n.h>
#include "gedit-plugins-engine.h"
-#include "gedit-plugin-info-priv.h"
-#include "gedit-plugin.h"
#include "gedit-debug.h"
#include "gedit-app.h"
#include "gedit-prefs-manager.h"
-#include "gedit-plugin-loader.h"
-#include "gedit-object-module.h"
#include "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 PLUGIN_EXT ".gedit-plugin"
-#define LOADER_EXT G_MODULE_SUFFIX
-
-typedef struct
-{
- GeditPluginLoader *loader;
- GeditObjectModule *module;
-} LoaderInfo;
-
-/* Signals */
-enum
-{
- ACTIVATE_PLUGIN,
- DEACTIVATE_PLUGIN,
- LAST_SIGNAL
-};
-
-static guint signals[LAST_SIGNAL];
-
-G_DEFINE_TYPE(GeditPluginsEngine, gedit_plugins_engine, G_TYPE_OBJECT)
+G_DEFINE_TYPE(GeditPluginsEngine, gedit_plugins_engine, GPE_TYPE_ENGINE)
struct _GeditPluginsEnginePrivate
{
- GList *plugin_list;
- GHashTable *loaders;
-
gboolean activate_from_prefs;
};
-GeditPluginsEngine *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);
-
-typedef gboolean (*LoadDirCallback)(GeditPluginsEngine *engine, const gchar *filename, gpointer userdata);
-
-static gboolean
-load_dir_real (GeditPluginsEngine *engine,
- const gchar *dir,
- const gchar *suffix,
- LoadDirCallback callback,
- gpointer userdata)
-{
- GError *error = NULL;
- GDir *d;
- const gchar *dirent;
- gboolean ret = TRUE;
-
- g_return_val_if_fail (dir != NULL, TRUE);
-
- gedit_debug_message (DEBUG_PLUGINS, "DIR: %s", dir);
-
- d = g_dir_open (dir, 0, &error);
- if (!d)
- {
- g_warning ("%s", error->message);
- g_error_free (error);
- return TRUE;
- }
-
- while ((dirent = g_dir_read_name (d)))
- {
- gchar *filename;
-
- if (!g_str_has_suffix (dirent, suffix))
- continue;
-
- filename = g_build_filename (dir, dirent, NULL);
-
- ret = callback (engine, filename, userdata);
-
- g_free (filename);
-
- if (!ret)
- break;
- }
-
- g_dir_close (d);
- return ret;
-}
-
-static gboolean
-load_plugin_info (GeditPluginsEngine *engine,
- const gchar *filename,
- gpointer userdata)
-{
- GeditPluginInfo *info;
-
- info = _gedit_plugin_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)
- {
- gedit_debug_message (DEBUG_PLUGINS, "Two or more plugins named '%s'. "
- "Only the first will be considered.\n",
- gedit_plugin_info_get_module_name (info));
-
- _gedit_plugin_info_unref (info);
-
- return TRUE;
- }
-
- engine->priv->plugin_list = g_list_prepend (engine->priv->plugin_list, info);
-
- gedit_debug_message (DEBUG_PLUGINS, "Plugin %s loaded", info->name);
- return TRUE;
-}
-
-static void
-load_all_plugins (GeditPluginsEngine *engine)
-{
- gchar *plugin_dir;
- const gchar *pdirs_env = NULL;
-
- /* load user plugins */
- plugin_dir = gedit_dirs_get_user_plugins_dir ();
- if (g_file_test (plugin_dir, G_FILE_TEST_IS_DIR))
- {
- load_dir_real (engine,
- plugin_dir,
- PLUGIN_EXT,
- load_plugin_info,
- NULL);
-
- }
- g_free (plugin_dir);
-
- /* load system plugins */
- pdirs_env = g_getenv ("GEDIT_PLUGINS_PATH");
-
- gedit_debug_message (DEBUG_PLUGINS, "GEDIT_PLUGINS_PATH=%s", pdirs_env);
-
- if (pdirs_env != NULL)
- {
- gchar **pdirs;
- gint i;
-
- pdirs = g_strsplit (pdirs_env, G_SEARCHPATH_SEPARATOR_S, 0);
-
- for (i = 0; pdirs[i] != NULL; i++)
- {
- if (!load_dir_real (engine,
- pdirs[i],
- PLUGIN_EXT,
- load_plugin_info,
- NULL))
- {
- break;
- }
- }
-
- g_strfreev (pdirs);
- }
- else
- {
- plugin_dir = gedit_dirs_get_gedit_plugins_dir ();
-
- load_dir_real (engine,
- plugin_dir,
- PLUGIN_EXT,
- load_plugin_info,
- NULL);
-
- g_free (plugin_dir);
- }
-}
-
-static guint
-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;
-}
-
-static gboolean
-equal_lowercase (gconstpointer a, gconstpointer b)
-{
- return g_ascii_strcasecmp ((const gchar *)a, (const gchar *)b) == 0;
-}
-
-static void
-loader_destroy (LoaderInfo *info)
-{
- if (!info)
- return;
-
- if (info->loader)
- g_object_unref (info->loader);
-
- g_free (info);
-}
-
-static void
-add_loader (GeditPluginsEngine *engine,
- const gchar *loader_id,
- GeditObjectModule *module)
-{
- LoaderInfo *info;
-
- info = g_new (LoaderInfo, 1);
- info->loader = NULL;
- info->module = module;
-
- g_hash_table_insert (engine->priv->loaders, g_strdup (loader_id), info);
-}
+GPEEngine *default_engine = NULL;
static void
gedit_plugins_engine_init (GeditPluginsEngine *engine)
{
gedit_debug (DEBUG_PLUGINS);
- if (!g_module_supported ())
- {
- g_warning ("gedit is not able to initialize the plugins engine.");
- return;
- }
-
engine->priv = G_TYPE_INSTANCE_GET_PRIVATE (engine,
GEDIT_TYPE_PLUGINS_ENGINE,
GeditPluginsEnginePrivate);
- load_all_plugins (engine);
-
/* make sure that the first reactivation will read active plugins
from the prefs */
engine->priv->activate_from_prefs = TRUE;
-
- /* mapping from loadername -> loader object */
- engine->priv->loaders = g_hash_table_new_full (hash_lowercase,
- equal_lowercase,
- (GDestroyNotify)g_free,
- (GDestroyNotify)loader_destroy);
-}
-
-static void
-loader_garbage_collect (const char *id, LoaderInfo *info)
-{
- if (info->loader)
- gedit_plugin_loader_garbage_collect (info->loader);
-}
-
-void
-gedit_plugins_engine_garbage_collect (GeditPluginsEngine *engine)
-{
- g_hash_table_foreach (engine->priv->loaders,
- (GHFunc) loader_garbage_collect,
- NULL);
}
static void
gedit_plugins_engine_finalize (GObject *object)
{
- GeditPluginsEngine *engine = GEDIT_PLUGINS_ENGINE (object);
- GList *item;
-
gedit_debug (DEBUG_PLUGINS);
- /* 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);
- }
-
- /* 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);
-
- _gedit_plugin_info_unref (info);
- }
-
- g_list_free (engine->priv->plugin_list);
-
G_OBJECT_CLASS (gedit_plugins_engine_parent_class)->finalize (object);
}
static void
gedit_plugins_engine_class_init (GeditPluginsEngineClass *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;
-
- signals[ACTIVATE_PLUGIN] =
- g_signal_new ("activate-plugin",
- the_type,
- G_SIGNAL_RUN_LAST,
- G_STRUCT_OFFSET (GeditPluginsEngineClass, activate_plugin),
- NULL, NULL,
- g_cclosure_marshal_VOID__BOXED,
- G_TYPE_NONE,
- 1,
- GEDIT_TYPE_PLUGIN_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),
- NULL, NULL,
- g_cclosure_marshal_VOID__BOXED,
- G_TYPE_NONE,
- 1,
- GEDIT_TYPE_PLUGIN_INFO | G_SIGNAL_TYPE_STATIC_SCOPE);
g_type_class_add_private (klass, sizeof (GeditPluginsEnginePrivate));
}
-static gboolean
-load_loader (GeditPluginsEngine *engine,
- const gchar *filename,
- gpointer data)
-{
- GeditObjectModule *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,
- path,
- "register_gedit_plugin_loader",
- TRUE);
-
- g_free (base);
- g_free (path);
-
- /* make sure to load the type definition */
- if (!g_type_module_use (G_TYPE_MODULE (module)))
- {
- g_object_unref (module);
- g_warning ("Plugin loader module `%s' could not be loaded", filename);
-
- return TRUE;
- }
-
- /* 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);
- g_type_module_unuse (G_TYPE_MODULE (module));
-
- return TRUE;
-}
-
-static void
-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))
- {
- g_warning ("Loader object is not a valid GeditPluginLoader instance");
-
- if (loader != NULL && G_IS_OBJECT (loader))
- g_object_unref (loader);
- }
- else
- {
- info->loader = loader;
- }
- }
-}
-
-static GeditPluginLoader *
-get_plugin_loader (GeditPluginsEngine *engine, GeditPluginInfo *info)
-{
- const gchar *loader_id;
- LoaderInfo *loader_info;
-
- loader_id = info->loader;
-
- loader_info = (LoaderInfo *)g_hash_table_lookup (
- engine->priv->loaders,
- loader_id);
-
- if (loader_info == NULL)
- {
- gchar *loader_dir;
-
- loader_dir = gedit_dirs_get_gedit_plugin_loaders_dir ();
-
- /* loader could not be found in the hash, try to find it by
- scanning */
- 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,
- loader_id);
- }
-
- if (loader_info == NULL)
- {
- /* cache non-existent so we don't scan again */
- add_loader (engine, loader_id, NULL);
- return NULL;
- }
-
- ensure_loader (loader_info);
- return loader_info->loader;
-}
-
-GeditPluginsEngine *
+GPEEngine *
gedit_plugins_engine_get_default (void)
{
+ static const GPEPathInfo paths[] = {
+ { "./plugins/", "./plugins/" },
+ { GEDIT_PREFIX "/lib/gedit-2/plugins/",
+ GEDIT_PREFIX "/share/gedit-2/plugins/" },
+ { NULL },
+ };
+
if (default_engine != NULL)
return default_engine;
- default_engine = GEDIT_PLUGINS_ENGINE (g_object_new (GEDIT_TYPE_PLUGINS_ENGINE, NULL));
+ default_engine = GPE_ENGINE (g_object_new (GEDIT_TYPE_PLUGINS_ENGINE,
+ "app-name", "Gedit",
+ "path-infos", paths,
+ 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)
-{
- gedit_debug (DEBUG_PLUGINS);
-
- return engine->priv->plugin_list;
-}
-
-static gint
-compare_plugin_info_and_name (GeditPluginInfo *info,
- const gchar *module_name)
-{
- return strcmp (gedit_plugin_info_get_module_name (info), module_name);
-}
-
-GeditPluginInfo *
-gedit_plugins_engine_get_plugin_info (GeditPluginsEngine *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;
-}
-
+#if 0
static void
save_active_plugin_list (GeditPluginsEngine *engine)
{
@@ -548,314 +132,38 @@ save_active_plugin_list (GeditPluginsEngine *engine)
g_slist_free (active_plugins);
}
-static gboolean
-load_plugin (GeditPluginsEngine *engine,
- GeditPluginInfo *info)
-{
- GeditPluginLoader *loader;
- gchar *path;
-
- if (gedit_plugin_info_is_active (info))
- return TRUE;
-
- if (!gedit_plugin_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);
-
- 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)
-{
- const GList *wins;
-
- if (!load_plugin (engine, info))
- return;
-
- for (wins = gedit_app_get_windows (gedit_app_get_default ());
- wins != NULL;
- wins = wins->next)
- {
- gedit_plugin_activate (info->plugin, GEDIT_WINDOW (wins->data));
- }
-}
-
-gboolean
-gedit_plugins_engine_activate_plugin (GeditPluginsEngine *engine,
- GeditPluginInfo *info)
-{
- gedit_debug (DEBUG_PLUGINS);
-
- g_return_val_if_fail (info != NULL, FALSE);
-
- if (!gedit_plugin_info_is_available (info))
- return FALSE;
-
- if (gedit_plugin_info_is_active (info))
- return TRUE;
-
- g_signal_emit (engine, signals[ACTIVATE_PLUGIN], 0, info);
-
- if (gedit_plugin_info_is_active (info))
- save_active_plugin_list (engine);
-
- return gedit_plugin_info_is_active (info);
-}
-
static void
call_plugin_deactivate (GeditPlugin *plugin,
GeditWindow *window)
{
- gedit_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
strings don't exist anymore, and ui manager updates in an idle
func) */
gtk_ui_manager_ensure_update (gedit_window_get_ui_manager (window));
}
-
-static void
-gedit_plugins_engine_deactivate_plugin_real (GeditPluginsEngine *engine,
- GeditPluginInfo *info)
-{
- const GList *wins;
- GeditPluginLoader *loader;
-
- if (!gedit_plugin_info_is_active (info) ||
- !gedit_plugin_info_is_available (info))
- return;
-
- for (wins = gedit_app_get_windows (gedit_app_get_default ());
- wins != NULL;
- wins = wins->next)
- {
- call_plugin_deactivate (info->plugin, GEDIT_WINDOW (wins->data));
- }
-
- /* 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);
-
- info->plugin = NULL;
-}
-
-gboolean
-gedit_plugins_engine_deactivate_plugin (GeditPluginsEngine *engine,
- GeditPluginInfo *info)
-{
- gedit_debug (DEBUG_PLUGINS);
-
- g_return_val_if_fail (info != NULL, FALSE);
-
- if (!gedit_plugin_info_is_active (info))
- return TRUE;
-
- g_signal_emit (engine, signals[DEACTIVATE_PLUGIN], 0, info);
- if (!gedit_plugin_info_is_active (info))
- save_active_plugin_list (engine);
-
- return !gedit_plugin_info_is_active (info);
-}
-
-void
-gedit_plugins_engine_activate_plugins (GeditPluginsEngine *engine,
- GeditWindow *window)
-{
- GSList *active_plugins = NULL;
- GList *pl;
-
- gedit_debug (DEBUG_PLUGINS);
-
- g_return_if_fail (GEDIT_IS_PLUGINS_ENGINE (engine));
- g_return_if_fail (GEDIT_IS_WINDOW (window));
-
- /* the first time, we get the 'active' plugins from gconf */
- if (engine->priv->activate_from_prefs)
- {
- active_plugins = gedit_prefs_manager_get_active_plugins ();
- }
-
- for (pl = engine->priv->plugin_list; pl; pl = pl->next)
- {
- GeditPluginInfo *info = (GeditPluginInfo*)pl->data;
-
- if (engine->priv->activate_from_prefs &&
- g_slist_find_custom (active_plugins,
- gedit_plugin_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))
- continue;
-
- if (load_plugin (engine, info))
- gedit_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;
- }
-
- gedit_debug_message (DEBUG_PLUGINS, "End");
-
- /* also call update_ui after activation */
- gedit_plugins_engine_update_plugins_ui (engine, window);
-}
-
-void
-gedit_plugins_engine_deactivate_plugins (GeditPluginsEngine *engine,
- GeditWindow *window)
-{
- GList *pl;
-
- gedit_debug (DEBUG_PLUGINS);
-
- g_return_if_fail (GEDIT_IS_PLUGINS_ENGINE (engine));
- g_return_if_fail (GEDIT_IS_WINDOW (window));
-
- for (pl = engine->priv->plugin_list; pl; pl = pl->next)
- {
- GeditPluginInfo *info = (GeditPluginInfo*)pl->data;
-
- /* check if the plugin is actually active */
- if (!gedit_plugin_info_is_active (info))
- continue;
-
- /* call deactivate for the plugin for this window */
- gedit_plugin_deactivate (info->plugin, window);
- }
-
- gedit_debug_message (DEBUG_PLUGINS, "End");
-}
-
-void
-gedit_plugins_engine_update_plugins_ui (GeditPluginsEngine *engine,
- GeditWindow *window)
-{
- GList *pl;
-
- gedit_debug (DEBUG_PLUGINS);
-
- g_return_if_fail (GEDIT_IS_PLUGINS_ENGINE (engine));
- g_return_if_fail (GEDIT_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;
-
- if (!gedit_plugin_info_is_active (info))
- continue;
-
- gedit_debug_message (DEBUG_PLUGINS, "Updating UI of %s", info->name);
- gedit_plugin_update_ui (info->plugin, window);
- }
-}
-
-void
-gedit_plugins_engine_configure_plugin (GeditPluginsEngine *engine,
- GeditPluginInfo *info,
- GtkWindow *parent)
-{
- GtkWidget *conf_dlg;
-
- GtkWindowGroup *wg;
-
- gedit_debug (DEBUG_PLUGINS);
-
- g_return_if_fail (info != NULL);
-
- conf_dlg = gedit_plugin_create_configure_dialog (info->plugin);
- g_return_if_fail (conf_dlg != NULL);
- gtk_window_set_transient_for (GTK_WINDOW (conf_dlg),
- parent);
-
- wg = gtk_window_get_group (parent);
- if (wg == NULL)
- {
- 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_widget_show (conf_dlg);
-}
+#endif
void
gedit_plugins_engine_active_plugins_changed (GeditPluginsEngine *engine)
{
- gboolean to_activate;
- GSList *active_plugins;
- GList *pl;
-
+ GSList *active_plugins, *p;
+ const gchar **strv, **s;
+
gedit_debug (DEBUG_PLUGINS);
active_plugins = gedit_prefs_manager_get_active_plugins ();
- for (pl = engine->priv->plugin_list; pl; pl = pl->next)
- {
- GeditPluginInfo *info = (GeditPluginInfo*)pl->data;
+ /* Let's create a null-ended array of strings to pass the active plugin
+ to the plugins engine... */
+ strv = g_new (const gchar *, g_slist_length (active_plugins) + 1);
+ for (p = active_plugins, s = strv; p != NULL; p = p->next, s++)
+ *s = (const gchar *) p->data;
+ *s = NULL;
- if (!gedit_plugin_info_is_available (info))
- continue;
-
- to_activate = (g_slist_find_custom (active_plugins,
- gedit_plugin_info_get_module_name (info),
- (GCompareFunc)strcmp) != NULL);
-
- if (!gedit_plugin_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)
- g_signal_emit (engine, signals[DEACTIVATE_PLUGIN], 0, info);
- }
+ gpe_engine_set_active_plugins (GPE_ENGINE (engine), strv);
+ g_free (strv);
g_slist_foreach (active_plugins, (GFunc) g_free, NULL);
g_slist_free (active_plugins);
}
-
-void
-gedit_plugins_engine_rescan_plugins (GeditPluginsEngine *engine)
-{
- gedit_debug (DEBUG_PLUGINS);
-
- load_all_plugins (engine);
-}
diff --git a/gedit/gedit-plugins-engine.h b/gedit/gedit-plugins-engine.h
index 975c1e9..5733331 100644
--- a/gedit/gedit-plugins-engine.h
+++ b/gedit/gedit-plugins-engine.h
@@ -3,6 +3,7 @@
* This file is part of gedit
*
* Copyright (C) 2002-2005 - Paolo Maggi
+ * Copyright (C) 2009 - 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
@@ -32,9 +33,7 @@
#define __GEDIT_PLUGINS_ENGINE_H__
#include <glib.h>
-#include "gedit-window.h"
-#include "gedit-plugin-info.h"
-#include "gedit-plugin.h"
+#include <libgpe/gpe-engine.h>
G_BEGIN_DECLS
@@ -50,7 +49,7 @@ typedef struct _GeditPluginsEnginePrivate GeditPluginsEnginePrivate;
struct _GeditPluginsEngine
{
- GObject parent;
+ GPEEngine parent;
GeditPluginsEnginePrivate *priv;
};
@@ -58,49 +57,14 @@ typedef struct _GeditPluginsEngineClass GeditPluginsEngineClass;
struct _GeditPluginsEngineClass
{
- GObjectClass parent_class;
-
- void (* activate_plugin) (GeditPluginsEngine *engine,
- GeditPluginInfo *info);
-
- void (* deactivate_plugin) (GeditPluginsEngine *engine,
- GeditPluginInfo *info);
+ GPEEngineClass parent_class;
};
-GType gedit_plugins_engine_get_type (void) G_GNUC_CONST;
-
-GeditPluginsEngine *gedit_plugins_engine_get_default (void);
-
-void gedit_plugins_engine_garbage_collect (GeditPluginsEngine *engine);
-
-const GList *gedit_plugins_engine_get_plugin_list (GeditPluginsEngine *engine);
-
-GeditPluginInfo *gedit_plugins_engine_get_plugin_info (GeditPluginsEngine *engine,
- const gchar *name);
-
-/* plugin load and unloading (overall, for all windows) */
-gboolean gedit_plugins_engine_activate_plugin (GeditPluginsEngine *engine,
- GeditPluginInfo *info);
-gboolean gedit_plugins_engine_deactivate_plugin (GeditPluginsEngine *engine,
- GeditPluginInfo *info);
-
-void gedit_plugins_engine_configure_plugin (GeditPluginsEngine *engine,
- GeditPluginInfo *info,
- GtkWindow *parent);
-
-/* plugin activation/deactivation per window, private to GeditWindow */
-void gedit_plugins_engine_activate_plugins (GeditPluginsEngine *engine,
- GeditWindow *window);
-void gedit_plugins_engine_deactivate_plugins (GeditPluginsEngine *engine,
- GeditWindow *window);
-void gedit_plugins_engine_update_plugins_ui (GeditPluginsEngine *engine,
- GeditWindow *window);
+GType gedit_plugins_engine_get_type (void) G_GNUC_CONST;
+GPEEngine *gedit_plugins_engine_get_default (void);
/* private for gconf notification */
-void gedit_plugins_engine_active_plugins_changed
- (GeditPluginsEngine *engine);
-
-void gedit_plugins_engine_rescan_plugins (GeditPluginsEngine *engine);
+void gedit_plugins_engine_active_plugins_changed (GeditPluginsEngine *engine);
G_END_DECLS
diff --git a/gedit/gedit-prefs-manager-app.c b/gedit/gedit-prefs-manager-app.c
index 802cd8a..6de579f 100644
--- a/gedit/gedit-prefs-manager-app.c
+++ b/gedit/gedit-prefs-manager-app.c
@@ -1570,7 +1570,7 @@ gedit_prefs_manager_active_plugins_changed (GConfClient *client,
{
GeditPluginsEngine *engine;
- engine = gedit_plugins_engine_get_default ();
+ engine = GEDIT_PLUGINS_ENGINE (gedit_plugins_engine_get_default ());
gedit_plugins_engine_active_plugins_changed (engine);
}
diff --git a/gedit/gedit-window.c b/gedit/gedit-window.c
index 680393c..c0401eb 100644
--- a/gedit/gedit-window.c
+++ b/gedit/gedit-window.c
@@ -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 ());
+ gpe_engine_garbage_collect (gedit_plugins_engine_get_default ());
/* save the panes position and make sure to deactivate plugins
* for this window, but only once */
@@ -181,8 +181,8 @@ gedit_window_dispose (GObject *object)
{
save_panes_state (window);
- gedit_plugins_engine_deactivate_plugins (gedit_plugins_engine_get_default (),
- window);
+ gpe_engine_remove_object (gedit_plugins_engine_get_default (),
+ G_OBJECT (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 ());
+ gpe_engine_garbage_collect (gedit_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 ());
+ gpe_engine_garbage_collect (gedit_plugins_engine_get_default ());
}
static void
@@ -825,8 +825,8 @@ 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 (),
- window);
+ gpe_engine_update_plugins_ui (gedit_plugins_engine_get_default (),
+ G_OBJECT (window));
}
static void
@@ -2695,8 +2695,8 @@ sync_name (GeditTab *tab,
g_free (escaped_name);
g_free (tip);
- gedit_plugins_engine_update_plugins_ui (gedit_plugins_engine_get_default (),
- window);
+ gpe_engine_update_plugins_ui (gedit_plugins_engine_get_default (),
+ G_OBJECT (window));
}
static GeditWindow *
@@ -3089,8 +3089,8 @@ 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 (),
- window);
+ gpe_engine_update_plugins_ui (gedit_plugins_engine_get_default (),
+ G_OBJECT (window));
}
static void
@@ -3099,8 +3099,8 @@ sync_languages_menu (GeditDocument *doc,
GeditWindow *window)
{
update_languages_menu (window);
- gedit_plugins_engine_update_plugins_ui (gedit_plugins_engine_get_default (),
- window);
+ gpe_engine_update_plugins_ui (gedit_plugins_engine_get_default (),
+ G_OBJECT (window));
}
static void
@@ -3108,8 +3108,8 @@ editable_changed (GeditView *view,
GParamSpec *arg1,
GeditWindow *window)
{
- gedit_plugins_engine_update_plugins_ui (gedit_plugins_engine_get_default (),
- window);
+ gpe_engine_update_plugins_ui (gedit_plugins_engine_get_default (),
+ G_OBJECT (window));
}
static void
@@ -3313,8 +3313,8 @@ notebook_tab_removed (GeditNotebook *notebook,
"ViewHighlightMode");
gtk_action_set_sensitive (action, FALSE);
- gedit_plugins_engine_update_plugins_ui (gedit_plugins_engine_get_default (),
- window);
+ gpe_engine_update_plugins_ui (gedit_plugins_engine_get_default (),
+ G_OBJECT (window));
}
if (window->priv->num_tabs <= 1)
@@ -3906,8 +3906,8 @@ gedit_window_init (GeditWindow *window)
gedit_debug_message (DEBUG_WINDOW, "Update plugins ui");
- gedit_plugins_engine_activate_plugins (gedit_plugins_engine_get_default (),
- window);
+ gpe_engine_add_object (gedit_plugins_engine_get_default (),
+ G_OBJECT (window));
/* set visibility of panes.
* This needs to be done after plugins activatation */
diff --git a/gedit/gedit.c b/gedit/gedit.c
index 03a1705..88de0f1 100644
--- a/gedit/gedit.c
+++ b/gedit/gedit.c
@@ -540,7 +540,7 @@ int
main (int argc, char *argv[])
{
GOptionContext *context;
- GeditPluginsEngine *engine;
+ GPEEngine *engine;
GeditWindow *window;
GeditApp *app;
gboolean restored = FALSE;
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]