Re: How can I access gtk_tree_view declared in interface.c from callback.c ?



you have to do a

GtkTreeView *treeview1 = GTK_TREE_VIEW(lookup_widget("treeview1", 
GTK_WIDGET(menuitem)));

before you can use the treeview. as far as i know (i might be wrong) in the 
newer glade versions one cannot use the 'user_data' stuff in the callback 
functions.

the widgets aren't declared in the callback file, you have to look them up 
using a widget from the same window and 'lookup_widget' before you can use 
them.

gyözö

Hi,

I have a file interface.c where glade set up a gtk treeview named
treeview1. When in callbacks.c I try to use treeview1 I got this error:

callbacks.c: In function `on_new1_activate':
callbacks.c:56: warning: dereferencing `void *' pointer
callbacks.c:56: error: request for member `treeview1' in something not a
structure or union

This is the code:
void on_new1_activate (GtkMenuItem *menuitem, gpointer user_data)
{
      //qui devo creare un nuovo archivio.
      gchar *path = Show_File_Dialog ( FALSE );
      if (path == NULL) return;
      g_print ("Hai scelto: %s\n",path);
      switch (ChoosenArchiveType)
      {
              case 0:
              g_print ("Hai scelto: bzip2\n");
              break;
              case 1:
              g_print ("Hai scelto: rar\n");
              break;
              case 2:
              g_print ("Hai scelto: tar\n");
              break;
              case 3:
              g_print ("Hai scelto: zip\n");
              break;
              default:
              break;
      }
      g_free (path);
56:   user_data->treeview1 = NULL;    <----- here I got the error
}

Thanks for the attention,

-- 
Ginsberg's Theorem:
        (1) You can't win.
        (2) You can't break even.
        (3) You can't even quit the game.

Freeman's Commentary on Ginsberg's theorem:
        Every major philosophy that attempts to make life seem
        meaningful is based on the negation of one part of Ginsberg's
        Theorem.  To wit:

        (1) Capitalism is based on the assumption that you can win.
        (2) Socialism is based on the assumption that you can break
            even.
        (3) Mysticism is based on the assumption that you can quit the
            game.



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