Commit Graph

118 Commits

Author SHA1 Message Date
f521e92d35 app: make gimp_data_factory_data_foreach() public 2018-06-04 12:33:09 +02:00
2ca408d146 app: add "new-func" and "get-standard-func" properties to GimpDataFactory
to make it behave better, and as preparation for further subclassing.
2018-06-04 12:18:13 +02:00
d1b9f74c6f app: we always need to freeze/thaw around gimp_font_factory_data_init()
so pull it to the parent class. Also remove the "no_data" parameter
from the data_init() virtual function and handle it in
gimp_font_factory_data_init() itself.
2018-06-03 23:16:29 +02:00
c563659ed8 app: move the GimpAsyncSet and the waiting code to GimpDataFactory
it's potentially useful for all data factories.
2018-06-03 22:28:00 +02:00
68cf2641f8 app: add gimp_data_factory_get_data_path[_writable]()
which return GLists of GFiles. Use the new API in GimpDataFactory's
default implementations.
2018-06-03 20:42:21 +02:00
01e4104236 app: make GimpDataFactory properly derivable
Virtualize a lot of functions and move their code into the default
implementation. Also connect to changes of the "path" property and
reload data automatically when the path changes. Add "wait" method
which is by default empty but is to be implemented by fonts.
2018-06-03 00:45:06 +02:00
d71ed88592 app: add buffering to reading data files
gimp_data_factory_load_data(): use a GBufferedInputStream so we don't
end up reading files byte-by-byte in the worst case.
2018-02-21 22:12:52 +01:00
0cb3e75f79 app: use a lot of g_clear_object() and g_clear_pointer()
More than 2000 lines of code less in app/, instead of

if (instance->member)
  {
    g_object_unref/g_free/g_whatever (instance->member);
    instance->member = NULL;
  }

we now simply use

g_clear_object/pointer (&instance->member);
2017-07-15 18:42:44 +02:00
84ee79c71d app: clean out many tabs under app/core/. 2016-11-25 05:51:03 +01:00
39909b6008 app: replace GimpList's internal GList with a GQueue
so we can easily iterate in reverse order, and access the last element
in O(1). Nothing makes use of this yet.
2016-05-01 15:22:44 +02:00
0ee649629e app: GimpDataFactory: get the data's mtime in the function where it's needed 2015-12-28 16:46:08 +01:00
16fa1b722d Bug 752582 - Error message when refreshing resources without...
...a writable resource directory

gimp_data_factory_data_save(): don't warn about a missing writable
directory if there is nothing to save.
2015-07-21 19:24:45 +02:00
9be16e00bc app: make sure name references to GimpData objects are serialized correctly
They were also serialized correctly before, but only because many
GimpData objects were (bogusly) always dirty after loading, which
caused them to always be written do disk on exit. This commit fixes
this problem and updates by-name references explicitly as things are
renamed, instead of relying on bugs.

Add gimp_data_factory_data_clean() which clears the dirty flags from
all a factory's objects. Call the new function on all factories at the
end of gimp_restore(), when all data has been loaded. This might be
total overkill, but ensures that everything is clean in the beginning.

Add new signal GimpContext::prop_name_changed() which is emitted when
any of the context's object properties (brush, gradient etc) is
renamed.

In GimpToolPreset, connect to the new signal and dirty the preset if a
relevant object propery was renamed, making sure the preset is saved
to disk later. Also optmize updates quite a bit by ignoring
notifications on tool option properties that are irrelevant to the
preset.

This might or might not address the issues discussed in bug #739487.
2015-02-26 22:31:58 +01:00
da26597467 app: add gimp_file_has_extension() and use it in GimpDataFactory 2014-08-02 23:29:00 +02:00
ab2afa0c1f app: don't check for a writable dir for each loaded GimpData
Instead, do the check once for each element of the data path, and pass
the result to the load functions.
2014-08-02 15:09:33 +02:00
2b1735f784 app: move gimp_file_compare() to gimp-utils.[ch]
It's a GCompareFunc to be used for finding GFiles in lists.
2014-08-02 15:07:26 +02:00
6821eb298c app: port GimpDataFactory file loading to GFileEnumerator
Also slightly change the semantics of gimp_data_set_folder_tags()
to be less complicated.
2014-08-01 20:30:45 +02:00
58c3b7661f app: port gimp_data_create_filename() to GFile
implies also porting gimp_data_factory_get_save_dir().
2014-07-26 16:37:30 +02:00
e618a2866c app: simplify handling of a GimpDataFactory's writable_path
Simply keep it around in GimpDataLoadContext during loading, instead
of g_object_set/getting it on the factory.
2014-07-26 14:21:39 +02:00
e6f4252d55 app: simplify GimpData load/save error reporting a lot
Add the filename and general "Foo failed" spam generically in GimpData
and GimpDataFactory, and make the individual loaders/savers much
simpler.
2014-07-04 18:46:02 +02:00
6f7e244d75 app: add GInputStream* parameter to GimpDataLoadFunc
and port all loaders to loading from an already open stream.
2014-07-04 03:31:03 +02:00
651c3d56ff app: more filename -> GFile 2014-07-01 15:56:39 +02:00
113617f526 app: change the GimpData loading API from filename to GFile 2014-07-01 02:30:22 +02:00
9696e297ac app: turn GimpData's "filename" string into a "file" GFile
One more step, but for now just causes more code in most places to get
to the path inside the GFile.
2014-07-01 01:19:35 +02:00
26738b9ff3 Bug 722487: Something in the attached .gimp-2.8 directory makes...
GIMP fail on start

Make gimp_tool_preset_load() robust against completely failed
deserializing.
2014-05-05 10:34:08 +02:00
8707701bee Bug 720163 - Typo fix for a console gimp-error message
s/configuation/configuration/
2013-12-10 14:48:08 +13:00
697572ccc0 app,libgimp*: fix includes to follow our include policy
- don't include <gdk-pixbuf/gdk-pixbuf.h> in headers in app/
- instead, include it in many .c files instead of <glib-object.h>,
  finally acknowledging the fact that app/ depends on gdk-pixbuf almost
  globally
- fix up includes as if libgimpbase depended in GIO, which it soon will
2013-10-15 01:58:39 +02:00
59c0c96921 app: add gimp_data_factory_get_data_type() 2012-10-07 00:17:01 +02:00
2a30a2bb74 Bug 684698 - Preferences-Folders: only 15 folder items accepted
Raise "max_paths" from 16 to 256 in all calls to gimp_path_parse().
2012-09-26 23:29:51 +02:00
867da8f293 app: add gimp_context_get_foreground,background_pixel()
which takes a Babl format to convert from/to.
Include <gegl.h> in a million places.
2012-05-02 17:50:41 +02:00
2303d292c3 app: initialize var before usage
to silence valgrind

==12105== Conditional jump or move depends on uninitialised value(s)
==12105==    at 0x6B069C: gimp_data_set_folder_tags (gimp/app/core/gimpdata.c:885)
==12105==    by 0x6B155E: gimp_data_factory_load_data (gimp/app/core/gimpdatafactory.c:922)
==12105==    by 0x64F34D0: gimp_datafiles_read_directories (gimp/libgimpbase/gimpdatafiles.c:155)
==12105==    by 0x6B1293: gimp_data_factory_data_load (gimp/app/core/gimpdatafactory.c:354)
==12105==    by 0x6B1E1C: gimp_data_factory_data_init (gimp/app/core/gimpdatafactory.c:239)
==12105==    by 0x6871D2: gimp_restore (gimp/app/core/gimp.c:952)
==12105==    by 0x47EABA: app_run (gimp/app/app.c:217)
==12105==    by 0x47E64D: main (gimp/app/main.c:440)
==12105==  Uninitialised value was created by a stack allocation
==12105==    at 0x6B1190: gimp_data_factory_data_load (gimp/app/core/gimpdatafactory.c:319)
2012-02-10 12:24:32 +01:00
0729c25bc0 app: set tags for all subdirectories a data file lives in
GimpData: add gimp_data_set_folder_tags() and remove the tag logic
from gimp_data_set_filename(). The function gets the toplevel data
directory passed so it knows where to stop assigning tags.

GimpDataFactory: when loading data, keep track of the currently
processed data hierachy's toplevel directory, and pass it to above new
function. Also make sure obsolete files don't get folder-tagged.
2012-02-09 10:02:49 +01:00
23ed56d75d app: gimp_data_factory_load_data(): fix handling of obsolete and writable
Make sure obsolete files are immutable, and propagate a folder's
"writable" state into its subfolders. Also clean up the function's
control flow to not fry the reader's brain.
2012-01-14 20:54:35 +01:00
caad58d203 app: add a GimpContext parameter to GimpDataLoadFunc 2010-04-11 13:12:41 +02:00
4fcf34699f app: flip context and name parameters in GimpDataNewFunc 2010-04-10 19:55:42 +02:00
430b0e5517 app: add a GimpContext parameter to all functions which create GimpData
and pass a context whereever needed. Fix up gimp_tool_preset_new()
to actually make a copy of the context's active tool's options.
2010-04-05 13:26:31 +02:00
345bbfe475 app: adjust wording and spelling in error messages 2009-12-26 20:46:19 +01:00
22767ca7b8 Seal GimpData completely and add the missing accessors 2009-10-31 18:48:38 +01:00
7abcfbf237 Add private struct to GimpData
And start sealing by moving "filename" there. Add
gimp_data_get_filename() and use it everywhere.
2009-10-31 15:24:57 +01:00
cfa76869d6 Bug 599797 - Crash on "Refresh dynamics" if ~/.gimp-2.7/dynamics folder is missing
(gimp_data_factory_refresh_cache_add): don't add data objects without
filename to the refresh cache. Regardless why they have no filename,
they can't be reloaded anyway (in this case it's newly created objects
that couldn't be saved because there is no folder to save them).
2009-10-30 22:58:19 +01:00
223cbeb6fb Fix gimp_data_factory_data_foreach()
Make the function do what is says also if the callback doesn't remove
the data from the factory, argh... also add "gboolean skip_internal"
parameter because doing that unconditionally feels equally broken.
2009-10-30 22:50:02 +01:00
a0e70231fb Rename cache utility function and reorder stuff to make more sense 2009-10-30 22:40:50 +01:00
118440affc Add typedef GimpDataForeachFunc
instead of defining the callback signature in the
declaration of gimp_data_factory_data_foreach().
2009-10-30 22:00:51 +01:00
2700b35dae gimp_data_factory_load_data(): add local "loader" variable for readability 2009-10-30 21:45:03 +01:00
1e49fd6b50 Give a proper error message if there is no writable data directory
(gimp_data_factory_get_save_dir): add GError and return an error
message telling why exactly a writable folder could not be found.

Show that error message instead of silently failing of just giving a
useless generic error so the user knows how to fix the problem.
2009-10-30 21:34:08 +01:00
0c908fc12b Inline a function that was only used once
Keeping gimp_data_factory_data_reload() separate from
gimp_data_factory_data_refresh() is more confusing than helpful
because the function is an integral part of the refresh logic and
implemented everything but saving all dirty objects.
2009-10-28 20:25:55 +01:00
a3558e3cb8 Remove GIMP_OBJECT() casts when calling gimp_object_get_name() 2009-08-31 22:47:18 +02:00
53aa877346 use G_FILE_TEST_IS_REGULAR instead of G_FILE_TEST_EXISTS
Keeps us from trying to load a directory as a data file.
2009-08-27 23:12:55 +02:00
3d0c025a51 app: Support obsolete data resources
Add support for having obsolete data resources. An obsolete resource
is not shown in the UI or managed in any way, but it will be
considered when plug-ins requests resources. This in order to maintain
backwards compatibility for plug-ins.
2009-08-13 21:54:00 +02:00
d9b5207aa2 Change licence to GPLv3 (and to LGPLv3 for libgimp).
2009-01-17  Michael Natterer  <mitch@gimp.org>

	* all files with a GPL header and all COPYING files:

	Change licence to GPLv3 (and to LGPLv3 for libgimp).

	Cleaned up some copyright headers and regenerated the parsers in
	the ImageMap plugin.


svn path=/trunk/; revision=27913
2009-01-17 22:28:01 +00:00