how to create a window in gimp plugin?

View: New views
5 Messages — Rating Filter:   Alert me  

how to create a window in gimp plugin?

by gbstack :: Rate this Message:

Reply to Author | View Threaded | Show Only this Message

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@...
https://lists.XCF.Berkeley.EDU/mailman/listinfo/gimp-developer

Re: how to create a window in gimp plugin?

by Adam Turcotte :: Rate this Message:

Reply to Author | View Threaded | Show Only this Message

On Thu, Jul 2, 2009 at 2:01 AM, gbstack<gbstack08@...> 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@...
https://lists.XCF.Berkeley.EDU/mailman/listinfo/gimp-developer

Re: how to create a window in gimp plugin?

by Martin Nordholts-2 :: Rate this Message:

Reply to Author | View Threaded | Show Only this Message

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@...
https://lists.XCF.Berkeley.EDU/mailman/listinfo/gimp-developer

Re: how to create a window in gimp plugin?

by Sven Neumann :: Rate this Message:

Reply to Author | View Threaded | Show Only this Message

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@...
https://lists.XCF.Berkeley.EDU/mailman/listinfo/gimp-developer

Re: how to create a window in gimp plugin?

by gbstack :: Rate this Message:

Reply to Author | View Threaded | Show Only this Message

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@...
https://lists.XCF.Berkeley.EDU/mailman/listinfo/gimp-developer