summaryrefslogtreecommitdiffstats
path: root/source/theme.c
diff options
context:
space:
mode:
authorDave Davenport <qball@gmpclient.org>2017-03-11 17:06:06 +0100
committerDave Davenport <qball@gmpclient.org>2017-03-11 17:06:06 +0100
commitb7f4b7484ff755febb471b7c46df2a47993c1e34 (patch)
tree7e1beeca9e69931a0a3f05e52f143cebe1a7c6ad /source/theme.c
parent048d601a85089ee7a3020bc59a83be2ff0ee3296 (diff)
Some initial support for @import in theme and try to fall back when theme fails to load
Diffstat (limited to 'source/theme.c')
-rw-r--r--source/theme.c53
1 files changed, 13 insertions, 40 deletions
diff --git a/source/theme.c b/source/theme.c
index 4e33a9a1..8839128b 100644
--- a/source/theme.c
+++ b/source/theme.c
@@ -556,6 +556,18 @@ void distance_get_linestyle ( Distance d, cairo_t *draw )
}
}
+gboolean rofi_theme_is_empty ( void )
+{
+ if ( rofi_theme == NULL ) {
+ return TRUE;
+ }
+ if ( rofi_theme->properties == NULL && rofi_theme->num_widgets == 0 ) {
+ return TRUE;
+ }
+
+ return FALSE;
+}
+
#ifdef THEME_CONVERTER
static Property* rofi_theme_convert_get_color ( const char *color, const char *name )
@@ -580,7 +592,7 @@ static void rofi_theme_convert_create_property_ht ( ThemeWidget *widget )
void rofi_theme_convert_old_theme ( void )
{
if ( rofi_theme != NULL ) {
- return;
+ rofi_theme_free ( rofi_theme );
}
rofi_theme = (ThemeWidget *) g_slice_new0 ( ThemeWidget );
rofi_theme->name = g_strdup ( "Root" );
@@ -857,43 +869,4 @@ void rofi_theme_convert_old_theme ( void )
}
}
}
-gboolean rofi_theme_parse_file ( const char *file )
-{
- char *filename = rofi_expand_path ( file );
- yyin = fopen ( filename, "rb" );
- if ( yyin == NULL ) {
- char *str = g_markup_printf_escaped ( "Failed to open theme: <i>%s</i>\nError: <b>%s</b>",
- filename, strerror ( errno ) );
- rofi_add_error_message ( g_string_new ( str ) );
- g_free ( str );
- g_free ( filename );
- return TRUE;
- }
- extern int str_len;
- extern const char*input_str;
- str_len = 0;
- input_str = NULL;
- int parser_retv = yyparse ( file );
- yylex_destroy ();
- g_free ( filename );
- yyin = NULL;
- if ( parser_retv != 0 ) {
- return TRUE;
- }
- 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 );
- int parser_retv = yyparse ( string );
- yylex_destroy ();
- if ( parser_retv != 0 ) {
- return TRUE;
- }
- return FALSE;
-}
#endif