Commit 4ac9543f authored by Jehan's avatar Jehan

app: extensions can now contain plug-ins.

parent a8f1a18b
......@@ -45,7 +45,7 @@ struct _GimpExtensionPrivate
AsApp *app;
gboolean writable;
/* Extension metadata. */
/* Extension metadata: directories. */
GList *brush_paths;
GList *dynamics_paths;
GList *mypaint_brush_paths;
......@@ -53,6 +53,9 @@ struct _GimpExtensionPrivate
GList *gradient_paths;
GList *palette_paths;
GList *tool_preset_paths;
/* Extension metadata: plug-in entry points. */
GList *plug_in_paths;
};
......@@ -371,6 +374,13 @@ gimp_extension_run (GimpExtension *extension,
value, TRUE,
error);
}
if (! (*error))
{
value = g_hash_table_lookup (metadata, "GIMP::plug-in-path");
extension->p->plug_in_paths = gimp_extension_validate_paths (extension,
value, FALSE,
error);
}
if (*error)
gimp_extension_stop (extension);
......@@ -395,6 +405,8 @@ gimp_extension_stop (GimpExtension *extension)
extension->p->palette_paths = NULL;
g_list_free_full (extension->p->tool_preset_paths, g_object_unref);
extension->p->tool_preset_paths = NULL;
g_list_free_full (extension->p->plug_in_paths, g_object_unref);
extension->p->plug_in_paths = NULL;
}
GList *
......@@ -439,6 +451,12 @@ gimp_extension_get_tool_preset_paths (GimpExtension *extension)
return extension->p->tool_preset_paths;
}
GList *
gimp_extension_get_plug_in_paths (GimpExtension *extension)
{
return extension->p->plug_in_paths;
}
/**
* gimp_extension_validate_paths:
* @extension: the #GimpExtension
......
......@@ -66,5 +66,6 @@ GList * gimp_extension_get_pattern_paths (GimpExtension *extensio
GList * gimp_extension_get_gradient_paths (GimpExtension *extension);
GList * gimp_extension_get_palette_paths (GimpExtension *extension);
GList * gimp_extension_get_tool_preset_paths (GimpExtension *extension);
GList * gimp_extension_get_plug_in_paths (GimpExtension *extension);
#endif /* __GIMP_EXTENSION_H__ */
......@@ -53,6 +53,7 @@ enum
PROP_GRADIENT_PATHS,
PROP_PALETTE_PATHS,
PROP_TOOL_PRESET_PATHS,
PROP_PLUG_IN_PATHS,
};
struct _GimpExtensionManagerPrivate
......@@ -75,6 +76,7 @@ struct _GimpExtensionManagerPrivate
GList *gradient_paths;
GList *palette_paths;
GList *tool_preset_paths;
GList *plug_in_paths;
};
static void gimp_extension_manager_finalize (GObject *object);
......@@ -139,6 +141,10 @@ gimp_extension_manager_class_init (GimpExtensionManagerClass *klass)
g_param_spec_pointer ("tool-preset-paths",
NULL, NULL,
GIMP_PARAM_READWRITE));
g_object_class_install_property (object_class, PROP_PLUG_IN_PATHS,
g_param_spec_pointer ("plug-in-paths",
NULL, NULL,
GIMP_PARAM_READWRITE));
g_type_class_add_private (klass, sizeof (GimpExtensionManagerPrivate));
}
......@@ -197,6 +203,9 @@ gimp_extension_manager_set_property (GObject *object,
case PROP_TOOL_PRESET_PATHS:
manager->p->tool_preset_paths = g_value_get_pointer (value);
break;
case PROP_PLUG_IN_PATHS:
manager->p->plug_in_paths = g_value_get_pointer (value);
break;
default:
G_OBJECT_WARN_INVALID_PROPERTY_ID (object, property_id, pspec);
......@@ -238,6 +247,9 @@ gimp_extension_manager_get_property (GObject *object,
case PROP_TOOL_PRESET_PATHS:
g_value_set_pointer (value, manager->p->tool_preset_paths);
break;
case PROP_PLUG_IN_PATHS:
g_value_set_pointer (value, manager->p->plug_in_paths);
break;
default:
G_OBJECT_WARN_INVALID_PROPERTY_ID (object, property_id, pspec);
......@@ -342,6 +354,7 @@ gimp_extension_manager_refresh (GimpExtensionManager *manager)
GList *gradient_paths = NULL;
GList *palette_paths = NULL;
GList *tool_preset_paths = NULL;
GList *plug_in_paths = NULL;
g_hash_table_iter_init (&iter, manager->p->active_extensions);
while (g_hash_table_iter_next (&iter, &key, &value))
......@@ -376,6 +389,10 @@ gimp_extension_manager_refresh (GimpExtensionManager *manager)
new_paths = g_list_copy_deep (gimp_extension_get_tool_preset_paths (extension),
(GCopyFunc) g_object_ref, NULL);
tool_preset_paths = g_list_concat (tool_preset_paths, new_paths);
new_paths = g_list_copy_deep (gimp_extension_get_plug_in_paths (extension),
(GCopyFunc) g_object_ref, NULL);
plug_in_paths = g_list_concat (plug_in_paths, new_paths);
}
g_object_set (manager,
......@@ -386,6 +403,7 @@ gimp_extension_manager_refresh (GimpExtensionManager *manager)
"gradient-paths", gradient_paths,
"palette-paths", palette_paths,
"tool-preset-paths", tool_preset_paths,
"plug-in-paths", plug_in_paths,
NULL);
}
......
......@@ -227,6 +227,26 @@ gimp_plug_in_manager_search (GimpPlugInManager *manager,
}
#endif /* G_OS_WIN32 */
status_callback (_("Loading extension plug-ins"), "", 0.0);
g_object_get (manager->gimp->extension_manager,
"plug-in-paths", &path,
NULL);
for (list = path; list; list = g_list_next (list))
{
if (gimp_file_is_executable (list->data))
{
guint64 mtime;
GFileInfo *info;
info = g_file_query_info (list->data, G_FILE_ATTRIBUTE_TIME_MODIFIED,
G_FILE_QUERY_INFO_NONE, NULL, NULL);
mtime = g_file_info_get_attribute_uint64 (info,
G_FILE_ATTRIBUTE_TIME_MODIFIED);
gimp_plug_in_manager_add_from_file (manager, list->data, mtime);
g_object_unref (info);
}
}
status_callback (_("Searching plug-ins"), "", 0.0);
/* Give automatic tests a chance to use plug-ins from the build
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment