- Timestamp:
- Nov 22, 2009, 3:26:33 PM (11 years ago)
- Location:
- neercs/trunk/src
- Files:
-
- 3 edited
Legend:
- Unmodified
- Added
- Removed
-
neercs/trunk/src/configuration.c
r3998 r3999 26 26 27 27 28 struct config_line29 {30 const char name[32];31 int (*func_ptr) (const char *argv, struct screen_list * screen_list);32 };33 34 28 struct config_line *get_config(const char *name); 35 29 int set_window_manager(const char *argv, struct screen_list *screen_list); … … 42 36 int set_socket_dir(const char *argv, struct screen_list *screen_list); 43 37 int set_delay(const char *argv, struct screen_list *screen_list); 38 char* get_window_manager(struct screen_list *screen_list); 39 char* get_cube_duration(struct screen_list *screen_list); 40 char* get_thumbnails(struct screen_list *screen_list); 41 char* get_status_bar(struct screen_list *screen_list); 42 char* get_screensaver_timeout(struct screen_list *screen_list); 43 char* get_autolock_timeout(struct screen_list *screen_list); 44 char* get_lock_on_detach(struct screen_list *screen_list); 45 char* get_socket_dir(struct screen_list *screen_list); 46 char* get_delay(struct screen_list *screen_list); 47 44 48 45 49 /* Options definition and associated function pointer */ 46 50 struct config_line config_option[] = { 47 {.name = "window_manager",. func_ptr = set_window_manager},48 {.name = "cube_duration",. func_ptr = set_cube_duration},49 {.name = "thumbnails",. func_ptr = set_thumbnails},50 {.name = "status_bar",. func_ptr = set_status_bar},51 {.name = "screensaver_timeout",. func_ptr = set_screensaver_timeout},52 {.name = "autolock_timeout",. func_ptr = set_autolock_timeout},53 {.name = "lock_on_detach",. func_ptr = set_lock_on_detach},54 {.name = "socket_dir",. func_ptr = set_socket_dir},55 {.name = "delay",. func_ptr = set_delay},51 {.name = "window_manager",.set = set_window_manager, .get = get_window_manager}, 52 {.name = "cube_duration",.set = set_cube_duration, .get = get_window_manager}, 53 {.name = "thumbnails",.set = set_thumbnails, .get = get_window_manager}, 54 {.name = "status_bar",.set = set_status_bar, .get = get_window_manager}, 55 {.name = "screensaver_timeout",.set = set_screensaver_timeout, .get = get_window_manager}, 56 {.name = "autolock_timeout",.set = set_autolock_timeout, .get = get_window_manager}, 57 {.name = "lock_on_detach",.set = set_lock_on_detach, .get = get_window_manager}, 58 {.name = "socket_dir",.set = set_socket_dir, .get = get_window_manager}, 59 {.name = "delay",.set = set_delay, .get = NULL}, 56 60 57 {.name = "last",. func_ptr= NULL},61 {.name = "last",.set = NULL}, 58 62 }; 59 63 … … 344 348 if (c) 345 349 { 346 c-> func_ptr(option->value, screen_list);350 c->set((const char*)option->value, screen_list); 347 351 } 348 352 option = option->next; … … 448 452 return 0; 449 453 } 454 455 456 457 char* get_window_manager(struct screen_list *screen_list) 458 { 459 switch(screen_list->wm_type) 460 { 461 case WM_FULL: 462 return "full"; 463 case WM_CARD: 464 return "card"; 465 case WM_VSPLIT: 466 return "vsplit"; 467 case WM_HSPLIT: 468 return "hsplit"; 469 case WM_CUBE: 470 return "cube"; 471 default: 472 return "invalid"; 473 } 474 return NULL; /* Not reached */ 475 } 476 477 char* get_cube_duration(struct screen_list *screen_list) 478 { 479 char *r = malloc(100); 480 sprintf(r, "%f", (float)screen_list->cube.duration/1000000.0f); 481 return r; 482 } 483 484 char* get_thumbnails(struct screen_list *screen_list) 485 { 486 if(screen_list->mini) return "yes"; 487 return "no"; 488 } 489 490 char* get_status_bar(struct screen_list *screen_list) 491 { 492 if(screen_list->status) return "yes"; 493 return "no"; 494 } 495 496 char* get_screensaver_timeout(struct screen_list *screen_list) 497 { 498 char *r = malloc(100); 499 sprintf(r, "%f", (float)screen_list->screensaver_timeout/1000000.0f); 500 return r; 501 } 502 503 char* get_autolock_timeout(struct screen_list *screen_list) 504 { 505 char *r = malloc(100); 506 sprintf(r, "%f", (float)screen_list->autolock_timeout/1000000.0f); 507 return r; 508 } 509 510 char* get_lock_on_detach(struct screen_list *screen_list) 511 { 512 if(screen_list->lock_on_detach) return "yes"; 513 else return "no"; 514 } 515 516 char* get_socket_dir(struct screen_list *screen_list) 517 { 518 return screen_list->socket_dir; 519 } 520 521 char* get_delay(struct screen_list *screen_list) 522 { 523 char *r = malloc(100); 524 sprintf(r, "%d", screen_list->requested_delay); 525 return r; 526 } 527 528 529 -
neercs/trunk/src/help.c
r3998 r3999 75 75 caca_printf(screen_list->cv, x, y++, ""); 76 76 caca_printf(screen_list->cv, x, y++, ""); 77 caca_printf(screen_list->cv, x, y ++, "See http://caca.zoy.org/wiki/neercs for more informations");77 caca_printf(screen_list->cv, x, y, "See http://caca.zoy.org/wiki/neercs for more informations"); 78 78 } -
neercs/trunk/src/neercs.h
r3998 r3999 28 28 WM_MAX, 29 29 }; 30 31 struct option32 {33 char *key;34 char *value;35 36 struct option *next;37 };38 39 30 40 31 … … 218 209 }; 219 210 220 211 /* Configuration */ 212 struct option 213 { 214 char *key; 215 char *value; 216 217 struct option *next; 218 }; 219 struct config_line 220 { 221 const char name[32]; 222 int (*set) (const char *argv, struct screen_list * screen_list); 223 char* (*get) (struct screen_list * screen_list); 224 }; 225 226 /* Recurrents */ 221 227 struct recurrent 222 228 {
Note: See TracChangeset
for help on using the changeset viewer.