[gnome-builder/wip/gtk4-port] libide/gui: load resources after loading module
- From: Christian Hergert <chergert src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [gnome-builder/wip/gtk4-port] libide/gui: load resources after loading module
- Date: Fri, 29 Apr 2022 17:34:11 +0000 (UTC)
commit ff9a292bb409c081998ad7dd7251d52aaef2ca20
Author: Christian Hergert <chergert redhat com>
Date: Fri Apr 29 10:30:14 2022 -0700
libide/gui: load resources after loading module
Otherwise, the resources could get loaded in the wrong order with regards
to menu merging (which is why we had the hack in place before to work
around it).
Since we don't need resources when the plugins load, but when their addins
are instantiated, this is fine and allows the resources to be dynamically
injected after the plugin, but before the addins.
It fixes the buildui plugin getting it's resources injected before the
project-tree has injected it's own menus.
src/libide/gui/ide-application-plugins.c | 28 ++++++++++++++++++----------
1 file changed, 18 insertions(+), 10 deletions(-)
---
diff --git a/src/libide/gui/ide-application-plugins.c b/src/libide/gui/ide-application-plugins.c
index 98ff70bd1..02df5388e 100644
--- a/src/libide/gui/ide-application-plugins.c
+++ b/src/libide/gui/ide-application-plugins.c
@@ -226,9 +226,9 @@ _ide_application_load_plugin (IdeApplication *self,
}
static void
-ide_application_plugins_load_plugin_cb (IdeApplication *self,
- PeasPluginInfo *plugin_info,
- PeasEngine *engine)
+ide_application_plugins_load_plugin_after_cb (IdeApplication *self,
+ PeasPluginInfo *plugin_info,
+ PeasEngine *engine)
{
const gchar *data_dir;
const gchar *module_dir;
@@ -265,15 +265,23 @@ ide_application_plugins_load_plugin_cb (IdeApplication *self,
}
static void
-ide_application_plugins_unload_plugin_cb (IdeApplication *self,
- PeasPluginInfo *plugin_info,
- PeasEngine *engine)
+ide_application_plugins_unload_plugin_after_cb (IdeApplication *self,
+ PeasPluginInfo *plugin_info,
+ PeasEngine *engine)
{
+ const gchar *module_dir;
+ const gchar *module_name;
+
g_assert (IDE_IS_MAIN_THREAD ());
g_assert (IDE_IS_APPLICATION (self));
g_assert (plugin_info != NULL);
g_assert (PEAS_IS_ENGINE (engine));
+ module_dir = peas_plugin_info_get_module_dir (plugin_info);
+ module_name = peas_plugin_info_get_module_name (plugin_info);
+
+ g_debug ("Unloaded plugin \"%s\" with module-dir \"%s\"",
+ module_name, module_dir);
}
/**
@@ -296,15 +304,15 @@ _ide_application_load_plugins_for_startup (IdeApplication *self)
g_signal_connect_object (engine,
"load-plugin",
- G_CALLBACK (ide_application_plugins_load_plugin_cb),
+ G_CALLBACK (ide_application_plugins_load_plugin_after_cb),
self,
- G_CONNECT_SWAPPED);
+ G_CONNECT_SWAPPED | G_CONNECT_AFTER);
g_signal_connect_object (engine,
"unload-plugin",
- G_CALLBACK (ide_application_plugins_unload_plugin_cb),
+ G_CALLBACK (ide_application_plugins_unload_plugin_after_cb),
self,
- G_CONNECT_SWAPPED);
+ G_CONNECT_SWAPPED | G_CONNECT_AFTER);
/* Ensure that our embedded plugins are allowed early access to
* start loading (before we ever look at anything on disk). This
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]