Mercurial > dwindows
comparison dwtest.c @ 1873:15d24b5300ec
Third GTK3 round of changes to split string and data
in the container control.
author | bsmith@81767d24-ef19-dc11-ae90-00e081727c95 |
---|---|
date | Thu, 08 Aug 2013 20:28:57 +0000 |
parents | eae36372d64d |
children | fb137f7f91e4 |
comparison
equal
deleted
inserted
replaced
1872:eae36372d64d | 1873:15d24b5300ec |
---|---|
1187 } | 1187 } |
1188 | 1188 |
1189 void container_add(void) | 1189 void container_add(void) |
1190 { | 1190 { |
1191 char *titles[4]; | 1191 char *titles[4]; |
1192 char *names[3]; | |
1193 char buffer[100]; | 1192 char buffer[100]; |
1194 unsigned long flags[4] = { DW_CFA_BITMAPORICON | DW_CFA_LEFT | DW_CFA_HORZSEPARATOR | DW_CFA_SEPARATOR, | 1193 unsigned long flags[4] = { DW_CFA_BITMAPORICON | DW_CFA_LEFT | DW_CFA_HORZSEPARATOR | DW_CFA_SEPARATOR, |
1195 DW_CFA_ULONG | DW_CFA_RIGHT | DW_CFA_HORZSEPARATOR | DW_CFA_SEPARATOR, | 1194 DW_CFA_ULONG | DW_CFA_RIGHT | DW_CFA_HORZSEPARATOR | DW_CFA_SEPARATOR, |
1196 DW_CFA_TIME | DW_CFA_CENTER | DW_CFA_HORZSEPARATOR | DW_CFA_SEPARATOR, | 1195 DW_CFA_TIME | DW_CFA_CENTER | DW_CFA_HORZSEPARATOR | DW_CFA_SEPARATOR, |
1197 DW_CFA_DATE | DW_CFA_LEFT | DW_CFA_HORZSEPARATOR | DW_CFA_SEPARATOR }; | 1196 DW_CFA_DATE | DW_CFA_LEFT | DW_CFA_HORZSEPARATOR | DW_CFA_SEPARATOR }; |
1223 dw_container_set_stripe(container, DW_CLR_DEFAULT, DW_CLR_DEFAULT); | 1222 dw_container_set_stripe(container, DW_CLR_DEFAULT, DW_CLR_DEFAULT); |
1224 containerinfo = dw_container_alloc(container, 3); | 1223 containerinfo = dw_container_alloc(container, 3); |
1225 | 1224 |
1226 for(z=0;z<3;z++) | 1225 for(z=0;z<3;z++) |
1227 { | 1226 { |
1228 names[z] = (char *)malloc( 100 ); | 1227 char names[100]; |
1228 | |
1229 /* yes, there is a memory leak here */ | 1229 /* yes, there is a memory leak here */ |
1230 sprintf(names[z],"Don't allocate from stack: Item: %d",z); | 1230 sprintf(names, "We can now allocate from the stack: Item: %d", z); |
1231 size = z*100; | 1231 size = z*100; |
1232 sprintf(buffer, "Filename %d",z+1); | 1232 sprintf(buffer, "Filename %d",z+1); |
1233 if (z == 0 ) thisicon = foldericon; | 1233 if (z == 0 ) thisicon = foldericon; |
1234 else thisicon = fileicon; | 1234 else thisicon = fileicon; |
1235 dw_debug("Initial: container: %x containerinfo: %x icon: %x\n", DW_POINTER_TO_INT(container), | 1235 dw_debug("Initial: container: %x containerinfo: %x icon: %x\n", DW_POINTER_TO_INT(container), |
1246 date.day = z+10; | 1246 date.day = z+10; |
1247 date.month = z+10; | 1247 date.month = z+10; |
1248 date.year = z+2000; | 1248 date.year = z+2000; |
1249 dw_filesystem_set_item(container, containerinfo, 3, z, &date); | 1249 dw_filesystem_set_item(container, containerinfo, 3, z, &date); |
1250 | 1250 |
1251 dw_container_set_row_title(containerinfo, z, names[z]); | 1251 dw_container_set_row_title(containerinfo, z, names); |
1252 dw_container_set_row_data(containerinfo, z, DW_INT_TO_POINTER(z)); | 1252 dw_container_set_row_data(containerinfo, z, DW_INT_TO_POINTER(z)); |
1253 } | 1253 } |
1254 | 1254 |
1255 dw_container_insert(container, containerinfo, 3); | 1255 dw_container_insert(container, containerinfo, 3); |
1256 | 1256 |