Mercurial > hg > xemacs-beta
comparison src/dialog-x.c @ 436:080151679be2 r21-2-26
Import from CVS: tag r21-2-26
author | cvs |
---|---|
date | Mon, 13 Aug 2007 11:31:24 +0200 |
parents | 3ecd8885ac67 |
children | abe6d1db359e |
comparison
equal
deleted
inserted
replaced
435:53cf74a9db44 | 436:080151679be2 |
---|---|
42 { | 42 { |
43 /* !!#### This function has not been Mule-ized */ | 43 /* !!#### This function has not been Mule-ized */ |
44 widget_value *wv; | 44 widget_value *wv; |
45 int got_some; | 45 int got_some; |
46 wv = xmalloc_widget_value (); | 46 wv = xmalloc_widget_value (); |
47 wv->name = (char *) "value"; | 47 wv->name = xstrdup ("value"); |
48 got_some = lw_get_some_values (id, wv); | 48 got_some = lw_get_some_values (id, wv); |
49 if (got_some) | 49 if (got_some) |
50 { | 50 { |
51 Lisp_Object text_field_callback; | 51 Lisp_Object text_field_callback; |
52 char *text_field_value = wv->value; | 52 char *text_field_value = wv->value; |
54 if (text_field_value) | 54 if (text_field_value) |
55 { | 55 { |
56 void *tmp = LISP_TO_VOID (list2 (text_field_callback, | 56 void *tmp = LISP_TO_VOID (list2 (text_field_callback, |
57 build_string (text_field_value))); | 57 build_string (text_field_value))); |
58 popup_selection_callback (0, id, (XtPointer) tmp); | 58 popup_selection_callback (0, id, (XtPointer) tmp); |
59 xfree (text_field_value); | |
60 } | 59 } |
61 } | 60 } |
62 free_widget_value (wv); | 61 /* This code tried to optimize, newing/freeing. This is generally |
62 unsafe so we will alwats strdup and always use | |
63 free_widget_value_tree. */ | |
64 free_widget_value_tree (wv); | |
63 } | 65 } |
64 | 66 |
65 static void | 67 static void |
66 dbox_selection_callback (Widget widget, LWLIB_ID id, XtPointer client_data) | 68 dbox_selection_callback (Widget widget, LWLIB_ID id, XtPointer client_data) |
67 { | 69 { |
142 /* Also make sure that we free the partially-created widget_value | 144 /* Also make sure that we free the partially-created widget_value |
143 tree on Lisp error. */ | 145 tree on Lisp error. */ |
144 | 146 |
145 wv_closure = make_opaque_ptr (kids); | 147 wv_closure = make_opaque_ptr (kids); |
146 record_unwind_protect (widget_value_unwind, wv_closure); | 148 record_unwind_protect (widget_value_unwind, wv_closure); |
147 prev->name = (char *) "message"; | 149 prev->name = xstrdup ("message"); |
148 prev->value = xstrdup (name); | 150 prev->value = xstrdup (name); |
149 prev->enabled = 1; | 151 prev->enabled = 1; |
150 | 152 |
151 for (; !NILP (desc); desc = Fcdr (desc)) | 153 for (; !NILP (desc); desc = Fcdr (desc)) |
152 { | 154 { |
164 wv = xmalloc_widget_value (); | 166 wv = xmalloc_widget_value (); |
165 | 167 |
166 gui_item = gui_parse_item_keywords (button); | 168 gui_item = gui_parse_item_keywords (button); |
167 if (!button_item_to_widget_value (gui_item, wv, allow_text_p, 1)) | 169 if (!button_item_to_widget_value (gui_item, wv, allow_text_p, 1)) |
168 { | 170 { |
169 free_widget_value (wv); | 171 free_widget_value_tree (wv); |
170 continue; | 172 continue; |
171 } | 173 } |
172 | 174 |
173 if (wv->type == TEXT_TYPE) | 175 if (wv->type == TEXT_TYPE) |
174 { | 176 { |
176 allow_text_p = 0; /* only allow one */ | 178 allow_text_p = 0; /* only allow one */ |
177 } | 179 } |
178 else /* it's a button */ | 180 else /* it's a button */ |
179 { | 181 { |
180 allow_text_p = 0; /* only allow text field at the front */ | 182 allow_text_p = 0; /* only allow text field at the front */ |
181 wv->value = xstrdup (wv->name); /* what a mess... */ | 183 if (wv->value) xfree (wv->value); |
182 wv->name = (char *) button_names [n]; | 184 wv->value = wv->name; /* what a mess... */ |
185 wv->name = xstrdup (button_names [n]); | |
183 | 186 |
184 if (partition_seen) | 187 if (partition_seen) |
185 rbuttons++; | 188 rbuttons++; |
186 else | 189 else |
187 lbuttons++; | 190 lbuttons++; |
200 { | 203 { |
201 char type = (text_field_p ? 'P' : 'Q'); | 204 char type = (text_field_p ? 'P' : 'Q'); |
202 widget_value *dbox; | 205 widget_value *dbox; |
203 sprintf (tmp_dbox_name, "%c%dBR%d", type, lbuttons + rbuttons, rbuttons); | 206 sprintf (tmp_dbox_name, "%c%dBR%d", type, lbuttons + rbuttons, rbuttons); |
204 dbox = xmalloc_widget_value (); | 207 dbox = xmalloc_widget_value (); |
205 dbox->name = tmp_dbox_name; | 208 dbox->name = xstrdup (tmp_dbox_name); |
206 dbox->contents = kids; | 209 dbox->contents = kids; |
207 | 210 |
208 /* No more need to free the half-filled-in structures. */ | 211 /* No more need to free the half-filled-in structures. */ |
209 set_opaque_ptr (wv_closure, 0); | 212 set_opaque_ptr (wv_closure, 0); |
210 unbind_to (count, Qnil); | 213 unbind_to (count, Qnil); |