Forum: Ruby-Gnome 2 Gtk::TreeViewColumn

Posted by Grant Schoep (matobinder)
on 2012-02-09 23:31
(Received via mailing list)
I'm still  stuck with getting a undefined sort_column_id. For a
GtkTreeViewColumn
--------

irb(main):001:0> require 'gtk2'
=> true
irb(main):002:0> column = Gtk::TreeViewColumn.new
=> #<Gtk::TreeViewColumn:0x29dbde8 ptr=0x2c32840>
irb(main):003:0> column.sort_column_id = 1
NoMethodError: undefined method `sort_column_id=' for
#<Gtk::TreeViewColumn:0x29dbde8 ptr=0x2c32840>
       from (irb):3
       from /myscratch/ruby/bin/irb:12:in `<main>'

------------

This works on older Ruby, and "the latest greatest" Ruby + Ruby/GTK

Just on this one machine I have built the interpreter on that is back
to GTK 2.10

For reference, I am using this for my own "file selector" box, as I
need to apply my own sort.  This Gtk::TreeViewColumn is my file
listing. I may not be using the best way to do it. But it seems odd it
just fails on this one build. My build base was the latest(as of
yesterday) snapshot of Ruby/GTK from Github.
Posted by Kouhei Sutou (Guest)
on 2012-02-11 01:35
(Received via mailing list)
Hi,

In <CAC6rHipdHNg0FKTOxx+-29U6YSe5pAvCuivS8v4tdv7jbbxGdg@mail.gmail.com>
  "[ruby-gnome2-devel-en] Gtk::TreeViewColumn" on Thu, 9 Feb 2012 
15:30:47 -0700,
  grant schoep <matobinder@gmail.com> wrote:

> I'm still  stuck with getting a undefined sort_column_id. For a
> GtkTreeViewColumn

Short answer: I've commited Gtk::TreeViewColumn#sort_column_id=
support code on GTK+ 2.10 into master.

Long answer:

Ruby/GTK+ generates accessors from GObject's property
information automatically. For example, GtkTreeViewColumn
(it's a C level GObject) has the "sort-column-id" property:
  http://developer.gnome.org/gtk/stable/GtkTreeViewC...

Ruby/GTK+ generates

  * Gtk::TreeViewColumn#sort_column_id
  * Gtk::TreeViewColumn#sort_column_id=
  * Gtk::TreeViewColumn#set_sort_column_id

from the property.

The above page says the "sort-column-id" property is defined
"Since 2.18". So you don't have
Gtk::TreeViewColumn#sort_column_id= with GTK+ 2.10.

I've added codes that accesse sort-column-id value by the
following functions:

  * gtk_tree_view_column_set_sort_column_id()
    http://developer.gnome.org/gtk/stable/GtkTreeViewC...
  * gtk_tree_view_column_get_sort_column_id()
    http://developer.gnome.org/gtk/stable/GtkTreeViewC...

Now you can use Gtk::TreeViewColumn#sort_column_id= with
GTK+ 2.10.


Thanks,
--
kou
Posted by Grant Schoep (matobinder)
on 2012-03-12 20:24
(Received via mailing list)
In <CAC6rHipdHNg0FKTOxx+-29U6YSe5pAvCuivS8v4tdv7jbbxGdg@mail.gmail.com>

>
Sorry for the long delay on reply. I just back to this. Thanks for the 
long
answer. Explains a lot. I see you did two different commits.

The first one allowed  me to do

 thing.set_sort_column_id(1)

But the next commit, that added the

RG_DEF_ALIAS(sort_column_id, set_sort_column_id);

Gives me the compile error:
rbgtktreeviewcolumn.c: In function 'Init_gtk_treeviewcolumn':
rbgtktreeviewcolumn.c:294: error: 'sort_column_id' undeclared (first use 
in
this function)
rbgtktreeviewcolumn.c:294: error: (Each undeclared identifier is 
reported
only once
rbgtktreeviewcolumn.c:294: error: for each function it appears in.)
rbgtktreeviewcolumn.c:294: error: 'set_sort_column_id' undeclared (first
use in this function)
Posted by Vincent Carmona (vinc-mai)
on 2012-03-13 19:24
(Received via mailing list)
Le 12 mars 2012 20:23, grant schoep <matobinder@gmail.com> a crit :

>> support code on GTK+ 2.10 into master.
>
> use in this function)
> is just $99.99! Visual Studio, SharePoint, SQL - plus HTML5, CSS3, MVC3,
> Metro Style Apps, more. Free future releases when you subscribe now!
> http://p.sf.net/sfu/learndevnow-dev2
> _______________________________________________
> ruby-gnome2-devel-en mailing list
> ruby-gnome2-devel-en@lists.sourceforge.net
> https://lists.sourceforge.net/lists/listinfo/ruby-...
>
>

Hello Kouhei, Grant

I believe it was easy to fix so I did it. Could you please check ?
Posted by Vincent Carmona (vinc-mai)
on 2012-03-14 13:27
(Received via mailing list)
Le 13 mars 2012 19:46, grant schoep <matobinder@gmail.com> a crit :
Posted by Kouhei Sutou (Guest)
on 2012-03-14 13:38
(Received via mailing list)
Hi,

In <CAENqjqfEfgbB2C-7S7qOqOYOAWqdXGzKTZYyGZc4hk8Bv-sFhQ@mail.gmail.com>
  "Re: [ruby-gnome2-devel-en] Gtk::TreeViewColumn" on Tue, 13 Mar 2012 
19:23:30 +0100,
  Vincent Carmona <vinc4mai@gmail.com> wrote:

> I believe it was easy to fix so I did it. Could you please check ?

Thanks!!!
It looks good for me too.

--
kou
Please log in before posting. Registration is free and takes only a minute.
Existing account (Switch to SSL-encrypted connection)
NEW: Do you have a Google/GoogleMail or Yahoo account? No registration required!
Log in with Google account | Log in with Yahoo account
No account? Register here.