Commit 20b399e9 authored by Jehan's avatar Jehan

app: add some GimpExtension and GimpExtensionManager API.

To be used in the next commit.
I keep the GUI and core changes well separated in different commits so
that the core is easy to cherry-pick even though I will have to have
different GUI code.
parent b9b8676c
......@@ -185,6 +185,36 @@ gimp_extension_new (const gchar *dir,
NULL);
}
const gchar *
gimp_extension_get_name (GimpExtension *extension)
{
g_return_val_if_fail (extension->p->app != NULL, NULL);
return as_app_get_name (extension->p->app, g_getenv ("LANGUAGE")) ?
as_app_get_name (extension->p->app, g_getenv ("LANGUAGE")) :
as_app_get_name (extension->p->app, NULL);
}
const gchar *
gimp_extension_get_comment (GimpExtension *extension)
{
g_return_val_if_fail (extension->p->app != NULL, NULL);
return as_app_get_comment (extension->p->app, g_getenv ("LANGUAGE")) ?
as_app_get_comment (extension->p->app, g_getenv ("LANGUAGE")) :
as_app_get_comment (extension->p->app, NULL);
}
const gchar *
gimp_extension_get_description (GimpExtension *extension)
{
g_return_val_if_fail (extension->p->app != NULL, NULL);
return as_app_get_description (extension->p->app, g_getenv ("LANGUAGE")) ?
as_app_get_description (extension->p->app, g_getenv ("LANGUAGE")) :
as_app_get_description (extension->p->app, NULL);
}
gboolean
gimp_extension_load (GimpExtension *extension,
GError **error)
......
......@@ -52,6 +52,9 @@ GType gimp_extension_get_type (void) G_GNUC_CONST;
GimpExtension * gimp_extension_new (const gchar *dir,
gboolean writable);
const gchar * gimp_extension_get_name (GimpExtension *extension);
const gchar * gimp_extension_get_comment (GimpExtension *extension);
const gchar * gimp_extension_get_description (GimpExtension *extension);
gboolean gimp_extension_load (GimpExtension *extension,
GError **error);
......
......@@ -341,6 +341,27 @@ gimp_extension_manager_initialize (GimpExtensionManager *manager)
gimp_extension_manager_refresh (manager);
}
const GList *
gimp_extension_manager_get_system_extensions (GimpExtensionManager *manager)
{
return manager->p->sys_extensions;
}
const GList *
gimp_extension_manager_get_user_extensions (GimpExtensionManager *manager)
{
return manager->p->extensions;
}
gboolean
gimp_extension_manager_is_active (GimpExtensionManager *manager,
const gchar *id)
{
return g_hash_table_contains (manager->p->active_extensions, id);
}
/* Private functions. */
static void
gimp_extension_manager_refresh (GimpExtensionManager *manager)
{
......
......@@ -55,4 +55,10 @@ GimpExtensionManager * gimp_extension_manager_new (Gimp *gimp);
void gimp_extension_manager_initialize (GimpExtensionManager *manager);
const GList * gimp_extension_manager_get_system_extensions (GimpExtensionManager *manager);
const GList * gimp_extension_manager_get_user_extensions (GimpExtensionManager *manager);
gboolean gimp_extension_manager_is_active (GimpExtensionManager *manager,
const gchar *id);
#endif /* __GIMP_EXTENSION_MANAGER_H__ */
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