RSS/Atom feed Twitter
Site is read-only, email is disabled

Porting plug-ins to GIMP-1.3.23

This discussion is connected to the gimp-developer-list.gnome.org mailing list which is provided by the GIMP developers and not related to gimpusers.com.

This is a read-only list on gimpusers.com so this discussion thread is read-only, too.

1 of 1 message available
Toggle history

Please log in to manage your subscriptions.

Porting plug-ins to GIMP-1.3.23 Sven Neumann 24 Nov 18:31
Sven Neumann
2003-11-24 18:31:56 UTC (over 20 years ago)

Porting plug-ins to GIMP-1.3.23

Hi,

if you have plug-ins that used to work with GIMP-1.3, you will most probably notice that they don't work with 1.3.23 any longer. If you try to recompile them, you will notice that there are some incompatible changes in libgimpwidgets. The changes were absolutely needed and are quite small. Let me point you at the culprits nevertheless...

(1) GimpDialog API changes http://developer.gimp.org/api/1.3/libgimpwidgets/GimpDialog.html

GimpDialog is actually a GtkDialog. It has always been but the new API is much closer to the GtkDialog API. Here's a simple code snippet using the new API:

dialog = gimp_dialog_new (_("Foo Filter"), "foo", NULL, 0, gimp_standard_help_func, "gimp-plug-in-foo",
GTK_STOCK_CANCEL, GTK_RESPONSE_CANCEL, GTK_STOCK_OK, GTK_RESPONSE_OK,
NULL);

As you can see the new way of creating a GimpDialog is a lot simpler. For each button you simply pass a label text (or a stock-id) and an integer that will serve as an identifier for the button. You can then connect to the "response" signal which is emitted if a button is pressed or the user attempts to close the dialog by other means. The registered response ID is passed to the signal handler.

Alternatively, you can use gimp_dialog_run(), a convenience function that behaves very much like gtk_dialog_run(). Most GIMP plug-ins simply create a dialog, run a main loop which is quit when the dialog is closed and then check if the OK button was pressed. This used to be done by connecting a signal handler to the OK button and setting some boolean variable from there. With the new dialog API, this boils down to:

static gboolean
foo_dialog (void)
{
GtkWidget *dialog;
gboolean run;

dialog = gimp_dialog_new (_("Foo Filter"), "foo", NULL, 0, gimp_standard_help_func, "gimp-plug-in-foo",
GTK_STOCK_CANCEL, GTK_RESPONSE_CANCEL, GTK_STOCK_OK, GTK_RESPONSE_OK,

NULL);

/* add widgets to the dialog here */

run = (gimp_dialog_run (GIMP_DIALOG (dialog)) == GTK_RESPONSE_OK);

gtk_widget_destroy (dialog);

return run; }

(2) GimpFileSelection was renamed to GimpFileEntry. http://developer.gimp.org/api/1.3/libgimpwidgets/GimpFileEntry.html

This is a trivial change and not many plug-in are using a file entry anyway. If your's does, just change all occurances of gimp_file_selection to gimp_file_entry.

(3) New option menu and radio group APIs http://developer.gimp.org/api/1.3/libgimpwidgets/libgimpwidgets-GimpWidgets.html

The old API for option menus and groups of radio buttons associated a data pointer with each menu item or button. In almost all cases this pointer was used to attach an integer (often an enum value). Unless you used the GINT_TO_POINTER() and GPOINTER_TO_INT() macros, this common usage case doesn't work for all platforms. That's why we introduced new functions that take integer values directly. We ask you to check your code and convert to the new functions if you are using integers with gimp_option_menu_new() or gimp_radio_group_new().

Sven