Re: How to use gtk_list_store_newv()



On Monday 22 November 2004 08:18, Greg Breland wrote:

I need to build grids at runtime dynamically from XML.  Apparently
gtk_list_store_newv(gint n_columns, GType *types) is what I need instead
of the vararg version.  However, I'm completely confused by the 2nd
argument.

I tried looking for examples, but the few I found didn't explain how to
generate the array of GTypes needed.  I've tried everything I can think
of but continue to get:

warning: passing arg 2 of `gtk_list_store_newv` from incompatible
pointer type

I'm so lost on this I can't even post what I'm trying since it is just
guesses at this point.  Can anyone point me in the right direction?

Try something like:

  GType *types;
  gint      n_cols;

  n_cols = 3;
  types = g_new0 (GType, n_cols);

  types[0] = G_TYPE_UINT;
  types[1] = G_TYPE_STRING;
  types[2] = G_TYPE_WHATEVER;

  gtk_list_store_newv (n_cols, types);

  g_free (types);


Cheers
 -Tim



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