GTK+ Forums

Discussion forum for GTK+ and Programming. Ask questions, troubleshoot problems, view and post example code, or express your opinions.
It is currently Sat Dec 20, 2014 3:06 pm

All times are UTC




Post new topic Reply to topic  [ 2 posts ] 
Author Message
 Post subject: How do I get the column number in GtkTreeView version 3
PostPosted: Mon Jul 02, 2012 11:18 am 
Offline
Familiar Face

Joined: Mon Jul 02, 2012 11:04 am
Posts: 5
In Gtk+ 2, I serving the signal "row-activated" I had access to the column numbers in the following way:
Code:
void on_treeview1_row_activated(GtkTreeView *tree_view, GtkTreePath *path, GtkTreeViewColumn *column, gpointer user_data)
{
  GList *lista_kolumn;
  gint kolumna_nr;   

  lista_kolumn = gtk_tree_view_get_columns ( GTK_TREE_VIEW(column->tree_view) ) ;

  kolumna_nr = g_list_index ( lista_kolumn, (gpointer) column );

  g_printf ( "<<<Kolumna %d>>>\n", kolumna_nr ); 
}


but in Gtk+ 3 column->tree_view is private and can not get.
How do I get the column number ?


Top
 Profile  
 
 Post subject: Re: How do I get the column number in GtkTreeView version 3
PostPosted: Sat Jul 07, 2012 8:08 am 
Offline
Never Seen the Sunlight

Joined: Mon Apr 28, 2008 5:52 am
Posts: 799
Location: UK
Hi,

To get access to the Tree View from your Tree View Column you now need to use a function to get the information. Direct access to internal data in structures was deprecated a long time ago in GTK+ v2 and now removed in GTK+ v3.

The function you want is (introduced in version 2.12)
Code:
GtkWidget *         gtk_tree_view_column_get_tree_view  (GtkTreeViewColumn *tree_column);
and you example becomes
Code:
void on_treeview1_row_activated(GtkTreeView *tree_view, GtkTreePath *path, GtkTreeViewColumn *column, gpointer user_data)
{
  GList *lista_kolumn;
  gint kolumna_nr;   

  lista_kolumn = gtk_tree_view_get_columns ( GTK_TREE_VIEW( gtk_tree_view_column_get_tree_view(column) ) ) ;

  kolumna_nr = g_list_index ( lista_kolumn, (gpointer) column );

  g_printf ( "<<<Kolumna %d>>>\n", kolumna_nr );
}

_________________
E.


Top
 Profile  
 
Display posts from previous:  Sort by  
Post new topic Reply to topic  [ 2 posts ] 

All times are UTC


Who is online

Users browsing this forum: Google [Bot], Yahoo [Bot] and 4 guests


You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum
You cannot post attachments in this forum

Search for:
Jump to:  
Powered by phpBB © 2000, 2002, 2005, 2007 phpBB Group