is GBoxed the way to wrap things like GList, GHashMap, ... [resend]



hi,

Several of my GObjects provide thgs like GList or GHashmap as readable properties. Unfortunately these properties are just gpointers. For the file-serialisation it would be nice to know whats behind the pointer. Is GBoxed the way to go? This modules has only vague docs, especially what it is for.

For GList I assume I would do:

#define MY_TYPE_BOXED_LIST my_boxed_list_get_type();

GType my_boxed_list_get_type (void)
{
  static GType type = 0;
  if (type == 0) {
    type = g_boxed_type_register_static("MyBoxedList",
        my_boxed_list_copy,my_boxed_list_free);
  }
  return type;
}

gpointer my_boxed_list_copy (GType boxed_type, gconstpointer src_boxed)
{
  return g_list_copy (src_boxed);
}

gpointer my_boxed_list_free (GType boxed_type, gpointer boxed)
{
  return g_list_free (boxed);
}

For the properties I would install a g_param_spec_boxed with the type = MY_TYPE_BOXED_LIST?

Does that makes sense? Or can anyone point me to a more complete example?

Stefan



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