GTK+ Forums Forum Index GTK+ Forums
Discussion forum for GTK+ and Programming. Ask questions, troubleshoot problems, view and post example code, or express your opinions.
 
 FAQFAQ   SearchSearch   MemberlistMemberlist   UsergroupsUsergroups   RegisterRegister 
 ProfileProfile   Log in to check your private messagesLog in to check your private messages   Log inLog in 

GtkTreeView modified rules hint - C

 
Post new topic   Reply to topic    GTK+ Forums Forum Index -> GTK+ Example Code
Author Message
guillermohurta



Joined: 11 Mar 2008
Posts: 4

PostPosted: Wed Mar 12, 2008 2:18 am    Post subject: GtkTreeView modified rules hint - C Reply with quote

I hope somebody finds helpful this function. I use it to set my own rules hint colors:

Code: (Plaintext)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18

void
tree_data_func (GtkTreeViewColumn *col,
                    GtkCellRenderer   *renderer,
                    GtkTreeModel      *model,
                    GtkTreeIter       *iter,
                    gpointer           user_data)
{
    GtkTreePath *path = gtk_tree_model_get_path (model, iter);
    gint *ind = gtk_tree_path_get_indices (path);

    if((*ind % 2) != 0)
        g_object_set(renderer,"cell-background", "LightGreen", "cell-background-set", TRUE, NULL);
    else
        g_object_set(renderer, "cell-background-set", FALSE, NULL);
    return;
}/*tree_data_func*/


It's possible to enhance the function by receiving the color as a parameter.
I would appreciate if it is posted a better way to do this.
Back to top
Display posts from previous:   
Post new topic   Reply to topic    GTK+ Forums Forum Index -> GTK+ Example Code All times are GMT
Page 1 of 1

 


Powered by phpBB © 2001, 2005 phpBB Group
CodeBB 1.0 Beta 2
Protected by Anti-Spam ACP