how to create a window in gimp plugin?

ForumsFor GIMP developers (read-only) ► how to create a window in gimp plugin?

Sent: 2009-07-02 08:01:16 UTC (over 2 years ago)

From: gbstack

how to create a window in gimp plugin?

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.

_______________________________________________
Gimp-developer mailing list
Gimp-developer@lists.XCF.Berkeley.EDU
https://lists.XCF.Berkeley.EDU/mailman/listinfo/gimp-developer

Sent: 2009-07-02 17:52:28 UTC (over 2 years ago)

From: Adam Turcotte

how to create a window in gimp plugin?

On Thu, Jul 2, 2009 at 2:01 AM, gbstack wrote:
> I want to create a window in gimp plugin

I'm not sure if this helps, but when I've created gimp plugins, I've
always used gimp_dialog_new () instead of gtk_window_new ().

For an example, take a look at the scale_dialog () method here:
http://gsoc.rivetsforbreakfast.com/gimp/IBFNBQH.c

Adam Turcotte

_______________________________________________
Gimp-developer mailing list
Gimp-developer@lists.XCF.Berkeley.EDU
https://lists.XCF.Berkeley.EDU/mailman/listinfo/gimp-developer

Sent: 2009-07-02 19:56:19 UTC (over 2 years ago)

From: Martin Nordholts

how to create a window in gimp plugin?

On 07/02/2009 08:01 AM, gbstack wrote:
> Hello,everybody!
>
> I want to create a window in gimp plugin,so this is my code(part of the
> plugin):
>
> any suggestion is appreciated.
>

One way that always works is looking at how other plug-ins does it, for
example:
http://git.gnome.org/cgit/gimp/tree/plug-ins/common/decompose.c

Look in/around decompose_dialog()

/ Martin

_______________________________________________
Gimp-developer mailing list
Gimp-developer@lists.XCF.Berkeley.EDU
https://lists.XCF.Berkeley.EDU/mailman/listinfo/gimp-developer

Sent: 2009-07-02 22:01:23 UTC (over 2 years ago)

From: Sven Neumann

how to create a window in gimp plugin?

Hi,

On Thu, 2009-07-02 at 14:01 +0800, gbstack wrote:
> Hello,everybody!
>
> I want to create a window in gimp plugin,so this is my code(part of the
> plugin):

Please have a look at
http://developer.gimp.org/writing-a-plug-in/1/index.html

In particular part III of this tutorial should be helpful.

Sven

_______________________________________________
Gimp-developer mailing list
Gimp-developer@lists.XCF.Berkeley.EDU
https://lists.XCF.Berkeley.EDU/mailman/listinfo/gimp-developer

Sent: 2009-07-03 07:16:00 UTC (over 2 years ago)

From: gbstack

how to create a window in gimp plugin?

Hi,
thanks for your tutorials,plugin examples and suggestions.

now it's fixed,if I use gimp_ui_init instead of gtk_init,I can create a
GtkWindow in gimp plugin now.

thank you all! :-)

Regards,
Todong Ma

_______________________________________________
Gimp-developer mailing list
Gimp-developer@lists.XCF.Berkeley.EDU
https://lists.XCF.Berkeley.EDU/mailman/listinfo/gimp-developer

Welcome!


Lost password?

Not a member? Sign up!

Random tutorials | Latest tutorials

  1. Hot Wallpaper with Flames Hot Wallpaper with Flames 52
  2. Creating an abstract chaos explosion Creating an abstract chaos explosion 10
  3. Create a simple Grunge-Stamp! Create a simple Grunge-Stamp! 7
  4. Ashes to ashes, dust to dust. Dissolve text into particles Ashes to ashes, dust to dust. Dissolve text into particles 3

Latest comments

2.6.12 crashes on startup in windows xp. 2.6.11 works fine. (2 days ago in Last stable 2.6 release: 2.6.12 has arrived)

Thank you! You really helped! The tutorial went great for me! Tha... (5 days ago in [AVATAR] Become a real Na'Vi using GIMP!)

maybe you still selected a channel or so? explicitly click a layer ... (5 days ago in Create cool rifts with translucent lights!)

Poll

Is GIMP an adequate application for you to create printed graphics like flyers, advertisments etc?

Latest forum activities

Your Ad Here

facts & numbers

gimpusers.com RSS feed

48 identi.ca followers
749 Twitter followers

powered by bitfire it services