PDA

View Full Version : Gtk Plug, Socket, embed one program into another.



arkashkin
03-26-2010, 06:06 AM
Hello,
I'm trying to embed some program into another using the plug and socket mechanism. From the examples which I have found on the Internet all the widgets of program A are placed into the plug and then the plug is connect into the socket of program B and then A appears inside B.
I'm trying to make the same as with A in Glade (program for designing gtk gui) so it would embed into some IDE, does it means I need to create a plug and move all of it's window's widgets into the plug?

Here is the original code in Glade where I want to create the plug:
glade_window_init (GladeWindow *window)

{
GladeWindowPrivate *priv;

GtkWidget *vbox;
GtkWidget *hpaned1;
GtkWidget *hpaned2;
GtkWidget *vpaned;
GtkWidget *menubar;
GtkWidget *palette;
GtkWidget *dockitem;
GtkWidget *widget;
GtkWidget *sep;
GtkAction *undo_action, *redo_action;
GtkAccelGroup *accel_group;

window->priv = priv = GLADE_WINDOW_GET_PRIVATE (window);

priv->default_path = NULL;

priv->app = glade_app_new ();

vbox = gtk_vbox_new (FALSE, 0);
gtk_container_add (GTK_CONTAINER (window), vbox);
.....................
.....................
}

So from the original code you can see that Vbox is created inside the Window and the
rest of the widgets are created inside the Vbox.

Now, I need to create a plug so I can embed this program to another.

So I have looked on a few examples to do so and they all look similar to this:

GtkWidget *plug;
plug = gtk_plug_new (win_id_of_socket);
gtk_container_add (GTK_CONTAINER (plug), vbox);
gtk_widget_show ( plug );

The Vbox is added inside the plug and all other widget are inside the Vbox.
this code is working great but I don't know how to modify Glade's code to work like this.

The problem is that in Glade's code there is a Window widget, all of Glade's code depends on it to be a Window, so I can't put the Vbox inside the plug.

Maybe some one could help me with this?

MK27
03-26-2010, 08:43 AM
Hmm, never tried this feature of gtk, will check it out.

I guess you wouldn't have this problem if you didn't use glade. I don't, so I can't really help with that.

Anyway, you might want to try the gtk forum, a lot of glade users there:

GTK+ Programming (http://www.gtkforums.com/viewforum.php?f=3)

arkashkin
03-27-2010, 01:01 AM
Hmm, never tried this feature of gtk, will check it out.

I guess you wouldn't have this problem if you didn't use glade. I don't, so I can't really help with that.

Anyway, you might want to try the gtk forum, a lot of glade users there:

GTK+ Programming (http://www.gtkforums.com/viewforum.php?f=3)

As you will see on this link, I have chosen a little difficult project for my self...
Gtk Plug, Socket, embed one program into another. (http://www.gtkforums.com/viewtopic.php?p=14627#14627)
Thank you very much for pointing me to gtk forums...