Commit Graph

2632 Commits

Author SHA1 Message Date
Jehan 2c1efdedf0 app: do not free non-allocated DBus manager.
While this issue was unseen so far on common desktop machines, the CI
build encountered it, hence failing 6 of the unit tests.
A connection to the bus could not be established hence the dbus_manager
was never allocated, and finally it would crash at exit if we tried to
unref it unconditionnally. Use g_clear_object() instead.

Also add some stderr output for easier debugging, for when one of the 2
possible error cases might happen (as documented by g_bus_own_name()).
2020-03-19 17:44:24 +01:00
Ell f25a8934fa app: rename GimpParallelRunAsyncFunc to GimpRunAsyncFunc
... and move it to core-type.h, in preparation for next commit.
2020-03-14 00:43:43 +02:00
Michael Natterer bb144065c7 app: s/getenv/g_getenv/ in gui_restore_after_callback()
(cherry picked from commit 65b6f7cc6f)
2020-02-18 20:41:18 +01:00
Michael Natterer 3a36ae49de app: fix indentation in gui_restore_after_callback()
(cherry picked from commit 2ffa09fab5)
2020-02-18 20:41:07 +01:00
Oleksii Samorukov 5d0b0ad467 Fix meson build on macos 2020-01-18 23:39:34 +01:00
Alex Samorukov 05d6b8a591 Move comment to match the description 2020-01-10 16:48:33 +00:00
Oleksii Samorukov 0de790137e Move macos menu init to the gui related code and reparent it with a main window.
Closes #1258

(cherry picked from commit eb4b8fbd05)
2020-01-10 16:48:33 +00:00
Jehan 9a043d0fc9 Issue #4251: (meson) dbus-glib-1 not required.
As written in previous commit, this is not a dependency since commit
c4460e84.
2019-11-16 19:26:58 +01:00
Jehan 5f2a6940e3 app, devel-docs: remove dangling DBUS_GLIB_* variables.
dbus-glib is no more a dependency since commit c4460e84, i.e. already
since 2013!
2019-11-16 19:19:02 +01:00
Jehan 2f01751907 Issue #4119: GIMP main window not restored from Taskbar under MS Windows
Tested in a VM. Minimized window is properly deiconified and showed to
the front. Though a window in the back (not minimized) is not moved to
the front.
2019-10-20 19:44:41 +02:00
luzpaz 44d10e458c Fix various typos
Found via `codespell` (v1.17.0.dev0)
2019-09-21 17:10:46 +00:00
Michael Natterer 1bca89163d libgimpbase: remove gimp_personal_rc_file()
and port its remaining users to gimp_directory_file().
2019-09-21 18:08:13 +02:00
Michael Natterer dbd793d631 libgimpconfig: get rid of filenames in all config related APIs
and rename function names which say "gfile" to just "file".
2019-09-21 12:55:12 +02:00
Félix Piédallu 65eff6f150 Meson port. 2019-09-11 16:42:04 +02:00
Michael Natterer b92dd2c8e3 app: split GimpDisplay in two classes: GimpDisplay and GimpDisplayImpl
GimpDisplay contains only the ID logic and the "gimp" and "config"
pointers, and lives in the core.

GimpDisplayImpl is a subclass and contains all the actual display
stuff. The subclass is only an implementation detail and doesn't
appear in any API.

Remove all hacks which pass displays as gpointer, GObject or
GimpObject through the core, or even lookup its type by name,
just use GimpDisplay.
2019-09-04 14:30:43 +02:00
Michael Natterer 392f00baf5 app, libgimp: get rid of all ID GTypes and ID param specs
Turn all ID param specs into object param specs (e.g. GimpParamImageID
becomes GimpParamImage) and convert between IDs and objects in
gimpgpparams.c directly above the the wire protocol, so all of app/,
libgimp/ and plug-ins/ can deal directly with objects down to the
lowest level and not care about IDs.

Use the actual object param specs for procedure arguments and return
values again instead of a plain g_param_spec_object() and bring back
the none_ok parameter.

This implies changing the PDB type checking functions to work on pure
integers instead of IDs (one can't check whether object creation is
possible if performing that check requires the object to already
exist).

For example gimp_foo_is_valid() becomes gimp_foo_id_is_valid() and is
not involved in automatic object creation magic at the protocol
level. Added wrappers which still say gimp_foo_is_valid() and take the
respective objects.

Adapted all code, and it all becomes nicer and less convoluted, even
the generated PDB wrappers in app/ and libgimp/.
2019-08-29 11:39:34 +02:00
Michael Natterer 7201d48231 Get rid of capitalized "ID" in function and variable names
and use "id" instead.
2019-08-23 22:23:23 +02:00
Niels De Graef 284ba5c870 libgimpconfig: Prevent GIR conflicts in GimpConfigWriter
GimpConfigWriter contains several constructors with the convention
`gimp_config_writer_new_* ()`. This will lead to problems however with
languages like Vala, where it cannot disambiguate the following:

```
// calls config_writer_new_string()
Gimp.ConfigWriter w = new ConfigWriter.string("xxx");
// calls config_writer_string()
w.string("xxx")
```

Using `from_` in constructors is general practice in GObject-bsed
libraries because of this.

This also fixes an error when trying to use vapigen on the GIMP .GIR
file.
2019-08-16 10:04:39 +00:00
Michael Natterer d3d621b502 libgimpconfig: add a GimpScanner typedef and make it a boxed type
Replace _destroy() by _ref() and _unref().
2019-08-09 12:42:52 +02:00
Michael Natterer 63695b4b21 libgimbase: merge gimpparam.h into gimpparamspecs.h
which means that it's now included normally via gimpbase.h
and not any longer via gimpbasetypes.h which we only did out
of lazyness. A *lot* of files in libgimp* and app/ now need to
2019-07-31 10:16:21 +02:00
Michael Natterer 0a6f157d58 app, libgimp, libgimpbase: big plug-in API refactoring part three
- libgimpbase: change GPParam to transfer all information about the
  GValues we use, in the same way done for GPParamDef. GPParam is now
  different from GimpParam from libgimp, pointers can't be casted any
  longer. The protocol is now completely GimpPDBArgType-free. Remove
  gp_params_destroy() from the public API.

- libgimp: add API to convert between an array of GPParams and
  GimpValueArray, the latter is now the new official API for dealing
  with procedure arguments and return values, GimpParam is cruft (the
  wire now talks with GimpPlugIn more directly than with the members
  of GimpPlugInInfo, which need additional compat conversions).

- libgimp, app: rename gimpgpparamspecs.[ch] to simply
  gimpgpparams.[ch] which is also more accurate because they now
  contain GValue functions too. The code that used to live in
  app/plug-in/plug-in-params.h is now completely in libgimp.

- app: contains no protocol compat code any longer, the only place
  that uses GimpPDBArgType is the PDB query procedure implementation,
  which also needs to change.

- app: change some forgotten int32 run-modes to enums.
2019-07-29 12:22:58 +02:00
Jehan 5d2dbfe2e8 app: gdk_threads_(enter|leave)() deprecated since GDK 3.6.
There are no replacements. Just we must make sure that all GTK+/GDK
calls are run from the main thread, which is already what we were doing.

Actually I don't even think these were doing anything as we were not
calling gdk_threads_init() so the default lock functions were not set
anyway. These were just bogus calls.
2019-07-22 11:25:24 +02:00
Michael Natterer 86e07c16b5 app: start porting away from GtkAction and friends
Step one: get rid of all those deprecation warnings that make
it hard to see any other warnings:

- add a lot of dummy API to GimpAction, GimpActionGroup, GimpUIManager
  etc. which simply forwards to the deprecated GTK functions, they
  will all go away again later
- rename GimpAction to GimpActionImpl
- add interface GimpAction that is implemented by all action classes,
  creates a common interface and allows to remove some duplicated
  logic from GimpToggleAction and GimpRadioAction, and at the same
  time adds more features
2019-07-02 14:21:32 +02:00
Ell 1846764d3b app: include system gimp.css file in theme.css
Include the system-wide gimp.css file, in addition to the user-
specific gimp.css file, in the generated theme.css file, instead of
copying the former into the latter when creating the user's
gimpdir.  This allows us to modify the system-wide gimp.css file,
and having the changes take effect in existing installations.
2019-03-27 20:14:10 -04:00
Ell 8c96c3d1bb app, libgimp: communicate dark-theme preference to plug-ins through theme.css
The GUI implementation of gimp_wait() relies on the ability to run
plug-ins (namely, the busy-dialog plug-in) without entering the
main loop.  This prohibits the said plug-ins from making any PDB
calls, which would result in a deadlock.  However, we're currently
calling gimp_gimprc_query() to fetch the prefer-dark-theme option
during gimp_ui_init() (or any time the theme.css file changes).

Instead, communicate this preference through the theme.css file
itself, by writing a /* prefer-dark-theme */ comment to the file
when the option is set.  Yes, it's a bit of a hack :P
2019-02-20 14:40:11 -05:00
Michael Natterer 53aa2bb211 app: put the * { -gtk-icon-style: regular|symbolic; } into theme.css
instead of manually appending it after the file is generated, this way
it automatically applies to plug-ins too.
2019-01-04 15:25:40 +01: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
Alex Samorukov ea2c9eefb3 app: do not activate OSX menu if tests are running to prevent crash
(cherry picked from commit 62c52742cd)
2018-11-23 11:41:16 +01:00
Jehan dd3d9ab3dd app: make sure we reset tool modifier state before saving options.
I had this funny behavior when I was quitting GIMP with the active tool
using modifiers (for instance bucket fill). Each time I'd quit with
ctrl-q (and if the image is not dirty), the options would use the value
from the modifier state and be saved as-is. Hence at next restart, the
default value was always different!
2018-11-22 16:22:21 +01:00
Sergio Jiménez Herena 1ca2d74411 app: Add option in the windows menu to hide the image tab bar.
(cherry picked from commit 360aee10d8)
2018-10-23 11:52:07 +02:00
Ell 85b16b9eaa app: fix gimp_wait() deadlock
In the GUI implementation of gimp_wait(), explicitly finish the
input-pipe async operation after the busy-dialog plug-in
terminates, to avoid the async callback function from being
repeatedly called, stalling the main thread.  Previously, this code
relied on gimp-parallel implicitly aborting the async operation,
but this is no longer the case since commit
4969d75785.
2018-10-11 02:26:04 -04: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 8cfe2df866 app: allow GUI config property for icon style preference.
A single icon theme can contain both regular and symbolic icons. Let's
give possibility to switch from one style to the other within GIMP
Preferences.

This won't work very well in all cases yet, especially if an icon theme
only has symbolic icons (and no regular ones) because of inconsistencies
in glib which are being fixed (patches which I submitted and which were
merged in glib on 2018-08-17).
So this will work as expected when we will bump our glib requirement to
whatever is the next release.
2018-08-17 23:24:21 +02:00
Jehan ae19441ddc app: small code cleaning.
Removing unused declaration of icons_set_icon_theme().
And reorder a bit the declarations to match the definition order.
2018-08-10 21:40:27 +02:00
Jehan a4e0a8f96e app: extensions can now install themes. 2018-08-07 15:51:54 +02:00
Jehan 7d611e713c 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.
2018-08-07 15:51:54 +02:00
Jehan c7b5977637 app: work with GIO in splash code.
This will go with the next commit, but I broke it so I can backport the
code without extension handling in gimp-2-10 first.
2018-08-07 15:51:54 +02:00
luz.paz 732bcb463e Misc. comment typos
Found via `codespell`
2018-07-14 19:07:43 +00:00
Michael Natterer 149e4af170 app: remove forgotten prototype from gui.c 2018-07-13 15:28:25 +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 b74e600c12 app: add gimp_parallel_run_async_{full,independent}()
Remove the "independent" parameter of gimp_parallel_run_async(),
and have the function always execute the passed callback in the
shared async thread-pool.

Add a new gimp_parallel_run_async_full() function, taking, in
addition to a callback and a data pointer:

  - A priority value, controlling the priority of the callback in
    the async thread-pool queue.  0 is the default priority (used
    by gimp_parallel_run_async()), negative values have higher
    priority, and positive values have lower priority.

  - A destructor function for the data pointer.  This function is
    called to free the user data in case the async operation is
    canceled before execution of the callback function begins, and
    the operation is dropped from the queue and aborted without
    executing the callback.  Note that if the callback *is*
    executed, the destructor is *not* used -- it's the callback's
    responsibility to free/recycle the user data.

Add a separate gimp_parallel_run_async_independent() function,
taking the same parameters, and executing the passed callback in
an independent thread, rather than the thread pool.  This function
doesn't take a priority value or a destructor (and there's no
corresponding "_full()" variant that does), since they're pointless
for independent threads.

Adapt the rest of the code to the changes.
2018-07-01 13:52:21 -04:00
Michael Natterer b36205176e app, libgimp*: remove the config option to disable tooltips
Also remove all traces of it from the plug-in protocol and raise the
protocol version to 0x0100 (we now allow features and therefore
version bumps in stable, and the master protocol version should always
be higher). Fix the code that aborts plug-in startup on protocol
version mismatch, we can't use gimp_message() because we have no
protocol.
2018-06-06 19:23:30 +02:00
Edward E 127ad04bfa app: finish porting GdkScreen/monitor_number to GdkMonitor
gui_unique_*_idle_open were missed in
5ece7a8d1f
2018-05-31 16:33:54 +00:00
Ell 5a66d6cc74 app: fix gui_wait() cleanup 2018-05-29 16:35:20 -04:00
Ell cec17de3c2 app: add gimp_wait()
Add a GimpGui::wait() virtual function, and a corresponding
gimp_wait() function.  The function takes an object implementing
the GimpWaitable interface, and a printf-style message, and waits
for the object to become ready, displaying the message as
indication in the meantime.  The default implementation simply
prints the message to STDERR.

Implement the function in gui-vtable, using the busy-dialog plug-
in added in the previous commit, to display the message in a
dialog.  Additionally, if the object implements the GimpCancelable
interface, provide a "cancel" button in the dialog, which, when
pressed, causes gimp_cancelable_cancel() to be called on the
object.  Note that the function keeps waiting on the object even
after requesting cancelation; GimpTriviallyCancelableWaitable can
be used to stop the wait once cancelation has been requested.
2018-05-29 16:04:28 -04:00
Michael Natterer ee7bab75fb app: use gdk_seat_ungrab() in gui_ungrab() 2018-05-23 19:19:51 +02:00
Michael Natterer f3f61379f7 app: remove the option to enable tearoff menus 2018-05-20 21:06:35 +02:00
Michael Natterer 587d511398 app: undeprecate GimpUIConfigurer, don't use gtk_window_parse_geometry() 2018-05-20 21:06:35 +02:00
Michael Natterer 1d8696cd80 Get rid of gdk_flush() globally, use gdk_display_flush() 2018-05-20 21:06:34 +02:00
Jehan 7642715c17 app: allow setting parent for dialogs created by GimpDialogFactory.
Fixes a bunch of:
> Gtk-Message: GtkDialog mapped without a transient parent. This is discouraged.
2018-05-20 21:06:33 +02:00