Re: stringlist



Le vendredi 04 aoÃt 2006 Ã 17:51 +0200, Lars Clausen a Ãcrit :
On Fri, 2006-08-04 at 17:25 +0200, lidiriel wrote:

They should be fairly easy.  Check out pointarrayprop_load and _save in
prop_geomtypes.c, which are similar.  It's just that nobody's been using
them yet.

-Lars
I have implemented the two methods : stringlistprop_load & _save in
prop_text.c but i try to use PROP_STRINGLIST and it's not work.

This is the problem :
My object bug when i try to draw it.
The name of my object is "baygoto". I declare the structure :

typedef struct _Baygoto {
  Element element;
  ConnectionPoint connections[BAY_BAYGOTO_NUM_CNX];
  /* baygoto identifiant */
  gchar *id;
  /* Custom inner color */
  Color fill_color;
  /* Font text */
  DiaFont *font;
  GList *lst;
} Baygoto;

The element lst is the stringlist...
ok now i use the property description :
static PropDescription baygoto_props[] = {
  ELEMENT_COMMON_PROPERTIES,
  { "id", PROP_TYPE_STRING, PROP_FLAG_VISIBLE, N_("Identifier"), NULL,
NULL },
  { "lst", PROP_TYPE_STRINGLIST, 0, NULL, NULL, NULL },
  PROP_STD_FILL_COLOUR,
  PROP_DESC_END
};

and this is the offset

static PropOffset baygoto_offsets[] = {
  ELEMENT_COMMON_PROPERTIES_OFFSETS,
        { "id", PROP_TYPE_STRING, offsetof(Baygoto, id) },
        { "lst", PROP_TYPE_STRINGLIST, offsetof(Baygoto, lst) },
  { "fill_colour", PROP_TYPE_COLOUR, offsetof(Baygoto, fill_color) },
  { NULL, 0, 0}
};

at this point all code is functionnal but the list is empty so i had in
create method the piece of code for test :
gchar *name;
...     
name = "test_glist";
baygoto->lst = g_list_append(baygoto->lst,g_strdup(name));

ok now i use this and i have a core dump. with gdb i look in the
problem.
It's seem to be a problem in dia_object_default_create or just after ...

 dia_object_default_create (type=0xb6bb0ae0, startpoint=0xbff0e900,
user_data=0x0, handle1=0xbff0e914, handle2=0xbff0e910) at
object_defaults.c:283

the parameter user_data is Null (0x0) it's normal ?

OR it after dia_object_default_create ...  in free_scroll_tool ()
I go to test again for localize the problem.
Have an idea ?

Lidiriel.





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