[Vala] Retrieve Row ID from Gtk.TreeView




Hi guys,

I am fairly new to Vala and decided to learn it by implementing a tool,
which i always wished for in the GNOME desktop environment but never
found a solution that pleased me: A HTTP debugging proxy in Gtk.

I am familiar with Gtk, because i used it excessively in Python, which
is, why i am pretty clueless about the following function, that does not
behave as i would expect it to do.

I try to use the following code to retrieve a row ID which is stored in
the second column of my list_store. It always returns 0 with an error
message, that val does not hold int, what i dont understand because the
column value is gint (set in glade) and i set an int value to this
line. 


            [CCode (instance_pos = -1)]
            public void selected_request(Gtk.TreeView source){
                Gtk.TreeSelection sel = source.get_selection();
                Gtk.TreeIter selected;
                Gtk.TreeModel model;
                sel.get_selected(out model, out selected);
                model = source.get_model();
                GLib.Value val;
                model.get(selected, 1, out val);
                this.id_currently_displayed = val.get_int();
                this.render();
            }

The full code can be seen at http://github.com/grindhold/nostril

I have another question, too. I assume that this mailinglist is "one
question -> one thread"-organized, so I open another Thread for that.
(please tell me if your social protocl dictates otherwise)

Regards and thanks in advance for your help.
        Grindhold

P.S.: Vala is a great and very underrated language. I am glad, i
discovered it.

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]