[Vala] Signals of widgets created with Glade.XML



I have a glade file which places a treeview item inside a window.
I want to create a treeview object using Glade.XML:

public class Simple : GLib.Object
{
   private Gtk.TreeView treeview;
   public Simple ()
   {
        Glade.XML xml = new Glade.XML (...);
        Gtk.Window window = (Gtk.Window) xml.get_widget ("window1");
        treeview = (Gtk.TreeView) xml.get_widget ("treeview1");

        //add some data to the treeview....

        treeview.test_expand_row.connect (sample_func);
        window.show_all();
    }
    public bool sample_func (Gtk.TreeIter iter, Gtk.TreePath path)
    {
         debug ("Simple::sample_func");
         return false;
    }
}

The code above compiles with no error or warning message.
After running I can see the treeview with correct data, but when i expand a row no message is printed in terminal. I did the experiment with another signal "key_press_event", and nothing happened again. Is the problem is with function return value? (although the signal expects bool value), or somthing else?

In main window I have defined an ActionEntry and set the following as its callback function:

void sample_callback ()
{
     Simple obj = new Simple ();
}

And create a menu item for that action.
Any thing seems wrong?
thanks.



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