summaryrefslogtreecommitdiff
path: root/src/eom-window.c
diff options
context:
space:
mode:
authormonsta <[email protected]>2016-11-30 21:18:35 +0300
committermonsta <[email protected]>2016-11-30 22:24:15 +0300
commit108741a82a158996883f9d1ae19c6e65226f3309 (patch)
tree7b545ec61d19aa4ce2ac8f421493c248a70baf3a /src/eom-window.c
parent52399afcd688b56aaa0750af6d3af42c26c31abe (diff)
downloadeom-108741a82a158996883f9d1ae19c6e65226f3309.tar.bz2
eom-108741a82a158996883f9d1ae19c6e65226f3309.tar.xz
port plugin system to libpeas
backported from eog with a few changes upstream commits for reference: https://git.gnome.org/browse/eog/commit/?id=1f79c321367c91c8e9063f1343a7e4ce4199c4d5 https://git.gnome.org/browse/eog/commit/?id=9afc5483b615039a580e295fe08d7b8ec524759c https://git.gnome.org/browse/eog/commit/?id=40bedbf33812e65f4a8e79691b1fadfaace94035 https://git.gnome.org/browse/eog/commit/?id=8b0acfddc52c220393770a9895b6b56cab7821fd https://git.gnome.org/browse/eog/commit/?id=95694f8b5f06b891a5e55356451ad60b53387563 https://git.gnome.org/browse/eog/commit/?id=7eeb6c8c0e55a3ad954cde4a6fed91ea7f89691c
Diffstat (limited to 'src/eom-window.c')
-rw-r--r--src/eom-window.c48
1 files changed, 46 insertions, 2 deletions
diff --git a/src/eom-window.c b/src/eom-window.c
index 5c022f4..72400d5 100644
--- a/src/eom-window.c
+++ b/src/eom-window.c
@@ -50,7 +50,6 @@
#include "eom-jobs.h"
#include "eom-util.h"
#include "eom-save-as-dialog-helper.h"
-#include "eom-plugin-engine.h"
#include "eom-close-confirmation-dialog.h"
#include "eom-clipboard-handler.h"
@@ -68,6 +67,9 @@
#include <gio/gdesktopappinfo.h>
#include <gtk/gtk.h>
+#include <libpeas/peas-extension-set.h>
+#include <libpeas/peas-activatable.h>
+
#if HAVE_LCMS
#include <X11/Xlib.h>
#include <X11/Xatom.h>
@@ -185,6 +187,8 @@ struct _EomWindowPrivate {
GtkPageSetup *page_setup;
+ PeasExtensionSet *extensions;
+
#ifdef HAVE_LCMS
cmsHPROFILE *display_profile;
#endif
@@ -4562,6 +4566,14 @@ eom_window_dispose (GObject *object)
window = EOM_WINDOW (object);
priv = window->priv;
+ peas_engine_garbage_collect (PEAS_ENGINE (EOM_APP->plugin_engine));
+
+ if (priv->extensions != NULL) {
+ g_object_unref (priv->extensions);
+ priv->extensions = NULL;
+ peas_engine_garbage_collect (PEAS_ENGINE (EOM_APP->plugin_engine));
+ }
+
if (priv->page_setup != NULL) {
g_object_unref (priv->page_setup);
priv->page_setup = NULL;
@@ -4678,6 +4690,8 @@ eom_window_dispose (GObject *object)
priv->last_save_as_folder = NULL;
}
+ peas_engine_garbage_collect (PEAS_ENGINE (EOM_APP->plugin_engine));
+
G_OBJECT_CLASS (eom_window_parent_class)->dispose (object);
}
@@ -4999,19 +5013,49 @@ eom_window_get_property (GObject *object,
}
}
+static void
+on_extension_added (PeasExtensionSet *set,
+ PeasPluginInfo *info,
+ PeasExtension *exten,
+ GtkWindow *window)
+{
+ peas_extension_call (exten, "activate", window);
+}
+
+static void
+on_extension_removed (PeasExtensionSet *set,
+ PeasPluginInfo *info,
+ PeasExtension *exten,
+ GtkWindow *window)
+{
+ peas_extension_call (exten, "deactivate", window);
+}
+
static GObject *
eom_window_constructor (GType type,
guint n_construct_properties,
GObjectConstructParam *construct_params)
{
GObject *object;
+ EomWindowPrivate *priv;
object = G_OBJECT_CLASS (eom_window_parent_class)->constructor
(type, n_construct_properties, construct_params);
+ priv = EOM_WINDOW (object)->priv;
+
eom_window_construct_ui (EOM_WINDOW (object));
- eom_plugin_engine_update_plugins_ui (EOM_WINDOW (object), TRUE);
+ priv->extensions = peas_extension_set_new (PEAS_ENGINE (EOM_APP->plugin_engine),
+ PEAS_TYPE_ACTIVATABLE,
+ "object", object, NULL);
+
+ peas_extension_set_call (priv->extensions, "activate");
+
+ g_signal_connect (priv->extensions, "extension-added",
+ G_CALLBACK (on_extension_added), object);
+ g_signal_connect (priv->extensions, "extension-removed",
+ G_CALLBACK (on_extension_removed), object);
return object;
}