Thread: Gtk Plug, Socket, embed one program into another.

  1. #1
    Registered User
    Join Date
    Mar 2010
    Posts
    6

    Unhappy Gtk Plug, Socket, embed one program into another.

    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)
    Code:
    {
    	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:
    Code:
     	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?
    Last edited by arkashkin; 03-26-2010 at 09:47 AM.

  2. #2
    spurious conceit MK27's Avatar
    Join Date
    Jul 2008
    Location
    segmentation fault
    Posts
    8,300
    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
    C programming resources:
    GNU C Function and Macro Index -- glibc reference manual
    The C Book -- nice online learner guide
    Current ISO draft standard
    CCAN -- new CPAN like open source library repository
    3 (different) GNU debugger tutorials: #1 -- #2 -- #3
    cpwiki -- our wiki on sourceforge

  3. #3
    Registered User
    Join Date
    Mar 2010
    Posts
    6
    Quote Originally Posted by MK27 View Post
    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
    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.
    Thank you very much for pointing me to gtk forums...

Popular pages Recent additions subscribe to a feed

Similar Threads

  1. Writing to an Output Socket in use by another program
    By maththeorylvr in forum Windows Programming
    Replies: 4
    Last Post: 10-28-2005, 12:17 PM
  2. Dikumud
    By maxorator in forum C++ Programming
    Replies: 1
    Last Post: 10-01-2005, 06:39 AM
  3. my server program auto shut down
    By hanhao in forum Networking/Device Communication
    Replies: 1
    Last Post: 03-13-2004, 10:49 PM
  4. My program, anyhelp
    By @licomb in forum C Programming
    Replies: 14
    Last Post: 08-14-2001, 10:04 PM

Tags for this Thread