mirror of
https://gitlab.gnome.org/GNOME/gimp
synced 2024-10-18 13:53:46 +00:00
Issue #2224 - Use the "Swap folder" setting for the GEGL cache
Move swap/cache and temporary files out the GIMP user config dir: libgimpbase: add gimp_cache_directory() and gimp_temp_directory() which return the new default values inside XDG_CACHE_HOME and the system temp directory. Like all directories from gimpenv.[ch] the values can be overridden by environment variables. Improve API docs for all functions returning directories. Add new config file substitutions ${gimp_cache_dir} and ${gimp_temp_dir}. Document all the new stuff in the gimp and gimprc manpages. app: default "swap-path" and "temp-path" to the new config file substitutions. On startup and config changes, make sure that the swap and temp directories actually exist. In the preferences dialog, add reset buttons to all file path pages.
This commit is contained in:
parent
9d34e9334f
commit
a29f73bd9a
|
@ -271,6 +271,14 @@ static const gchar *man_page_path =
|
||||||
"Path to configuration files, which is set to the value of the environment\n"
|
"Path to configuration files, which is set to the value of the environment\n"
|
||||||
"variable GIMP3_SYSCONFDIR or to the compiled-in default value \n"
|
"variable GIMP3_SYSCONFDIR or to the compiled-in default value \n"
|
||||||
"@gimpsysconfdir@.\n"
|
"@gimpsysconfdir@.\n"
|
||||||
|
".TP\n"
|
||||||
|
".I gimp_cache_dir\n"
|
||||||
|
"Path to cached files, which is set to the value of the environment\n"
|
||||||
|
"variable GIMP3_CACHEDIR or to the system default for per-user cached files.\n"
|
||||||
|
".TP\n"
|
||||||
|
".I gimp_temp_dir\n"
|
||||||
|
"Path to temporary files, which is set to the value of the environment\n"
|
||||||
|
"variable GIMP3_TEMPDIR or to the system default for temporary files.\n"
|
||||||
"\n";
|
"\n";
|
||||||
|
|
||||||
static const gchar man_page_footer[] =
|
static const gchar man_page_footer[] =
|
||||||
|
|
|
@ -119,7 +119,7 @@ gimp_gegl_config_class_init (GimpGeglConfigClass *klass)
|
||||||
"Temp path",
|
"Temp path",
|
||||||
TEMP_PATH_BLURB,
|
TEMP_PATH_BLURB,
|
||||||
GIMP_CONFIG_PATH_DIR,
|
GIMP_CONFIG_PATH_DIR,
|
||||||
"${gimp_dir}" G_DIR_SEPARATOR_S "tmp",
|
"${gimp_temp_dir}",
|
||||||
GIMP_PARAM_STATIC_STRINGS |
|
GIMP_PARAM_STATIC_STRINGS |
|
||||||
GIMP_CONFIG_PARAM_RESTART);
|
GIMP_CONFIG_PARAM_RESTART);
|
||||||
|
|
||||||
|
@ -128,7 +128,7 @@ gimp_gegl_config_class_init (GimpGeglConfigClass *klass)
|
||||||
"Swap path",
|
"Swap path",
|
||||||
SWAP_PATH_BLURB,
|
SWAP_PATH_BLURB,
|
||||||
GIMP_CONFIG_PATH_DIR,
|
GIMP_CONFIG_PATH_DIR,
|
||||||
"${gimp_dir}",
|
"${gimp_cache_dir}",
|
||||||
GIMP_PARAM_STATIC_STRINGS |
|
GIMP_PARAM_STATIC_STRINGS |
|
||||||
GIMP_CONFIG_PARAM_RESTART);
|
GIMP_CONFIG_PARAM_RESTART);
|
||||||
|
|
||||||
|
|
|
@ -98,6 +98,10 @@ static void prefs_color_management_reset (GtkWidget *widget,
|
||||||
GObject *config);
|
GObject *config);
|
||||||
static void prefs_dialog_defaults_reset (GtkWidget *widget,
|
static void prefs_dialog_defaults_reset (GtkWidget *widget,
|
||||||
GObject *config);
|
GObject *config);
|
||||||
|
static void prefs_folders_reset (GtkWidget *widget,
|
||||||
|
GObject *config);
|
||||||
|
static void prefs_path_reset (GtkWidget *widget,
|
||||||
|
GObject *config);
|
||||||
|
|
||||||
static void prefs_import_raw_procedure_callback (GtkWidget *widget,
|
static void prefs_import_raw_procedure_callback (GtkWidget *widget,
|
||||||
GObject *config);
|
GObject *config);
|
||||||
|
@ -485,6 +489,30 @@ prefs_dialog_defaults_reset (GtkWidget *widget,
|
||||||
g_free (pspecs);
|
g_free (pspecs);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
static void
|
||||||
|
prefs_folders_reset (GtkWidget *widget,
|
||||||
|
GObject *config)
|
||||||
|
{
|
||||||
|
gimp_config_reset_property (config, "temp-path");
|
||||||
|
gimp_config_reset_property (config, "swap-path");
|
||||||
|
}
|
||||||
|
|
||||||
|
static void
|
||||||
|
prefs_path_reset (GtkWidget *widget,
|
||||||
|
GObject *config)
|
||||||
|
{
|
||||||
|
const gchar *path_property;
|
||||||
|
const gchar *writable_property;
|
||||||
|
|
||||||
|
path_property = g_object_get_data (G_OBJECT (widget), "path");
|
||||||
|
writable_property = g_object_get_data (G_OBJECT (widget), "path-writable");
|
||||||
|
|
||||||
|
gimp_config_reset_property (config, path_property);
|
||||||
|
|
||||||
|
if (writable_property)
|
||||||
|
gimp_config_reset_property (config, writable_property);
|
||||||
|
}
|
||||||
|
|
||||||
static void
|
static void
|
||||||
prefs_template_select_callback (GimpContainerView *view,
|
prefs_template_select_callback (GimpContainerView *view,
|
||||||
GimpTemplate *template,
|
GimpTemplate *template,
|
||||||
|
@ -3060,6 +3088,13 @@ prefs_dialog_new (Gimp *gimp,
|
||||||
NULL,
|
NULL,
|
||||||
&top_iter);
|
&top_iter);
|
||||||
|
|
||||||
|
button = gimp_prefs_box_set_page_resettable (GIMP_PREFS_BOX (prefs_box),
|
||||||
|
vbox,
|
||||||
|
_("Reset Folders"));
|
||||||
|
g_signal_connect (button, "clicked",
|
||||||
|
G_CALLBACK (prefs_folders_reset),
|
||||||
|
config);
|
||||||
|
|
||||||
{
|
{
|
||||||
static const struct
|
static const struct
|
||||||
{
|
{
|
||||||
|
@ -3103,70 +3138,101 @@ prefs_dialog_new (Gimp *gimp,
|
||||||
const gchar *label;
|
const gchar *label;
|
||||||
const gchar *icon;
|
const gchar *icon;
|
||||||
const gchar *help_data;
|
const gchar *help_data;
|
||||||
|
const gchar *reset_label;
|
||||||
const gchar *fs_label;
|
const gchar *fs_label;
|
||||||
const gchar *path_property_name;
|
const gchar *path_property_name;
|
||||||
const gchar *writable_property_name;
|
const gchar *writable_property_name;
|
||||||
}
|
}
|
||||||
paths[] =
|
paths[] =
|
||||||
{
|
{
|
||||||
{ N_("Brushes"), N_("Brush Folders"), "folders-brushes",
|
{ N_("Brushes"), N_("Brush Folders"),
|
||||||
|
"folders-brushes",
|
||||||
GIMP_HELP_PREFS_FOLDERS_BRUSHES,
|
GIMP_HELP_PREFS_FOLDERS_BRUSHES,
|
||||||
|
N_("Reset Brush Folders"),
|
||||||
N_("Select Brush Folders"),
|
N_("Select Brush Folders"),
|
||||||
"brush-path", "brush-path-writable" },
|
"brush-path", "brush-path-writable" },
|
||||||
{ N_("Dynamics"), N_("Dynamics Folders"), "folders-dynamics",
|
{ N_("Dynamics"), N_("Dynamics Folders"),
|
||||||
|
"folders-dynamics",
|
||||||
GIMP_HELP_PREFS_FOLDERS_DYNAMICS,
|
GIMP_HELP_PREFS_FOLDERS_DYNAMICS,
|
||||||
|
N_("Reset Dynamics Folders"),
|
||||||
N_("Select Dynamics Folders"),
|
N_("Select Dynamics Folders"),
|
||||||
"dynamics-path", "dynamics-path-writable" },
|
"dynamics-path", "dynamics-path-writable" },
|
||||||
{ N_("Patterns"), N_("Pattern Folders"), "folders-patterns",
|
{ N_("Patterns"), N_("Pattern Folders"),
|
||||||
|
"folders-patterns",
|
||||||
GIMP_HELP_PREFS_FOLDERS_PATTERNS,
|
GIMP_HELP_PREFS_FOLDERS_PATTERNS,
|
||||||
|
N_("Reset Pattern Folders"),
|
||||||
N_("Select Pattern Folders"),
|
N_("Select Pattern Folders"),
|
||||||
"pattern-path", "pattern-path-writable" },
|
"pattern-path", "pattern-path-writable" },
|
||||||
{ N_("Palettes"), N_("Palette Folders"), "folders-palettes",
|
{ N_("Palettes"), N_("Palette Folders"),
|
||||||
|
"folders-palettes",
|
||||||
GIMP_HELP_PREFS_FOLDERS_PALETTES,
|
GIMP_HELP_PREFS_FOLDERS_PALETTES,
|
||||||
|
N_("Reset Palette Folders"),
|
||||||
N_("Select Palette Folders"),
|
N_("Select Palette Folders"),
|
||||||
"palette-path", "palette-path-writable" },
|
"palette-path", "palette-path-writable" },
|
||||||
{ N_("Gradients"), N_("Gradient Folders"), "folders-gradients",
|
{ N_("Gradients"), N_("Gradient Folders"),
|
||||||
|
"folders-gradients",
|
||||||
GIMP_HELP_PREFS_FOLDERS_GRADIENTS,
|
GIMP_HELP_PREFS_FOLDERS_GRADIENTS,
|
||||||
|
N_("Reset Gradient Folders"),
|
||||||
N_("Select Gradient Folders"),
|
N_("Select Gradient Folders"),
|
||||||
"gradient-path", "gradient-path-writable" },
|
"gradient-path", "gradient-path-writable" },
|
||||||
{ N_("Fonts"), N_("Font Folders"), "folders-fonts",
|
{ N_("Fonts"), N_("Font Folders"),
|
||||||
|
"folders-fonts",
|
||||||
GIMP_HELP_PREFS_FOLDERS_FONTS,
|
GIMP_HELP_PREFS_FOLDERS_FONTS,
|
||||||
|
N_("Reset Font Folders"),
|
||||||
N_("Select Font Folders"),
|
N_("Select Font Folders"),
|
||||||
"font-path", NULL },
|
"font-path", NULL },
|
||||||
{ N_("Tool Presets"), N_("Tool Preset Folders"), "folders-tool-presets",
|
{ N_("Tool Presets"), N_("Tool Preset Folders"),
|
||||||
|
"folders-tool-presets",
|
||||||
GIMP_HELP_PREFS_FOLDERS_TOOL_PRESETS,
|
GIMP_HELP_PREFS_FOLDERS_TOOL_PRESETS,
|
||||||
|
N_("Reset Tool Preset Folders"),
|
||||||
N_("Select Tool Preset Folders"),
|
N_("Select Tool Preset Folders"),
|
||||||
"tool-preset-path", "tool-preset-path-writable" },
|
"tool-preset-path", "tool-preset-path-writable" },
|
||||||
{ N_("MyPaint Brushes"), N_("MyPaint Brush Folders"), "folders-mypaint-brushes",
|
{ N_("MyPaint Brushes"), N_("MyPaint Brush Folders"),
|
||||||
|
"folders-mypaint-brushes",
|
||||||
GIMP_HELP_PREFS_FOLDERS_MYPAINT_BRUSHES,
|
GIMP_HELP_PREFS_FOLDERS_MYPAINT_BRUSHES,
|
||||||
|
N_("Reset MyPaint Brush Folders"),
|
||||||
N_("Select MyPaint Brush Folders"),
|
N_("Select MyPaint Brush Folders"),
|
||||||
"mypaint-brush-path", "mypaint-brush-path-writable" },
|
"mypaint-brush-path", "mypaint-brush-path-writable" },
|
||||||
{ N_("Plug-ins"), N_("Plug-in Folders"), "folders-plug-ins",
|
{ N_("Plug-ins"), N_("Plug-in Folders"),
|
||||||
|
"folders-plug-ins",
|
||||||
GIMP_HELP_PREFS_FOLDERS_PLUG_INS,
|
GIMP_HELP_PREFS_FOLDERS_PLUG_INS,
|
||||||
|
N_("Reset plug-in Folders"),
|
||||||
N_("Select plug-in Folders"),
|
N_("Select plug-in Folders"),
|
||||||
"plug-in-path", NULL },
|
"plug-in-path", NULL },
|
||||||
{ N_("Scripts"), N_("Script-Fu Folders"), "folders-scripts",
|
{ N_("Scripts"), N_("Script-Fu Folders"),
|
||||||
|
"folders-scripts",
|
||||||
GIMP_HELP_PREFS_FOLDERS_SCRIPTS,
|
GIMP_HELP_PREFS_FOLDERS_SCRIPTS,
|
||||||
|
N_("Reset Script-Fu Folders"),
|
||||||
N_("Select Script-Fu Folders"),
|
N_("Select Script-Fu Folders"),
|
||||||
"script-fu-path", NULL },
|
"script-fu-path", NULL },
|
||||||
{ N_("Modules"), N_("Module Folders"), "folders-modules",
|
{ N_("Modules"), N_("Module Folders"),
|
||||||
|
"folders-modules",
|
||||||
GIMP_HELP_PREFS_FOLDERS_MODULES,
|
GIMP_HELP_PREFS_FOLDERS_MODULES,
|
||||||
|
N_("Reset Module Folders"),
|
||||||
N_("Select Module Folders"),
|
N_("Select Module Folders"),
|
||||||
"module-path", NULL },
|
"module-path", NULL },
|
||||||
{ N_("Interpreters"), N_("Interpreter Folders"), "folders-interp",
|
{ N_("Interpreters"), N_("Interpreter Folders"),
|
||||||
|
"folders-interp",
|
||||||
GIMP_HELP_PREFS_FOLDERS_INTERPRETERS,
|
GIMP_HELP_PREFS_FOLDERS_INTERPRETERS,
|
||||||
|
N_("Reset Interpreter Folders"),
|
||||||
N_("Select Interpreter Folders"),
|
N_("Select Interpreter Folders"),
|
||||||
"interpreter-path", NULL },
|
"interpreter-path", NULL },
|
||||||
{ N_("Environment"), N_("Environment Folders"), "folders-environ",
|
{ N_("Environment"), N_("Environment Folders"),
|
||||||
|
"folders-environ",
|
||||||
GIMP_HELP_PREFS_FOLDERS_ENVIRONMENT,
|
GIMP_HELP_PREFS_FOLDERS_ENVIRONMENT,
|
||||||
|
N_("Reset Environment Folders"),
|
||||||
N_("Select Environment Folders"),
|
N_("Select Environment Folders"),
|
||||||
"environ-path", NULL },
|
"environ-path", NULL },
|
||||||
{ N_("Themes"), N_("Theme Folders"), "folders-themes",
|
{ N_("Themes"), N_("Theme Folders"),
|
||||||
|
"folders-themes",
|
||||||
GIMP_HELP_PREFS_FOLDERS_THEMES,
|
GIMP_HELP_PREFS_FOLDERS_THEMES,
|
||||||
|
N_("Reset Theme Folders"),
|
||||||
N_("Select Theme Folders"),
|
N_("Select Theme Folders"),
|
||||||
"theme-path", NULL },
|
"theme-path", NULL },
|
||||||
{ N_("Icon Themes"), N_("Icon Theme Folders"), "folders-icon-themes",
|
{ N_("Icon Themes"), N_("Icon Theme Folders"),
|
||||||
|
"folders-icon-themes",
|
||||||
GIMP_HELP_PREFS_FOLDERS_ICON_THEMES,
|
GIMP_HELP_PREFS_FOLDERS_ICON_THEMES,
|
||||||
|
N_("Reset Icon Theme Folders"),
|
||||||
N_("Select Icon Theme Folders"),
|
N_("Select Icon Theme Folders"),
|
||||||
"icon-theme-path", NULL }
|
"icon-theme-path", NULL }
|
||||||
};
|
};
|
||||||
|
@ -3186,6 +3252,17 @@ prefs_dialog_new (Gimp *gimp,
|
||||||
&child_iter);
|
&child_iter);
|
||||||
g_free (icon_name);
|
g_free (icon_name);
|
||||||
|
|
||||||
|
button = gimp_prefs_box_set_page_resettable (GIMP_PREFS_BOX (prefs_box),
|
||||||
|
vbox,
|
||||||
|
gettext (paths[i].reset_label));
|
||||||
|
g_object_set_data (G_OBJECT (button), "path",
|
||||||
|
(gpointer) paths[i].path_property_name);
|
||||||
|
g_object_set_data (G_OBJECT (button), "path-writable",
|
||||||
|
(gpointer) paths[i].writable_property_name);
|
||||||
|
g_signal_connect (button, "clicked",
|
||||||
|
G_CALLBACK (prefs_path_reset),
|
||||||
|
config);
|
||||||
|
|
||||||
editor = gimp_prop_path_editor_new (object,
|
editor = gimp_prop_path_editor_new (object,
|
||||||
paths[i].path_property_name,
|
paths[i].path_property_name,
|
||||||
paths[i].writable_property_name,
|
paths[i].writable_property_name,
|
||||||
|
|
|
@ -23,6 +23,8 @@
|
||||||
#include <gio/gio.h>
|
#include <gio/gio.h>
|
||||||
#include <gegl.h>
|
#include <gegl.h>
|
||||||
|
|
||||||
|
#include "libgimpconfig/gimpconfig.h"
|
||||||
|
|
||||||
#include "gimp-gegl-types.h"
|
#include "gimp-gegl-types.h"
|
||||||
|
|
||||||
#include "config/gimpgeglconfig.h"
|
#include "config/gimpgeglconfig.h"
|
||||||
|
@ -35,12 +37,17 @@
|
||||||
#include "gimp-babl.h"
|
#include "gimp-babl.h"
|
||||||
#include "gimp-gegl.h"
|
#include "gimp-gegl.h"
|
||||||
|
|
||||||
|
#include <operation/gegl-operation.h>
|
||||||
|
|
||||||
|
|
||||||
|
static void gimp_gegl_notify_swap_path (GimpGeglConfig *config);
|
||||||
|
static void gimp_gegl_notify_temp_path (GimpGeglConfig *config);
|
||||||
static void gimp_gegl_notify_tile_cache_size (GimpGeglConfig *config);
|
static void gimp_gegl_notify_tile_cache_size (GimpGeglConfig *config);
|
||||||
static void gimp_gegl_notify_num_processors (GimpGeglConfig *config);
|
static void gimp_gegl_notify_num_processors (GimpGeglConfig *config);
|
||||||
static void gimp_gegl_notify_use_opencl (GimpGeglConfig *config);
|
static void gimp_gegl_notify_use_opencl (GimpGeglConfig *config);
|
||||||
|
|
||||||
#include <operation/gegl-operation.h>
|
|
||||||
|
/* public functions */
|
||||||
|
|
||||||
void
|
void
|
||||||
gimp_gegl_init (Gimp *gimp)
|
gimp_gegl_init (Gimp *gimp)
|
||||||
|
@ -51,6 +58,10 @@ gimp_gegl_init (Gimp *gimp)
|
||||||
|
|
||||||
config = GIMP_GEGL_CONFIG (gimp->config);
|
config = GIMP_GEGL_CONFIG (gimp->config);
|
||||||
|
|
||||||
|
/* make sure swap and temp directories exist */
|
||||||
|
gimp_gegl_notify_swap_path (config);
|
||||||
|
gimp_gegl_notify_temp_path (config);
|
||||||
|
|
||||||
g_object_set (gegl_config (),
|
g_object_set (gegl_config (),
|
||||||
"tile-cache-size", (guint64) config->tile_cache_size,
|
"tile-cache-size", (guint64) config->tile_cache_size,
|
||||||
"threads", config->num_processors,
|
"threads", config->num_processors,
|
||||||
|
@ -59,6 +70,15 @@ gimp_gegl_init (Gimp *gimp)
|
||||||
|
|
||||||
gimp_parallel_init (gimp);
|
gimp_parallel_init (gimp);
|
||||||
|
|
||||||
|
g_signal_connect (config, "notify::swap-path",
|
||||||
|
G_CALLBACK (gimp_gegl_notify_swap_path),
|
||||||
|
NULL);
|
||||||
|
g_signal_connect (config, "notify::temp-path",
|
||||||
|
G_CALLBACK (gimp_gegl_notify_temp_path),
|
||||||
|
NULL);
|
||||||
|
g_signal_connect (config, "notify::num-processors",
|
||||||
|
G_CALLBACK (gimp_gegl_notify_num_processors),
|
||||||
|
NULL);
|
||||||
g_signal_connect (config, "notify::tile-cache-size",
|
g_signal_connect (config, "notify::tile-cache-size",
|
||||||
G_CALLBACK (gimp_gegl_notify_tile_cache_size),
|
G_CALLBACK (gimp_gegl_notify_tile_cache_size),
|
||||||
NULL);
|
NULL);
|
||||||
|
@ -82,6 +102,37 @@ gimp_gegl_exit (Gimp *gimp)
|
||||||
gimp_parallel_exit (gimp);
|
gimp_parallel_exit (gimp);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
/* private functions */
|
||||||
|
|
||||||
|
static void
|
||||||
|
gimp_gegl_notify_swap_path (GimpGeglConfig *config)
|
||||||
|
{
|
||||||
|
GFile *file = gimp_file_new_for_config_path (config->swap_path, NULL);
|
||||||
|
gchar *path = g_file_get_path (file);
|
||||||
|
|
||||||
|
if (! g_file_query_exists (file, NULL))
|
||||||
|
g_file_make_directory_with_parents (file, NULL, NULL);
|
||||||
|
|
||||||
|
g_object_set (gegl_config (),
|
||||||
|
"swap", path,
|
||||||
|
NULL);
|
||||||
|
|
||||||
|
g_free (path);
|
||||||
|
g_object_unref (file);
|
||||||
|
}
|
||||||
|
|
||||||
|
static void
|
||||||
|
gimp_gegl_notify_temp_path (GimpGeglConfig *config)
|
||||||
|
{
|
||||||
|
GFile *file = gimp_file_new_for_config_path (config->temp_path, NULL);
|
||||||
|
|
||||||
|
if (! g_file_query_exists (file, NULL))
|
||||||
|
g_file_make_directory_with_parents (file, NULL, NULL);
|
||||||
|
|
||||||
|
g_object_unref (file);
|
||||||
|
}
|
||||||
|
|
||||||
static void
|
static void
|
||||||
gimp_gegl_notify_tile_cache_size (GimpGeglConfig *config)
|
gimp_gegl_notify_tile_cache_size (GimpGeglConfig *config)
|
||||||
{
|
{
|
||||||
|
|
|
@ -171,6 +171,14 @@ to get the base location for plug-ins and modules. If unset
|
||||||
.B GIMP3_SYSCONFDIR
|
.B GIMP3_SYSCONFDIR
|
||||||
to get the location of configuration files. If unset @gimpsysconfdir@
|
to get the location of configuration files. If unset @gimpsysconfdir@
|
||||||
is used.
|
is used.
|
||||||
|
.TP 8
|
||||||
|
.B GIMP3_CACHEDIR
|
||||||
|
to get the location for caches files. If unset the system default for
|
||||||
|
per-user cached files is used.
|
||||||
|
.TP 8
|
||||||
|
.B GIMP3_TEMPDIR
|
||||||
|
to get the location of temporary files. If unset the system default for
|
||||||
|
temporary files is used.
|
||||||
|
|
||||||
On Linux GIMP can be compiled with support for binary relocatibility.
|
On Linux GIMP can be compiled with support for binary relocatibility.
|
||||||
This will cause data, plug-ins and configuration files to be searched
|
This will cause data, plug-ins and configuration files to be searched
|
||||||
|
|
|
@ -6,6 +6,7 @@ EXPORTS
|
||||||
gimp_blend_mode_get_type
|
gimp_blend_mode_get_type
|
||||||
gimp_brush_generated_shape_get_type
|
gimp_brush_generated_shape_get_type
|
||||||
gimp_bucket_fill_mode_get_type
|
gimp_bucket_fill_mode_get_type
|
||||||
|
gimp_cache_directory
|
||||||
gimp_canonicalize_identifier
|
gimp_canonicalize_identifier
|
||||||
gimp_cap_style_get_type
|
gimp_cap_style_get_type
|
||||||
gimp_channel_ops_get_type
|
gimp_channel_ops_get_type
|
||||||
|
@ -152,6 +153,7 @@ EXPORTS
|
||||||
gimp_stroke_method_get_type
|
gimp_stroke_method_get_type
|
||||||
gimp_sysconf_directory
|
gimp_sysconf_directory
|
||||||
gimp_sysconf_directory_file
|
gimp_sysconf_directory_file
|
||||||
|
gimp_temp_directory
|
||||||
gimp_text_direction_get_type
|
gimp_text_direction_get_type
|
||||||
gimp_text_hint_style_get_type
|
gimp_text_hint_style_get_type
|
||||||
gimp_text_justification_get_type
|
gimp_text_justification_get_type
|
||||||
|
|
|
@ -199,6 +199,9 @@ gimp_env_init (gboolean plug_in)
|
||||||
* In any case, we always return some non-empty string, whether it
|
* In any case, we always return some non-empty string, whether it
|
||||||
* corresponds to an existing directory or not.
|
* corresponds to an existing directory or not.
|
||||||
*
|
*
|
||||||
|
* In config files such as gimprc, the string ${gimp_dir} expands to
|
||||||
|
* this directory.
|
||||||
|
*
|
||||||
* The returned string is owned by GIMP and must not be modified or
|
* The returned string is owned by GIMP and must not be modified or
|
||||||
* freed. The returned string is in the encoding used for filenames by
|
* freed. The returned string is in the encoding used for filenames by
|
||||||
* GLib, which isn't necessarily UTF-8 (on Windows it is always
|
* GLib, which isn't necessarily UTF-8 (on Windows it is always
|
||||||
|
@ -371,6 +374,9 @@ DllMain (HINSTANCE hinstDLL,
|
||||||
* filename is used. On OSX we ask [NSBundle mainBundle] for the
|
* filename is used. On OSX we ask [NSBundle mainBundle] for the
|
||||||
* resource path to check if GIMP is part of a relocatable bundle.
|
* resource path to check if GIMP is part of a relocatable bundle.
|
||||||
*
|
*
|
||||||
|
* In config files such as gimprc, the string ${gimp_installation_dir}
|
||||||
|
* expands to this directory.
|
||||||
|
*
|
||||||
* The returned string is owned by GIMP and must not be modified or
|
* The returned string is owned by GIMP and must not be modified or
|
||||||
* freed. The returned string is in the encoding used for filenames by
|
* freed. The returned string is in the encoding used for filenames by
|
||||||
* GLib, which isn't necessarily UTF-8. (On Windows it always is
|
* GLib, which isn't necessarily UTF-8. (On Windows it always is
|
||||||
|
@ -460,11 +466,17 @@ gimp_installation_directory (void)
|
||||||
/**
|
/**
|
||||||
* gimp_data_directory:
|
* gimp_data_directory:
|
||||||
*
|
*
|
||||||
* Returns the top directory for GIMP data. If the environment
|
* Returns the default top directory for GIMP data. If the environment
|
||||||
* variable GIMP3_DATADIR exists, that is used. It should be an
|
* variable GIMP3_DATADIR exists, that is used. It should be an
|
||||||
* absolute pathname. Otherwise, on Unix the compile-time defined
|
* absolute pathname. Otherwise, on Unix the compile-time defined
|
||||||
* directory is used. On Windows, the installation directory as deduced
|
* directory is used. On Windows, the installation directory as
|
||||||
* from the executable's full filename is used.
|
* deduced from the executable's full filename is used.
|
||||||
|
*
|
||||||
|
* Note that the actual directories used for GIMP data files can be
|
||||||
|
* overridden by the user in the preferences dialog.
|
||||||
|
*
|
||||||
|
* In config files such as gimprc, the string ${gimp_data_dir} expands
|
||||||
|
* to this directory.
|
||||||
*
|
*
|
||||||
* The returned string is owned by GIMP and must not be modified or
|
* The returned string is owned by GIMP and must not be modified or
|
||||||
* freed. The returned string is in the encoding used for filenames by
|
* freed. The returned string is in the encoding used for filenames by
|
||||||
|
@ -550,6 +562,9 @@ gimp_locale_directory (void)
|
||||||
* directory is used. On Windows, the installation directory as deduced
|
* directory is used. On Windows, the installation directory as deduced
|
||||||
* from the executable's full filename is used.
|
* from the executable's full filename is used.
|
||||||
*
|
*
|
||||||
|
* In config files such as gimprc, the string ${gimp_sysconf_dir}
|
||||||
|
* expands to this directory.
|
||||||
|
*
|
||||||
* The returned string is owned by GIMP and must not be modified or
|
* The returned string is owned by GIMP and must not be modified or
|
||||||
* freed. The returned string is in the encoding used for filenames by
|
* freed. The returned string is in the encoding used for filenames by
|
||||||
* GLib, which isn't necessarily UTF-8. (On Windows it always is
|
* GLib, which isn't necessarily UTF-8. (On Windows it always is
|
||||||
|
@ -579,11 +594,17 @@ gimp_sysconf_directory (void)
|
||||||
/**
|
/**
|
||||||
* gimp_plug_in_directory:
|
* gimp_plug_in_directory:
|
||||||
*
|
*
|
||||||
* Returns the top directory for GIMP plug_ins and modules. If the
|
* Returns the default top directory for GIMP plug-ins and modules. If
|
||||||
* environment variable GIMP3_PLUGINDIR exists, that is used. It
|
* the environment variable GIMP3_PLUGINDIR exists, that is used. It
|
||||||
* should be an absolute pathname. Otherwise, on Unix the compile-time
|
* should be an absolute pathname. Otherwise, on Unix the compile-time
|
||||||
* defined directory is used. On Windows, the installation directory as
|
* defined directory is used. On Windows, the installation directory
|
||||||
* deduced from the executable's full filename is used.
|
* as deduced from the executable's full filename is used.
|
||||||
|
*
|
||||||
|
* Note that the actual directories used for GIMP plug-ins and modules
|
||||||
|
* can be overridden by the user in the preferences dialog.
|
||||||
|
*
|
||||||
|
* In config files such as gimprc, the string ${gimp_plug_in_dir}
|
||||||
|
* expands to this directory.
|
||||||
*
|
*
|
||||||
* The returned string is owned by GIMP and must not be modified or
|
* The returned string is owned by GIMP and must not be modified or
|
||||||
* freed. The returned string is in the encoding used for filenames by
|
* freed. The returned string is in the encoding used for filenames by
|
||||||
|
@ -611,6 +632,90 @@ gimp_plug_in_directory (void)
|
||||||
return gimp_plug_in_dir;
|
return gimp_plug_in_dir;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* gimp_cache_directory:
|
||||||
|
*
|
||||||
|
* Returns the default top directory for GIMP cached files. If the
|
||||||
|
* environment variable GIMP3_CACHEDIR exists, that is used. It
|
||||||
|
* should be an absolute pathname. Otherwise, a subdirectory of the
|
||||||
|
* directory returned by g_get_user_cache_dir() is used.
|
||||||
|
*
|
||||||
|
* Note that the actual directories used for GIMP caches files can
|
||||||
|
* be overridden by the user in the preferences dialog.
|
||||||
|
*
|
||||||
|
* In config files such as gimprc, the string ${gimp_cache_dir}
|
||||||
|
* expands to this directory.
|
||||||
|
*
|
||||||
|
* The returned string is owned by GIMP and must not be modified or
|
||||||
|
* freed. The returned string is in the encoding used for filenames by
|
||||||
|
* GLib, which isn't necessarily UTF-8. (On Windows it always is
|
||||||
|
* UTF-8.).
|
||||||
|
*
|
||||||
|
* Since: 2.10.10
|
||||||
|
*
|
||||||
|
* Returns: The default top directory for GIMP cached files.
|
||||||
|
**/
|
||||||
|
const gchar *
|
||||||
|
gimp_cache_directory (void)
|
||||||
|
{
|
||||||
|
static gchar *gimp_cache_dir = NULL;
|
||||||
|
|
||||||
|
if (! gimp_cache_dir)
|
||||||
|
{
|
||||||
|
gchar *tmp = g_build_filename (g_get_user_cache_dir (),
|
||||||
|
GIMP_PACKAGE,
|
||||||
|
GIMP_USER_VERSION,
|
||||||
|
NULL);
|
||||||
|
|
||||||
|
gimp_cache_dir = gimp_env_get_dir ("GIMP3_CACHEDIR", NULL, tmp);
|
||||||
|
g_free (tmp);
|
||||||
|
}
|
||||||
|
|
||||||
|
return gimp_cache_dir;
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* gimp_temp_directory:
|
||||||
|
*
|
||||||
|
* Returns the default top directory for GIMP temporary files. If the
|
||||||
|
* environment variable GIMP3_TEMPDIR exists, that is used. It
|
||||||
|
* should be an absolute pathname. Otherwise, a subdirectory of the
|
||||||
|
* directory returned by g_get_tmp_dir() is used.
|
||||||
|
*
|
||||||
|
* In config files such as gimprc, the string ${gimp_temp_dir} expands
|
||||||
|
* to this directory.
|
||||||
|
*
|
||||||
|
* Note that the actual directories used for GIMP temporary files can
|
||||||
|
* be overridden by the user in the preferences dialog.
|
||||||
|
*
|
||||||
|
* The returned string is owned by GIMP and must not be modified or
|
||||||
|
* freed. The returned string is in the encoding used for filenames by
|
||||||
|
* GLib, which isn't necessarily UTF-8. (On Windows it always is
|
||||||
|
* UTF-8.).
|
||||||
|
*
|
||||||
|
* Since: 2.10.10
|
||||||
|
*
|
||||||
|
* Returns: The default top directory for GIMP temporary files.
|
||||||
|
**/
|
||||||
|
const gchar *
|
||||||
|
gimp_temp_directory (void)
|
||||||
|
{
|
||||||
|
static gchar *gimp_temp_dir = NULL;
|
||||||
|
|
||||||
|
if (! gimp_temp_dir)
|
||||||
|
{
|
||||||
|
gchar *tmp = g_build_filename (g_get_tmp_dir (),
|
||||||
|
GIMP_PACKAGE,
|
||||||
|
GIMP_USER_VERSION,
|
||||||
|
NULL);
|
||||||
|
|
||||||
|
gimp_temp_dir = gimp_env_get_dir ("GIMP3_TEMPDIR", NULL, tmp);
|
||||||
|
g_free (tmp);
|
||||||
|
}
|
||||||
|
|
||||||
|
return gimp_temp_dir;
|
||||||
|
}
|
||||||
|
|
||||||
static GFile *
|
static GFile *
|
||||||
gimp_child_file (const gchar *parent,
|
gimp_child_file (const gchar *parent,
|
||||||
const gchar *element,
|
const gchar *element,
|
||||||
|
@ -1103,8 +1208,12 @@ gimp_env_get_dir (const gchar *gimp_env_name,
|
||||||
|
|
||||||
return retval;
|
return retval;
|
||||||
}
|
}
|
||||||
|
else if (! g_path_is_absolute (relative_subdir))
|
||||||
|
{
|
||||||
|
return g_build_filename (gimp_installation_directory (),
|
||||||
|
relative_subdir,
|
||||||
|
NULL);
|
||||||
|
}
|
||||||
|
|
||||||
return g_build_filename (gimp_installation_directory (),
|
return g_strdup (relative_subdir);
|
||||||
relative_subdir,
|
|
||||||
NULL);
|
|
||||||
}
|
}
|
||||||
|
|
|
@ -53,6 +53,8 @@ const gchar * gimp_data_directory (void) G_GNUC_CONST;
|
||||||
const gchar * gimp_locale_directory (void) G_GNUC_CONST;
|
const gchar * gimp_locale_directory (void) G_GNUC_CONST;
|
||||||
const gchar * gimp_sysconf_directory (void) G_GNUC_CONST;
|
const gchar * gimp_sysconf_directory (void) G_GNUC_CONST;
|
||||||
const gchar * gimp_plug_in_directory (void) G_GNUC_CONST;
|
const gchar * gimp_plug_in_directory (void) G_GNUC_CONST;
|
||||||
|
const gchar * gimp_cache_directory (void) G_GNUC_CONST;
|
||||||
|
const gchar * gimp_temp_directory (void) G_GNUC_CONST;
|
||||||
|
|
||||||
GFile * gimp_directory_file (const gchar *first_element,
|
GFile * gimp_directory_file (const gchar *first_element,
|
||||||
...) G_GNUC_MALLOC;
|
...) G_GNUC_MALLOC;
|
||||||
|
|
|
@ -566,6 +566,10 @@ gimp_config_path_expand_only (const gchar *path,
|
||||||
s = gimp_sysconf_directory ();
|
s = gimp_sysconf_directory ();
|
||||||
else if (strcmp (token, "gimp_installation_dir") == 0)
|
else if (strcmp (token, "gimp_installation_dir") == 0)
|
||||||
s = gimp_installation_directory ();
|
s = gimp_installation_directory ();
|
||||||
|
else if (strcmp (token, "gimp_cache_dir") == 0)
|
||||||
|
s = gimp_cache_directory ();
|
||||||
|
else if (strcmp (token, "gimp_temp_dir") == 0)
|
||||||
|
s = gimp_temp_directory ();
|
||||||
|
|
||||||
if (!s)
|
if (!s)
|
||||||
s = g_getenv (token);
|
s = g_getenv (token);
|
||||||
|
@ -697,6 +701,8 @@ gimp_config_path_unexpand_only (const gchar *path)
|
||||||
{ "${gimp_data_dir}", gimp_data_directory () },
|
{ "${gimp_data_dir}", gimp_data_directory () },
|
||||||
{ "${gimp_sysconf_dir}", gimp_sysconf_directory () },
|
{ "${gimp_sysconf_dir}", gimp_sysconf_directory () },
|
||||||
{ "${gimp_installation_dir}", gimp_installation_directory () },
|
{ "${gimp_installation_dir}", gimp_installation_directory () },
|
||||||
|
{ "${gimp_cache_dir}", gimp_cache_directory () },
|
||||||
|
{ "${gimp_temp_dir}", gimp_temp_directory () },
|
||||||
{ "${gimp_dir}", gimp_directory () }
|
{ "${gimp_dir}", gimp_directory () }
|
||||||
};
|
};
|
||||||
|
|
||||||
|
|
Loading…
Reference in a new issue