Commit 7d611e71 authored by Jehan's avatar Jehan

app: extensions can now install splashes.

Not the most useful type of extensions per-se, but a lot of people seem
to appreciate creating and installing new splashes. Let's make it easy
to install as extensions.
Note that extension splashes are cumulative. So if you enabled several
splash extensions at once, an image would be chosen in random amongst
all of them.
parent c7b59776
......@@ -287,6 +287,11 @@ gimp_constructed (GObject *object)
/* create user and default context */
gimp_contexts_init (gimp);
/* Initialize the extension manager early as its contents may be used
* at the very start (e.g. the splash image).
*/
gimp_extension_manager_initialize (gimp->extension_manager);
}
static void
......@@ -517,7 +522,6 @@ gimp_real_initialize (Gimp *gimp,
gimp_pdb_compat_procs_register (gimp->pdb, gimp->pdb_compat_mode);
gimp_plug_in_manager_initialize (gimp->plug_in_manager, status_callback);
gimp_extension_manager_initialize (gimp->extension_manager);
status_callback (NULL, "", 1.0);
}
......
......@@ -55,6 +55,7 @@ struct _GimpExtensionPrivate
GList *gradient_paths;
GList *palette_paths;
GList *tool_preset_paths;
GList *splash_paths;
/* Extension metadata: plug-in entry points. */
GList *plug_in_paths;
......@@ -436,6 +437,13 @@ gimp_extension_run (GimpExtension *extension,
value, FALSE,
error);
}
if (! (*error))
{
value = g_hash_table_lookup (metadata, "GIMP::splash-path");
extension->p->splash_paths = gimp_extension_validate_paths (extension,
value, TRUE,
error);
}
if (*error)
gimp_extension_clean (extension);
......@@ -498,6 +506,12 @@ gimp_extension_get_tool_preset_paths (GimpExtension *extension)
return extension->p->tool_preset_paths;
}
GList *
gimp_extension_get_splash_paths (GimpExtension *extension)
{
return extension->p->splash_paths;
}
GList *
gimp_extension_get_plug_in_paths (GimpExtension *extension)
{
......@@ -558,6 +572,8 @@ gimp_extension_clean (GimpExtension *extension)
extension->p->tool_preset_paths = NULL;
g_list_free_full (extension->p->plug_in_paths, g_object_unref);
extension->p->plug_in_paths = NULL;
g_list_free_full (extension->p->splash_paths, g_object_unref);
extension->p->splash_paths = NULL;
}
/**
......
......@@ -69,6 +69,7 @@ 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_splash_paths (GimpExtension *extension);
GList * gimp_extension_get_plug_in_paths (GimpExtension *extension);
gint gimp_extension_cmp (GimpExtension *extension1,
......
......@@ -53,6 +53,7 @@ enum
PROP_GRADIENT_PATHS,
PROP_PALETTE_PATHS,
PROP_TOOL_PRESET_PATHS,
PROP_SPLASH_PATHS,
PROP_PLUG_IN_PATHS,
};
......@@ -76,6 +77,7 @@ struct _GimpExtensionManagerPrivate
GList *gradient_paths;
GList *palette_paths;
GList *tool_preset_paths;
GList *splash_paths;
GList *plug_in_paths;
};
......@@ -160,6 +162,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_SPLASH_PATHS,
g_param_spec_pointer ("splash-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,
......@@ -398,6 +404,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_SPLASH_PATHS:
manager->p->splash_paths = g_value_get_pointer (value);
break;
case PROP_PLUG_IN_PATHS:
manager->p->plug_in_paths = g_value_get_pointer (value);
break;
......@@ -442,6 +451,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_SPLASH_PATHS:
g_value_set_pointer (value, manager->p->splash_paths);
break;
case PROP_PLUG_IN_PATHS:
g_value_set_pointer (value, manager->p->plug_in_paths);
break;
......@@ -694,6 +706,7 @@ gimp_extension_manager_refresh (GimpExtensionManager *manager)
GList *gradient_paths = NULL;
GList *palette_paths = NULL;
GList *tool_preset_paths = NULL;
GList *splash_paths = NULL;
GList *plug_in_paths = NULL;
g_hash_table_iter_init (&iter, manager->p->running_extensions);
......@@ -730,6 +743,10 @@ gimp_extension_manager_refresh (GimpExtensionManager *manager)
(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_splash_paths (extension),
(GCopyFunc) g_object_ref, NULL);
splash_paths = g_list_concat (splash_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);
......@@ -744,6 +761,7 @@ gimp_extension_manager_refresh (GimpExtensionManager *manager)
"palette-paths", palette_paths,
"tool-preset-paths", tool_preset_paths,
"plug-in-paths", plug_in_paths,
"splash-paths", splash_paths,
NULL);
}
......
......@@ -266,7 +266,7 @@ gui_init (Gimp *gimp,
if (! no_splash)
{
splash_create (gimp->be_verbose, initial_monitor);
splash_create (gimp, gimp->be_verbose, initial_monitor);
status_callback = splash_update;
}
......
......@@ -29,6 +29,8 @@
#include "gui-types.h"
#include "core/gimp.h"
#include "widgets/gimpwidgets-utils.h"
#include "splash.h"
......@@ -83,7 +85,8 @@ static void splash_average_text_area (GimpSplash *splash,
GdkRGBA *rgba);
static GdkPixbufAnimation *
splash_image_load (gint max_width,
splash_image_load (Gimp *gimp,
gint max_width,
gint max_height,
gboolean be_verbose);
static GdkPixbufAnimation *
......@@ -108,7 +111,8 @@ static void splash_timer_elapsed (void);
/* public functions */
void
splash_create (gboolean be_verbose,
splash_create (Gimp *gimp,
gboolean be_verbose,
GdkMonitor *monitor)
{
GtkWidget *frame;
......@@ -126,7 +130,7 @@ splash_create (gboolean be_verbose,
max_width = workarea.width / 2;
max_height = workarea.height / 2;
pixbuf = splash_image_load (max_width, max_height, be_verbose);
pixbuf = splash_image_load (gimp, max_width, max_height, be_verbose);
if (! pixbuf)
return;
......@@ -475,7 +479,8 @@ splash_average_text_area (GimpSplash *splash,
}
static GdkPixbufAnimation *
splash_image_load (gint max_width,
splash_image_load (Gimp *gimp,
gint max_width,
gint max_height,
gboolean be_verbose)
{
......@@ -484,6 +489,16 @@ splash_image_load (gint max_width,
GFile *file;
GList *list;
/* Random image in splash extensions. */
g_object_get (gimp->extension_manager,
"splash-paths", &list,
NULL);
animation = splash_image_pick_from_dirs (list,
max_width, max_height,
be_verbose);
if (animation)
return animation;
/* File "gimp-splash.png" in personal configuration directory. */
filename = gimp_personal_rc_file ("gimp-splash.png");
animation = splash_image_load_from_path (filename,
......
......@@ -19,7 +19,8 @@
#define __SPLASH_H__
void splash_create (gboolean be_verbose,
void splash_create (Gimp *gimp,
gboolean be_verbose,
GdkMonitor *mointor);
void splash_destroy (void);
......
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