LinuxQuestions.org
Share your knowledge at the LQ Wiki.
Go Back   LinuxQuestions.org > Forums > Non-*NIX Forums > Programming
User Name
Password
Programming This forum is for all programming questions.
The question does not have to be directly related to Linux and any language is fair game.

Notices


Reply
  Search this Thread
Old 11-08-2005, 09:02 PM   #1
bendeco13
Member
 
Registered: Oct 2004
Distribution: Fedora 7
Posts: 232

Rep: Reputation: 30
GTK additional arguments for signals


I'm new to GTK (in c++), but I have experience in GTK for python, any ways.
I'm trying to figure out a way to pass more than one argument through signals.
Say for instance I'm trying to do this:
Code:
static void cellfunc(GtkTreeViewColumn *col, GtkCellRenderer *cell, GtkTreeModel *model, GtkTreeIter *iter, gpointer entry, string format)
{
    string path = gtk_entry_get_text(GTK_ENTRY(entry));
    string ntxt = format_file_data(filename, format);    /* User defined function */
    g_object_set(GTK_CELL_RENDERER(cell), "text", ntxt, NULL);
}
This isn't my exact code, but I figured it was the most 'barebone' version that would make my question a little easier to understand.

Given the above code, How would I go about setting up the:
gtk_tree_view_column_set_cell_data_func()
Right now I have it setup like this, but it don't work:
gtk_tree_view_column_set_cell_data_func(GTK_TREE_VIEW_COLUMN(col), GTK_CELL_RENDERER(cell), cellfunc(dataformat), GTK_ENTRY(direntry), NULL);

Basically I'm trying to pass additional arguments to the 'cellfunc' function.
Does anyone know how I would go about this.

Thanks in advance,
Bendeco
 
Old 11-09-2005, 12:10 AM   #2
paulsm4
LQ Guru
 
Registered: Mar 2004
Distribution: SusE 8.2
Posts: 5,863
Blog Entries: 1

Rep: Reputation: Disabled
Yes:

1. You can make your argument a pointer to a struct (a struct that contains your multiple items)
... or ...
2. You can declare a global variable (optionally making your argument an index for your global).
 
Old 11-09-2005, 01:04 AM   #3
bendeco13
Member
 
Registered: Oct 2004
Distribution: Fedora 7
Posts: 232

Original Poster
Rep: Reputation: 30
Quote:
1. You can make your argument a pointer to a struct (a struct that contains your multiple items)
... or ...
2. You can declare a global variable (optionally making your argument an index for your global).
I'm currently doing #2, but I'm using the functions in a seperate header file and I want it to be as universal as possible, so I was exploring for a new way to do this.
I will read into creating a struct.

Thanks for the reply.
Bendeco

I try to be as professional as possible on these forums,
BUT... I just noticed that I said "I'm currently doing #2".
HAHAHAHA

Last edited by bendeco13; 11-09-2005 at 01:06 AM.
 
  


Reply


Thread Tools Search this Thread
Search this Thread:

Advanced Search

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is Off
HTML code is Off



Similar Threads
Thread Thread Starter Forum Replies Last Post
catching signals alaios Programming 3 11-16-2007 06:05 AM
gtk signals and callback functions samel_tvom Programming 7 10-26-2005 06:03 PM
!!! about signals !!! b2na Programming 4 02-04-2005 01:34 AM
!! about signals !!! b2na General 1 01-03-2005 05:37 PM
Signals Speek Programming 2 12-24-2004 05:58 AM

LinuxQuestions.org > Forums > Non-*NIX Forums > Programming

All times are GMT -5. The time now is 03:49 PM.

Main Menu
Advertisement
My LQ
Write for LQ
LinuxQuestions.org is looking for people interested in writing Editorials, Articles, Reviews, and more. If you'd like to contribute content, let us know.
Main Menu
Syndicate
RSS1  Latest Threads
RSS1  LQ News
Twitter: @linuxquestions
Open Source Consulting | Domain Registration