[Gimp-developer] plugin development



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.

Sorry, if what i want is not clear, i am not a native english speaker and i
will happily answer if you need more information.

Regards and Thanks,
Paul


[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]