Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

column title button signals not working #117

Open
osa1 opened this issue Oct 21, 2014 · 1 comment
Open

column title button signals not working #117

osa1 opened this issue Oct 21, 2014 · 1 comment

Comments

@osa1
Copy link
Contributor

osa1 commented Oct 21, 2014

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
@osa1
Copy link
Contributor Author

osa1 commented Oct 22, 2014

This is because of #120 .

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant