Re: [Gimp-developer] plugin development
- From: Michael Natterer <mitch gimp org>
- To: gimp-developer-list gnome org
- Subject: Re: [Gimp-developer] plugin development
- Date: Sat, 06 Jan 2018 12:33:51 +0100
On Sun, 2017-12-31 at 15:17 +0100, p144a kabsi at wrote:
Hi!
I am developing a Gimp plugin in C and have a question, but if this
is not
the right place to ask, please tell me so and accept my apology.
The plugin requires the user to select a color, but i can't figure
out the
correct way to do it. In lack of better knowledge i am using a field
of
type GimpRGB for the struct that holds the plugin options and the
GimpParamDef in the query() function has an entry that looks like
this:
{
GIMP_PDB_COLOR,
"inside color",
"Inside color"
}
In the run() function i set the color field of the option like this:
options.inside_color = param[ PARAM_INSIDE_COLOR ].data.d_color;
Again in lack of better knowledge, my function that builds the dialog
for
chosing options uses a GtkColorButton
for the user to pick a color and i connect the signal "color_set" in
the
following way to a callback which is defined like this:
static void color_set( GtkColorButton *button, gpointer data ) {
gtk_color_button_get_color( button, data );
}
and when building the dialog i connect it like this:
g_signal_connect( color_button, "color_set", G_CALLBACK( color_set ),
&options.inside_color );
The gimptool compiles my plugin and it is registered and runs as
expected
in the Gimp.
However, when building the dialog, i try to set the color that was
stored
in he options from a previous run like this:
gtk_color_button_set_color( ( GtkColorButton * ) color_button,
&options.inside_color );
the gimptool gives me a warning:
expected ‘const struct GdkColor *’ but argument is of type ‘struct
GimpRGB *’
When googling for help i read that GdkColor is deprecated?? and i
want to
ask you for the correct and preferred way of doing this.
You would simply use a GimpColorButton and gimp_color_button_new()
Regards,
Mitch
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]