[gnome-builder/wip/chergert/multi-process: 41/58] app: avoid iterating plugin list
- From: Christian Hergert <chergert src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [gnome-builder/wip/chergert/multi-process: 41/58] app: avoid iterating plugin list
- Date: Thu, 29 Oct 2015 00:37:46 +0000 (UTC)
commit ef8563e21bac51f3d5cf696da5011f0eae3ae424
Author: Christian Hergert <chergert redhat com>
Date: Tue Oct 20 00:16:09 2015 -0700
app: avoid iterating plugin list
src/app/gb-application.c | 30 ++++++++++++------------------
1 files changed, 12 insertions(+), 18 deletions(-)
---
diff --git a/src/app/gb-application.c b/src/app/gb-application.c
index 4ac74be..da69ff6 100644
--- a/src/app/gb-application.c
+++ b/src/app/gb-application.c
@@ -56,11 +56,10 @@ gb_application_is_worker (GbApplication *self)
static void
gb_application_load_worker (GbApplication *self)
{
- PeasEngine *engine;
- g_auto(GStrv) loaded_plugins = NULL;
g_autoptr(GDBusConnection) connection = NULL;
+ PeasEngine *engine;
+ PeasPluginInfo *plugin_info;
GError *error = NULL;
- gsize i;
IDE_ENTRY;
@@ -84,24 +83,19 @@ gb_application_load_worker (GbApplication *self)
}
engine = peas_engine_get_default ();
- loaded_plugins = peas_engine_get_loaded_plugins (engine);
+ plugin_info = peas_engine_get_plugin_info (engine, self->type);
- for (i = 0; loaded_plugins [i]; i++)
+ if ((plugin_info != NULL) && peas_plugin_info_is_loaded (plugin_info))
{
- if (g_strcmp0 (loaded_plugins [i], self->type) == 0)
- {
- PeasPluginInfo *plugin_info;
- PeasExtension *exten;
+ PeasExtension *exten;
- plugin_info = peas_engine_get_plugin_info (engine, self->type);
- exten = peas_engine_create_extension (engine, plugin_info, IDE_TYPE_WORKER, NULL);
+ exten = peas_engine_create_extension (engine, plugin_info, IDE_TYPE_WORKER, NULL);
- if (exten != NULL)
- {
- ide_worker_register_service (IDE_WORKER (exten), connection);
- g_application_hold (G_APPLICATION (self));
- IDE_EXIT;
- }
+ if (exten != NULL)
+ {
+ ide_worker_register_service (IDE_WORKER (exten), connection);
+ g_application_hold (G_APPLICATION (self));
+ IDE_EXIT;
}
}
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]