Re: [Vala] making a running a program as a child inside my program's widget.



Hi again,
I made glade to create a plug, with a socket-id which is passed through a
command argument to glade.
From looking on this example:

#!/usr/bin/python

import pygtk
pygtk.require('2.0')
import gtk,sys

Wid = 0L
if len(sys.argv) == 2:
    Wid = long(sys.argv[1])

plug = gtk.Plug(Wid)
print "Plug ID=", plug.get_id()

def embed_event(widget):
    print "I (",widget,") have just been embedded!"

plug.connect("embedded", embed_event)

entry = gtk.Entry()
entry.set_text("hello")
def entry_point(widget):
    print "You've changed my text to '%s'" % widget.get_text()

entry.connect("changed", entry_point)
plug.connect("destroy", gtk.mainquit)

plug.add(entry)
plug.show_all()

gtk.mainloop()


I understand plug is acting like the main a window ?? because the gtk.entry
is inside it and there is no window created...
I know where in the code of Glade the main window is created but if i have
understood correctly, I should convert it's main window to a plug??

*This is how Glade's main function look like:*

GtkWidget *plug;
 GladeWindow *window;
......
......
gtk_init (NULL, NULL);
......
......
int temp = atoi(argv[3]);
plug = gtk_plug_new (temp);
window = GLADE_WINDOW (glade_window_new ());

int winID = gtk_plug_get_id(plug);
printf("win_id of the plug is - %d  \n",winID);   //the plug is created and
I'm able to connect it to a socket but nothing is changed...
......
......
gtk_widget_show (GTK_WIDGET (window));
gtk_main ();
------------------------------------------------------------------------------
I have tried to do some thing like this:
gtk_container_add ( GTK_CONTAINER ( plug ), window );
but that doesn't help...
So what I'm doing wrong? I know that the problem is on the plug side(my
modification of Glade) because on the socket side of the code i use the code
that came with the example and it works well...

help...

On Sat, Mar 6, 2010 at 1:07 PM, Jan Hudec <bulb ucw cz> wrote:

On Sat, Mar 06, 2010 at 12:23:26 +0200, Arkadi Viner wrote:
I don't find any example or code for gladeui on the internet for what I
need
so I think it's much easier to go with the socket and the plug....

It would probably be a bit easier, but the result will be bigger bit more
ugly. That's because libgladeui allows you to lay out the glade widgets
individually to fit the rest of the application, which you can't do with
socket/plug.

It's mostly obvious you won't find many examples, since there are just two
users
-- glade itself and anjuta -- but it does not look too complicated. Just
create the application, give it the document, get back the widgets and put
them somewhere.

On Sat, Mar 6, 2010 at 10:23 AM, Abderrahim Kitouni <a kitouni gmail com
wrote:

Hi,

2010/3/5 Arkadi Viner <arkashkin gmail com>:
Does it has bindings for vala ?
it's just a GObject lybrary, you can easily generate bindings
automatically [1]. And even if it was some random library, you can
write bindings as you need them binding only classes/methods you need.

HTH,
Abderrahim

[1] http://live.gnome.org/Vala/Bindings


_______________________________________________
Vala-list mailing list
Vala-list gnome org
http://mail.gnome.org/mailman/listinfo/vala-list

--
                                                Jan 'Bulb' Hudec <
bulb ucw cz>



[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]