summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorVadim Barkov <[email protected]>2016-12-19 23:24:10 +0300
committerVadim Barkov <[email protected]>2016-12-19 23:24:10 +0300
commit98c44e3c9455581f90c4f6a70fc42adf986d8206 (patch)
treee9de2a70895a7f28d47eb12b12f9e3d33c64faa3
parent2314b3828cbe540d65ba517c32872476417501a6 (diff)
parent38c20e460232c5f4ec7bf616180ff777b5d6b3a0 (diff)
downloadpluma-98c44e3c9455581f90c4f6a70fc42adf986d8206.tar.bz2
pluma-98c44e3c9455581f90c4f6a70fc42adf986d8206.tar.xz
Merge branch 'master' of https://github.com/mate-desktop/pluma
-rw-r--r--Makefile.am2
-rw-r--r--NEWS14
-rw-r--r--README14
-rw-r--r--configure.ac20
-rw-r--r--data/pluma.pc.in2
-rw-r--r--docs/reference/Makefile.am2
-rw-r--r--docs/reference/pluma-docs.sgml1
-rw-r--r--docs/reference/pluma-sections.txt25
-rw-r--r--docs/reference/pluma.types2
-rw-r--r--plugin-loaders/Makefile.am3
-rw-r--r--plugin-loaders/c/Makefile.am24
-rw-r--r--plugin-loaders/c/pluma-plugin-loader-c.c182
-rw-r--r--plugin-loaders/c/pluma-plugin-loader-c.h60
-rw-r--r--plugins/changecase/Makefile.am6
-rw-r--r--plugins/changecase/changecase.plugin.desktop.in (renamed from plugins/changecase/changecase.pluma-plugin.desktop.in)2
-rw-r--r--plugins/changecase/pluma-changecase-plugin.c172
-rw-r--r--plugins/changecase/pluma-changecase-plugin.h15
-rw-r--r--plugins/docinfo/Makefile.am6
-rw-r--r--plugins/docinfo/docinfo.plugin.desktop.in (renamed from plugins/docinfo/docinfo.pluma-plugin.desktop.in)2
-rw-r--r--plugins/docinfo/pluma-docinfo-plugin.c238
-rw-r--r--plugins/docinfo/pluma-docinfo-plugin.h12
-rwxr-xr-xplugins/externaltools/tools/library.py22
-rw-r--r--plugins/filebrowser/Makefile.am6
-rw-r--r--plugins/filebrowser/filebrowser.plugin.desktop.in (renamed from plugins/filebrowser/filebrowser.pluma-plugin.desktop.in)2
-rw-r--r--plugins/filebrowser/pluma-file-bookmarks-store.c15
-rw-r--r--plugins/filebrowser/pluma-file-bookmarks-store.h2
-rw-r--r--plugins/filebrowser/pluma-file-browser-plugin.c275
-rw-r--r--plugins/filebrowser/pluma-file-browser-plugin.h17
-rw-r--r--plugins/filebrowser/pluma-file-browser-store.c23
-rw-r--r--plugins/filebrowser/pluma-file-browser-store.h2
-rw-r--r--plugins/filebrowser/pluma-file-browser-view.c15
-rw-r--r--plugins/filebrowser/pluma-file-browser-view.h2
-rw-r--r--plugins/filebrowser/pluma-file-browser-widget.c15
-rw-r--r--plugins/filebrowser/pluma-file-browser-widget.h2
-rw-r--r--plugins/modelines/Makefile.am6
-rw-r--r--plugins/modelines/modelines.plugin.desktop.in (renamed from plugins/modelines/modelines.pluma-plugin.desktop.in)2
-rw-r--r--plugins/modelines/pluma-modeline-plugin.c188
-rw-r--r--plugins/modelines/pluma-modeline-plugin.h25
-rw-r--r--plugins/sort/Makefile.am6
-rw-r--r--plugins/sort/pluma-sort-plugin.c220
-rw-r--r--plugins/sort/pluma-sort-plugin.h12
-rw-r--r--plugins/sort/sort.plugin.desktop.in (renamed from plugins/sort/sort.pluma-plugin.desktop.in)2
-rw-r--r--plugins/spell/Makefile.am6
-rw-r--r--plugins/spell/pluma-spell-plugin.c471
-rw-r--r--plugins/spell/pluma-spell-plugin.h10
-rw-r--r--plugins/spell/spell.plugin.desktop.in (renamed from plugins/spell/spell.pluma-plugin.desktop.in)2
-rw-r--r--plugins/taglist/Makefile.am6
-rw-r--r--plugins/taglist/pluma-taglist-plugin-panel.c15
-rw-r--r--plugins/taglist/pluma-taglist-plugin-panel.h2
-rw-r--r--plugins/taglist/pluma-taglist-plugin-parser.c23
-rw-r--r--plugins/taglist/pluma-taglist-plugin.c181
-rw-r--r--plugins/taglist/pluma-taglist-plugin.h9
-rw-r--r--plugins/taglist/taglist.plugin.desktop.in (renamed from plugins/taglist/taglist.pluma-plugin.desktop.in)2
-rw-r--r--plugins/time/Makefile.am6
-rw-r--r--plugins/time/pluma-time-plugin.c411
-rw-r--r--plugins/time/pluma-time-plugin.h9
-rw-r--r--plugins/time/time.plugin.desktop.in (renamed from plugins/time/time.pluma-plugin.desktop.in)2
-rw-r--r--plugins/trailsave/Makefile.am6
-rw-r--r--plugins/trailsave/pluma-trail-save-plugin.c139
-rw-r--r--plugins/trailsave/pluma-trail-save-plugin.h15
-rw-r--r--plugins/trailsave/trailsave.plugin.desktop.in (renamed from plugins/trailsave/trailsave.pluma-plugin.desktop.in)2
-rw-r--r--pluma/Makefile.am51
-rwxr-xr-xpluma/dialogs/pluma-preferences-dialog.c4
-rw-r--r--pluma/pluma-app.c8
-rw-r--r--pluma/pluma-commands-file.c4
-rw-r--r--pluma/pluma-dirs.c14
-rw-r--r--pluma/pluma-dirs.h3
-rw-r--r--pluma/pluma-document.c23
-rw-r--r--pluma/pluma-file-chooser-dialog.c2
-rw-r--r--pluma/pluma-message-bus.c15
-rw-r--r--pluma/pluma-message-type.c9
-rw-r--r--pluma/pluma-message.c7
-rw-r--r--pluma/pluma-object-module.c343
-rw-r--r--pluma/pluma-object-module.h94
-rw-r--r--pluma/pluma-plugin-info-priv.h67
-rw-r--r--pluma/pluma-plugin-info.c396
-rw-r--r--pluma/pluma-plugin-info.h63
-rw-r--r--pluma/pluma-plugin-loader.c131
-rw-r--r--pluma/pluma-plugin-loader.h106
-rw-r--r--pluma/pluma-plugin-manager.c895
-rw-r--r--pluma/pluma-plugin-manager.h83
-rw-r--r--pluma/pluma-plugin.c334
-rw-r--r--pluma/pluma-plugin.h240
-rw-r--r--pluma/pluma-plugins-engine.c808
-rw-r--r--pluma/pluma-plugins-engine.h45
-rw-r--r--pluma/pluma-prefs-manager-app.c26
-rw-r--r--pluma/pluma-status-combo-box.c6
-rw-r--r--pluma/pluma-tab.c6
-rw-r--r--pluma/pluma-utils.c27
-rw-r--r--pluma/pluma-utils.h2
-rw-r--r--pluma/pluma-window-private.h11
-rw-r--r--pluma/pluma-window.c126
-rw-r--r--pluma/pluma-window.h3
-rw-r--r--pluma/pluma.c10
-rw-r--r--po/POTFILES.in19
-rw-r--r--po/ca.po56
-rw-r--r--po/nb.po90
-rw-r--r--po/ro.po11
-rw-r--r--po/sv.po6
99 files changed, 1958 insertions, 5166 deletions
diff --git a/Makefile.am b/Makefile.am
index d472aea3..44bcacd4 100644
--- a/Makefile.am
+++ b/Makefile.am
@@ -1,7 +1,7 @@
## Process this file with automake to produce Makefile.in
ACLOCAL_AMFLAGS = -I m4 ${ACLOCAL_FLAGS}
-SUBDIRS = pluma pixmaps po data plugin-loaders plugins docs help
+SUBDIRS = pluma pixmaps po data plugins docs help
if ENABLE_TESTS
SUBDIRS += tests
diff --git a/NEWS b/NEWS
index 73d5e95b..86f54a93 100644
--- a/NEWS
+++ b/NEWS
@@ -1,3 +1,17 @@
+pluma 1.17.2
+============
+
+ * Fix build without X when introspection is enabled
+ * Some code cleanups
+
+pluma 1.17.1
+============
+
+ * Build: actually build GObject introspection data
+ * Port plugin system and C plugins to libpeas
+ * Some code and docs cleanups
+ * Translations update
+
pluma 1.17.0
============
diff --git a/README b/README
index aec37434..2b346de6 100644
--- a/README
+++ b/README
@@ -110,18 +110,8 @@ In the bug report please include:
Patches
=======
-Patches should also be submitted to github.com/mate-desktop/pluma. If the patch
-fixes an existing bug, add the patch as an attachment to that bug
-report.
-
-Otherwise, enter a new bug report that describes the patch, and attach
-the patch to that bug report.
-
-Patches should be in unified diff form. (The -u option to GNU diff.)
-
-If you are interested in helping us to develop pluma, please see the
-file 'AUTHOR' for contact information and/or send a message to the pluma
-mailing list. See also the file 'HACKING' for more detailed information.
+Patches should also be submitted to https://github.com/mate-desktop/pluma,
+preferably via pull requests.
The pluma team.
diff --git a/configure.ac b/configure.ac
index 4fd1c5f4..d2b83381 100644
--- a/configure.ac
+++ b/configure.ac
@@ -4,7 +4,7 @@ AC_PREREQ(2.63.2)
m4_define(pluma_major_version, 1)
m4_define(pluma_minor_version, 17)
-m4_define(pluma_micro_version, 0)
+m4_define(pluma_micro_version, 2)
m4_define(pluma_version, pluma_major_version.pluma_minor_version.pluma_micro_version)
AC_INIT([pluma], [pluma_version],
@@ -39,7 +39,6 @@ LT_INIT(disable-static)
GTK_DOC_CHECK([1.0],[--flavour=no-tmpl])
-AC_CHECK_FUNC(sigaction)
AC_CHECK_LIB(m, floor)
dnl make sure we keep ACLOCAL_FLAGS around for maintainer builds to work
@@ -161,6 +160,8 @@ PKG_CHECK_MODULES(PLUMA, [
gio-2.0 >= 2.26.0
gtk+-3.0 >= $GTK_REQUIRED
gtksourceview-3.0 >= $GTKSOURCEVIEW_REQUIRED
+ libpeas-1.0 >= 1.2.0
+ libpeas-gtk-1.0 >= 1.2.0
])
PKG_CHECK_MODULES(X11, [x11])
@@ -176,6 +177,16 @@ PKG_CHECK_MODULES(EGG_SMCLIENT, [sm >= 1.0.0])
AC_SUBST(EGG_SMCLIENT_CFLAGS)
AC_SUBST(EGG_SMCLIENT_LIBS)
+# Introspection
+GOBJECT_INTROSPECTION_CHECK([0.9.3])
+
+if test "$found_introspection" = "yes"; then
+ have_introspection=yes
+ AC_DEFINE([HAVE_INTROSPECTION], [1], [Define to enable GObject Introspection])
+else
+ have_introspection=no
+fi
+
dnl ================================================================
dnl GSettings related settings
dnl ================================================================
@@ -213,10 +224,8 @@ AC_ARG_ENABLE([tests],
AM_CONDITIONAL(ENABLE_TESTS, test x$enable_tests = xyes)
PLUGIN_LIBTOOL_FLAGS="-module -avoid-version"
-LOADER_LIBTOOL_FLAGS="-module -avoid-version"
AC_SUBST(PLUGIN_LIBTOOL_FLAGS)
-AC_SUBST(LOADER_LIBTOOL_FLAGS)
PLUMA_PLUGINS_DATA_DIR="$datadir/pluma/plugins"
AC_SUBST(PLUMA_PLUGINS_DATA_DIR)
@@ -240,8 +249,6 @@ pluma/smclient/Makefile
pluma/Makefile
help/Makefile
pixmaps/Makefile
-plugin-loaders/Makefile
-plugin-loaders/c/Makefile
plugins/Makefile
plugins/changecase/Makefile
plugins/docinfo/Makefile
@@ -269,6 +276,7 @@ Configuration:
Compiler: ${CC}
Spell Plugin enabled: $enable_enchant
Gvfs metadata enabled: $enable_gvfs_metadata
+ GObject Introspection: ${have_introspection}
Tests enabled: $enable_tests
"
diff --git a/data/pluma.pc.in b/data/pluma.pc.in
index b79400c7..68d60a02 100644
--- a/data/pluma.pc.in
+++ b/data/pluma.pc.in
@@ -6,7 +6,7 @@ pluginsdir=@libdir@/pluma/plugins
Name: pluma
Description: pluma
-Requires: gtksourceview-3.0
+Requires: gtksourceview-3.0 libpeas-1.0 libpeas-gtk-1.0
Version: @VERSION@
Cflags: -I${includedir}/pluma
Libs: -L${libdir}
diff --git a/docs/reference/Makefile.am b/docs/reference/Makefile.am
index f52aba90..e85d2228 100644
--- a/docs/reference/Makefile.am
+++ b/docs/reference/Makefile.am
@@ -46,8 +46,6 @@ IGNORE_HFILES= \
pluma-documents-panel.h \
pluma-io-error-message-area.h \
pluma-languages-manager.h \
- pluma-object-module.h \
- pluma-plugin-manager.h \
pluma-plugins-engine.h \
pluma-prefs-manager-private.h \
pluma-session.h \
diff --git a/docs/reference/pluma-docs.sgml b/docs/reference/pluma-docs.sgml
index cf349af0..19bda5a5 100644
--- a/docs/reference/pluma-docs.sgml
+++ b/docs/reference/pluma-docs.sgml
@@ -17,7 +17,6 @@
<xi:include href="xml/pluma-message.xml"/>
<xi:include href="xml/pluma-notebook.xml"/>
<xi:include href="xml/pluma-panel.xml"/>
- <xi:include href="xml/pluma-plugin.xml"/>
<xi:include href="xml/pluma-print-job-preview.xml"/>
<xi:include href="xml/pluma-print.xml"/>
<xi:include href="xml/pluma-progress-message-area.xml"/>
diff --git a/docs/reference/pluma-sections.txt b/docs/reference/pluma-sections.txt
index 873e28c2..db6fc66f 100644
--- a/docs/reference/pluma-sections.txt
+++ b/docs/reference/pluma-sections.txt
@@ -239,30 +239,6 @@ PLUMA_PANEL_GET_CLASS
</SECTION>
<SECTION>
-<FILE>pluma-plugin</FILE>
-<TITLE>PlumaPlugin</TITLE>
-PlumaPlugin
-pluma_plugin_activate
-pluma_plugin_deactivate
-pluma_plugin_update_ui
-pluma_plugin_is_configurable
-pluma_plugin_create_configure_dialog
-PLUMA_PLUGIN_REGISTER_TYPE
-<SUBSECTION Standard>
-PLUMA_PLUGIN
-PLUMA_IS_PLUGIN
-PLUMA_TYPE_PLUGIN
-pluma_plugin_get_type
-PLUMA_PLUGIN_CLASS
-PLUMA_IS_PLUGIN_CLASS
-PLUMA_PLUGIN_GET_CLASS
-PLUMA_PLUGIN_REGISTER_TYPE_WITH_CODE
-PLUMA_PLUGIN_REGISTER_TYPE
-PLUMA_PLUGIN_DEFINE_TYPE_WITH_CODE
-PLUMA_PLUGIN_DEFINE_TYPE
-</SECTION>
-
-<SECTION>
<FILE>pluma-print-job-preview</FILE>
PlumaPrintJobPreviewPrivate
<TITLE>PlumaPrintJobPreview</TITLE>
@@ -411,7 +387,6 @@ pluma_window_get_statusbar
pluma_window_get_ui_manager
pluma_window_get_state
pluma_window_get_tab_from_location
-pluma_window_get_tab_from_uri
pluma_window_get_message_bus
<SUBSECTION Standard>
PLUMA_WINDOW
diff --git a/docs/reference/pluma.types b/docs/reference/pluma.types
index 0dc5633e..0eeea1a2 100644
--- a/docs/reference/pluma.types
+++ b/docs/reference/pluma.types
@@ -8,7 +8,6 @@
#include "pluma-message-type.h"
#include "pluma-notebook.h"
#include "pluma-panel.h"
-#include "pluma-plugin.h"
#include "pluma-progress-message-area.h"
#include "pluma-statusbar.h"
#include "pluma-tab.h"
@@ -24,7 +23,6 @@ pluma_message_bus_get_type
pluma_message_type_get_type
pluma_notebook_get_type
pluma_panel_get_type
-pluma_plugin_get_type
pluma_progress_message_area_get_type
pluma_statusbar_get_type
pluma_tab_get_type
diff --git a/plugin-loaders/Makefile.am b/plugin-loaders/Makefile.am
deleted file mode 100644
index 2573ec31..00000000
--- a/plugin-loaders/Makefile.am
+++ /dev/null
@@ -1,3 +0,0 @@
-SUBDIRS = c
-
--include $(top_srcdir)/git.mk
diff --git a/plugin-loaders/c/Makefile.am b/plugin-loaders/c/Makefile.am
deleted file mode 100644
index 571c79d4..00000000
--- a/plugin-loaders/c/Makefile.am
+++ /dev/null
@@ -1,24 +0,0 @@
-# C plugin loader
-
-loaderdir = $(libdir)/pluma/plugin-loaders
-
-AM_CPPFLAGS = \
- -I$(top_srcdir) \
- $(PLUMA_CFLAGS) \
- $(WARN_CFLAGS) \
- $(DISABLE_DEPRECATED_CFLAGS) \
- -DPLUMA_LOCALEDIR=\""$(prefix)/$(DATADIRNAME)/locale"\"
-
-loader_LTLIBRARIES = libcloader.la
-
-NOINST_H_FILES = \
- pluma-plugin-loader-c.h
-
-libcloader_la_SOURCES = \
- pluma-plugin-loader-c.c \
- $(NOINST_H_FILES)
-
-libcloader_la_LDFLAGS = $(LOADER_LIBTOOL_FLAGS)
-libcloader_la_LIBADD = $(PLUMA_LIBS)
-
--include $(top_srcdir)/git.mk
diff --git a/plugin-loaders/c/pluma-plugin-loader-c.c b/plugin-loaders/c/pluma-plugin-loader-c.c
deleted file mode 100644
index 1ecca185..00000000
--- a/plugin-loaders/c/pluma-plugin-loader-c.c
+++ /dev/null
@@ -1,182 +0,0 @@
-/*
- * pluma-plugin-loader-c.c
- * This file is part of pluma
- *
- * 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., 51 Franklin St, Fifth Floor,
- * Boston, MA 02110-1301, USA.
- */
-
-#include "pluma-plugin-loader-c.h"
-#include <pluma/pluma-object-module.h>
-
-#define PLUMA_PLUGIN_LOADER_C_GET_PRIVATE(object)(G_TYPE_INSTANCE_GET_PRIVATE((object), PLUMA_TYPE_PLUGIN_LOADER_C, PlumaPluginLoaderCPrivate))
-
-struct _PlumaPluginLoaderCPrivate
-{
- GHashTable *loaded_plugins;
-};
-
-static void pluma_plugin_loader_iface_init (gpointer g_iface, gpointer iface_data);
-
-PLUMA_PLUGIN_LOADER_REGISTER_TYPE (PlumaPluginLoaderC, pluma_plugin_loader_c, G_TYPE_OBJECT, pluma_plugin_loader_iface_init);
-
-
-static const gchar *
-pluma_plugin_loader_iface_get_id (void)
-{
- return "C";
-}
-
-static PlumaPlugin *
-pluma_plugin_loader_iface_load (PlumaPluginLoader *loader,
- PlumaPluginInfo *info,
- const gchar *path)
-{
- PlumaPluginLoaderC *cloader = PLUMA_PLUGIN_LOADER_C (loader);
- PlumaObjectModule *module;
- const gchar *module_name;
- PlumaPlugin *result;
-
- module = (PlumaObjectModule *)g_hash_table_lookup (cloader->priv->loaded_plugins, info);
- module_name = pluma_plugin_info_get_module_name (info);
-
- if (module == NULL)
- {
- /* For now we force all modules to be resident */
- module = pluma_object_module_new (module_name,
- path,
- "register_pluma_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", pluma_plugin_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 = (PlumaPlugin *)pluma_object_module_new_object (module,
- "install-dir", path,
- "data-dir-name", module_name,
- NULL);
-
- if (!result)
- {
- g_warning ("Could not create plugin object: %s", pluma_plugin_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
-pluma_plugin_loader_iface_unload (PlumaPluginLoader *loader,
- PlumaPluginInfo *info)
-{
- //PlumaPluginLoaderC *cloader = PLUMA_PLUGIN_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
-pluma_plugin_loader_iface_init (gpointer g_iface,
- gpointer iface_data)
-{
- PlumaPluginLoaderInterface *iface = (PlumaPluginLoaderInterface *)g_iface;
-
- iface->get_id = pluma_plugin_loader_iface_get_id;
- iface->load = pluma_plugin_loader_iface_load;
- iface->unload = pluma_plugin_loader_iface_unload;
-}
-
-static void
-pluma_plugin_loader_c_finalize (GObject *object)
-{
- PlumaPluginLoaderC *cloader = PLUMA_PLUGIN_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)
- {
- PlumaPluginInfo *info = (PlumaPluginInfo *)item->data;
-
- if (pluma_plugin_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 (pluma_plugin_loader_c_parent_class)->finalize (object);
-}
-
-static void
-pluma_plugin_loader_c_class_init (PlumaPluginLoaderCClass *klass)
-{
- GObjectClass *object_class = G_OBJECT_CLASS (klass);
-
- object_class->finalize = pluma_plugin_loader_c_finalize;
-
- g_type_class_add_private (object_class, sizeof (PlumaPluginLoaderCPrivate));
-}
-
-static void
-pluma_plugin_loader_c_class_finalize (PlumaPluginLoaderCClass *klass)
-{
-}
-
-static void
-pluma_plugin_loader_c_init (PlumaPluginLoaderC *self)
-{
- self->priv = PLUMA_PLUGIN_LOADER_C_GET_PRIVATE (self);
-
- /* loaded_plugins maps PlumaPluginInfo to a PlumaObjectModule */
- self->priv->loaded_plugins = g_hash_table_new (g_direct_hash,
- g_direct_equal);
-}
-
-PlumaPluginLoaderC *
-pluma_plugin_loader_c_new ()
-{
- GObject *loader = g_object_new (PLUMA_TYPE_PLUGIN_LOADER_C, NULL);
-
- return PLUMA_PLUGIN_LOADER_C (loader);
-}
diff --git a/plugin-loaders/c/pluma-plugin-loader-c.h b/plugin-loaders/c/pluma-plugin-loader-c.h
deleted file mode 100644
index 431befb5..00000000
--- a/plugin-loaders/c/pluma-plugin-loader-c.h
+++ /dev/null
@@ -1,60 +0,0 @@
-/*
- * pluma-plugin-loader-c.h
- * This file is part of pluma
- *
- * 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., 51 Franklin St, Fifth Floor,
- * Boston, MA 02110-1301, USA.
- */
-
-#ifndef __PLUMA_PLUGIN_LOADER_C_H__
-#define __PLUMA_PLUGIN_LOADER_C_H__
-
-#include <pluma/pluma-plugin-loader.h>
-
-G_BEGIN_DECLS
-
-#define PLUMA_TYPE_PLUGIN_LOADER_C (pluma_plugin_loader_c_get_type ())
-#define PLUMA_PLUGIN_LOADER_C(obj) (G_TYPE_CHECK_INSTANCE_CAST ((obj), PLUMA_TYPE_PLUGIN_LOADER_C, PlumaPluginLoaderC))
-#define PLUMA_PLUGIN_LOADER_C_CONST(obj) (G_TYPE_CHECK_INSTANCE_CAST ((obj), PLUMA_TYPE_PLUGIN_LOADER_C, PlumaPluginLoaderC const))
-#define PLUMA_PLUGIN_LOADER_C_CLASS(klass) (G_TYPE_CHECK_CLASS_CAST ((klass), PLUMA_TYPE_PLUGIN_LOADER_C, PlumaPluginLoaderCClass))
-#define PLUMA_IS_PLUGIN_LOADER_C(obj) (G_TYPE_CHECK_INSTANCE_TYPE ((obj), PLUMA_TYPE_PLUGIN_LOADER_C))
-#define PLUMA_IS_PLUGIN_LOADER_C_CLASS(klass) (G_TYPE_CHECK_CLASS_TYPE ((klass), PLUMA_TYPE_PLUGIN_LOADER_C))
-#define PLUMA_PLUGIN_LOADER_C_GET_CLASS(obj) (G_TYPE_INSTANCE_GET_CLASS ((obj), PLUMA_TYPE_PLUGIN_LOADER_C, PlumaPluginLoaderCClass))
-
-typedef struct _PlumaPluginLoaderC PlumaPluginLoaderC;
-typedef struct _PlumaPluginLoaderCClass PlumaPluginLoaderCClass;
-typedef struct _PlumaPluginLoaderCPrivate PlumaPluginLoaderCPrivate;
-
-struct _PlumaPluginLoaderC {
- GObject parent;
-
- PlumaPluginLoaderCPrivate *priv;
-};
-
-struct _PlumaPluginLoaderCClass {
- GObjectClass parent_class;
-};
-
-GType pluma_plugin_loader_c_get_type (void) G_GNUC_CONST;
-PlumaPluginLoaderC *pluma_plugin_loader_c_new(void);
-
-/* All the loaders must implement this function */
-G_MODULE_EXPORT GType register_pluma_plugin_loader (GTypeModule * module);
-
-G_END_DECLS
-
-#endif /* __PLUMA_PLUGIN_LOADER_C_H__ */
diff --git a/plugins/changecase/Makefile.am b/plugins/changecase/Makefile.am
index 6b3a1cdd..5cb37347 100644
--- a/plugins/changecase/Makefile.am
+++ b/plugins/changecase/Makefile.am
@@ -19,11 +19,11 @@ libchangecase_la_LIBADD = $(PLUMA_LIBS)
uidir = $(PLUMA_PLUGINS_DATA_DIR)/changecase
ui_DATA =
-plugin_in_files = changecase.pluma-plugin.desktop.in
+plugin_in_files = changecase.plugin.desktop.in
-%.pluma-plugin: %.pluma-plugin.desktop.in $(INTLTOOL_MERGE) $(wildcard $(top_srcdir)/po/*po) ; $(INTLTOOL_MERGE) $(top_srcdir)/po $< $@ -d -u -c $(top_builddir)/po/.intltool-merge-cache
+%.plugin: %.plugin.desktop.in $(INTLTOOL_MERGE) $(wildcard $(top_srcdir)/po/*po) ; $(INTLTOOL_MERGE) $(top_srcdir)/po $< $@ -d -u -c $(top_builddir)/po/.intltool-merge-cache
-plugin_DATA = $(plugin_in_files:.pluma-plugin.desktop.in=.pluma-plugin)
+plugin_DATA = $(plugin_in_files:.plugin.desktop.in=.plugin)
EXTRA_DIST = $(ui_DATA) $(plugin_in_files)
diff --git a/plugins/changecase/changecase.pluma-plugin.desktop.in b/plugins/changecase/changecase.plugin.desktop.in
index d8383125..d1539d99 100644
--- a/plugins/changecase/changecase.pluma-plugin.desktop.in
+++ b/plugins/changecase/changecase.plugin.desktop.in
@@ -1,4 +1,4 @@
-[Pluma Plugin]
+[Plugin]
Module=changecase
IAge=2
_Name=Change Case
diff --git a/plugins/changecase/pluma-changecase-plugin.c b/plugins/changecase/pluma-changecase-plugin.c
index 03b86e04..65b938d9 100644
--- a/plugins/changecase/pluma-changecase-plugin.c
+++ b/plugins/changecase/pluma-changecase-plugin.c
@@ -28,12 +28,36 @@
#include <glib/gi18n-lib.h>
#include <gmodule.h>
+#include <libpeas/peas-activatable.h>
+#include <pluma/pluma-window.h>
#include <pluma/pluma-debug.h>
-#define WINDOW_DATA_KEY "PlumaChangecasePluginWindowData"
+#define PLUMA_CHANGECASE_PLUGIN_GET_PRIVATE(object)(G_TYPE_INSTANCE_GET_PRIVATE ((object), \
+ PLUMA_TYPE_CHANGECASE_PLUGIN, \
+ PlumaChangecasePluginPrivate))
-PLUMA_PLUGIN_REGISTER_TYPE(PlumaChangecasePlugin, pluma_changecase_plugin)
+static void peas_activatable_iface_init (PeasActivatableInterface *iface);
+
+G_DEFINE_DYNAMIC_TYPE_EXTENDED (PlumaChangecasePlugin,
+ pluma_changecase_plugin,
+ PEAS_TYPE_EXTENSION_BASE,
+ 0,
+ G_IMPLEMENT_INTERFACE_DYNAMIC (PEAS_TYPE_ACTIVATABLE,
+ peas_activatable_iface_init))
+
+struct _PlumaChangecasePluginPrivate
+{
+ GtkWidget *window;
+
+ GtkActionGroup *action_group;
+ guint ui_id;
+};
+
+enum {
+ PROP_0,
+ PROP_OBJECT
+};
typedef enum {
TO_UPPER_CASE,
@@ -250,44 +274,88 @@ const gchar submenu[] =
" </menubar>"
"</ui>";
+
static void
pluma_changecase_plugin_init (PlumaChangecasePlugin *plugin)
{
pluma_debug_message (DEBUG_PLUGINS, "PlumaChangecasePlugin initializing");
+
+ plugin->priv = PLUMA_CHANGECASE_PLUGIN_GET_PRIVATE (plugin);
}
static void
-pluma_changecase_plugin_finalize (GObject *object)
+pluma_changecase_plugin_dispose (GObject *object)
{
- G_OBJECT_CLASS (pluma_changecase_plugin_parent_class)->finalize (object);
+ PlumaChangecasePlugin *plugin = PLUMA_CHANGECASE_PLUGIN (object);
+
+ pluma_debug_message (DEBUG_PLUGINS, "PlumaChangecasePlugin disposing");
+
+ if (plugin->priv->window != NULL)
+ {
+ g_object_unref (plugin->priv->window);
+ plugin->priv->window = NULL;
+ }
+
+ if (plugin->priv->action_group != NULL)
+ {
+ g_object_unref (plugin->priv->action_group);
+ plugin->priv->action_group = NULL;
+ }
- pluma_debug_message (DEBUG_PLUGINS, "PlumaChangecasePlugin finalizing");
+ G_OBJECT_CLASS (pluma_changecase_plugin_parent_class)->dispose (object);
}
-typedef struct
+static void
+pluma_changecase_plugin_set_property (GObject *object,
+ guint prop_id,
+ const GValue *value,
+ GParamSpec *pspec)
{
- GtkActionGroup *action_group;
- guint ui_id;
-} WindowData;
+ PlumaChangecasePlugin *plugin = PLUMA_CHANGECASE_PLUGIN (object);
+
+ switch (prop_id)
+ {
+ case PROP_OBJECT:
+ plugin->priv->window = GTK_WIDGET (g_value_dup_object (value));
+ break;
+
+ default:
+ G_OBJECT_WARN_INVALID_PROPERTY_ID (object, prop_id, pspec);
+ break;
+ }
+}
static void
-free_window_data (WindowData *data)
+pluma_changecase_plugin_get_property (GObject *object,
+ guint prop_id,
+ GValue *value,
+ GParamSpec *pspec)
{
- g_return_if_fail (data != NULL);
+ PlumaChangecasePlugin *plugin = PLUMA_CHANGECASE_PLUGIN (object);
- g_slice_free (WindowData, data);
+ switch (prop_id)
+ {
+ case PROP_OBJECT:
+ g_value_set_object (value, plugin->priv->window);
+ break;
+
+ default:
+ G_OBJECT_WARN_INVALID_PROPERTY_ID (object, prop_id, pspec);
+ break;
+ }
}
static void
-update_ui_real (PlumaWindow *window,
- WindowData *data)
+update_ui (PlumaChangecasePluginPrivate *data)
{
+ PlumaWindow *window;
GtkTextView *view;
GtkAction *action;
gboolean sensitive = FALSE;
pluma_debug (DEBUG_PLUGINS);
+ window = PLUMA_WINDOW (data->window);
view = GTK_TEXT_VIEW (pluma_window_get_active_view (window));
if (view != NULL)
@@ -305,16 +373,17 @@ update_ui_real (PlumaWindow *window,
}
static void
-impl_activate (PlumaPlugin *plugin,
- PlumaWindow *window)
+pluma_changecase_plugin_activate (PeasActivatable *activatable)
{
+ PlumaChangecasePluginPrivate *data;
+ PlumaWindow *window;
GtkUIManager *manager;
- WindowData *data;
GError *error = NULL;
pluma_debug (DEBUG_PLUGINS);
- data = g_slice_new (WindowData);
+ data = PLUMA_CHANGECASE_PLUGIN (activatable)->priv;
+ window = PLUMA_WINDOW (data->window);
manager = pluma_window_get_ui_manager (window);
@@ -335,61 +404,72 @@ impl_activate (PlumaPlugin *plugin,
if (data->ui_id == 0)
{
g_warning ("%s", error->message);
- free_window_data (data);
return;
}
- g_object_set_data_full (G_OBJECT (window),
- WINDOW_DATA_KEY,
- data,
- (GDestroyNotify) free_window_data);
-
- update_ui_real (window, data);
+ update_ui (data);
}
static void
-impl_deactivate (PlumaPlugin *plugin,
- PlumaWindow *window)
+pluma_changecase_plugin_deactivate (PeasActivatable *activatable)
{
+ PlumaChangecasePluginPrivate *data;
+ PlumaWindow *window;
GtkUIManager *manager;
- WindowData *data;
pluma_debug (DEBUG_PLUGINS);
- manager = pluma_window_get_ui_manager (window);
+ data = PLUMA_CHANGECASE_PLUGIN (activatable)->priv;
+ window = PLUMA_WINDOW (data->window);
- data = (WindowData *) g_object_get_data (G_OBJECT (window), WINDOW_DATA_KEY);
- g_return_if_fail (data != NULL);
+ manager = pluma_window_get_ui_manager (window);
gtk_ui_manager_remove_ui (manager, data->ui_id);
gtk_ui_manager_remove_action_group (manager, data->action_group);
-
- g_object_set_data (G_OBJECT (window), WINDOW_DATA_KEY, NULL);
}
static void
-impl_update_ui (PlumaPlugin *plugin,
- PlumaWindow *window)
+pluma_changecase_plugin_update_state (PeasActivatable *activatable)
{
- WindowData *data;
-
pluma_debug (DEBUG_PLUGINS);
- data = (WindowData *) g_object_get_data (G_OBJECT (window), WINDOW_DATA_KEY);
- g_return_if_fail (data != NULL);
-
- update_ui_real (window, data);
+ update_ui (PLUMA_CHANGECASE_PLUGIN (activatable)->priv);
}
static void
pluma_changecase_plugin_class_init (PlumaChangecasePluginClass *klass)
{
GObjectClass *object_class = G_OBJECT_CLASS (klass);
- PlumaPluginClass *plugin_class = PLUMA_PLUGIN_CLASS (klass);
- object_class->finalize = pluma_changecase_plugin_finalize;
+ object_class->dispose = pluma_changecase_plugin_dispose;
+ object_class->set_property = pluma_changecase_plugin_set_property;
+ object_class->get_property = pluma_changecase_plugin_get_property;
+
+ g_object_class_override_property (object_class, PROP_OBJECT, "object");
+
+ g_type_class_add_private (klass, sizeof (PlumaChangecasePluginPrivate));
+}
+
+static void
+pluma_changecase_plugin_class_finalize (PlumaChangecasePluginClass *klass)
+{
+ /* dummy function - used by G_DEFINE_DYNAMIC_TYPE_EXTENDED */
+}
+
+static void
+peas_activatable_iface_init (PeasActivatableInterface *iface)
+{
+ iface->activate = pluma_changecase_plugin_activate;
+ iface->deactivate = pluma_changecase_plugin_deactivate;
+ iface->update_state = pluma_changecase_plugin_update_state;
+}
+
+G_MODULE_EXPORT void
+peas_register_types (PeasObjectModule *module)
+{
+ pluma_changecase_plugin_register_type (G_TYPE_MODULE (module));
- plugin_class->activate = impl_activate;
- plugin_class->deactivate = impl_deactivate;
- plugin_class->update_ui = impl_update_ui;
+ peas_object_module_register_extension_type (module,
+ PEAS_TYPE_ACTIVATABLE,
+ PLUMA_TYPE_CHANGECASE_PLUGIN);
}
diff --git a/plugins/changecase/pluma-changecase-plugin.h b/plugins/changecase/pluma-changecase-plugin.h
index b3d1016f..f610ac27 100644
--- a/plugins/changecase/pluma-changecase-plugin.h
+++ b/plugins/changecase/pluma-changecase-plugin.h
@@ -25,7 +25,8 @@
#include <glib.h>
#include <glib-object.h>
-#include <pluma/pluma-plugin.h>
+#include <libpeas/peas-extension-base.h>
+#include <libpeas/peas-object-module.h>
G_BEGIN_DECLS
@@ -39,6 +40,9 @@ G_BEGIN_DECLS
#define PLUMA_IS_CHANGECASE_PLUGIN_CLASS(k) (G_TYPE_CHECK_CLASS_TYPE ((k), PLUMA_TYPE_CHANGECASE_PLUGIN))
#define PLUMA_CHANGECASE_PLUGIN_GET_CLASS(o) (G_TYPE_INSTANCE_GET_CLASS ((o), PLUMA_TYPE_CHANGECASE_PLUGIN, PlumaChangecasePluginClass))
+/* Private structure type */
+typedef struct _PlumaChangecasePluginPrivate PlumaChangecasePluginPrivate;
+
/*
* Main object structure
*/
@@ -46,7 +50,10 @@ typedef struct _PlumaChangecasePlugin PlumaChangecasePlugin;
struct _PlumaChangecasePlugin
{
- PlumaPlugin parent_instance;
+ PeasExtensionBase parent_instance;
+
+ /*< private >*/
+ PlumaChangecasePluginPrivate *priv;
};
/*
@@ -56,7 +63,7 @@ typedef struct _PlumaChangecasePluginClass PlumaChangecasePluginClass;
struct _PlumaChangecasePluginClass
{
- PlumaPluginClass parent_class;
+ PeasExtensionBaseClass parent_class;
};
/*
@@ -65,7 +72,7 @@ struct _PlumaChangecasePluginClass
GType pluma_changecase_plugin_get_type (void) G_GNUC_CONST;
/* All the plugins must implement this function */
-G_MODULE_EXPORT GType register_pluma_plugin (GTypeModule *module);
+G_MODULE_EXPORT void peas_register_types (PeasObjectModule *module);
G_END_DECLS
diff --git a/plugins/docinfo/Makefile.am b/plugins/docinfo/Makefile.am
index ec9fc410..1e1b48e9 100644
--- a/plugins/docinfo/Makefile.am
+++ b/plugins/docinfo/Makefile.am
@@ -19,11 +19,11 @@ libdocinfo_la_LIBADD = $(PLUMA_LIBS)
uidir = $(PLUMA_PLUGINS_DATA_DIR)/docinfo
ui_DATA = docinfo.ui
-plugin_in_files = docinfo.pluma-plugin.desktop.in
+plugin_in_files = docinfo.plugin.desktop.in
-%.pluma-plugin: %.pluma-plugin.desktop.in $(INTLTOOL_MERGE) $(wildcard $(top_srcdir)/po/*po) ; $(INTLTOOL_MERGE) $(top_srcdir)/po $< $@ -d -u -c $(top_builddir)/po/.intltool-merge-cache
+%.plugin: %.plugin.desktop.in $(INTLTOOL_MERGE) $(wildcard $(top_srcdir)/po/*po) ; $(INTLTOOL_MERGE) $(top_srcdir)/po $< $@ -d -u -c $(top_builddir)/po/.intltool-merge-cache
-plugin_DATA = $(plugin_in_files:.pluma-plugin.desktop.in=.pluma-plugin)
+plugin_DATA = $(plugin_in_files:.plugin.desktop.in=.plugin)
EXTRA_DIST = $(ui_DATA) $(plugin_in_files)
diff --git a/plugins/docinfo/docinfo.pluma-plugin.desktop.in b/plugins/docinfo/docinfo.plugin.desktop.in
index 990f2cd6..b4da32b0 100644
--- a/plugins/docinfo/docinfo.pluma-plugin.desktop.in
+++ b/plugins/docinfo/docinfo.plugin.desktop.in
@@ -1,4 +1,4 @@
-[Pluma Plugin]
+[Plugin]
Module=docinfo
IAge=2
_Name=Document Statistics
diff --git a/plugins/docinfo/pluma-docinfo-plugin.c b/plugins/docinfo/pluma-docinfo-plugin.c
index 520274bb..fbe1ea22 100644
--- a/plugins/docinfo/pluma-docinfo-plugin.c
+++ b/plugins/docinfo/pluma-docinfo-plugin.c
@@ -31,14 +31,26 @@
#include <glib/gi18n-lib.h>
#include <pango/pango-break.h>
#include <gmodule.h>
+#include <libpeas/peas-activatable.h>
+#include <pluma/pluma-window.h>
#include <pluma/pluma-debug.h>
#include <pluma/pluma-utils.h>
-#define WINDOW_DATA_KEY "PlumaDocInfoWindowData"
#define MENU_PATH "/MenuBar/ToolsMenu/ToolsOps_2"
-PLUMA_PLUGIN_REGISTER_TYPE(PlumaDocInfoPlugin, pluma_docinfo_plugin)
+#define PLUMA_DOCINFO_PLUGIN_GET_PRIVATE(object)(G_TYPE_INSTANCE_GET_PRIVATE ((object), \
+ PLUMA_TYPE_DOCINFO_PLUGIN, \
+ PlumaDocInfoPluginPrivate))
+
+static void peas_activatable_iface_init (PeasActivatableInterface *iface);
+
+G_DEFINE_DYNAMIC_TYPE_EXTENDED (PlumaDocInfoPlugin,
+ pluma_docinfo_plugin,
+ PEAS_TYPE_EXTENSION_BASE,
+ 0,
+ G_IMPLEMENT_INTERFACE_DYNAMIC (PEAS_TYPE_ACTIVATABLE,
+ peas_activatable_iface_init))
typedef struct
{
@@ -57,23 +69,28 @@ typedef struct
GtkWidget *selected_bytes_label;
} DocInfoDialog;
-typedef struct
+struct _PlumaDocInfoPluginPrivate
{
- PlumaPlugin *plugin;
+ GtkWidget *window;
GtkActionGroup *ui_action_group;
guint ui_id;
DocInfoDialog *dialog;
-} WindowData;
+};
+
+enum {
+ PROP_0,
+ PROP_OBJECT
+};
static void docinfo_dialog_response_cb (GtkDialog *widget,
gint res_id,
- PlumaWindow *window);
+ PlumaDocInfoPluginPrivate *data);
static void
docinfo_dialog_destroy_cb (GObject *obj,
- WindowData *data)
+ PlumaDocInfoPluginPrivate *data)
{
pluma_debug (DEBUG_PLUGINS);
@@ -85,9 +102,10 @@ docinfo_dialog_destroy_cb (GObject *obj,
}
static DocInfoDialog *
-get_docinfo_dialog (PlumaWindow *window,
- WindowData *data)
+get_docinfo_dialog (PlumaDocInfoPlugin *plugin)
{
+ PlumaDocInfoPluginPrivate *data;
+ PlumaWindow *window;
DocInfoDialog *dialog;
gchar *data_dir;
gchar *ui_file;
@@ -97,9 +115,12 @@ get_docinfo_dialog (PlumaWindow *window,
pluma_debug (DEBUG_PLUGINS);
+ data = plugin->priv;
+ window = PLUMA_WINDOW (data->window);
+
dialog = g_new (DocInfoDialog, 1);
- data_dir = pluma_plugin_get_data_dir (data->plugin);
+ data_dir = peas_extension_base_get_data_dir (PEAS_EXTENSION_BASE (plugin));
ui_file = g_build_filename (data_dir, "docinfo.ui", NULL);
ret = pluma_utils_get_ui_objects (ui_file,
NULL,
@@ -149,7 +170,7 @@ get_docinfo_dialog (PlumaWindow *window,
g_signal_connect (dialog->dialog,
"response",
G_CALLBACK (docinfo_dialog_response_cb),
- window);
+ data);
return dialog;
}
@@ -338,16 +359,16 @@ selectioninfo_real (PlumaDocument *doc,
static void
docinfo_cb (GtkAction *action,
- PlumaWindow *window)
+ PlumaDocInfoPlugin *plugin)
{
+ PlumaDocInfoPluginPrivate *data;
+ PlumaWindow *window;
PlumaDocument *doc;
- WindowData *data;
pluma_debug (DEBUG_PLUGINS);
- data = (WindowData *) g_object_get_data (G_OBJECT (window),
- WINDOW_DATA_KEY);
-
+ data = plugin->priv;
+ window = PLUMA_WINDOW (data->window);
doc = pluma_window_get_active_document (window);
g_return_if_fail (doc != NULL);
@@ -360,7 +381,7 @@ docinfo_cb (GtkAction *action,
{
DocInfoDialog *dialog;
- dialog = get_docinfo_dialog (window, data);
+ dialog = get_docinfo_dialog (plugin);
g_return_if_fail (dialog != NULL);
data->dialog = dialog;
@@ -377,14 +398,13 @@ docinfo_cb (GtkAction *action,
static void
docinfo_dialog_response_cb (GtkDialog *widget,
gint res_id,
- PlumaWindow *window)
+ PlumaDocInfoPluginPrivate *data)
{
- WindowData *data;
+ PlumaWindow *window;
pluma_debug (DEBUG_PLUGINS);
-
- data = (WindowData *) g_object_get_data (G_OBJECT (window),
- WINDOW_DATA_KEY);
+
+ window = PLUMA_WINDOW (data->window);
switch (res_id)
{
@@ -427,37 +447,19 @@ static const GtkActionEntry action_entries[] =
};
static void
-free_window_data (WindowData *data)
-{
- g_return_if_fail (data != NULL);
-
- pluma_debug (DEBUG_PLUGINS);
-
- g_object_unref (data->plugin);
-
- g_object_unref (data->ui_action_group);
-
- if (data->dialog != NULL)
- {
- gtk_widget_destroy (data->dialog->dialog);
- }
-
- g_free (data);
-}
-
-static void
-update_ui_real (PlumaWindow *window,
- WindowData *data)
+update_ui (PlumaDocInfoPluginPrivate *data)
{
+ PlumaWindow *window;
PlumaView *view;
pluma_debug (DEBUG_PLUGINS);
+ window = PLUMA_WINDOW (data->window);
view = pluma_window_get_active_view (window);
gtk_action_group_set_sensitive (data->ui_action_group,
(view != NULL));
-
+
if (data->dialog != NULL)
{
gtk_dialog_set_response_sensitive (GTK_DIALOG (data->dialog->dialog),
@@ -470,28 +472,86 @@ static void
pluma_docinfo_plugin_init (PlumaDocInfoPlugin *plugin)
{
pluma_debug_message (DEBUG_PLUGINS, "PlumaDocInfoPlugin initializing");
+
+ plugin->priv = PLUMA_DOCINFO_PLUGIN_GET_PRIVATE (plugin);
+}
+
+static void
+pluma_docinfo_plugin_dispose (GObject *object)
+{
+ PlumaDocInfoPlugin *plugin = PLUMA_DOCINFO_PLUGIN (object);
+
+ pluma_debug_message (DEBUG_PLUGINS, "PlumaDocInfoPlugin disposing");
+
+ if (plugin->priv->window != NULL)
+ {
+ g_object_unref (plugin->priv->window);
+ plugin->priv->window = NULL;
+ }
+
+ if (plugin->priv->ui_action_group != NULL)
+ {
+ g_object_unref (plugin->priv->ui_action_group);
+ plugin->priv->ui_action_group = NULL;
+ }
+
+ G_OBJECT_CLASS (pluma_docinfo_plugin_parent_class)->dispose (object);
+}
+
+static void
+pluma_docinfo_plugin_set_property (GObject *object,
+ guint prop_id,
+ const GValue *value,
+ GParamSpec *pspec)
+{
+ PlumaDocInfoPlugin *plugin = PLUMA_DOCINFO_PLUGIN (object);
+
+ switch (prop_id)
+ {
+ case PROP_OBJECT:
+ plugin->priv->window = GTK_WIDGET (g_value_dup_object (value));
+ break;
+
+ default:
+ G_OBJECT_WARN_INVALID_PROPERTY_ID (object, prop_id, pspec);
+ break;
+ }
}
static void
-pluma_docinfo_plugin_finalize (GObject *object)
+pluma_docinfo_plugin_get_property (GObject *object,
+ guint prop_id,
+ GValue *value,
+ GParamSpec *pspec)
{
- pluma_debug_message (DEBUG_PLUGINS, "PlumaDocInfoPlugin finalizing");
+ PlumaDocInfoPlugin *plugin = PLUMA_DOCINFO_PLUGIN (object);
- G_OBJECT_CLASS (pluma_docinfo_plugin_parent_class)->finalize (object);
+ switch (prop_id)
+ {
+ case PROP_OBJECT:
+ g_value_set_object (value, plugin->priv->window);
+ break;
+
+ default:
+ G_OBJECT_WARN_INVALID_PROPERTY_ID (object, prop_id, pspec);
+ break;
+ }
}
static void
-impl_activate (PlumaPlugin *plugin,
- PlumaWindow *window)
+pluma_docinfo_plugin_activate (PeasActivatable *activatable)
{
+ PlumaDocInfoPlugin *plugin;
+ PlumaDocInfoPluginPrivate *data;
+ PlumaWindow *window;
GtkUIManager *manager;
- WindowData *data;
pluma_debug (DEBUG_PLUGINS);
- data = g_new (WindowData, 1);
+ plugin = PLUMA_DOCINFO_PLUGIN (activatable);
+ data = plugin->priv;
+ window = PLUMA_WINDOW (data->window);
- data->plugin = g_object_ref (plugin);
data->dialog = NULL;
data->ui_action_group = gtk_action_group_new ("PlumaDocInfoPluginActions");
@@ -500,7 +560,7 @@ impl_activate (PlumaPlugin *plugin,
gtk_action_group_add_actions (data->ui_action_group,
action_entries,
G_N_ELEMENTS (action_entries),
- window);
+ plugin);
manager = pluma_window_get_ui_manager (window);
gtk_ui_manager_insert_action_group (manager,
@@ -509,11 +569,6 @@ impl_activate (PlumaPlugin *plugin,
data->ui_id = gtk_ui_manager_new_merge_id (manager);
- g_object_set_data_full (G_OBJECT (window),
- WINDOW_DATA_KEY,
- data,
- (GDestroyNotify) free_window_data);
-
gtk_ui_manager_add_ui (manager,
data->ui_id,
MENU_PATH,
@@ -522,60 +577,71 @@ impl_activate (PlumaPlugin *plugin,
GTK_UI_MANAGER_MENUITEM,
FALSE);
- update_ui_real (window,
- data);
+ update_ui (data);
}
static void
-impl_deactivate (PlumaPlugin *plugin,
- PlumaWindow *window)
+pluma_docinfo_plugin_deactivate (PeasActivatable *activatable)
{
+ PlumaDocInfoPluginPrivate *data;
+ PlumaWindow *window;
GtkUIManager *manager;
- WindowData *data;
pluma_debug (DEBUG_PLUGINS);
- manager = pluma_window_get_ui_manager (window);
+ data = PLUMA_DOCINFO_PLUGIN (activatable)->priv;
+ window = PLUMA_WINDOW (data->window);
- data = (WindowData *) g_object_get_data (G_OBJECT (window),
- WINDOW_DATA_KEY);
- g_return_if_fail (data != NULL);
+ manager = pluma_window_get_ui_manager (window);
gtk_ui_manager_remove_ui (manager,
data->ui_id);
gtk_ui_manager_remove_action_group (manager,
data->ui_action_group);
-
- g_object_set_data (G_OBJECT (window),
- WINDOW_DATA_KEY,
- NULL);
}
static void
-impl_update_ui (PlumaPlugin *plugin,
- PlumaWindow *window)
+pluma_docinfo_plugin_update_state (PeasActivatable *activatable)
{
- WindowData *data;
-
pluma_debug (DEBUG_PLUGINS);
- data = (WindowData *) g_object_get_data (G_OBJECT (window),
- WINDOW_DATA_KEY);
- g_return_if_fail (data != NULL);
-
- update_ui_real (window,
- data);
+ update_ui (PLUMA_DOCINFO_PLUGIN (activatable)->priv);
}
static void
pluma_docinfo_plugin_class_init (PlumaDocInfoPluginClass *klass)
{
GObjectClass *object_class = G_OBJECT_CLASS (klass);
- PlumaPluginClass *plugin_class = PLUMA_PLUGIN_CLASS (klass);
- object_class->finalize = pluma_docinfo_plugin_finalize;
+ object_class->dispose = pluma_docinfo_plugin_dispose;
+ object_class->set_property = pluma_docinfo_plugin_set_property;
+ object_class->get_property = pluma_docinfo_plugin_get_property;
+
+ g_object_class_override_property (object_class, PROP_OBJECT, "object");
+
+ g_type_class_add_private (klass, sizeof (PlumaDocInfoPluginPrivate));
+}
+
+static void
+pluma_docinfo_plugin_class_finalize (PlumaDocInfoPluginClass *klass)
+{
+ /* dummy function - used by G_DEFINE_DYNAMIC_TYPE_EXTENDED */
+}
+
+static void
+peas_activatable_iface_init (PeasActivatableInterface *iface)
+{
+ iface->activate = pluma_docinfo_plugin_activate;
+ iface->deactivate = pluma_docinfo_plugin_deactivate;
+ iface->update_state = pluma_docinfo_plugin_update_state;
+}
+
+G_MODULE_EXPORT void
+peas_register_types (PeasObjectModule *module)
+{
+ pluma_docinfo_plugin_register_type (G_TYPE_MODULE (module));
- plugin_class->activate = impl_activate;
- plugin_class->deactivate = impl_deactivate;
- plugin_class->update_ui = impl_update_ui;
+ peas_object_module_register_extension_type (module,
+ PEAS_TYPE_ACTIVATABLE,
+ PLUMA_TYPE_DOCINFO_PLUGIN);
}
diff --git a/plugins/docinfo/pluma-docinfo-plugin.h b/plugins/docinfo/pluma-docinfo-plugin.h
index 7b8fe272..5476e4fb 100644
--- a/plugins/docinfo/pluma-docinfo-plugin.h
+++ b/plugins/docinfo/pluma-docinfo-plugin.h
@@ -25,7 +25,8 @@
#include <glib.h>
#include <glib-object.h>
-#include <pluma/pluma-plugin.h>
+#include <libpeas/peas-extension-base.h>
+#include <libpeas/peas-object-module.h>
G_BEGIN_DECLS
@@ -49,7 +50,10 @@ typedef struct _PlumaDocInfoPlugin PlumaDocInfoPlugin;
struct _PlumaDocInfoPlugin
{
- PlumaPlugin parent_instance;
+ PeasExtensionBase parent_instance;
+
+ /*< private >*/
+ PlumaDocInfoPluginPrivate *priv;
};
/*
@@ -59,7 +63,7 @@ typedef struct _PlumaDocInfoPluginClass PlumaDocInfoPluginClass;
struct _PlumaDocInfoPluginClass
{
- PlumaPluginClass parent_class;
+ PeasExtensionBaseClass parent_class;
};
/*
@@ -68,7 +72,7 @@ struct _PlumaDocInfoPluginClass
GType pluma_docinfo_plugin_get_type (void) G_GNUC_CONST;
/* All the plugins must implement this function */
-G_MODULE_EXPORT GType register_pluma_plugin (GTypeModule *module);
+G_MODULE_EXPORT void peas_register_types (PeasObjectModule *module);
G_END_DECLS
diff --git a/plugins/externaltools/tools/library.py b/plugins/externaltools/tools/library.py
index 039e0a50..09a0cd42 100755
--- a/plugins/externaltools/tools/library.py
+++ b/plugins/externaltools/tools/library.py
@@ -19,7 +19,6 @@
import os
import re
import locale
-import platform
class Singleton(object):
_instance = None
@@ -39,22 +38,13 @@ class ToolLibrary(Singleton):
def set_locations(self, datadir):
self.locations = []
- if platform.platform() != 'Windows':
- for d in self.get_xdg_data_dirs():
- self.locations.append(os.path.join(d, 'pluma', 'plugins', 'externaltools', 'tools'))
+ for d in self.get_xdg_data_dirs():
+ self.locations.append(os.path.join(d, 'pluma', 'plugins', 'externaltools', 'tools'))
self.locations.append(datadir)
# self.locations[0] is where we save the custom scripts
- if platform.platform() == 'Windows':
- toolsdir = os.path.expanduser('~/pluma/tools')
- else:
- userdir = os.getenv('MATE22_USER_DIR')
- if userdir:
- toolsdir = os.path.join(userdir, 'pluma/tools')
- else:
- toolsdir = os.path.expanduser('~/.config/pluma/tools')
-
+ toolsdir = os.path.expanduser('~/.config/pluma/tools')
self.locations.insert(0, toolsdir);
if not os.path.isdir(self.locations[0]):
@@ -78,11 +68,7 @@ class ToolLibrary(Singleton):
# storage file.
def import_old_xml_store(self):
import xml.etree.ElementTree as et
- userdir = os.getenv('MATE22_USER_DIR')
- if userdir:
- filename = os.path.join(userdir, 'pluma/pluma-tools.xml')
- else:
- filename = os.path.expanduser('~/.config/pluma/pluma-tools.xml')
+ filename = os.path.expanduser('~/.config/pluma/pluma-tools.xml')
if not os.path.isfile(filename):
return
diff --git a/plugins/filebrowser/Makefile.am b/plugins/filebrowser/Makefile.am
index 3b494cdf..faa554ec 100644
--- a/plugins/filebrowser/Makefile.am
+++ b/plugins/filebrowser/Makefile.am
@@ -44,9 +44,9 @@ libfilebrowser_la_LIBADD = $(PLUMA_LIBS)
uidir = $(PLUMA_PLUGINS_DATA_DIR)/filebrowser
ui_DATA = pluma-file-browser-widget-ui.xml
-plugin_in_files = filebrowser.pluma-plugin.desktop.in
+plugin_in_files = filebrowser.plugin.desktop.in
-%.pluma-plugin: %.pluma-plugin.desktop.in $(INTLTOOL_MERGE) $(wildcard $(top_srcdir)/po/*po) ; $(INTLTOOL_MERGE) $(top_srcdir)/po $< $@ -d -u -c $(top_builddir)/po/.intltool-merge-cache
+%.plugin: %.plugin.desktop.in $(INTLTOOL_MERGE) $(wildcard $(top_srcdir)/po/*po) ; $(INTLTOOL_MERGE) $(top_srcdir)/po $< $@ -d -u -c $(top_builddir)/po/.intltool-merge-cache
pluma-file-browser-enum-types.h: pluma-file-browser-enum-types.h.template $(NOINST_H_FILES) $(GLIB_MKENUMS)
(cd $(srcdir) && $(GLIB_MKENUMS) --template pluma-file-browser-enum-types.h.template $(NOINST_H_FILES)) > $@
@@ -63,7 +63,7 @@ pluma-file-browser-marshal.c: pluma-file-browser-marshal.list $(GLIB_GENMARSHAL)
$(AM_V_GEN) echo "#include \"pluma-file-browser-marshal.h\"" > $@ && \
$(GLIB_GENMARSHAL) $< --body --prefix=pluma_file_browser_marshal >> $@
-plugin_DATA = $(plugin_in_files:.pluma-plugin.desktop.in=.pluma-plugin)
+plugin_DATA = $(plugin_in_files:.plugin.desktop.in=.plugin)
@INTLTOOL_XML_NOMERGE_RULE@
filebrowser_gschema_in = org.mate.pluma.plugins.filebrowser.gschema.xml.in
diff --git a/plugins/filebrowser/filebrowser.pluma-plugin.desktop.in b/plugins/filebrowser/filebrowser.plugin.desktop.in
index 02668983..625f2d01 100644
--- a/plugins/filebrowser/filebrowser.pluma-plugin.desktop.in
+++ b/plugins/filebrowser/filebrowser.plugin.desktop.in
@@ -1,4 +1,4 @@
-[Pluma Plugin]
+[Plugin]
Loader=C
Module=filebrowser
IAge=2
diff --git a/plugins/filebrowser/pluma-file-bookmarks-store.c b/plugins/filebrowser/pluma-file-bookmarks-store.c
index d1d8b53d..073d6bb3 100644
--- a/plugins/filebrowser/pluma-file-bookmarks-store.c
+++ b/plugins/filebrowser/pluma-file-bookmarks-store.c
@@ -23,7 +23,6 @@
#include <glib/gi18n.h>
#include <gio/gio.h>
#include <pluma/pluma-utils.h>
-#include <pluma/pluma-plugin.h>
#include "pluma-file-bookmarks-store.h"
#include "pluma-file-browser-utils.h"
@@ -56,7 +55,7 @@ static gboolean find_with_flags (GtkTreeModel * model,
guint flags,
guint notflags);
-PLUMA_PLUGIN_DEFINE_TYPE(PlumaFileBookmarksStore, pluma_file_bookmarks_store, GTK_TYPE_TREE_STORE)
+G_DEFINE_DYNAMIC_TYPE (PlumaFileBookmarksStore, pluma_file_bookmarks_store, GTK_TYPE_TREE_STORE)
static void
pluma_file_bookmarks_store_dispose (GObject * object)
@@ -98,6 +97,12 @@ pluma_file_bookmarks_store_class_init (PlumaFileBookmarksStoreClass *klass)
}
static void
+pluma_file_bookmarks_store_class_finalize (PlumaFileBookmarksStoreClass *klass)
+{
+ /* dummy function - used by G_DEFINE_DYNAMIC_TYPE */
+}
+
+static void
pluma_file_bookmarks_store_init (PlumaFileBookmarksStore * obj)
{
obj->priv = PLUMA_FILE_BOOKMARKS_STORE_GET_PRIVATE (obj);
@@ -876,4 +881,10 @@ on_bookmarks_file_changed (GFileMonitor * monitor,
}
}
+void
+_pluma_file_bookmarks_store_register_type (GTypeModule *type_module)
+{
+ pluma_file_bookmarks_store_register_type (type_module);
+}
+
// ex:ts=8:noet:
diff --git a/plugins/filebrowser/pluma-file-bookmarks-store.h b/plugins/filebrowser/pluma-file-bookmarks-store.h
index 6bd9fcf9..4c368db6 100644
--- a/plugins/filebrowser/pluma-file-bookmarks-store.h
+++ b/plugins/filebrowser/pluma-file-bookmarks-store.h
@@ -77,7 +77,7 @@ struct _PlumaFileBookmarksStoreClass
};
GType pluma_file_bookmarks_store_get_type (void) G_GNUC_CONST;
-GType pluma_file_bookmarks_store_register_type (GTypeModule * module);
+void _pluma_file_bookmarks_store_register_type (GTypeModule * module);
PlumaFileBookmarksStore *pluma_file_bookmarks_store_new (void);
gchar *pluma_file_bookmarks_store_get_uri (PlumaFileBookmarksStore * model,
diff --git a/plugins/filebrowser/pluma-file-browser-plugin.c b/plugins/filebrowser/pluma-file-browser-plugin.c
index 750b2be0..b619309e 100644
--- a/plugins/filebrowser/pluma-file-browser-plugin.c
+++ b/plugins/filebrowser/pluma-file-browser-plugin.c
@@ -28,9 +28,11 @@
#include <pluma/pluma-utils.h>
#include <pluma/pluma-app.h>
#include <glib/gi18n-lib.h>
+#include <pluma/pluma-window.h>
#include <pluma/pluma-debug.h>
#include <gio/gio.h>
#include <string.h>
+#include <libpeas/peas-activatable.h>
#include "pluma-file-browser-enum-types.h"
#include "pluma-file-browser-plugin.h"
@@ -39,8 +41,6 @@
#include "pluma-file-browser-widget.h"
#include "pluma-file-browser-messages.h"
-#define WINDOW_DATA_KEY "PlumaFileBrowserPluginWindowData"
-
#define FILE_BROWSER_SCHEMA "org.mate.pluma.plugins.filebrowser"
#define FILE_BROWSER_ONLOAD_SCHEMA "org.mate.pluma.plugins.filebrowser.on-load"
#define CAJA_SCHEMA "org.mate.caja.preferences"
@@ -54,11 +54,8 @@
struct _PlumaFileBrowserPluginPrivate
{
- gpointer *dummy;
-};
+ GtkWidget *window;
-typedef struct _PlumaFileBrowserPluginData
-{
PlumaFileBrowserWidget * tree_widget;
gulong merge_id;
GtkActionGroup * action_group;
@@ -71,7 +68,12 @@ typedef struct _PlumaFileBrowserPluginData
GSettings *onload_settings;
GSettings *caja_settings;
GSettings *terminal_settings;
-} PlumaFileBrowserPluginData;
+};
+
+enum {
+ PROP_0,
+ PROP_OBJECT
+};
static void on_uri_activated_cb (PlumaFileBrowserWidget * widget,
gchar const *uri,
@@ -79,67 +81,114 @@ static void on_uri_activated_cb (PlumaFileBrowserWidget * widget,
static void on_error_cb (PlumaFileBrowserWidget * widget,
guint code,
gchar const *message,
- PlumaWindow * window);
+ PlumaFileBrowserPluginPrivate * data);
static void on_model_set_cb (PlumaFileBrowserView * widget,
GParamSpec *arg1,
- PlumaWindow * window);
+ PlumaFileBrowserPluginPrivate * data);
static void on_virtual_root_changed_cb (PlumaFileBrowserStore * model,
GParamSpec * param,
- PlumaWindow * window);
+ PlumaFileBrowserPluginPrivate * data);
static void on_filter_mode_changed_cb (PlumaFileBrowserStore * model,
GParamSpec * param,
- PlumaWindow * window);
+ PlumaFileBrowserPluginPrivate * data);
static void on_rename_cb (PlumaFileBrowserStore * model,
const gchar * olduri,
const gchar * newuri,
PlumaWindow * window);
static void on_filter_pattern_changed_cb (PlumaFileBrowserWidget * widget,
GParamSpec * param,
- PlumaWindow * window);
+ PlumaFileBrowserPluginPrivate * data);
static void on_tab_added_cb (PlumaWindow * window,
PlumaTab * tab,
- PlumaFileBrowserPluginData * data);
+ PlumaFileBrowserPluginPrivate * data);
static gboolean on_confirm_delete_cb (PlumaFileBrowserWidget * widget,
PlumaFileBrowserStore * store,
GList * rows,
- PlumaWindow * window);
+ PlumaFileBrowserPluginPrivate * data);
static gboolean on_confirm_no_trash_cb (PlumaFileBrowserWidget * widget,
GList * files,
PlumaWindow * window);
-PLUMA_PLUGIN_REGISTER_TYPE_WITH_CODE (PlumaFileBrowserPlugin, filetree_plugin, \
- pluma_file_browser_enum_and_flag_register_type (type_module); \
- pluma_file_browser_store_register_type (type_module); \
- pluma_file_bookmarks_store_register_type (type_module); \
- pluma_file_browser_view_register_type (type_module); \
- pluma_file_browser_widget_register_type (type_module); \
+static void peas_activatable_iface_init (PeasActivatableInterface *iface);
+
+G_DEFINE_DYNAMIC_TYPE_EXTENDED (PlumaFileBrowserPlugin,
+ pluma_file_browser_plugin,
+ PEAS_TYPE_EXTENSION_BASE,
+ 0,
+ G_IMPLEMENT_INTERFACE_DYNAMIC (PEAS_TYPE_ACTIVATABLE,
+ peas_activatable_iface_init) \
+ \
+ pluma_file_browser_enum_and_flag_register_type (type_module); \
+ _pluma_file_browser_store_register_type (type_module); \
+ _pluma_file_bookmarks_store_register_type (type_module); \
+ _pluma_file_browser_view_register_type (type_module); \
+ _pluma_file_browser_widget_register_type (type_module); \
)
-
static void
-filetree_plugin_init (PlumaFileBrowserPlugin * plugin)
+pluma_file_browser_plugin_init (PlumaFileBrowserPlugin * plugin)
{
plugin->priv = PLUMA_FILE_BROWSER_PLUGIN_GET_PRIVATE (plugin);
}
static void
-filetree_plugin_finalize (GObject * object)
+pluma_file_browser_plugin_dispose (GObject * object)
+{
+ PlumaFileBrowserPlugin *plugin = PLUMA_FILE_BROWSER_PLUGIN (object);
+
+ if (plugin->priv->window != NULL)
+ {
+ g_object_unref (plugin->priv->window);
+ plugin->priv->window = NULL;
+ }
+
+ G_OBJECT_CLASS (pluma_file_browser_plugin_parent_class)->dispose (object);
+}
+
+static void
+pluma_file_browser_plugin_set_property (GObject *object,
+ guint prop_id,
+ const GValue *value,
+ GParamSpec *pspec)
{
- //PlumaFileBrowserPlugin * plugin = PLUMA_FILE_BROWSER_PLUGIN (object);
+ PlumaFileBrowserPlugin *plugin = PLUMA_FILE_BROWSER_PLUGIN (object);
+
+ switch (prop_id)
+ {
+ case PROP_OBJECT:
+ plugin->priv->window = GTK_WIDGET (g_value_dup_object (value));
+ break;
- G_OBJECT_CLASS (filetree_plugin_parent_class)->finalize (object);
+ default:
+ G_OBJECT_WARN_INVALID_PROPERTY_ID (object, prop_id, pspec);
+ break;
+ }
}
-static PlumaFileBrowserPluginData *
-get_plugin_data (PlumaWindow * window)
+static void
+pluma_file_browser_plugin_get_property (GObject *object,
+ guint prop_id,
+ GValue *value,
+ GParamSpec *pspec)
{
- return (PlumaFileBrowserPluginData *) (g_object_get_data (G_OBJECT (window), WINDOW_DATA_KEY));
+ PlumaFileBrowserPlugin *plugin = PLUMA_FILE_BROWSER_PLUGIN (object);
+
+ switch (prop_id)
+ {
+ case PROP_OBJECT:
+ g_value_set_object (value, plugin->priv->window);
+ break;
+
+ default:
+ G_OBJECT_WARN_INVALID_PROPERTY_ID (object, prop_id, pspec);
+ break;
+ }
}
static void
on_end_loading_cb (PlumaFileBrowserStore * store,
GtkTreeIter * iter,
- PlumaFileBrowserPluginData * data)
+ PlumaFileBrowserPluginPrivate * data)
{
/* Disconnect the signal */
g_signal_handler_disconnect (store, data->end_loading_handle);
@@ -148,7 +197,7 @@ on_end_loading_cb (PlumaFileBrowserStore * store,
}
static void
-prepare_auto_root (PlumaFileBrowserPluginData *data)
+prepare_auto_root (PlumaFileBrowserPluginPrivate *data)
{
PlumaFileBrowserStore *store;
@@ -168,7 +217,7 @@ prepare_auto_root (PlumaFileBrowserPluginData *data)
}
static void
-restore_default_location (PlumaFileBrowserPluginData *data)
+restore_default_location (PlumaFileBrowserPluginPrivate *data)
{
gchar * root;
gchar * virtual_root;
@@ -214,7 +263,7 @@ restore_default_location (PlumaFileBrowserPluginData *data)
}
static void
-restore_filter (PlumaFileBrowserPluginData * data)
+restore_filter (PlumaFileBrowserPluginPrivate *data)
{
gchar *filter_mode;
PlumaFileBrowserStoreFilterMode mode;
@@ -269,12 +318,12 @@ on_click_policy_changed (GSettings *settings,
gchar *key,
gpointer user_data)
{
- PlumaFileBrowserPluginData * data;
+ PlumaFileBrowserPluginPrivate * data;
gchar *click_policy;
PlumaFileBrowserViewClickPolicy policy = PLUMA_FILE_BROWSER_VIEW_CLICK_POLICY_DOUBLE;
PlumaFileBrowserView *view;
- data = (PlumaFileBrowserPluginData *)(user_data);
+ data = (PlumaFileBrowserPluginPrivate *)(user_data);
click_policy = g_settings_get_string (settings, key);
policy = click_policy_from_string (click_policy);
@@ -289,10 +338,10 @@ on_enable_delete_changed (GSettings *settings,
gchar *key,
gpointer user_data)
{
- PlumaFileBrowserPluginData *data;
+ PlumaFileBrowserPluginPrivate *data;
gboolean enable = FALSE;
- data = (PlumaFileBrowserPluginData *)(user_data);
+ data = (PlumaFileBrowserPluginPrivate *)(user_data);
enable = g_settings_get_boolean (settings, key);
g_object_set (G_OBJECT (data->tree_widget), "enable-delete", enable, NULL);
@@ -303,10 +352,10 @@ on_confirm_trash_changed (GSettings *settings,
gchar *key,
gpointer user_data)
{
- PlumaFileBrowserPluginData *data;
+ PlumaFileBrowserPluginPrivate *data;
gboolean enable = FALSE;
- data = (PlumaFileBrowserPluginData *)(user_data);
+ data = (PlumaFileBrowserPluginPrivate *)(user_data);
enable = g_settings_get_boolean (settings, key);
data->confirm_trash = enable;
@@ -325,7 +374,7 @@ have_click_policy (void)
}
static void
-install_caja_prefs (PlumaFileBrowserPluginData *data)
+install_caja_prefs (PlumaFileBrowserPluginPrivate *data)
{
gchar *pref;
gboolean prefb;
@@ -364,7 +413,7 @@ install_caja_prefs (PlumaFileBrowserPluginData *data)
}
static void
-set_root_from_doc (PlumaFileBrowserPluginData * data,
+set_root_from_doc (PlumaFileBrowserPluginPrivate * data,
PlumaDocument * doc)
{
GFile *file;
@@ -397,17 +446,14 @@ set_root_from_doc (PlumaFileBrowserPluginData * data,
static void
on_action_set_active_root (GtkAction * action,
- PlumaWindow * window)
+ PlumaFileBrowserPluginPrivate * data)
{
- PlumaFileBrowserPluginData *data;
-
- data = get_plugin_data (window);
set_root_from_doc (data,
- pluma_window_get_active_document (window));
+ pluma_window_get_active_document (PLUMA_WINDOW (data->window)));
}
static gchar *
-get_terminal (PlumaFileBrowserPluginData * data)
+get_terminal (PlumaFileBrowserPluginPrivate * data)
{
gchar * terminal;
@@ -428,9 +474,8 @@ get_terminal (PlumaFileBrowserPluginData * data)
static void
on_action_open_terminal (GtkAction * action,
- PlumaWindow * window)
+ PlumaFileBrowserPluginPrivate * data)
{
- PlumaFileBrowserPluginData * data;
gchar * terminal;
gchar * wd = NULL;
gchar * local;
@@ -440,8 +485,6 @@ on_action_open_terminal (GtkAction * action,
GtkTreeIter iter;
PlumaFileBrowserStore * store;
- data = get_plugin_data (window);
-
/* Get the current directory */
if (!pluma_file_browser_widget_get_selected_directory (data->tree_widget, &iter))
return;
@@ -481,17 +524,14 @@ on_action_open_terminal (GtkAction * action,
static void
on_selection_changed_cb (GtkTreeSelection *selection,
- PlumaWindow *window)
+ PlumaFileBrowserPluginPrivate *data)
{
- PlumaFileBrowserPluginData * data;
GtkTreeView * tree_view;
GtkTreeModel * model;
GtkTreeIter iter;
gboolean sensitive;
gchar * uri;
- data = get_plugin_data (window);
-
tree_view = GTK_TREE_VIEW (pluma_file_browser_widget_get_browser_view (data->tree_widget));
model = gtk_tree_view_get_model (tree_view);
@@ -548,14 +588,12 @@ static GtkActionEntry extra_single_selection_actions[] = {
};
static void
-add_popup_ui (PlumaWindow * window)
+add_popup_ui (PlumaFileBrowserPluginPrivate *data)
{
- PlumaFileBrowserPluginData * data;
GtkUIManager * manager;
GtkActionGroup * action_group;
GError * error = NULL;
- data = get_plugin_data (window);
manager = pluma_file_browser_widget_get_ui_manager (data->tree_widget);
action_group = gtk_action_group_new ("FileBrowserPluginExtra");
@@ -563,7 +601,7 @@ add_popup_ui (PlumaWindow * window)
gtk_action_group_add_actions (action_group,
extra_actions,
G_N_ELEMENTS (extra_actions),
- window);
+ data);
gtk_ui_manager_insert_action_group (manager, action_group, 0);
data->action_group = action_group;
@@ -572,7 +610,7 @@ add_popup_ui (PlumaWindow * window)
gtk_action_group_add_actions (action_group,
extra_single_selection_actions,
G_N_ELEMENTS (extra_single_selection_actions),
- window);
+ data);
gtk_ui_manager_insert_action_group (manager, action_group, 0);
data->single_selection_action_group = action_group;
@@ -588,12 +626,10 @@ add_popup_ui (PlumaWindow * window)
}
static void
-remove_popup_ui (PlumaWindow * window)
+remove_popup_ui (PlumaFileBrowserPluginPrivate *data)
{
- PlumaFileBrowserPluginData * data;
GtkUIManager * manager;
- data = get_plugin_data (window);
manager = pluma_file_browser_widget_get_ui_manager (data->tree_widget);
gtk_ui_manager_remove_ui (manager, data->merge_id);
@@ -605,14 +641,14 @@ remove_popup_ui (PlumaWindow * window)
}
static void
-impl_updateui (PlumaPlugin * plugin, PlumaWindow * window)
+pluma_file_browser_plugin_update_state (PeasActivatable *activatable)
{
- PlumaFileBrowserPluginData * data;
+ PlumaFileBrowserPluginPrivate *data;
PlumaDocument * doc;
- data = get_plugin_data (window);
+ data = PLUMA_FILE_BROWSER_PLUGIN (activatable)->priv;
- doc = pluma_window_get_active_document (window);
+ doc = pluma_window_get_active_document (PLUMA_WINDOW (data->window));
gtk_action_set_sensitive (gtk_action_group_get_action (data->action_group,
"SetActiveRoot"),
@@ -621,10 +657,11 @@ impl_updateui (PlumaPlugin * plugin, PlumaWindow * window)
}
static void
-impl_activate (PlumaPlugin * plugin, PlumaWindow * window)
+pluma_file_browser_plugin_activate (PeasActivatable *activatable)
{
+ PlumaFileBrowserPluginPrivate *data;
+ PlumaWindow *window;
PlumaPanel * panel;
- PlumaFileBrowserPluginData * data;
GtkWidget * image;
GdkPixbuf * pixbuf;
PlumaFileBrowserStore * store;
@@ -632,9 +669,10 @@ impl_activate (PlumaPlugin * plugin, PlumaWindow * window)
GSettingsSchemaSource *schema_source;
GSettingsSchema *schema;
- data = g_new0 (PlumaFileBrowserPluginData, 1);
+ data = PLUMA_FILE_BROWSER_PLUGIN (activatable)->priv;
+ window = PLUMA_WINDOW (data->window);
- data_dir = pluma_plugin_get_data_dir (plugin);
+ data_dir = peas_extension_base_get_data_dir (PEAS_EXTENSION_BASE (activatable));
data->tree_widget = PLUMA_FILE_BROWSER_WIDGET (pluma_file_browser_widget_new (data_dir));
g_free (data_dir);
@@ -647,17 +685,17 @@ impl_activate (PlumaPlugin * plugin, PlumaWindow * window)
G_CALLBACK (on_uri_activated_cb), window);
g_signal_connect (data->tree_widget,
- "error", G_CALLBACK (on_error_cb), window);
+ "error", G_CALLBACK (on_error_cb), data);
g_signal_connect (data->tree_widget,
"notify::filter-pattern",
G_CALLBACK (on_filter_pattern_changed_cb),
- window);
+ data);
g_signal_connect (data->tree_widget,
"confirm-delete",
G_CALLBACK (on_confirm_delete_cb),
- window);
+ data);
g_signal_connect (data->tree_widget,
"confirm-no-trash",
@@ -669,7 +707,7 @@ impl_activate (PlumaPlugin * plugin, PlumaWindow * window)
(data->tree_widget))),
"changed",
G_CALLBACK (on_selection_changed_cb),
- window);
+ data);
panel = pluma_window_get_side_panel (window);
pixbuf = pluma_file_browser_utils_pixbuf_from_theme("system-file-manager",
@@ -688,9 +726,8 @@ impl_activate (PlumaPlugin * plugin, PlumaWindow * window)
_("File Browser"),
image);
gtk_widget_show (GTK_WIDGET (data->tree_widget));
- g_object_set_data (G_OBJECT (window), WINDOW_DATA_KEY, data);
- add_popup_ui (window);
+ add_popup_ui (data);
/* Restore filter options */
restore_filter (data);
@@ -708,18 +745,18 @@ impl_activate (PlumaPlugin * plugin, PlumaWindow * window)
g_signal_connect (pluma_file_browser_widget_get_browser_view (data->tree_widget),
"notify::model",
G_CALLBACK (on_model_set_cb),
- window);
+ data);
store = pluma_file_browser_widget_get_browser_store (data->tree_widget);
g_signal_connect (store,
"notify::virtual-root",
G_CALLBACK (on_virtual_root_changed_cb),
- window);
+ data);
g_signal_connect (store,
"notify::filter-mode",
G_CALLBACK (on_filter_mode_changed_cb),
- window);
+ data);
g_signal_connect (store,
"rename",
@@ -734,16 +771,18 @@ impl_activate (PlumaPlugin * plugin, PlumaWindow * window)
/* Register messages on the bus */
pluma_file_browser_messages_register (window, data->tree_widget);
- impl_updateui (plugin, window);
+ pluma_file_browser_plugin_update_state (activatable);
}
static void
-impl_deactivate (PlumaPlugin * plugin, PlumaWindow * window)
+pluma_file_browser_plugin_deactivate (PeasActivatable *activatable)
{
- PlumaFileBrowserPluginData * data;
+ PlumaFileBrowserPluginPrivate *data;
+ PlumaWindow *window;
PlumaPanel * panel;
- data = get_plugin_data (window);
+ data = PLUMA_FILE_BROWSER_PLUGIN (activatable)->priv;
+ window = PLUMA_WINDOW (data->window);
/* Unregister messages from the bus */
pluma_file_browser_messages_unregister (window);
@@ -760,31 +799,51 @@ impl_deactivate (PlumaPlugin * plugin, PlumaWindow * window)
if (data->caja_settings)
g_object_unref (data->caja_settings);
- remove_popup_ui (window);
+ remove_popup_ui (data);
panel = pluma_window_get_side_panel (window);
pluma_panel_remove_item (panel, GTK_WIDGET (data->tree_widget));
-
- g_free (data);
- g_object_set_data (G_OBJECT (window), WINDOW_DATA_KEY, NULL);
}
static void
-filetree_plugin_class_init (PlumaFileBrowserPluginClass * klass)
+pluma_file_browser_plugin_class_init (PlumaFileBrowserPluginClass * klass)
{
GObjectClass *object_class = G_OBJECT_CLASS (klass);
- PlumaPluginClass * plugin_class = PLUMA_PLUGIN_CLASS (klass);
- object_class->finalize = filetree_plugin_finalize;
+ object_class->dispose = pluma_file_browser_plugin_dispose;
+ object_class->set_property = pluma_file_browser_plugin_set_property;
+ object_class->get_property = pluma_file_browser_plugin_get_property;
- plugin_class->activate = impl_activate;
- plugin_class->deactivate = impl_deactivate;
- plugin_class->update_ui = impl_updateui;
+ g_object_class_override_property (object_class, PROP_OBJECT, "object");
g_type_class_add_private (object_class,
sizeof (PlumaFileBrowserPluginPrivate));
}
+static void
+pluma_file_browser_plugin_class_finalize (PlumaFileBrowserPluginClass *klass)
+{
+ /* dummy function - used by G_DEFINE_DYNAMIC_TYPE_EXTENDED */
+}
+
+static void
+peas_activatable_iface_init (PeasActivatableInterface *iface)
+{
+ iface->activate = pluma_file_browser_plugin_activate;
+ iface->deactivate = pluma_file_browser_plugin_deactivate;
+ iface->update_state = pluma_file_browser_plugin_update_state;
+}
+
+G_MODULE_EXPORT void
+peas_register_types (PeasObjectModule *module)
+{
+ pluma_file_browser_plugin_register_type (G_TYPE_MODULE (module));
+
+ peas_object_module_register_extension_type (module,
+ PEAS_TYPE_ACTIVATABLE,
+ PLUMA_TYPE_FILE_BROWSER_PLUGIN);
+}
+
/* Callbacks */
static void
on_uri_activated_cb (PlumaFileBrowserWidget * tree_widget,
@@ -795,13 +854,10 @@ on_uri_activated_cb (PlumaFileBrowserWidget * tree_widget,
static void
on_error_cb (PlumaFileBrowserWidget * tree_widget,
- guint code, gchar const *message, PlumaWindow * window)
+ guint code, gchar const *message, PlumaFileBrowserPluginPrivate * data)
{
gchar * title;
GtkWidget * dlg;
- PlumaFileBrowserPluginData * data;
-
- data = get_plugin_data (window);
/* Do not show the error when the root has been set automatically */
if (data->auto_root && (code == PLUMA_FILE_BROWSER_ERROR_SET_ROOT ||
@@ -848,7 +904,7 @@ on_error_cb (PlumaFileBrowserWidget * tree_widget,
break;
}
- dlg = gtk_message_dialog_new (GTK_WINDOW (window),
+ dlg = gtk_message_dialog_new (GTK_WINDOW (data->window),
GTK_DIALOG_MODAL |
GTK_DIALOG_DESTROY_WITH_PARENT,
GTK_MESSAGE_ERROR, GTK_BUTTONS_OK,
@@ -863,9 +919,8 @@ on_error_cb (PlumaFileBrowserWidget * tree_widget,
static void
on_model_set_cb (PlumaFileBrowserView * widget,
GParamSpec *arg1,
- PlumaWindow * window)
+ PlumaFileBrowserPluginPrivate * data)
{
- PlumaFileBrowserPluginData * data = get_plugin_data (window);
GtkTreeModel * model;
model = gtk_tree_view_get_model (GTK_TREE_VIEW (pluma_file_browser_widget_get_browser_view (data->tree_widget)));
@@ -881,9 +936,8 @@ on_model_set_cb (PlumaFileBrowserView * widget,
static void
on_filter_mode_changed_cb (PlumaFileBrowserStore * model,
GParamSpec * param,
- PlumaWindow * window)
+ PlumaFileBrowserPluginPrivate * data)
{
- PlumaFileBrowserPluginData * data = get_plugin_data (window);
PlumaFileBrowserStoreFilterMode mode;
mode = pluma_file_browser_store_get_filter_mode (model);
@@ -967,9 +1021,8 @@ on_rename_cb (PlumaFileBrowserStore * store,
static void
on_filter_pattern_changed_cb (PlumaFileBrowserWidget * widget,
GParamSpec * param,
- PlumaWindow * window)
+ PlumaFileBrowserPluginPrivate * data)
{
- PlumaFileBrowserPluginData * data = get_plugin_data (window);
gchar * pattern;
g_object_get (G_OBJECT (widget), "filter-pattern", &pattern, NULL);
@@ -985,9 +1038,8 @@ on_filter_pattern_changed_cb (PlumaFileBrowserWidget * widget,
static void
on_virtual_root_changed_cb (PlumaFileBrowserStore * store,
GParamSpec * param,
- PlumaWindow * window)
+ PlumaFileBrowserPluginPrivate * data)
{
- PlumaFileBrowserPluginData * data = get_plugin_data (window);
gchar * root;
gchar * virtual_root;
@@ -1007,7 +1059,7 @@ on_virtual_root_changed_cb (PlumaFileBrowserStore * store,
g_settings_set_string (data->onload_settings, "virtual-root", virtual_root);
}
- g_signal_handlers_disconnect_by_func (window,
+ g_signal_handlers_disconnect_by_func (PLUMA_WINDOW (data->window),
G_CALLBACK (on_tab_added_cb),
data);
@@ -1018,7 +1070,7 @@ on_virtual_root_changed_cb (PlumaFileBrowserStore * store,
static void
on_tab_added_cb (PlumaWindow * window,
PlumaTab * tab,
- PlumaFileBrowserPluginData * data)
+ PlumaFileBrowserPluginPrivate *data)
{
gboolean open;
gboolean load_default = TRUE;
@@ -1100,15 +1152,12 @@ static gboolean
on_confirm_delete_cb (PlumaFileBrowserWidget *widget,
PlumaFileBrowserStore *store,
GList *paths,
- PlumaWindow *window)
+ PlumaFileBrowserPluginPrivate *data)
{
gchar *normal;
gchar *message;
gchar *secondary;
gboolean result;
- PlumaFileBrowserPluginData *data;
-
- data = get_plugin_data (window);
if (!data->confirm_trash)
return TRUE;
@@ -1123,7 +1172,7 @@ on_confirm_delete_cb (PlumaFileBrowserWidget *widget,
secondary = _("If you delete an item, it is permanently lost.");
- result = pluma_file_browser_utils_confirmation_dialog (window,
+ result = pluma_file_browser_utils_confirmation_dialog (PLUMA_WINDOW (data->window),
GTK_MESSAGE_QUESTION,
message,
secondary,
diff --git a/plugins/filebrowser/pluma-file-browser-plugin.h b/plugins/filebrowser/pluma-file-browser-plugin.h
index 6e70efa1..89324c91 100644
--- a/plugins/filebrowser/pluma-file-browser-plugin.h
+++ b/plugins/filebrowser/pluma-file-browser-plugin.h
@@ -24,13 +24,15 @@
#include <glib.h>
#include <glib-object.h>
-#include <pluma/pluma-plugin.h>
+#include <libpeas/peas-extension-base.h>
+#include <libpeas/peas-object-module.h>
G_BEGIN_DECLS
+
/*
* Type checking and casting macros
*/
-#define PLUMA_TYPE_FILE_BROWSER_PLUGIN (filetree_plugin_get_type ())
+#define PLUMA_TYPE_FILE_BROWSER_PLUGIN (pluma_file_browser_plugin_get_type ())
#define PLUMA_FILE_BROWSER_PLUGIN(o) (G_TYPE_CHECK_INSTANCE_CAST ((o), PLUMA_TYPE_FILE_BROWSER_PLUGIN, PlumaFileBrowserPlugin))
#define PLUMA_FILE_BROWSER_PLUGIN_CLASS(k) (G_TYPE_CHECK_CLASS_CAST((k), PLUMA_TYPE_FILE_BROWSER_PLUGIN, PlumaFileBrowserPluginClass))
#define PLUMA_IS_FILE_BROWSER_PLUGIN(o) (G_TYPE_CHECK_INSTANCE_TYPE ((o), PLUMA_TYPE_FILE_BROWSER_PLUGIN))
@@ -44,28 +46,27 @@ typedef struct _PlumaFileBrowserPluginClass PlumaFileBrowserPluginClass;
struct _PlumaFileBrowserPlugin
{
- PlumaPlugin parent_instance;
+ PeasExtensionBase parent_instance;
/*< private > */
PlumaFileBrowserPluginPrivate *priv;
};
-
-
struct _PlumaFileBrowserPluginClass
{
- PlumaPluginClass parent_class;
+ PeasExtensionBaseClass parent_class;
};
/*
* Public methods
*/
-GType filetree_plugin_get_type (void) G_GNUC_CONST;
+GType pluma_file_browser_plugin_get_type (void) G_GNUC_CONST;
/* All the plugins must implement this function */
-G_MODULE_EXPORT GType register_pluma_plugin (GTypeModule * module);
+G_MODULE_EXPORT void peas_register_types (PeasObjectModule *module);
G_END_DECLS
+
#endif /* __PLUMA_FILE_BROWSER_PLUGIN_H__ */
// ex:ts=8:noet:
diff --git a/plugins/filebrowser/pluma-file-browser-store.c b/plugins/filebrowser/pluma-file-browser-store.c
index ce83fc74..1615729a 100644
--- a/plugins/filebrowser/pluma-file-browser-store.c
+++ b/plugins/filebrowser/pluma-file-browser-store.c
@@ -26,8 +26,6 @@
#include <string.h>
#include <glib/gi18n-lib.h>
#include <gio/gio.h>
-#include <pluma/pluma-plugin.h>
-#include <pluma/pluma-utils.h>
#include "pluma-file-browser-store.h"
#include "pluma-file-browser-marshal.h"
@@ -197,13 +195,12 @@ static void model_check_dummy (PlumaFileBrowserSto
static void next_files_async (GFileEnumerator * enumerator,
AsyncNode * async);
-PLUMA_PLUGIN_DEFINE_TYPE_WITH_CODE (PlumaFileBrowserStore, pluma_file_browser_store,
+G_DEFINE_DYNAMIC_TYPE_EXTENDED (PlumaFileBrowserStore, pluma_file_browser_store,
G_TYPE_OBJECT,
- PLUMA_PLUGIN_IMPLEMENT_INTERFACE (pluma_file_browser_store_tree_model,
- GTK_TYPE_TREE_MODEL,
+ 0,
+ G_IMPLEMENT_INTERFACE_DYNAMIC (GTK_TYPE_TREE_MODEL,
pluma_file_browser_store_iface_init)
- PLUMA_PLUGIN_IMPLEMENT_INTERFACE (pluma_file_browser_store_drag_source,
- GTK_TYPE_TREE_DRAG_SOURCE,
+ G_IMPLEMENT_INTERFACE_DYNAMIC (GTK_TYPE_TREE_DRAG_SOURCE,
pluma_file_browser_store_drag_source_init))
/* Properties */
@@ -428,6 +425,12 @@ pluma_file_browser_store_class_init (PlumaFileBrowserStoreClass * klass)
}
static void
+pluma_file_browser_store_class_finalize (PlumaFileBrowserStoreClass *klass)
+{
+ /* dummy function - used by G_DEFINE_DYNAMIC_TYPE_EXTENDED */
+}
+
+static void
pluma_file_browser_store_iface_init (GtkTreeModelIface * iface)
{
iface->get_flags = pluma_file_browser_store_get_flags;
@@ -3622,4 +3625,10 @@ pluma_file_browser_store_new_directory (PlumaFileBrowserStore * model,
return result;
}
+void
+_pluma_file_browser_store_register_type (GTypeModule *type_module)
+{
+ pluma_file_browser_store_register_type (type_module);
+}
+
// ex:ts=8:noet:
diff --git a/plugins/filebrowser/pluma-file-browser-store.h b/plugins/filebrowser/pluma-file-browser-store.h
index 9a63842b..da889dbd 100644
--- a/plugins/filebrowser/pluma-file-browser-store.h
+++ b/plugins/filebrowser/pluma-file-browser-store.h
@@ -116,7 +116,7 @@ struct _PlumaFileBrowserStoreClass {
};
GType pluma_file_browser_store_get_type (void) G_GNUC_CONST;
-GType pluma_file_browser_store_register_type (GTypeModule * module);
+void _pluma_file_browser_store_register_type (GTypeModule * module);
PlumaFileBrowserStore *pluma_file_browser_store_new (gchar const *root);
diff --git a/plugins/filebrowser/pluma-file-browser-view.c b/plugins/filebrowser/pluma-file-browser-view.c
index 65728b0f..a206d8a8 100644
--- a/plugins/filebrowser/pluma-file-browser-view.c
+++ b/plugins/filebrowser/pluma-file-browser-view.c
@@ -21,7 +21,6 @@
#include <string.h>
#include <gio/gio.h>
-#include <pluma/pluma-plugin.h>
#include <gtk/gtk.h>
#include <gdk/gdkkeysyms.h>
@@ -86,7 +85,7 @@ static const GtkTargetEntry drag_source_targets[] = {
{ "text/uri-list", 0, 0 }
};
-PLUMA_PLUGIN_DEFINE_TYPE (PlumaFileBrowserView, pluma_file_browser_view,
+G_DEFINE_DYNAMIC_TYPE (PlumaFileBrowserView, pluma_file_browser_view,
GTK_TYPE_TREE_VIEW)
static void on_cell_edited (GtkCellRendererText * cell,
@@ -912,6 +911,12 @@ pluma_file_browser_view_class_init (PlumaFileBrowserViewClass * klass)
}
static void
+pluma_file_browser_view_class_finalize (PlumaFileBrowserViewClass *klass)
+{
+ /* dummy function - used by G_DEFINE_DYNAMIC_TYPE */
+}
+
+static void
cell_data_cb (GtkTreeViewColumn * tree_column, GtkCellRenderer * cell,
GtkTreeModel * tree_model, GtkTreeIter * iter,
PlumaFileBrowserView * obj)
@@ -1257,5 +1262,11 @@ on_row_inserted (PlumaFileBrowserStore * model,
gtk_tree_path_free (copy);
}
+
+void
+_pluma_file_browser_view_register_type (GTypeModule *type_module)
+{
+ pluma_file_browser_view_register_type (type_module);
+}
// ex:ts=8:noet:
diff --git a/plugins/filebrowser/pluma-file-browser-view.h b/plugins/filebrowser/pluma-file-browser-view.h
index 47de6be8..299d210c 100644
--- a/plugins/filebrowser/pluma-file-browser-view.h
+++ b/plugins/filebrowser/pluma-file-browser-view.h
@@ -66,7 +66,7 @@ struct _PlumaFileBrowserViewClass
};
GType pluma_file_browser_view_get_type (void) G_GNUC_CONST;
-GType pluma_file_browser_view_register_type (GTypeModule * module);
+void _pluma_file_browser_view_register_type (GTypeModule * module);
GtkWidget *pluma_file_browser_view_new (void);
void pluma_file_browser_view_set_model (PlumaFileBrowserView * tree_view,
diff --git a/plugins/filebrowser/pluma-file-browser-widget.c b/plugins/filebrowser/pluma-file-browser-widget.c
index 535ecbc4..11fa6a20 100644
--- a/plugins/filebrowser/pluma-file-browser-widget.c
+++ b/plugins/filebrowser/pluma-file-browser-widget.c
@@ -32,7 +32,6 @@
#include <gdk/gdkkeysyms.h>
#include <pluma/pluma-utils.h>
-#include <pluma/pluma-plugin.h>
#include "pluma-file-browser-utils.h"
#include "pluma-file-browser-error.h"
@@ -236,7 +235,7 @@ static void on_action_filter_binary (GtkAction * action,
static void on_action_bookmark_open (GtkAction * action,
PlumaFileBrowserWidget * obj);
-PLUMA_PLUGIN_DEFINE_TYPE (PlumaFileBrowserWidget, pluma_file_browser_widget,
+G_DEFINE_DYNAMIC_TYPE (PlumaFileBrowserWidget, pluma_file_browser_widget,
GTK_TYPE_BOX)
static void
@@ -480,6 +479,12 @@ pluma_file_browser_widget_class_init (PlumaFileBrowserWidgetClass * klass)
}
static void
+pluma_file_browser_widget_class_finalize (PlumaFileBrowserWidgetClass *klass)
+{
+ /* dummy function - used by G_DEFINE_DYNAMIC_TYPE */
+}
+
+static void
add_signal (PlumaFileBrowserWidget * obj, gpointer object, gulong id)
{
SignalNode *node = g_new (SignalNode, 1);
@@ -3152,4 +3157,10 @@ on_action_bookmark_open (GtkAction * action, PlumaFileBrowserWidget * obj)
bookmark_open (obj, model, &iter);
}
+void
+_pluma_file_browser_widget_register_type (GTypeModule *type_module)
+{
+ pluma_file_browser_widget_register_type (type_module);
+}
+
// ex:ts=8:noet:
diff --git a/plugins/filebrowser/pluma-file-browser-widget.h b/plugins/filebrowser/pluma-file-browser-widget.h
index 47b0d74e..8af73381 100644
--- a/plugins/filebrowser/pluma-file-browser-widget.h
+++ b/plugins/filebrowser/pluma-file-browser-widget.h
@@ -71,7 +71,7 @@ struct _PlumaFileBrowserWidgetClass
};
GType pluma_file_browser_widget_get_type (void) G_GNUC_CONST;
-GType pluma_file_browser_widget_register_type (GTypeModule * module);
+void _pluma_file_browser_widget_register_type (GTypeModule * module);
GtkWidget *pluma_file_browser_widget_new (const gchar *data_dir);
diff --git a/plugins/modelines/Makefile.am b/plugins/modelines/Makefile.am
index e375c898..c4840177 100644
--- a/plugins/modelines/Makefile.am
+++ b/plugins/modelines/Makefile.am
@@ -22,10 +22,10 @@ libmodelines_la_SOURCES = \
libmodelines_la_LDFLAGS = $(PLUGIN_LIBTOOL_FLAGS)
libmodelines_la_LIBADD = $(PLUMA_LIBS)
-plugin_in_files = modelines.pluma-plugin.desktop.in
-%.pluma-plugin: %.pluma-plugin.desktop.in $(INTLTOOL_MERGE) $(wildcard $(top_srcdir)/po/*po) ; $(INTLTOOL_MERGE) $(top_srcdir)/po $< $@ -d -u -c $(top_builddir)/po/.intltool-merge-cache
+plugin_in_files = modelines.plugin.desktop.in
+%.plugin: %.plugin.desktop.in $(INTLTOOL_MERGE) $(wildcard $(top_srcdir)/po/*po) ; $(INTLTOOL_MERGE) $(top_srcdir)/po $< $@ -d -u -c $(top_builddir)/po/.intltool-merge-cache
-plugin_DATA = $(plugin_in_files:.pluma-plugin.desktop.in=.pluma-plugin)
+plugin_DATA = $(plugin_in_files:.plugin.desktop.in=.plugin)
EXTRA_DIST = \
$(plugin_in_files) \
diff --git a/plugins/modelines/modelines.pluma-plugin.desktop.in b/plugins/modelines/modelines.plugin.desktop.in
index 9adf3f4e..04c34e7f 100644
--- a/plugins/modelines/modelines.pluma-plugin.desktop.in
+++ b/plugins/modelines/modelines.plugin.desktop.in
@@ -1,4 +1,4 @@
-[Pluma Plugin]
+[Plugin]
Module=modelines
IAge=2
_Name=Modelines
diff --git a/plugins/modelines/pluma-modeline-plugin.c b/plugins/modelines/pluma-modeline-plugin.c
index 34639324..cc7e461b 100644
--- a/plugins/modelines/pluma-modeline-plugin.c
+++ b/plugins/modelines/pluma-modeline-plugin.c
@@ -25,20 +25,22 @@
#include <glib/gi18n-lib.h>
#include <gmodule.h>
+#include <libpeas/peas-activatable.h>
#include "pluma-modeline-plugin.h"
#include "modeline-parser.h"
+#include <pluma/pluma-window.h>
#include <pluma/pluma-debug.h>
-#include <pluma/pluma-utils.h>
-#define WINDOW_DATA_KEY "PlumaModelinePluginWindowData"
#define DOCUMENT_DATA_KEY "PlumaModelinePluginDocumentData"
-typedef struct
+struct _PlumaModelinePluginPrivate
{
+ GtkWidget *window;
+
gulong tab_added_handler_id;
gulong tab_removed_handler_id;
-} WindowData;
+};
typedef struct
{
@@ -46,18 +48,19 @@ typedef struct
gulong document_saved_handler_id;
} DocumentData;
-static void pluma_modeline_plugin_activate (PlumaPlugin *plugin, PlumaWindow *window);
-static void pluma_modeline_plugin_deactivate (PlumaPlugin *plugin, PlumaWindow *window);
-static GObject *pluma_modeline_plugin_constructor (GType type, guint n_construct_properties, GObjectConstructParam *construct_param);
-static void pluma_modeline_plugin_finalize (GObject *object);
+enum {
+ PROP_0,
+ PROP_OBJECT
+};
-PLUMA_PLUGIN_REGISTER_TYPE(PlumaModelinePlugin, pluma_modeline_plugin)
+static void peas_activatable_iface_init (PeasActivatableInterface *iface);
-static void
-window_data_free (WindowData *wdata)
-{
- g_slice_free (WindowData, wdata);
-}
+G_DEFINE_DYNAMIC_TYPE_EXTENDED (PlumaModelinePlugin,
+ pluma_modeline_plugin,
+ PEAS_TYPE_EXTENSION_BASE,
+ 0,
+ G_IMPLEMENT_INTERFACE_DYNAMIC (PEAS_TYPE_ACTIVATABLE,
+ peas_activatable_iface_init))
static void
document_data_free (DocumentData *ddata)
@@ -66,43 +69,27 @@ document_data_free (DocumentData *ddata)
}
static void
-pluma_modeline_plugin_class_init (PlumaModelinePluginClass *klass)
+pluma_modeline_plugin_constructed (GObject *object)
{
- GObjectClass *object_class = G_OBJECT_CLASS (klass);
- PlumaPluginClass *plugin_class = PLUMA_PLUGIN_CLASS (klass);
-
- object_class->constructor = pluma_modeline_plugin_constructor;
- object_class->finalize = pluma_modeline_plugin_finalize;
-
- plugin_class->activate = pluma_modeline_plugin_activate;
- plugin_class->deactivate = pluma_modeline_plugin_deactivate;
-}
-
-static GObject *
-pluma_modeline_plugin_constructor (GType type,
- guint n_construct_properties,
- GObjectConstructParam *construct_param)
-{
- GObject *object;
gchar *data_dir;
- object = G_OBJECT_CLASS (pluma_modeline_plugin_parent_class)->constructor (type,
- n_construct_properties,
- construct_param);
-
- data_dir = pluma_plugin_get_data_dir (PLUMA_PLUGIN (object));
+ data_dir = peas_extension_base_get_data_dir (PEAS_EXTENSION_BASE (object));
modeline_parser_init (data_dir);
g_free (data_dir);
- return object;
+ G_OBJECT_CLASS (pluma_modeline_plugin_parent_class)->constructed (object);
}
static void
pluma_modeline_plugin_init (PlumaModelinePlugin *plugin)
{
pluma_debug_message (DEBUG_PLUGINS, "PlumaModelinePlugin initializing");
+
+ plugin->priv = G_TYPE_INSTANCE_GET_PRIVATE (plugin,
+ PLUMA_TYPE_MODELINE_PLUGIN,
+ PlumaModelinePluginPrivate);
}
static void
@@ -116,6 +103,62 @@ pluma_modeline_plugin_finalize (GObject *object)
}
static void
+pluma_modeline_plugin_dispose (GObject *object)
+{
+ PlumaModelinePlugin *plugin = PLUMA_MODELINE_PLUGIN (object);
+
+ pluma_debug_message (DEBUG_PLUGINS, "PlumaModelinePlugin disposing");
+
+ if (plugin->priv->window != NULL)
+ {
+ g_object_unref (plugin->priv->window);
+ plugin->priv->window = NULL;
+ }
+
+ G_OBJECT_CLASS (pluma_modeline_plugin_parent_class)->dispose (object);
+}
+
+static void
+pluma_modeline_plugin_set_property (GObject *object,
+ guint prop_id,
+ const GValue *value,
+ GParamSpec *pspec)
+{
+ PlumaModelinePlugin *plugin = PLUMA_MODELINE_PLUGIN (object);
+
+ switch (prop_id)
+ {
+ case PROP_OBJECT:
+ plugin->priv->window = GTK_WIDGET (g_value_dup_object (value));
+ break;
+
+ default:
+ G_OBJECT_WARN_INVALID_PROPERTY_ID (object, prop_id, pspec);
+ break;
+ }
+}
+
+static void
+pluma_modeline_plugin_get_property (GObject *object,
+ guint prop_id,
+ GValue *value,
+ GParamSpec *pspec)
+{
+ PlumaModelinePlugin *plugin = PLUMA_MODELINE_PLUGIN (object);
+
+ switch (prop_id)
+ {
+ case PROP_OBJECT:
+ g_value_set_object (value, plugin->priv->window);
+ break;
+
+ default:
+ G_OBJECT_WARN_INVALID_PROPERTY_ID (object, prop_id, pspec);
+ break;
+ }
+}
+
+static void
on_document_loaded_or_saved (PlumaDocument *document,
const GError *error,
GtkSourceView *view)
@@ -186,15 +229,18 @@ on_window_tab_removed (PlumaWindow *window,
}
static void
-pluma_modeline_plugin_activate (PlumaPlugin *plugin,
- PlumaWindow *window)
+pluma_modeline_plugin_activate (PeasActivatable *activatable)
{
- WindowData *wdata;
+ PlumaModelinePluginPrivate *data;
+ PlumaWindow *window;
GList *views;
GList *l;
pluma_debug (DEBUG_PLUGINS);
+ data = PLUMA_MODELINE_PLUGIN (activatable)->priv;
+ window = PLUMA_WINDOW (data->window);
+
views = pluma_window_get_views (window);
for (l = views; l != NULL; l = l->next)
{
@@ -203,36 +249,30 @@ pluma_modeline_plugin_activate (PlumaPlugin *plugin,
}
g_list_free (views);
- wdata = g_slice_new (WindowData);
-
- wdata->tab_added_handler_id =
+ data->tab_added_handler_id =
g_signal_connect (window, "tab-added",
G_CALLBACK (on_window_tab_added), NULL);
- wdata->tab_removed_handler_id =
+ data->tab_removed_handler_id =
g_signal_connect (window, "tab-removed",
G_CALLBACK (on_window_tab_removed), NULL);
-
- g_object_set_data_full (G_OBJECT (window), WINDOW_DATA_KEY,
- wdata, (GDestroyNotify) window_data_free);
}
static void
-pluma_modeline_plugin_deactivate (PlumaPlugin *plugin,
- PlumaWindow *window)
+pluma_modeline_plugin_deactivate (PeasActivatable *activatable)
{
- WindowData *wdata;
+ PlumaModelinePluginPrivate *data;
+ PlumaWindow *window;
GList *views;
GList *l;
pluma_debug (DEBUG_PLUGINS);
- wdata = g_object_steal_data (G_OBJECT (window), WINDOW_DATA_KEY);
+ data = PLUMA_MODELINE_PLUGIN (activatable)->priv;
+ window = PLUMA_WINDOW (data->window);
- g_signal_handler_disconnect (window, wdata->tab_added_handler_id);
- g_signal_handler_disconnect (window, wdata->tab_removed_handler_id);
-
- window_data_free (wdata);
+ g_signal_handler_disconnect (window, data->tab_added_handler_id);
+ g_signal_handler_disconnect (window, data->tab_removed_handler_id);
views = pluma_window_get_views (window);
@@ -246,3 +286,41 @@ pluma_modeline_plugin_deactivate (PlumaPlugin *plugin,
g_list_free (views);
}
+static void
+pluma_modeline_plugin_class_init (PlumaModelinePluginClass *klass)
+{
+ GObjectClass *object_class = G_OBJECT_CLASS (klass);
+
+ object_class->constructed = pluma_modeline_plugin_constructed;
+ object_class->finalize = pluma_modeline_plugin_finalize;
+ object_class->dispose = pluma_modeline_plugin_dispose;
+ object_class->set_property = pluma_modeline_plugin_set_property;
+ object_class->get_property = pluma_modeline_plugin_get_property;
+
+ g_object_class_override_property (object_class, PROP_OBJECT, "object");
+
+ g_type_class_add_private (klass, sizeof (PlumaModelinePluginPrivate));
+}
+
+static void
+pluma_modeline_plugin_class_finalize (PlumaModelinePluginClass *klass)
+{
+ /* dummy function - used by G_DEFINE_DYNAMIC_TYPE_EXTENDED */
+}
+
+static void
+peas_activatable_iface_init (PeasActivatableInterface *iface)
+{
+ iface->activate = pluma_modeline_plugin_activate;
+ iface->deactivate = pluma_modeline_plugin_deactivate;
+}
+
+G_MODULE_EXPORT void
+peas_register_types (PeasObjectModule *module)
+{
+ pluma_modeline_plugin_register_type (G_TYPE_MODULE (module));
+
+ peas_object_module_register_extension_type (module,
+ PEAS_TYPE_ACTIVATABLE,
+ PLUMA_TYPE_MODELINE_PLUGIN);
+}
diff --git a/plugins/modelines/pluma-modeline-plugin.h b/plugins/modelines/pluma-modeline-plugin.h
index 4618997e..c44faf36 100644
--- a/plugins/modelines/pluma-modeline-plugin.h
+++ b/plugins/modelines/pluma-modeline-plugin.h
@@ -24,7 +24,8 @@
#include <glib.h>
#include <glib-object.h>
-#include <pluma/pluma-plugin.h>
+#include <libpeas/peas-extension-base.h>
+#include <libpeas/peas-object-module.h>
G_BEGIN_DECLS
@@ -35,13 +36,27 @@ G_BEGIN_DECLS
#define PLUMA_IS_MODELINE_PLUGIN_CLASS(k) (G_TYPE_CHECK_CLASS_TYPE ((k), PLUMA_TYPE_MODELINE_PLUGIN))
#define PLUMA_MODELINE_PLUGIN_GET_CLASS(o) (G_TYPE_INSTANCE_GET_CLASS ((o), PLUMA_TYPE_MODELINE_PLUGIN, PlumaModelinePluginClass))
-/* Private structure type */
-typedef PlumaPluginClass PlumaModelinePluginClass;
-typedef PlumaPlugin PlumaModelinePlugin;
+typedef struct _PlumaModelinePlugin PlumaModelinePlugin;
+typedef struct _PlumaModelinePluginPrivate PlumaModelinePluginPrivate;
+
+struct _PlumaModelinePlugin
+{
+ PeasExtensionBase parent_instance;
+
+ /*< private >*/
+ PlumaModelinePluginPrivate *priv;
+};
+
+typedef struct _PlumaModelinePluginClass PlumaModelinePluginClass;
+
+struct _PlumaModelinePluginClass
+{
+ PeasExtensionBaseClass parent_class;
+};
GType pluma_modeline_plugin_get_type (void) G_GNUC_CONST;
-G_MODULE_EXPORT GType register_pluma_plugin (GTypeModule *module);
+G_MODULE_EXPORT void peas_register_types (PeasObjectModule *module);
G_END_DECLS
diff --git a/plugins/sort/Makefile.am b/plugins/sort/Makefile.am
index 749be6bc..18245f05 100644
--- a/plugins/sort/Makefile.am
+++ b/plugins/sort/Makefile.am
@@ -19,11 +19,11 @@ libsort_la_LIBADD = $(PLUMA_LIBS)
uidir = $(PLUMA_PLUGINS_DATA_DIR)/sort
ui_DATA = sort.ui
-plugin_in_files = sort.pluma-plugin.desktop.in
+plugin_in_files = sort.plugin.desktop.in
-%.pluma-plugin: %.pluma-plugin.desktop.in $(INTLTOOL_MERGE) $(wildcard $(top_srcdir)/po/*po) ; $(INTLTOOL_MERGE) $(top_srcdir)/po $< $@ -d -u -c $(top_builddir)/po/.intltool-merge-cache
+%.plugin: %.plugin.desktop.in $(INTLTOOL_MERGE) $(wildcard $(top_srcdir)/po/*po) ; $(INTLTOOL_MERGE) $(top_srcdir)/po $< $@ -d -u -c $(top_builddir)/po/.intltool-merge-cache
-plugin_DATA = $(plugin_in_files:.pluma-plugin.desktop.in=.pluma-plugin)
+plugin_DATA = $(plugin_in_files:.plugin.desktop.in=.plugin)
EXTRA_DIST = $(ui_DATA) $(plugin_in_files)
diff --git a/plugins/sort/pluma-sort-plugin.c b/plugins/sort/pluma-sort-plugin.c
index 9ca9dc63..67a3a1ce 100644
--- a/plugins/sort/pluma-sort-plugin.c
+++ b/plugins/sort/pluma-sort-plugin.c
@@ -30,20 +30,30 @@
#include <string.h>
#include <glib/gi18n-lib.h>
#include <gmodule.h>
+#include <libpeas/peas-activatable.h>
+#include <pluma/pluma-window.h>
#include <pluma/pluma-debug.h>
#include <pluma/pluma-utils.h>
#include <pluma/pluma-help.h>
#define PLUMA_SORT_PLUGIN_GET_PRIVATE(object)(G_TYPE_INSTANCE_GET_PRIVATE ((object), PLUMA_TYPE_SORT_PLUGIN, PlumaSortPluginPrivate))
-/* Key in case the plugin ever needs any settings. */
-#define SORT_BASE_KEY "/apps/pluma/plugins/sort"
-
-#define WINDOW_DATA_KEY "PlumaSortPluginWindowData"
#define MENU_PATH "/MenuBar/EditMenu/EditOps_6"
-PLUMA_PLUGIN_REGISTER_TYPE(PlumaSortPlugin, pluma_sort_plugin)
+static void peas_activatable_iface_init (PeasActivatableInterface *iface);
+
+G_DEFINE_DYNAMIC_TYPE_EXTENDED (PlumaSortPlugin,
+ pluma_sort_plugin,
+ PEAS_TYPE_EXTENSION_BASE,
+ 0,
+ G_IMPLEMENT_INTERFACE_DYNAMIC (PEAS_TYPE_ACTIVATABLE,
+ peas_activatable_iface_init))
+
+enum {
+ PROP_0,
+ PROP_OBJECT
+};
typedef struct
{
@@ -58,17 +68,13 @@ typedef struct
GtkTextIter start, end; /* selection */
} SortDialog;
-typedef struct
+struct _PlumaSortPluginPrivate
{
+ GtkWidget *window;
+
GtkActionGroup *ui_action_group;
guint ui_id;
-} WindowData;
-
-typedef struct
-{
- PlumaPlugin *plugin;
- PlumaWindow *window;
-} ActionData;
+};
typedef struct
{
@@ -78,7 +84,7 @@ typedef struct
gint starting_column;
} SortInfo;
-static void sort_cb (GtkAction *action, ActionData *action_data);
+static void sort_cb (GtkAction *action, PlumaSortPlugin *plugin);
static void sort_real (SortDialog *dialog);
static const GtkActionEntry action_entries[] =
@@ -92,7 +98,7 @@ static const GtkActionEntry action_entries[] =
};
static void
-sort_dialog_dispose (GObject *obj,
+sort_dialog_destroy (GObject *obj,
gpointer dialog_pointer)
{
pluma_debug (DEBUG_PLUGINS);
@@ -150,8 +156,9 @@ get_current_selection (PlumaWindow *window, SortDialog *dialog)
}
static SortDialog *
-get_sort_dialog (ActionData *action_data)
+get_sort_dialog (PlumaSortPlugin *plugin)
{
+ PlumaWindow *window;
SortDialog *dialog;
GtkWidget *error_widget;
gboolean ret;
@@ -160,9 +167,11 @@ get_sort_dialog (ActionData *action_data)
pluma_debug (DEBUG_PLUGINS);
+ window = PLUMA_WINDOW (plugin->priv->window);
+
dialog = g_slice_new (SortDialog);
- data_dir = pluma_plugin_get_data_dir (action_data->plugin);
+ data_dir = peas_extension_base_get_data_dir (PEAS_EXTENSION_BASE (plugin));
ui_file = g_build_filename (data_dir, "sort.ui", NULL);
g_free (data_dir);
ret = pluma_utils_get_ui_objects (ui_file,
@@ -181,7 +190,7 @@ get_sort_dialog (ActionData *action_data)
const gchar *err_message;
err_message = gtk_label_get_label (GTK_LABEL (error_widget));
- pluma_warning (GTK_WINDOW (action_data->window),
+ pluma_warning (GTK_WINDOW (window),
"%s", err_message);
g_slice_free (SortDialog, dialog);
@@ -194,8 +203,8 @@ get_sort_dialog (ActionData *action_data)
GTK_RESPONSE_OK);
g_signal_connect (dialog->dialog,
- "dispose",
- G_CALLBACK (sort_dialog_dispose),
+ "destroy",
+ G_CALLBACK (sort_dialog_destroy),
dialog);
g_signal_connect (dialog->dialog,
@@ -203,35 +212,38 @@ get_sort_dialog (ActionData *action_data)
G_CALLBACK (sort_dialog_response_handler),
dialog);
- get_current_selection (action_data->window, dialog);
+ get_current_selection (window, dialog);
return dialog;
}
static void
sort_cb (GtkAction *action,
- ActionData *action_data)
+ PlumaSortPlugin *plugin)
{
+ PlumaWindow *window;
PlumaDocument *doc;
GtkWindowGroup *wg;
SortDialog *dialog;
pluma_debug (DEBUG_PLUGINS);
- doc = pluma_window_get_active_document (action_data->window);
+ window = PLUMA_WINDOW (plugin->priv->window);
+
+ doc = pluma_window_get_active_document (window);
g_return_if_fail (doc != NULL);
- dialog = get_sort_dialog (action_data);
+ dialog = get_sort_dialog (plugin);
g_return_if_fail (dialog != NULL);
- wg = pluma_window_get_group (action_data->window);
+ wg = pluma_window_get_group (window);
gtk_window_group_add_window (wg,
GTK_WINDOW (dialog->dialog));
dialog->doc = doc;
gtk_window_set_transient_for (GTK_WINDOW (dialog->dialog),
- GTK_WINDOW (action_data->window));
+ GTK_WINDOW (window));
gtk_window_set_modal (GTK_WINDOW (dialog->dialog),
TRUE);
@@ -439,30 +451,54 @@ sort_real (SortDialog *dialog)
}
static void
-free_window_data (WindowData *data)
+pluma_sort_plugin_set_property (GObject *object,
+ guint prop_id,
+ const GValue *value,
+ GParamSpec *pspec)
{
- g_return_if_fail (data != NULL);
+ PlumaSortPlugin *plugin = PLUMA_SORT_PLUGIN (object);
- g_object_unref (data->ui_action_group);
- g_slice_free (WindowData, data);
+ switch (prop_id)
+ {
+ case PROP_OBJECT:
+ plugin->priv->window = GTK_WIDGET (g_value_dup_object (value));
+ break;
+
+ default:
+ G_OBJECT_WARN_INVALID_PROPERTY_ID (object, prop_id, pspec);
+ break;
+ }
}
static void
-free_action_data (ActionData *data)
+pluma_sort_plugin_get_property (GObject *object,
+ guint prop_id,
+ GValue *value,
+ GParamSpec *pspec)
{
- g_return_if_fail (data != NULL);
+ PlumaSortPlugin *plugin = PLUMA_SORT_PLUGIN (object);
- g_slice_free (ActionData, data);
+ switch (prop_id)
+ {
+ case PROP_OBJECT:
+ g_value_set_object (value, plugin->priv->window);
+ break;
+
+ default:
+ G_OBJECT_WARN_INVALID_PROPERTY_ID (object, prop_id, pspec);
+ break;
+ }
}
static void
-update_ui_real (PlumaWindow *window,
- WindowData *data)
+update_ui (PlumaSortPluginPrivate *data)
{
+ PlumaWindow *window;
PlumaView *view;
pluma_debug (DEBUG_PLUGINS);
+ window = PLUMA_WINDOW (data->window);
view = pluma_window_get_active_view (window);
gtk_action_group_set_sensitive (data->ui_action_group,
@@ -471,30 +507,28 @@ update_ui_real (PlumaWindow *window,
}
static void
-impl_activate (PlumaPlugin *plugin,
- PlumaWindow *window)
+pluma_sort_plugin_activate (PeasActivatable *activatable)
{
+ PlumaSortPlugin *plugin;
+ PlumaSortPluginPrivate *data;
+ PlumaWindow *window;
GtkUIManager *manager;
- WindowData *data;
- ActionData *action_data;
pluma_debug (DEBUG_PLUGINS);
- data = g_slice_new (WindowData);
- action_data = g_slice_new (ActionData);
- action_data->window = window;
- action_data->plugin = plugin;
+ plugin = PLUMA_SORT_PLUGIN (activatable);
+ data = plugin->priv;
+ window = PLUMA_WINDOW (data->window);
manager = pluma_window_get_ui_manager (window);
data->ui_action_group = gtk_action_group_new ("PlumaSortPluginActions");
gtk_action_group_set_translation_domain (data->ui_action_group,
GETTEXT_PACKAGE);
- gtk_action_group_add_actions_full (data->ui_action_group,
+ gtk_action_group_add_actions (data->ui_action_group,
action_entries,
G_N_ELEMENTS (action_entries),
- action_data,
- (GDestroyNotify) free_action_data);
+ plugin);
gtk_ui_manager_insert_action_group (manager,
data->ui_action_group,
@@ -502,11 +536,6 @@ impl_activate (PlumaPlugin *plugin,
data->ui_id = gtk_ui_manager_new_merge_id (manager);
- g_object_set_data_full (G_OBJECT (window),
- WINDOW_DATA_KEY,
- data,
- (GDestroyNotify) free_window_data);
-
gtk_ui_manager_add_ui (manager,
data->ui_id,
MENU_PATH,
@@ -515,74 +544,101 @@ impl_activate (PlumaPlugin *plugin,
GTK_UI_MANAGER_MENUITEM,
FALSE);
- update_ui_real (window,
- data);
+ update_ui (data);
}
static void
-impl_deactivate (PlumaPlugin *plugin,
- PlumaWindow *window)
+pluma_sort_plugin_deactivate (PeasActivatable *activatable)
{
+ PlumaSortPluginPrivate *data;
+ PlumaWindow *window;
GtkUIManager *manager;
- WindowData *data;
pluma_debug (DEBUG_PLUGINS);
- manager = pluma_window_get_ui_manager (window);
+ data = PLUMA_SORT_PLUGIN (activatable)->priv;
+ window = PLUMA_WINDOW (data->window);
- data = (WindowData *) g_object_get_data (G_OBJECT (window),
- WINDOW_DATA_KEY);
- g_return_if_fail (data != NULL);
+ manager = pluma_window_get_ui_manager (window);
gtk_ui_manager_remove_ui (manager,
data->ui_id);
gtk_ui_manager_remove_action_group (manager,
data->ui_action_group);
-
- g_object_set_data (G_OBJECT (window),
- WINDOW_DATA_KEY,
- NULL);
}
static void
-impl_update_ui (PlumaPlugin *plugin,
- PlumaWindow *window)
+pluma_sort_plugin_update_state (PeasActivatable *activatable)
{
- WindowData *data;
-
pluma_debug (DEBUG_PLUGINS);
- data = (WindowData *) g_object_get_data (G_OBJECT (window),
- WINDOW_DATA_KEY);
- g_return_if_fail (data != NULL);
-
- update_ui_real (window,
- data);
+ update_ui (PLUMA_SORT_PLUGIN (activatable)->priv);
}
static void
pluma_sort_plugin_init (PlumaSortPlugin *plugin)
{
pluma_debug_message (DEBUG_PLUGINS, "PlumaSortPlugin initializing");
+
+ plugin->priv = PLUMA_SORT_PLUGIN_GET_PRIVATE (plugin);
}
static void
-pluma_sort_plugin_finalize (GObject *object)
+pluma_sort_plugin_dispose (GObject *object)
{
- pluma_debug_message (DEBUG_PLUGINS, "PlumaSortPlugin finalizing");
+ PlumaSortPlugin *plugin = PLUMA_SORT_PLUGIN (object);
+
+ pluma_debug_message (DEBUG_PLUGINS, "PlumaSortPlugin disposing");
+
+ if (plugin->priv->window != NULL)
+ {
+ g_object_unref (plugin->priv->window);
+ plugin->priv->window = NULL;
+ }
+
+ if (plugin->priv->ui_action_group)
+ {
+ g_object_unref (plugin->priv->ui_action_group);
+ plugin->priv->ui_action_group = NULL;
+ }
- G_OBJECT_CLASS (pluma_sort_plugin_parent_class)->finalize (object);
+ G_OBJECT_CLASS (pluma_sort_plugin_parent_class)->dispose (object);
}
static void
pluma_sort_plugin_class_init (PlumaSortPluginClass *klass)
{
GObjectClass *object_class = G_OBJECT_CLASS (klass);
- PlumaPluginClass *plugin_class = PLUMA_PLUGIN_CLASS (klass);
- object_class->finalize = pluma_sort_plugin_finalize;
+ object_class->dispose = pluma_sort_plugin_dispose;
+ object_class->set_property = pluma_sort_plugin_set_property;
+ object_class->get_property = pluma_sort_plugin_get_property;
+
+ g_object_class_override_property (object_class, PROP_OBJECT, "object");
+
+ g_type_class_add_private (klass, sizeof (PlumaSortPluginPrivate));
+}
+
+static void
+pluma_sort_plugin_class_finalize (PlumaSortPluginClass *klass)
+{
+ /* dummy function - used by G_DEFINE_DYNAMIC_TYPE_EXTENDED */
+}
+
+static void
+peas_activatable_iface_init (PeasActivatableInterface *iface)
+{
+ iface->activate = pluma_sort_plugin_activate;
+ iface->deactivate = pluma_sort_plugin_deactivate;
+ iface->update_state = pluma_sort_plugin_update_state;
+}
+
+G_MODULE_EXPORT void
+peas_register_types (PeasObjectModule *module)
+{
+ pluma_sort_plugin_register_type (G_TYPE_MODULE (module));
- plugin_class->activate = impl_activate;
- plugin_class->deactivate = impl_deactivate;
- plugin_class->update_ui = impl_update_ui;
+ peas_object_module_register_extension_type (module,
+ PEAS_TYPE_ACTIVATABLE,
+ PLUMA_TYPE_SORT_PLUGIN);
}
diff --git a/plugins/sort/pluma-sort-plugin.h b/plugins/sort/pluma-sort-plugin.h
index 2ba82441..fc495633 100644
--- a/plugins/sort/pluma-sort-plugin.h
+++ b/plugins/sort/pluma-sort-plugin.h
@@ -23,7 +23,8 @@
#include <glib.h>
#include <glib-object.h>
-#include <pluma/pluma-plugin.h>
+#include <libpeas/peas-extension-base.h>
+#include <libpeas/peas-object-module.h>
G_BEGIN_DECLS
@@ -47,7 +48,10 @@ typedef struct _PlumaSortPlugin PlumaSortPlugin;
struct _PlumaSortPlugin
{
- PlumaPlugin parent_instance;
+ PeasExtensionBase parent_instance;
+
+ /*< private >*/
+ PlumaSortPluginPrivate *priv;
};
/*
@@ -57,7 +61,7 @@ typedef struct _PlumaSortPluginClass PlumaSortPluginClass;
struct _PlumaSortPluginClass
{
- PlumaPluginClass parent_class;
+ PeasExtensionBaseClass parent_class;
};
/*
@@ -66,7 +70,7 @@ struct _PlumaSortPluginClass
GType pluma_sort_plugin_get_type (void) G_GNUC_CONST;
/* All the plugins must implement this function */
-G_MODULE_EXPORT GType register_pluma_plugin (GTypeModule *module);
+G_MODULE_EXPORT void peas_register_types (PeasObjectModule *module);
G_END_DECLS
diff --git a/plugins/sort/sort.pluma-plugin.desktop.in b/plugins/sort/sort.plugin.desktop.in
index 6676ab6b..5775a984 100644
--- a/plugins/sort/sort.pluma-plugin.desktop.in
+++ b/plugins/sort/sort.plugin.desktop.in
@@ -1,4 +1,4 @@
-[Pluma Plugin]
+[Plugin]
Module=sort
IAge=2
_Name=Sort
diff --git a/plugins/spell/Makefile.am b/plugins/spell/Makefile.am
index 001b25ae..9b15bc36 100644
--- a/plugins/spell/Makefile.am
+++ b/plugins/spell/Makefile.am
@@ -44,11 +44,11 @@ pluma-spell-marshal.c: pluma-spell-marshal.list $(GLIB_GENMARSHAL)
$(AM_V_GEN) echo "#include \"pluma-spell-marshal.h\"" > $@ && \
$(GLIB_GENMARSHAL) $< --body --prefix=pluma_marshal >> $@
-plugin_in_files = spell.pluma-plugin.desktop.in
+plugin_in_files = spell.plugin.desktop.in
-%.pluma-plugin: %.pluma-plugin.desktop.in $(INTLTOOL_MERGE) $(wildcard $(top_srcdir)/po/*po) ; $(INTLTOOL_MERGE) $(top_srcdir)/po $< $@ -d -u -c $(top_builddir)/po/.intltool-merge-cache
+%.plugin: %.plugin.desktop.in $(INTLTOOL_MERGE) $(wildcard $(top_srcdir)/po/*po) ; $(INTLTOOL_MERGE) $(top_srcdir)/po $< $@ -d -u -c $(top_builddir)/po/.intltool-merge-cache
-plugin_DATA = $(plugin_in_files:.pluma-plugin.desktop.in=.pluma-plugin)
+plugin_DATA = $(plugin_in_files:.plugin.desktop.in=.plugin)
@INTLTOOL_XML_NOMERGE_RULE@
spell_gschema_in = org.mate.pluma.plugins.spell.gschema.xml.in
diff --git a/plugins/spell/pluma-spell-plugin.c b/plugins/spell/pluma-spell-plugin.c
index d856dd7b..b7f96eb3 100644
--- a/plugins/spell/pluma-spell-plugin.c
+++ b/plugins/spell/pluma-spell-plugin.c
@@ -31,9 +31,11 @@
#include <glib/gi18n.h>
#include <gmodule.h>
+#include <libpeas/peas-activatable.h>
+#include <libpeas-gtk/peas-gtk-configurable.h>
+#include <pluma/pluma-window.h>
#include <pluma/pluma-debug.h>
-#include <pluma/pluma-help.h>
#include <pluma/pluma-prefs-manager.h>
#include <pluma/pluma-statusbar.h>
#include <pluma/pluma-utils.h>
@@ -46,7 +48,6 @@
#define PLUMA_METADATA_ATTRIBUTE_SPELL_LANGUAGE "metadata::pluma-spell-language"
#define PLUMA_METADATA_ATTRIBUTE_SPELL_ENABLED "metadata::pluma-spell-enabled"
-#define WINDOW_DATA_KEY "PlumaSpellPluginWindowData"
#define MENU_PATH "/MenuBar/ToolsMenu/ToolsOps_1"
#define PLUMA_SPELL_PLUGIN_GET_PRIVATE(object)(G_TYPE_INSTANCE_GET_PRIVATE ((object), \
@@ -57,32 +58,39 @@
#define SPELL_SCHEMA "org.mate.pluma.plugins.spell"
#define AUTOCHECK_TYPE_KEY "autocheck-type"
-PLUMA_PLUGIN_REGISTER_TYPE(PlumaSpellPlugin, pluma_spell_plugin)
+static void peas_activatable_iface_init (PeasActivatableInterface *iface);
+static void peas_gtk_configurable_iface_init (PeasGtkConfigurableInterface *iface);
+
+G_DEFINE_DYNAMIC_TYPE_EXTENDED (PlumaSpellPlugin,
+ pluma_spell_plugin,
+ PEAS_TYPE_EXTENSION_BASE,
+ 0,
+ G_IMPLEMENT_INTERFACE_DYNAMIC (PEAS_TYPE_ACTIVATABLE,
+ peas_activatable_iface_init)
+ G_IMPLEMENT_INTERFACE_DYNAMIC (PEAS_GTK_TYPE_CONFIGURABLE,
+ peas_gtk_configurable_iface_init))
+
+enum {
+ PROP_0,
+ PROP_OBJECT
+};
-typedef struct
+struct _PlumaSpellPluginPrivate
{
+ GtkWidget *window;
+
GtkActionGroup *action_group;
guint ui_id;
guint message_cid;
gulong tab_added_id;
gulong tab_removed_id;
- PlumaSpellPlugin *plugin;
-} WindowData;
-typedef struct
-{
- PlumaPlugin *plugin;
- PlumaWindow *window;
-} ActionData;
-
-struct _PlumaSpellPluginPrivate
-{
GSettings *settings;
};
-static void spell_cb (GtkAction *action, ActionData *action_data);
-static void set_language_cb (GtkAction *action, ActionData *action_data);
-static void auto_spell_cb (GtkAction *action, PlumaWindow *window);
+static void spell_cb (GtkAction *action, PlumaSpellPlugin *plugin);
+static void set_language_cb (GtkAction *action, PlumaSpellPlugin *plugin);
+static void auto_spell_cb (GtkAction *action, PlumaSpellPlugin *plugin);
/* UI actions. */
static const GtkActionEntry action_entries[] =
@@ -120,13 +128,13 @@ typedef struct _SpellConfigureDialog SpellConfigureDialog;
struct _SpellConfigureDialog
{
- GtkWidget *dialog;
+ GtkWidget *content;
GtkWidget *never;
GtkWidget *always;
GtkWidget *document;
- PlumaSpellPlugin *plugin;
+ GSettings *settings;
};
typedef enum
@@ -163,15 +171,27 @@ pluma_spell_plugin_init (PlumaSpellPlugin *plugin)
}
static void
-pluma_spell_plugin_finalize (GObject *object)
+pluma_spell_plugin_dispose (GObject *object)
{
PlumaSpellPlugin *plugin = PLUMA_SPELL_PLUGIN (object);
- pluma_debug_message (DEBUG_PLUGINS, "PlumaSpellPlugin finalizing");
+ pluma_debug_message (DEBUG_PLUGINS, "PlumaSpellPlugin disposing");
+
+ if (plugin->priv->window != NULL)
+ {
+ g_object_unref (plugin->priv->window);
+ plugin->priv->window = NULL;
+ }
+
+ if (plugin->priv->action_group)
+ {
+ g_object_unref (plugin->priv->action_group);
+ plugin->priv->action_group = NULL;
+ }
g_object_unref (G_OBJECT (plugin->priv->settings));
- G_OBJECT_CLASS (pluma_spell_plugin_parent_class)->finalize (object);
+ G_OBJECT_CLASS (pluma_spell_plugin_parent_class)->dispose (object);
}
static void
@@ -226,16 +246,16 @@ get_autocheck_type (PlumaSpellPlugin *plugin)
}
static void
-set_autocheck_type (PlumaSpellPlugin *plugin,
+set_autocheck_type (GSettings *settings,
PlumaSpellPluginAutocheckType autocheck_type)
{
- if (!g_settings_is_writable (plugin->priv->settings,
+ if (!g_settings_is_writable (settings,
AUTOCHECK_TYPE_KEY))
{
return;
}
- g_settings_set_enum (plugin->priv->settings,
+ g_settings_set_enum (settings,
AUTOCHECK_TYPE_KEY,
autocheck_type);
}
@@ -739,7 +759,6 @@ get_configure_dialog (PlumaSpellPlugin *plugin)
SpellConfigureDialog *dialog = NULL;
gchar *data_dir;
gchar *ui_file;
- GtkWidget *content;
PlumaSpellPluginAutocheckType autocheck_type;
GtkWidget *error_widget;
gboolean ret;
@@ -750,37 +769,15 @@ get_configure_dialog (PlumaSpellPlugin *plugin)
pluma_debug (DEBUG_PLUGINS);
- GtkWidget *dlg = gtk_dialog_new_with_buttons (_("Configure Spell Checker plugin..."),
- NULL,
- GTK_DIALOG_DESTROY_WITH_PARENT,
- GTK_STOCK_CANCEL,
- GTK_RESPONSE_CANCEL,
- GTK_STOCK_OK,
- GTK_RESPONSE_OK,
- GTK_STOCK_HELP,
- GTK_RESPONSE_HELP,
- NULL);
-
- g_return_val_if_fail (dlg != NULL, NULL);
+ dialog = g_slice_new (SpellConfigureDialog);
+ dialog->settings = g_object_ref (plugin->priv->settings);
- dialog = g_new0 (SpellConfigureDialog, 1);
- dialog->dialog = dlg;
-
-
- /* HIG defaults */
- gtk_container_set_border_width (GTK_CONTAINER (GTK_DIALOG (dialog->dialog)), 5);
- gtk_box_set_spacing (GTK_BOX (gtk_dialog_get_content_area (GTK_DIALOG (dialog->dialog))),
- 2); /* 2 * 5 + 2 = 12 */
- gtk_container_set_border_width (GTK_CONTAINER (gtk_dialog_get_action_area (GTK_DIALOG (dialog->dialog))),
- 5);
- gtk_box_set_spacing (GTK_BOX (gtk_dialog_get_action_area (GTK_DIALOG (dialog->dialog))), 6);
-
- data_dir = pluma_plugin_get_data_dir (PLUMA_PLUGIN (plugin));
+ data_dir = peas_extension_base_get_data_dir (PEAS_EXTENSION_BASE (plugin));
ui_file = g_build_filename (data_dir, "pluma-spell-setup-dialog.ui", NULL);
ret = pluma_utils_get_ui_objects (ui_file,
root_objects,
&error_widget,
- "spell_dialog_content", &content,
+ "spell_dialog_content", &dialog->content,
"autocheck_never", &dialog->never,
"autocheck_document", &dialog->document,
"autocheck_always", &dialog->always,
@@ -791,18 +788,9 @@ get_configure_dialog (PlumaSpellPlugin *plugin)
if (!ret)
{
- gtk_box_pack_start (GTK_BOX (gtk_dialog_get_content_area (GTK_DIALOG (dialog->dialog))),
- error_widget, TRUE, TRUE, 0);
-
- gtk_container_set_border_width (GTK_CONTAINER (error_widget), 5);
-
- gtk_widget_show (error_widget);
-
- return dialog;
+ return NULL;
}
- gtk_window_set_resizable (GTK_WINDOW (dialog->dialog), FALSE);
-
autocheck_type = get_autocheck_type (plugin);
if (autocheck_type == AUTOCHECK_ALWAYS)
@@ -818,75 +806,46 @@ get_configure_dialog (PlumaSpellPlugin *plugin)
gtk_toggle_button_set_active (GTK_TOGGLE_BUTTON (dialog->never), TRUE);
}
- gtk_window_set_default_size (GTK_WIDGET (content), 15, 120);
-
- gtk_box_pack_start (GTK_BOX (gtk_dialog_get_content_area (GTK_DIALOG (dialog->dialog))),
- content, FALSE, FALSE, 0);
- g_object_unref (content);
- gtk_container_set_border_width (GTK_CONTAINER (content), 5);
-
- gtk_dialog_set_default_response (GTK_DIALOG (dialog->dialog),
- GTK_RESPONSE_OK);
-
return dialog;
}
static void
-ok_button_pressed (SpellConfigureDialog *dialog)
+configure_dialog_button_toggled (GtkToggleButton *button,
+ SpellConfigureDialog *dialog)
{
pluma_debug (DEBUG_PLUGINS);
if (gtk_toggle_button_get_active (GTK_TOGGLE_BUTTON (dialog->always)))
{
- set_autocheck_type (dialog->plugin, AUTOCHECK_ALWAYS);
+ set_autocheck_type (dialog->settings, AUTOCHECK_ALWAYS);
}
else if (gtk_toggle_button_get_active (GTK_TOGGLE_BUTTON (dialog->document)))
{
- set_autocheck_type (dialog->plugin, AUTOCHECK_DOCUMENT);
+ set_autocheck_type (dialog->settings, AUTOCHECK_DOCUMENT);
}
else
{
- set_autocheck_type (dialog->plugin, AUTOCHECK_NEVER);
+ set_autocheck_type (dialog->settings, AUTOCHECK_NEVER);
}
}
static void
-configure_dialog_response_cb (GtkWidget *widget,
- gint response,
- SpellConfigureDialog *dialog)
+configure_dialog_destroyed (GtkWidget *widget,
+ gpointer data)
{
- switch (response)
- {
- case GTK_RESPONSE_HELP:
- {
- pluma_debug_message (DEBUG_PLUGINS, "GTK_RESPONSE_HELP");
-
- pluma_help_display (GTK_WINDOW (widget),
- NULL,
- "pluma-spell-checker-plugin");
- break;
- }
- case GTK_RESPONSE_OK:
- {
- pluma_debug_message (DEBUG_PLUGINS, "GTK_RESPONSE_OK");
+ SpellConfigureDialog *dialog = (SpellConfigureDialog *) data;
- ok_button_pressed (dialog);
+ pluma_debug (DEBUG_PLUGINS);
- gtk_widget_destroy (dialog->dialog);
- break;
- }
- case GTK_RESPONSE_CANCEL:
- {
- pluma_debug_message (DEBUG_PLUGINS, "GTK_RESPONSE_CANCEL");
- gtk_widget_destroy (dialog->dialog);
- }
- }
+ g_object_unref (dialog->settings);
+ g_slice_free (SpellConfigureDialog, data);
}
static void
set_language_cb (GtkAction *action,
- ActionData *action_data)
+ PlumaSpellPlugin *plugin)
{
+ PlumaWindow *window;
PlumaDocument *doc;
PlumaSpellChecker *spell;
const PlumaSpellCheckerLanguage *lang;
@@ -896,7 +855,8 @@ set_language_cb (GtkAction *action,
pluma_debug (DEBUG_PLUGINS);
- doc = pluma_window_get_active_document (action_data->window);
+ window = PLUMA_WINDOW (plugin->priv->window);
+ doc = pluma_window_get_active_document (window);
g_return_if_fail (doc != NULL);
spell = get_spell_checker_from_document (doc);
@@ -904,13 +864,13 @@ set_language_cb (GtkAction *action,
lang = pluma_spell_checker_get_language (spell);
- data_dir = pluma_plugin_get_data_dir (action_data->plugin);
- dlg = pluma_spell_language_dialog_new (GTK_WINDOW (action_data->window),
+ data_dir = peas_extension_base_get_data_dir (PEAS_EXTENSION_BASE (plugin));
+ dlg = pluma_spell_language_dialog_new (GTK_WINDOW (window),
lang,
data_dir);
g_free (data_dir);
- wg = pluma_window_get_group (action_data->window);
+ wg = pluma_window_get_group (window);
gtk_window_group_add_window (wg, GTK_WINDOW (dlg));
@@ -926,8 +886,10 @@ set_language_cb (GtkAction *action,
static void
spell_cb (GtkAction *action,
- ActionData *action_data)
+ PlumaSpellPlugin *plugin)
{
+ PlumaSpellPluginPrivate *data;
+ PlumaWindow *window;
PlumaView *view;
PlumaDocument *doc;
PlumaSpellChecker *spell;
@@ -938,7 +900,9 @@ spell_cb (GtkAction *action,
pluma_debug (DEBUG_PLUGINS);
- view = pluma_window_get_active_view (action_data->window);
+ data = plugin->priv;
+ window = PLUMA_WINDOW (data->window);
+ view = pluma_window_get_active_view (window);
g_return_if_fail (view != NULL);
doc = PLUMA_DOCUMENT (gtk_text_view_get_buffer (GTK_TEXT_VIEW (view)));
@@ -949,14 +913,9 @@ spell_cb (GtkAction *action,
if (gtk_text_buffer_get_char_count (GTK_TEXT_BUFFER (doc)) <= 0)
{
- WindowData *data;
GtkWidget *statusbar;
- data = (WindowData *) g_object_get_data (G_OBJECT (action_data->window),
- WINDOW_DATA_KEY);
- g_return_if_fail (data != NULL);
-
- statusbar = pluma_window_get_statusbar (action_data->window);
+ statusbar = pluma_window_get_statusbar (window);
pluma_statusbar_flash_message (PLUMA_STATUSBAR (statusbar),
data->message_cid,
_("The document is empty."));
@@ -979,14 +938,9 @@ spell_cb (GtkAction *action,
word = get_next_misspelled_word (view);
if (word == NULL)
{
- WindowData *data;
GtkWidget *statusbar;
- data = (WindowData *) g_object_get_data (G_OBJECT (action_data->window),
- WINDOW_DATA_KEY);
- g_return_if_fail (data != NULL);
-
- statusbar = pluma_window_get_statusbar (action_data->window);
+ statusbar = pluma_window_get_statusbar (window);
pluma_statusbar_flash_message (PLUMA_STATUSBAR (statusbar),
data->message_cid,
_("No misspelled words"));
@@ -994,12 +948,13 @@ spell_cb (GtkAction *action,
return;
}
- data_dir = pluma_plugin_get_data_dir (action_data->plugin);
+ data_dir = peas_extension_base_get_data_dir (PEAS_EXTENSION_BASE (plugin));
dlg = pluma_spell_checker_dialog_new_from_spell_checker (spell, data_dir);
g_free (data_dir);
+
gtk_window_set_modal (GTK_WINDOW (dlg), TRUE);
gtk_window_set_transient_for (GTK_WINDOW (dlg),
- GTK_WINDOW (action_data->window));
+ GTK_WINDOW (window));
g_signal_connect (dlg, "ignore", G_CALLBACK (ignore_cb), view);
g_signal_connect (dlg, "ignore_all", G_CALLBACK (ignore_cb), view);
@@ -1059,15 +1014,16 @@ set_auto_spell (PlumaWindow *window,
static void
auto_spell_cb (GtkAction *action,
- PlumaWindow *window)
+ PlumaSpellPlugin *plugin)
{
-
+ PlumaWindow *window;
PlumaDocument *doc;
gboolean active;
- WindowData *data;
pluma_debug (DEBUG_PLUGINS);
+ window = PLUMA_WINDOW (plugin->priv->window);
+
active = gtk_toggle_action_get_active (GTK_TOGGLE_ACTION (action));
pluma_debug_message (DEBUG_PLUGINS, active ? "Auto Spell activated" : "Auto Spell deactivated");
@@ -1076,12 +1032,8 @@ auto_spell_cb (GtkAction *action,
if (doc == NULL)
return;
- data = g_object_get_data (G_OBJECT (window),
- WINDOW_DATA_KEY);
-
- if (get_autocheck_type(data->plugin) == AUTOCHECK_DOCUMENT)
+ if (get_autocheck_type (plugin) == AUTOCHECK_DOCUMENT)
{
-
pluma_document_set_metadata (doc,
PLUMA_METADATA_ATTRIBUTE_SPELL_ENABLED,
active ? "1" : NULL, NULL);
@@ -1091,26 +1043,10 @@ auto_spell_cb (GtkAction *action,
}
static void
-free_window_data (WindowData *data)
-{
- g_return_if_fail (data != NULL);
-
- g_object_unref (data->action_group);
- g_slice_free (WindowData, data);
-}
-
-static void
-free_action_data (gpointer data)
-{
- g_return_if_fail (data != NULL);
-
- g_slice_free (ActionData, data);
-}
-
-static void
-update_ui_real (PlumaWindow *window,
- WindowData *data)
+update_ui (PlumaSpellPlugin *plugin)
{
+ PlumaSpellPluginPrivate *data;
+ PlumaWindow *window;
PlumaDocument *doc;
PlumaView *view;
gboolean autospell;
@@ -1118,6 +1054,8 @@ update_ui_real (PlumaWindow *window,
pluma_debug (DEBUG_PLUGINS);
+ data = plugin->priv;
+ window = PLUMA_WINDOW (data->window);
doc = pluma_window_get_active_document (window);
view = pluma_window_get_active_view (window);
@@ -1140,12 +1078,12 @@ update_ui_real (PlumaWindow *window,
"AutoSpell");
g_signal_handlers_block_by_func (action, auto_spell_cb,
- window);
+ plugin);
set_auto_spell (window, doc, autospell);
gtk_toggle_action_set_active (GTK_TOGGLE_ACTION (action),
autospell);
g_signal_handlers_unblock_by_func (action, auto_spell_cb,
- window);
+ plugin);
}
}
@@ -1155,20 +1093,17 @@ update_ui_real (PlumaWindow *window,
}
static void
-set_auto_spell_from_metadata (PlumaWindow *window,
+set_auto_spell_from_metadata (PlumaSpellPlugin *plugin,
PlumaDocument *doc,
GtkActionGroup *action_group)
{
gboolean active = FALSE;
gchar *active_str = NULL;
+ PlumaWindow *window;
PlumaDocument *active_doc;
PlumaSpellPluginAutocheckType autocheck_type;
- WindowData *data;
-
- data = g_object_get_data (G_OBJECT (window),
- WINDOW_DATA_KEY);
- autocheck_type = get_autocheck_type(data->plugin);
+ autocheck_type = get_autocheck_type (plugin);
switch (autocheck_type)
{
@@ -1196,6 +1131,8 @@ set_auto_spell_from_metadata (PlumaWindow *window,
g_free (active_str);
}
+ window = PLUMA_WINDOW (plugin->priv->window);
+
set_auto_spell (window, doc, active);
/* In case that the doc is the active one we mark the spell action */
@@ -1209,22 +1146,21 @@ set_auto_spell_from_metadata (PlumaWindow *window,
"AutoSpell");
g_signal_handlers_block_by_func (action, auto_spell_cb,
- window);
+ plugin);
gtk_toggle_action_set_active (GTK_TOGGLE_ACTION (action),
active);
g_signal_handlers_unblock_by_func (action, auto_spell_cb,
- window);
+ plugin);
}
}
static void
on_document_loaded (PlumaDocument *doc,
const GError *error,
- PlumaWindow *window)
+ PlumaSpellPlugin *plugin)
{
if (error == NULL)
{
- WindowData *data;
PlumaSpellChecker *spell;
spell = PLUMA_SPELL_CHECKER (g_object_get_qdata (G_OBJECT (doc),
@@ -1234,22 +1170,18 @@ on_document_loaded (PlumaDocument *doc,
set_language_from_metadata (spell, doc);
}
- data = g_object_get_data (G_OBJECT (window),
- WINDOW_DATA_KEY);
-
- set_auto_spell_from_metadata (window, doc, data->action_group);
+ set_auto_spell_from_metadata (plugin, doc, plugin->priv->action_group);
}
}
static void
on_document_saved (PlumaDocument *doc,
const GError *error,
- PlumaWindow *window)
+ PlumaSpellPlugin *plugin)
{
PlumaAutomaticSpellChecker *autospell;
PlumaSpellChecker *spell;
const gchar *key;
- WindowData *data;
if (error != NULL)
{
@@ -1269,10 +1201,7 @@ on_document_saved (PlumaDocument *doc,
key = NULL;
}
- data = g_object_get_data (G_OBJECT (window),
- WINDOW_DATA_KEY);
-
- if (get_autocheck_type(data->plugin) == AUTOCHECK_DOCUMENT)
+ if (get_autocheck_type (plugin) == AUTOCHECK_DOCUMENT)
{
pluma_document_set_metadata (doc,
@@ -1294,11 +1223,10 @@ on_document_saved (PlumaDocument *doc,
static void
tab_added_cb (PlumaWindow *window,
PlumaTab *tab,
- gpointer useless)
+ PlumaSpellPlugin *plugin)
{
PlumaDocument *doc;
gchar *uri;
- WindowData *data;
doc = pluma_tab_get_document (tab);
@@ -1306,67 +1234,61 @@ tab_added_cb (PlumaWindow *window,
if (!uri)
{
- data = g_object_get_data (G_OBJECT (window),
- WINDOW_DATA_KEY);
-
- set_auto_spell_from_metadata (window, doc, data->action_group);
+ set_auto_spell_from_metadata (plugin, doc, plugin->priv->action_group);
g_free(uri);
}
g_signal_connect (doc, "loaded",
G_CALLBACK (on_document_loaded),
- window);
+ plugin);
g_signal_connect (doc, "saved",
G_CALLBACK (on_document_saved),
- window);
+ plugin);
}
static void
tab_removed_cb (PlumaWindow *window,
PlumaTab *tab,
- gpointer useless)
+ PlumaSpellPlugin *plugin)
{
PlumaDocument *doc;
doc = pluma_tab_get_document (tab);
- g_signal_handlers_disconnect_by_func (doc, on_document_loaded, window);
- g_signal_handlers_disconnect_by_func (doc, on_document_saved, window);
+ g_signal_handlers_disconnect_by_func (doc, on_document_loaded, plugin);
+ g_signal_handlers_disconnect_by_func (doc, on_document_saved, plugin);
}
static void
-impl_activate (PlumaPlugin *plugin,
- PlumaWindow *window)
+pluma_spell_plugin_activate (PeasActivatable *activatable)
{
+ PlumaSpellPlugin *plugin;
+ PlumaSpellPluginPrivate *data;
+ PlumaWindow *window;
GtkUIManager *manager;
- WindowData *data;
- ActionData *action_data;
GList *docs, *l;
pluma_debug (DEBUG_PLUGINS);
- data = g_slice_new (WindowData);
- data->plugin = PLUMA_SPELL_PLUGIN (plugin);
- action_data = g_slice_new (ActionData);
- action_data->plugin = plugin;
- action_data->window = window;
+ plugin = PLUMA_SPELL_PLUGIN (activatable);
+ data = plugin->priv;
+ window = PLUMA_WINDOW (data->window);
manager = pluma_window_get_ui_manager (window);
data->action_group = gtk_action_group_new ("PlumaSpellPluginActions");
gtk_action_group_set_translation_domain (data->action_group,
GETTEXT_PACKAGE);
- gtk_action_group_add_actions_full (data->action_group,
+ gtk_action_group_add_actions (data->action_group,
action_entries,
G_N_ELEMENTS (action_entries),
- action_data,
- (GDestroyNotify) free_action_data);
+ plugin);
gtk_action_group_add_toggle_actions (data->action_group,
toggle_action_entries,
G_N_ELEMENTS (toggle_action_entries),
- window);
+ plugin);
gtk_ui_manager_insert_action_group (manager, data->action_group, -1);
@@ -1376,11 +1298,6 @@ impl_activate (PlumaPlugin *plugin,
(GTK_STATUSBAR (pluma_window_get_statusbar (window)),
"spell_plugin_message");
- g_object_set_data_full (G_OBJECT (window),
- WINDOW_DATA_KEY,
- data,
- (GDestroyNotify) free_window_data);
-
gtk_ui_manager_add_ui (manager,
data->ui_id,
MENU_PATH,
@@ -1405,100 +1322,140 @@ impl_activate (PlumaPlugin *plugin,
GTK_UI_MANAGER_MENUITEM,
FALSE);
- update_ui_real (window, data);
+ update_ui (plugin);
docs = pluma_window_get_documents (window);
for (l = docs; l != NULL; l = g_list_next (l))
{
PlumaDocument *doc = PLUMA_DOCUMENT (l->data);
- set_auto_spell_from_metadata (window, doc,
+ set_auto_spell_from_metadata (plugin, doc,
data->action_group);
g_signal_handlers_disconnect_by_func (doc,
on_document_loaded,
- window);
+ plugin);
g_signal_handlers_disconnect_by_func (doc,
on_document_saved,
- window);
+ plugin);
}
data->tab_added_id =
g_signal_connect (window, "tab-added",
- G_CALLBACK (tab_added_cb), NULL);
+ G_CALLBACK (tab_added_cb), plugin);
data->tab_removed_id =
g_signal_connect (window, "tab-removed",
- G_CALLBACK (tab_removed_cb), NULL);
+ G_CALLBACK (tab_removed_cb), plugin);
}
static void
-impl_deactivate (PlumaPlugin *plugin,
- PlumaWindow *window)
+pluma_spell_plugin_deactivate (PeasActivatable *activatable)
{
+ PlumaSpellPluginPrivate *data;
+ PlumaWindow *window;
GtkUIManager *manager;
- WindowData *data;
pluma_debug (DEBUG_PLUGINS);
- manager = pluma_window_get_ui_manager (window);
+ data = PLUMA_SPELL_PLUGIN (activatable)->priv;
+ window = PLUMA_WINDOW (data->window);
- data = (WindowData *) g_object_get_data (G_OBJECT (window), WINDOW_DATA_KEY);
- g_return_if_fail (data != NULL);
+ manager = pluma_window_get_ui_manager (window);
gtk_ui_manager_remove_ui (manager, data->ui_id);
gtk_ui_manager_remove_action_group (manager, data->action_group);
g_signal_handler_disconnect (window, data->tab_added_id);
g_signal_handler_disconnect (window, data->tab_removed_id);
-
- g_object_set_data (G_OBJECT (window), WINDOW_DATA_KEY, NULL);
}
static void
-impl_update_ui (PlumaPlugin *plugin,
- PlumaWindow *window)
+pluma_spell_plugin_update_state (PeasActivatable *activatable)
{
- WindowData *data;
-
pluma_debug (DEBUG_PLUGINS);
- data = (WindowData *) g_object_get_data (G_OBJECT (window), WINDOW_DATA_KEY);
- g_return_if_fail (data != NULL);
+ update_ui (PLUMA_SPELL_PLUGIN (activatable));
+}
+
+static void
+pluma_spell_plugin_set_property (GObject *object,
+ guint prop_id,
+ const GValue *value,
+ GParamSpec *pspec)
+{
+ PlumaSpellPlugin *plugin = PLUMA_SPELL_PLUGIN (object);
- update_ui_real (window, data);
+ switch (prop_id)
+ {
+ case PROP_OBJECT:
+ plugin->priv->window = GTK_WIDGET (g_value_dup_object (value));
+ break;
+
+ default:
+ G_OBJECT_WARN_INVALID_PROPERTY_ID (object, prop_id, pspec);
+ break;
+ }
}
-static GtkWidget *
-impl_create_configure_dialog (PlumaPlugin *plugin)
+static void
+pluma_spell_plugin_get_property (GObject *object,
+ guint prop_id,
+ GValue *value,
+ GParamSpec *pspec)
{
- SpellConfigureDialog *dialog;
+ PlumaSpellPlugin *plugin = PLUMA_SPELL_PLUGIN (object);
- dialog = get_configure_dialog(PLUMA_SPELL_PLUGIN (plugin));
+ switch (prop_id)
+ {
+ case PROP_OBJECT:
+ g_value_set_object (value, plugin->priv->window);
+ break;
- dialog->plugin = PLUMA_SPELL_PLUGIN (plugin);
+ default:
+ G_OBJECT_WARN_INVALID_PROPERTY_ID (object, prop_id, pspec);
+ break;
+ }
+}
- g_signal_connect (dialog->dialog,
- "response",
- G_CALLBACK (configure_dialog_response_cb),
- dialog);
+static GtkWidget *
+pluma_spell_plugin_create_configure_widget (PeasGtkConfigurable *configurable)
+{
+ SpellConfigureDialog *dialog;
- return GTK_WIDGET (dialog->dialog);
+ dialog = get_configure_dialog (PLUMA_SPELL_PLUGIN (configurable));
+
+ g_signal_connect (dialog->always,
+ "toggled",
+ G_CALLBACK (configure_dialog_button_toggled),
+ dialog);
+ g_signal_connect (dialog->document,
+ "toggled",
+ G_CALLBACK (configure_dialog_button_toggled),
+ dialog);
+ g_signal_connect (dialog->never,
+ "toggled",
+ G_CALLBACK (configure_dialog_button_toggled),
+ dialog);
+
+ g_signal_connect (dialog->content,
+ "destroy",
+ G_CALLBACK (configure_dialog_destroyed),
+ dialog);
+
+ return dialog->content;
}
static void
pluma_spell_plugin_class_init (PlumaSpellPluginClass *klass)
{
GObjectClass *object_class = G_OBJECT_CLASS (klass);
- PlumaPluginClass *plugin_class = PLUMA_PLUGIN_CLASS (klass);
- object_class->finalize = pluma_spell_plugin_finalize;
+ object_class->dispose = pluma_spell_plugin_dispose;
+ object_class->set_property = pluma_spell_plugin_set_property;
+ object_class->get_property = pluma_spell_plugin_get_property;
- plugin_class->activate = impl_activate;
- plugin_class->deactivate = impl_deactivate;
- plugin_class->update_ui = impl_update_ui;
-
- plugin_class->create_configure_dialog = impl_create_configure_dialog;
+ g_object_class_override_property (object_class, PROP_OBJECT, "object");
if (spell_checker_id == 0)
spell_checker_id = g_quark_from_string ("PlumaSpellCheckerID");
@@ -1508,3 +1465,37 @@ pluma_spell_plugin_class_init (PlumaSpellPluginClass *klass)
g_type_class_add_private (object_class, sizeof (PlumaSpellPluginPrivate));
}
+
+static void
+pluma_spell_plugin_class_finalize (PlumaSpellPluginClass *klass)
+{
+ /* dummy function - used by G_DEFINE_DYNAMIC_TYPE_EXTENDED */
+}
+
+static void
+peas_activatable_iface_init (PeasActivatableInterface *iface)
+{
+ iface->activate = pluma_spell_plugin_activate;
+ iface->deactivate = pluma_spell_plugin_deactivate;
+ iface->update_state = pluma_spell_plugin_update_state;
+}
+
+static void
+peas_gtk_configurable_iface_init (PeasGtkConfigurableInterface *iface)
+{
+ iface->create_configure_widget = pluma_spell_plugin_create_configure_widget;
+}
+
+G_MODULE_EXPORT void
+peas_register_types (PeasObjectModule *module)
+{
+ pluma_spell_plugin_register_type (G_TYPE_MODULE (module));
+
+ peas_object_module_register_extension_type (module,
+ PEAS_TYPE_ACTIVATABLE,
+ PLUMA_TYPE_SPELL_PLUGIN);
+
+ peas_object_module_register_extension_type (module,
+ PEAS_GTK_TYPE_CONFIGURABLE,
+ PLUMA_TYPE_SPELL_PLUGIN);
+}
diff --git a/plugins/spell/pluma-spell-plugin.h b/plugins/spell/pluma-spell-plugin.h
index d2c06252..aa45eb63 100644
--- a/plugins/spell/pluma-spell-plugin.h
+++ b/plugins/spell/pluma-spell-plugin.h
@@ -25,7 +25,8 @@
#include <glib.h>
#include <glib-object.h>
-#include <pluma/pluma-plugin.h>
+#include <libpeas/peas-extension-base.h>
+#include <libpeas/peas-object-module.h>
G_BEGIN_DECLS
@@ -49,8 +50,9 @@ typedef struct _PlumaSpellPlugin PlumaSpellPlugin;
struct _PlumaSpellPlugin
{
- PlumaPlugin parent_instance;
+ PeasExtensionBase parent_instance;
+ /*< private >*/
PlumaSpellPluginPrivate *priv;
};
@@ -61,7 +63,7 @@ typedef struct _PlumaSpellPluginClass PlumaSpellPluginClass;
struct _PlumaSpellPluginClass
{
- PlumaPluginClass parent_class;
+ PeasExtensionBaseClass parent_class;
};
/*
@@ -70,7 +72,7 @@ struct _PlumaSpellPluginClass
GType pluma_spell_plugin_get_type (void) G_GNUC_CONST;
/* All the plugins must implement this function */
-G_MODULE_EXPORT GType register_pluma_plugin (GTypeModule *module);
+G_MODULE_EXPORT void peas_register_types (PeasObjectModule *module);
G_END_DECLS
diff --git a/plugins/spell/spell.pluma-plugin.desktop.in b/plugins/spell/spell.plugin.desktop.in
index 970a505f..9bf11b72 100644
--- a/plugins/spell/spell.pluma-plugin.desktop.in
+++ b/plugins/spell/spell.plugin.desktop.in
@@ -1,4 +1,4 @@
-[Pluma Plugin]
+[Plugin]
Module=spell
IAge=2
_Name=Spell Checker
diff --git a/plugins/taglist/Makefile.am b/plugins/taglist/Makefile.am
index 2b85c58a..044fae3f 100644
--- a/plugins/taglist/Makefile.am
+++ b/plugins/taglist/Makefile.am
@@ -30,9 +30,9 @@ libtaglist_la_SOURCES = \
libtaglist_la_LDFLAGS = $(PLUGIN_LIBTOOL_FLAGS)
libtaglist_la_LIBADD = $(PLUMA_LIBS)
-plugin_in_files = taglist.pluma-plugin.desktop.in
+plugin_in_files = taglist.plugin.desktop.in
-%.pluma-plugin: %.pluma-plugin.desktop.in $(INTLTOOL_MERGE) $(wildcard $(top_srcdir)/po/*po)
+%.plugin: %.plugin.desktop.in $(INTLTOOL_MERGE) $(wildcard $(top_srcdir)/po/*po)
$(INTLTOOL_MERGE) $(top_srcdir)/po $< $@ -d -u -c $(top_builddir)/po/.intltool-merge-cache
GZIP_ENV = -9
@@ -41,7 +41,7 @@ GZIP_ENV = -9
LC_ALL=C $(INTLTOOL_MERGE) $(top_srcdir)/po $< $(@:.gz=) -x -u -c $(top_builddir)/po/.intltool-merge-cache
GZIP=$(GZIP_ENV) gzip -n -f $(@:.gz=)
-plugin_DATA = $(plugin_in_files:.pluma-plugin.desktop.in=.pluma-plugin)
+plugin_DATA = $(plugin_in_files:.plugin.desktop.in=.plugin)
EXTRA_DIST = \
$(taglist_in_files) $(taglist_DATA) \
diff --git a/plugins/taglist/pluma-taglist-plugin-panel.c b/plugins/taglist/pluma-taglist-plugin-panel.c
index 8e5fd458..3c1b39a3 100644
--- a/plugins/taglist/pluma-taglist-plugin-panel.c
+++ b/plugins/taglist/pluma-taglist-plugin-panel.c
@@ -39,7 +39,6 @@
#include <pluma/pluma-utils.h>
#include <pluma/pluma-debug.h>
-#include <pluma/pluma-plugin.h>
#include <gtk/gtk.h>
#include <gdk/gdkkeysyms.h>
@@ -69,7 +68,7 @@ struct _PlumaTaglistPluginPanelPrivate
gchar *data_dir;
};
-PLUMA_PLUGIN_DEFINE_TYPE (PlumaTaglistPluginPanel, pluma_taglist_plugin_panel, GTK_TYPE_BOX)
+G_DEFINE_DYNAMIC_TYPE (PlumaTaglistPluginPanel, pluma_taglist_plugin_panel, GTK_TYPE_BOX)
enum
{
@@ -161,6 +160,12 @@ pluma_taglist_plugin_panel_class_init (PlumaTaglistPluginPanelClass *klass)
}
static void
+pluma_taglist_plugin_panel_class_finalize (PlumaTaglistPluginPanelClass *klass)
+{
+ /* dummy function - used by G_DEFINE_DYNAMIC_TYPE */
+}
+
+static void
insert_tag (PlumaTaglistPluginPanel *panel,
Tag *tag,
gboolean grab_focus)
@@ -783,3 +788,9 @@ pluma_taglist_plugin_panel_new (PlumaWindow *window,
return GTK_WIDGET (panel);
}
+
+void
+_pluma_taglist_plugin_panel_register_type (GTypeModule *type_module)
+{
+ pluma_taglist_plugin_panel_register_type (type_module);
+}
diff --git a/plugins/taglist/pluma-taglist-plugin-panel.h b/plugins/taglist/pluma-taglist-plugin-panel.h
index ab001b17..346dbd37 100644
--- a/plugins/taglist/pluma-taglist-plugin-panel.h
+++ b/plugins/taglist/pluma-taglist-plugin-panel.h
@@ -77,7 +77,7 @@ struct _PlumaTaglistPluginPanelClass
/*
* Public methods
*/
-GType pluma_taglist_plugin_panel_register_type (GTypeModule *module);
+void _pluma_taglist_plugin_panel_register_type (GTypeModule *module);
GType pluma_taglist_plugin_panel_get_type (void) G_GNUC_CONST;
diff --git a/plugins/taglist/pluma-taglist-plugin-parser.c b/plugins/taglist/pluma-taglist-plugin-parser.c
index a67fae5d..75c06f39 100644
--- a/plugins/taglist/pluma-taglist-plugin-parser.c
+++ b/plugins/taglist/pluma-taglist-plugin-parser.c
@@ -43,8 +43,6 @@
#include "pluma-taglist-plugin-parser.h"
-/* we screwed up so we still look here for compatibility */
-#define USER_PLUMA_TAGLIST_PLUGIN_LOCATION_LEGACY ".pluma/plugins/taglist/"
#define USER_PLUMA_TAGLIST_PLUGIN_LOCATION "pluma/taglist/"
TagList* taglist = NULL;
@@ -603,33 +601,12 @@ TagList* create_taglist(const gchar* data_dir)
}
const gchar* home;
- const gchar* envvar;
/* load user's taglists */
- /* legacy dir */
home = g_get_home_dir ();
if (home != NULL)
{
- pdir = g_build_filename (home,
- USER_PLUMA_TAGLIST_PLUGIN_LOCATION_LEGACY,
- NULL);
- parse_taglist_dir (pdir);
- g_free (pdir);
- }
-
- /* Support old libmate env var */
- envvar = g_getenv ("MATE22_USER_DIR");
- if (envvar != NULL)
- {
- pdir = g_build_filename (envvar,
- USER_PLUMA_TAGLIST_PLUGIN_LOCATION,
- NULL);
- parse_taglist_dir (pdir);
- g_free (pdir);
- }
- else if (home != NULL)
- {
pdir = g_build_filename(home, ".config", USER_PLUMA_TAGLIST_PLUGIN_LOCATION, NULL);
parse_taglist_dir(pdir);
g_free (pdir);
diff --git a/plugins/taglist/pluma-taglist-plugin.c b/plugins/taglist/pluma-taglist-plugin.c
index 391a6dde..7feeeb78 100644
--- a/plugins/taglist/pluma-taglist-plugin.c
+++ b/plugins/taglist/pluma-taglist-plugin.c
@@ -37,23 +37,37 @@
#include <glib/gi18n-lib.h>
#include <gmodule.h>
+#include <libpeas/peas-activatable.h>
-#include <pluma/pluma-plugin.h>
+#include <pluma/pluma-window.h>
#include <pluma/pluma-debug.h>
-#define WINDOW_DATA_KEY "PlumaTaglistPluginWindowData"
-
#define PLUMA_TAGLIST_PLUGIN_GET_PRIVATE(object)(G_TYPE_INSTANCE_GET_PRIVATE ((object), PLUMA_TYPE_TAGLIST_PLUGIN, PlumaTaglistPluginPrivate))
struct _PlumaTaglistPluginPrivate
{
- gpointer dummy;
+ GtkWidget *window;
+
+ GtkWidget *taglist_panel;
};
-PLUMA_PLUGIN_REGISTER_TYPE_WITH_CODE (PlumaTaglistPlugin, pluma_taglist_plugin,
- pluma_taglist_plugin_panel_register_type (module);
+static void peas_activatable_iface_init (PeasActivatableInterface *iface);
+
+G_DEFINE_DYNAMIC_TYPE_EXTENDED (PlumaTaglistPlugin,
+ pluma_taglist_plugin,
+ PEAS_TYPE_EXTENSION_BASE,
+ 0,
+ G_IMPLEMENT_INTERFACE_DYNAMIC (PEAS_TYPE_ACTIVATABLE,
+ peas_activatable_iface_init) \
+ \
+ _pluma_taglist_plugin_panel_register_type (type_module); \
)
+enum {
+ PROP_0,
+ PROP_OBJECT
+};
+
static void
pluma_taglist_plugin_init (PlumaTaglistPlugin *plugin)
{
@@ -63,11 +77,24 @@ pluma_taglist_plugin_init (PlumaTaglistPlugin *plugin)
}
static void
-pluma_taglist_plugin_finalize (GObject *object)
+pluma_taglist_plugin_dispose (GObject *object)
{
-/*
PlumaTaglistPlugin *plugin = PLUMA_TAGLIST_PLUGIN (object);
-*/
+
+ pluma_debug_message (DEBUG_PLUGINS, "PlumaTaglistPlugin disposing");
+
+ if (plugin->priv->window != NULL)
+ {
+ g_object_unref (plugin->priv->window);
+ plugin->priv->window = NULL;
+ }
+
+ G_OBJECT_CLASS (pluma_taglist_plugin_parent_class)->dispose (object);
+}
+
+static void
+pluma_taglist_plugin_finalize (GObject *object)
+{
pluma_debug_message (DEBUG_PLUGINS, "PlumaTaglistPlugin finalizing");
free_taglist ();
@@ -76,85 +103,139 @@ pluma_taglist_plugin_finalize (GObject *object)
}
static void
-impl_activate (PlumaPlugin *plugin,
- PlumaWindow *window)
+pluma_taglist_plugin_activate (PeasActivatable *activatable)
{
+ PlumaTaglistPluginPrivate *priv;
+ PlumaWindow *window;
PlumaPanel *side_panel;
- GtkWidget *taglist_panel;
gchar *data_dir;
-
+
pluma_debug (DEBUG_PLUGINS);
-
- g_return_if_fail (g_object_get_data (G_OBJECT (window), WINDOW_DATA_KEY) == NULL);
-
+
+ priv = PLUMA_TAGLIST_PLUGIN (activatable)->priv;
+ window = PLUMA_WINDOW (priv->window);
side_panel = pluma_window_get_side_panel (window);
-
- data_dir = pluma_plugin_get_data_dir (plugin);
- taglist_panel = pluma_taglist_plugin_panel_new (window, data_dir);
+
+ data_dir = peas_extension_base_get_data_dir (PEAS_EXTENSION_BASE (activatable));
+ priv->taglist_panel = pluma_taglist_plugin_panel_new (window, data_dir);
g_free (data_dir);
-
+
pluma_panel_add_item_with_stock_icon (side_panel,
- taglist_panel,
+ priv->taglist_panel,
_("Tags"),
GTK_STOCK_ADD);
-
- g_object_set_data (G_OBJECT (window),
- WINDOW_DATA_KEY,
- taglist_panel);
}
static void
-impl_deactivate (PlumaPlugin *plugin,
- PlumaWindow *window)
+pluma_taglist_plugin_deactivate (PeasActivatable *activatable)
{
+ PlumaTaglistPluginPrivate *priv;
+ PlumaWindow *window;
PlumaPanel *side_panel;
- gpointer data;
pluma_debug (DEBUG_PLUGINS);
- data = g_object_get_data (G_OBJECT (window), WINDOW_DATA_KEY);
- g_return_if_fail (data != NULL);
-
+ priv = PLUMA_TAGLIST_PLUGIN (activatable)->priv;
+ window = PLUMA_WINDOW (priv->window);
side_panel = pluma_window_get_side_panel (window);
pluma_panel_remove_item (side_panel,
- GTK_WIDGET (data));
-
- g_object_set_data (G_OBJECT (window),
- WINDOW_DATA_KEY,
- NULL);
+ priv->taglist_panel);
}
static void
-impl_update_ui (PlumaPlugin *plugin,
- PlumaWindow *window)
+pluma_taglist_plugin_update_state (PeasActivatable *activatable)
{
- gpointer data;
+ PlumaTaglistPluginPrivate *priv;
+ PlumaWindow *window;
PlumaView *view;
-
+
pluma_debug (DEBUG_PLUGINS);
-
- data = g_object_get_data (G_OBJECT (window), WINDOW_DATA_KEY);
- g_return_if_fail (data != NULL);
-
+
+ priv = PLUMA_TAGLIST_PLUGIN (activatable)->priv;
+ window = PLUMA_WINDOW (priv->window);
view = pluma_window_get_active_view (window);
-
- gtk_widget_set_sensitive (GTK_WIDGET (data),
+
+ gtk_widget_set_sensitive (priv->taglist_panel,
(view != NULL) &&
gtk_text_view_get_editable (GTK_TEXT_VIEW (view)));
}
static void
+pluma_taglist_plugin_set_property (GObject *object,
+ guint prop_id,
+ const GValue *value,
+ GParamSpec *pspec)
+{
+ PlumaTaglistPlugin *plugin = PLUMA_TAGLIST_PLUGIN (object);
+
+ switch (prop_id)
+ {
+ case PROP_OBJECT:
+ plugin->priv->window = GTK_WIDGET (g_value_dup_object (value));
+ break;
+
+ default:
+ G_OBJECT_WARN_INVALID_PROPERTY_ID (object, prop_id, pspec);
+ break;
+ }
+}
+
+static void
+pluma_taglist_plugin_get_property (GObject *object,
+ guint prop_id,
+ GValue *value,
+ GParamSpec *pspec)
+{
+ PlumaTaglistPlugin *plugin = PLUMA_TAGLIST_PLUGIN (object);
+
+ switch (prop_id)
+ {
+ case PROP_OBJECT:
+ g_value_set_object (value, plugin->priv->window);
+ break;
+
+ default:
+ G_OBJECT_WARN_INVALID_PROPERTY_ID (object, prop_id, pspec);
+ break;
+ }
+}
+
+static void
pluma_taglist_plugin_class_init (PlumaTaglistPluginClass *klass)
{
GObjectClass *object_class = G_OBJECT_CLASS (klass);
- PlumaPluginClass *plugin_class = PLUMA_PLUGIN_CLASS (klass);
object_class->finalize = pluma_taglist_plugin_finalize;
+ object_class->dispose = pluma_taglist_plugin_dispose;
+ object_class->set_property = pluma_taglist_plugin_set_property;
+ object_class->get_property = pluma_taglist_plugin_get_property;
- plugin_class->activate = impl_activate;
- plugin_class->deactivate = impl_deactivate;
- plugin_class->update_ui = impl_update_ui;
+ g_object_class_override_property (object_class, PROP_OBJECT, "object");
g_type_class_add_private (object_class, sizeof (PlumaTaglistPluginPrivate));
}
+
+static void
+pluma_taglist_plugin_class_finalize (PlumaTaglistPluginClass *klass)
+{
+ /* dummy function - used by G_DEFINE_DYNAMIC_TYPE_EXTENDED */
+}
+
+static void
+peas_activatable_iface_init (PeasActivatableInterface *iface)
+{
+ iface->activate = pluma_taglist_plugin_activate;
+ iface->deactivate = pluma_taglist_plugin_deactivate;
+ iface->update_state = pluma_taglist_plugin_update_state;
+}
+
+G_MODULE_EXPORT void
+peas_register_types (PeasObjectModule *module)
+{
+ pluma_taglist_plugin_register_type (G_TYPE_MODULE (module));
+
+ peas_object_module_register_extension_type (module,
+ PEAS_TYPE_ACTIVATABLE,
+ PLUMA_TYPE_TAGLIST_PLUGIN);
+}
diff --git a/plugins/taglist/pluma-taglist-plugin.h b/plugins/taglist/pluma-taglist-plugin.h
index a73fbe2d..0ffd1294 100644
--- a/plugins/taglist/pluma-taglist-plugin.h
+++ b/plugins/taglist/pluma-taglist-plugin.h
@@ -32,7 +32,8 @@
#include <glib.h>
#include <glib-object.h>
-#include <pluma/pluma-plugin.h>
+#include <libpeas/peas-extension-base.h>
+#include <libpeas/peas-object-module.h>
G_BEGIN_DECLS
@@ -56,7 +57,7 @@ typedef struct _PlumaTaglistPlugin PlumaTaglistPlugin;
struct _PlumaTaglistPlugin
{
- PlumaPlugin parent_instance;
+ PeasExtensionBase parent_instance;
/*< private >*/
PlumaTaglistPluginPrivate *priv;
@@ -69,7 +70,7 @@ typedef struct _PlumaTaglistPluginClass PlumaTaglistPluginClass;
struct _PlumaTaglistPluginClass
{
- PlumaPluginClass parent_class;
+ PeasExtensionBaseClass parent_class;
};
/*
@@ -78,7 +79,7 @@ struct _PlumaTaglistPluginClass
GType pluma_taglist_plugin_get_type (void) G_GNUC_CONST;
/* All the plugins must implement this function */
-G_MODULE_EXPORT GType register_pluma_plugin (GTypeModule *module);
+G_MODULE_EXPORT void peas_register_types (PeasObjectModule *module);
G_END_DECLS
diff --git a/plugins/taglist/taglist.pluma-plugin.desktop.in b/plugins/taglist/taglist.plugin.desktop.in
index a138ff3a..00b07952 100644
--- a/plugins/taglist/taglist.pluma-plugin.desktop.in
+++ b/plugins/taglist/taglist.plugin.desktop.in
@@ -1,4 +1,4 @@
-[Pluma Plugin]
+[Plugin]
Module=taglist
IAge=2
_Name=Tag list
diff --git a/plugins/time/Makefile.am b/plugins/time/Makefile.am
index d1f8fe3b..30363e76 100644
--- a/plugins/time/Makefile.am
+++ b/plugins/time/Makefile.am
@@ -21,11 +21,11 @@ ui_DATA = \
pluma-time-dialog.ui \
pluma-time-setup-dialog.ui
-plugin_in_files = time.pluma-plugin.desktop.in
+plugin_in_files = time.plugin.desktop.in
-%.pluma-plugin: %.pluma-plugin.desktop.in $(INTLTOOL_MERGE) $(wildcard $(top_srcdir)/po/*po) ; $(INTLTOOL_MERGE) $(top_srcdir)/po $< $@ -d -u -c $(top_builddir)/po/.intltool-merge-cache
+%.plugin: %.plugin.desktop.in $(INTLTOOL_MERGE) $(wildcard $(top_srcdir)/po/*po) ; $(INTLTOOL_MERGE) $(top_srcdir)/po $< $@ -d -u -c $(top_builddir)/po/.intltool-merge-cache
-plugin_DATA = $(plugin_in_files:.pluma-plugin.desktop.in=.pluma-plugin)
+plugin_DATA = $(plugin_in_files:.plugin.desktop.in=.plugin)
@INTLTOOL_XML_NOMERGE_RULE@
time_gschema_in = org.mate.pluma.plugins.time.gschema.xml.in
diff --git a/plugins/time/pluma-time-plugin.c b/plugins/time/pluma-time-plugin.c
index 1cda2c35..1266f971 100644
--- a/plugins/time/pluma-time-plugin.c
+++ b/plugins/time/pluma-time-plugin.c
@@ -40,7 +40,10 @@
#include <glib.h>
#include <gmodule.h>
#include <gio/gio.h>
+#include <libpeas/peas-activatable.h>
+#include <libpeas-gtk/peas-gtk-configurable.h>
+#include <pluma/pluma-window.h>
#include <pluma/pluma-debug.h>
#include <pluma/pluma-utils.h>
@@ -48,7 +51,6 @@
PLUMA_TYPE_TIME_PLUGIN, \
PlumaTimePluginPrivate))
-#define WINDOW_DATA_KEY "PlumaTimePluginWindowData"
#define MENU_PATH "/MenuBar/EditMenu/EditOps_4"
/* GSettings keys */
@@ -106,7 +108,7 @@ typedef struct _TimeConfigureDialog TimeConfigureDialog;
struct _TimeConfigureDialog
{
- GtkWidget *dialog;
+ GtkWidget *content;
GtkWidget *list;
@@ -118,8 +120,7 @@ struct _TimeConfigureDialog
GtkWidget *custom_entry;
GtkWidget *custom_format_example;
- /* Info needed for the response handler */
- PlumaTimePlugin *plugin;
+ GSettings *settings;
};
typedef struct _ChooseFormatDialog ChooseFormatDialog;
@@ -139,7 +140,8 @@ struct _ChooseFormatDialog
/* Info needed for the response handler */
GtkTextBuffer *buffer;
- PlumaTimePlugin *plugin;
+
+ GSettings *settings;
};
typedef enum
@@ -152,24 +154,32 @@ typedef enum
struct _PlumaTimePluginPrivate
{
- GSettings *settings;
-};
+ GtkWidget *window;
-PLUMA_PLUGIN_REGISTER_TYPE(PlumaTimePlugin, pluma_time_plugin)
+ GSettings *settings;
-typedef struct
-{
GtkActionGroup *action_group;
guint ui_id;
-} WindowData;
+};
-typedef struct
-{
- PlumaWindow *window;
- PlumaTimePlugin *plugin;
-} ActionData;
+enum {
+ PROP_0,
+ PROP_OBJECT
+};
+
+static void peas_activatable_iface_init (PeasActivatableInterface *iface);
+static void peas_gtk_configurable_iface_init (PeasGtkConfigurableInterface *iface);
-static void time_cb (GtkAction *action, ActionData *data);
+G_DEFINE_DYNAMIC_TYPE_EXTENDED (PlumaTimePlugin,
+ pluma_time_plugin,
+ PEAS_TYPE_EXTENSION_BASE,
+ 0,
+ G_IMPLEMENT_INTERFACE_DYNAMIC (PEAS_TYPE_ACTIVATABLE,
+ peas_activatable_iface_init)
+ G_IMPLEMENT_INTERFACE_DYNAMIC (PEAS_GTK_TYPE_CONFIGURABLE,
+ peas_gtk_configurable_iface_init))
+
+static void time_cb (GtkAction *action, PlumaTimePlugin *plugin);
static const GtkActionEntry action_entries[] =
{
@@ -206,23 +216,37 @@ pluma_time_plugin_finalize (GObject *object)
}
static void
-free_window_data (WindowData *data)
+pluma_time_plugin_dispose (GObject *object)
{
- g_return_if_fail (data != NULL);
+ PlumaTimePlugin *plugin = PLUMA_TIME_PLUGIN (object);
+
+ pluma_debug_message (DEBUG_PLUGINS, "PlumaTimePlugin disposing");
+
+ if (plugin->priv->window != NULL)
+ {
+ g_object_unref (plugin->priv->window);
+ plugin->priv->window = NULL;
+ }
+
+ if (plugin->priv->action_group)
+ {
+ g_object_unref (plugin->priv->action_group);
+ plugin->priv->action_group = NULL;
+ }
- g_object_unref (data->action_group);
- g_free (data);
+ G_OBJECT_CLASS (pluma_time_plugin_parent_class)->dispose (object);
}
static void
-update_ui_real (PlumaWindow *window,
- WindowData *data)
+update_ui (PlumaTimePluginPrivate *data)
{
+ PlumaWindow *window;
PlumaView *view;
GtkAction *action;
pluma_debug (DEBUG_PLUGINS);
+ window = PLUMA_WINDOW (data->window);
view = pluma_window_get_active_view (window);
pluma_debug_message (DEBUG_PLUGINS, "View: %p", view);
@@ -235,41 +259,33 @@ update_ui_real (PlumaWindow *window,
}
static void
-impl_activate (PlumaPlugin *plugin,
- PlumaWindow *window)
+pluma_time_plugin_activate (PeasActivatable *activatable)
{
+ PlumaTimePlugin *plugin;
+ PlumaTimePluginPrivate *data;
+ PlumaWindow *window;
GtkUIManager *manager;
- WindowData *data;
- ActionData *action_data;
pluma_debug (DEBUG_PLUGINS);
- data = g_new (WindowData, 1);
- action_data = g_new (ActionData, 1);
-
- action_data->plugin = PLUMA_TIME_PLUGIN (plugin);
- action_data->window = window;
+ plugin = PLUMA_TIME_PLUGIN (activatable);
+ data = plugin->priv;
+ window = PLUMA_WINDOW (data->window);
manager = pluma_window_get_ui_manager (window);
data->action_group = gtk_action_group_new ("PlumaTimePluginActions");
gtk_action_group_set_translation_domain (data->action_group,
GETTEXT_PACKAGE);
- gtk_action_group_add_actions_full (data->action_group,
+ gtk_action_group_add_actions (data->action_group,
action_entries,
G_N_ELEMENTS (action_entries),
- action_data,
- (GDestroyNotify) g_free);
+ plugin);
gtk_ui_manager_insert_action_group (manager, data->action_group, -1);
data->ui_id = gtk_ui_manager_new_merge_id (manager);
- g_object_set_data_full (G_OBJECT (window),
- WINDOW_DATA_KEY,
- data,
- (GDestroyNotify) free_window_data);
-
gtk_ui_manager_add_ui (manager,
data->ui_id,
MENU_PATH,
@@ -278,41 +294,33 @@ impl_activate (PlumaPlugin *plugin,
GTK_UI_MANAGER_MENUITEM,
FALSE);
- update_ui_real (window, data);
+ update_ui (data);
}
static void
-impl_deactivate (PlumaPlugin *plugin,
- PlumaWindow *window)
+pluma_time_plugin_deactivate (PeasActivatable *activatable)
{
+ PlumaTimePluginPrivate *data;
+ PlumaWindow *window;
GtkUIManager *manager;
- WindowData *data;
pluma_debug (DEBUG_PLUGINS);
- manager = pluma_window_get_ui_manager (window);
+ data = PLUMA_TIME_PLUGIN (activatable)->priv;
+ window = PLUMA_WINDOW (data->window);
- data = (WindowData *) g_object_get_data (G_OBJECT (window), WINDOW_DATA_KEY);
- g_return_if_fail (data != NULL);
+ manager = pluma_window_get_ui_manager (window);
gtk_ui_manager_remove_ui (manager, data->ui_id);
gtk_ui_manager_remove_action_group (manager, data->action_group);
-
- g_object_set_data (G_OBJECT (window), WINDOW_DATA_KEY, NULL);
}
static void
-impl_update_ui (PlumaPlugin *plugin,
- PlumaWindow *window)
+pluma_time_plugin_update_state (PeasActivatable *activatable)
{
- WindowData *data;
-
pluma_debug (DEBUG_PLUGINS);
- data = (WindowData *) g_object_get_data (G_OBJECT (window), WINDOW_DATA_KEY);
- g_return_if_fail (data != NULL);
-
- update_ui_real (window, data);
+ update_ui (PLUMA_TIME_PLUGIN (activatable)->priv);
}
/* whether we should prompt the user or use the specified format */
@@ -328,16 +336,16 @@ get_prompt_type (PlumaTimePlugin *plugin)
}
static void
-set_prompt_type (PlumaTimePlugin *plugin,
+set_prompt_type (GSettings *settings,
PlumaTimePluginPromptType prompt_type)
{
- if (!g_settings_is_writable (plugin->priv->settings,
+ if (!g_settings_is_writable (settings,
PROMPT_TYPE_KEY))
{
return;
}
- g_settings_set_enum (plugin->priv->settings,
+ g_settings_set_enum (settings,
PROMPT_TYPE_KEY,
prompt_type);
}
@@ -355,18 +363,18 @@ get_selected_format (PlumaTimePlugin *plugin)
}
static void
-set_selected_format (PlumaTimePlugin *plugin,
+set_selected_format (GSettings *settings,
const gchar *format)
{
g_return_if_fail (format != NULL);
- if (!g_settings_is_writable (plugin->priv->settings,
+ if (!g_settings_is_writable (settings,
SELECTED_FORMAT_KEY))
{
return;
}
- g_settings_set_string (plugin->priv->settings,
+ g_settings_set_string (settings,
SELECTED_FORMAT_KEY,
format);
}
@@ -384,16 +392,16 @@ get_custom_format (PlumaTimePlugin *plugin)
}
static void
-set_custom_format (PlumaTimePlugin *plugin,
+set_custom_format (GSettings *settings,
const gchar *format)
{
g_return_if_fail (format != NULL);
- if (!g_settings_is_writable (plugin->priv->settings,
+ if (!g_settings_is_writable (settings,
CUSTOM_FORMAT_KEY))
return;
- g_settings_set_string (plugin->priv->settings,
+ g_settings_set_string (settings,
CUSTOM_FORMAT_KEY,
format);
}
@@ -448,13 +456,24 @@ get_time (const gchar* format)
}
static void
-dialog_disposed (GObject *obj, gpointer dialog_pointer)
+configure_dialog_destroyed (GtkWidget *widget,
+ gpointer data)
{
+ TimeConfigureDialog *dialog = (TimeConfigureDialog *) data;
+
pluma_debug (DEBUG_PLUGINS);
- g_free (dialog_pointer);
+ g_object_unref (dialog->settings);
+ g_slice_free (TimeConfigureDialog, data);
+}
- pluma_debug_message (DEBUG_PLUGINS, "END");
+static void
+choose_format_dialog_destroyed (GtkWidget *widget,
+ gpointer data)
+{
+ pluma_debug (DEBUG_PLUGINS);
+
+ g_slice_free (ChooseFormatDialog, data);
}
static GtkTreeModel *
@@ -640,6 +659,7 @@ configure_dialog_button_toggled (GtkToggleButton *button, TimeConfigureDialog *d
gtk_widget_set_sensitive (dialog->custom_entry, TRUE);
gtk_widget_set_sensitive (dialog->custom_format_example, TRUE);
+ set_prompt_type (dialog->settings, USE_CUSTOM_FORMAT);
return;
}
@@ -649,6 +669,7 @@ configure_dialog_button_toggled (GtkToggleButton *button, TimeConfigureDialog *d
gtk_widget_set_sensitive (dialog->custom_entry, FALSE);
gtk_widget_set_sensitive (dialog->custom_format_example, FALSE);
+ set_prompt_type (dialog->settings, USE_SELECTED_FORMAT);
return;
}
@@ -658,6 +679,7 @@ configure_dialog_button_toggled (GtkToggleButton *button, TimeConfigureDialog *d
gtk_widget_set_sensitive (dialog->custom_entry, FALSE);
gtk_widget_set_sensitive (dialog->custom_format_example, FALSE);
+ set_prompt_type (dialog->settings, PROMPT_SELECTED_FORMAT);
return;
}
}
@@ -691,13 +713,23 @@ get_format_from_list (GtkWidget *listview)
g_return_val_if_reached (0);
}
+static void
+configure_dialog_selection_changed (GtkTreeSelection *selection,
+ TimeConfigureDialog *dialog)
+{
+ gint sel_format;
+
+ sel_format = get_format_from_list (dialog->list);
+ set_selected_format (dialog->settings, formats[sel_format]);
+}
+
static TimeConfigureDialog *
get_configure_dialog (PlumaTimePlugin *plugin)
{
TimeConfigureDialog *dialog = NULL;
+ GtkTreeSelection *selection;
gchar *data_dir;
gchar *ui_file;
- GtkWidget *content;
GtkWidget *viewport;
PlumaTimePluginPromptType prompt_type;
gchar *sf, *cf;
@@ -710,37 +742,15 @@ get_configure_dialog (PlumaTimePlugin *plugin)
pluma_debug (DEBUG_PLUGINS);
- GtkWidget *dlg = gtk_dialog_new_with_buttons (_("Configure insert date/time plugin..."),
- NULL,
- GTK_DIALOG_DESTROY_WITH_PARENT,
- GTK_STOCK_CANCEL,
- GTK_RESPONSE_CANCEL,
- GTK_STOCK_OK,
- GTK_RESPONSE_OK,
- GTK_STOCK_HELP,
- GTK_RESPONSE_HELP,
- NULL);
-
- g_return_val_if_fail (dlg != NULL, NULL);
+ dialog = g_slice_new (TimeConfigureDialog);
+ dialog->settings = g_object_ref (plugin->priv->settings);
- dialog = g_new0 (TimeConfigureDialog, 1);
- dialog->dialog = dlg;
-
- /* HIG defaults */
- gtk_container_set_border_width (GTK_CONTAINER (GTK_DIALOG (dialog->dialog)), 5);
- gtk_box_set_spacing (GTK_BOX (gtk_dialog_get_content_area (GTK_DIALOG (dialog->dialog))),
- 2); /* 2 * 5 + 2 = 12 */
- gtk_container_set_border_width (GTK_CONTAINER (gtk_dialog_get_action_area (GTK_DIALOG (dialog->dialog))),
- 5);
- gtk_box_set_spacing (GTK_BOX (gtk_dialog_get_action_area (GTK_DIALOG (dialog->dialog))), 6);
-
-
- data_dir = pluma_plugin_get_data_dir (PLUMA_PLUGIN (plugin));
+ data_dir = peas_extension_base_get_data_dir (PEAS_EXTENSION_BASE (plugin));
ui_file = g_build_filename (data_dir, "pluma-time-setup-dialog.ui", NULL);
ret = pluma_utils_get_ui_objects (ui_file,
root_objects,
&error_widget,
- "time_dialog_content", &content,
+ "time_dialog_content", &dialog->content,
"formats_viewport", &viewport,
"formats_tree", &dialog->list,
"always_prompt", &dialog->prompt,
@@ -755,27 +765,20 @@ get_configure_dialog (PlumaTimePlugin *plugin)
if (!ret)
{
- gtk_box_pack_start (GTK_BOX (gtk_dialog_get_content_area (GTK_DIALOG (dialog->dialog))),
- error_widget,
- TRUE, TRUE, 0);
- gtk_container_set_border_width (GTK_CONTAINER (error_widget), 5);
-
- gtk_widget_show (error_widget);
-
- return dialog;
+ return NULL;
}
- gtk_window_set_resizable (GTK_WINDOW (dialog->dialog), FALSE);
-
sf = get_selected_format (plugin);
create_formats_list (dialog->list, sf, plugin);
g_free (sf);
prompt_type = get_prompt_type (plugin);
- cf = get_custom_format (plugin);
- gtk_entry_set_text (GTK_ENTRY(dialog->custom_entry), cf);
- g_free (cf);
+ g_settings_bind (dialog->settings,
+ CUSTOM_FORMAT_KEY,
+ dialog->custom_entry,
+ "text",
+ G_SETTINGS_BIND_GET | G_SETTINGS_BIND_SET);
if (prompt_type == USE_CUSTOM_FORMAT)
{
@@ -808,14 +811,6 @@ get_configure_dialog (PlumaTimePlugin *plugin)
/* setup a window of a sane size. */
gtk_widget_set_size_request (GTK_WIDGET (viewport), 10, 200);
- gtk_box_pack_start (GTK_BOX (gtk_dialog_get_content_area (GTK_DIALOG (dialog->dialog))),
- content, FALSE, FALSE, 0);
- g_object_unref (content);
- gtk_container_set_border_width (GTK_CONTAINER (content), 5);
-
- gtk_dialog_set_default_response (GTK_DIALOG (dialog->dialog),
- GTK_RESPONSE_OK);
-
g_signal_connect (dialog->custom,
"toggled",
G_CALLBACK (configure_dialog_button_toggled),
@@ -828,15 +823,21 @@ get_configure_dialog (PlumaTimePlugin *plugin)
"toggled",
G_CALLBACK (configure_dialog_button_toggled),
dialog);
- g_signal_connect (dialog->dialog,
- "dispose",
- G_CALLBACK (dialog_disposed),
+ g_signal_connect (dialog->content,
+ "destroy",
+ G_CALLBACK (configure_dialog_destroyed),
dialog);
g_signal_connect (dialog->custom_entry,
"changed",
G_CALLBACK (updated_custom_format_example),
dialog->custom_format_example);
+ selection = gtk_tree_view_get_selection (GTK_TREE_VIEW (dialog->list));
+ g_signal_connect (selection,
+ "changed",
+ G_CALLBACK (configure_dialog_selection_changed),
+ dialog);
+
return dialog;
}
@@ -866,8 +867,8 @@ choose_format_dialog_row_activated (GtkTreeView *list,
sel_format = get_format_from_list (dialog->list);
the_time = get_time (formats[sel_format]);
- set_prompt_type (dialog->plugin, PROMPT_SELECTED_FORMAT);
- set_selected_format (dialog->plugin, formats[sel_format]);
+ set_prompt_type (dialog->settings, PROMPT_SELECTED_FORMAT);
+ set_selected_format (dialog->settings, formats[sel_format]);
g_return_if_fail (the_time != NULL);
@@ -892,9 +893,10 @@ get_choose_format_dialog (GtkWindow *parent,
if (parent != NULL)
wg = gtk_window_get_group (parent);
- dialog = g_new0 (ChooseFormatDialog, 1);
+ dialog = g_slice_new (ChooseFormatDialog);
+ dialog->settings = plugin->priv->settings;
- data_dir = pluma_plugin_get_data_dir (PLUMA_PLUGIN (plugin));
+ data_dir = peas_extension_base_get_data_dir (PEAS_EXTENSION_BASE (plugin));
ui_file = g_build_filename (data_dir, "pluma-time-dialog.ui", NULL);
ret = pluma_utils_get_ui_objects (ui_file,
NULL,
@@ -991,8 +993,8 @@ get_choose_format_dialog (GtkWindow *parent,
G_CALLBACK (choose_format_dialog_button_toggled),
dialog);
g_signal_connect (dialog->dialog,
- "dispose",
- G_CALLBACK (dialog_disposed),
+ "destroy",
+ G_CALLBACK (choose_format_dialog_destroyed),
dialog);
g_signal_connect (dialog->custom_entry,
"changed",
@@ -1037,8 +1039,8 @@ choose_format_dialog_response_cb (GtkWidget *widget,
sel_format = get_format_from_list (dialog->list);
the_time = get_time (formats[sel_format]);
- set_prompt_type (dialog->plugin, PROMPT_SELECTED_FORMAT);
- set_selected_format (dialog->plugin, formats[sel_format]);
+ set_prompt_type (dialog->settings, PROMPT_SELECTED_FORMAT);
+ set_selected_format (dialog->settings, formats[sel_format]);
}
else
{
@@ -1047,8 +1049,8 @@ choose_format_dialog_response_cb (GtkWidget *widget,
format = gtk_entry_get_text (GTK_ENTRY (dialog->custom_entry));
the_time = get_time (format);
- set_prompt_type (dialog->plugin, PROMPT_CUSTOM_FORMAT);
- set_custom_format (dialog->plugin, format);
+ set_prompt_type (dialog->settings, PROMPT_CUSTOM_FORMAT);
+ set_custom_format (dialog->settings, format);
}
g_return_if_fail (the_time != NULL);
@@ -1067,28 +1069,30 @@ choose_format_dialog_response_cb (GtkWidget *widget,
static void
time_cb (GtkAction *action,
- ActionData *data)
+ PlumaTimePlugin *plugin)
{
+ PlumaWindow *window;
GtkTextBuffer *buffer;
gchar *the_time = NULL;
PlumaTimePluginPromptType prompt_type;
pluma_debug (DEBUG_PLUGINS);
- buffer = GTK_TEXT_BUFFER (pluma_window_get_active_document (data->window));
+ window = PLUMA_WINDOW (plugin->priv->window);
+ buffer = GTK_TEXT_BUFFER (pluma_window_get_active_document (window));
g_return_if_fail (buffer != NULL);
- prompt_type = get_prompt_type (data->plugin);
+ prompt_type = get_prompt_type (plugin);
if (prompt_type == USE_CUSTOM_FORMAT)
{
- gchar *cf = get_custom_format (data->plugin);
+ gchar *cf = get_custom_format (plugin);
the_time = get_time (cf);
g_free (cf);
}
else if (prompt_type == USE_SELECTED_FORMAT)
{
- gchar *sf = get_selected_format (data->plugin);
+ gchar *sf = get_selected_format (plugin);
the_time = get_time (sf);
g_free (sf);
}
@@ -1096,13 +1100,13 @@ time_cb (GtkAction *action,
{
ChooseFormatDialog *dialog;
- dialog = get_choose_format_dialog (GTK_WINDOW (data->window),
+ dialog = get_choose_format_dialog (GTK_WINDOW (window),
prompt_type,
- data->plugin);
+ plugin);
if (dialog != NULL)
{
dialog->buffer = buffer;
- dialog->plugin = data->plugin;
+ dialog->settings = plugin->priv->settings;
g_signal_connect (dialog->dialog,
"response",
@@ -1122,100 +1126,101 @@ time_cb (GtkAction *action,
g_free (the_time);
}
-static void
-ok_button_pressed (TimeConfigureDialog *dialog)
+static GtkWidget *
+pluma_time_plugin_create_configure_widget (PeasGtkConfigurable *configurable)
{
- gint sel_format;
- const gchar *custom_format;
+ TimeConfigureDialog *dialog;
- pluma_debug (DEBUG_PLUGINS);
+ dialog = get_configure_dialog (PLUMA_TIME_PLUGIN (configurable));
- sel_format = get_format_from_list (dialog->list);
+ return dialog->content;
+}
- custom_format = gtk_entry_get_text (GTK_ENTRY (dialog->custom_entry));
+static void
+pluma_time_plugin_set_property (GObject *object,
+ guint prop_id,
+ const GValue *value,
+ GParamSpec *pspec)
+{
+ PlumaTimePlugin *plugin = PLUMA_TIME_PLUGIN (object);
- if (gtk_toggle_button_get_active (GTK_TOGGLE_BUTTON (dialog->custom)))
- {
- set_prompt_type (dialog->plugin, USE_CUSTOM_FORMAT);
- set_custom_format (dialog->plugin, custom_format);
- }
- else if (gtk_toggle_button_get_active (GTK_TOGGLE_BUTTON (dialog->use_list)))
+ switch (prop_id)
{
- set_prompt_type (dialog->plugin, USE_SELECTED_FORMAT);
- set_selected_format (dialog->plugin, formats [sel_format]);
- }
- else
- {
- /* Default to prompt the user with the list selected */
- set_prompt_type (dialog->plugin, PROMPT_SELECTED_FORMAT);
- }
+ case PROP_OBJECT:
+ plugin->priv->window = GTK_WIDGET (g_value_dup_object (value));
+ break;
- pluma_debug_message (DEBUG_PLUGINS, "Sel: %d", sel_format);
+ default:
+ G_OBJECT_WARN_INVALID_PROPERTY_ID (object, prop_id, pspec);
+ break;
+ }
}
static void
-configure_dialog_response_cb (GtkWidget *widget,
- gint response,
- TimeConfigureDialog *dialog)
+pluma_time_plugin_get_property (GObject *object,
+ guint prop_id,
+ GValue *value,
+ GParamSpec *pspec)
{
- switch (response)
- {
- case GTK_RESPONSE_HELP:
- {
- pluma_debug_message (DEBUG_PLUGINS, "GTK_RESPONSE_HELP");
+ PlumaTimePlugin *plugin = PLUMA_TIME_PLUGIN (object);
- pluma_help_display (GTK_WINDOW (widget),
- NULL,
- "pluma-insert-date-time-plugin#pluma-date-time-configure");
+ switch (prop_id)
+ {
+ case PROP_OBJECT:
+ g_value_set_object (value, plugin->priv->window);
break;
- }
- case GTK_RESPONSE_OK:
- {
- pluma_debug_message (DEBUG_PLUGINS, "GTK_RESPONSE_OK");
-
- ok_button_pressed (dialog);
- gtk_widget_destroy (dialog->dialog);
+ default:
+ G_OBJECT_WARN_INVALID_PROPERTY_ID (object, prop_id, pspec);
break;
- }
- case GTK_RESPONSE_CANCEL:
- {
- pluma_debug_message (DEBUG_PLUGINS, "GTK_RESPONSE_CANCEL");
- gtk_widget_destroy (dialog->dialog);
- }
}
}
-static GtkWidget *
-impl_create_configure_dialog (PlumaPlugin *plugin)
+static void
+pluma_time_plugin_class_init (PlumaTimePluginClass *klass)
{
- TimeConfigureDialog *dialog;
+ GObjectClass *object_class = G_OBJECT_CLASS (klass);
- dialog = get_configure_dialog (PLUMA_TIME_PLUGIN (plugin));
+ object_class->finalize = pluma_time_plugin_finalize;
+ object_class->dispose = pluma_time_plugin_dispose;
+ object_class->set_property = pluma_time_plugin_set_property;
+ object_class->get_property = pluma_time_plugin_get_property;
- dialog->plugin = PLUMA_TIME_PLUGIN (plugin);
+ g_object_class_override_property (object_class, PROP_OBJECT, "object");
- g_signal_connect (dialog->dialog,
- "response",
- G_CALLBACK (configure_dialog_response_cb),
- dialog);
+ g_type_class_add_private (object_class, sizeof (PlumaTimePluginPrivate));
+}
- return GTK_WIDGET (dialog->dialog);
+static void
+pluma_time_plugin_class_finalize (PlumaTimePluginClass *klass)
+{
+ /* dummy function - used by G_DEFINE_DYNAMIC_TYPE_EXTENDED */
}
static void
-pluma_time_plugin_class_init (PlumaTimePluginClass *klass)
+peas_activatable_iface_init (PeasActivatableInterface *iface)
{
- GObjectClass *object_class = G_OBJECT_CLASS (klass);
- PlumaPluginClass *plugin_class = PLUMA_PLUGIN_CLASS (klass);
+ iface->activate = pluma_time_plugin_activate;
+ iface->deactivate = pluma_time_plugin_deactivate;
+ iface->update_state = pluma_time_plugin_update_state;
+}
- object_class->finalize = pluma_time_plugin_finalize;
+static void
+peas_gtk_configurable_iface_init (PeasGtkConfigurableInterface *iface)
+{
+ iface->create_configure_widget = pluma_time_plugin_create_configure_widget;
+}
- plugin_class->activate = impl_activate;
- plugin_class->deactivate = impl_deactivate;
- plugin_class->update_ui = impl_update_ui;
+G_MODULE_EXPORT void
+peas_register_types (PeasObjectModule *module)
+{
+ pluma_time_plugin_register_type (G_TYPE_MODULE (module));
- plugin_class->create_configure_dialog = impl_create_configure_dialog;
+ peas_object_module_register_extension_type (module,
+ PEAS_TYPE_ACTIVATABLE,
+ PLUMA_TYPE_TIME_PLUGIN);
- g_type_class_add_private (object_class, sizeof (PlumaTimePluginPrivate));
+ peas_object_module_register_extension_type (module,
+ PEAS_GTK_TYPE_CONFIGURABLE,
+ PLUMA_TYPE_TIME_PLUGIN);
}
diff --git a/plugins/time/pluma-time-plugin.h b/plugins/time/pluma-time-plugin.h
index 7795c9c8..3b9bb7bf 100644
--- a/plugins/time/pluma-time-plugin.h
+++ b/plugins/time/pluma-time-plugin.h
@@ -25,7 +25,8 @@
#include <glib.h>
#include <glib-object.h>
-#include <pluma/pluma-plugin.h>
+#include <libpeas/peas-extension-base.h>
+#include <libpeas/peas-object-module.h>
G_BEGIN_DECLS
@@ -49,7 +50,7 @@ typedef struct _PlumaTimePlugin PlumaTimePlugin;
struct _PlumaTimePlugin
{
- PlumaPlugin parent_instance;
+ PeasExtensionBase parent_instance;
/*< private >*/
PlumaTimePluginPrivate *priv;
@@ -62,7 +63,7 @@ typedef struct _PlumaTimePluginClass PlumaTimePluginClass;
struct _PlumaTimePluginClass
{
- PlumaPluginClass parent_class;
+ PeasExtensionBaseClass parent_class;
};
/*
@@ -71,7 +72,7 @@ struct _PlumaTimePluginClass
GType pluma_time_plugin_get_type (void) G_GNUC_CONST;
/* All the plugins must implement this function */
-G_MODULE_EXPORT GType register_pluma_plugin (GTypeModule *module);
+G_MODULE_EXPORT void peas_register_types (PeasObjectModule *module);
G_END_DECLS
diff --git a/plugins/time/time.pluma-plugin.desktop.in b/plugins/time/time.plugin.desktop.in
index af812768..a59f2085 100644
--- a/plugins/time/time.pluma-plugin.desktop.in
+++ b/plugins/time/time.plugin.desktop.in
@@ -1,4 +1,4 @@
-[Pluma Plugin]
+[Plugin]
Module=time
IAge=2
_Name=Insert Date/Time
diff --git a/plugins/trailsave/Makefile.am b/plugins/trailsave/Makefile.am
index c8446959..d5879e46 100644
--- a/plugins/trailsave/Makefile.am
+++ b/plugins/trailsave/Makefile.am
@@ -16,11 +16,11 @@ libtrailsave_la_SOURCES = \
libtrailsave_la_LDFLAGS = $(PLUGIN_LIBTOOL_FLAGS)
libtrailsave_la_LIBADD = $(PLUMA_LIBS)
-plugin_in_files = trailsave.pluma-plugin.desktop.in
+plugin_in_files = trailsave.plugin.desktop.in
-%.pluma-plugin: %.pluma-plugin.desktop.in $(INTLTOOL_MERGE) $(wildcard $(top_srcdir)/po/*po) ; $(INTLTOOL_MERGE) $(top_srcdir)/po $< $@ -d -u -c $(top_builddir)/po/.intltool-merge-cache
+%.plugin: %.plugin.desktop.in $(INTLTOOL_MERGE) $(wildcard $(top_srcdir)/po/*po) ; $(INTLTOOL_MERGE) $(top_srcdir)/po $< $@ -d -u -c $(top_builddir)/po/.intltool-merge-cache
-plugin_DATA = $(plugin_in_files:.pluma-plugin.desktop.in=.pluma-plugin)
+plugin_DATA = $(plugin_in_files:.plugin.desktop.in=.plugin)
EXTRA_DIST = $(plugin_in_files)
diff --git a/plugins/trailsave/pluma-trail-save-plugin.c b/plugins/trailsave/pluma-trail-save-plugin.c
index dbc1621b..589a85c2 100644
--- a/plugins/trailsave/pluma-trail-save-plugin.c
+++ b/plugins/trailsave/pluma-trail-save-plugin.c
@@ -22,9 +22,35 @@
#include <config.h>
#endif
+#include <libpeas/peas-activatable.h>
+
+#include <pluma/pluma-window.h>
+#include <pluma/pluma-debug.h>
+
#include "pluma-trail-save-plugin.h"
-PLUMA_PLUGIN_REGISTER_TYPE(PlumaTrailSavePlugin, pluma_trail_save_plugin)
+#define PLUMA_TRAIL_SAVE_PLUGIN_GET_PRIVATE(object)(G_TYPE_INSTANCE_GET_PRIVATE ((object), \
+ PLUMA_TYPE_TRAIL_SAVE_PLUGIN, \
+ PlumaTrailSavePluginPrivate))
+
+static void peas_activatable_iface_init (PeasActivatableInterface *iface);
+
+G_DEFINE_DYNAMIC_TYPE_EXTENDED (PlumaTrailSavePlugin,
+ pluma_trail_save_plugin,
+ PEAS_TYPE_EXTENSION_BASE,
+ 0,
+ G_IMPLEMENT_INTERFACE_DYNAMIC (PEAS_TYPE_ACTIVATABLE,
+ peas_activatable_iface_init))
+
+struct _PlumaTrailSavePluginPrivate
+{
+ GtkWidget *window;
+};
+
+enum {
+ PROP_0,
+ PROP_OBJECT
+};
static void
strip_trailing_spaces (GtkTextBuffer *text_buffer)
@@ -107,7 +133,7 @@ on_save (PlumaDocument *document,
const gchar *uri,
PlumaEncoding *encoding,
PlumaDocumentSaveFlags save_flags,
- PlumaPlugin *plugin)
+ PlumaTrailSavePlugin *plugin)
{
GtkTextBuffer *text_buffer = GTK_TEXT_BUFFER (document);
@@ -117,7 +143,7 @@ on_save (PlumaDocument *document,
static void
on_tab_added (PlumaWindow *window,
PlumaTab *tab,
- PlumaPlugin *plugin)
+ PlumaTrailSavePlugin *plugin)
{
PlumaDocument *document;
@@ -128,7 +154,7 @@ on_tab_added (PlumaWindow *window,
static void
on_tab_removed (PlumaWindow *window,
PlumaTab *tab,
- PlumaPlugin *plugin)
+ PlumaTrailSavePlugin *plugin)
{
PlumaDocument *document;
@@ -137,15 +163,19 @@ on_tab_removed (PlumaWindow *window,
}
static void
-impl_activate (PlumaPlugin *plugin,
- PlumaWindow *window)
+pluma_trail_save_plugin_activate (PeasActivatable *activatable)
{
+ PlumaTrailSavePlugin *plugin;
+ PlumaWindow *window;
GList *documents;
GList *documents_iter;
PlumaDocument *document;
pluma_debug (DEBUG_PLUGINS);
+ plugin = PLUMA_TRAIL_SAVE_PLUGIN (activatable);
+ window = PLUMA_WINDOW (plugin->priv->window);
+
g_signal_connect (window, "tab_added", G_CALLBACK (on_tab_added), plugin);
g_signal_connect (window, "tab_removed", G_CALLBACK (on_tab_removed), plugin);
@@ -163,15 +193,19 @@ impl_activate (PlumaPlugin *plugin,
}
static void
-impl_deactivate (PlumaPlugin *plugin,
- PlumaWindow *window)
+pluma_trail_save_plugin_deactivate (PeasActivatable *activatable)
{
+ PlumaTrailSavePlugin *plugin;
+ PlumaWindow *window;
GList *documents;
GList *documents_iter;
PlumaDocument *document;
pluma_debug (DEBUG_PLUGINS);
+ plugin = PLUMA_TRAIL_SAVE_PLUGIN (activatable);
+ window = PLUMA_WINDOW (plugin->priv->window);
+
g_signal_handlers_disconnect_by_data (window, plugin);
documents = pluma_window_get_documents (window);
@@ -191,24 +225,99 @@ static void
pluma_trail_save_plugin_init (PlumaTrailSavePlugin *plugin)
{
pluma_debug_message (DEBUG_PLUGINS, "PlumaTrailSavePlugin initializing");
+
+ plugin->priv = PLUMA_TRAIL_SAVE_PLUGIN_GET_PRIVATE (plugin);
+}
+
+static void
+pluma_trail_save_plugin_dispose (GObject *object)
+{
+ PlumaTrailSavePlugin *plugin = PLUMA_TRAIL_SAVE_PLUGIN (object);
+
+ pluma_debug_message (DEBUG_PLUGINS, "PlumaTrailSavePlugin disposing");
+
+ if (plugin->priv->window != NULL)
+ {
+ g_object_unref (plugin->priv->window);
+ plugin->priv->window = NULL;
+ }
+
+ G_OBJECT_CLASS (pluma_trail_save_plugin_parent_class)->dispose (object);
}
static void
-pluma_trail_save_plugin_finalize (GObject *object)
+pluma_trail_save_plugin_set_property (GObject *object,
+ guint prop_id,
+ const GValue *value,
+ GParamSpec *pspec)
{
- pluma_debug_message (DEBUG_PLUGINS, "PlumaTrailSavePlugin finalizing");
+ PlumaTrailSavePlugin *plugin = PLUMA_TRAIL_SAVE_PLUGIN (object);
- G_OBJECT_CLASS (pluma_trail_save_plugin_parent_class)->finalize (object);
+ switch (prop_id)
+ {
+ case PROP_OBJECT:
+ plugin->priv->window = GTK_WIDGET (g_value_dup_object (value));
+ break;
+
+ default:
+ G_OBJECT_WARN_INVALID_PROPERTY_ID (object, prop_id, pspec);
+ break;
+ }
+}
+
+static void
+pluma_trail_save_plugin_get_property (GObject *object,
+ guint prop_id,
+ GValue *value,
+ GParamSpec *pspec)
+{
+ PlumaTrailSavePlugin *plugin = PLUMA_TRAIL_SAVE_PLUGIN (object);
+
+ switch (prop_id)
+ {
+ case PROP_OBJECT:
+ g_value_set_object (value, plugin->priv->window);
+ break;
+
+ default:
+ G_OBJECT_WARN_INVALID_PROPERTY_ID (object, prop_id, pspec);
+ break;
+ }
}
static void
pluma_trail_save_plugin_class_init (PlumaTrailSavePluginClass *klass)
{
GObjectClass *object_class = G_OBJECT_CLASS (klass);
- PlumaPluginClass *plugin_class = PLUMA_PLUGIN_CLASS (klass);
- object_class->finalize = pluma_trail_save_plugin_finalize;
+ object_class->dispose = pluma_trail_save_plugin_dispose;
+ object_class->set_property = pluma_trail_save_plugin_set_property;
+ object_class->get_property = pluma_trail_save_plugin_get_property;
+
+ g_object_class_override_property (object_class, PROP_OBJECT, "object");
+
+ g_type_class_add_private (object_class, sizeof (PlumaTrailSavePluginPrivate));
+}
+
+static void
+pluma_trail_save_plugin_class_finalize (PlumaTrailSavePluginClass *klass)
+{
+ /* dummy function - used by G_DEFINE_DYNAMIC_TYPE_EXTENDED */
+}
+
+static void
+peas_activatable_iface_init (PeasActivatableInterface *iface)
+{
+ iface->activate = pluma_trail_save_plugin_activate;
+ iface->deactivate = pluma_trail_save_plugin_deactivate;
+}
+
+G_MODULE_EXPORT void
+peas_register_types (PeasObjectModule *module)
+{
+ pluma_trail_save_plugin_register_type (G_TYPE_MODULE (module));
- plugin_class->activate = impl_activate;
- plugin_class->deactivate = impl_deactivate;
+ peas_object_module_register_extension_type (module,
+ PEAS_TYPE_ACTIVATABLE,
+ PLUMA_TYPE_TRAIL_SAVE_PLUGIN);
}
diff --git a/plugins/trailsave/pluma-trail-save-plugin.h b/plugins/trailsave/pluma-trail-save-plugin.h
index 4d0e3306..73608de5 100644
--- a/plugins/trailsave/pluma-trail-save-plugin.h
+++ b/plugins/trailsave/pluma-trail-save-plugin.h
@@ -23,7 +23,8 @@
#include <glib.h>
#include <glib-object.h>
-#include <pluma/pluma-plugin.h>
+#include <libpeas/peas-extension-base.h>
+#include <libpeas/peas-object-module.h>
G_BEGIN_DECLS
@@ -37,6 +38,9 @@ G_BEGIN_DECLS
#define PLUMA_IS_TRAIL_SAVE_PLUGIN_CLASS(k) (G_TYPE_CHECK_CLASS_TYPE ((k), PLUMA_TYPE_TRAIL_SAVE_PLUGIN))
#define PLUMA_TRAIL_SAVE_PLUGIN_GET_CLASS(o) (G_TYPE_INSTANCE_GET_CLASS ((o), PLUMA_TYPE_TRAIL_SAVE_PLUGIN, PlumaTrailSavePluginClass))
+/* Private structure type */
+typedef struct _PlumaTrailSavePluginPrivate PlumaTrailSavePluginPrivate;
+
/*
* Main object structure
*/
@@ -44,7 +48,10 @@ typedef struct _PlumaTrailSavePlugin PlumaTrailSavePlugin;
struct _PlumaTrailSavePlugin
{
- PlumaPlugin parent_instance;
+ PeasExtensionBase parent_instance;
+
+ /*< private >*/
+ PlumaTrailSavePluginPrivate *priv;
};
/*
@@ -54,7 +61,7 @@ typedef struct _PlumaTrailSavePluginClass PlumaTrailSavePluginClass;
struct _PlumaTrailSavePluginClass
{
- PlumaPluginClass parent_class;
+ PeasExtensionBaseClass parent_class;
};
/*
@@ -63,7 +70,7 @@ struct _PlumaTrailSavePluginClass
GType pluma_trail_save_plugin_get_type (void) G_GNUC_CONST;
/* All the plugins must implement this function */
-G_MODULE_EXPORT GType register_pluma_plugin (GTypeModule *module);
+G_MODULE_EXPORT void peas_register_types (PeasObjectModule *module);
G_END_DECLS
diff --git a/plugins/trailsave/trailsave.pluma-plugin.desktop.in b/plugins/trailsave/trailsave.plugin.desktop.in
index dcdbeee6..3849ba7f 100644
--- a/plugins/trailsave/trailsave.pluma-plugin.desktop.in
+++ b/plugins/trailsave/trailsave.plugin.desktop.in
@@ -1,4 +1,4 @@
-[Pluma Plugin]
+[Plugin]
Module=trailsave
IAge=2
_Name=Save Without Trailing Spaces
diff --git a/pluma/Makefile.am b/pluma/Makefile.am
index 01914351..5a213037 100644
--- a/pluma/Makefile.am
+++ b/pluma/Makefile.am
@@ -11,6 +11,7 @@ AM_CPPFLAGS = \
-I$(srcdir)/smclient \
$(PLUMA_CFLAGS) \
$(WARN_CFLAGS) \
+ $(INTROSPECTION_CFLAGS) \
$(DISABLE_DEPRECATED_CFLAGS) \
-DDATADIR=\""$(datadir)"\" \
-DLIBDIR=\""$(libdir)"\"
@@ -18,7 +19,7 @@ AM_CPPFLAGS = \
pluma_SOURCES = \
pluma.c
-pluma_LDADD = libpluma.la $(PLUMA_LIBS) $(EGG_SMCLIENT_LIBS)
+pluma_LDADD = libpluma.la $(PLUMA_LIBS) $(EGG_SMCLIENT_LIBS) $(INTROSPECTION_LIBS)
pluma_LDFLAGS = -export-dynamic -no-undefined -export-symbols-regex "^[[^_]].*"
@@ -46,16 +47,12 @@ NOINST_H_FILES = \
pluma-document-output-stream.h \
pluma-document-saver.h \
pluma-documents-panel.h \
+ pluma-file-chooser-dialog.h \
pluma-gio-document-loader.h \
pluma-gio-document-saver.h \
pluma-history-entry.h \
pluma-io-error-message-area.h \
pluma-language-manager.h \
- pluma-object-module.h \
- pluma-plugin-info.h \
- pluma-plugin-info-priv.h \
- pluma-plugin-loader.h \
- pluma-plugin-manager.h \
pluma-plugins-engine.h \
pluma-prefs-manager-private.h \
pluma-print-job.h \
@@ -75,14 +72,12 @@ INST_H_FILES = \
pluma-document.h \
pluma-encodings.h \
pluma-encodings-combo-box.h \
- pluma-file-chooser-dialog.h \
pluma-help.h \
pluma-message-bus.h \
pluma-message-type.h \
pluma-message.h \
pluma-notebook.h \
pluma-panel.h \
- pluma-plugin.h \
pluma-prefs-manager-app.h \
pluma-prefs-manager.h \
pluma-progress-message-area.h \
@@ -102,11 +97,7 @@ headerdir = $(prefix)/include/pluma
header_DATA = \
$(INST_H_FILES)
-
-libpluma_la_SOURCES = \
- $(BUILT_SOURCES) \
- $(BACON_FILES) \
- $(POSIXIO_FILES) \
+libpluma_c_files = \
pluma-app.c \
pluma-close-button.c \
pluma-commands-documents.c \
@@ -136,13 +127,8 @@ libpluma_la_SOURCES = \
pluma-message-bus.c \
pluma-message-type.c \
pluma-message.c \
- pluma-object-module.c \
pluma-notebook.c \
pluma-panel.c \
- pluma-plugin-info.c \
- pluma-plugin.c \
- pluma-plugin-loader.c \
- pluma-plugin-manager.c \
pluma-plugins-engine.c \
pluma-prefs-manager-app.c \
pluma-prefs-manager.c \
@@ -160,7 +146,13 @@ libpluma_la_SOURCES = \
pluma-utils.c \
pluma-view.c \
pluma-window.c \
- plumatextregion.c \
+ plumatextregion.c
+
+libpluma_la_SOURCES = \
+ $(libpluma_c_files) \
+ $(BUILT_SOURCES) \
+ $(BACON_FILES) \
+ $(POSIXIO_FILES) \
$(NOINST_H_FILES) \
$(INST_H_FILES)
@@ -195,6 +187,27 @@ EXTRA_DIST = \
CLEANFILES = $(BUILT_SOURCES)
+if HAVE_INTROSPECTION
+-include $(INTROSPECTION_MAKEFILE)
+INTROSPECTION_GIRS = Pluma-1.0.gir
+INTROSPECTION_SCANNER_ARGS = -I$(top_srcdir) --warn-all
+
+Pluma-1.0.gir: pluma
+Pluma_1_0_gir_INCLUDES = Gtk-3.0 GtkSource-3.0
+Pluma_1_0_gir_FILES = $(INST_H_FILES) $(libpluma_c_files) $(BUILT_SOURCES)
+Pluma_1_0_gir_VERSION = 1.0
+Pluma_1_0_gir_PROGRAM = $(builddir)/pluma
+Pluma_1_0_gir_NAMESPACE = Pluma
+
+girdir = $(datadir)/gir-1.0
+gir_DATA = $(INTROSPECTION_GIRS)
+
+typelibdir = $(libdir)/girepository-1.0
+typelib_DATA = $(INTROSPECTION_GIRS:.gir=.typelib)
+
+CLEANFILES += $(gir_DATA) $(typelib_DATA)
+endif
+
dist-hook:
cd $(distdir); rm -f $(BUILT_SOURCES)
diff --git a/pluma/dialogs/pluma-preferences-dialog.c b/pluma/dialogs/pluma-preferences-dialog.c
index 3bacd273..be13d59d 100755
--- a/pluma/dialogs/pluma-preferences-dialog.c
+++ b/pluma/dialogs/pluma-preferences-dialog.c
@@ -39,6 +39,7 @@
#include <glib/gi18n.h>
#include <gtk/gtk.h>
#include <gtksourceview/gtksource.h>
+#include <libpeas-gtk/peas-gtk-plugin-manager.h>
#include <pluma/pluma-prefs-manager.h>
@@ -47,7 +48,6 @@
#include "pluma-debug.h"
#include "pluma-document.h"
#include "pluma-style-scheme-manager.h"
-#include "pluma-plugin-manager.h"
#include "pluma-help.h"
#include "pluma-dirs.h"
@@ -1047,7 +1047,7 @@ setup_plugins_page (PlumaPreferencesDialog *dlg)
pluma_debug (DEBUG_PREFS);
- page_content = pluma_plugin_manager_new ();
+ page_content = peas_gtk_plugin_manager_new (NULL);
g_return_if_fail (page_content != NULL);
gtk_box_pack_start (GTK_BOX (dlg->priv->plugin_manager_place_holder),
diff --git a/pluma/pluma-app.c b/pluma/pluma-app.c
index d9e713e4..90ed1b64 100644
--- a/pluma/pluma-app.c
+++ b/pluma/pluma-app.c
@@ -350,7 +350,7 @@ app_weak_notify (gpointer data,
* Returns the #PlumaApp object. This object is a singleton and
* represents the running pluma instance.
*
- * Return value: the #PlumaApp pointer
+ * Return value: (transfer none): the #PlumaApp pointer
*/
PlumaApp *
pluma_app_get_default (void)
@@ -555,7 +555,7 @@ pluma_app_create_window_real (PlumaApp *app,
*
* Create a new #PlumaWindow part of @app.
*
- * Return value: the new #PlumaWindow
+ * Return value: (transfer none): the new #PlumaWindow
*/
PlumaWindow *
pluma_app_create_window (PlumaApp *app,
@@ -592,7 +592,7 @@ _pluma_app_restore_window (PlumaApp *app,
*
* Returns all the windows currently present in #PlumaApp.
*
- * Return value: (transfer none): the list of #PlumaWindows objects.
+ * Return value: (element-type Pluma.Window) (transfer none): the list of #PlumaWindows objects.
* The list should not be freed
*/
const GList *
@@ -609,7 +609,7 @@ pluma_app_get_windows (PlumaApp *app)
*
* Retrives the #PlumaWindow currently active.
*
- * Return value: the active #PlumaWindow
+ * Return value: (transfer none): the active #PlumaWindow
*/
PlumaWindow *
pluma_app_get_active_window (PlumaApp *app)
diff --git a/pluma/pluma-commands-file.c b/pluma/pluma-commands-file.c
index 5407c212..c2cfb6cf 100644
--- a/pluma/pluma-commands-file.c
+++ b/pluma/pluma-commands-file.c
@@ -310,8 +310,6 @@ load_uri_list (PlumaWindow *window,
* @line_pos:
*
* Do nothing if uri does not exist
- *
- * Returns: (transfer container):
*/
void
pluma_commands_load_uri (PlumaWindow *window,
@@ -343,7 +341,7 @@ pluma_commands_load_uri (PlumaWindow *window,
*
* Ignore non-existing URIs
*
- * Returns: (transfer container):
+ * Returns:
*/
gint
pluma_commands_load_uris (PlumaWindow *window,
diff --git a/pluma/pluma-dirs.c b/pluma/pluma-dirs.c
index 929b8bd2..aebf5150 100644
--- a/pluma/pluma-dirs.c
+++ b/pluma/pluma-dirs.c
@@ -95,17 +95,17 @@ gchar* pluma_dirs_get_pluma_plugins_dir(void)
return plugin_dir;
}
-gchar* pluma_dirs_get_pluma_plugin_loaders_dir(void)
+gchar* pluma_dirs_get_pluma_plugins_data_dir(void)
{
- gchar* lib_dir;
- gchar* loader_dir;
+ gchar* data_dir;
+ gchar* plugin_data_dir;
- lib_dir = pluma_dirs_get_pluma_lib_dir();
+ data_dir = pluma_dirs_get_pluma_data_dir();
- loader_dir = g_build_filename(lib_dir, "plugin-loaders", NULL);
- g_free(lib_dir);
+ plugin_data_dir = g_build_filename(data_dir, "plugins", NULL);
+ g_free(data_dir);
- return loader_dir;
+ return plugin_data_dir;
}
gchar* pluma_dirs_get_ui_file(const gchar* file)
diff --git a/pluma/pluma-dirs.h b/pluma/pluma-dirs.h
index 529f18ee..a9c74d85 100644
--- a/pluma/pluma-dirs.h
+++ b/pluma/pluma-dirs.h
@@ -44,8 +44,7 @@ gchar *pluma_dirs_get_pluma_lib_dir (void);
gchar *pluma_dirs_get_pluma_plugins_dir (void);
-gchar *pluma_dirs_get_pluma_plugin_loaders_dir
- (void);
+gchar *pluma_dirs_get_pluma_plugins_data_dir (void);
gchar *pluma_dirs_get_ui_file (const gchar *file);
diff --git a/pluma/pluma-document.c b/pluma/pluma-document.c
index 3fe939f5..8634636f 100644
--- a/pluma/pluma-document.c
+++ b/pluma/pluma-document.c
@@ -545,8 +545,6 @@ pluma_document_class_init (PlumaDocumentClass *klass)
* @create: whether the document should be created if it doesn't exist.
*
* The "load" signal is emitted when a document is loaded.
- *
- * Since: 2.22
*/
document_signals[LOAD] =
g_signal_new ("load",
@@ -596,8 +594,6 @@ pluma_document_class_init (PlumaDocumentClass *klass)
* @flags: the #PlumaDocumentSaveFlags for the save operation.
*
* The "save" signal is emitted when the document is saved.
- *
- * Since: 2.20
*/
document_signals[SAVE] =
g_signal_new ("save",
@@ -1039,6 +1035,13 @@ set_uri (PlumaDocument *doc,
}
}
+
+/**
+ * pluma_document_get_location:
+ * @doc: a #PlumaDocument
+ *
+ * Returns: (allow-none) (transfer full): a new #GFile
+ */
GFile *
pluma_document_get_location (PlumaDocument *doc)
{
@@ -1777,7 +1780,7 @@ compute_num_of_lines (const gchar *text)
}
/**
- * pluma_document_set_search_text"
+ * pluma_document_set_search_text:
* @doc:
* @text: (allow-none):
* @flags:
@@ -1876,7 +1879,7 @@ pluma_document_get_can_search_again (PlumaDocument *doc)
* @start: (allow-none):
* @end: (allow-none):
* @match_start: (allow-none):
- * @match_end: (allow=none):
+ * @match_end: (allow-none):
**/
gboolean
pluma_document_search_forward (PlumaDocument *doc,
@@ -1964,7 +1967,7 @@ pluma_document_search_forward (PlumaDocument *doc,
* @start: (allow-none):
* @end: (allow-none):
* @match_start: (allow-none):
- * @match_end: (allow=none):
+ * @match_end: (allow-none):
**/
gboolean
pluma_document_search_backward (PlumaDocument *doc,
@@ -2191,6 +2194,12 @@ pluma_document_set_language (PlumaDocument *doc,
set_language (doc, lang, TRUE);
}
+/**
+ * pluma_document_get_language:
+ * @doc:
+ *
+ * Return value: (transfer none):
+ */
GtkSourceLanguage *
pluma_document_get_language (PlumaDocument *doc)
{
diff --git a/pluma/pluma-file-chooser-dialog.c b/pluma/pluma-file-chooser-dialog.c
index f23a4c0a..76c11d8a 100644
--- a/pluma/pluma-file-chooser-dialog.c
+++ b/pluma/pluma-file-chooser-dialog.c
@@ -463,7 +463,7 @@ pluma_file_chooser_dialog_new_valist (const gchar *title,
* @action: Open or save mode for the dialog
* @first_button_text: (allow-none): stock ID or text to go in
* the first button, or %NULL
- * @Varargs: (allow-none): response ID for the first button, then
+ * @...: (allow-none): response ID for the first button, then
* additional (button, id) pairs, ending with %NULL
*
* Creates a new #PlumaFileChooserDialog. This function is analogous to
diff --git a/pluma/pluma-message-bus.c b/pluma/pluma-message-bus.c
index 84551bff..4cda5693 100644
--- a/pluma/pluma-message-bus.c
+++ b/pluma/pluma-message-bus.c
@@ -88,9 +88,6 @@
* NULL);
* </programlisting>
* </example>
- *
- * Since: 2.25.3
- *
*/
#define PLUMA_MESSAGE_BUS_GET_PRIVATE(object)(G_TYPE_INSTANCE_GET_PRIVATE((object), PLUMA_TYPE_MESSAGE_BUS, PlumaMessageBusPrivate))
@@ -523,7 +520,7 @@ pluma_message_bus_init (PlumaMessageBus *self)
*
* Get the default application #PlumaMessageBus.
*
- * Return value: the default #PlumaMessageBus
+ * Return value: (transfer none): the default #PlumaMessageBus
*
*/
PlumaMessageBus *
@@ -794,7 +791,7 @@ foreach_type (const gchar *key,
/**
* pluma_message_bus_foreach:
* @bus: the #PlumaMessagebus
- * @func: the callback function
+ * @func: (scope call): the callback function
* @userdata: the user data to supply to the callback function
*
* Calls @func for each message type registered on the bus
@@ -872,7 +869,7 @@ pluma_message_bus_disconnect (PlumaMessageBus *bus,
* @bus: a #PlumaMessageBus
* @object_path: the object path
* @method: the method
- * @callback: the connected callback
+ * @callback: (scope call): the connected callback
* @userdata: the userdata with which the callback was connected
*
* Disconnects a previously connected message callback by matching the
@@ -915,7 +912,7 @@ pluma_message_bus_block (PlumaMessageBus *bus,
* @bus: a #PlumaMessageBus
* @object_path: the object path
* @method: the method
- * @callback: the callback to block
+ * @callback: (scope call): the callback to block
* @userdata: the userdata with which the callback was connected
*
* Blocks evoking the callback that matches provided @callback and @userdata.
@@ -956,7 +953,7 @@ pluma_message_bus_unblock (PlumaMessageBus *bus,
* @bus: a #PlumaMessageBus
* @object_path: the object path
* @method: the method
- * @callback: the callback to block
+ * @callback: (scope call): the callback to block
* @userdata: the userdata with which the callback was connected
*
* Unblocks the callback that matches provided @callback and @userdata.
@@ -1131,7 +1128,7 @@ pluma_message_bus_send (PlumaMessageBus *bus,
* specifies key (string) value pairs used to construct the message
* arguments. To send a message asynchronously use pluma_message_bus_send().
*
- * Return value: the constructed #PlumaMessage. The caller owns a reference
+ * Return value: (transfer full): the constructed #PlumaMessage. The caller owns a reference
* to the #PlumaMessage and should call g_object_unref() when
* it is no longer needed
*/
diff --git a/pluma/pluma-message-type.c b/pluma/pluma-message-type.c
index f399887b..7ca880f0 100644
--- a/pluma/pluma-message-type.c
+++ b/pluma/pluma-message-type.c
@@ -33,9 +33,6 @@
* NULL);
* </programlisting>
* </example>
- *
- * Since: 2.25.3
- *
*/
typedef struct
{
@@ -398,7 +395,7 @@ pluma_message_type_set_valist (PlumaMessageType *message_type,
* Instantiate a new message from the message type with specific values
* for the message arguments.
*
- * Return value: the newly created message
+ * Return value: (transfer full): the newly created message
*
*/
PlumaMessage *
@@ -423,7 +420,7 @@ pluma_message_type_instantiate_valist (PlumaMessageType *message_type,
* Instantiate a new message from the message type with specific values
* for the message arguments.
*
- * Return value: the newly created message
+ * Return value: (transfer full): the newly created message
*
*/
PlumaMessage *
@@ -509,7 +506,7 @@ foreach_gtype (const gchar *key,
/**
* pluma_message_type_foreach:
* @message_type: the #PlumaMessageType
- * @func: the callback function
+ * @func: (scope call): the callback function
* @user_data: user data supplied to the callback function
*
* Calls @func for each argument in the message type.
diff --git a/pluma/pluma-message.c b/pluma/pluma-message.c
index 0e138b04..4d8f7a4b 100644
--- a/pluma/pluma-message.c
+++ b/pluma/pluma-message.c
@@ -17,9 +17,6 @@
* A message can be seen as a method call, or signal emission depending on
* who is the sender and who is the receiver. There is no explicit distinction
* between methods and signals.
- *
- * Since: 2.25.3
- *
*/
#define PLUMA_MESSAGE_GET_PRIVATE(object)(G_TYPE_INSTANCE_GET_PRIVATE((object), PLUMA_TYPE_MESSAGE, PlumaMessagePrivate))
@@ -367,8 +364,8 @@ pluma_message_set_value (PlumaMessage *message,
/**
* pluma_message_set_valuesv:
* @message: the #PlumaMessage
- * @keys: (array-length=n_values): keys to set values for
- * @values: (array-length=n_values): values to set
+ * @keys: (array length=n_values): keys to set values for
+ * @values: (array length=n_values): values to set
* @n_values: number of arguments to set values for
*
* Set message argument values.
diff --git a/pluma/pluma-object-module.c b/pluma/pluma-object-module.c
deleted file mode 100644
index 7870d413..00000000
--- a/pluma/pluma-object-module.c
+++ /dev/null
@@ -1,343 +0,0 @@
-/*
- * pluma-object-module.c
- * This file is part of pluma
- *
- * 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., 51 Franklin St, Fifth Floor,
- * Boston, MA 02110-1301, USA.
- */
-
-/* This is a modified version of ephy-module.c from Epiphany source code.
- * Here the original copyright assignment:
- *
- * Copyright (C) 2003 Marco Pesenti Gritti
- * Copyright (C) 2003, 2004 Christian Persch
- *
- */
-
-/*
- * Modified by the pluma Team, 2005. See the AUTHORS file for a
- * list of people on the pluma Team.
- * See the ChangeLog files for a list of changes.
- *
- * $Id: pluma-module.c 6314 2008-06-05 12:57:53Z pborelli $
- */
-
-#include "config.h"
-
-#include "pluma-object-module.h"
-#include "pluma-debug.h"
-
-typedef GType (*PlumaObjectModuleRegisterFunc) (GTypeModule *);
-
-enum {
- PROP_0,
- PROP_MODULE_NAME,
- PROP_PATH,
- PROP_TYPE_REGISTRATION,
- PROP_RESIDENT
-};
-
-struct _PlumaObjectModulePrivate
-{
- GModule *library;
-
- GType type;
- gchar *path;
- gchar *module_name;
- gchar *type_registration;
-
- gboolean resident;
-};
-
-G_DEFINE_TYPE (PlumaObjectModule, pluma_object_module, G_TYPE_TYPE_MODULE);
-
-static gboolean
-pluma_object_module_load (GTypeModule *gmodule)
-{
- PlumaObjectModule *module = PLUMA_OBJECT_MODULE (gmodule);
- PlumaObjectModuleRegisterFunc register_func;
- gchar *path;
-
- pluma_debug_message (DEBUG_PLUGINS, "Loading %s module from %s",
- module->priv->module_name, module->priv->path);
-
- path = g_module_build_path (module->priv->path, module->priv->module_name);
- g_return_val_if_fail (path != NULL, FALSE);
- pluma_debug_message (DEBUG_PLUGINS, "Module filename: %s", path);
-
- module->priv->library = g_module_open (path,
- G_MODULE_BIND_LAZY);
- g_free (path);
-
- if (module->priv->library == NULL)
- {
- g_warning ("%s: %s", module->priv->module_name, g_module_error());
-
- return FALSE;
- }
-
- /* extract symbols from the lib */
- if (!g_module_symbol (module->priv->library, module->priv->type_registration,
- (void *) &register_func))
- {
- g_warning ("%s: %s", module->priv->module_name, g_module_error());
- g_module_close (module->priv->library);
-
- return FALSE;
- }
-
- /* symbol can still be NULL even though g_module_symbol
- * returned TRUE */
- if (register_func == NULL)
- {
- g_warning ("Symbol '%s' should not be NULL", module->priv->type_registration);
- g_module_close (module->priv->library);
-
- return FALSE;
- }
-
- module->priv->type = register_func (gmodule);
-
- if (module->priv->type == 0)
- {
- g_warning ("Invalid object contained by module %s", module->priv->module_name);
- return FALSE;
- }
-
- if (module->priv->resident)
- {
- g_module_make_resident (module->priv->library);
- }
-
- return TRUE;
-}
-
-static void
-pluma_object_module_unload (GTypeModule *gmodule)
-{
- PlumaObjectModule *module = PLUMA_OBJECT_MODULE (gmodule);
-
- pluma_debug_message (DEBUG_PLUGINS, "Unloading %s", module->priv->path);
-
- g_module_close (module->priv->library);
-
- module->priv->library = NULL;
- module->priv->type = 0;
-}
-
-static void
-pluma_object_module_init (PlumaObjectModule *module)
-{
- pluma_debug_message (DEBUG_PLUGINS, "PlumaObjectModule %p initialising", module);
-
- module->priv = G_TYPE_INSTANCE_GET_PRIVATE (module,
- PLUMA_TYPE_OBJECT_MODULE,
- PlumaObjectModulePrivate);
-}
-
-static void
-pluma_object_module_finalize (GObject *object)
-{
- PlumaObjectModule *module = PLUMA_OBJECT_MODULE (object);
-
- pluma_debug_message (DEBUG_PLUGINS, "PlumaObjectModule %p finalising", module);
-
- g_free (module->priv->path);
- g_free (module->priv->module_name);
- g_free (module->priv->type_registration);
-
- G_OBJECT_CLASS (pluma_object_module_parent_class)->finalize (object);
-}
-
-static void
-pluma_object_module_get_property (GObject *object,
- guint prop_id,
- GValue *value,
- GParamSpec *pspec)
-{
- PlumaObjectModule *module = PLUMA_OBJECT_MODULE (object);
-
- switch (prop_id)
- {
- case PROP_MODULE_NAME:
- g_value_set_string (value, module->priv->module_name);
- break;
- case PROP_PATH:
- g_value_set_string (value, module->priv->path);
- break;
- case PROP_TYPE_REGISTRATION:
- g_value_set_string (value, module->priv->type_registration);
- break;
- case PROP_RESIDENT:
- g_value_set_boolean (value, module->priv->resident);
- break;
- default:
- g_return_if_reached ();
- }
-}
-
-static void
-pluma_object_module_set_property (GObject *object,
- guint prop_id,
- const GValue *value,
- GParamSpec *pspec)
-{
- PlumaObjectModule *module = PLUMA_OBJECT_MODULE (object);
-
- switch (prop_id)
- {
- case PROP_MODULE_NAME:
- module->priv->module_name = g_value_dup_string (value);
- g_type_module_set_name (G_TYPE_MODULE (object),
- module->priv->module_name);
- break;
- case PROP_PATH:
- module->priv->path = g_value_dup_string (value);
- break;
- case PROP_TYPE_REGISTRATION:
- module->priv->type_registration = g_value_dup_string (value);
- break;
- case PROP_RESIDENT:
- module->priv->resident = g_value_get_boolean (value);
- break;
- default:
- g_return_if_reached ();
- }
-}
-
-static void
-pluma_object_module_class_init (PlumaObjectModuleClass *klass)
-{
- GObjectClass *object_class = G_OBJECT_CLASS (klass);
- GTypeModuleClass *module_class = G_TYPE_MODULE_CLASS (klass);
-
- object_class->set_property = pluma_object_module_set_property;
- object_class->get_property = pluma_object_module_get_property;
- object_class->finalize = pluma_object_module_finalize;
-
- module_class->load = pluma_object_module_load;
- module_class->unload = pluma_object_module_unload;
-
- g_object_class_install_property (object_class,
- PROP_MODULE_NAME,
- g_param_spec_string ("module-name",
- "Module Name",
- "The module to load for this object",
- NULL,
- G_PARAM_READWRITE |
- G_PARAM_CONSTRUCT_ONLY));
-
- g_object_class_install_property (object_class,
- PROP_PATH,
- g_param_spec_string ("path",
- "Path",
- "The path to use when loading this module",
- NULL,
- G_PARAM_READWRITE |
- G_PARAM_CONSTRUCT_ONLY));
-
- g_object_class_install_property (object_class,
- PROP_TYPE_REGISTRATION,
- g_param_spec_string ("type-registration",
- "Type Registration",
- "The name of the type registration function",
- NULL,
- G_PARAM_READWRITE |
- G_PARAM_CONSTRUCT_ONLY));
-
- g_object_class_install_property (object_class,
- PROP_RESIDENT,
- g_param_spec_boolean ("resident",
- "Resident",
- "Whether the module is resident",
- FALSE,
- G_PARAM_READWRITE |
- G_PARAM_CONSTRUCT_ONLY));
-
- g_type_class_add_private (klass, sizeof (PlumaObjectModulePrivate));
-}
-
-PlumaObjectModule *
-pluma_object_module_new (const gchar *module_name,
- const gchar *path,
- const gchar *type_registration,
- gboolean resident)
-{
- return (PlumaObjectModule *)g_object_new (PLUMA_TYPE_OBJECT_MODULE,
- "module-name",
- module_name,
- "path",
- path,
- "type-registration",
- type_registration,
- "resident",
- resident,
- NULL);
-}
-
-GObject *
-pluma_object_module_new_object (PlumaObjectModule *module,
- const gchar *first_property_name,
- ...)
-{
- va_list var_args;
- GObject *result;
-
- g_return_val_if_fail (module->priv->type != 0, NULL);
-
- pluma_debug_message (DEBUG_PLUGINS, "Creating object of type %s",
- g_type_name (module->priv->type));
-
- 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 *
-pluma_object_module_get_path (PlumaObjectModule *module)
-{
- g_return_val_if_fail (PLUMA_IS_OBJECT_MODULE (module), NULL);
-
- return module->priv->path;
-}
-
-const gchar *
-pluma_object_module_get_module_name (PlumaObjectModule *module)
-{
- g_return_val_if_fail (PLUMA_IS_OBJECT_MODULE (module), NULL);
-
- return module->priv->module_name;
-}
-
-const gchar *
-pluma_object_module_get_type_registration (PlumaObjectModule *module)
-{
- g_return_val_if_fail (PLUMA_IS_OBJECT_MODULE (module), NULL);
-
- return module->priv->type_registration;
-}
-
-GType
-pluma_object_module_get_object_type (PlumaObjectModule *module)
-{
- g_return_val_if_fail (PLUMA_IS_OBJECT_MODULE (module), 0);
-
- return module->priv->type;
-}
diff --git a/pluma/pluma-object-module.h b/pluma/pluma-object-module.h
deleted file mode 100644
index f67ed7cf..00000000
--- a/pluma/pluma-object-module.h
+++ /dev/null
@@ -1,94 +0,0 @@
-/*
- * pluma-object-module.h
- * This file is part of pluma
- *
- * 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., 51 Franklin St, Fifth Floor,
- * Boston, MA 02110-1301, USA.
- */
-
-/* This is a modified version of pluma-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 pluma Team, 2005. See the AUTHORS file for a
- * list of people on the pluma Team.
- * See the ChangeLog files for a list of changes.
- *
- * $Id: pluma-module.h 6263 2008-05-05 10:52:10Z sfre $
- */
-
-#ifndef __PLUMA_OBJECT_MODULE_H__
-#define __PLUMA_OBJECT_MODULE_H__
-
-#include <glib-object.h>
-#include <gmodule.h>
-#include <stdarg.h>
-
-G_BEGIN_DECLS
-
-#define PLUMA_TYPE_OBJECT_MODULE (pluma_object_module_get_type ())
-#define PLUMA_OBJECT_MODULE(obj) (G_TYPE_CHECK_INSTANCE_CAST ((obj), PLUMA_TYPE_OBJECT_MODULE, PlumaObjectModule))
-#define PLUMA_OBJECT_MODULE_CLASS(klass) (G_TYPE_CHECK_CLASS_CAST ((klass), PLUMA_TYPE_OBJECT_MODULE, PlumaObjectModuleClass))
-#define PLUMA_IS_OBJECT_MODULE(obj) (G_TYPE_CHECK_INSTANCE_TYPE ((obj), PLUMA_TYPE_OBJECT_MODULE))
-#define PLUMA_IS_OBJECT_MODULE_CLASS(klass) (G_TYPE_CHECK_CLASS_TYPE ((klass), PLUMA_TYPE_OBJECT_MODULE))
-#define PLUMA_OBJECT_MODULE_GET_CLASS(obj) (G_TYPE_INSTANCE_GET_CLASS((obj), PLUMA_TYPE_OBJECT_MODULE, PlumaObjectModuleClass))
-
-typedef struct _PlumaObjectModule PlumaObjectModule;
-typedef struct _PlumaObjectModulePrivate PlumaObjectModulePrivate;
-
-struct _PlumaObjectModule
-{
- GTypeModule parent;
-
- PlumaObjectModulePrivate *priv;
-};
-
-typedef struct _PlumaObjectModuleClass PlumaObjectModuleClass;
-
-struct _PlumaObjectModuleClass
-{
- GTypeModuleClass parent_class;
-
- /* Virtual class methods */
- void (* garbage_collect) ();
-};
-
-GType pluma_object_module_get_type (void) G_GNUC_CONST;
-
-PlumaObjectModule *pluma_object_module_new (const gchar *module_name,
- const gchar *path,
- const gchar *type_registration,
- gboolean resident);
-
-GObject *pluma_object_module_new_object (PlumaObjectModule *module,
- const gchar *first_property_name,
- ...);
-
-GType pluma_object_module_get_object_type (PlumaObjectModule *module);
-const gchar *pluma_object_module_get_path (PlumaObjectModule *module);
-const gchar *pluma_object_module_get_module_name (PlumaObjectModule *module);
-const gchar *pluma_object_module_get_type_registration (PlumaObjectModule *module);
-
-G_END_DECLS
-
-#endif
diff --git a/pluma/pluma-plugin-info-priv.h b/pluma/pluma-plugin-info-priv.h
deleted file mode 100644
index f69e2334..00000000
--- a/pluma/pluma-plugin-info-priv.h
+++ /dev/null
@@ -1,67 +0,0 @@
-/*
- * pluma-plugin-info-priv.h
- * This file is part of pluma
- *
- * 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., 51 Franklin St, Fifth Floor,
- * Boston, MA 02110-1301, USA.
- */
-
-/*
- * Modified by the pluma Team, 2002-2007. See the AUTHORS file for a
- * list of people on the pluma Team.
- * See the ChangeLog files for a list of changes.
- *
- * $Id$
- */
-
-#ifndef __PLUMA_PLUGIN_INFO_PRIV_H__
-#define __PLUMA_PLUGIN_INFO_PRIV_H__
-
-#include "pluma-plugin-info.h"
-#include "pluma-plugin.h"
-
-struct _PlumaPluginInfo
-{
- gint refcount;
-
- PlumaPlugin *plugin;
- gchar *file;
-
- gchar *module_name;
- gchar *loader;
- gchar **dependencies;
-
- gchar *name;
- gchar *desc;
- gchar *icon_name;
- gchar **authors;
- gchar *copyright;
- gchar *website;
- gchar *version;
-
- /* A plugin is unavailable if it is not possible to activate it
- due to an error loading the plugin module */
- gint available : 1;
-};
-
-PlumaPluginInfo *_pluma_plugin_info_new (const gchar *file);
-void _pluma_plugin_info_ref (PlumaPluginInfo *info);
-void _pluma_plugin_info_unref (PlumaPluginInfo *info);
-
-
-#endif /* __PLUMA_PLUGIN_INFO_PRIV_H__ */
diff --git a/pluma/pluma-plugin-info.c b/pluma/pluma-plugin-info.c
deleted file mode 100644
index ef8ab684..00000000
--- a/pluma/pluma-plugin-info.c
+++ /dev/null
@@ -1,396 +0,0 @@
-/*
- * pluma-plugin-info.c
- * This file is part of pluma
- *
- * 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., 51 Franklin St, Fifth Floor,
- * Boston, MA 02110-1301, USA.
- */
-
-/*
- * Modified by the pluma Team, 2002-2007. See the AUTHORS file for a
- * list of people on the pluma Team.
- * See the ChangeLog files for a list of changes.
- *
- * $Id$
- */
-
-#ifdef HAVE_CONFIG_H
-#include <config.h>
-#endif
-
-#include <string.h>
-#include <glib/gi18n.h>
-#include <glib.h>
-
-#include "pluma-plugin-info.h"
-#include "pluma-plugin-info-priv.h"
-#include "pluma-debug.h"
-#include "pluma-plugin.h"
-
-void
-_pluma_plugin_info_ref (PlumaPluginInfo *info)
-{
- g_atomic_int_inc (&info->refcount);
-}
-
-static PlumaPluginInfo *
-pluma_plugin_info_copy (PlumaPluginInfo *info)
-{
- _pluma_plugin_info_ref (info);
- return info;
-}
-
-void
-_pluma_plugin_info_unref (PlumaPluginInfo *info)
-{
- if (!g_atomic_int_dec_and_test (&info->refcount))
- return;
-
- if (info->plugin != NULL)
- {
- pluma_debug_message (DEBUG_PLUGINS, "Unref plugin %s", info->name);
-
- g_object_unref (info->plugin);
- }
-
- g_free (info->file);
- g_free (info->module_name);
- g_strfreev (info->dependencies);
- g_free (info->name);
- g_free (info->desc);
- g_free (info->icon_name);
- g_free (info->website);
- g_free (info->copyright);
- g_free (info->loader);
- g_free (info->version);
- g_strfreev (info->authors);
-
- g_free (info);
-}
-
-/**
- * pluma_plugin_info_get_type:
- *
- * Retrieves the #GType object which is associated with the #PlumaPluginInfo
- * class.
- *
- * Return value: the GType associated with #PlumaPluginInfo.
- **/
-GType
-pluma_plugin_info_get_type (void)
-{
- static GType the_type = 0;
-
- if (G_UNLIKELY (!the_type))
- the_type = g_boxed_type_register_static (
- "PlumaPluginInfo",
- (GBoxedCopyFunc) pluma_plugin_info_copy,
- (GBoxedFreeFunc) _pluma_plugin_info_unref);
-
- return the_type;
-}
-
-/**
- * pluma_plugin_info_new:
- * @filename: the filename where to read the plugin information
- *
- * Creates a new #PlumaPluginInfo from a file on the disk.
- *
- * Return value: a newly created #PlumaPluginInfo.
- */
-PlumaPluginInfo *
-_pluma_plugin_info_new (const gchar *file)
-{
- PlumaPluginInfo *info;
- GKeyFile *plugin_file = NULL;
- gchar *str;
-
- g_return_val_if_fail (file != NULL, NULL);
-
- pluma_debug_message (DEBUG_PLUGINS, "Loading plugin: %s", file);
-
- info = g_new0 (PlumaPluginInfo, 1);
- info->refcount = 1;
- info->file = g_strdup (file);
-
- plugin_file = g_key_file_new ();
- if (!g_key_file_load_from_file (plugin_file, file, G_KEY_FILE_NONE, NULL))
- {
- g_warning ("Bad plugin file: %s", file);
- goto error;
- }
-
- if (!g_key_file_has_key (plugin_file,
- "Pluma Plugin",
- "IAge",
- NULL))
- {
- pluma_debug_message (DEBUG_PLUGINS,
- "IAge key does not exist in file: %s", file);
- goto error;
- }
-
- /* Check IAge=2 */
- if (g_key_file_get_integer (plugin_file,
- "Pluma Plugin",
- "IAge",
- NULL) != 2)
- {
- pluma_debug_message (DEBUG_PLUGINS,
- "Wrong IAge in file: %s", file);
- goto error;
- }
-
- /* Get module name */
- str = g_key_file_get_string (plugin_file,
- "Pluma Plugin",
- "Module",
- NULL);
-
- if ((str != NULL) && (*str != '\0'))
- {
- info->module_name = str;
- }
- else
- {
- g_warning ("Could not find 'Module' in %s", file);
- g_free (str);
- goto error;
- }
-
- /* Get the dependency list */
- info->dependencies = g_key_file_get_string_list (plugin_file,
- "Pluma Plugin",
- "Depends",
- NULL,
- NULL);
- if (info->dependencies == NULL)
- {
- pluma_debug_message (DEBUG_PLUGINS, "Could not find 'Depends' in %s", file);
- info->dependencies = g_new0 (gchar *, 1);
- }
-
- /* Get the loader for this plugin */
- str = g_key_file_get_string (plugin_file,
- "Pluma Plugin",
- "Loader",
- NULL);
-
- if ((str != NULL) && (*str != '\0'))
- {
- info->loader = str;
- }
- else
- {
- /* default to the C loader */
- info->loader = g_strdup("c");
- g_free (str);
- }
-
- /* Get Name */
- str = g_key_file_get_locale_string (plugin_file,
- "Pluma Plugin",
- "Name",
- NULL, NULL);
- if (str)
- info->name = str;
- else
- {
- g_warning ("Could not find 'Name' in %s", file);
- goto error;
- }
-
- /* Get Description */
- str = g_key_file_get_locale_string (plugin_file,
- "Pluma Plugin",
- "Description",
- NULL, NULL);
- if (str)
- info->desc = str;
- else
- pluma_debug_message (DEBUG_PLUGINS, "Could not find 'Description' in %s", file);
-
- /* Get Icon */
- str = g_key_file_get_locale_string (plugin_file,
- "Pluma Plugin",
- "Icon",
- NULL, NULL);
- if (str)
- info->icon_name = str;
- else
- pluma_debug_message (DEBUG_PLUGINS, "Could not find 'Icon' in %s, using 'pluma-plugin'", file);
-
-
- /* Get Authors */
- info->authors = g_key_file_get_string_list (plugin_file,
- "Pluma Plugin",
- "Authors",
- NULL,
- NULL);
- if (info->authors == NULL)
- pluma_debug_message (DEBUG_PLUGINS, "Could not find 'Authors' in %s", file);
-
-
- /* Get Copyright */
- str = g_key_file_get_string (plugin_file,
- "Pluma Plugin",
- "Copyright",
- NULL);
- if (str)
- info->copyright = str;
- else
- pluma_debug_message (DEBUG_PLUGINS, "Could not find 'Copyright' in %s", file);
-
- /* Get Website */
- str = g_key_file_get_string (plugin_file,
- "Pluma Plugin",
- "Website",
- NULL);
- if (str)
- info->website = str;
- else
- pluma_debug_message (DEBUG_PLUGINS, "Could not find 'Website' in %s", file);
-
- /* Get Version */
- str = g_key_file_get_string (plugin_file,
- "Pluma Plugin",
- "Version",
- NULL);
- if (str)
- info->version = str;
- else
- pluma_debug_message (DEBUG_PLUGINS, "Could not find 'Version' in %s", file);
-
- 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:
- g_free (info->file);
- g_free (info->module_name);
- g_free (info->name);
- g_free (info->loader);
- g_free (info);
- g_key_file_free (plugin_file);
-
- return NULL;
-}
-
-gboolean
-pluma_plugin_info_is_active (PlumaPluginInfo *info)
-{
- g_return_val_if_fail (info != NULL, FALSE);
-
- return info->available && info->plugin != NULL;
-}
-
-gboolean
-pluma_plugin_info_is_available (PlumaPluginInfo *info)
-{
- g_return_val_if_fail (info != NULL, FALSE);
-
- return info->available != FALSE;
-}
-
-gboolean
-pluma_plugin_info_is_configurable (PlumaPluginInfo *info)
-{
- pluma_debug_message (DEBUG_PLUGINS, "Is '%s' configurable?", info->name);
-
- g_return_val_if_fail (info != NULL, FALSE);
-
- if (info->plugin == NULL || !info->available)
- return FALSE;
-
- return pluma_plugin_is_configurable (info->plugin);
-}
-
-const gchar *
-pluma_plugin_info_get_module_name (PlumaPluginInfo *info)
-{
- g_return_val_if_fail (info != NULL, NULL);
-
- return info->module_name;
-}
-
-const gchar *
-pluma_plugin_info_get_name (PlumaPluginInfo *info)
-{
- g_return_val_if_fail (info != NULL, NULL);
-
- return info->name;
-}
-
-const gchar *
-pluma_plugin_info_get_description (PlumaPluginInfo *info)
-{
- g_return_val_if_fail (info != NULL, NULL);
-
- return info->desc;
-}
-
-const gchar *
-pluma_plugin_info_get_icon_name (PlumaPluginInfo *info)
-{
- g_return_val_if_fail (info != NULL, NULL);
-
- /* use the pluma-plugin icon as a default if the plugin does not
- have its own */
- if (info->icon_name != NULL &&
- gtk_icon_theme_has_icon (gtk_icon_theme_get_default (),
- info->icon_name))
- return info->icon_name;
- else
- return "pluma-plugin";
-}
-
-const gchar **
-pluma_plugin_info_get_authors (PlumaPluginInfo *info)
-{
- g_return_val_if_fail (info != NULL, (const gchar **)NULL);
-
- return (const gchar **) info->authors;
-}
-
-const gchar *
-pluma_plugin_info_get_website (PlumaPluginInfo *info)
-{
- g_return_val_if_fail (info != NULL, NULL);
-
- return info->website;
-}
-
-const gchar *
-pluma_plugin_info_get_copyright (PlumaPluginInfo *info)
-{
- g_return_val_if_fail (info != NULL, NULL);
-
- return info->copyright;
-}
-
-const gchar *
-pluma_plugin_info_get_version (PlumaPluginInfo *info)
-{
- g_return_val_if_fail (info != NULL, NULL);
-
- return info->version;
-}
diff --git a/pluma/pluma-plugin-info.h b/pluma/pluma-plugin-info.h
deleted file mode 100644
index 9a5fb024..00000000
--- a/pluma/pluma-plugin-info.h
+++ /dev/null
@@ -1,63 +0,0 @@
-/*
- * pluma-plugin-info.h
- * This file is part of pluma
- *
- * 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., 51 Franklin St, Fifth Floor,
- * Boston, MA 02110-1301, USA.
- */
-
-/*
- * Modified by the pluma Team, 2002-2007. See the AUTHORS file for a
- * list of people on the pluma Team.
- * See the ChangeLog files for a list of changes.
- *
- * $Id$
- */
-
-#ifndef __PLUMA_PLUGIN_INFO_H__
-#define __PLUMA_PLUGIN_INFO_H__
-
-#include <glib-object.h>
-
-G_BEGIN_DECLS
-
-#define PLUMA_TYPE_PLUGIN_INFO (pluma_plugin_info_get_type ())
-#define PLUMA_PLUGIN_INFO(obj) ((PlumaPluginInfo *) (obj))
-
-typedef struct _PlumaPluginInfo PlumaPluginInfo;
-
-GType pluma_plugin_info_get_type (void) G_GNUC_CONST;
-
-gboolean pluma_plugin_info_is_active (PlumaPluginInfo *info);
-gboolean pluma_plugin_info_is_available (PlumaPluginInfo *info);
-gboolean pluma_plugin_info_is_configurable (PlumaPluginInfo *info);
-
-const gchar *pluma_plugin_info_get_module_name (PlumaPluginInfo *info);
-
-const gchar *pluma_plugin_info_get_name (PlumaPluginInfo *info);
-const gchar *pluma_plugin_info_get_description (PlumaPluginInfo *info);
-const gchar *pluma_plugin_info_get_icon_name (PlumaPluginInfo *info);
-const gchar **pluma_plugin_info_get_authors (PlumaPluginInfo *info);
-const gchar *pluma_plugin_info_get_website (PlumaPluginInfo *info);
-const gchar *pluma_plugin_info_get_copyright (PlumaPluginInfo *info);
-const gchar *pluma_plugin_info_get_version (PlumaPluginInfo *info);
-
-G_END_DECLS
-
-#endif /* __PLUMA_PLUGIN_INFO_H__ */
-
diff --git a/pluma/pluma-plugin-loader.c b/pluma/pluma-plugin-loader.c
deleted file mode 100644
index 5da3e21c..00000000
--- a/pluma/pluma-plugin-loader.c
+++ /dev/null
@@ -1,131 +0,0 @@
-/*
- * pluma-plugin-loader.c
- * This file is part of pluma
- *
- * 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., 51 Franklin St, Fifth Floor,
- * Boston, MA 02110-1301, USA.
- */
-
-#include "pluma-plugin-loader.h"
-
-static void
-pluma_plugin_loader_base_init (gpointer g_class)
-{
- static gboolean initialized = FALSE;
-
- if (G_UNLIKELY (!initialized))
- {
- /* create interface signals here. */
- initialized = TRUE;
- }
-}
-
-GType
-pluma_plugin_loader_get_type (void)
-{
- static GType type = 0;
-
- if (G_UNLIKELY (type == 0))
- {
- static const GTypeInfo info =
- {
- sizeof (PlumaPluginLoaderInterface),
- pluma_plugin_loader_base_init, /* base_init */
- NULL, /* base_finalize */
- NULL, /* class_init */
- NULL, /* class_finalize */
- NULL, /* class_data */
- 0,
- 0, /* n_preallocs */
- NULL /* instance_init */
- };
-
- type = g_type_register_static (G_TYPE_INTERFACE, "PlumaPluginLoader", &info, 0);
- }
-
- return type;
-}
-
-const gchar *
-pluma_plugin_loader_type_get_id (GType type)
-{
- GTypeClass *klass;
- PlumaPluginLoaderInterface *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, PLUMA_TYPE_PLUGIN_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 ();
-}
-
-PlumaPlugin *
-pluma_plugin_loader_load (PlumaPluginLoader *loader,
- PlumaPluginInfo *info,
- const gchar *path)
-{
- PlumaPluginLoaderInterface *iface;
-
- g_return_val_if_fail (PLUMA_IS_PLUGIN_LOADER (loader), NULL);
-
- iface = PLUMA_PLUGIN_LOADER_GET_INTERFACE (loader);
- g_return_val_if_fail (iface->load != NULL, NULL);
-
- return iface->load (loader, info, path);
-}
-
-void
-pluma_plugin_loader_unload (PlumaPluginLoader *loader,
- PlumaPluginInfo *info)
-{
- PlumaPluginLoaderInterface *iface;
-
- g_return_if_fail (PLUMA_IS_PLUGIN_LOADER (loader));
-
- iface = PLUMA_PLUGIN_LOADER_GET_INTERFACE (loader);
- g_return_if_fail (iface->unload != NULL);
-
- iface->unload (loader, info);
-}
-
-void
-pluma_plugin_loader_garbage_collect (PlumaPluginLoader *loader)
-{
- PlumaPluginLoaderInterface *iface;
-
- g_return_if_fail (PLUMA_IS_PLUGIN_LOADER (loader));
-
- iface = PLUMA_PLUGIN_LOADER_GET_INTERFACE (loader);
-
- if (iface->garbage_collect != NULL)
- iface->garbage_collect (loader);
-}
diff --git a/pluma/pluma-plugin-loader.h b/pluma/pluma-plugin-loader.h
deleted file mode 100644
index 47a5cb16..00000000
--- a/pluma/pluma-plugin-loader.h
+++ /dev/null
@@ -1,106 +0,0 @@
-/*
- * pluma-plugin-loader.h
- * This file is part of pluma
- *
- * 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., 51 Franklin St, Fifth Floor,
- * Boston, MA 02110-1301, USA.
- */
-
-#ifndef __PLUMA_PLUGIN_LOADER_H__
-#define __PLUMA_PLUGIN_LOADER_H__
-
-#include <glib-object.h>
-#include <pluma/pluma-plugin.h>
-#include <pluma/pluma-plugin-info.h>
-
-G_BEGIN_DECLS
-
-#define PLUMA_TYPE_PLUGIN_LOADER (pluma_plugin_loader_get_type ())
-#define PLUMA_PLUGIN_LOADER(obj) (G_TYPE_CHECK_INSTANCE_CAST ((obj), PLUMA_TYPE_PLUGIN_LOADER, PlumaPluginLoader))
-#define PLUMA_IS_PLUGIN_LOADER(obj) (G_TYPE_CHECK_INSTANCE_TYPE ((obj), PLUMA_TYPE_PLUGIN_LOADER))
-#define PLUMA_PLUGIN_LOADER_GET_INTERFACE(inst) (G_TYPE_INSTANCE_GET_INTERFACE ((inst), PLUMA_TYPE_PLUGIN_LOADER, PlumaPluginLoaderInterface))
-
-typedef struct _PlumaPluginLoader PlumaPluginLoader; /* dummy object */
-typedef struct _PlumaPluginLoaderInterface PlumaPluginLoaderInterface;
-
-struct _PlumaPluginLoaderInterface {
- GTypeInterface parent;
-
- const gchar *(*get_id) (void);
-
- PlumaPlugin *(*load) (PlumaPluginLoader *loader,
- PlumaPluginInfo *info,
- const gchar *path);
-
- void (*unload) (PlumaPluginLoader *loader,
- PlumaPluginInfo *info);
-
- void (*garbage_collect) (PlumaPluginLoader *loader);
-};
-
-GType pluma_plugin_loader_get_type (void);
-
-const gchar *pluma_plugin_loader_type_get_id (GType type);
-PlumaPlugin *pluma_plugin_loader_load (PlumaPluginLoader *loader,
- PlumaPluginInfo *info,
- const gchar *path);
-void pluma_plugin_loader_unload (PlumaPluginLoader *loader,
- PlumaPluginInfo *info);
-void pluma_plugin_loader_garbage_collect (PlumaPluginLoader *loader);
-
-/**
- * PLUMA_PLUGIN_LOADER_IMPLEMENT_INTERFACE(TYPE_IFACE, iface_init):
- *
- * Utility macro used to register interfaces for gobject types in plugin loaders.
- */
-#define PLUMA_PLUGIN_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);
-
-/**
- * PLUMA_PLUGIN_LOADER_REGISTER_TYPE(PluginLoaderName, plugin_loader_name, PARENT_TYPE, loader_interface_init):
- *
- * Utility macro used to register plugin loaders.
- */
-#define PLUMA_PLUGIN_LOADER_REGISTER_TYPE(PluginLoaderName, plugin_loader_name, PARENT_TYPE, loader_iface_init) \
- G_DEFINE_DYNAMIC_TYPE_EXTENDED (PluginLoaderName, \
- plugin_loader_name, \
- PARENT_TYPE, \
- 0, \
- PLUMA_PLUGIN_LOADER_IMPLEMENT_INTERFACE(PLUMA_TYPE_PLUGIN_LOADER, loader_iface_init)); \
- \
- \
-G_MODULE_EXPORT GType \
-register_pluma_plugin_loader (GTypeModule *type_module) \
-{ \
- plugin_loader_name##_register_type (type_module); \
- \
- return plugin_loader_name##_get_type(); \
-}
-
-G_END_DECLS
-
-#endif /* __PLUMA_PLUGIN_LOADER_H__ */
diff --git a/pluma/pluma-plugin-manager.c b/pluma/pluma-plugin-manager.c
deleted file mode 100644
index ce3e73c6..00000000
--- a/pluma/pluma-plugin-manager.c
+++ /dev/null
@@ -1,895 +0,0 @@
-/*
- * pluma-plugin-manager.c
- * This file is part of pluma
- *
- * Copyright (C) 2002 Paolo Maggi and James Willcox
- * Copyright (C) 2003-2006 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., 51 Franklin St, Fifth Floor,
- * Boston, MA 02110-1301, USA.
- */
-
-/*
- * Modified by the pluma Team, 1998-2006. See the AUTHORS file for a
- * list of people on the pluma Team.
- * See the ChangeLog files for a list of changes.
- *
- * $Id$
- */
-
-#ifdef HAVE_CONFIG_H
-#include <config.h>
-#endif
-
-#include <string.h>
-
-#include <glib/gi18n.h>
-
-#include "pluma-plugin-manager.h"
-#include "pluma-utils.h"
-#include "pluma-plugins-engine.h"
-#include "pluma-plugin.h"
-#include "pluma-debug.h"
-
-enum
-{
- ACTIVE_COLUMN,
- AVAILABLE_COLUMN,
- INFO_COLUMN,
- N_COLUMNS
-};
-
-#define PLUGIN_MANAGER_NAME_TITLE _("Plugin")
-#define PLUGIN_MANAGER_ACTIVE_TITLE _("Enabled")
-
-#define PLUMA_PLUGIN_MANAGER_GET_PRIVATE(object)(G_TYPE_INSTANCE_GET_PRIVATE ((object), PLUMA_TYPE_PLUGIN_MANAGER, PlumaPluginManagerPrivate))
-
-struct _PlumaPluginManagerPrivate
-{
- GtkWidget *tree;
-
- GtkWidget *about_button;
- GtkWidget *configure_button;
-
- PlumaPluginsEngine *engine;
-
- GtkWidget *about;
-
- GtkWidget *popup_menu;
-};
-
-G_DEFINE_TYPE(PlumaPluginManager, pluma_plugin_manager, GTK_TYPE_BOX)
-
-static PlumaPluginInfo *plugin_manager_get_selected_plugin (PlumaPluginManager *pm);
-static void plugin_manager_toggle_active (PlumaPluginManager *pm, GtkTreeIter *iter, GtkTreeModel *model);
-static void pluma_plugin_manager_finalize (GObject *object);
-
-static void
-pluma_plugin_manager_class_init (PlumaPluginManagerClass *klass)
-{
- GObjectClass *object_class = G_OBJECT_CLASS (klass);
-
- object_class->finalize = pluma_plugin_manager_finalize;
-
- g_type_class_add_private (object_class, sizeof (PlumaPluginManagerPrivate));
-}
-
-static void
-about_button_cb (GtkWidget *button,
- PlumaPluginManager *pm)
-{
- PlumaPluginInfo *info;
-
- pluma_debug (DEBUG_PLUGINS);
-
- info = plugin_manager_get_selected_plugin (pm);
-
- g_return_if_fail (info != NULL);
-
- /* if there is another about dialog already open destroy it */
- if (pm->priv->about)
- gtk_widget_destroy (pm->priv->about);
-
- pm->priv->about = g_object_new (GTK_TYPE_ABOUT_DIALOG,
- "program-name", pluma_plugin_info_get_name (info),
- "copyright", pluma_plugin_info_get_copyright (info),
- "authors", pluma_plugin_info_get_authors (info),
- "comments", pluma_plugin_info_get_description (info),
- "website", pluma_plugin_info_get_website (info),
- "logo-icon-name", pluma_plugin_info_get_icon_name (info),
- "version", pluma_plugin_info_get_version (info),
- NULL);
-
- gtk_window_set_destroy_with_parent (GTK_WINDOW (pm->priv->about),
- TRUE);
-
- g_signal_connect (pm->priv->about,
- "response",
- G_CALLBACK (gtk_widget_destroy),
- NULL);
- g_signal_connect (pm->priv->about,
- "destroy",
- G_CALLBACK (gtk_widget_destroyed),
- &pm->priv->about);
-
- gtk_window_set_transient_for (GTK_WINDOW (pm->priv->about),
- GTK_WINDOW (gtk_widget_get_toplevel (GTK_WIDGET(pm))));
- gtk_widget_show (pm->priv->about);
-}
-
-static void
-configure_button_cb (GtkWidget *button,
- PlumaPluginManager *pm)
-{
- PlumaPluginInfo *info;
- GtkWindow *toplevel;
-
- pluma_debug (DEBUG_PLUGINS);
-
- info = plugin_manager_get_selected_plugin (pm);
-
- g_return_if_fail (info != NULL);
-
- pluma_debug_message (DEBUG_PLUGINS, "Configuring: %s\n",
- pluma_plugin_info_get_name (info));
-
- toplevel = GTK_WINDOW (gtk_widget_get_toplevel (GTK_WIDGET(pm)));
-
- pluma_plugins_engine_configure_plugin (pm->priv->engine,
- info, toplevel);
-
- pluma_debug_message (DEBUG_PLUGINS, "Done");
-}
-
-static void
-plugin_manager_view_info_cell_cb (GtkTreeViewColumn *tree_column,
- GtkCellRenderer *cell,
- GtkTreeModel *tree_model,
- GtkTreeIter *iter,
- gpointer data)
-{
- PlumaPluginInfo *info;
- gchar *text;
-
- g_return_if_fail (tree_model != NULL);
- g_return_if_fail (tree_column != NULL);
-
- gtk_tree_model_get (tree_model, iter, INFO_COLUMN, &info, -1);
-
- if (info == NULL)
- return;
-
- text = g_markup_printf_escaped ("<b>%s</b>\n%s",
- pluma_plugin_info_get_name (info),
- pluma_plugin_info_get_description (info));
- g_object_set (G_OBJECT (cell),
- "markup", text,
- "sensitive", pluma_plugin_info_is_available (info),
- NULL);
-
- g_free (text);
-}
-
-static void
-plugin_manager_view_icon_cell_cb (GtkTreeViewColumn *tree_column,
- GtkCellRenderer *cell,
- GtkTreeModel *tree_model,
- GtkTreeIter *iter,
- gpointer data)
-{
- PlumaPluginInfo *info;
-
- g_return_if_fail (tree_model != NULL);
- g_return_if_fail (tree_column != NULL);
-
- gtk_tree_model_get (tree_model, iter, INFO_COLUMN, &info, -1);
-
- if (info == NULL)
- return;
-
- g_object_set (G_OBJECT (cell),
- "icon-name", pluma_plugin_info_get_icon_name (info),
- "sensitive", pluma_plugin_info_is_available (info),
- NULL);
-}
-
-
-static void
-active_toggled_cb (GtkCellRendererToggle *cell,
- gchar *path_str,
- PlumaPluginManager *pm)
-{
- GtkTreeIter iter;
- GtkTreePath *path;
- GtkTreeModel *model;
-
- pluma_debug (DEBUG_PLUGINS);
-
- path = gtk_tree_path_new_from_string (path_str);
-
- model = gtk_tree_view_get_model (GTK_TREE_VIEW (pm->priv->tree));
- g_return_if_fail (model != NULL);
-
- gtk_tree_model_get_iter (model, &iter, path);
-
- if (&iter != NULL)
- plugin_manager_toggle_active (pm, &iter, model);
-
- gtk_tree_path_free (path);
-}
-
-static void
-cursor_changed_cb (GtkTreeView *view,
- gpointer data)
-{
- PlumaPluginManager *pm = data;
- PlumaPluginInfo *info;
-
- pluma_debug (DEBUG_PLUGINS);
-
- info = plugin_manager_get_selected_plugin (pm);
-
- gtk_widget_set_sensitive (GTK_WIDGET (pm->priv->about_button),
- info != NULL);
- gtk_widget_set_sensitive (GTK_WIDGET (pm->priv->configure_button),
- (info != NULL) &&
- pluma_plugin_info_is_configurable (info));
-}
-
-static void
-row_activated_cb (GtkTreeView *tree_view,
- GtkTreePath *path,
- GtkTreeViewColumn *column,
- gpointer data)
-{
- PlumaPluginManager *pm = data;
- GtkTreeIter iter;
- GtkTreeModel *model;
-
- pluma_debug (DEBUG_PLUGINS);
-
- model = gtk_tree_view_get_model (GTK_TREE_VIEW (pm->priv->tree));
-
- g_return_if_fail (model != NULL);
-
- gtk_tree_model_get_iter (model, &iter, path);
-
- g_return_if_fail (&iter != NULL);
-
- plugin_manager_toggle_active (pm, &iter, model);
-}
-
-static void
-plugin_manager_populate_lists (PlumaPluginManager *pm)
-{
- const GList *plugins;
- GtkListStore *model;
- GtkTreeIter iter;
-
- pluma_debug (DEBUG_PLUGINS);
-
- plugins = pluma_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)
- {
- PlumaPluginInfo *info;
- info = (PlumaPluginInfo *)plugins->data;
-
- gtk_list_store_append (model, &iter);
- gtk_list_store_set (model, &iter,
- ACTIVE_COLUMN, pluma_plugin_info_is_active (info),
- AVAILABLE_COLUMN, pluma_plugin_info_is_available (info),
- INFO_COLUMN, info,
- -1);
-
- plugins = plugins->next;
- }
-
- if (gtk_tree_model_get_iter_first (GTK_TREE_MODEL (model), &iter))
- {
- GtkTreeSelection *selection;
- PlumaPluginInfo* info;
-
- selection = gtk_tree_view_get_selection (GTK_TREE_VIEW (pm->priv->tree));
- g_return_if_fail (selection != NULL);
-
- gtk_tree_selection_select_iter (selection, &iter);
-
- gtk_tree_model_get (GTK_TREE_MODEL (model), &iter,
- INFO_COLUMN, &info, -1);
-
- gtk_widget_set_sensitive (GTK_WIDGET (pm->priv->configure_button),
- pluma_plugin_info_is_configurable (info));
- }
-}
-
-static gboolean
-plugin_manager_set_active (PlumaPluginManager *pm,
- GtkTreeIter *iter,
- GtkTreeModel *model,
- gboolean active)
-{
- PlumaPluginInfo *info;
- gboolean res = TRUE;
-
- pluma_debug (DEBUG_PLUGINS);
-
- gtk_tree_model_get (model, iter, INFO_COLUMN, &info, -1);
-
- g_return_val_if_fail (info != NULL, FALSE);
-
- if (active)
- {
- /* activate the plugin */
- if (!pluma_plugins_engine_activate_plugin (pm->priv->engine, info)) {
- pluma_debug_message (DEBUG_PLUGINS, "Could not activate %s.\n",
- pluma_plugin_info_get_name (info));
-
- res = FALSE;
- }
- }
- else
- {
- /* deactivate the plugin */
- if (!pluma_plugins_engine_deactivate_plugin (pm->priv->engine, info)) {
- pluma_debug_message (DEBUG_PLUGINS, "Could not deactivate %s.\n",
- pluma_plugin_info_get_name (info));
-
- res = FALSE;
- }
- }
-
- return res;
-}
-
-static void
-plugin_manager_toggle_active (PlumaPluginManager *pm,
- GtkTreeIter *iter,
- GtkTreeModel *model)
-{
- gboolean active;
-
- pluma_debug (DEBUG_PLUGINS);
-
- gtk_tree_model_get (model, iter, ACTIVE_COLUMN, &active, -1);
-
- active ^= 1;
-
- plugin_manager_set_active (pm, iter, model, active);
-}
-
-static PlumaPluginInfo *
-plugin_manager_get_selected_plugin (PlumaPluginManager *pm)
-{
- PlumaPluginInfo *info = NULL;
- GtkTreeModel *model;
- GtkTreeIter iter;
- GtkTreeSelection *selection;
-
- pluma_debug (DEBUG_PLUGINS);
-
- model = gtk_tree_view_get_model (GTK_TREE_VIEW (pm->priv->tree));
- g_return_val_if_fail (model != NULL, NULL);
-
- selection = gtk_tree_view_get_selection (GTK_TREE_VIEW (pm->priv->tree));
- g_return_val_if_fail (selection != NULL, NULL);
-
- if (gtk_tree_selection_get_selected (selection, NULL, &iter))
- {
- gtk_tree_model_get (model, &iter, INFO_COLUMN, &info, -1);
- }
-
- return info;
-}
-
-static void
-plugin_manager_set_active_all (PlumaPluginManager *pm,
- gboolean active)
-{
- GtkTreeModel *model;
- GtkTreeIter iter;
-
- pluma_debug (DEBUG_PLUGINS);
-
- model = gtk_tree_view_get_model (GTK_TREE_VIEW (pm->priv->tree));
-
- g_return_if_fail (model != NULL);
-
- gtk_tree_model_get_iter_first (model, &iter);
-
- do {
- plugin_manager_set_active (pm, &iter, model, active);
- }
- while (gtk_tree_model_iter_next (model, &iter));
-}
-
-/* Callback used as the interactive search comparison function */
-static gboolean
-name_search_cb (GtkTreeModel *model,
- gint column,
- const gchar *key,
- GtkTreeIter *iter,
- gpointer data)
-{
- PlumaPluginInfo *info;
- gchar *normalized_string;
- gchar *normalized_key;
- gchar *case_normalized_string;
- gchar *case_normalized_key;
- gint key_len;
- gboolean retval;
-
- gtk_tree_model_get (model, iter, INFO_COLUMN, &info, -1);
- if (!info)
- return FALSE;
-
- normalized_string = g_utf8_normalize (pluma_plugin_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);
-
- key_len = strlen (case_normalized_key);
-
- /* Oddly enough, this callback must return whether to stop the search
- * because we found a match, not whether we actually matched.
- */
- retval = (strncmp (case_normalized_key, case_normalized_string, key_len) != 0);
-
- g_free (normalized_key);
- g_free (normalized_string);
- g_free (case_normalized_key);
- g_free (case_normalized_string);
-
- return retval;
-}
-
-static void
-enable_plugin_menu_cb (GtkMenu *menu,
- PlumaPluginManager *pm)
-{
- GtkTreeModel *model;
- GtkTreeIter iter;
- GtkTreeSelection *selection;
-
- model = gtk_tree_view_get_model (GTK_TREE_VIEW (pm->priv->tree));
- g_return_if_fail (model != NULL);
-
- selection = gtk_tree_view_get_selection (GTK_TREE_VIEW (pm->priv->tree));
- g_return_if_fail (selection != NULL);
-
- if (gtk_tree_selection_get_selected (selection, NULL, &iter))
- plugin_manager_toggle_active (pm, &iter, model);
-}
-
-static void
-enable_all_menu_cb (GtkMenu *menu,
- PlumaPluginManager *pm)
-{
- plugin_manager_set_active_all (pm, TRUE);
-}
-
-static void
-disable_all_menu_cb (GtkMenu *menu,
- PlumaPluginManager *pm)
-{
- plugin_manager_set_active_all (pm, FALSE);
-}
-
-static GtkWidget *
-create_tree_popup_menu (PlumaPluginManager *pm)
-{
- GtkWidget *menu;
- GtkWidget *item;
- GtkWidget *image;
- PlumaPluginInfo *info;
-
- info = plugin_manager_get_selected_plugin (pm);
-
- menu = gtk_menu_new ();
-
- item = gtk_image_menu_item_new_with_mnemonic (_("_About"));
- image = gtk_image_new_from_stock (GTK_STOCK_ABOUT,
- GTK_ICON_SIZE_MENU);
- gtk_image_menu_item_set_image (GTK_IMAGE_MENU_ITEM (item), image);
- g_signal_connect (item, "activate",
- G_CALLBACK (about_button_cb), pm);
- gtk_menu_shell_append (GTK_MENU_SHELL (menu), item);
-
- item = gtk_image_menu_item_new_with_mnemonic (_("C_onfigure"));
- image = gtk_image_new_from_stock (GTK_STOCK_PREFERENCES,
- GTK_ICON_SIZE_MENU);
- 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, pluma_plugin_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, pluma_plugin_info_is_available (info));
- gtk_check_menu_item_set_active (GTK_CHECK_MENU_ITEM (item),
- pluma_plugin_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);
-
- item = gtk_separator_menu_item_new ();
- gtk_menu_shell_append (GTK_MENU_SHELL (menu), item);
-
- item = gtk_menu_item_new_with_mnemonic (_("Ac_tivate All"));
- g_signal_connect (item, "activate",
- G_CALLBACK (enable_all_menu_cb), pm);
- gtk_menu_shell_append (GTK_MENU_SHELL (menu), item);
-
- item = gtk_menu_item_new_with_mnemonic (_("_Deactivate All"));
- g_signal_connect (item, "activate",
- G_CALLBACK (disable_all_menu_cb), pm);
- gtk_menu_shell_append (GTK_MENU_SHELL (menu), item);
-
- gtk_widget_show_all (menu);
-
- return menu;
-}
-
-static void
-tree_popup_menu_detach (PlumaPluginManager *pm,
- GtkMenu *menu)
-{
- pm->priv->popup_menu = NULL;
-}
-
-static void
-show_tree_popup_menu (GtkTreeView *tree,
- PlumaPluginManager *pm,
- GdkEventButton *event)
-{
- if (pm->priv->popup_menu)
- gtk_widget_destroy (pm->priv->popup_menu);
-
- pm->priv->popup_menu = create_tree_popup_menu (pm);
-
- gtk_menu_attach_to_widget (GTK_MENU (pm->priv->popup_menu),
- GTK_WIDGET (pm),
- (GtkMenuDetachFunc) tree_popup_menu_detach);
-
- if (event != NULL)
- {
- gtk_menu_popup (GTK_MENU (pm->priv->popup_menu), NULL, NULL,
- NULL, NULL,
- event->button, event->time);
- }
- else
- {
- gtk_menu_popup (GTK_MENU (pm->priv->popup_menu), NULL, NULL,
- pluma_utils_menu_position_under_tree_view, tree,
- 0, gtk_get_current_event_time ());
-
- gtk_menu_shell_select_first (GTK_MENU_SHELL (pm->priv->popup_menu),
- FALSE);
- }
-}
-
-static gboolean
-button_press_event_cb (GtkWidget *tree,
- GdkEventButton *event,
- PlumaPluginManager *pm)
-{
- /* We want the treeview selection to be updated before showing the menu.
- * This code is evil, thanks to Federico Mena Quintero's black magic.
- * See: http://mail.gnome.org/archives/gtk-devel-list/2006-February/msg00168.html
- * FIXME: Let's remove it asap.
- */
-
- static gboolean in_press = FALSE;
- gboolean handled;
-
- if (in_press)
- return FALSE; /* we re-entered */
-
- if (GDK_BUTTON_PRESS != event->type || 3 != event->button)
- return FALSE; /* let the normal handler run */
-
- in_press = TRUE;
- handled = gtk_widget_event (tree, (GdkEvent *) event);
- in_press = FALSE;
-
- if (!handled)
- return FALSE;
-
- /* The selection is fully updated by now */
- show_tree_popup_menu (GTK_TREE_VIEW (tree), pm, event);
- return TRUE;
-}
-
-static gboolean
-popup_menu_cb (GtkTreeView *tree,
- PlumaPluginManager *pm)
-{
- show_tree_popup_menu (tree, pm, NULL);
- return TRUE;
-}
-
-static gint
-model_name_sort_func (GtkTreeModel *model,
- GtkTreeIter *iter1,
- GtkTreeIter *iter2,
- gpointer user_data)
-{
- PlumaPluginInfo *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 (pluma_plugin_info_get_name (info1),
- pluma_plugin_info_get_name (info2));
-}
-
-static void
-plugin_manager_construct_tree (PlumaPluginManager *pm)
-{
- GtkTreeViewColumn *column;
- GtkCellRenderer *cell;
- GtkListStore *model;
-
- pluma_debug (DEBUG_PLUGINS);
-
- model = gtk_list_store_new (N_COLUMNS,
- G_TYPE_BOOLEAN,
- G_TYPE_BOOLEAN,
- G_TYPE_POINTER);
-
- gtk_tree_view_set_model (GTK_TREE_VIEW (pm->priv->tree),
- GTK_TREE_MODEL (model));
- g_object_unref (model);
-
- gtk_tree_view_set_headers_visible (GTK_TREE_VIEW (pm->priv->tree), FALSE);
-
- /* first column */
- cell = gtk_cell_renderer_toggle_new ();
- g_object_set (cell, "xpad", 6, NULL);
- g_signal_connect (cell,
- "toggled",
- G_CALLBACK (active_toggled_cb),
- pm);
- column = gtk_tree_view_column_new_with_attributes (PLUGIN_MANAGER_ACTIVE_TITLE,
- cell,
- "active",
- ACTIVE_COLUMN,
- "activatable",
- AVAILABLE_COLUMN,
- "sensitive",
- AVAILABLE_COLUMN,
- NULL);
- gtk_tree_view_append_column (GTK_TREE_VIEW (pm->priv->tree), column);
-
- /* second column */
- column = gtk_tree_view_column_new ();
- gtk_tree_view_column_set_title (column, PLUGIN_MANAGER_NAME_TITLE);
- gtk_tree_view_column_set_resizable (column, TRUE);
-
- cell = gtk_cell_renderer_pixbuf_new ();
- gtk_tree_view_column_pack_start (column, cell, FALSE);
- g_object_set (cell, "stock-size", GTK_ICON_SIZE_SMALL_TOOLBAR, NULL);
- gtk_tree_view_column_set_cell_data_func (column, cell,
- plugin_manager_view_icon_cell_cb,
- pm, NULL);
-
- cell = gtk_cell_renderer_text_new ();
- gtk_tree_view_column_pack_start (column, cell, TRUE);
- g_object_set (cell, "ellipsize", PANGO_ELLIPSIZE_END, NULL);
- gtk_tree_view_column_set_cell_data_func (column, cell,
- plugin_manager_view_info_cell_cb,
- pm, NULL);
-
-
- gtk_tree_view_column_set_spacing (column, 6);
- gtk_tree_view_append_column (GTK_TREE_VIEW (pm->priv->tree), column);
-
- /* Sort on the plugin names */
- gtk_tree_sortable_set_default_sort_func (GTK_TREE_SORTABLE (model),
- model_name_sort_func,
- NULL,
- NULL);
- gtk_tree_sortable_set_sort_column_id (GTK_TREE_SORTABLE (model),
- GTK_TREE_SORTABLE_DEFAULT_SORT_COLUMN_ID,
- GTK_SORT_ASCENDING);
-
- /* Enable search for our non-string column */
- gtk_tree_view_set_search_column (GTK_TREE_VIEW (pm->priv->tree),
- INFO_COLUMN);
- gtk_tree_view_set_search_equal_func (GTK_TREE_VIEW (pm->priv->tree),
- name_search_cb,
- NULL,
- NULL);
-
- g_signal_connect (pm->priv->tree,
- "cursor_changed",
- G_CALLBACK (cursor_changed_cb),
- pm);
- g_signal_connect (pm->priv->tree,
- "row_activated",
- G_CALLBACK (row_activated_cb),
- pm);
-
- g_signal_connect (pm->priv->tree,
- "button-press-event",
- G_CALLBACK (button_press_event_cb),
- pm);
- g_signal_connect (pm->priv->tree,
- "popup-menu",
- G_CALLBACK (popup_menu_cb),
- pm);
- gtk_widget_show (pm->priv->tree);
-}
-
-static void
-plugin_toggled_cb (PlumaPluginsEngine *engine,
- PlumaPluginInfo *info,
- PlumaPluginManager *pm)
-{
- GtkTreeSelection *selection;
- GtkTreeModel *model;
- GtkTreeIter iter;
- gboolean info_found = FALSE;
-
- selection = gtk_tree_view_get_selection (GTK_TREE_VIEW (pm->priv->tree));
-
- if (gtk_tree_selection_get_selected (selection, &model, &iter))
- {
- /* There is an item selected: it's probably the one we want! */
- PlumaPluginInfo *tinfo;
- gtk_tree_model_get (model, &iter, INFO_COLUMN, &tinfo, -1);
- info_found = info == tinfo;
- }
-
- if (!info_found)
- {
- gtk_tree_model_get_iter_first (model, &iter);
-
- do
- {
- PlumaPluginInfo *tinfo;
- gtk_tree_model_get (model, &iter, INFO_COLUMN, &tinfo, -1);
- info_found = info == tinfo;
- }
- while (!info_found && gtk_tree_model_iter_next (model, &iter));
- }
-
- if (!info_found)
- {
- g_warning ("PlumaPluginManager: plugin '%s' not found in the tree model",
- pluma_plugin_info_get_name (info));
- return;
- }
-
- gtk_list_store_set (GTK_LIST_STORE (model), &iter, ACTIVE_COLUMN, pluma_plugin_info_is_active (info), -1);
-}
-
-static void
-pluma_plugin_manager_init (PlumaPluginManager *pm)
-{
- GtkWidget *label;
- GtkWidget *viewport;
- GtkWidget *hbuttonbox;
-
- pluma_debug (DEBUG_PLUGINS);
-
- pm->priv = PLUMA_PLUGIN_MANAGER_GET_PRIVATE (pm);
-
- gtk_orientable_set_orientation (GTK_ORIENTABLE (pm),
- GTK_ORIENTATION_VERTICAL);
-
- /*
- * Always we create the manager, firstly we rescan the plugins directory
- */
- pluma_plugins_engine_rescan_plugins (pluma_plugins_engine_get_default ());
-
- gtk_box_set_spacing (GTK_BOX (pm), 6);
-
- label = gtk_label_new_with_mnemonic (_("Active _Plugins:"));
- gtk_label_set_justify (GTK_LABEL (label), GTK_JUSTIFY_LEFT);
-#if GTK_CHECK_VERSION (3, 16, 0)
- gtk_label_set_xalign (GTK_LABEL (label), 0.0);
-#else
- gtk_misc_set_alignment (GTK_MISC (label), 0.0, 0.5);
-#endif
-
- gtk_box_pack_start (GTK_BOX (pm), label, FALSE, TRUE, 0);
-
- viewport = gtk_scrolled_window_new (NULL, NULL);
- gtk_scrolled_window_set_policy (GTK_SCROLLED_WINDOW (viewport),
- GTK_POLICY_AUTOMATIC,
- GTK_POLICY_AUTOMATIC);
- gtk_scrolled_window_set_shadow_type (GTK_SCROLLED_WINDOW (viewport),
- GTK_SHADOW_IN);
-
- gtk_box_pack_start (GTK_BOX (pm), viewport, TRUE, TRUE, 0);
-
- pm->priv->tree = gtk_tree_view_new ();
- gtk_container_add (GTK_CONTAINER (viewport), pm->priv->tree);
-
- gtk_label_set_mnemonic_widget (GTK_LABEL (label), pm->priv->tree);
-
- hbuttonbox = gtk_button_box_new (GTK_ORIENTATION_HORIZONTAL);
- gtk_box_pack_start (GTK_BOX (pm), hbuttonbox, FALSE, FALSE, 0);
- gtk_button_box_set_layout (GTK_BUTTON_BOX (hbuttonbox), GTK_BUTTONBOX_END);
- gtk_box_set_spacing (GTK_BOX (hbuttonbox), 8);
-
- pm->priv->about_button = pluma_gtk_button_new_with_stock_icon (_("_About Plugin"),
- GTK_STOCK_ABOUT);
- gtk_container_add (GTK_CONTAINER (hbuttonbox), pm->priv->about_button);
-
- pm->priv->configure_button = pluma_gtk_button_new_with_stock_icon (_("C_onfigure Plugin"),
- GTK_STOCK_PREFERENCES);
- gtk_container_add (GTK_CONTAINER (hbuttonbox), pm->priv->configure_button);
-
- /* setup a window of a sane size. */
- gtk_widget_set_size_request (GTK_WIDGET (viewport), 270, 100);
-
- g_signal_connect (pm->priv->about_button,
- "clicked",
- G_CALLBACK (about_button_cb),
- pm);
- g_signal_connect (pm->priv->configure_button,
- "clicked",
- G_CALLBACK (configure_button_cb),
- pm);
-
- plugin_manager_construct_tree (pm);
-
- /* get the plugin engine and populate the treeview */
- pm->priv->engine = pluma_plugins_engine_get_default ();
-
- g_signal_connect_after (pm->priv->engine,
- "activate-plugin",
- G_CALLBACK (plugin_toggled_cb),
- pm);
- g_signal_connect_after (pm->priv->engine,
- "deactivate-plugin",
- G_CALLBACK (plugin_toggled_cb),
- pm);
-
- if (pluma_plugins_engine_get_plugin_list (pm->priv->engine) != NULL)
- {
- plugin_manager_populate_lists (pm);
- }
- else
- {
- gtk_widget_set_sensitive (pm->priv->about_button, FALSE);
- gtk_widget_set_sensitive (pm->priv->configure_button, FALSE);
- }
-}
-
-static void
-pluma_plugin_manager_finalize (GObject *object)
-{
- PlumaPluginManager *pm = PLUMA_PLUGIN_MANAGER (object);
-
- g_signal_handlers_disconnect_by_func (pm->priv->engine,
- plugin_toggled_cb,
- pm);
-
- if (pm->priv->popup_menu)
- gtk_widget_destroy (pm->priv->popup_menu);
-
- G_OBJECT_CLASS (pluma_plugin_manager_parent_class)->finalize (object);
-
-}
-
-GtkWidget *pluma_plugin_manager_new (void)
-{
- return g_object_new (PLUMA_TYPE_PLUGIN_MANAGER,0);
-}
diff --git a/pluma/pluma-plugin-manager.h b/pluma/pluma-plugin-manager.h
deleted file mode 100644
index abdab625..00000000
--- a/pluma/pluma-plugin-manager.h
+++ /dev/null
@@ -1,83 +0,0 @@
-/*
- * pluma-plugin-manager.h
- * This file is part of pluma
- *
- * 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., 51 Franklin St, Fifth Floor,
- * Boston, MA 02110-1301, USA.
- */
-
-/*
- * Modified by the pluma Team, 2002-2005. See the AUTHORS file for a
- * list of people on the pluma Team.
- * See the ChangeLog files for a list of changes.
- *
- * $Id$
- */
-
-#ifndef __PLUMA_PLUGIN_MANAGER_H__
-#define __PLUMA_PLUGIN_MANAGER_H__
-
-#include <gtk/gtk.h>
-
-G_BEGIN_DECLS
-
-/*
- * Type checking and casting macros
- */
-#define PLUMA_TYPE_PLUGIN_MANAGER (pluma_plugin_manager_get_type())
-#define PLUMA_PLUGIN_MANAGER(obj) (G_TYPE_CHECK_INSTANCE_CAST((obj), PLUMA_TYPE_PLUGIN_MANAGER, PlumaPluginManager))
-#define PLUMA_PLUGIN_MANAGER_CLASS(klass) (G_TYPE_CHECK_CLASS_CAST((klass), PLUMA_TYPE_PLUGIN_MANAGER, PlumaPluginManagerClass))
-#define PLUMA_IS_PLUGIN_MANAGER(obj) (G_TYPE_CHECK_INSTANCE_TYPE((obj), PLUMA_TYPE_PLUGIN_MANAGER))
-#define PLUMA_IS_PLUGIN_MANAGER_CLASS(klass) (G_TYPE_CHECK_CLASS_TYPE ((klass), PLUMA_TYPE_PLUGIN_MANAGER))
-#define PLUMA_PLUGIN_MANAGER_GET_CLASS(obj) (G_TYPE_INSTANCE_GET_CLASS((obj), PLUMA_TYPE_PLUGIN_MANAGER, PlumaPluginManagerClass))
-
-/* Private structure type */
-typedef struct _PlumaPluginManagerPrivate PlumaPluginManagerPrivate;
-
-/*
- * Main object structure
- */
-typedef struct _PlumaPluginManager PlumaPluginManager;
-
-struct _PlumaPluginManager
-{
- GtkBox vbox;
-
- /*< private > */
- PlumaPluginManagerPrivate *priv;
-};
-
-/*
- * Class definition
- */
-typedef struct _PlumaPluginManagerClass PlumaPluginManagerClass;
-
-struct _PlumaPluginManagerClass
-{
- GtkBoxClass parent_class;
-};
-
-/*
- * Public methods
- */
-GType pluma_plugin_manager_get_type (void) G_GNUC_CONST;
-
-GtkWidget *pluma_plugin_manager_new (void);
-
-G_END_DECLS
-
-#endif /* __PLUMA_PLUGIN_MANAGER_H__ */
diff --git a/pluma/pluma-plugin.c b/pluma/pluma-plugin.c
deleted file mode 100644
index da2689d6..00000000
--- a/pluma/pluma-plugin.c
+++ /dev/null
@@ -1,334 +0,0 @@
-/*
- * pluma-plugin.h
- * This file is part of pluma
- *
- * 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., 51 Franklin St, Fifth Floor,
- * Boston, MA 02110-1301, USA.
- */
-
-/*
- * Modified by the pluma Team, 2002-2005. See the AUTHORS file for a
- * list of people on the pluma Team.
- * See the ChangeLog files for a list of changes.
- *
- * $Id$
- */
-
-#ifdef HAVE_CONFIG_H
-#include <config.h>
-#endif
-
-#include "pluma-plugin.h"
-#include "pluma-dirs.h"
-
-/* properties */
-enum {
- PROP_0,
- PROP_INSTALL_DIR,
- PROP_DATA_DIR_NAME,
- PROP_DATA_DIR
-};
-
-typedef struct _PlumaPluginPrivate PlumaPluginPrivate;
-
-struct _PlumaPluginPrivate
-{
- gchar *install_dir;
- gchar *data_dir_name;
-};
-
-#define PLUMA_PLUGIN_GET_PRIVATE(object)(G_TYPE_INSTANCE_GET_PRIVATE ((object), PLUMA_TYPE_PLUGIN, PlumaPluginPrivate))
-
-G_DEFINE_TYPE(PlumaPlugin, pluma_plugin, G_TYPE_OBJECT)
-
-static void
-dummy (PlumaPlugin *plugin, PlumaWindow *window)
-{
- /* Empty */
-}
-
-static GtkWidget *
-create_configure_dialog (PlumaPlugin *plugin)
-{
- return NULL;
-}
-
-static gboolean
-is_configurable (PlumaPlugin *plugin)
-{
- return (PLUMA_PLUGIN_GET_CLASS (plugin)->create_configure_dialog !=
- create_configure_dialog);
-}
-
-static void
-pluma_plugin_get_property (GObject *object,
- guint prop_id,
- GValue *value,
- GParamSpec *pspec)
-{
- switch (prop_id)
- {
- case PROP_INSTALL_DIR:
- g_value_take_string (value, pluma_plugin_get_install_dir (PLUMA_PLUGIN (object)));
- break;
- case PROP_DATA_DIR:
- g_value_take_string (value, pluma_plugin_get_data_dir (PLUMA_PLUGIN (object)));
- break;
- default:
- g_return_if_reached ();
- }
-}
-
-static void
-pluma_plugin_set_property (GObject *object,
- guint prop_id,
- const GValue *value,
- GParamSpec *pspec)
-{
- PlumaPluginPrivate *priv = PLUMA_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
-pluma_plugin_finalize (GObject *object)
-{
- PlumaPluginPrivate *priv = PLUMA_PLUGIN_GET_PRIVATE (object);
-
- g_free (priv->install_dir);
- g_free (priv->data_dir_name);
-
- G_OBJECT_CLASS (pluma_plugin_parent_class)->finalize (object);
-}
-
-static void
-pluma_plugin_class_init (PlumaPluginClass *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 = pluma_plugin_get_property;
- object_class->set_property = pluma_plugin_set_property;
- object_class->finalize = pluma_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 (PlumaPluginPrivate));
-}
-
-static void
-pluma_plugin_init (PlumaPlugin *plugin)
-{
- /* Empty */
-}
-
-/**
- * pluma_plugin_get_install_dir:
- * @plugin: a #PlumaPlugin
- *
- * 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 *
-pluma_plugin_get_install_dir (PlumaPlugin *plugin)
-{
- g_return_val_if_fail (PLUMA_IS_PLUGIN (plugin), NULL);
-
- return g_strdup (PLUMA_PLUGIN_GET_PRIVATE (plugin)->install_dir);
-}
-
-/**
- * pluma_plugin_get_data_dir:
- * @plugin: a #PlumaPlugin
- *
- * 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 *
-pluma_plugin_get_data_dir (PlumaPlugin *plugin)
-{
- PlumaPluginPrivate *priv;
- gchar *pluma_lib_dir;
- gchar *data_dir;
-
- g_return_val_if_fail (PLUMA_IS_PLUGIN (plugin), NULL);
-
- priv = PLUMA_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 pluma_data_dir,
- * so it's under $prefix/share/pluma/plugins/data_dir_name
- * where data_dir_name usually it's the name of the plugin
- */
- pluma_lib_dir = pluma_dirs_get_pluma_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, pluma_lib_dir))
- {
- gchar *pluma_data_dir;
-
- pluma_data_dir = pluma_dirs_get_pluma_data_dir ();
-
- data_dir = g_build_filename (pluma_data_dir,
- "plugins",
- priv->data_dir_name,
- NULL);
-
- g_free (pluma_data_dir);
- }
- else
- {
- data_dir = g_build_filename (priv->install_dir,
- priv->data_dir_name,
- NULL);
- }
-
- g_free (pluma_lib_dir);
-
- return data_dir;
-}
-
-/**
- * pluma_plugin_activate:
- * @plugin: a #PlumaPlugin
- * @window: a #PlumaWindow
- *
- * Activates the plugin.
- */
-void
-pluma_plugin_activate (PlumaPlugin *plugin,
- PlumaWindow *window)
-{
- g_return_if_fail (PLUMA_IS_PLUGIN (plugin));
- g_return_if_fail (PLUMA_IS_WINDOW (window));
-
- PLUMA_PLUGIN_GET_CLASS (plugin)->activate (plugin, window);
-}
-
-/**
- * pluma_plugin_deactivate:
- * @plugin: a #PlumaPlugin
- * @window: a #PlumaWindow
- *
- * Deactivates the plugin.
- */
-void
-pluma_plugin_deactivate (PlumaPlugin *plugin,
- PlumaWindow *window)
-{
- g_return_if_fail (PLUMA_IS_PLUGIN (plugin));
- g_return_if_fail (PLUMA_IS_WINDOW (window));
-
- PLUMA_PLUGIN_GET_CLASS (plugin)->deactivate (plugin, window);
-}
-
-/**
- * pluma_plugin_update_ui:
- * @plugin: a #PlumaPlugin
- * @window: a #PlumaWindow
- *
- * Triggers an update of the user interface to take into account state changes
- * caused by the plugin.
- */
-void
-pluma_plugin_update_ui (PlumaPlugin *plugin,
- PlumaWindow *window)
-{
- g_return_if_fail (PLUMA_IS_PLUGIN (plugin));
- g_return_if_fail (PLUMA_IS_WINDOW (window));
-
- PLUMA_PLUGIN_GET_CLASS (plugin)->update_ui (plugin, window);
-}
-
-/**
- * pluma_plugin_is_configurable:
- * @plugin: a #PlumaPlugin
- *
- * Whether the plugin is configurable.
- *
- * Returns: TRUE if the plugin is configurable:
- */
-gboolean
-pluma_plugin_is_configurable (PlumaPlugin *plugin)
-{
- g_return_val_if_fail (PLUMA_IS_PLUGIN (plugin), FALSE);
-
- return PLUMA_PLUGIN_GET_CLASS (plugin)->is_configurable (plugin);
-}
-
-/**
- * pluma_plugin_create_configure_dialog:
- * @plugin: a #PlumaPlugin
- *
- * Creates the configure dialog widget for the plugin.
- *
- * Returns: the configure dialog widget for the plugin.
- */
-GtkWidget *
-pluma_plugin_create_configure_dialog (PlumaPlugin *plugin)
-{
- g_return_val_if_fail (PLUMA_IS_PLUGIN (plugin), NULL);
-
- return PLUMA_PLUGIN_GET_CLASS (plugin)->create_configure_dialog (plugin);
-}
diff --git a/pluma/pluma-plugin.h b/pluma/pluma-plugin.h
deleted file mode 100644
index 39cd19d0..00000000
--- a/pluma/pluma-plugin.h
+++ /dev/null
@@ -1,240 +0,0 @@
-/*
- * pluma-plugin.h
- * This file is part of pluma
- *
- * 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., 51 Franklin St, Fifth Floor,
- * Boston, MA 02110-1301, USA.
- */
-
-/*
- * Modified by the pluma Team, 2002-2005. See the AUTHORS file for a
- * list of people on the pluma Team.
- * See the ChangeLog files for a list of changes.
- *
- * $Id$
- */
-
-#ifndef __PLUMA_PLUGIN_H__
-#define __PLUMA_PLUGIN_H__
-
-#include <glib-object.h>
-
-#include <pluma/pluma-window.h>
-#include <pluma/pluma-debug.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 PLUMA_TYPE_PLUGIN (pluma_plugin_get_type())
-#define PLUMA_PLUGIN(obj) (G_TYPE_CHECK_INSTANCE_CAST((obj), PLUMA_TYPE_PLUGIN, PlumaPlugin))
-#define PLUMA_PLUGIN_CLASS(klass) (G_TYPE_CHECK_CLASS_CAST((klass), PLUMA_TYPE_PLUGIN, PlumaPluginClass))
-#define PLUMA_IS_PLUGIN(obj) (G_TYPE_CHECK_INSTANCE_TYPE((obj), PLUMA_TYPE_PLUGIN))
-#define PLUMA_IS_PLUGIN_CLASS(klass) (G_TYPE_CHECK_CLASS_TYPE ((klass), PLUMA_TYPE_PLUGIN))
-#define PLUMA_PLUGIN_GET_CLASS(obj) (G_TYPE_INSTANCE_GET_CLASS((obj), PLUMA_TYPE_PLUGIN, PlumaPluginClass))
-
-/*
- * Main object structure
- */
-typedef struct _PlumaPlugin PlumaPlugin;
-
-struct _PlumaPlugin
-{
- GObject parent;
-};
-
-/*
- * Class definition
- */
-typedef struct _PlumaPluginClass PlumaPluginClass;
-
-struct _PlumaPluginClass
-{
- GObjectClass parent_class;
-
- /* Virtual public methods */
-
- void (*activate) (PlumaPlugin *plugin,
- PlumaWindow *window);
- void (*deactivate) (PlumaPlugin *plugin,
- PlumaWindow *window);
-
- void (*update_ui) (PlumaPlugin *plugin,
- PlumaWindow *window);
-
- GtkWidget *(*create_configure_dialog)
- (PlumaPlugin *plugin);
-
- /* Plugins should not override this, it's handled automatically by
- the PlumaPluginClass */
- gboolean (*is_configurable)
- (PlumaPlugin *plugin);
-
- /* Padding for future expansion */
- void (*_pluma_reserved1) (void);
- void (*_pluma_reserved2) (void);
- void (*_pluma_reserved3) (void);
- void (*_pluma_reserved4) (void);
-};
-
-/*
- * Public methods
- */
-GType pluma_plugin_get_type (void) G_GNUC_CONST;
-
-gchar *pluma_plugin_get_install_dir (PlumaPlugin *plugin);
-gchar *pluma_plugin_get_data_dir (PlumaPlugin *plugin);
-
-void pluma_plugin_activate (PlumaPlugin *plugin,
- PlumaWindow *window);
-void pluma_plugin_deactivate (PlumaPlugin *plugin,
- PlumaWindow *window);
-
-void pluma_plugin_update_ui (PlumaPlugin *plugin,
- PlumaWindow *window);
-
-gboolean pluma_plugin_is_configurable (PlumaPlugin *plugin);
-GtkWidget *pluma_plugin_create_configure_dialog
- (PlumaPlugin *plugin);
-
-/**
- * PLUMA_PLUGIN_REGISTER_TYPE_WITH_CODE(PluginName, plugin_name, CODE):
- *
- * Utility macro used to register plugins with additional code.
- */
-#define PLUMA_PLUGIN_REGISTER_TYPE_WITH_CODE(PluginName, plugin_name, CODE) \
- G_DEFINE_DYNAMIC_TYPE_EXTENDED (PluginName, \
- plugin_name, \
- PLUMA_TYPE_PLUGIN, \
- 0, \
- GTypeModule *module G_GNUC_UNUSED = type_module; /* back compat */ \
- CODE) \
- \
-/* This is not very nice, but G_DEFINE_DYNAMIC wants it and our old macro \
- * did not support it */ \
-static void \
-plugin_name##_class_finalize (PluginName##Class *klass) \
-{ \
-} \
- \
- \
-G_MODULE_EXPORT GType \
-register_pluma_plugin (GTypeModule *type_module) \
-{ \
- plugin_name##_register_type (type_module); \
- \
- return plugin_name##_get_type(); \
-}
-
-/**
- * PLUMA_PLUGIN_REGISTER_TYPE(PluginName, plugin_name):
- *
- * Utility macro used to register plugins.
- */
-#define PLUMA_PLUGIN_REGISTER_TYPE(PluginName, plugin_name) \
- PLUMA_PLUGIN_REGISTER_TYPE_WITH_CODE(PluginName, plugin_name, ;)
-
-/**
- * PLUMA_PLUGIN_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 PLUMA_PLUGIN_DEFINE_TYPE_WITH_CODE(ObjectName, object_name, PARENT_TYPE, CODE) \
- \
-static GType g_define_type_id = 0; \
- \
-GType \
-object_name##_get_type (void) \
-{ \
- return g_define_type_id; \
-} \
- \
-static void object_name##_init (ObjectName *self); \
-static void object_name##_class_init (ObjectName##Class *klass); \
-static gpointer object_name##_parent_class = NULL; \
-static void object_name##_class_intern_init (gpointer klass) \
-{ \
- object_name##_parent_class = g_type_class_peek_parent (klass); \
- object_name##_class_init ((ObjectName##Class *) klass); \
-} \
- \
-GType \
-object_name##_register_type (GTypeModule *type_module) \
-{ \
- GTypeModule *module G_GNUC_UNUSED = type_module; /* back compat */ \
- static const GTypeInfo our_info = \
- { \
- sizeof (ObjectName##Class), \
- NULL, /* base_init */ \
- NULL, /* base_finalize */ \
- (GClassInitFunc) object_name##_class_intern_init, \
- NULL, \
- NULL, /* class_data */ \
- sizeof (ObjectName), \
- 0, /* n_preallocs */ \
- (GInstanceInitFunc) object_name##_init \
- }; \
- \
- g_define_type_id = g_type_module_register_type (type_module, \
- PARENT_TYPE, \
- #ObjectName, \
- &our_info, \
- 0); \
- \
- CODE \
- \
- return g_define_type_id; \
-}
-
-
-/**
- * PLUMA_PLUGIN_DEFINE_TYPE(ObjectName, object_name, PARENT_TYPE):
- *
- * Utility macro used to register gobject types in plugins.
- *
- * Deprecated: use G_DEFINE_DYNAMIC instead
- */
-#define PLUMA_PLUGIN_DEFINE_TYPE(ObjectName, object_name, PARENT_TYPE) \
- PLUMA_PLUGIN_DEFINE_TYPE_WITH_CODE(ObjectName, object_name, PARENT_TYPE, ;)
-
-/**
- * PLUMA_PLUGIN_IMPLEMENT_INTERFACE(TYPE_IFACE, iface_init):
- *
- * Utility macro used to register interfaces for gobject types in plugins.
- */
-#define PLUMA_PLUGIN_IMPLEMENT_INTERFACE(object_name, TYPE_IFACE, iface_init) \
- const GInterfaceInfo object_name##_interface_info = \
- { \
- (GInterfaceInitFunc) iface_init, \
- NULL, \
- NULL \
- }; \
- \
- g_type_module_add_interface (type_module, \
- g_define_type_id, \
- TYPE_IFACE, \
- &object_name##_interface_info);
-
-G_END_DECLS
-
-#endif /* __PLUMA_PLUGIN_H__ */
diff --git a/pluma/pluma-plugins-engine.c b/pluma/pluma-plugins-engine.c
index 27f71dd9..fcedd86f 100644
--- a/pluma/pluma-plugins-engine.c
+++ b/pluma/pluma-plugins-engine.c
@@ -35,459 +35,107 @@
#include <string.h>
#include <glib/gi18n.h>
+#include <girepository.h>
#include "pluma-plugins-engine.h"
-#include "pluma-plugin-info-priv.h"
-#include "pluma-plugin.h"
#include "pluma-debug.h"
#include "pluma-app.h"
#include "pluma-prefs-manager.h"
-#include "pluma-plugin-loader.h"
-#include "pluma-object-module.h"
#include "pluma-dirs.h"
-#define PLUMA_PLUGINS_ENGINE_BASE_KEY "/apps/pluma/plugins"
-#define PLUMA_PLUGINS_ENGINE_KEY PLUMA_PLUGINS_ENGINE_BASE_KEY "/active-plugins"
-
-#define PLUGIN_EXT ".pluma-plugin"
-#define LOADER_EXT G_MODULE_SUFFIX
-
-typedef struct
-{
- PlumaPluginLoader *loader;
- PlumaObjectModule *module;
-} LoaderInfo;
-
-/* Signals */
-enum
-{
- ACTIVATE_PLUGIN,
- DEACTIVATE_PLUGIN,
- LAST_SIGNAL
-};
-
-static guint signals[LAST_SIGNAL] = { 0 };
-
-G_DEFINE_TYPE(PlumaPluginsEngine, pluma_plugins_engine, G_TYPE_OBJECT)
+G_DEFINE_TYPE (PlumaPluginsEngine, pluma_plugins_engine, PEAS_TYPE_ENGINE)
struct _PlumaPluginsEnginePrivate
{
- GList *plugin_list;
- GHashTable *loaders;
-
- gboolean activate_from_prefs;
+ GSettings *plugin_settings;
};
PlumaPluginsEngine *default_engine = NULL;
-static void pluma_plugins_engine_activate_plugin_real (PlumaPluginsEngine *engine,
- PlumaPluginInfo *info);
-static void pluma_plugins_engine_deactivate_plugin_real (PlumaPluginsEngine *engine,
- PlumaPluginInfo *info);
-
-typedef gboolean (*LoadDirCallback)(PlumaPluginsEngine *engine, const gchar *filename, gpointer userdata);
-
-static gboolean
-load_dir_real (PlumaPluginsEngine *engine,
- const gchar *dir,
- const gchar *suffix,
- LoadDirCallback callback,
- gpointer userdata)
+static void
+pluma_plugins_engine_init (PlumaPluginsEngine *engine)
{
+ gchar *private_path;
GError *error = NULL;
- GDir *d;
- const gchar *dirent;
- gboolean ret = TRUE;
-
- g_return_val_if_fail (dir != NULL, TRUE);
-
- pluma_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;
-}
+ pluma_debug (DEBUG_PLUGINS);
-static gboolean
-load_plugin_info (PlumaPluginsEngine *engine,
- const gchar *filename,
- gpointer userdata)
-{
- PlumaPluginInfo *info;
+ engine->priv = G_TYPE_INSTANCE_GET_PRIVATE (engine,
+ PLUMA_TYPE_PLUGINS_ENGINE,
+ PlumaPluginsEnginePrivate);
- info = _pluma_plugin_info_new (filename);
+ engine->priv->plugin_settings = g_settings_new (PLUMA_SCHEMA);
- if (info == NULL)
- return TRUE;
+ peas_engine_enable_loader (PEAS_ENGINE (engine), "python");
- /* If a plugin with this name has already been loaded
- * drop this one (user plugins override system plugins) */
- if (pluma_plugins_engine_get_plugin_info (engine, pluma_plugin_info_get_module_name (info)) != NULL)
+ /* This should be moved to libpeas */
+ if (!g_irepository_require (g_irepository_get_default (),
+ "Peas", "1.0", 0, &error))
{
- pluma_debug_message (DEBUG_PLUGINS, "Two or more plugins named '%s'. "
- "Only the first will be considered.\n",
- pluma_plugin_info_get_module_name (info));
-
- _pluma_plugin_info_unref (info);
-
- return TRUE;
+ g_warning ("Could not load Peas repository: %s", error->message);
+ g_error_free (error);
+ error = NULL;
}
- engine->priv->plugin_list = g_list_prepend (engine->priv->plugin_list, info);
-
- pluma_debug_message (DEBUG_PLUGINS, "Plugin %s loaded", info->name);
- return TRUE;
-}
-
-static void
-load_all_plugins (PlumaPluginsEngine *engine)
-{
- gchar *plugin_dir;
- const gchar *pdirs_env = NULL;
-
- /* load user plugins */
- plugin_dir = pluma_dirs_get_user_plugins_dir ();
- if (g_file_test (plugin_dir, G_FILE_TEST_IS_DIR))
+ if (!g_irepository_require (g_irepository_get_default (),
+ "PeasGtk", "1.0", 0, &error))
{
- load_dir_real (engine,
- plugin_dir,
- PLUGIN_EXT,
- load_plugin_info,
- NULL);
-
+ g_warning ("Could not load PeasGtk repository: %s", error->message);
+ g_error_free (error);
+ error = NULL;
}
- g_free (plugin_dir);
-
- /* load system plugins */
- pdirs_env = g_getenv ("PLUMA_PLUGINS_PATH");
-
- pluma_debug_message (DEBUG_PLUGINS, "PLUMA_PLUGINS_PATH=%s", pdirs_env);
-
- if (pdirs_env != NULL)
- {
- gchar **pdirs;
- gint i;
- pdirs = g_strsplit (pdirs_env, G_SEARCHPATH_SEPARATOR_S, 0);
+ private_path = g_build_filename (LIBDIR, "girepository-1.0", NULL);
- 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
+ if (!g_irepository_require_private (g_irepository_get_default (),
+ private_path, "Pluma", "1.0", 0, &error))
{
- plugin_dir = pluma_dirs_get_pluma_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 (PlumaPluginsEngine *engine,
- const gchar *loader_id,
- PlumaObjectModule *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);
-}
-
-static void
-pluma_plugins_engine_init (PlumaPluginsEngine *engine)
-{
- pluma_debug (DEBUG_PLUGINS);
-
- if (!g_module_supported ())
- {
- g_warning ("pluma is not able to initialize the plugins engine.");
- return;
+ g_warning ("Could not load Pluma repository: %s", error->message);
+ g_error_free (error);
+ error = NULL;
}
- engine->priv = G_TYPE_INSTANCE_GET_PRIVATE (engine,
- PLUMA_TYPE_PLUGINS_ENGINE,
- PlumaPluginsEnginePrivate);
-
- load_all_plugins (engine);
+ g_free (private_path);
- /* make sure that the first reactivation will read active plugins
- from the prefs */
- engine->priv->activate_from_prefs = TRUE;
+ peas_engine_add_search_path (PEAS_ENGINE (engine),
+ pluma_dirs_get_user_plugins_dir (),
+ pluma_dirs_get_user_plugins_dir ());
- /* mapping from loadername -> loader object */
- engine->priv->loaders = g_hash_table_new_full (hash_lowercase,
- equal_lowercase,
- (GDestroyNotify)g_free,
- (GDestroyNotify)loader_destroy);
-}
+ peas_engine_add_search_path (PEAS_ENGINE (engine),
+ pluma_dirs_get_pluma_plugins_dir (),
+ pluma_dirs_get_pluma_plugins_data_dir ());
-static void
-loader_garbage_collect (const char *id, LoaderInfo *info)
-{
- if (info->loader)
- pluma_plugin_loader_garbage_collect (info->loader);
-}
-
-void
-pluma_plugins_engine_garbage_collect (PlumaPluginsEngine *engine)
-{
- g_hash_table_foreach (engine->priv->loaders,
- (GHFunc) loader_garbage_collect,
- NULL);
+ g_settings_bind (engine->priv->plugin_settings,
+ GPM_ACTIVE_PLUGINS,
+ engine,
+ "loaded-plugins",
+ G_SETTINGS_BIND_DEFAULT);
}
static void
-pluma_plugins_engine_finalize (GObject *object)
+pluma_plugins_engine_dispose (GObject *object)
{
PlumaPluginsEngine *engine = PLUMA_PLUGINS_ENGINE (object);
- GList *item;
-
- pluma_debug (DEBUG_PLUGINS);
-
- /* Firs deactivate all plugins */
- for (item = engine->priv->plugin_list; item; item = item->next)
- {
- PlumaPluginInfo *info = PLUMA_PLUGIN_INFO (item->data);
-
- if (pluma_plugin_info_is_active (info))
- pluma_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)
+ if (engine->priv->plugin_settings != NULL)
{
- PlumaPluginInfo *info = PLUMA_PLUGIN_INFO (item->data);
-
- _pluma_plugin_info_unref (info);
+ g_object_unref (engine->priv->plugin_settings);
+ engine->priv->plugin_settings = NULL;
}
- g_list_free (engine->priv->plugin_list);
-
- G_OBJECT_CLASS (pluma_plugins_engine_parent_class)->finalize (object);
+ G_OBJECT_CLASS (pluma_plugins_engine_parent_class)->dispose (object);
}
static void
pluma_plugins_engine_class_init (PlumaPluginsEngineClass *klass)
{
- GType the_type = G_TYPE_FROM_CLASS (klass);
GObjectClass *object_class = G_OBJECT_CLASS (klass);
- object_class->finalize = pluma_plugins_engine_finalize;
- klass->activate_plugin = pluma_plugins_engine_activate_plugin_real;
- klass->deactivate_plugin = pluma_plugins_engine_deactivate_plugin_real;
-
- signals[ACTIVATE_PLUGIN] =
- g_signal_new ("activate-plugin",
- the_type,
- G_SIGNAL_RUN_LAST,
- G_STRUCT_OFFSET (PlumaPluginsEngineClass, activate_plugin),
- NULL, NULL,
- g_cclosure_marshal_VOID__BOXED,
- G_TYPE_NONE,
- 1,
- PLUMA_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 (PlumaPluginsEngineClass, deactivate_plugin),
- NULL, NULL,
- g_cclosure_marshal_VOID__BOXED,
- G_TYPE_NONE,
- 1,
- PLUMA_TYPE_PLUGIN_INFO | G_SIGNAL_TYPE_STATIC_SCOPE);
+ object_class->dispose = pluma_plugins_engine_dispose;
g_type_class_add_private (klass, sizeof (PlumaPluginsEnginePrivate));
}
-static gboolean
-load_loader (PlumaPluginsEngine *engine,
- const gchar *filename,
- gpointer data)
-{
- PlumaObjectModule *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 = pluma_object_module_new (base,
- path,
- "register_pluma_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 = pluma_object_module_get_object_type (module);
- id = pluma_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 */
- PlumaPluginLoader *loader;
- loader = (PlumaPluginLoader *)pluma_object_module_new_object (info->module, NULL);
-
- if (loader == NULL || !PLUMA_IS_PLUGIN_LOADER (loader))
- {
- g_warning ("Loader object is not a valid PlumaPluginLoader instance");
-
- if (loader != NULL && G_IS_OBJECT (loader))
- g_object_unref (loader);
- }
- else
- {
- info->loader = loader;
- }
- }
-}
-
-static PlumaPluginLoader *
-get_plugin_loader (PlumaPluginsEngine *engine, PlumaPluginInfo *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 = pluma_dirs_get_pluma_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;
-}
-
PlumaPluginsEngine *
pluma_plugins_engine_get_default (void)
{
@@ -496,366 +144,8 @@ pluma_plugins_engine_get_default (void)
default_engine = PLUMA_PLUGINS_ENGINE (g_object_new (PLUMA_TYPE_PLUGINS_ENGINE, NULL));
g_object_add_weak_pointer (G_OBJECT (default_engine),
- (gpointer) &default_engine);
- return default_engine;
-}
-
-const GList *
-pluma_plugins_engine_get_plugin_list (PlumaPluginsEngine *engine)
-{
- pluma_debug (DEBUG_PLUGINS);
-
- return engine->priv->plugin_list;
-}
-
-static gint
-compare_plugin_info_and_name (PlumaPluginInfo *info,
- const gchar *module_name)
-{
- return strcmp (pluma_plugin_info_get_module_name (info), module_name);
-}
+ (gpointer) &default_engine);
-PlumaPluginInfo *
-pluma_plugins_engine_get_plugin_info (PlumaPluginsEngine *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 : (PlumaPluginInfo *) l->data;
-}
-
-static void
-save_active_plugin_list (PlumaPluginsEngine *engine)
-{
- GSList *active_plugins = NULL;
- GList *l;
-
- for (l = engine->priv->plugin_list; l != NULL; l = l->next)
- {
- PlumaPluginInfo *info = (PlumaPluginInfo *) l->data;
-
- if (pluma_plugin_info_is_active (info))
- {
- active_plugins = g_slist_prepend (active_plugins,
- (gpointer)pluma_plugin_info_get_module_name (info));
- }
- }
-
- pluma_prefs_manager_set_active_plugins (active_plugins);
-
- g_slist_free (active_plugins);
-}
-
-static gboolean
-load_plugin (PlumaPluginsEngine *engine,
- PlumaPluginInfo *info)
-{
- PlumaPluginLoader *loader;
- gchar *path;
-
- if (pluma_plugin_info_is_active (info))
- return TRUE;
-
- if (!pluma_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 = pluma_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
-pluma_plugins_engine_activate_plugin_real (PlumaPluginsEngine *engine,
- PlumaPluginInfo *info)
-{
- const GList *wins;
-
- if (!load_plugin (engine, info))
- return;
-
- for (wins = pluma_app_get_windows (pluma_app_get_default ());
- wins != NULL;
- wins = wins->next)
- {
- pluma_plugin_activate (info->plugin, PLUMA_WINDOW (wins->data));
- }
-}
-
-gboolean
-pluma_plugins_engine_activate_plugin (PlumaPluginsEngine *engine,
- PlumaPluginInfo *info)
-{
- pluma_debug (DEBUG_PLUGINS);
-
- g_return_val_if_fail (info != NULL, FALSE);
-
- if (!pluma_plugin_info_is_available (info))
- return FALSE;
-
- if (pluma_plugin_info_is_active (info))
- return TRUE;
-
- g_signal_emit (engine, signals[ACTIVATE_PLUGIN], 0, info);
-
- if (pluma_plugin_info_is_active (info))
- save_active_plugin_list (engine);
-
- return pluma_plugin_info_is_active (info);
-}
-
-static void
-call_plugin_deactivate (PlumaPlugin *plugin,
- PlumaWindow *window)
-{
- pluma_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 (pluma_window_get_ui_manager (window));
-}
-
-static void
-pluma_plugins_engine_deactivate_plugin_real (PlumaPluginsEngine *engine,
- PlumaPluginInfo *info)
-{
- const GList *wins;
- PlumaPluginLoader *loader;
-
- if (!pluma_plugin_info_is_active (info) ||
- !pluma_plugin_info_is_available (info))
- return;
-
- for (wins = pluma_app_get_windows (pluma_app_get_default ());
- wins != NULL;
- wins = wins->next)
- {
- call_plugin_deactivate (info->plugin, PLUMA_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);
-
- pluma_plugin_loader_garbage_collect (loader);
- pluma_plugin_loader_unload (loader, info);
-
- info->plugin = NULL;
-}
-
-gboolean
-pluma_plugins_engine_deactivate_plugin (PlumaPluginsEngine *engine,
- PlumaPluginInfo *info)
-{
- pluma_debug (DEBUG_PLUGINS);
-
- g_return_val_if_fail (info != NULL, FALSE);
-
- if (!pluma_plugin_info_is_active (info))
- return TRUE;
-
- g_signal_emit (engine, signals[DEACTIVATE_PLUGIN], 0, info);
- if (!pluma_plugin_info_is_active (info))
- save_active_plugin_list (engine);
-
- return !pluma_plugin_info_is_active (info);
-}
-
-void
-pluma_plugins_engine_activate_plugins (PlumaPluginsEngine *engine,
- PlumaWindow *window)
-{
- GSList *active_plugins = NULL;
- GList *pl;
-
- pluma_debug (DEBUG_PLUGINS);
-
- g_return_if_fail (PLUMA_IS_PLUGINS_ENGINE (engine));
- g_return_if_fail (PLUMA_IS_WINDOW (window));
-
- /* the first time, we get the 'active' plugins from GSettings */
- if (engine->priv->activate_from_prefs)
- {
- active_plugins = pluma_prefs_manager_get_active_plugins ();
- }
-
- for (pl = engine->priv->plugin_list; pl; pl = pl->next)
- {
- PlumaPluginInfo *info = (PlumaPluginInfo*)pl->data;
-
- if (engine->priv->activate_from_prefs &&
- g_slist_find_custom (active_plugins,
- pluma_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 &&
- !pluma_plugin_info_is_active (info))
- continue;
-
- if (load_plugin (engine, info))
- pluma_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;
- }
-
- pluma_debug_message (DEBUG_PLUGINS, "End");
-
- /* also call update_ui after activation */
- pluma_plugins_engine_update_plugins_ui (engine, window);
-}
-
-void
-pluma_plugins_engine_deactivate_plugins (PlumaPluginsEngine *engine,
- PlumaWindow *window)
-{
- GList *pl;
-
- pluma_debug (DEBUG_PLUGINS);
-
- g_return_if_fail (PLUMA_IS_PLUGINS_ENGINE (engine));
- g_return_if_fail (PLUMA_IS_WINDOW (window));
-
- for (pl = engine->priv->plugin_list; pl; pl = pl->next)
- {
- PlumaPluginInfo *info = (PlumaPluginInfo*)pl->data;
-
- /* check if the plugin is actually active */
- if (!pluma_plugin_info_is_active (info))
- continue;
-
- /* call deactivate for the plugin for this window */
- pluma_plugin_deactivate (info->plugin, window);
- }
-
- pluma_debug_message (DEBUG_PLUGINS, "End");
-}
-
-void
-pluma_plugins_engine_update_plugins_ui (PlumaPluginsEngine *engine,
- PlumaWindow *window)
-{
- GList *pl;
-
- pluma_debug (DEBUG_PLUGINS);
-
- g_return_if_fail (PLUMA_IS_PLUGINS_ENGINE (engine));
- g_return_if_fail (PLUMA_IS_WINDOW (window));
-
- /* call update_ui for all active plugins */
- for (pl = engine->priv->plugin_list; pl; pl = pl->next)
- {
- PlumaPluginInfo *info = (PlumaPluginInfo*)pl->data;
-
- if (!pluma_plugin_info_is_active (info))
- continue;
-
- pluma_debug_message (DEBUG_PLUGINS, "Updating UI of %s", info->name);
- pluma_plugin_update_ui (info->plugin, window);
- }
-}
-
-void
-pluma_plugins_engine_configure_plugin (PlumaPluginsEngine *engine,
- PlumaPluginInfo *info,
- GtkWindow *parent)
-{
- GtkWidget *conf_dlg;
-
- GtkWindowGroup *wg;
-
- pluma_debug (DEBUG_PLUGINS);
-
- g_return_if_fail (info != NULL);
-
- conf_dlg = pluma_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);
-}
-
-void
-pluma_plugins_engine_active_plugins_changed (PlumaPluginsEngine *engine)
-{
- gboolean to_activate;
- GSList *active_plugins;
- GList *pl;
-
- pluma_debug (DEBUG_PLUGINS);
-
- active_plugins = pluma_prefs_manager_get_active_plugins ();
-
- for (pl = engine->priv->plugin_list; pl; pl = pl->next)
- {
- PlumaPluginInfo *info = (PlumaPluginInfo*)pl->data;
-
- if (!pluma_plugin_info_is_available (info))
- continue;
-
- to_activate = (g_slist_find_custom (active_plugins,
- pluma_plugin_info_get_module_name (info),
- (GCompareFunc)strcmp) != NULL);
-
- if (!pluma_plugin_info_is_active (info) && to_activate)
- g_signal_emit (engine, signals[ACTIVATE_PLUGIN], 0, info);
- else if (pluma_plugin_info_is_active (info) && !to_activate)
- g_signal_emit (engine, signals[DEACTIVATE_PLUGIN], 0, info);
- }
-
- g_slist_foreach (active_plugins, (GFunc) g_free, NULL);
- g_slist_free (active_plugins);
+ return default_engine;
}
-void
-pluma_plugins_engine_rescan_plugins (PlumaPluginsEngine *engine)
-{
- pluma_debug (DEBUG_PLUGINS);
-
- load_all_plugins (engine);
-}
diff --git a/pluma/pluma-plugins-engine.h b/pluma/pluma-plugins-engine.h
index 6a58f213..2cf20004 100644
--- a/pluma/pluma-plugins-engine.h
+++ b/pluma/pluma-plugins-engine.h
@@ -32,9 +32,7 @@
#define __PLUMA_PLUGINS_ENGINE_H__
#include <glib.h>
-#include "pluma-window.h"
-#include "pluma-plugin-info.h"
-#include "pluma-plugin.h"
+#include <libpeas/peas-engine.h>
G_BEGIN_DECLS
@@ -50,7 +48,7 @@ typedef struct _PlumaPluginsEnginePrivate PlumaPluginsEnginePrivate;
struct _PlumaPluginsEngine
{
- GObject parent;
+ PeasEngine parent;
PlumaPluginsEnginePrivate *priv;
};
@@ -58,50 +56,13 @@ typedef struct _PlumaPluginsEngineClass PlumaPluginsEngineClass;
struct _PlumaPluginsEngineClass
{
- GObjectClass parent_class;
-
- void (* activate_plugin) (PlumaPluginsEngine *engine,
- PlumaPluginInfo *info);
-
- void (* deactivate_plugin) (PlumaPluginsEngine *engine,
- PlumaPluginInfo *info);
+ PeasEngineClass parent_class;
};
GType pluma_plugins_engine_get_type (void) G_GNUC_CONST;
PlumaPluginsEngine *pluma_plugins_engine_get_default (void);
-void pluma_plugins_engine_garbage_collect (PlumaPluginsEngine *engine);
-
-const GList *pluma_plugins_engine_get_plugin_list (PlumaPluginsEngine *engine);
-
-PlumaPluginInfo *pluma_plugins_engine_get_plugin_info (PlumaPluginsEngine *engine,
- const gchar *name);
-
-/* plugin load and unloading (overall, for all windows) */
-gboolean pluma_plugins_engine_activate_plugin (PlumaPluginsEngine *engine,
- PlumaPluginInfo *info);
-gboolean pluma_plugins_engine_deactivate_plugin (PlumaPluginsEngine *engine,
- PlumaPluginInfo *info);
-
-void pluma_plugins_engine_configure_plugin (PlumaPluginsEngine *engine,
- PlumaPluginInfo *info,
- GtkWindow *parent);
-
-/* plugin activation/deactivation per window, private to PlumaWindow */
-void pluma_plugins_engine_activate_plugins (PlumaPluginsEngine *engine,
- PlumaWindow *window);
-void pluma_plugins_engine_deactivate_plugins (PlumaPluginsEngine *engine,
- PlumaWindow *window);
-void pluma_plugins_engine_update_plugins_ui (PlumaPluginsEngine *engine,
- PlumaWindow *window);
-
-/* private for GSettings notification */
-void pluma_plugins_engine_active_plugins_changed
- (PlumaPluginsEngine *engine);
-
-void pluma_plugins_engine_rescan_plugins (PlumaPluginsEngine *engine);
-
G_END_DECLS
#endif /* __PLUMA_PLUGINS_ENGINE_H__ */
diff --git a/pluma/pluma-prefs-manager-app.c b/pluma/pluma-prefs-manager-app.c
index 34a666eb..76d3942e 100644
--- a/pluma/pluma-prefs-manager-app.c
+++ b/pluma/pluma-prefs-manager-app.c
@@ -112,10 +112,6 @@ static void pluma_prefs_manager_auto_save_changed (GSettings *settings,
gchar *key,
gpointer user_data);
-static void pluma_prefs_manager_active_plugins_changed (GSettings *settings,
- gchar *key,
- gpointer user_data);
-
static void pluma_prefs_manager_lockdown_changed (GSettings *settings,
gchar *key,
gpointer user_data);
@@ -713,11 +709,6 @@ pluma_prefs_manager_app_init (void)
G_CALLBACK (pluma_prefs_manager_auto_save_changed),
NULL);
- g_signal_connect (pluma_prefs_manager->settings,
- "changed::" GPM_ACTIVE_PLUGINS,
- G_CALLBACK (pluma_prefs_manager_active_plugins_changed),
- NULL);
-
g_signal_connect (pluma_prefs_manager->lockdown_settings,
"changed",
G_CALLBACK (pluma_prefs_manager_lockdown_changed),
@@ -1415,23 +1406,6 @@ pluma_prefs_manager_auto_save_changed (GSettings *settings,
}
static void
-pluma_prefs_manager_active_plugins_changed (GSettings *settings,
- gchar *key,
- gpointer user_data)
-{
- pluma_debug (DEBUG_PREFS);
-
- if (strcmp (key, GPM_ACTIVE_PLUGINS) == 0)
- {
- PlumaPluginsEngine *engine;
-
- engine = pluma_plugins_engine_get_default ();
-
- pluma_plugins_engine_active_plugins_changed (engine);
- }
-}
-
-static void
pluma_prefs_manager_lockdown_changed (GSettings *settings,
gchar *key,
gpointer user_data)
diff --git a/pluma/pluma-status-combo-box.c b/pluma/pluma-status-combo-box.c
index e446b371..8b8d0004 100644
--- a/pluma/pluma-status-combo-box.c
+++ b/pluma/pluma-status-combo-box.c
@@ -409,6 +409,12 @@ pluma_status_combo_box_remove_item (PlumaStatusComboBox *combo,
GTK_WIDGET (item));
}
+/**
+ * pluma_status_combo_box_get_items:
+ * @combo:
+ *
+ * Returns: (element-type Gtk.Widget) (transfer container):
+ */
GList *
pluma_status_combo_box_get_items (PlumaStatusComboBox *combo)
{
diff --git a/pluma/pluma-tab.c b/pluma/pluma-tab.c
index 02fc2582..79339a90 100644
--- a/pluma/pluma-tab.c
+++ b/pluma/pluma-tab.c
@@ -1619,7 +1619,7 @@ _pluma_tab_new_from_uri (const gchar *uri,
*
* Gets the #PlumaView inside @tab.
*
- * Returns: the #PlumaView inside @tab
+ * Returns: (transfer none): the #PlumaView inside @tab
*/
PlumaView *
pluma_tab_get_view (PlumaTab *tab)
@@ -1633,7 +1633,7 @@ pluma_tab_get_view (PlumaTab *tab)
*
* Gets the #PlumaDocument associated to @tab.
*
- * Returns: the #PlumaDocument associated to @tab
+ * Returns: (transfer none): the #PlumaDocument associated to @tab
*/
PlumaDocument *
pluma_tab_get_document (PlumaTab *tab)
@@ -1958,7 +1958,7 @@ _pluma_tab_get_icon (PlumaTab *tab)
*
* Gets the #PlumaTab associated with @doc.
*
- * Returns: the #PlumaTab associated with @doc
+ * Returns: (transfer none): the #PlumaTab associated with @doc
*/
PlumaTab *
pluma_tab_get_from_document (PlumaDocument *doc)
diff --git a/pluma/pluma-utils.c b/pluma/pluma-utils.c
index 868a5bd8..ff872e09 100644
--- a/pluma/pluma-utils.c
+++ b/pluma/pluma-utils.c
@@ -202,15 +202,13 @@ pluma_utils_menu_position_under_tree_view (GtkMenu *menu,
}
}
-/* FIXME: remove this with gtk 2.12, it has gdk_color_to_string */
-gchar *
-pluma_gdk_color_to_string (GdkColor color)
-{
- return g_strdup_printf ("#%04x%04x%04x",
- color.red,
- color.green,
- color.blue);
-}
+/**
+ * pluma_gtk_button_new_with_stock_icon:
+ * @label:
+ * @stock_id:
+ *
+ * Returns: (transfer full):
+ */
GtkWidget *
pluma_gtk_button_new_with_stock_icon (const gchar *label,
@@ -226,6 +224,15 @@ pluma_gtk_button_new_with_stock_icon (const gchar *label,
return button;
}
+/**
+ * pluma_dialog_add_button:
+ * @dialog:
+ * @text:
+ * @stock_id:
+ * @response_id:
+ *
+ * Returns: (transfer none):
+ */
GtkWidget *
pluma_dialog_add_button (GtkDialog *dialog,
const gchar *text,
@@ -1383,7 +1390,7 @@ pluma_utils_uri_for_display (const gchar *uri)
*
* Create a list of valid uri's from a uri-list drop.
*
- * Return value: a string array which will hold the uris or %NULL if there
+ * Return value: (transfer full): a string array which will hold the uris or %NULL if there
* were no valid uris. g_strfreev should be used when the
* string array is no longer used
*/
diff --git a/pluma/pluma-utils.h b/pluma/pluma-utils.h
index be54f786..e9dd0a5b 100644
--- a/pluma/pluma-utils.h
+++ b/pluma/pluma-utils.h
@@ -64,8 +64,6 @@ void pluma_utils_menu_position_under_tree_view
gboolean *push_in,
gpointer user_data);
-gchar *pluma_gdk_color_to_string (GdkColor color);
-
GtkWidget *pluma_gtk_button_new_with_stock_icon (const gchar *label,
const gchar *stock_id);
diff --git a/pluma/pluma-window-private.h b/pluma/pluma-window-private.h
index e575a59e..3c36a499 100644
--- a/pluma/pluma-window-private.h
+++ b/pluma/pluma-window-private.h
@@ -31,6 +31,8 @@
#ifndef __PLUMA_WINDOW_PRIVATE_H__
#define __PLUMA_WINDOW_PRIVATE_H__
+#include <libpeas/peas-extension-set.h>
+
#include "pluma/pluma-window.h"
#include "pluma-prefs-manager.h"
#include "pluma-message-bus.h"
@@ -51,8 +53,9 @@ struct _PlumaWindowPrivate
GtkWidget *tab_width_combo;
GtkWidget *language_combo;
-
- PlumaMessageBus *message_bus;
+
+ PlumaMessageBus *message_bus;
+ PeasExtensionSet *extensions;
/* Widgets for fullscreen mode */
GtkWidget *fullscreen_controls;
@@ -60,7 +63,7 @@ struct _PlumaWindowPrivate
gboolean fullscreen_animation_enter;
/* statusbar and context ids for statusbar messages */
- GtkWidget *statusbar;
+ GtkWidget *statusbar;
guint generic_message_cid;
guint tip_message_cid;
guint tab_width_id;
@@ -93,7 +96,7 @@ struct _PlumaWindowPrivate
gint num_tabs_with_error;
gint width;
- gint height;
+ gint height;
GdkWindowState window_state;
gint side_panel_size;
diff --git a/pluma/pluma-window.c b/pluma/pluma-window.c
index 2432aeaf..8bff1509 100644
--- a/pluma/pluma-window.c
+++ b/pluma/pluma-window.c
@@ -40,6 +40,8 @@
#include <gio/gio.h>
#include <gtk/gtk.h>
#include <gtksourceview/gtksource.h>
+#include <libpeas/peas-activatable.h>
+#include <libpeas/peas-extension-set.h>
#include "pluma-ui.h"
#include "pluma-window.h"
@@ -175,7 +177,7 @@ pluma_window_dispose (GObject *object)
/* First of all, force collection so that plugins
* really drop some of the references.
*/
- pluma_plugins_engine_garbage_collect (pluma_plugins_engine_get_default ());
+ peas_engine_garbage_collect (PEAS_ENGINE (pluma_plugins_engine_get_default ()));
/* save the panes position and make sure to deactivate plugins
* for this window, but only once */
@@ -183,8 +185,12 @@ pluma_window_dispose (GObject *object)
{
save_panes_state (window);
- pluma_plugins_engine_deactivate_plugins (pluma_plugins_engine_get_default (),
- window);
+ /* Note that unreffing the extensions will automatically remove
+ all extensions which in turn will deactivate the extension */
+ g_object_unref (window->priv->extensions);
+
+ peas_engine_garbage_collect (PEAS_ENGINE (pluma_plugins_engine_get_default ()));
+
window->priv->dispose_has_run = TRUE;
}
@@ -232,7 +238,7 @@ pluma_window_dispose (GObject *object)
/* Now that there have broken some reference loops,
* force collection again.
*/
- pluma_plugins_engine_garbage_collect (pluma_plugins_engine_get_default ());
+ peas_engine_garbage_collect (PEAS_ENGINE (pluma_plugins_engine_get_default ()));
G_OBJECT_CLASS (pluma_window_parent_class)->dispose (object);
}
@@ -322,7 +328,7 @@ static void
pluma_window_tab_removed (PlumaWindow *window,
PlumaTab *tab)
{
- pluma_plugins_engine_garbage_collect (pluma_plugins_engine_get_default ());
+ peas_engine_garbage_collect (PEAS_ENGINE (pluma_plugins_engine_get_default ()));
}
static void
@@ -824,8 +830,7 @@ set_sensitivity_according_to_tab (PlumaWindow *window,
update_next_prev_doc_sensitivity (window, tab);
- pluma_plugins_engine_update_plugins_ui (pluma_plugins_engine_get_default (),
- window);
+ peas_extension_set_call (window->priv->extensions, "update_state", window);
}
static void
@@ -2685,8 +2690,7 @@ sync_name (PlumaTab *tab,
g_free (escaped_name);
g_free (tip);
- pluma_plugins_engine_update_plugins_ui (pluma_plugins_engine_get_default (),
- window);
+ peas_extension_set_call (window->priv->extensions, "update_state", window);
}
static PlumaWindow *
@@ -3077,8 +3081,7 @@ selection_changed (PlumaDocument *doc,
editable &&
gtk_text_buffer_get_has_selection (GTK_TEXT_BUFFER (doc)));
- pluma_plugins_engine_update_plugins_ui (pluma_plugins_engine_get_default (),
- window);
+ peas_extension_set_call (window->priv->extensions, "update_state", window);
}
static void
@@ -3087,8 +3090,7 @@ sync_languages_menu (PlumaDocument *doc,
PlumaWindow *window)
{
update_languages_menu (window);
- pluma_plugins_engine_update_plugins_ui (pluma_plugins_engine_get_default (),
- window);
+ peas_extension_set_call (window->priv->extensions, "update_state", window);
}
static void
@@ -3100,8 +3102,7 @@ readonly_changed (PlumaDocument *doc,
sync_name (window->priv->active_tab, NULL, window);
- pluma_plugins_engine_update_plugins_ui (pluma_plugins_engine_get_default (),
- window);
+ peas_extension_set_call (window->priv->extensions, "update_state", window);
}
static void
@@ -3109,8 +3110,7 @@ editable_changed (PlumaView *view,
GParamSpec *arg1,
PlumaWindow *window)
{
- pluma_plugins_engine_update_plugins_ui (pluma_plugins_engine_get_default (),
- window);
+ peas_extension_set_call (window->priv->extensions, "update_state", window);
}
static void
@@ -3322,8 +3322,7 @@ notebook_tab_removed (PlumaNotebook *notebook,
if (window->priv->num_tabs == 0)
{
- pluma_plugins_engine_update_plugins_ui (pluma_plugins_engine_get_default (),
- window);
+ peas_extension_set_call (window->priv->extensions, "update_state", window);
}
update_window_state (window);
@@ -3812,6 +3811,30 @@ add_notebook (PlumaWindow *window,
}
static void
+on_extension_added (PeasExtensionSet *extensions,
+ PeasPluginInfo *info,
+ PeasExtension *exten,
+ PlumaWindow *window)
+{
+ peas_extension_call (exten, "activate", window);
+}
+
+static void
+on_extension_removed (PeasExtensionSet *extensions,
+ PeasPluginInfo *info,
+ PeasExtension *exten,
+ PlumaWindow *window)
+{
+ peas_extension_call (exten, "deactivate", 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 (window->priv->manager);
+}
+
+static void
pluma_window_init (PlumaWindow *window)
{
GtkWidget *main_box;
@@ -3936,8 +3959,19 @@ pluma_window_init (PlumaWindow *window)
pluma_debug_message (DEBUG_WINDOW, "Update plugins ui");
- pluma_plugins_engine_activate_plugins (pluma_plugins_engine_get_default (),
- window);
+ window->priv->extensions = peas_extension_set_new (PEAS_ENGINE (pluma_plugins_engine_get_default ()),
+ PEAS_TYPE_ACTIVATABLE, "object", window, NULL);
+
+ peas_extension_set_call (window->priv->extensions, "activate");
+
+ g_signal_connect (window->priv->extensions,
+ "extension-added",
+ G_CALLBACK (on_extension_added),
+ window);
+ g_signal_connect (window->priv->extensions,
+ "extension-removed",
+ G_CALLBACK (on_extension_removed),
+ window);
/* set visibility of panes.
* This needs to be done after plugins activatation */
@@ -3954,7 +3988,7 @@ pluma_window_init (PlumaWindow *window)
*
* Gets the active #PlumaView.
*
- * Returns: the active #PlumaView
+ * Returns: (transfer none): the active #PlumaView
*/
PlumaView *
pluma_window_get_active_view (PlumaWindow *window)
@@ -3977,7 +4011,7 @@ pluma_window_get_active_view (PlumaWindow *window)
*
* Gets the active #PlumaDocument.
*
- * Returns: the active #PlumaDocument
+ * Returns: (transfer none): the active #PlumaDocument
*/
PlumaDocument *
pluma_window_get_active_document (PlumaWindow *window)
@@ -4009,7 +4043,7 @@ _pluma_window_get_notebook (PlumaWindow *window)
* Creates a new #PlumaTab and adds the new tab to the #PlumaNotebook.
* In case @jump_to is %TRUE the #PlumaNotebook switches to that new #PlumaTab.
*
- * Returns: a new #PlumaTab
+ * Returns: (transfer none): a new #PlumaTab
*/
PlumaTab *
pluma_window_create_tab (PlumaWindow *window,
@@ -4049,7 +4083,7 @@ pluma_window_create_tab (PlumaWindow *window,
* Whether @create is %TRUE, creates a new empty document if location does
* not refer to an existing file
*
- * Returns: a new #PlumaTab
+ * Returns: (transfer none): a new #PlumaTab
*/
PlumaTab *
pluma_window_create_tab_from_uri (PlumaWindow *window,
@@ -4093,7 +4127,7 @@ pluma_window_create_tab_from_uri (PlumaWindow *window,
*
* Gets the active #PlumaTab in the @window.
*
- * Returns: the active #PlumaTab in the @window.
+ * Returns: (transfer none): the active #PlumaTab in the @window.
*/
PlumaTab *
pluma_window_get_active_tab (PlumaWindow *window)
@@ -4303,7 +4337,7 @@ pluma_window_set_active_tab (PlumaWindow *window,
*
* Gets the #GtkWindowGroup in which @window resides.
*
- * Returns: the #GtkWindowGroup
+ * Returns: (transfer none): the #GtkWindowGroup
*/
GtkWindowGroup *
pluma_window_get_group (PlumaWindow *window)
@@ -4327,7 +4361,7 @@ _pluma_window_is_removing_tabs (PlumaWindow *window)
*
* Gets the #GtkUIManager associated with the @window.
*
- * Returns: the #GtkUIManager of the @window.
+ * Returns: (transfer none): the #GtkUIManager of the @window.
*/
GtkUIManager *
pluma_window_get_ui_manager (PlumaWindow *window)
@@ -4343,7 +4377,7 @@ pluma_window_get_ui_manager (PlumaWindow *window)
*
* Gets the side #PlumaPanel of the @window.
*
- * Returns: the side #PlumaPanel.
+ * Returns: (transfer none): the side #PlumaPanel.
*/
PlumaPanel *
pluma_window_get_side_panel (PlumaWindow *window)
@@ -4359,7 +4393,7 @@ pluma_window_get_side_panel (PlumaWindow *window)
*
* Gets the bottom #PlumaPanel of the @window.
*
- * Returns: the bottom #PlumaPanel.
+ * Returns: (transfer none): the bottom #PlumaPanel.
*/
PlumaPanel *
pluma_window_get_bottom_panel (PlumaWindow *window)
@@ -4375,7 +4409,7 @@ pluma_window_get_bottom_panel (PlumaWindow *window)
*
* Gets the #PlumaStatusbar of the @window.
*
- * Returns: the #PlumaStatusbar of the @window.
+ * Returns: (transfer none): the #PlumaStatusbar of the @window.
*/
GtkWidget *
pluma_window_get_statusbar (PlumaWindow *window)
@@ -4587,7 +4621,7 @@ _pluma_window_is_fullscreen (PlumaWindow *window)
*
* Gets the #PlumaTab that matches with the given @location.
*
- * Returns: the #PlumaTab that matches with the given @location.
+ * Returns: (transfer none): the #PlumaTab that matches with the given @location.
*/
PlumaTab *
pluma_window_get_tab_from_location (PlumaWindow *window,
@@ -4648,31 +4682,3 @@ pluma_window_get_message_bus (PlumaWindow *window)
return window->priv->message_bus;
}
-
-/**
- * pluma_window_get_tab_from_uri:
- * @window: a #PlumaWindow
- * @uri: the uri to get the #PlumaTab
- *
- * Gets the #PlumaTab that matches @uri.
- *
- * Returns: the #PlumaTab associated with @uri.
- *
- * Deprecated: 2.24: Use pluma_window_get_tab_from_location() instead.
- */
-PlumaTab *
-pluma_window_get_tab_from_uri (PlumaWindow *window,
- const gchar *uri)
-{
- GFile *f;
- PlumaTab *tab;
-
- g_return_val_if_fail (PLUMA_IS_WINDOW (window), NULL);
- g_return_val_if_fail (uri != NULL, NULL);
-
- f = g_file_new_for_uri (uri);
- tab = pluma_window_get_tab_from_location (window, f);
- g_object_unref (f);
-
- return tab;
-}
diff --git a/pluma/pluma-window.h b/pluma/pluma-window.h
index 8baf2cb2..b90baa32 100644
--- a/pluma/pluma-window.h
+++ b/pluma/pluma-window.h
@@ -154,9 +154,6 @@ PlumaWindowState pluma_window_get_state (PlumaWindow *window);
PlumaTab *pluma_window_get_tab_from_location (PlumaWindow *window,
GFile *location);
-PlumaTab *pluma_window_get_tab_from_uri (PlumaWindow *window,
- const gchar *uri);
-
/* Message bus */
PlumaMessageBus *pluma_window_get_message_bus (PlumaWindow *window);
diff --git a/pluma/pluma.c b/pluma/pluma.c
index 4fb5a752..6f12a051 100644
--- a/pluma/pluma.c
+++ b/pluma/pluma.c
@@ -42,6 +42,10 @@
#include <gtk/gtk.h>
#include <gdk/gdkx.h>
+#ifdef HAVE_INTROSPECTION
+#include <girepository.h>
+#endif
+
#include "pluma-app.h"
#include "pluma-commands.h"
#include "pluma-debug.h"
@@ -519,10 +523,12 @@ main (int argc, char *argv[])
/* Setup command line options */
context = g_option_context_new (_("- Edit text files"));
g_option_context_add_main_entries (context, options, GETTEXT_PACKAGE);
- g_option_context_add_group (context, gtk_get_option_group (FALSE));
+ g_option_context_add_group (context, gtk_get_option_group (TRUE));
g_option_context_add_group (context, egg_sm_client_get_option_group ());
- gtk_init (&argc, &argv);
+#ifdef HAVE_INTROSPECTION
+ g_option_context_add_group (context, g_irepository_get_option_group ());
+#endif
if (!g_option_context_parse (context, &argc, &argv, &error))
{
diff --git a/po/POTFILES.in b/po/POTFILES.in
index 1dbbcf4a..906e0515 100644
--- a/po/POTFILES.in
+++ b/po/POTFILES.in
@@ -29,7 +29,6 @@ pluma/pluma-help.c
pluma/pluma-io-error-message-area.c
pluma/pluma-notebook.c
pluma/pluma-panel.c
-pluma/pluma-plugin-manager.c
pluma/pluma-plugins-engine.c
pluma/pluma-prefs-manager.c
pluma/pluma-print-job.c
@@ -45,21 +44,21 @@ pluma/pluma-ui.xml
pluma/pluma-utils.c
pluma/pluma-view.c
pluma/pluma-window.c
-plugins/changecase/changecase.pluma-plugin.desktop.in
+plugins/changecase/changecase.plugin.desktop.in
plugins/changecase/pluma-changecase-plugin.c
-plugins/docinfo/docinfo.pluma-plugin.desktop.in
+plugins/docinfo/docinfo.plugin.desktop.in
[type: gettext/glade]plugins/docinfo/docinfo.ui
plugins/docinfo/pluma-docinfo-plugin.c
-plugins/filebrowser/filebrowser.pluma-plugin.desktop.in
+plugins/filebrowser/filebrowser.plugin.desktop.in
[type: gettext/gsettings]plugins/filebrowser/org.mate.pluma.plugins.filebrowser.gschema.xml.in
plugins/filebrowser/pluma-file-bookmarks-store.c
plugins/filebrowser/pluma-file-browser-plugin.c
plugins/filebrowser/pluma-file-browser-store.c
plugins/filebrowser/pluma-file-browser-view.c
plugins/filebrowser/pluma-file-browser-widget.c
-plugins/modelines/modelines.pluma-plugin.desktop.in
+plugins/modelines/modelines.plugin.desktop.in
plugins/sort/pluma-sort-plugin.c
-plugins/sort/sort.pluma-plugin.desktop.in
+plugins/sort/sort.plugin.desktop.in
[type: gettext/glade]plugins/sort/sort.ui
[type: gettext/gsettings]plugins/spell/org.mate.pluma.plugins.spell.gschema.xml.in
plugins/spell/pluma-automatic-spell-checker.c
@@ -71,18 +70,18 @@ plugins/spell/pluma-spell-plugin.c
[type: gettext/glade]plugins/spell/languages-dialog.ui
[type: gettext/glade]plugins/spell/spell-checker.ui
[type: gettext/glade]plugins/spell/pluma-spell-setup-dialog.ui
-plugins/spell/spell.pluma-plugin.desktop.in
+plugins/spell/spell.plugin.desktop.in
plugins/taglist/pluma-taglist-plugin.c
plugins/taglist/pluma-taglist-plugin-panel.c
plugins/taglist/pluma-taglist-plugin-parser.c
plugins/taglist/HTML.tags.xml.in
plugins/taglist/Latex.tags.xml.in
-plugins/taglist/taglist.pluma-plugin.desktop.in
+plugins/taglist/taglist.plugin.desktop.in
plugins/taglist/XSLT.tags.xml.in
plugins/taglist/XUL.tags.xml.in
[type: gettext/gsettings]plugins/time/org.mate.pluma.plugins.time.gschema.xml.in
plugins/time/pluma-time-plugin.c
-plugins/time/time.pluma-plugin.desktop.in
-plugins/trailsave/trailsave.pluma-plugin.desktop.in
+plugins/time/time.plugin.desktop.in
+plugins/trailsave/trailsave.plugin.desktop.in
[type: gettext/glade]plugins/time/pluma-time-dialog.ui
[type: gettext/glade]plugins/time/pluma-time-setup-dialog.ui
diff --git a/po/ca.po b/po/ca.po
index 697f50e5..7ae6890a 100644
--- a/po/ca.po
+++ b/po/ca.po
@@ -12,7 +12,7 @@ msgstr ""
"Project-Id-Version: MATE Desktop Environment\n"
"Report-Msgid-Bugs-To: \n"
"POT-Creation-Date: 2016-08-01 10:33+0300\n"
-"PO-Revision-Date: 2016-10-17 09:21+0000\n"
+"PO-Revision-Date: 2016-12-06 07:50+0000\n"
"Last-Translator: Robert Antoni Buj Gelonch <[email protected]>\n"
"Language-Team: Catalan (http://www.transifex.com/mate/MATE/language/ca/)\n"
"MIME-Version: 1.0\n"
@@ -3416,7 +3416,7 @@ msgstr "Àncora"
#. Deprecated since HTML 4.01, not supported in XHTML 1.0 Strict DTD.
#: ../plugins/taglist/HTML.tags.xml.in.h:12
msgid "Applet class file code (deprecated)"
-msgstr "Fitxer de codi d'una classe d'una miniaplicació (desaconsellat)"
+msgstr "Fitxer de codi d'una classe d'una miniaplicació (en desús)"
#: ../plugins/taglist/HTML.tags.xml.in.h:13
msgid "Associated information"
@@ -3433,17 +3433,17 @@ msgstr "Capçaleres relacionades amb l'eix"
#. Deprecated since HTML 4.01, not supported in XHTML 1.0 Strict DTD.
#: ../plugins/taglist/HTML.tags.xml.in.h:17
msgid "Background color (deprecated)"
-msgstr "Color de fons (desaconsellat)"
+msgstr "Color de fons (en desús)"
#. Deprecated since HTML 4.01, not supported in XHTML 1.0 Strict DTD.
#: ../plugins/taglist/HTML.tags.xml.in.h:19
msgid "Background texture tile (deprecated)"
-msgstr "Títol de la textura del fons (desaconsellat)"
+msgstr "Títol de la textura del fons (en desús)"
#. Deprecated since HTML 4.01, not supported in XHTML 1.0 Strict DTD.
#: ../plugins/taglist/HTML.tags.xml.in.h:21
msgid "Base font (deprecated)"
-msgstr "Lletra base (desaconsellat)"
+msgstr "Lletra base (en desús)"
#: ../plugins/taglist/HTML.tags.xml.in.h:22
msgid "Base URI"
@@ -3456,7 +3456,7 @@ msgstr "Negreta"
#. Deprecated since HTML 4.01, not supported in XHTML 1.0 Strict DTD.
#: ../plugins/taglist/HTML.tags.xml.in.h:25
msgid "Border (deprecated)"
-msgstr "Vora (desaconsellat)"
+msgstr "Contorn (en desús)"
#: ../plugins/taglist/HTML.tags.xml.in.h:26
msgid "Cell rowspan"
@@ -3465,7 +3465,7 @@ msgstr "Abast en columnes de la cel·la"
#. Deprecated since HTML 4.01, not supported in XHTML 1.0 Strict DTD.
#: ../plugins/taglist/HTML.tags.xml.in.h:28
msgid "Center (deprecated)"
-msgstr "Centra (desaconsellat)"
+msgstr "Centra (en desús)"
#: ../plugins/taglist/HTML.tags.xml.in.h:29
msgid "Character encoding of linked resource"
@@ -3502,7 +3502,7 @@ msgstr "Codi del tipus de contingut"
#. Deprecated since HTML 4.01, not supported in XHTML 1.0 Strict DTD.
#: ../plugins/taglist/HTML.tags.xml.in.h:38
msgid "Color of selected links (deprecated)"
-msgstr "Color dels enllaços seleccionats (desaconsellat)"
+msgstr "Color dels enllaços seleccionats (en desús)"
#: ../plugins/taglist/HTML.tags.xml.in.h:39
msgid "Column span"
@@ -3524,7 +3524,7 @@ msgstr "Fragment codi d'ordinador"
#. since HTML 4.01, not supported in XHTML 1.0 Strict DTD.
#: ../plugins/taglist/HTML.tags.xml.in.h:45
msgid "Content type (deprecated)"
-msgstr "Tipus de continguts (desaconsellat)"
+msgstr "Tipus de continguts (en desús)"
#: ../plugins/taglist/HTML.tags.xml.in.h:46
msgid "Coordinates"
@@ -3569,7 +3569,7 @@ msgstr "Directivitat"
#. Deprecated since HTML 4.01, not supported in XHTML 1.0 Strict DTD.
#: ../plugins/taglist/HTML.tags.xml.in.h:60
msgid "Directionality (deprecated)"
-msgstr "Directivitat (desaconsellat)"
+msgstr "Directivitat (en desús)"
#: ../plugins/taglist/HTML.tags.xml.in.h:61
msgid "Disabled"
@@ -3619,7 +3619,7 @@ msgstr "Tipus de codificació"
#. Deprecated since HTML 4.01, not supported in XHTML 1.0 Strict DTD.
#: ../plugins/taglist/HTML.tags.xml.in.h:73
msgid "Font face (deprecated)"
-msgstr "Lletra face (desaconsellat)"
+msgstr "Lletra face (en desús)"
#: ../plugins/taglist/HTML.tags.xml.in.h:74
msgid "For label"
@@ -3748,7 +3748,7 @@ msgstr "Filet horitzontal"
#. Deprecated since HTML 4.01, not supported in XHTML 1.0 Strict DTD.
#: ../plugins/taglist/HTML.tags.xml.in.h:106
msgid "Horizontal space (deprecated)"
-msgstr "Espai horitzontal (desaconsellat)"
+msgstr "Espai horitzontal (en desús)"
#: ../plugins/taglist/HTML.tags.xml.in.h:107
msgid "HREF URI"
@@ -3801,7 +3801,7 @@ msgstr "Text itàlic"
#. Deprecated since HTML 4.01, not supported in XHTML 1.0 Strict DTD.
#: ../plugins/taglist/HTML.tags.xml.in.h:120
msgid "Java applet (deprecated)"
-msgstr "Miniaplicació Java (desaconsellat)"
+msgstr "Miniaplicació Java (en desús)"
#: ../plugins/taglist/HTML.tags.xml.in.h:121
msgid "Label"
@@ -3818,7 +3818,7 @@ msgstr "Estil de text gran"
#. Deprecated since HTML 4.01, not supported in XHTML 1.0 Strict DTD.
#: ../plugins/taglist/HTML.tags.xml.in.h:125
msgid "Link color (deprecated)"
-msgstr "Color de l'enllaç (desaconsellat)"
+msgstr "Color de l'enllaç (en desús)"
#: ../plugins/taglist/HTML.tags.xml.in.h:126
msgid "List item"
@@ -3871,7 +3871,7 @@ msgstr "Enllaç independent del medi"
#. Deprecated since HTML 4.01, not supported in XHTML 1.0 Strict DTD.
#: ../plugins/taglist/HTML.tags.xml.in.h:142
msgid "Menu list (deprecated)"
-msgstr "Llista de menú (desaconsellat)"
+msgstr "Llista de menú (en desús)"
#: ../plugins/taglist/HTML.tags.xml.in.h:143
msgid "Multi-line text field"
@@ -3904,7 +3904,7 @@ msgstr "Sense script"
#. Deprecated since HTML 4.01, not supported in XHTML 1.0 Strict DTD.
#: ../plugins/taglist/HTML.tags.xml.in.h:151
msgid "No shade (deprecated)"
-msgstr "Sense ombra (desaconsellat)"
+msgstr "Sense ombra (en desús)"
#: ../plugins/taglist/HTML.tags.xml.in.h:152
msgid "No URI"
@@ -3913,12 +3913,12 @@ msgstr "Sense URI"
#. Deprecated since HTML 4.01, not supported in XHTML 1.0 Strict DTD.
#: ../plugins/taglist/HTML.tags.xml.in.h:154
msgid "No word wrap (deprecated)"
-msgstr "Sense ajustament de paraules (desaconsellat)"
+msgstr "Sense ajustament de paraules (en desús)"
#. Deprecated since HTML 4.01, not supported in XHTML 1.0 Strict DTD.
#: ../plugins/taglist/HTML.tags.xml.in.h:156
msgid "Object applet file (deprecated)"
-msgstr "Objecte fitxer de miniaplicació (desaconsellat)"
+msgstr "Objecte fitxer de miniaplicació (en desús)"
#: ../plugins/taglist/HTML.tags.xml.in.h:157
msgid "Object data reference"
@@ -4043,7 +4043,7 @@ msgstr "Text i contrasenya de només lectura"
#. Deprecated since HTML 4.01, not supported in XHTML 1.0 Strict DTD.
#: ../plugins/taglist/HTML.tags.xml.in.h:188
msgid "Reduced spacing (deprecated)"
-msgstr "Espai reduït (desaconsellat)"
+msgstr "Espai reduït (en desús)"
#: ../plugins/taglist/HTML.tags.xml.in.h:189
msgid "Reverse link"
@@ -4101,7 +4101,7 @@ msgstr "Citació curta en línia"
#. Deprecated since HTML 4.01, not supported in XHTML 1.0 Strict DTD.
#: ../plugins/taglist/HTML.tags.xml.in.h:204
msgid "Size (deprecated)"
-msgstr "Mida (desaconsellat)"
+msgstr "Mida (en desús)"
#: ../plugins/taglist/HTML.tags.xml.in.h:205
msgid "Small text style"
@@ -4134,17 +4134,17 @@ msgstr "Missatge d'espera mentre es carrega"
#. Deprecated since HTML 4.01, not supported in XHTML 1.0 Strict DTD.
#: ../plugins/taglist/HTML.tags.xml.in.h:213
msgid "Starting sequence number (deprecated)"
-msgstr "Nombre d'inici de la seqüència (desaconsellat)"
+msgstr "Nombre d'inici de la seqüència (en desús)"
#. Deprecated since HTML 4.01, not supported in XHTML 1.0 Strict DTD.
#: ../plugins/taglist/HTML.tags.xml.in.h:215
msgid "Strike-through text style (deprecated)"
-msgstr "Estil de text ratllat (desaconsellat)"
+msgstr "Estil de text ratllat (en desús)"
#. Deprecated since HTML 4.01, not supported in XHTML 1.0 Strict DTD.
#: ../plugins/taglist/HTML.tags.xml.in.h:217
msgid "Strike-through text (deprecated)"
-msgstr "Estil de text ratllat (desaconsellat)"
+msgstr "Estil de text ratllat (en desús)"
#: ../plugins/taglist/HTML.tags.xml.in.h:218
msgid "Strong emphasis"
@@ -4229,7 +4229,7 @@ msgstr "Estil de text teletip o monoespai"
#. Deprecated since HTML 4.01, not supported in XHTML 1.0 Strict DTD.
#: ../plugins/taglist/HTML.tags.xml.in.h:239
msgid "Text color (deprecated)"
-msgstr "Color del text (desaconsellat)"
+msgstr "Color del text (en desús)"
#: ../plugins/taglist/HTML.tags.xml.in.h:240
msgid "Text entered by user"
@@ -4270,12 +4270,12 @@ msgstr "Alineació vertical de les cel·les"
#. Deprecated since HTML 4.01, not supported in XHTML 1.0 Strict DTD.
#: ../plugins/taglist/HTML.tags.xml.in.h:250
msgid "Vertical space (deprecated)"
-msgstr "Espai vertical (desaconsellat)"
+msgstr "Espai vertical (en desús)"
#. Deprecated since HTML 4.01, not supported in XHTML 1.0 Strict DTD.
#: ../plugins/taglist/HTML.tags.xml.in.h:252
msgid "Visited link color (deprecated)"
-msgstr "Color dels enllaços visitats (desaconsellat)"
+msgstr "Color dels enllaços visitats (en desús)"
#: ../plugins/taglist/HTML.tags.xml.in.h:253
msgid "Width"
@@ -4311,11 +4311,11 @@ msgstr "Lletra base"
#: ../plugins/taglist/HTML.tags.xml.in.h:261
msgid "Border color"
-msgstr "Color de la vora"
+msgstr "Color del contorn"
#: ../plugins/taglist/HTML.tags.xml.in.h:262
msgid "Border"
-msgstr "Vora"
+msgstr "Contorn"
#: ../plugins/taglist/HTML.tags.xml.in.h:263
msgid "Center"
diff --git a/po/nb.po b/po/nb.po
index 7d9821c0..6440ecdc 100644
--- a/po/nb.po
+++ b/po/nb.po
@@ -10,7 +10,7 @@ msgstr ""
"Project-Id-Version: MATE Desktop Environment\n"
"Report-Msgid-Bugs-To: \n"
"POT-Creation-Date: 2016-08-01 10:33+0300\n"
-"PO-Revision-Date: 2016-05-01 01:23+0000\n"
+"PO-Revision-Date: 2016-11-19 14:41+0000\n"
"Last-Translator: Allan Nordhøy <[email protected]>\n"
"Language-Team: Norwegian Bokmål (http://www.transifex.com/mate/MATE/language/nb/)\n"
"MIME-Version: 1.0\n"
@@ -426,7 +426,7 @@ msgstr "Aktive tillegg"
msgid ""
"List of active plugins. It contains the \"Location\" of the active plugins. "
"See the .pluma-plugin file for obtaining the \"Location\" of a given plugin."
-msgstr "Liste over aktive tillegg. Denne inneholder «lokasjon» for de aktive tilleggene. Se filen .pluma-plugin for å finne «lokasjon» for et gitt tillegg."
+msgstr "Liste over aktive tillegg. Denne inneholder «plassering» for de aktive tilleggene. Se filen .pluma-plugin for å finne «plassering» for et gitt tillegg."
#: ../data/pluma.appdata.xml.in.h:1
msgid "A Text Editor for the MATE desktop environment"
@@ -884,14 +884,14 @@ msgstr "%s\nKjør «%s --help» for å se en liste med tilgjengelige kommandolin
#: ../pluma/pluma-commands-file.c:250
#, c-format
msgid "Loading file '%s'…"
-msgstr "Laster fil «%s»..."
+msgstr "Laster fil «%s»…"
#: ../pluma/pluma-commands-file.c:259
#, c-format
msgid "Loading %d file…"
msgid_plural "Loading %d files…"
-msgstr[0] "Laster %d fil..."
-msgstr[1] "Laster %d filer..."
+msgstr[0] "Laster %d fil…"
+msgstr[1] "Laster %d filer…"
#. Translators: "Open Files" is the title of the file chooser window
#: ../pluma/pluma-commands-file.c:465
@@ -910,16 +910,16 @@ msgstr "Vil du prøve å erstatte den med filen du lagrer?"
#: ../pluma/pluma-commands-file.c:650 ../pluma/pluma-commands-file.c:873
#, c-format
msgid "Saving file '%s'…"
-msgstr "Lagrer fil «%s»..."
+msgstr "Lagrer fil «%s»…"
#: ../pluma/pluma-commands-file.c:758
msgid "Save As…"
-msgstr "Lagre som..."
+msgstr "Lagre som…"
#: ../pluma/pluma-commands-file.c:1087
#, c-format
msgid "Reverting the document '%s'…"
-msgstr "Forkaster endringer i dokument «%s»..."
+msgstr "Forkaster endringer i dokumentet «%s»…"
#: ../pluma/pluma-commands-file.c:1132
#, c-format
@@ -1205,25 +1205,25 @@ msgstr "Kunne ikke finne filen %s."
#: ../pluma/pluma-io-error-message-area.c:258
#: ../pluma/pluma-io-error-message-area.c:265
msgid "Please check that you typed the location correctly and try again."
-msgstr "Vennligst sjekk at du skrev inn lokasjonen korrekt og prøv igjen."
+msgstr "Sjekk at du skrev inn plasseringen rett og prøv igjen."
#. Translators: %s is a URI scheme (like for example http:, ftp:, etc.)
#: ../pluma/pluma-io-error-message-area.c:234
#, c-format
msgid "pluma cannot handle %s locations."
-msgstr "pluma kan ikke håndtere %s-lokasjoner."
+msgstr "pluma kan ikke håndtere %s-plasseringer."
#: ../pluma/pluma-io-error-message-area.c:240
msgid "pluma cannot handle this location."
-msgstr "pluma kan ikke håndtere denne lokasjonen."
+msgstr "pluma kan ikke håndtere denne plasseringen."
#: ../pluma/pluma-io-error-message-area.c:248
msgid "The location of the file cannot be mounted."
-msgstr "Lokasjonen for filen kan ikke monteres."
+msgstr "Plasseringen for filen kan ikke monteres."
#: ../pluma/pluma-io-error-message-area.c:252
msgid "The location of the file cannot be accessed because it is not mounted."
-msgstr "Lokasjonen for filen kan ikke aksesseres fordi den ikke er montert."
+msgstr "Plasseringen for filen kan ikke nås fordi den ikke er montert."
#: ../pluma/pluma-io-error-message-area.c:256
#, c-format
@@ -1233,21 +1233,21 @@ msgstr "%s er en katalog."
#: ../pluma/pluma-io-error-message-area.c:263
#, c-format
msgid "%s is not a valid location."
-msgstr "«%s» er ikke en gyldig lokasjon."
+msgstr "«%s» er ikke en gyldig plassering."
#: ../pluma/pluma-io-error-message-area.c:293
#, c-format
msgid ""
"Host %s could not be found. Please check that your proxy settings are "
"correct and try again."
-msgstr "Vert %s ble ikke funnet. Vennligst sjekk at dine mellomtjenings-innstillinger er riktige og prøv igjen."
+msgstr "Verten %s ble ikke funnet. Sjekk at dine mellomtjenings-innstillinger er riktige og prøv igjen."
#: ../pluma/pluma-io-error-message-area.c:306
#, c-format
msgid ""
"Hostname was invalid. Please check that you typed the location correctly and"
" try again."
-msgstr "Vertsnavnet er ugyldig. Vennligst sjekk at du skrev inn lokasjonen korrekt og prøv igjen."
+msgstr "Vertsnavnet er ugyldig. Sjekk at du skrev inn plasseringen rett og prøv igjen."
#: ../pluma/pluma-io-error-message-area.c:314
#, c-format
@@ -1256,7 +1256,7 @@ msgstr "%s er ikke en vanlig fil."
#: ../pluma/pluma-io-error-message-area.c:319
msgid "Connection timed out. Please try again."
-msgstr "Tidsavbrudd for tilkobling. Vennligst prøv igjen."
+msgstr "Tidsavbrudd for tilkobling. Prøv igjen."
#: ../pluma/pluma-io-error-message-area.c:342
msgid "The file is too big."
@@ -1311,7 +1311,7 @@ msgstr "pluma har ikke klart å gjenkjenne tegnkodingen."
#: ../pluma/pluma-io-error-message-area.c:632
#: ../pluma/pluma-io-error-message-area.c:654
msgid "Please check that you are not trying to open a binary file."
-msgstr "Vennligst sjekk om du prøver å åpne en binær fil."
+msgstr "Sjekk om du prøver å åpne en binær fil."
#: ../pluma/pluma-io-error-message-area.c:633
msgid "Select a character encoding from the menu and try again."
@@ -1417,55 +1417,55 @@ msgstr "pluma kunne ikke ta sikkerhetskopi av den gamle kopien av filen før lag
msgid ""
"pluma cannot handle %s locations in write mode. Please check that you typed "
"the location correctly and try again."
-msgstr "pluma kan ikke håndtere %s-lokasjoner i skrivemodus. Vennligst sjekk at du skrev inn lokasjonen korrekt og prøv igjen."
+msgstr "pluma kan ikke håndtere %s-plasseringer i skrivemodus. Sjekk at du skrev inn plasseringen rett og prøv igjen."
#: ../pluma/pluma-io-error-message-area.c:1128
msgid ""
"pluma cannot handle this location in write mode. Please check that you typed"
" the location correctly and try again."
-msgstr "pluma kan ikke håndtere denne lokasjonen i skrivemodus. Vennligst sjekk at du skrev inn lokasjonen korrekt og prøv igjen."
+msgstr "pluma kan ikke håndtere denne plasseringen i skrivemodus. Sjekk at du skrev inn plasseringen rett og prøv igjen."
#: ../pluma/pluma-io-error-message-area.c:1137
#, c-format
msgid ""
"%s is not a valid location. Please check that you typed the location "
"correctly and try again."
-msgstr "%s er ikke en gyldig lokasjon. Vennligst sjekk at du skrev inn lokasjonen korrekt og prøv igjen."
+msgstr "%s er ikke en gyldig plassering. Sjekk at du skrev inn plasseringen rett og prøv igjen."
#: ../pluma/pluma-io-error-message-area.c:1143
msgid ""
"You do not have the permissions necessary to save the file. Please check "
"that you typed the location correctly and try again."
-msgstr "Du har ikke nødvendige rettigheter til å lagre filen. Vennligst sjekk at du skrev inn lokasjonen korrekt og prøv igjen."
+msgstr "Du har ikke nødvendige rettigheter til å lagre filen. Sjekk at du skrev inn plasseringen rett og prøv igjen."
#: ../pluma/pluma-io-error-message-area.c:1149
msgid ""
"There is not enough disk space to save the file. Please free some disk space"
" and try again."
-msgstr "Det er ikke nok plass på disken til å lagre filen. Vennligst frigjør plass og prøv igjen."
+msgstr "Det er ikke nok plass på disken til å lagre filen. Frigjør plass og prøv igjen."
#: ../pluma/pluma-io-error-message-area.c:1154
msgid ""
"You are trying to save the file on a read-only disk. Please check that you "
"typed the location correctly and try again."
-msgstr "Du prøver å lagre filen på en skrivebeskyttet disk. Vennligst sjekk at du skrev inn lokasjonen korrekt og prøv igjen."
+msgstr "Du prøver å lagre filen på en skrivebeskyttet disk.Sjekk at du skrev inn plasseringen rett og prøv igjen."
#: ../pluma/pluma-io-error-message-area.c:1160
msgid "A file with the same name already exists. Please use a different name."
-msgstr "En fil med det samme navnet eksisterer allerede. Vennligst bruk et annet navn."
+msgstr "En fil med det samme navnet finnes allerede. Bruk et annet navn."
#: ../pluma/pluma-io-error-message-area.c:1165
msgid ""
"The disk where you are trying to save the file has a limitation on length of"
" the file names. Please use a shorter name."
-msgstr "Disken du prøver å lagre filen på har en begrensning på lengde på filnavn. Vennligst bruk et kortere navn."
+msgstr "Disken du prøver å lagre filen på har en begrensning for filnavnslengde. Bruk et kortere navn."
#: ../pluma/pluma-io-error-message-area.c:1172
msgid ""
"The disk where you are trying to save the file has a limitation on file "
"sizes. Please try saving a smaller file or saving it to a disk that does not"
" have this limitation."
-msgstr "Disken du prøver å lagre filen på har en begrensning på filstørrelse. Vennligst prøv å lagre en mindre fil eller lagre den på en disk som ikke har denne begrensningen."
+msgstr "Disken du prøver å lagre filen på har en begrensning for filstørrelse. Prøv å lagre en mindre fil eller lagre den på en disk som ikke har denne begrensningen."
#: ../pluma/pluma-io-error-message-area.c:1188
#, c-format
@@ -1829,7 +1829,7 @@ msgstr "Bruk_ervalg"
#: ../pluma/pluma-ui.h:63
msgid "Configure the application"
-msgstr "Konfigurer applikasjonen"
+msgstr "Sett opp programmet"
#. Help menu
#: ../pluma/pluma-ui.h:66
@@ -1842,7 +1842,7 @@ msgstr "Åpne pluma-håndbok"
#: ../pluma/pluma-ui.h:69
msgid "About this application"
-msgstr "Om denne applikasjonen"
+msgstr "Om dette programmet"
#: ../pluma/pluma-ui.h:73
msgid "Leave fullscreen mode"
@@ -2061,7 +2061,7 @@ msgstr "Vis eller skjul bunnpanelet i dette vinduet"
#: ../pluma/pluma-utils.c:1100
msgid "Please check your installation."
-msgstr "Vennligst sjekk din installasjon."
+msgstr "Sjekk installasjonen din"
#: ../pluma/pluma-utils.c:1177
#, c-format
@@ -2497,7 +2497,7 @@ msgstr "Enkel filtilgang fra sidelinjen"
#: ../plugins/filebrowser/org.mate.pluma.plugins.filebrowser.gschema.xml.in.h:1
msgid "Set Location to First Document"
-msgstr "Sett lokasjonen til første dokument"
+msgstr "Sett plasseringen til første dokument"
#: ../plugins/filebrowser/org.mate.pluma.plugins.filebrowser.gschema.xml.in.h:2
msgid ""
@@ -2562,11 +2562,11 @@ msgstr "Virtuell rotkatalog som brukes når fillesertillegget og onload/tree_vie
#: ../plugins/filebrowser/org.mate.pluma.plugins.filebrowser.gschema.xml.in.h:13
msgid "Enable Restore of Remote Locations"
-msgstr "Aktiver gjenoppretting av eksterne lokasjoner"
+msgstr "Aktiver gjenoppretting av eksterne plasseringer"
#: ../plugins/filebrowser/org.mate.pluma.plugins.filebrowser.gschema.xml.in.h:14
msgid "Sets whether to enable restoring of remote locations."
-msgstr "Bestemmer om gjenoppretting fra eksterne lokasjoner skal aktiveres."
+msgstr "Bestemmer om gjenoppretting fra eksterne plasseringer skal aktiveres."
#: ../plugins/filebrowser/pluma-file-bookmarks-store.c:235
msgid "File System"
@@ -2578,7 +2578,7 @@ msgstr "_Sett rot til aktivt dokument"
#: ../plugins/filebrowser/pluma-file-browser-plugin.c:539
msgid "Set the root to the active document location"
-msgstr "Sett roten til lokasjonen for aktivt dokument"
+msgstr "Sett roten til plasseringen for aktivt dokument"
#: ../plugins/filebrowser/pluma-file-browser-plugin.c:544
msgid "_Open terminal here"
@@ -2748,19 +2748,19 @@ msgstr "Endre navn på valgt fil eller mappe"
#: ../plugins/filebrowser/pluma-file-browser-widget.c:849
msgid "_Previous Location"
-msgstr "_Forrige lokasjon"
+msgstr "_Forrige plassering"
#: ../plugins/filebrowser/pluma-file-browser-widget.c:851
msgid "Go to the previous visited location"
-msgstr "Gå til forrige lokasjon"
+msgstr "Gå til forrige plassering"
#: ../plugins/filebrowser/pluma-file-browser-widget.c:853
msgid "_Next Location"
-msgstr "_Neste lokasjon"
+msgstr "_Neste plassering"
#: ../plugins/filebrowser/pluma-file-browser-widget.c:854
msgid "Go to the next visited location"
-msgstr "Gå til neste lokasjon"
+msgstr "Gå til neste plassering"
#: ../plugins/filebrowser/pluma-file-browser-widget.c:855
msgid "Re_fresh View"
@@ -2800,24 +2800,24 @@ msgstr "Vis binære filer"
#: ../plugins/filebrowser/pluma-file-browser-widget.c:1010
#: ../plugins/filebrowser/pluma-file-browser-widget.c:1031
msgid "Previous location"
-msgstr "Forrige lokasjon"
+msgstr "Forrige plassering"
#: ../plugins/filebrowser/pluma-file-browser-widget.c:1003
msgid "Go to previous location"
-msgstr "Gå til forrige lokasjon"
+msgstr "Gå til forrige plassering"
#: ../plugins/filebrowser/pluma-file-browser-widget.c:1005
#: ../plugins/filebrowser/pluma-file-browser-widget.c:1026
msgid "Go to a previously opened location"
-msgstr "Gå til en tidligere åpnet lokasjon"
+msgstr "Gå til en tidligere åpnet plassering"
#: ../plugins/filebrowser/pluma-file-browser-widget.c:1022
msgid "Next location"
-msgstr "Neste lokasjon"
+msgstr "Neste plassering"
#: ../plugins/filebrowser/pluma-file-browser-widget.c:1024
msgid "Go to next location"
-msgstr "Gå til neste lokasjon"
+msgstr "Gå til neste plassering"
#: ../plugins/filebrowser/pluma-file-browser-widget.c:1236
msgid "_Match Filename"
@@ -3053,7 +3053,7 @@ msgstr "Arkivet «%s» kunne ikke opprettes"
#: ../plugins/snippets/snippets/Exporter.py:82
#, python-format
msgid "Target directory \"%s\" does not exist"
-msgstr "Målkatalog «%s» eksisterer ikke"
+msgstr "Målmappa «%s» finnes ikke"
#: ../plugins/snippets/snippets/Exporter.py:85
#, python-format
@@ -3064,7 +3064,7 @@ msgstr "Målkatalog «%s» er ikke en gyldig katalog"
#: ../plugins/snippets/snippets/Importer.py:83
#, python-format
msgid "File \"%s\" does not exist"
-msgstr "Fil «%s» eksisterer ikke"
+msgstr "Fila «%s» finnes ikke"
#: ../plugins/snippets/snippets/Importer.py:32
#, python-format
diff --git a/po/ro.po b/po/ro.po
index 15dd9de3..884ae6a0 100644
--- a/po/ro.po
+++ b/po/ro.po
@@ -3,7 +3,8 @@
# This file is distributed under the same license as the PACKAGE package.
#
# Translators:
-# Daniel <[email protected]>, 2015-2016
+# Daniel <[email protected]>, 2015-2016
+# Daniel <[email protected]>, 2016
# sorinn <[email protected]>, 2014
# sidro <[email protected]>, 2014
msgid ""
@@ -11,8 +12,8 @@ msgstr ""
"Project-Id-Version: MATE Desktop Environment\n"
"Report-Msgid-Bugs-To: \n"
"POT-Creation-Date: 2016-08-01 10:33+0300\n"
-"PO-Revision-Date: 2016-09-23 20:46+0000\n"
-"Last-Translator: Daniel <[email protected]>\n"
+"PO-Revision-Date: 2016-11-25 10:41+0000\n"
+"Last-Translator: Daniel <[email protected]>\n"
"Language-Team: Romanian (http://www.transifex.com/mate/MATE/language/ro/)\n"
"MIME-Version: 1.0\n"
"Content-Type: text/plain; charset=UTF-8\n"
@@ -3591,11 +3592,11 @@ msgstr "Dezactivat"
#: ../plugins/taglist/HTML.tags.xml.in.h:62
msgid "DIV container"
-msgstr "Container DIV"
+msgstr "Conținător DIV"
#: ../plugins/taglist/HTML.tags.xml.in.h:63
msgid "DIV Style container"
-msgstr "Container stil DIV"
+msgstr "Conținător stil DIV"
#: ../plugins/taglist/HTML.tags.xml.in.h:64
msgid "Document base"
diff --git a/po/sv.po b/po/sv.po
index 0dec4f22..e387f958 100644
--- a/po/sv.po
+++ b/po/sv.po
@@ -12,7 +12,7 @@ msgstr ""
"Project-Id-Version: MATE Desktop Environment\n"
"Report-Msgid-Bugs-To: \n"
"POT-Creation-Date: 2016-08-01 10:33+0300\n"
-"PO-Revision-Date: 2016-11-04 13:50+0000\n"
+"PO-Revision-Date: 2016-11-23 16:46+0000\n"
"Last-Translator: Jonatan Nyberg <[email protected]>\n"
"Language-Team: Swedish (http://www.transifex.com/mate/MATE/language/sv/)\n"
"MIME-Version: 1.0\n"
@@ -376,7 +376,7 @@ msgstr "Anger det typsnitt som ska användas för radnummer vid utskrift. Detta
#: ../data/org.mate.pluma.gschema.xml.in.h:73
msgctxt "auto-detected"
msgid "[ 'UTF-8', 'CURRENT', 'ISO-8859-15', 'UTF-16' ]"
-msgstr ""
+msgstr "[ 'UTF-8', 'CURRENT', 'ISO-8859-15', 'UTF-16' ]"
#: ../data/org.mate.pluma.gschema.xml.in.h:74
msgid "Automatically Detected Encodings"
@@ -647,7 +647,7 @@ msgstr "Kunde inte ta bort färgschemat \"%s\"."
#: ../pluma/dialogs/pluma-preferences-dialog.c:1090
msgid "Pluma Preferences"
-msgstr ""
+msgstr "Pluma Inställningar"
#: ../pluma/dialogs/pluma-preferences-dialog.ui.h:1
msgid "Preferences"