Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • SEARCH
  • Home
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 6832225
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 26, 20262026-05-26T22:49:59+00:00 2026-05-26T22:49:59+00:00

I am quite new with GtkTreeView. I am creating one single column with multiple

  • 0

I am quite new with GtkTreeView. I am creating one single column with multiple rows, and I am detecting when the user is clicking on each row (or cell in this case).

I am able to retrieve the label from the cell but it is not merely enough for what I need to do. I have a struct that contains a few extra parameters that I would like to pass along. I am currently using a callback on the whole tree, as follows:

GtkTreeSelection* selection = gtk_tree_view_get_selection(GTK_TREE_VIEW(list));
g_signal_connect(selection, "changed", G_CALLBACK(on_changed), selection);

I append rows in my TreeView. Would it be possible to create a unique signal per row where I could pass my struct as the parameter please? Otherwise, is there another way to pass data for the function? The problem is that each row has a unique struct that contains different information.

Thank you very much.

EDIT:

I had not understood all the power of the TreeView. I’ve put everything in my model now and it works just fine. Sorry guys, I now understand the model a lot better.

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-05-26T22:49:59+00:00Added an answer on May 26, 2026 at 10:49 pm

    Although you have found your answer just adding a couple of points which you might find useful:
    1. When you are connecting a callback for a signal to a widget it is redundant to pass the widget to which you are connecting the callback as data. In g_signal_connect(selection, "changed", G_CALLBACK(on_changed), selection); passing selection as data is redundant as the callback function for "changed" signature has the first parameter as GtkTreeSelection * through which you will get pointer to selection. AFAIK this is true for all the signal callbacks; you will find that there is GtkWidget * (or pointer to the object for which signal callback was connected) parameter in the callback function through which will get the object for which the signal was received.
    2. If you already didn’t know, what you found out on your own is Model-View-Controller or MVC implementation in GtkTreeView. In this pattern, the data logic, UI & input-interaction logic are separated. GtkListStore & GtkTreeStore represent the model which hold your data. Thus to add any kind of data you make use of these. The view or the UI in this case consists of GtkTreeView, GtkCellRenderer etc. And of course, you control the interactions through handling user inputs with the aid of signals & callbacks.
    Hope this helps!

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I am quite new to github. I worked on a project which has multiple
Quite new to Linq, and I'm struggling with this one. Basically I have a
Im quite new to xslt transforms and I need help with one kind of
Quite new to maven here so let me explain first what I am trying
Still quite new to Haskell.. I want to read the contents of a file,
Iam quite new to functions in SQL and I would like to create a
I'm quite new to programming, and I was wondering if there is a good
I'm quite new to subject of writting stored function for mySQL database, hence i'm
Hi I am quite new to php but i have been following some tutorials
I'm quite new to php and have been reading Larry Ullman book to develop

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.