Commit Graph

356 Commits

Author SHA1 Message Date
Michael Natterer d7d281bd97 libgimpconfig: fix previous commit to return the right error token 2019-06-20 15:01:29 +02:00
sarah f19844d0d1 enhancement: validate reference argument of gimp_scanner_parse_string before using it 2019-06-20 06:04:30 +00:00
Jehan 613bf7c5ab app, libgimpconfig: make various usage of g_file_replace() safer.
When an error occurs, we want to prevent overwriting any previous
version of the file by incomplete contents. So run
g_output_stream_close() with a cancelled GCancellable to do so.
See also discussion in #2565.
2018-11-26 15:50:38 +01:00
Michael Natterer a29f73bd9a 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.
2018-11-18 18:10:34 +01:00
Ell 3b0040c043 app, libgimp*, modules: don't use g_type_class_add_private() ...
... and G_TYPE_INSTANCE_GET_PRIVATE()

g_type_class_add_private() and G_TYPE_INSTANCE_GET_PRIVATE() were
deprecated in GLib 2.58.  Instead, use
G_DEFINE_[ABSTRACT_]TYPE_WITH_PRIVATE(), and
G_ADD_PRIVATE[_DYNAMIC](), and the implictly-defined
foo_get_instance_private() functions, all of which are available in
the GLib versions we depend on.

This commit only covers types registered using one of the
G_DEFINE_FOO() macros (i.e., most types), but not types with a
custom registration function, of which we still have a few -- GLib
currently only provides a (non-deprecated) public API for adding a
private struct using the G_DEFINE_FOO() macros.

Note that this commit was 99% auto-generated (because I'm not
*that* crazy :), so if there are any style mismatches... we'll have
to live with them for now.
2018-09-18 14:39:56 -04:00
Jehan bc427479e0 libgimpconfig: update some description comments.
Second parameter of gimp_scanner_parse_token() and
gimp_scanner_parse_identifier() is not a return value. It is a value to
compare with.
2018-07-17 19:45:51 +02:00
Michael Natterer 5f700549e7 Change the license URL from http://www.gnu.org/licenses/ to https:// 2018-07-11 23:29:46 +02:00
Ell 3b228afdbe libgimpconfig: allow writing empty data in gimp_config_writer_data() 2018-07-05 22:47:45 -04:00
Jehan a411ee7c38 libgimpconfig: forgot to update gimpconfig.def AGAIN!
Aaaaargh!
2018-07-03 02:01:20 +02:00
Jehan 9c05f10368 libgimpconfig: new API gimp_config_build_system_path().
This is the complementary of gimp_config_build_writable_path() to
properly get the system vs. user directories.
2018-07-02 21:16:14 +02:00
Ell e47ffefab2 libgimpcolor, libgimpconfig: remove deprecated interface functions
Remove the deprectaed foo_interface_get_type() functions, as per
the last two commits.
2018-05-27 05:59:39 -04:00
Ell 5f8643a6ee libgimpconfig: align GimpConfig with the rest of the interfaces
Unlike the last two commits, we don't port GimpConfig to
G_DEFINE_INTERFACE(), since we need to provide a base initializer
for it.  However, this commit aligns it with the rest of our
intefaces, by renaming gimp_config_interface_get_type() to
gimp_config_get_type(), and by performing class initialization for
the interface in a separate function than base initialization.

Keep gimp_config_interface_get_type() around as a deprecated
function, to maintain ABI compatibility.  It will be removed in a
separate commit in master, so that this commit can be easily
cherry-picked to gimp-2-10.
2018-05-27 05:56:34 -04:00
Michael Natterer 7990b1d57c libgimp: update all .def files 2018-05-25 22:13:33 +02:00
Michael Natterer bb2a9d119f libgimpconfig: move all GimpColorConfig members to private 2018-05-20 21:06:33 +02:00
Michael Natterer f4f106ad26 libimp*: add private pointers to all instance structs
even if we don't have private members (yet). Also make class padding 8
pointers in all headers. This commit moves nothing to private, it just
makes all headers consistent and adjusts .c files accordigly.
2018-05-20 21:06:33 +02:00
Michael Natterer 86e3f31a03 libgimpconfig: remove all deprecated cruft 2018-05-20 21:06:29 +02:00
luz.paz 69b2e84924 Source and trivial typos
Found via `codespell` and `grep`
2018-05-12 23:44:47 +02:00
Jehan d4404aa4bc libgimpconfig: fix the fix of the fix!
So apparently, it's "parenthesis" in singular.
Cf. commit 1b44812ab1.
2018-04-26 01:10:55 +02:00
Jehan 1b44812ab1 libgimpconfig: fix wrong typo fix.
Actually after re-reviewing previous commit, I found at least one wrong
fix in commit 4a77ff2d3d.
s/the opening parentheses/the opening parenthese/
2018-04-25 23:53:45 +02:00
luz.paz 4a77ff2d3d Bug 795557 - Misc. typo fixes in source, comments and doxygen (pt3)
Found via `codespell` and grep.
2018-04-25 23:49:06 +02:00
Jehan 08cc37271f libgimpconfig: create parent directories for config file if necessary.
The directory should be already created by GIMP. But just in case it is
not there, for whatever reason, don't just fail. Try and create all
parents.
2018-04-22 22:17:28 +02:00
Michael Natterer b021909a63 libgimpconfig: use g_object_new_with_properties() instead of g_object_newv() 2018-01-02 13:14:42 +01:00
Ell f7d6805ebb */Makefile.am: add abbreviations to generated enum files
Update the dprod production of generated enum files to include
abbreviated value descriptions, as per the previous commits.

Add a comment for translators above the abbreviated descriptions,
specifying the full description they abbreviate.
2017-11-30 03:10:14 -05:00
Ell 58fdaae3ad enums: add intermediate generated enum files to .gitignore 2017-08-24 15:35:27 -04:00
Michael Natterer 4a5b740828 libgimpconfig: add GIMP_CONFIG_PROP_INT64() and GIMP_CONFIG_PROP_UINT64()
While all serialize and deserialize code is supporting 64-bit ints for
quite a while, we didn't have convenience macros to install properties.
2017-07-23 15:17:12 +02:00
Jehan 7999cfbeef libgimp*: tab cleaning. 2017-06-17 11:38:18 +02:00
Michael Natterer caef6d0deb libgimp*: various doc fixes 2017-06-03 21:22:12 +02:00
Ell 3ca48a0b30 enums: don't use comments in generated enum recipes
Works in bash, but apparently not portable.
2017-06-02 11:15:43 -04:00
Ell f16ba7d1a7 libgimpconfig: remove negative value handling from gimp_scanner_parse_color()
Handled internally by gimp_scanner_parse_float(), since last commit.
2017-05-27 16:40:26 -04:00
Ell b8505a4eac libgimpconfig: fix negative float parsing 2017-05-27 15:50:56 -04:00
Ell 5bcde32caf enums: run gimp-mkenums from the build dir
Commit 1e6acbd4e1 modified the
generated enum recipes to run gimp-mkenums from the source
directory, instead of the build directory, so that only the
basenames of the corresponding header files would appear in
the comment at the top of the generated files.  This was a
mistake -- $(GIMP_MKENUMS) is expecting to be invoked from the
build directory.

Switch back to running gimp-mkenums from the build directory.  To
avoid including the relative path from the build directory to the
source directory in the generated file, add a @basename@ production
variable to gimp-mkenums, which exapnds to the basename of the
input file, and use it instead of @filename@ in the recipes for the
generated enum files.
2017-05-22 20:29:18 -04:00
Ell f9fa0d1b18 enums: don't write generated enum files to src-dir if unchanged
When regenerating an enum file, don't copy it back to the source
directory if it hasn't actually changed.  This allows using a read-
only source directory where the enum header is newer than the
generated file, as long as they're not really out of sync.

OTOH, *do* touch the generated source-dir file even when unchanged,
in order to avoid re-running its recipe on the next build, however,
allow this to silently fail (which is harmless).
2017-05-22 17:58:04 -04:00
Michael Natterer 05874c1268 libgimpconfig: don't gimp_rgb_clamp() in gimp_scanner_parse_color()
so config files can now contain oog RGB values too.
2017-05-19 02:05:57 +02:00
Michael Natterer f807cbe10b libgimpconfig: change GimpColorConfig's out-of-gamut color to magenta
I have no clue why it was some gray.
2017-05-16 22:43:21 +02:00
Ell 1e6acbd4e1 enums: generate enum files in source dir
We check them into git, so this makes it easier to keep them in
sync when using a separate build directory.

Case in point -- this commit also syncs a few enum files that went
out-of-sync with their headers.
2017-05-06 17:26:16 -04:00
Michael Natterer 7111eadf3b libgimpconfig: gimp_config_reset_properties(): reset only changed properties
This avoids a lot of useless notifications when resetting an object,
and fixes e.g. the "reset tool options" behavior of GimpTransformTool,
which did completely reset itself instead of just behaving like all
non-default options had changed.

And probably breaks some things that were relying on these redundant
notifications.
2017-02-09 12:38:10 +01:00
Michael Natterer 4fb62427a2 libgimpconfig: better compat enum handling in gimp_config_deserialize_enum()
The compat enum's GType is now attached to the original enum's GType,
not to the individual GParamSpec.
2017-01-08 20:16:47 +01:00
Michael Natterer 7ab80eaa09 libgimpconfig: support "compat enums" in gimp_config_deserialize_enum()
If the enum value is not found among the nicks and names of the
GParamSpec's actual enum type, check if it has a "gimp-compat-enum"
GType attached as QData, and try the lookup there.
2017-01-06 23:09:39 +01:00
Michael Natterer 865d8796e0 libgimpconfig: gimp_scanner_parse_color(): parse nevative color values
instead of choking and aborting parsing of the entire config file. The
negative values are still clamped away after parsing, but at least we
properly read them now.
2016-10-18 22:34:51 +02:00
Michael Natterer bafe4419c6 libgimpconfig: (de)serialize GFile properties as config paths
so they are found in relocated prefixes / user configs.
2016-10-17 18:55:50 +02:00
Michael Natterer 1e69bbdef6 libgimpconfig: don't unref the GFile in gimp_config_serialize_value()
g_value_get_object() doesn't return a new reference, so it must
not be dropped. Fixes random crashes when a profile was chosen
in a GimpTemplate (e.g. in new image or prefs). Spotted by Elle.
2016-10-12 22:39:31 +02:00
Piotr Drąg f2e63397af Fix a typo in a translatable string ("represantation") 2016-10-02 13:47:50 +02:00
Michael Natterer 0524b60228 app: consistently treat GimpColorConfig profile paths as config paths
and use gimp_file_new_for_config_path() and _get_config_path() when
dealing with them. We used a weird mix of config paths and plain
(filesystem encoded) paths, waiting to to break on umlauts or
whatever. The code in gimpcolorconfig.c was particularly bad.
2016-10-01 00:29:44 +02:00
Michael Natterer d36d956770 libgimpconfig: add gimp_file_new_for_config_path() and _get_config_path()
Which turn a UTF-8 encoded config path directly into a GFile and back,
using gimp_config_path_expand() and _unexpand().
2016-09-30 22:03:34 +02:00
Michael Natterer ada5fe977b Bug 772025 - Incomplete toolrc file causes GIMP to hang
gimp_config_deserialize_properties(): don't loop infinitely when
encountering EOF in a truncated file.
2016-09-28 18:32:25 +02:00
Michael Natterer ce4c4a44a6 libgimpconfig: fix typo: s/next level/nest level/ 2016-09-28 18:29:38 +02:00
Michael Natterer b63fed76eb libgimpconfig: serialize empty value arrays as (property-name 0)
not (property-name NULL), which means nothing to the parser.
A "0" simply means an array with zero values.
2016-09-14 00:56:17 +02:00
Michael Natterer 42647ec6d6 libgimpconfig: forgot debug output in gimp_config_path_unexpand_only() 2016-09-04 15:25:45 +02:00
Michael Natterer 6b391156be libgimpconfig: add gimp_config_path_unexpand()
which is the opposite of gimp_config_path_expand() and replaces all
occurances of well-known gimprc paths with their respective
identifiers such as ${gimp_data_directory}, ${gimp_directory} etc.
2016-09-01 00:39:34 +02:00
Richard Kreckel dd9b0fc55b Bug 768044 - Fix many typos
This fixes many typos in comments and one in a user-visible string (msgid
"center abscisse" changed to "center abscissa" in affected po files. too).
2016-06-26 00:35:24 +02:00