diff options
author | QC <qball@gmpclient.org> | 2014-05-22 09:33:32 +0200 |
---|---|---|
committer | QC <qball@gmpclient.org> | 2014-05-22 09:33:32 +0200 |
commit | 21a0666a6e58a373106ec104015b4fc2def62f9f (patch) | |
tree | ba6f030c9e0973e99d1012521c1dec847c2f7ae4 /config/config.c | |
parent | a26cf2637d944dd88987f7571e65ec372e2ea7ef (diff) |
Cleanups and indenting.
Diffstat (limited to 'config/config.c')
-rw-r--r-- | config/config.c | 92 |
1 files changed, 5 insertions, 87 deletions
diff --git a/config/config.c b/config/config.c index 854f9437..83c019d6 100644 --- a/config/config.c +++ b/config/config.c @@ -70,92 +70,10 @@ Settings config = { // Mode of window, list (Vertical) or dmenu like (Horizontal) .hmode = FALSE, // Padding of the window. - .padding = 5, - .show_title = 1, - .y_offset = 0, - .x_offset = 0, - .fixed_num_lines = FALSE + .padding = 5, + .show_title = 1, + .y_offset = 0, + .x_offset = 0, + .fixed_num_lines = FALSE }; -/** - * Do some input validation, especially the first few could break things. - * It is good to catch them beforehand. - * - * This functions exits the program with 1 when it finds an invalid configuration. - */ -void config_sanity_check( void ) -{ - if ( config.menu_lines == 0 ) { - fprintf(stderr, "config.menu_lines is invalid. You need at least one visible line.\n"); - exit(1); - } - if ( config.menu_columns == 0 ) { - fprintf(stderr, "config.menu_columns is invalid. You need at least one visible column.\n"); - exit(1); - } - - if ( config.menu_width == 0 ) { - fprintf(stderr, "config.menu_width is invalid. You cannot have a window with no width.\n"); - exit(1); - } - - if ( !( config.location >= WL_CENTER && config.location <= WL_WEST ) ) - { - fprintf(stderr, "config.location is invalid. ( %d >= %d >= %d) does not hold.\n", - WL_WEST, config.location, WL_CENTER); - exit(1); - } - - if ( !( config.hmode == TRUE || config.hmode == FALSE ) ) - { - fprintf(stderr, "config.hmode is invalid.\n"); - exit(1); - } -} - -/** - * Print out the current configuration. - */ -void config_print( void ) -{ - printf("Windows opacity: %3d%%\n", config.window_opacity); - printf("Border width: %3d\n", config.menu_bw); - printf("Padding: %3d\n", config.padding); - printf("Width: %4d%s\n", config.menu_width, - config.menu_width > 100? "px":"%"); - printf("offset (x,y): (%2d,%2d)px\n", config.x_offset, config.y_offset); - printf("Location: "); - switch(config.location) - { - case WL_CENTER: printf(" Center\n"); break; - case WL_NORTH_WEST: printf("North West\n"); break; - case WL_NORTH: printf(" North\n"); break; - case WL_NORTH_EAST: printf("North East\n"); break; - case WL_EAST: printf(" East\n"); break; - case WL_EAST_SOUTH: printf("East South\n"); break; - case WL_SOUTH: printf(" South\n"); break; - case WL_SOUTH_WEST: printf("South West\n"); break; - case WL_WEST: printf(" West\n"); break; - default: printf(" Invalid\n"); break; - } - printf("# Lines: %3d\n", config.menu_lines); - printf("# Columns: %3d\n", config.menu_columns); - printf("Fixed number of lines: %5s\n", config.fixed_num_lines?"true":"false"); - printf("Horizontal model: %5s\n", config.hmode == TRUE?"true":"false"); - - - printf("Font: %35s\n", config.menu_font); - /* Colors */ - printf("FG Color: %7s\n", config.menu_fg); - printf("BG Color: %7s\n", config.menu_bg); - printf("Highlight FG Color: %7s\n", config.menu_hlfg); - printf("Highlight BG Color: %7s\n", config.menu_hlbg); - printf("Border color: %7s\n", config.menu_bc); - - /* Terminal */ - printf("Terminal emulator: %22s\n", config.terminal_emulator); - /* Keybindings. */ - printf("Window switcher key: %7s\n", config.window_key); - printf("Run dialog key: %7s\n", config.run_key); - printf("SSH dialog key: %7s\n", config.ssh_key); -} |