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

How to include a Glade user interface in a plugin?

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.

2 of 2 messages available
Toggle history

Please log in to manage your subscriptions.

How to include a Glade user interface in a plugin? Alessandro Francesconi 08 Nov 20:01
  How to include a Glade user interface in a plugin? Martin Nordholts 08 Nov 20:19
Alessandro Francesconi
2010-11-08 20:01:51 UTC (about 14 years ago)

How to include a Glade user interface in a plugin?

Hello guys, i'm recently into the Gimp Plugin development and I'm trying to write a plug that shows a new window to interact with the user. I designed it with Glade 3.6 to make it simple, then I saved the interface in GtkBuilder format "interface.glade".
But now... I can't figure out how to implement it in my plugin code. Look, that's what I tried:
That's the 'run' procedure:

static void run (
const gchar *name,
gint nparams,
const GimpParam *param,
gint *nreturn_vals,
GimpParam **return_vals)
{
static GimpParam values[1];
GimpPDBStatusType status = GIMP_PDB_SUCCESS; GimpRunMode run_mode;

/* Setting mandatory output values */ *nreturn_vals = 1;
*return_vals = values;
values[0].type = GIMP_PDB_STATUS;
values[0].data.d_status = status;

/* Getting run_mode - we won't display a dialog if * we are in NONINTERACTIVE mode */
run_mode = param[0].data.d_int32;
if (run_mode != GIMP_RUN_NONINTERACTIVE) batch_dialog();

return;
}

You see, the last rows calls the 'batch_dialog()' that will make the window appear, is that:
static gboolean
batch_dialog ()
{
gboolean run;
gimp_ui_init ("batchmygimp", FALSE);
GtkBuilder *builder;
GtkWidget *window;

printf("START\n");

builder = gtk_builder_new ();
gtk_builder_add_from_file (builder, "prova.glade", NULL); window = GTK_WIDGET (gtk_builder_get_object (builder, "window1"));
gtk_widget_show (window);
run = (gimp_dialog_run (GIMP_DIALOG (window)) == GTK_RESPONSE_OK); printf("run variable = %d\n",run);

return run; }

And nothing appears when I start it .-. Is there a plugin that implements Glade in it? So I can give a sight...

Martin Nordholts
2010-11-08 20:19:49 UTC (about 14 years ago)

How to include a Glade user interface in a plugin?

On 11/08/2010 09:01 PM, Alessandro Francesconi wrote:

Hello guys, i'm recently into the Gimp Plugin development and I'm trying to write a plug that shows a new window to interact with the user. I designed it with Glade 3.6 to make it simple, then I saved the interface in GtkBuilder format "interface.glade".

But now... I can't figure out how to implement it in my plugin code. Look, that's what I tried:>
gtk_widget_show (window);
run = (gimp_dialog_run (GIMP_DIALOG (window)) == GTK_RESPONSE_OK); printf("run variable = %d\n",run);

return run; }

You need a main loop, try putting gtk_main() before you return and make sure to call gtk_main_quit() in some UI handler.

The PNG save plug-in uses Glade: http://git.gnome.org/browse/gimp/tree/plug-ins/common/file-png.c

/ Martin