diff options
author | Dave Davenport <qball@gmpclient.org> | 2017-01-08 16:09:24 +0100 |
---|---|---|
committer | Dave Davenport <qball@gmpclient.org> | 2017-01-08 16:09:24 +0100 |
commit | c57e7348d2e34c7eb27fafa73b40602725ea315a (patch) | |
tree | 3db8e06a1a46941fcd94244db658d35a73768e5a /source/theme.c | |
parent | 6318e5024b155d5b7383d9352ba56e464f91b3b7 (diff) |
Add some better error message. Allow -theme-str option to override part of theme
Diffstat (limited to 'source/theme.c')
-rw-r--r-- | source/theme.c | 21 |
1 files changed, 19 insertions, 2 deletions
diff --git a/source/theme.c b/source/theme.c index 2680a504..080bb1e5 100644 --- a/source/theme.c +++ b/source/theme.c @@ -789,17 +789,34 @@ void rofi_theme_convert_old_theme ( void ) } } } -void rofi_theme_parse_file ( const char *file ) +gboolean rofi_theme_parse_file ( const char *file ) { char *filename = rofi_expand_path ( file ); yyin = fopen ( filename, "rb"); if ( yyin == NULL ){ fprintf(stderr, "Failed to open file: %s: '%s'\n", filename, strerror ( errno ) ); g_free(filename); - return; + return TRUE; } + extern int str_len; + extern const char*input_str; + str_len = 0; + input_str = NULL; while ( yyparse() ); yylex_destroy(); g_free(filename); + yyin = NULL; + return FALSE; +} +gboolean rofi_theme_parse_string ( const char *string ) +{ + extern int str_len; + extern const char*input_str; + yyin = NULL; + input_str = string; + str_len = strlen ( string ); + while ( yyparse () ); + yylex_destroy(); + return TRUE; } #endif |