Changeset 15709 for titan/plugins/weather/weather.h
- Timestamp:
- 05/14/12 20:45:22 (11 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
titan/plugins/weather/weather.h
r15707 r15709 69 69 { 70 70 changetext(tmp, fileline); 71 changename(tmp, fileline); 71 72 if(location == NULL) 72 73 location = ostrcat(location, fileline, 1, 0); … … 297 298 298 299 location = readweather(getconfig("weatherfile", NULL), weather, listbox); 300 addscreenrc(weather, listbox); 299 301 300 302 start: … … 385 387 } 386 388 387 addscreenrc(weather, listbox);388 389 drawscreen(weather, 0); 389 390 … … 401 402 if(location != NULL) 402 403 { 403 freeweather(node); node = NULL; 404 goto start; 404 struct skin* tmp = addlistbox(weather, listbox, NULL, 1); 405 if(tmp != NULL) 406 { 407 changetext(tmp, location); 408 changename(tmp, location); 409 } 405 410 } 406 411 drawscreen(weather, 0); 407 continue; 412 if(location == NULL) 413 continue; 414 free(location); location = NULL; 408 415 } 416 417 if(rcret == getrcconfigint("rcyellow", NULL)) 418 { 419 writeweather(getconfig("weatherfile", listbox); 420 continue; 421 } 422 423 if(listbox->select != NULL && rcret == getrcconfigint("rcgreen", NULL)) 424 { 425 delscreennode(weather, listbox->select->name); 426 drawscreen(weather, 0); 427 } 409 428 410 429 if(listbox->select != NULL) … … 422 441 } 423 442 443 int writeweather(const char *filename, struct skin* listbox) 444 { 445 debug(1000, "in"); 446 FILE *fd = NULL; 447 struct skin* node = listbox; 448 int ret = 0; 449 450 fd = fopen(filename, "w"); 451 if(fd == NULL) 452 { 453 perr("can't open %s", filename); 454 return 1; 455 } 456 457 while(node != NULL) 458 { 459 if(node->del == 1) 460 { 461 ret = fprintf(fd, "%s\n", node->text); 462 if(ret < 0) 463 { 464 perr("writting file %s", filename); 465 } 466 } 467 node = node->next; 468 } 469 470 fclose(fd); 471 debug(1000, "out"); 472 return 0; 473 } 474 424 475 #endif
Note: See TracChangeset
for help on using the changeset viewer.