Hello,everybody!
I want to create a window in gimp plugin,so this is my code(part of the
plugin):
/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;
GtkWidget *window;
gtk_init();
/* 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;
window = gtk_window_new(GTK_WINDOW_TOPLEVEL);
gtk_window_set_title(GTK_WINDOW(window),"hello");
gtk_widget_show(window);
gtk_main();
}
/but when I ran the plugin in gimp,it didn't work...
and this is the error message:
(hello:12429): GLib-GObject-WARNING **: invalid (NULL) pointer instance
(hello:12429): GLib-GObject-CRITICAL **: g_signal_connect_data:
assertion `G_TYPE_CHECK_INSTANCE (instance)' failed
(hello:12429): LibGimp-CRITICAL **: gimp_window_set_transient: assertion
`gimp_ui_initialized' failed
(hello:12429): Gtk-WARNING **: Screen for GtkWindow not set; you must
always set
a screen for a GtkWindow before using the window
(hello:12429): Gdk-CRITICAL **: gdk_screen_get_default_colormap:
assertion `GDK_IS_SCREEN (screen)' failed
(hello:12429): Gdk-CRITICAL **: gdk_colormap_get_visual: assertion
`GDK_IS_COLORMAP (colormap)' failed
(hello:12429): Gdk-CRITICAL **: gdk_screen_get_default_colormap:
assertion `GDK_IS_SCREEN (screen)' failed
(hello:12429): Gdk-CRITICAL **: gdk_screen_get_root_window: assertion
`GDK_IS_SCREEN (screen)' failed
(hello:12429): Gdk-CRITICAL **: gdk_screen_get_root_window: assertion
`GDK_IS_SCREEN (screen)' failed
(hello:12429): Gdk-CRITICAL **: gdk_window_new: assertion `GDK_IS_WINDOW
(parent)' failed
(hello:12429): Gdk-CRITICAL **:
gdk_window_enable_synchronized_configure: assertion `GDK_IS_WINDOW
(window)' failed
(hello:12429): Gdk-CRITICAL **: gdk_window_set_user_data: assertion
`window != NULL' failed
(hello:12429): Gtk-CRITICAL **: gtk_style_attach: assertion `window !=
NULL' failed
(hello:12429): Gtk-CRITICAL **: gtk_style_set_background: assertion
`GTK_IS_STYLE (style)' failed
(hello:12429): Gtk-CRITICAL **: gtk_paint_flat_box: assertion
`GTK_IS_STYLE (style)' failed
(hello:12429): Gdk-CRITICAL **: gdk_window_set_accept_focus: assertion
`GDK_IS_WINDOW (window)' failed
(hello:12429): Gdk-CRITICAL **: gdk_window_set_focus_on_map: assertion
`GDK_IS_WINDOW (window)' failed
(hello:12429): Gdk-CRITICAL **: gdk_window_set_modal_hint: assertion
`GDK_IS_WINDOW (window)' failed
(hello:12429): Gtk-CRITICAL **: gtk_window_realize_icon: assertion
`widget->window != NULL' failed
(hello:12429): Gtk-WARNING **: Screen for GtkWindow not set; you must
always set
a screen for a GtkWindow before using the window
(hello:12429): Gdk-CRITICAL **: gdk_window_set_geometry_hints: assertion
`GDK_IS_WINDOW (window)' failed
(hello:12429): Gdk-CRITICAL **: gdk_window_unmaximize: assertion
`GDK_IS_WINDOW (window)' failed
(hello:12429): Gdk-CRITICAL **: gdk_window_unstick: assertion
`GDK_IS_WINDOW (window)' failed
(hello:12429): Gdk-CRITICAL **: gdk_window_deiconify: assertion
`GDK_IS_WINDOW (window)' failed
(hello:12429): Gdk-CRITICAL **: gdk_window_unfullscreen: assertion
`GDK_IS_WINDOW (window)' failed
(hello:12429): Gdk-CRITICAL **: gdk_window_set_keep_above: assertion
`GDK_IS_WINDOW (window)' failed
(hello:12429): Gdk-CRITICAL **: gdk_window_set_keep_below: assertion
`GDK_IS_WINDOW (window)' failed
(hello:12429): Gdk-CRITICAL **: gdk_window_show: assertion
`GDK_IS_WINDOW (window)' failed
anyone can tell me how to fix it?
any suggestion is appreciated.
Regards,
Todong Ma.