Re: GSignal connect with struct *pointer



Quoted by a can full of super chickens
For `Matthias Mann <matman matman24 org>' 
On Saturday, 09 August 2003 (08:40):

    
Is it impossible to give a pointer of 'struct any_struct' to
g_signal_connect() for user data?
    

        Sure it's possible :)

    
typedef struct _MyStruct MyStruct;
    

        Change it to:


struct _MyStruct {
      GtkWidget    *treeView;
      GtkTreeStore *treeStore;
      .... some more widgets...
};
    

        And:

    
MyStruct *struct;
    

  struct = g_new0(MyStruct, 1);

  g_signal_connect(G_OBJECT(struct.treeView),
                   "row-expanded",
                   G_CALLBACK(tree_callback),
                   struct);
     

        It should work now ;)

-- 

 Leandro Pereira              (oO)           <leandro linuxmag com br>
                              /||\                  www.mindcrisis.tk

     "Alguns homens vêem as coisas como são, e dizem 'Por quê?'
    Eu sonho com as coisas que nunca foram e digo 'Por que não?'"
                        --George Bernard Shaw




[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]