diff options
author | James Booth <boothj5@gmail.com> | 2012-11-21 21:24:10 +0000 |
---|---|---|
committer | James Booth <boothj5@gmail.com> | 2012-11-21 21:24:10 +0000 |
commit | e8b2b7196ca3f291cf68592f517a31bff18c8f83 (patch) | |
tree | ab4674ecec6a152e0b1b5ddf2091fe94a36df9c1 /src/preferences.c | |
parent | 1a909fd6eb2f1ac5fb302c1c164e346fe9050249 (diff) | |
download | profani-tty-e8b2b7196ca3f291cf68592f517a31bff18c8f83.tar.gz |
Separated colours from main preferences
Diffstat (limited to 'src/preferences.c')
-rw-r--r-- | src/preferences.c | 314 |
1 files changed, 13 insertions, 301 deletions
diff --git a/src/preferences.c b/src/preferences.c index 9bfacd88..a44af242 100644 --- a/src/preferences.c +++ b/src/preferences.c @@ -44,56 +44,6 @@ gint log_maxsize = 0; static PAutocomplete login_ac; static PAutocomplete boolean_choice_ac; -struct colour_string_t { - char *str; - NCURSES_COLOR_T colour; -}; - -static int num_colours = 9; -static struct colour_string_t colours[] = { - { "default", -1 }, - { "white", COLOR_WHITE }, - { "green", COLOR_GREEN }, - { "red", COLOR_RED }, - { "yellow", COLOR_YELLOW }, - { "blue", COLOR_BLUE }, - { "cyan", COLOR_CYAN }, - { "black", COLOR_BLACK }, - { "magenta", COLOR_MAGENTA }, -}; - -// colour preferences -static struct colours_t { - NCURSES_COLOR_T bkgnd; - NCURSES_COLOR_T titlebar; - NCURSES_COLOR_T statusbar; - NCURSES_COLOR_T titlebartext; - NCURSES_COLOR_T titlebarbrackets; - NCURSES_COLOR_T statusbartext; - NCURSES_COLOR_T statusbarbrackets; - NCURSES_COLOR_T statusbaractive; - NCURSES_COLOR_T statusbarnew; - NCURSES_COLOR_T maintext; - NCURSES_COLOR_T splashtext; - NCURSES_COLOR_T online; - NCURSES_COLOR_T away; - NCURSES_COLOR_T xa; - NCURSES_COLOR_T dnd; - NCURSES_COLOR_T chat; - NCURSES_COLOR_T offline; - NCURSES_COLOR_T typing; - NCURSES_COLOR_T gone; - NCURSES_COLOR_T error; - NCURSES_COLOR_T incoming; - NCURSES_COLOR_T roominfo; - NCURSES_COLOR_T me; - NCURSES_COLOR_T them; -} colour_prefs; - -static NCURSES_COLOR_T _lookup_colour(const char * const colour); -static void _set_colour(gchar *val, NCURSES_COLOR_T *pref, - NCURSES_COLOR_T def); -static void _load_colours(void); static void _save_prefs(void); void @@ -125,8 +75,6 @@ prefs_load(void) } free(jids); - _load_colours(); - err = NULL; log_maxsize = g_key_file_get_integer(prefs, "log", "maxsize", &err); if (err != NULL) { @@ -147,111 +95,6 @@ prefs_close(void) g_key_file_free(prefs); } -static NCURSES_COLOR_T -_lookup_colour(const char * const colour) -{ - int i; - for (i = 0; i < num_colours; i++) { - if (strcmp(colours[i].str, colour) == 0) { - return colours[i].colour; - } - } - - return -99; -} - -static void -_set_colour(gchar *val, NCURSES_COLOR_T *pref, - NCURSES_COLOR_T def) -{ - if(!val) { - *pref = def; - } else { < |