Open osa1 opened 10 years ago
I made this change in treeview example in the repo:
diff --git a/examples/treeview/src/treeview.rs b/examples/treeview/src/treeview.rs index 39bd14f..3be128a 100644 --- a/examples/treeview/src/treeview.rs +++ b/examples/treeview/src/treeview.rs @@ -11,7 +11,11 @@ use rgtk::*; use rgtk::gtk::signals; fn append_text_column(tree: &mut gtk::TreeView) { - let column = gtk::TreeViewColumn::new().unwrap(); + let mut column = gtk::TreeViewColumn::new().unwrap(); + column.set_title("title"); + column.set_clickable(true); + let column_btn: gtk::Button = column.get_button(); + column_btn.connect(signals::Clicked::new(|| { println!("clicked"); })); let cell = gtk::CellRendererText::new().unwrap(); column.pack_start(&cell, true); column.add_attribute(&cell, "text", 0); @@ -37,7 +41,6 @@ fn main() { let left_store = gtk::ListStore::new(column_types).unwrap(); let left_model = left_store.get_model().unwrap(); left_tree.set_model(&left_model); - left_tree.set_headers_visible(false); append_text_column(&mut left_tree); for _ in range(0i, 10i) { @@ -53,7 +56,6 @@ fn main() { let right_store = gtk::TreeStore::new(column_types).unwrap(); let right_model = right_store.get_model().unwrap(); right_tree.set_model(&right_model); - right_tree.set_headers_visible(false); append_text_column(&mut right_tree); for _ in range(0i, 10i) {
This puts headers to lists and makes them clickable. The problem is handlers are not working. It's not printing anything when I click to headers.
I'm not sure if relevant but GTK/GLib prints those to stdout when I run this program:
➜ treeview git:(master) ✗ cargo run Compiling rgtk-examples v0.0.1 (file:///home/omer/rust/rgtk/examples/treeview) Running `target/treeview` (treeview:23066): GLib-GObject-CRITICAL **: g_object_ref: assertion 'G_IS_OBJECT (object)' failed (treeview:23066): GLib-GObject-WARNING **: invalid (NULL) pointer instance (treeview:23066): GLib-GObject-CRITICAL **: g_signal_connect_data: assertion 'G_TYPE_CHECK_INSTANCE (instance)' failed (treeview:23066): GLib-GObject-CRITICAL **: g_object_unref: assertion 'G_IS_OBJECT (object)' failed (treeview:23066): GLib-GObject-CRITICAL **: g_object_ref: assertion 'G_IS_OBJECT (object)' failed (treeview:23066): GLib-GObject-WARNING **: invalid (NULL) pointer instance (treeview:23066): GLib-GObject-CRITICAL **: g_signal_connect_data: assertion 'G_TYPE_CHECK_INSTANCE (instance)' failed (treeview:23066): GLib-GObject-CRITICAL **: g_object_unref: assertion 'G_IS_OBJECT (object)' failed
This is because of #120 .
I made this change in treeview example in the repo:
This puts headers to lists and makes them clickable. The problem is handlers are not working. It's not printing anything when I click to headers.
I'm not sure if relevant but GTK/GLib prints those to stdout when I run this program: