> -----Original Message----- > From: Tim Muller [mailto:[EMAIL PROTECTED] > Sent: Saturday, April 02, 2005 9:36 AM > To: gtk-app-devel-list@gnome.org > Cc: [EMAIL PROTECTED] > Subject: Re: Tree view and multiple TreeModels. > > > On Saturday 02 April 2005 14:23, MQ wrote: > > > > gtk_tree_view_get_model()? > > > > Not quite. This returns the model currently connected to the > View. But if I > > have model A and model B, how do I know which is the one returned by > > gtk_tree_view_get_model()? > > You could tag the two models with g_object_set_data(), like this: > > g_object_set_data (G_OBJECT (store1), "bla-model-num", > GINT_TO_POINTER (1)); > g_object_set_data (G_OBJECT (store2), "bla-model-num", > GINT_TO_POINTER (2)); > > and then later check with: > > gpointer data = g_object_get_data (G_OBJECT (store), "bla-model-num"); > gint bla_model_num = GPOINTER_TO_INT (data); > > switch (bla_model_num) > { > case 1: > g_print ("This is model 1\n"); > break; > case 2: > g_print ("This is model 2\n"); > break; > default: > g_assert_not_reached(); > } > > Although I guess it would be easier to just store the two > pointers somewhere > in a struct or so and do > > if (model == GTK_TREE_MODEL (foo->store1)) > { > .. > } > else if (model == GTK_TREE_MODEL (foo->store2)) > { > ... > } > > Cheers > -Tim
Thanks for the input, option #2 works well in my case :). -MQ _______________________________________________ gtk-app-devel-list mailing list gtk-app-devel-list@gnome.org http://mail.gnome.org/mailman/listinfo/gtk-app-devel-list