[gedit/eggplugins: 6/6] Add back a dummy GeditPlugin and GeditPluginsEngine specialization.
- From: Steve Frécinaux <sfre src gnome org>
- To: svn-commits-list gnome org
- Cc:
- Subject: [gedit/eggplugins: 6/6] Add back a dummy GeditPlugin and GeditPluginsEngine specialization.
- Date: Fri, 9 Oct 2009 18:03:04 +0000 (UTC)
commit e980cd56a528b686883cab2a11cc2fc0eb947228
Author: Steve Frécinaux <code istique net>
Date: Fri Oct 9 12:17:31 2009 +0200
Add back a dummy GeditPlugin and GeditPluginsEngine specialization.
gedit/Makefile.am | 4 +
gedit/gedit-plugin-manager.c | 4 +-
gedit/gedit-plugin.c | 48 +++++++++++++++
gedit/gedit-plugin.h | 126 +++++++++++++++++++++++++++++++++++++++
gedit/gedit-plugins-engine.c | 61 +++++++++++++++++++
gedit/gedit-plugins-engine.h | 68 +++++++++++++++++++++
gedit/gedit-prefs-manager-app.c | 4 +-
gedit/gedit-window.c | 24 ++++----
gedit/gedit.c | 4 +-
9 files changed, 325 insertions(+), 18 deletions(-)
---
diff --git a/gedit/Makefile.am b/gedit/Makefile.am
index dc19385..d84b4ce 100644
--- a/gedit/Makefile.am
+++ b/gedit/Makefile.am
@@ -56,6 +56,7 @@ endif
NOINST_H_FILES = \
gedit-language-manager.h \
gedit-style-scheme-manager.h \
+ gedit-plugins-engine.h \
gedit-plugin-manager.h \
gedit-ui.h \
gedit-window-private.h \
@@ -91,6 +92,7 @@ INST_H_FILES = \
gedit-metadata-manager.h \
gedit-notebook.h \
gedit-panel.h \
+ gedit-plugin.h \
gedit-prefs-manager-app.h \
gedit-prefs-manager.h \
gedit-progress-message-area.h \
@@ -148,6 +150,8 @@ libgedit_la_SOURCES = \
gedit-metadata-manager.c \
gedit-notebook.c \
gedit-panel.c \
+ gedit-plugin.c \
+ gedit-plugins-engine.c \
gedit-plugin-manager.c \
gedit-prefs-manager-app.c \
gedit-prefs-manager.c \
diff --git a/gedit/gedit-plugin-manager.c b/gedit/gedit-plugin-manager.c
index a2b7a10..f6d5101 100644
--- a/gedit/gedit-plugin-manager.c
+++ b/gedit/gedit-plugin-manager.c
@@ -793,7 +793,7 @@ gedit_plugin_manager_init (GeditPluginManager *pm)
/*
* Always we create the manager, firstly we rescan the plugins directory
*/
- egg_plugins_engine_rescan_plugins (egg_plugins_engine_get_default ());
+ egg_plugins_engine_rescan_plugins (gedit_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 = egg_plugins_engine_get_default ();
+ pm->priv->engine = gedit_plugins_engine_get_default ();
g_signal_connect_after (pm->priv->engine,
"activate-plugin",
diff --git a/gedit/gedit-plugin.c b/gedit/gedit-plugin.c
new file mode 100644
index 0000000..892a5e8
--- /dev/null
+++ b/gedit/gedit-plugin.c
@@ -0,0 +1,48 @@
+/*
+ * gedit-plugin.h
+ * 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
+ * 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-2009. See the AUTHORS file for a
+ * list of people on the gedit Team.
+ * See the ChangeLog files for a list of changes.
+ */
+
+#ifdef HAVE_CONFIG_H
+#include <config.h>
+#endif
+
+#include "gedit-plugin.h"
+
+G_DEFINE_TYPE(GeditPlugin, gedit_plugin, EGG_PLUGINS_TYPE_PLUGIN)
+
+static void
+gedit_plugin_class_init (GeditPluginClass *klass)
+{
+ /* Empty */
+}
+
+static void
+gedit_plugin_init (GeditPlugin *plugin)
+{
+ /* Empty */
+}
diff --git a/gedit/gedit-plugin.h b/gedit/gedit-plugin.h
new file mode 100644
index 0000000..848b7c7
--- /dev/null
+++ b/gedit/gedit-plugin.h
@@ -0,0 +1,126 @@
+/*
+ * egg-plugins-plugin.h
+ * 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
+ * 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.
+ */
+
+#ifndef __GEDIT_PLUGIN_H__
+#define __GEDIT_PLUGIN_H__
+
+#include <glib-object.h>
+#include <libplugins/egg-plugins-plugin.h>
+
+/* TODO: add a .h file that includes all the .h files normally needed to
+ * develop a plugin */
+
+G_BEGIN_DECLS
+
+/*
+ * Type checking and casting macros
+ */
+#define GEDIT_TYPE_PLUGIN (egg_plugins_plugin_get_type())
+#define GEDIT_PLUGIN(obj) (G_TYPE_CHECK_INSTANCE_CAST((obj), GEDIT_PLUGIN_TYPE_PLUGIN, GeditPlugin))
+#define GEDIT_PLUGIN_CLASS(klass) (G_TYPE_CHECK_CLASS_CAST((klass), GEDIT_PLUGIN_TYPE_PLUGIN, GeditPluginClass))
+#define GEDIT_IS_PLUGIN(obj) (G_TYPE_CHECK_INSTANCE_TYPE((obj), GEDIT_PLUGIN_TYPE_PLUGIN))
+#define GEDIT_IS_PLUGIN_CLASS(klass) (G_TYPE_CHECK_CLASS_TYPE ((klass), GEDIT_PLUGIN_TYPE_PLUGIN))
+#define GEDIT_PLUGIN_GET_CLASS(obj) (G_TYPE_INSTANCE_GET_CLASS((obj), GEDIT_PLUGIN_TYPE_PLUGIN, GeditPluginClass))
+
+/*
+ * Main object structure
+ */
+typedef struct _GeditPlugin GeditPlugin;
+
+struct _GeditPlugin
+{
+ EggPluginsPlugin parent;
+};
+
+/*
+ * Class definition
+ */
+typedef struct _GeditPluginClass GeditPluginClass;
+
+struct _GeditPluginClass
+{
+ EggPluginsPluginClass parent_class;
+};
+
+/*
+ * Public methods
+ */
+GType gedit_plugin_get_type (void) G_GNUC_CONST;
+
+
+/**
+ * GEDIT_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) \
+ EGG_PLUGINS_REGISTER_TYPE_WITH_CODE(GEDIT_TYPE_PLUGIN, PluginName, plugin_name, CODE)
+
+/**
+ * GEDIT_PLUGIN_REGISTER_TYPE(PluginName, plugin_name):
+ *
+ * Utility macro used to register plugins.
+ */
+#define GEDIT_PLUGINS_REGISTER_TYPE(PluginName, plugin_name) \
+ EGG_PLUGINS_PLUGIN_REGISTER_TYPE(GEDIT_TYPE_PLUGIN, PluginName, plugin_name)
+
+/**
+ * GEDIT_PLUGIN_DEFINE_TYPE_WITH_CODE(TypeName, type_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 EGG_PLUGINS_DEFINE_TYPE_WITH_CODE(TypeName, type_name, PARENT_TYPE, CODE) \
+ G_DEFINE_DYNAMIC_TYPE_EXTENDED(TypeName, type_name, PARENT_TYPE, 0, CODE)
+
+
+/**
+ * GEDIT_PLUGIN_DEFINE_TYPE(TypeName, type_name, PARENT_TYPE):
+ *
+ * Utility macro used to register gobject types in plugins.
+ *
+ * Deprecated: use G_DEFINE_DYNAMIC_TYPE instead
+ */
+#define GEDIT_DEFINE_TYPE(TypeName, type_name, PARENT_TYPE) \
+ G_DEFINE_DYNAMIC_TYPE(TypeName, type_name, PARENT_TYPE)
+
+/**
+ * GEDIT_PLUGIN_IMPLEMENT_INTERFACE(TYPE_IFACE, iface_init):
+ *
+ * Utility macro used to register interfaces for gobject types in plugins.
+ *
+ * Deprecated: use G_IMPLEMENT_INTERFACE instead.
+ */
+#define GEDIT_PLUGIN_IMPLEMENT_INTERFACE(type_name, TYPE_IFACE, iface_init) \
+ G_IMPLEMENT_INTERFACE(TYPE_IFACE, iface_init)
+
+G_END_DECLS
+
+#endif /* __EGG_PLUGINS_PLUGIN_H__ */
diff --git a/gedit/gedit-plugins-engine.c b/gedit/gedit-plugins-engine.c
new file mode 100644
index 0000000..17c7fe0
--- /dev/null
+++ b/gedit/gedit-plugins-engine.c
@@ -0,0 +1,61 @@
+/*
+ * gedit-plugins-engine.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
+ * 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-2009. See the AUTHORS file for a
+ * list of people on the gedit Team.
+ * See the ChangeLog files for a list of changes.
+ */
+
+#ifdef HAVE_CONFIG_H
+#include <config.h>
+#endif
+
+#include "gedit-plugins-engine.h"
+
+G_DEFINE_TYPE(GeditPluginsEngine, gedit_plugins_engine, EGG_PLUGINS_TYPE_ENGINE)
+
+EggPluginsEngine *default_engine = NULL;
+
+static void
+gedit_plugins_engine_class_init (GeditPluginsEngineClass *klass)
+{
+ /* Empty */
+}
+
+static void
+gedit_plugins_engine_init (GeditPluginsEngine *engine)
+{
+ /* Empty */
+}
+
+EggPluginsEngine *
+gedit_plugins_engine_get_default (void)
+{
+ if (default_engine == NULL)
+ {
+ default_engine = EGG_PLUGINS_ENGINE (g_object_new (GEDIT_TYPE_PLUGINS_ENGINE, NULL));
+ g_object_add_weak_pointer (G_OBJECT (default_engine), (gpointer) &default_engine);
+ }
+ return default_engine;
+}
diff --git a/gedit/gedit-plugins-engine.h b/gedit/gedit-plugins-engine.h
new file mode 100644
index 0000000..d7e769e
--- /dev/null
+++ b/gedit/gedit-plugins-engine.h
@@ -0,0 +1,68 @@
+/*
+ * gedit-plugins-engine.h
+ * 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
+ * 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-2009. See the AUTHORS file for a
+ * list of people on the gedit Team.
+ * See the ChangeLog files for a list of changes.
+ */
+
+#ifndef __GEDIT_PLUGINS_ENGINE_H__
+#define __GEDIT_PLUGINS_ENGINE_H__
+
+#include <glib.h>
+#include <gtk/gtk.h>
+#include <libplugins/egg-plugins-engine.h>
+#include "gedit-plugin.h"
+
+G_BEGIN_DECLS
+
+#define GEDIT_TYPE_PLUGINS_ENGINE (gedit_plugins_engine_get_type ())
+#define GEDIT_PLUGINS_ENGINE(obj) (G_TYPE_CHECK_INSTANCE_CAST((obj), GEDIT_TYPE_PLUGINS_ENGINE, GeditPluginsEngine))
+#define GEDIT_PLUGINS_ENGINE_CLASS(klass) (G_TYPE_CHECK_CLASS_CAST((klass), GEDIT_TYPE_PLUGINS_ENGINE, GeditPluginsEngineClass))
+#define GEDIT_IS_PLUGINS_ENGINE(obj) (G_TYPE_CHECK_INSTANCE_TYPE((obj), GEDIT_TYPE_PLUGINS_ENGINE))
+#define GEDIT_IS_PLUGINS_ENGINE_CLASS(klass) (G_TYPE_CHECK_CLASS_TYPE ((klass), GEDIT_TYPE_PLUGINS_ENGINE))
+#define GEDIT_PLUGINS_ENGINE_GET_CLASS(obj) (G_TYPE_INSTANCE_GET_CLASS((obj), GEDIT_TYPE_PLUGINS_ENGINE, GeditPluginsEngineClass))
+
+typedef struct _GeditPluginsEngine GeditPluginsEngine;
+
+struct _GeditPluginsEngine
+{
+ EggPluginsEngine parent;
+};
+
+typedef struct _GeditPluginsEngineClass GeditPluginsEngineClass;
+
+struct _GeditPluginsEngineClass
+{
+ EggPluginsEngineClass parent_class;
+};
+
+GType gedit_plugins_engine_get_type (void) G_GNUC_CONST;
+
+EggPluginsEngine
+ *gedit_plugins_engine_get_default (void);
+
+G_END_DECLS
+
+#endif /* __GEDIT_PLUGINS_ENGINE_H__ */
diff --git a/gedit/gedit-prefs-manager-app.c b/gedit/gedit-prefs-manager-app.c
index 7ff746a..eea737a 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/egg-plugins-engine.h>
+#include "gedit-plugins-engine.h"
#include "gedit-style-scheme-manager.h"
#include "gedit-dirs.h"
@@ -1570,7 +1570,7 @@ gedit_prefs_manager_active_plugins_changed (GConfClient *client,
{
EggPluginsEngine *engine;
- engine = egg_plugins_engine_get_default ();
+ engine = gedit_plugins_engine_get_default ();
egg_plugins_engine_active_plugins_changed (engine);
}
diff --git a/gedit/gedit-window.c b/gedit/gedit-window.c
index 1ff8ac8..a3f44ea 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/egg-plugins-engine.h>
+#include "gedit-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.
*/
- egg_plugins_engine_garbage_collect (egg_plugins_engine_get_default ());
+ egg_plugins_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,7 +181,7 @@ gedit_window_dispose (GObject *object)
{
save_panes_state (window);
- egg_plugins_engine_deactivate_plugins (egg_plugins_engine_get_default (),
+ egg_plugins_engine_deactivate_plugins (gedit_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.
*/
- egg_plugins_engine_garbage_collect (egg_plugins_engine_get_default ());
+ egg_plugins_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)
{
- egg_plugins_engine_garbage_collect (egg_plugins_engine_get_default ());
+ egg_plugins_engine_garbage_collect (gedit_plugins_engine_get_default ());
}
static void
@@ -825,7 +825,7 @@ set_sensitivity_according_to_tab (GeditWindow *window,
update_next_prev_doc_sensitivity (window, tab);
- egg_plugins_engine_update_plugins_ui (egg_plugins_engine_get_default (),
+ egg_plugins_engine_update_plugins_ui (gedit_plugins_engine_get_default (),
window);
}
@@ -2695,7 +2695,7 @@ sync_name (GeditTab *tab,
g_free (escaped_name);
g_free (tip);
- egg_plugins_engine_update_plugins_ui (egg_plugins_engine_get_default (),
+ egg_plugins_engine_update_plugins_ui (gedit_plugins_engine_get_default (),
window);
}
@@ -3089,7 +3089,7 @@ selection_changed (GeditDocument *doc,
editable &&
gtk_text_buffer_get_has_selection (GTK_TEXT_BUFFER (doc)));
- egg_plugins_engine_update_plugins_ui (egg_plugins_engine_get_default (),
+ egg_plugins_engine_update_plugins_ui (gedit_plugins_engine_get_default (),
window);
}
@@ -3099,7 +3099,7 @@ sync_languages_menu (GeditDocument *doc,
GeditWindow *window)
{
update_languages_menu (window);
- egg_plugins_engine_update_plugins_ui (egg_plugins_engine_get_default (),
+ egg_plugins_engine_update_plugins_ui (gedit_plugins_engine_get_default (),
window);
}
@@ -3108,7 +3108,7 @@ editable_changed (GeditView *view,
GParamSpec *arg1,
GeditWindow *window)
{
- egg_plugins_engine_update_plugins_ui (egg_plugins_engine_get_default (),
+ egg_plugins_engine_update_plugins_ui (gedit_plugins_engine_get_default (),
window);
}
@@ -3313,7 +3313,7 @@ notebook_tab_removed (GeditNotebook *notebook,
"ViewHighlightMode");
gtk_action_set_sensitive (action, FALSE);
- egg_plugins_engine_update_plugins_ui (egg_plugins_engine_get_default (),
+ egg_plugins_engine_update_plugins_ui (gedit_plugins_engine_get_default (),
window);
}
@@ -3906,7 +3906,7 @@ gedit_window_init (GeditWindow *window)
gedit_debug_message (DEBUG_WINDOW, "Update plugins ui");
- egg_plugins_engine_activate_plugins (egg_plugins_engine_get_default (),
+ egg_plugins_engine_activate_plugins (gedit_plugins_engine_get_default (),
window);
/* set visibility of panes.
diff --git a/gedit/gedit.c b/gedit/gedit.c
index 76ef16b..67f7f42 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/egg-plugins-engine.h>
+#include "gedit-plugins-engine.h"
#include "gedit-prefs-manager-app.h"
#include "gedit-session.h"
#include "gedit-utils.h"
@@ -678,7 +678,7 @@ main (int argc, char *argv[])
/* Init plugins engine */
gedit_debug_message (DEBUG_APP, "Init plugins");
- engine = egg_plugins_engine_get_default ();
+ engine = gedit_plugins_engine_get_default ();
gtk_about_dialog_set_url_hook (gedit_utils_activate_url, NULL, NULL);
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]