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...