mirror of https://github.com/GNOME/gimp.git
app, libgimpconfig: move gimp_param_spec_duplicate() to libgimpconfig
This commit is contained in:
parent
f73f813e1f
commit
8cdab31393
|
@ -413,8 +413,6 @@ libappcore_a_sources = \
|
|||
gimpparamspecs.h \
|
||||
gimpparamspecs-desc.c \
|
||||
gimpparamspecs-desc.h \
|
||||
gimpparamspecs-duplicate.c \
|
||||
gimpparamspecs-duplicate.h \
|
||||
gimpparasitelist.c \
|
||||
gimpparasitelist.h \
|
||||
gimppdbprogress.c \
|
||||
|
|
|
@ -1,28 +0,0 @@
|
|||
/* GIMP - The GNU Image Manipulation Program
|
||||
* Copyright (C) 1995 Spencer Kimball and Peter Mattis
|
||||
*
|
||||
* gimpparamspecs-duplicate.h
|
||||
* Copyright (C) 2008-2009 Michael Natterer <mitch@gimp.org>
|
||||
*
|
||||
* This program is free software: you can redistribute it and/or modify
|
||||
* it under the terms of the GNU General Public License as published by
|
||||
* the Free Software Foundation; either version 3 of the License, or
|
||||
* (at your option) any later version.
|
||||
*
|
||||
* This program is distributed in the hope that it will be useful,
|
||||
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
* GNU General Public License for more details.
|
||||
*
|
||||
* You should have received a copy of the GNU General Public License
|
||||
* along with this program. If not, see <https://www.gnu.org/licenses/>.
|
||||
*/
|
||||
|
||||
#ifndef __GIMP_PARAM_SPECS_DUPLICATE_H__
|
||||
#define __GIMP_PARAM_SPECS_DUPLICATE_H__
|
||||
|
||||
|
||||
GParamSpec * gimp_param_spec_duplicate (GParamSpec *pspec);
|
||||
|
||||
|
||||
#endif /* __GIMP_PARAM_SPECS_DUPLICATE_H__ */
|
|
@ -193,7 +193,6 @@ libappcore_sources = [
|
|||
'gimppalette.c',
|
||||
'gimppalettemru.c',
|
||||
'gimpparamspecs-desc.c',
|
||||
'gimpparamspecs-duplicate.c',
|
||||
'gimpparamspecs.c',
|
||||
'gimpparasitelist.c',
|
||||
'gimppattern-load.c',
|
||||
|
|
|
@ -32,7 +32,6 @@
|
|||
#include "core/gimp.h"
|
||||
|
||||
#include "core/gimplist.h"
|
||||
#include "core/gimpparamspecs-duplicate.h"
|
||||
#include "core/gimpviewable.h"
|
||||
|
||||
#include "gegl/gimp-gegl-utils.h"
|
||||
|
@ -186,7 +185,7 @@ gimp_operation_config_class_init (GObjectClass *klass,
|
|||
strcmp (pspec->name, "input") &&
|
||||
strcmp (pspec->name, "output"))
|
||||
{
|
||||
GParamSpec *copy = gimp_param_spec_duplicate (pspec);
|
||||
GParamSpec *copy = gimp_config_param_spec_duplicate (pspec);
|
||||
|
||||
if (copy)
|
||||
{
|
||||
|
|
|
@ -38,7 +38,6 @@
|
|||
#include "core/gimperror.h"
|
||||
#include "core/gimpimage.h"
|
||||
#include "core/gimplist.h"
|
||||
#include "core/gimpparamspecs-duplicate.h"
|
||||
#include "core/gimppickable.h"
|
||||
#include "core/gimpsettings.h"
|
||||
|
||||
|
|
|
@ -67,6 +67,7 @@ GIMP_CONFIG_PROP_STRING
|
|||
GIMP_CONFIG_PROP_UINT64
|
||||
GIMP_CONFIG_PROP_UINT
|
||||
GIMP_CONFIG_PROP_UNIT
|
||||
gimp_config_param_spec_duplicate
|
||||
</SECTION>
|
||||
|
||||
<SECTION>
|
||||
|
|
|
@ -8,10 +8,10 @@ libgimpconfig_introspectable_headers = \
|
|||
../libgimpconfig/gimpconfig-error.h \
|
||||
../libgimpconfig/gimpconfig-params.h \
|
||||
../libgimpconfig/gimpconfig-path.h \
|
||||
../libgimpconfig/gimpconfig-serialize.h \
|
||||
../libgimpconfig/gimpconfig-serialize.h \
|
||||
../libgimpconfig/gimpconfig-utils.h \
|
||||
../libgimpconfig/gimpconfigwriter.h \
|
||||
../libgimpconfig/gimpscanner.h \
|
||||
../libgimpconfig/gimpscanner.h \
|
||||
../libgimpconfig/gimpcolorconfig.h
|
||||
|
||||
libgimpconfig_introspectable = \
|
||||
|
@ -19,9 +19,10 @@ libgimpconfig_introspectable = \
|
|||
../libgimpconfig/gimpconfig-deserialize.c \
|
||||
../libgimpconfig/gimpconfig-error.c \
|
||||
../libgimpconfig/gimpconfig-path.c \
|
||||
../libgimpconfig/gimpconfig-serialize.c \
|
||||
../libgimpconfig/gimpconfig-params.c \
|
||||
../libgimpconfig/gimpconfig-serialize.c \
|
||||
../libgimpconfig/gimpconfig-utils.c \
|
||||
../libgimpconfig/gimpconfigwriter.c \
|
||||
../libgimpconfig/gimpscanner.c \
|
||||
../libgimpconfig/gimpscanner.c \
|
||||
../libgimpconfig/gimpcolorconfig.c \
|
||||
$(libgimpconfig_introspectable_headers)
|
||||
|
|
|
@ -1,45 +1,65 @@
|
|||
/* GIMP - The GNU Image Manipulation Program
|
||||
* Copyright (C) 1995 Spencer Kimball and Peter Mattis
|
||||
/* LIBGIMP - The GIMP Library
|
||||
* Copyright (C) 1995-2003 Peter Mattis and Spencer Kimball
|
||||
*
|
||||
* gimpparamspecs-duplicate.c
|
||||
* Copyright (C) 2008-2014 Michael Natterer <mitch@gimp.org>
|
||||
* gimpconfig-params.c
|
||||
* Copyright (C) 2008-2019 Michael Natterer <mitch@gimp.org>
|
||||
*
|
||||
* This program is free software: you can redistribute it and/or modify
|
||||
* it under the terms of the GNU General Public License as published by
|
||||
* the Free Software Foundation; either version 3 of the License, or
|
||||
* (at your option) any later version.
|
||||
* This library is free software: you can redistribute it and/or
|
||||
* modify it under the terms of the GNU Lesser General Public
|
||||
* License as published by the Free Software Foundation; either
|
||||
* version 3 of the License, or (at your option) any later version.
|
||||
*
|
||||
* This program is distributed in the hope that it will be useful,
|
||||
* This library is distributed in the hope that it will be useful,
|
||||
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
* GNU General Public License for more details.
|
||||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
|
||||
* Lesser General Public License for more details.
|
||||
*
|
||||
* You should have received a copy of the GNU General Public License
|
||||
* along with this program. If not, see <https://www.gnu.org/licenses/>.
|
||||
* You should have received a copy of the GNU Lesser General Public
|
||||
* License along with this library. If not, see
|
||||
* <https://www.gnu.org/licenses/>.
|
||||
*/
|
||||
|
||||
#include "config.h"
|
||||
|
||||
#include <cairo.h>
|
||||
#include <gdk-pixbuf/gdk-pixbuf.h>
|
||||
|
||||
#include <gegl.h>
|
||||
#include <gegl-paramspecs.h>
|
||||
#include <gdk-pixbuf/gdk-pixbuf.h>
|
||||
|
||||
#include "libgimpcolor/gimpcolor.h"
|
||||
#include "libgimpconfig/gimpconfig.h"
|
||||
|
||||
#include "core-types.h"
|
||||
|
||||
#include "gegl/gimp-gegl-utils.h"
|
||||
|
||||
#include "gimpparamspecs.h"
|
||||
#include "gimpparamspecs-duplicate.h"
|
||||
#include "gimpconfig.h"
|
||||
|
||||
|
||||
/* FIXME: this code is not yet general as it should be (gegl tool only atm) */
|
||||
static gboolean
|
||||
gimp_gegl_param_spec_has_key (GParamSpec *pspec,
|
||||
const gchar *key,
|
||||
const gchar *value)
|
||||
{
|
||||
const gchar *v = gegl_param_spec_get_property_key (pspec, key);
|
||||
|
||||
if (v && ! strcmp (v, value))
|
||||
return TRUE;
|
||||
|
||||
return FALSE;
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* gimp_config_param_spec_duplicate:
|
||||
* @pspec: the #GParamSpec to duplicate
|
||||
*
|
||||
* Creates an exact copy of @pspec, with all its properties, returns
|
||||
* %NULL if @pspec is of an unknown type that can't be duplicated.
|
||||
*
|
||||
* Return: (transfer full): The new #GParamSpec, or %NULL.
|
||||
*
|
||||
* Since: 3.0
|
||||
**/
|
||||
GParamSpec *
|
||||
gimp_param_spec_duplicate (GParamSpec *pspec)
|
||||
gimp_config_param_spec_duplicate (GParamSpec *pspec)
|
||||
{
|
||||
GParamSpec *copy = NULL;
|
||||
GParamFlags flags;
|
||||
|
@ -48,6 +68,9 @@ gimp_param_spec_duplicate (GParamSpec *pspec)
|
|||
|
||||
flags = pspec->flags;
|
||||
|
||||
/* this special case exists for the GEGL tool, we don't want this
|
||||
* property serialized
|
||||
*/
|
||||
if (! gimp_gegl_param_spec_has_key (pspec, "role", "output-extent"))
|
||||
flags |= GIMP_CONFIG_PARAM_SERIALIZE;
|
||||
|
||||
|
@ -166,8 +189,7 @@ gimp_param_spec_duplicate (GParamSpec *pspec)
|
|||
copy = gegl_param_spec_seed (pspec->name,
|
||||
g_param_spec_get_nick (pspec),
|
||||
g_param_spec_get_blurb (pspec),
|
||||
pspec->flags |
|
||||
GIMP_CONFIG_PARAM_SERIALIZE);
|
||||
flags);
|
||||
|
||||
G_PARAM_SPEC_UINT (copy)->minimum = spec->minimum;
|
||||
G_PARAM_SPEC_UINT (copy)->maximum = spec->maximum;
|
|
@ -2,7 +2,8 @@
|
|||
* Copyright (C) 1995 Spencer Kimball and Peter Mattis
|
||||
*
|
||||
* ParamSpecs for config objects
|
||||
* Copyright (C) 2001 Sven Neumann <sven@gimp.org>
|
||||
* Copyright (C) 2001 Sven Neumann <sven@gimp.org>
|
||||
* 2001-2019 Michael Natterer <mitch@gimp.org>
|
||||
*
|
||||
* This library is free software: you can redistribute it and/or
|
||||
* modify it under the terms of the GNU Lesser General Public
|
||||
|
@ -184,6 +185,11 @@ G_BEGIN_DECLS
|
|||
GIMP_CONFIG_PARAM_SERIALIZE))
|
||||
|
||||
|
||||
/* create a copy of a GParamSpec */
|
||||
|
||||
GParamSpec * gimp_config_param_spec_duplicate (GParamSpec *pspec);
|
||||
|
||||
|
||||
G_END_DECLS
|
||||
|
||||
#endif /* __GIMP_CONFIG_PARAMS_H__ */
|
||||
|
|
|
@ -39,6 +39,7 @@ EXPORTS
|
|||
gimp_config_path_expand_to_files
|
||||
gimp_config_path_get_type
|
||||
gimp_config_path_unexpand
|
||||
gimp_config_param_spec_duplicate
|
||||
gimp_config_reset
|
||||
gimp_config_reset_properties
|
||||
gimp_config_reset_property
|
||||
|
|
|
@ -20,6 +20,7 @@ libgimpconfig_sources_introspectable = files(
|
|||
'gimpconfig-error.c',
|
||||
'gimpconfig-iface.c',
|
||||
'gimpconfig-path.c',
|
||||
'gimpconfig-params.c',
|
||||
'gimpconfig-serialize.c',
|
||||
'gimpconfig-utils.c',
|
||||
'gimpconfigwriter.c',
|
||||
|
|
Loading…
Reference in New Issue