mirror of https://github.com/GNOME/gimp.git
plug-ins: Update Darktable API check
Darktable 4.6 updated the version output format to conform to standards. This broke the regex check that GIMP uses to test if Darktable is installed. The developers of Darktable have added a new --gimp flag for us to use for checking support. This patch updates our check code to use this API first, then fallback on the original regex code if a version of Darktable before 4.6 is installed.
This commit is contained in:
parent
c7d271d892
commit
a28b1bad14
|
@ -113,7 +113,7 @@ darktable_init_procedures (GimpPlugIn *plug_in)
|
|||
"org.darktable",
|
||||
REGISTRY_KEY_BASE,
|
||||
&search_path);
|
||||
gchar *argv[] = { exec_path, "--version", NULL };
|
||||
gchar *argv[] = { exec_path, "--gimp" , "version", NULL };
|
||||
gchar *darktable_stdout = NULL;
|
||||
gchar *darktable_stderr = NULL;
|
||||
gboolean have_darktable = FALSE;
|
||||
|
@ -126,6 +126,10 @@ darktable_init_procedures (GimpPlugIn *plug_in)
|
|||
if (debug_prints)
|
||||
g_printf ("[%s] trying to call '%s'\n", __FILE__, exec_path);
|
||||
|
||||
/* In Darktable 4.6, a new GIMP-specific API was introduced due to changes
|
||||
* in how the version output is formatted. We first check for Darktable
|
||||
* with this API, then fallback to the pre-4.6 regex checks if the user has
|
||||
* an older version of Darktable installed. */
|
||||
if (g_spawn_sync (NULL,
|
||||
argv,
|
||||
NULL,
|
||||
|
@ -136,6 +140,36 @@ darktable_init_procedures (GimpPlugIn *plug_in)
|
|||
&darktable_stderr,
|
||||
NULL,
|
||||
&error))
|
||||
{
|
||||
/* TODO: Utilize more features of Darktable API */
|
||||
if (! error)
|
||||
{
|
||||
if (! (darktable_stderr && *darktable_stderr))
|
||||
have_darktable = TRUE;
|
||||
}
|
||||
}
|
||||
else if (debug_prints)
|
||||
{
|
||||
g_printf ("[%s] g_spawn_sync failed\n", __FILE__);
|
||||
}
|
||||
|
||||
if (! have_darktable)
|
||||
{
|
||||
gchar *argv_pre_4_6[] = { exec_path, "--version", NULL };
|
||||
|
||||
g_clear_error (&error);
|
||||
error = NULL;
|
||||
|
||||
if (g_spawn_sync (NULL,
|
||||
argv_pre_4_6,
|
||||
NULL,
|
||||
(search_path ? G_SPAWN_SEARCH_PATH : 0),
|
||||
NULL,
|
||||
NULL,
|
||||
&darktable_stdout,
|
||||
&darktable_stderr,
|
||||
NULL,
|
||||
&error))
|
||||
{
|
||||
GRegex *regex;
|
||||
GMatchInfo *matches;
|
||||
|
@ -179,6 +213,7 @@ darktable_init_procedures (GimpPlugIn *plug_in)
|
|||
{
|
||||
g_printf ("[%s] g_spawn_sync failed\n", __FILE__);
|
||||
}
|
||||
}
|
||||
|
||||
if (debug_prints)
|
||||
{
|
||||
|
@ -235,11 +270,11 @@ darktable_create_procedure (GimpPlugIn *plug_in,
|
|||
darktable_load_thumb, NULL, NULL);
|
||||
|
||||
gimp_procedure_set_documentation (procedure,
|
||||
"Load thumbnail from a raw image "
|
||||
"via darktable",
|
||||
"This plug-in loads a thumbnail "
|
||||
_("Load thumbnail from a raw image "
|
||||
"via darktable"),
|
||||
_("This plug-in loads a thumbnail "
|
||||
"from a raw image by calling "
|
||||
"darktable-cli.",
|
||||
"darktable-cli."),
|
||||
name);
|
||||
gimp_procedure_set_attribution (procedure,
|
||||
"Tobias Ellinghaus",
|
||||
|
@ -532,7 +567,6 @@ load_thumbnail_image (GFile *file,
|
|||
error))
|
||||
{
|
||||
gimp_progress_update (0.5);
|
||||
|
||||
image = gimp_file_load (GIMP_RUN_NONINTERACTIVE, file_out);
|
||||
if (image)
|
||||
{
|
||||
|
|
Loading…
Reference in New Issue