Changeset 7869e48 for variable.c
- Timestamp:
- Jan 12, 2013, 1:43:13 PM (12 years ago)
- Children:
- e3a0d71, 4485285
- Parents:
- 4626016
- git-author:
- Jason Gross <jgross@mit.edu> (01/12/13 13:13:18)
- git-committer:
- Jason Gross <jgross@mit.edu> (01/12/13 13:43:13)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
variable.c
rd126a19 r7869e48 93 93 94 94 OWLVAR_BOOL( "logging" /* %OwlVarStub */, 0, 95 "turn personal logging on or off", 95 "turn personal logging on or off", 96 96 "If this is set to on, personal messages are\n" 97 97 "logged in the directory specified\n" … … 103 103 "If this is set to on, class messages are\n" 104 104 "logged in the directory specified\n" 105 "by the 'classlogpath' variable.\n" 105 "by the 'classlogpath' variable.\n" 106 106 "The filename in that directory is derived from\n" 107 107 "the name of the class to which the message was sent.\n" ), … … 172 172 173 173 OWLVAR_PATH( "logpath" /* %OwlVarStub */, "~/zlog/people", 174 "path for logging personal zephyrs", 174 "path for logging personal zephyrs", 175 175 "Specifies a directory which must exist.\n" 176 176 "Files will be created in the directory for each sender.\n"), … … 185 185 "This file will be logged to if 'debug' is set to 'on'.\n" 186 186 "BarnOwl will append a dot and the current process's pid to the filename."), 187 187 188 188 OWLVAR_PATH( "zsigproc" /* %OwlVarStub:zsigproc */, NULL, 189 189 "name of a program to run that will generate zsigs", … … 230 230 "turn zaway on or off", "" ), 231 231 232 OWLVAR_STRING( "zaway_msg" /* %OwlVarStub */, 232 OWLVAR_STRING( "zaway_msg" /* %OwlVarStub */, 233 233 OWL_DEFAULT_ZAWAYMSG, 234 234 "zaway msg for responding to zephyrs when away", "" ), 235 235 236 OWLVAR_STRING( "zaway_msg_default" /* %OwlVarStub */, 236 OWLVAR_STRING( "zaway_msg_default" /* %OwlVarStub */, 237 237 OWL_DEFAULT_ZAWAYMSG, 238 238 "default zaway message", "" ), … … 243 243 NULL, owl_variable_aaway_set, NULL), 244 244 245 OWLVAR_STRING( "aaway_msg" /* %OwlVarStub */, 245 OWLVAR_STRING( "aaway_msg" /* %OwlVarStub */, 246 246 OWL_DEFAULT_AAWAYMSG, 247 247 "AIM away msg for responding when away", "" ), 248 248 249 OWLVAR_STRING( "aaway_msg_default" /* %OwlVarStub */, 249 OWLVAR_STRING( "aaway_msg_default" /* %OwlVarStub */, 250 250 OWL_DEFAULT_AAWAYMSG, 251 251 "default AIM away message", "" ), 252 252 253 253 OWLVAR_STRING( "view_home" /* %OwlVarStub */, "all", 254 "home view to switch to after 'X' and 'V'", 254 "home view to switch to after 'X' and 'V'", 255 255 "SEE ALSO: view, filter\n" ), 256 256 … … 300 300 "notifications of buddies as soon as you login, set it to 0 instead."), 301 301 302 303 OWLVAR_INT_FULL( "typewinsize" /* %OwlVarStub:typwin_lines */, 302 303 OWLVAR_INT_FULL( "typewinsize" /* %OwlVarStub:typwin_lines */, 304 304 OWL_TYPWIN_SIZE, 305 "number of lines in the typing window", 305 "number of lines in the typing window", 306 306 "This specifies the height of the window at the\n" 307 307 "bottom of the screen where commands are entered\n" … … 529 529 } 530 530 531 /* note that changing the value of this will clobber 531 /* note that changing the value of this will clobber 532 532 * any user setting of this */ 533 533 int owl_variable_disable_ctrl_d_set(owl_variable *v, const void *newval) … … 541 541 owl_function_command_norv("bindkey editmulti C-d command edit:done"); 542 542 } 543 } 544 return owl_variable_int_set_default(v, newval); 543 } 544 return owl_variable_int_set_default(v, newval); 545 545 } 546 546 … … 593 593 break; 594 594 case OWL_VARIABLE_STRING: 595 if (!cur->validate_fn) 595 if (!cur->validate_fn) 596 596 cur->validate_fn = owl_variable_string_validate_default; 597 if (!cur->set_fn) 597 if (!cur->set_fn) 598 598 cur->set_fn = owl_variable_string_set_default; 599 if (!cur->set_fromstring_fn) 599 if (!cur->set_fromstring_fn) 600 600 cur->set_fromstring_fn = owl_variable_string_set_fromstring_default; 601 if (!cur->get_fn) 601 if (!cur->get_fn) 602 602 cur->get_fn = owl_variable_get_default; 603 if (!cur->get_tostring_fn) 604 cur->get_tostring_fn = owl_variable_string_get_tostring_default; 603 if (!cur->get_tostring_fn) 604 cur->get_tostring_fn = owl_variable_string_get_tostring_default; 605 605 if (!cur->delete_fn) 606 606 cur->delete_fn = owl_variable_delete_default; … … 609 609 break; 610 610 case OWL_VARIABLE_BOOL: 611 if (!cur->validate_fn) 611 if (!cur->validate_fn) 612 612 cur->validate_fn = owl_variable_bool_validate_default; 613 if (!cur->set_fn) 613 if (!cur->set_fn) 614 614 cur->set_fn = owl_variable_bool_set_default; 615 if (!cur->set_fromstring_fn) 615 if (!cur->set_fromstring_fn) 616 616 cur->set_fromstring_fn = owl_variable_bool_set_fromstring_default; 617 if (!cur->get_fn) 617 if (!cur->get_fn) 618 618 cur->get_fn = owl_variable_get_default; 619 if (!cur->get_tostring_fn) 620 cur->get_tostring_fn = owl_variable_bool_get_tostring_default; 619 if (!cur->get_tostring_fn) 620 cur->get_tostring_fn = owl_variable_bool_get_tostring_default; 621 621 if (!cur->delete_fn) 622 622 cur->delete_fn = owl_variable_delete_default; … … 625 625 break; 626 626 case OWL_VARIABLE_INT: 627 if (!cur->validate_fn) 627 if (!cur->validate_fn) 628 628 cur->validate_fn = owl_variable_int_validate_default; 629 if (!cur->set_fn) 629 if (!cur->set_fn) 630 630 cur->set_fn = owl_variable_int_set_default; 631 if (!cur->set_fromstring_fn) 631 if (!cur->set_fromstring_fn) 632 632 cur->set_fromstring_fn = owl_variable_int_set_fromstring_default; 633 if (!cur->get_fn) 633 if (!cur->get_fn) 634 634 cur->get_fn = owl_variable_get_default; 635 if (!cur->get_tostring_fn) 636 cur->get_tostring_fn = owl_variable_int_get_tostring_default; 635 if (!cur->get_tostring_fn) 636 cur->get_tostring_fn = owl_variable_int_get_tostring_default; 637 637 if (!cur->delete_fn) 638 638 cur->delete_fn = owl_variable_delete_default; … … 793 793 if (!v->set_fromstring_fn) { 794 794 if (msg) owl_function_error("Variable %s is read-only", owl_variable_get_name(v)); 795 return -1; 795 return -1; 796 796 } 797 797 if (0 != v->set_fromstring_fn(v, value)) { … … 807 807 owl_function_makemsg("%s = <null>", owl_variable_get_name(v)); 808 808 g_free(tostring); 809 } 809 } 810 810 return 0; 811 811 } 812 812 813 813 int owl_variable_set_string(owl_variable *v, const char *newval) 814 814 { … … 816 816 return v->set_fn(v, newval); 817 817 } 818 818 819 819 int owl_variable_set_int(owl_variable *v, int newval) 820 820 { … … 822 822 return v->set_fn(v, &newval); 823 823 } 824 824 825 825 int owl_variable_set_bool_on(owl_variable *v) 826 826 { … … 1035 1035 } else { 1036 1036 return g_strdup_printf("%d", *(const int*)val); 1037 } 1037 } 1038 1038 } 1039 1039 1040 1040 /* default functions for enums (a variant of integers) */ 1041 1041 1042 int owl_variable_enum_validate(const owl_variable *v, const void *newval) { 1042 int owl_variable_enum_validate(const owl_variable *v, const void *newval) { 1043 1043 char **enums; 1044 1044 int nenums, val;
Note: See TracChangeset
for help on using the changeset viewer.