Re: [Vala] socket in notebook



On Tue, 2014-04-01 at 23:19 +0200, Max wrote:
Hello.

I'm trying to use Gtk.Socket as a 'content' parameter to Gtk.Notebook but I hit some
problems:

Gtk.Socket sock = new Gtk.Socket();
Gtk.Label title = new Gtk.Label("Loading...");
notebook.append_page(sock, title);

However if I try to access socket_id I got SIGSEGV right away.

I realize it's a tricky to get all the show/realize for widgets in right order so I
would appreciate some concrete examples - how to properly make use of Gtk.Socket in
vala and how to obtain socket_id so I can communicate it to external program to use
with Gtk.Plug.

socket.vala:

        private static int main (string[] args) {
          Gtk.init (ref args);
        
          var win = new Gtk.Window ();
        
          var socket = new Gtk.Socket ();
          win.add (socket);
        
          win.show_all ();
          win.destroy.connect (Gtk.main_quit);
        
          GLib.message ("The ID of the sockets window is %u",
                        (uint) socket.get_id ());
        
          Gtk.main ();
        
          return 0;
        }
        
plug.vala:

        private static int main (string[] args) {
          Gtk.init (ref args);
        
          var plug = new Gtk.Plug ((X.Window) int.parse (args[1]));
        
          var label = new Gtk.Label ("Hello, world!");
          plug.add (label);
        
          plug.show_all ();
        
          Gtk.main ();
        
          return 0;
        }

Attachment: signature.asc
Description: This is a digitally signed message part



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