summaryrefslogtreecommitdiffstats
path: root/src/custom.c
Commit message (Collapse)AuthorAgeFilesLines
* src/custom.c: Mark sidebar help string "no-c-format"Lukas Fleischer2012-06-011-0/+1
| | | | | | | | This one was incorrectly detected as C format string due to the literal percent sign ("%") contained in the message. Add a comment that explicitly marks it as non-format string to avoid translation issues. Signed-off-by: Lukas Fleischer <calcurse@cryptocrack.de>
* Use our array of available date input formatsBaptiste Jonglez2012-05-311-10/+3
| | | | | Signed-off-by: Baptiste Jonglez <baptiste--git@jonglez.org> Signed-off-by: Lukas Fleischer <calcurse@cryptocrack.de>
* Give a meaning to DATE_FORMATSBaptiste Jonglez2012-05-311-1/+1
| | | | | | | | | | | It's a bit weird to consider DATE_FORMATS as part of the date input format enum, all the more so as it does not even represent the number of available formats (since those are numbered from 1). Turn DATE_FORMATS into the number of available date input formats. Signed-off-by: Baptiste Jonglez <baptiste--git@jonglez.org> Signed-off-by: Lukas Fleischer <calcurse@cryptocrack.de>
* src/custom.c: Use status_ask_simplechoice()Baptiste Jonglez2012-05-311-11/+14
| | | | | | | | | | | | | This eases up i18n somewhat, since the various date format available are used on other places as well, and thus need to be translated only once. Note that this commit incidentally fixes a small bug introduced by 38912b36: the user was able to set the date input format to a number between 1 and 5, while there are only 4 such formats available. Signed-off-by: Baptiste Jonglez <baptiste--git@jonglez.org> Signed-off-by: Lukas Fleischer <calcurse@cryptocrack.de>
* Use mvwaddstr() instead of mvwprintw()Baptiste Jonglez2012-05-311-43/+43
| | | | | | | | | | | | | When we only want to display a string at a specific place of the screen, there's no need to use the more complex mvwprintw(), use mvwaddstr() instead. This should be slightly more efficient, and, above all, it prevents weird things to happen if our string contains a '%', being interpreted as an unwanted format string. Signed-off-by: Baptiste Jonglez <baptiste--git@jonglez.org> Signed-off-by: Lukas Fleischer <calcurse@cryptocrack.de>
* Fix incorrect i18n usage for some stringsBaptiste Jonglez2012-05-251-1/+1
| | | | | | | | | | | Some strings are initialized without wrapping them in _(); instead, _() is applied on the variable when it is used. This is incorrect, since these strings don't get added to the catalog. Fix that by applying _() only once, when the string is declared. Signed-off-by: Baptiste Jonglez <baptiste--git@jonglez.org> Signed-off-by: Lukas Fleischer <calcurse@cryptocrack.de>
* Do not localize configuration optionsLukas Fleischer2012-05-231-10/+10
| | | | | | | | | The configuration options shown in the configuration menu are meant to reflect the keys used in the configuration file. The descriptions displayed alongside each option should be sufficient for non-English speakers. Signed-off-by: Lukas Fleischer <calcurse@cryptocrack.de>
* Switch to Linux kernel coding styleLukas Fleischer2012-05-211-797/+723
| | | | | | | | | | | | | | Convert our code base to adhere to Linux kernel coding style using Lindent, with the following exceptions: * Use spaces, instead of tabs, for indentation. * Use 2-character indentations (instead of 8 characters). Rationale: We currently have too much levels of indentation. Using 8-character tabs would make huge code parts unreadable. These need to be cleaned up before we can switch to 8 characters. Signed-off-by: Lukas Fleischer <calcurse@cryptocrack.de>
* Fix data type of "general.firstdayofweek"Lukas Fleischer2012-05-171-6/+7
| | | | | | | | | | | This option wasn't converted to a proper data type when it was renamed from "week_begins_on_monday" to "general.firstdayofweek". Convert the boolean option into an enumeration type that can take the values "monday" and "sunday". Also, update the documentation, add a conversion rule to the upgrade script and convert the configuration file used in the test suite. Signed-off-by: Lukas Fleischer <calcurse@cryptocrack.de>
* Update configuration dialogsLukas Fleischer2012-05-171-16/+16
| | | | | | | Rename the configuration options shown in the configuration dialogs to match the new naming scheme used in the configuration file. Signed-off-by: Lukas Fleischer <calcurse@cryptocrack.de>
* Declare several parameters/variables constantLukas Fleischer2012-05-081-7/+7
| | | | | | | | | | | | Add the "const" keyword to parameters and variables that are never modified. Most of these were spotted by "-Wwrite-strings". We cast the second parameter to execvp() explicitly as it expects a "char *const[]" where it should expect a "const char *const[]" (according to the documentation, this is due to compatibility reasons). This should be changed once we come up with a better solution. Signed-off-by: Lukas Fleischer <calcurse@cryptocrack.de>
* Mark localized string literals constantLukas Fleischer2012-04-051-11/+11
| | | | | | | Translated strings returned by gettext() are statically allocated and shouldn't be modified. Signed-off-by: Lukas Fleischer <calcurse@cryptocrack.de>
* Fix semantics of "general."{systemdialogs,progressbar}Lukas Fleischer2012-03-291-8/+8
| | | | | | | | | These were renamed from "skip_"* to *. However, we only changed syntax and didn't invert their semantic meaning. Fix this by negating the semantics of those variables. Also, negate these in the configuration file automatically when running `calcurse-upgrade`. Signed-off-by: Lukas Fleischer <calcurse@cryptocrack.de>
* Update copyright rangesLukas Fleischer2012-03-261-1/+1
| | | | | | Add 2012 to the copyright range for all source and documentation files. Signed-off-by: Lukas Fleischer <calcurse@cryptocrack.de>
* Do not strncpy() strings returned by gettext()Lukas Fleischer2012-03-121-7/+5
| | | | | | | | Translated strings returned by gettext() are statically allocated. There's no need to copy them to a buffer, we can use the pointers returned by gettext() instead. Signed-off-by: Lukas Fleischer <calcurse@cryptocrack.de>
* Avoid redundant window resets in config menuLukas Fleischer2012-03-121-1/+4
| | | | | | | There's no need to reset windows unless the layout was changed. Move wins_reset() to a separate branch to reflect this. Signed-off-by: Lukas Fleischer <calcurse@cryptocrack.de>
* Avoid redundant virtual screen updatesLukas Fleischer2012-03-121-1/+0
| | | | | | | | | | Remove some redundant wnoutrefresh() invocations. There's no need to copy a window to the virtual screen unless doupdate() is invoked immediately afterwards. This reduces flicker when browsing in the calendar panel. Signed-off-by: Lukas Fleischer <calcurse@cryptocrack.de>
* Break out configuration main menuLukas Fleischer2012-03-021-0/+55
| | | | | | | This was the only big block of code left in our main loop. Move it to a separate function, making the main loop a bit clearer. Signed-off-by: Lukas Fleischer <calcurse@cryptocrack.de>
* Revamp key bindings displayLukas Fleischer2012-03-021-15/+23
| | | | | | | | | | | | | Refactor the logic inside keys_display_bindings_bar() and remove the need to place the "show next page" key binding at the right positions. This used to be a pain to maintain, since we always had to move key bindings around when introducing a new key. Fix this by passing the actual key bindings in an array and using a separate parameter for the "show next page" key binding (which is automatically inserted at the right places from now on). Signed-off-by: Lukas Fleischer <calcurse@cryptocrack.de>
* Extract config file handlers into a separate fileLukas Fleischer2011-12-091-402/+0
| | | | | | | | We used custom_load_conf() to load the configuration file and io_save_conf() to save configuration. Move these functions, including all helpers, to a central location. Signed-off-by: Lukas Fleischer <calcurse@cryptocrack.de>
* Use a global configuration variableLukas Fleischer2011-11-141-41/+41
| | | | | | | This is one of the few valid use cases for a global variable. No need to make it pseudo-local and pass it from one function to another. Signed-off-by: Lukas Fleischer <calcurse@cryptocrack.de>
* Remove parentheses from return statementsLukas Fleischer2011-11-021-1/+1
| | | | | | | | | | | | | | No reason to use "return (x);" here. Refer to the GNU coding guidelines for details. Created using following semantic patch: @@ expression expr; @@ - return (expr); + return expr; Signed-off-by: Lukas Fleischer <calcurse@cryptocrack.de>
* Make use of the NULL macroLukas Fleischer2011-11-021-1/+1
| | | | | | | | | | | | | | | Use this constant everywhere when referring to a null pointer instead of casting 0 to various types of pointers. Created using following semantic patch: @@ type type; @@ - (type *)0 + NULL Signed-off-by: Lukas Fleischer <calcurse@cryptocrack.de>
* Do not cast unused return values to voidLukas Fleischer2011-11-021-17/+16
| | | | | | | | | | | | | | | | | | | | A small style fix that removes all remaining "(void)" casts. Using these isn't encouraged in GNU coding guidelines and doesn't serve a certain purpose, except for satisfying a few static code analysis tools. We already nuked some of these in previous patches, but this semantic patch should fix what's left: @@ identifier func; @@ - (void)func ( + func ( ...); Long lines were re-formatted manually. Signed-off-by: Lukas Fleischer <calcurse@cryptocrack.de>
* Avoid use of printf()/fprintf()Lukas Fleischer2011-11-021-5/+5
| | | | | | | | | | | | | | | | Use one of the following functions where appropriate: * puts() (whenever we print hard coded strings to stdout) * fputs() (whenever we print hard coded strings to a stream) * putchar() (whenever we print a single character to stdout) * fputc() (whenever we print a single character to a stream) * strncpy() (whenever we copy hard coded strings to a buffer) This removes the overhead introduced by the format string parser and reduces the number of false positive C-format strings spotted by xgettext(1)'s heuristics. Signed-off-by: Lukas Fleischer <calcurse@cryptocrack.de>
* Add count buffer to keys_getch()Lukas Fleischer2011-10-061-5/+5
| | | | | | | | Key commands can be prefixed with a natural number - keys_getch() will store this number in the buffer pointed to by the second parameter. Set this parameter to NULL to disable count prefixes. Signed-off-by: Lukas Fleischer <calcurse@cryptocrack.de>
* Avoid unnecessary window updatesLukas Fleischer2011-10-061-2/+2
| | | | | | | | Add a window bitmask to wins_update() and only update windows that might actually require an update in our main loop. This improves response times of the user interface a bit. Signed-off-by: Lukas Fleischer <calcurse@cryptocrack.de>
* Add configuration option to run the GC on exitLukas Fleischer2011-10-051-15/+31
| | | | | | | | If "auto_gc" is enabled, the garbage collector for note files will be run on every exit. As this is an experimental feature and may cause data loss, this is disabled by default. Signed-off-by: Lukas Fleischer <calcurse@cryptocrack.de>
* Add configuration option to notify all appointmentsLukas Fleischer2011-07-311-0/+5
| | | | | | | | If "notify-all" is enabled, all non-flagged appointments will be notified (instead of flagged ones). This is useful for users that want to be notified of everything. Signed-off-by: Lukas Fleischer <calcurse@cryptocrack.de>
* Fix configuration file backward compatibilityLukas Fleischer2011-07-291-2/+7
| | | | | | | | We kinda broke this in 6377582841118688aee13aff98c9216403582e45. All hail strsep()! Signed-off-by: Lukas Fleischer <calcurse@cryptocrack.de>
* Add hint to error messages in custom_load_conf()Lukas Fleischer2011-07-211-2/+2
| | | | | | | | Include the name of the configuration variable that issued the error in error messages that are thrown while parsing the configuration file. This makes it a lot easier to locate syntactic and semantic errors. Signed-off-by: Lukas Fleischer <calcurse@cryptocrack.de>
* Use map for configuration variable namesLukas Fleischer2011-07-211-49/+61
| | | | | | | | | Use a map instead of dozens of hardcoded conditionals. This makes configuration variable parsing more dynamic and extensible. Also, reintroduce formatting error messages that we dropped earlier. Signed-off-by: Lukas Fleischer <calcurse@cryptocrack.de>
* Return error status in custom_set_conf()Lukas Fleischer2011-07-211-14/+16
| | | | Signed-off-by: Lukas Fleischer <calcurse@cryptocrack.de>
* Rename custom_load_color() to conf_parse_color()Lukas Fleischer2011-07-211-21/+16
| | | | | | | Also, temporarily remove all error messages and return an error status instead. Signed-off-by: Lukas Fleischer <calcurse@cryptocrack.de>
* Declare foreground and background variables globalLukas Fleischer2011-07-211-6/+6
| | | | | | Removes the need to pass the terminal's default background color round. Signed-off-by: Lukas Fleischer <calcurse@cryptocrack.de>
* Refactor out integer variable parsingLukas Fleischer2011-07-211-6/+26
| | | | | | | Introduce conf_parse_unsigned() and conf_parse_int() similar to conf_parse_bool(). Signed-off-by: Lukas Fleischer <calcurse@cryptocrack.de>
* Refactor conf_parse_bool()Lukas Fleischer2011-07-211-19/+21
| | | | | | | | | | | | | * Increase size argument for strncmp() comparisons by one to include the terminating null-character (otherwise "yesfoo" would be parsed as "yes", "nobar" as "no"). * Pass destination address as an additional argument and return success/failure status to allow for better error handling. * Temporarily remove error handling (will be fixed later). Signed-off-by: Lukas Fleischer <calcurse@cryptocrack.de>
* Rename fill_config_var() to conf_parse_bool()Lukas Fleischer2011-07-211-10/+10
| | | | | | | This is a much better name as it implicitly describes that this function parses boolean configuration values only. Signed-off-by: Lukas Fleischer <calcurse@cryptocrack.de>
* Refactor out configuration variable settingLukas Fleischer2011-07-211-75/+82
| | | | | | | | Move configuration variable assignments to a new function, custom_set_conf(). This improves code readability and allows for setting configuration variables outside the configuration file loading function. Signed-off-by: Lukas Fleischer <calcurse@cryptocrack.de>
* Parse single-line configuration variablesLukas Fleischer2011-07-151-25/+33
| | | | | | | Include a fallback branch that accepts multi-line comments as well (backward compatibility). Signed-off-by: Lukas Fleischer <calcurse@cryptocrack.de>
* Be stricter when parsing the configuration fileLukas Fleischer2011-07-151-11/+6
| | | | | | | | Throw an error message if there is a line that contains an invalid configuration line (e.g. a non-empty line that neither contains a key nor a value). Signed-off-by: Lukas Fleischer <calcurse@cryptocrack.de>
* Refactor custom_load_conf()Lukas Fleischer2011-07-151-63/+49
| | | | | | | | Read key and value of each configuration setting in one loop cycle to facilitate adjustments of the configuration setting format. Also, this allows us to get rid of all the redundant variable resetting. Signed-off-by: Lukas Fleischer <calcurse@cryptocrack.de>
* Handle resize properly in the sidebar config menuLukas Fleischer2011-06-291-5/+16
| | | | | | | | | There used to be no resize handler in custom_sidebar_config() which resulted in a messed up screen if the terminal was resized during sidebar configuration. Doing a simple wins_reset() if the terminal was resized works around this problem. Signed-off-by: Lukas Fleischer <calcurse@cryptocrack.de>
* Always work with new window dimensions on resizeLukas Fleischer2011-06-281-35/+27
| | | | | | | | | | | | This one came up after improving resizing behaviour in commit fec37db06bbbdff79bc9816046a76e0b29e173b4. We used to use outdated width and height values at various places without noticing it due to the resize algorithm being called several times on every resize. This patch ensures we retrieve the new window dimensions *before* doing any layout calculations. Signed-off-by: Lukas Fleischer <calcurse@cryptocrack.de>
* Avoid redundant redraws on resizeLukas Fleischer2011-06-281-31/+41
| | | | | | | | | | Use a global flag to record whether the terminal was resized instead of redrawing everything each time a KEY_RESIZE is read. Add some additional checks to help_write_pad() as invalid actions may be passed now due to using signals instead of virtual key presses. Signed-off-by: Lukas Fleischer <calcurse@cryptocrack.de>
* Update copyright notices in source files, documentation and "COPYING".Lukas Fleischer2011-04-221-1/+1
| | | | | | | | | * Update copyright dates (use 2004-2011 as date range everywhere). * Change copyright holder from "Frederic Culot" to "calcurse Development Team". Signed-off-by: Lukas Fleischer <calcurse@cryptocrack.de>
* Fix bad use of unsigned integers.Lukas Fleischer2011-04-051-2/+3
| | | | | | | | Unsigned values should never be compared to values less than zero. Detected with "find_unsigned.cocci" spatch from http://coccinelle.lip6.fr/impact_linux.php. Signed-off-by: Lukas Fleischer <calcurse@cryptocrack.de>
* Compare pointers to "NULL" instead of "0".Lukas Fleischer2011-04-051-1/+1
| | | | | | "bad_zero.cocci" spatch from http://coccinelle.lip6.fr/impact_linux.php. Signed-off-by: Lukas Fleischer <calcurse@cryptocrack.de>
* Overall indentation fixes.Lukas Fleischer2011-03-141-397/+397
| | | | | | | Use spaces instead of tabs for source code indentation only, strip trailing whitespaces from lines. Signed-off-by: Lukas Fleischer <calcurse@cryptocrack.de>
* Update website links to match the new URL.Lukas Fleischer2011-03-041-1/+1
| | | | Signed-off-by: Lukas Fleischer <calcurse@cryptocrack.de>